This commit is contained in:
Ice
2008-08-16 22:44:50 +00:00
parent b56f2aa9ad
commit 7af7003f99
3 changed files with 453 additions and 450 deletions

View File

@@ -18,13 +18,6 @@ if (!defined('IN_PORTAL'))
exit;
}
$template->assign_vars(array(
'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
'READ_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_NEWEST_POST'),
'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'),
'S_DISPLAY_ANNOUNCEMENTS' => true,
));
$announcement = request_var('announcement', -1);
$start = request_var('ap', 0);
$start = ($start < 0) ? 0 : $start;
@@ -33,18 +26,18 @@ $start = ($start < 0) ? 0 : $start;
$portal_announcement_length = ($announcement < 0) ? $portal_config['portal_announcements_length'] : 0;
$fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_forum'], $portal_config['portal_announcements_permissions'], $portal_config['portal_number_of_announcements'], $portal_announcement_length, $portal_config['portal_announcements_day'], 'announcements', $start);
// Any announcements present? If not terminate it here.
if (sizeof($fetch_news) == 0)
{
// Any announcements present? If not terminate it here.
if (sizeof($fetch_news) == 0)
{
$template->assign_block_vars('announcements_row', array(
'S_NO_TOPICS' => true,
'S_NOT_LAST' => false
));
$template->assign_var('S_CAN_READ', false);
}
else
{
}
else
{
// Count number of posts for announcements archive, considering if permission check is dis- or enabled.
if ( $portal_config['portal_announcements_archive'] )
{
@@ -239,7 +232,6 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_foru
if ($portal_config['portal_number_of_announcements'] <> 0 && $portal_config['portal_announcements_archive'])
{
$template->assign_vars(array(
'S_TOPIC_ICONS' => $fetch_news['topic_icons'],
'AP_PAGINATION' => $pagination,
'TOTAL_ANNOUNCEMENTS' => ($total_announcements == 1) ? $user->lang['VIEW_LATEST_ANNOUNCEMENT'] : sprintf($user->lang['VIEW_LATEST_ANNOUNCEMENTS'], $total_announcements),
'AP_PAGE_NUMBER' => on_page($total_announcements, $portal_config['portal_number_of_announcements'], $start))
@@ -304,13 +296,21 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_foru
if ($portal_config['portal_number_of_announcements'] <> 0 && $portal_config['portal_announcements_archive'])
{
$template->assign_vars(array(
'S_TOPIC_ICONS' => $fetch_news['topic_icons'],
'AP_PAGINATION' => $pagination,
'TOTAL_ANNOUNCEMENTS' => ($total_announcements == 1) ? $user->lang['VIEW_LATEST_ANNOUNCEMENT'] : sprintf($user->lang['VIEW_LATEST_ANNOUNCEMENTS'], $total_announcements),
'AP_PAGE_NUMBER' => on_page($total_announcements, $portal_config['portal_number_of_announcements'], $start))
);
}
}
}
}
$template->assign_vars(array(
'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
'READ_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_NEWEST_POST'),
'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'),
'S_DISPLAY_ANNOUNCEMENTS' => true,
'S_TOPIC_ICONS' => $fetch_news['topic_icons'],
));
?>

View File

@@ -20,15 +20,6 @@ if (!defined('IN_PORTAL'))
exit;
}
$template->assign_vars(array(
'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
'READ_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_NEWEST_POST'),
'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'),
'S_NEWEST_OR_FIRST' => ( $portal_config['portal_news_show_last'] ) ? $user->lang['JUMP_NEWEST'] : $user->lang['JUMP_FIRST'],
'POSTED_BY_TEXT' => ( $portal_config['portal_news_show_last'] ) ? $user->lang['LAST_POST'] : $user->lang['POSTED'],
'S_DISPLAY_NEWS' => true,
));
$news = request_var('news', -1);
$user->add_lang('viewforum');
$start = request_var('np', 0);
@@ -39,16 +30,16 @@ $portal_news_length = ($news < 0) ? $portal_config['portal_news_length'] : 0;
$fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_config['portal_news_permissions'], $portal_config['portal_number_of_news'], $portal_news_length, 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news', $start);
// Any news present? If not terminate it here.
if (sizeof($fetch_news) == 0)
{
// Any news present? If not terminate it here.
if (sizeof($fetch_news) == 0)
{
$template->assign_block_vars('news_row', array(
'S_NO_TOPICS' => true,
'S_NOT_LAST' => false,
));
}
else
{
}
else
{
// Count number of posts for news archive, considering if permission check is dis- or enabled.
if ( $portal_config['portal_news_archive'] )
{
@@ -227,7 +218,6 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_con
if ($portal_config['portal_number_of_news'] <> 0 && $portal_config['portal_news_archive'])
{
$template->assign_vars(array(
'S_TOPIC_ICONS' => $fetch_news['topic_icons'],
'NP_PAGINATION' => $pagination,
'TOTAL_NEWS' => ($total_news == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $total_news),
'NP_PAGE_NUMBER' => on_page($total_news, $portal_config['portal_number_of_news'], $start))
@@ -293,12 +283,21 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_con
{
$template->assign_vars(array(
'NP_PAGINATION' => $pagination,
'S_TOPIC_ICONS' => $fetch_news['topic_icons'],
'TOTAL_NEWS' => ($total_news == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $total_news),
'NP_PAGE_NUMBER' => on_page($total_news, $portal_config['portal_number_of_news'], $start))
);
}
}
}
}
$template->assign_vars(array(
'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
'READ_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_NEWEST_POST'),
'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'),
'S_NEWEST_OR_FIRST' => ( $portal_config['portal_news_show_last'] ) ? $user->lang['JUMP_NEWEST'] : $user->lang['JUMP_FIRST'],
'POSTED_BY_TEXT' => ( $portal_config['portal_news_show_last'] ) ? $user->lang['LAST_POST'] : $user->lang['POSTED'],
'S_DISPLAY_NEWS' => true,
'S_TOPIC_ICONS' => $fetch_news['topic_icons'],
));
?>

View File

@@ -85,6 +85,8 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
$topic_icons = array();
$have_icons = 0;
if( $permissions == TRUE )
{
$disallow_access = array_unique(array_keys($auth->acl_getf('!f_read', true)));
@@ -137,7 +139,7 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
$topic_type = 't.topic_type = ' . POST_NORMAL;
$str_where = ( strlen($str_where) > 0 ) ? 'AND (' . trim(substr($str_where, 0, -4)) . ')' : '';
$user_link = ( $portal_config['portal_news_style'] ) ? 't.topic_poster = u.user_id' : (( $portal_config['portal_news_show_last'] ) ? 't.topic_last_poster_id = u.user_id' : 't.topic_poster = u.user_id' ) ;
$post_link = ( $portal_config['portal_news_show_last'] ) ? 't.topic_last_post_id = p.post_id' : 't.topic_first_post_id = p.post_id' ;
$post_link = ( $portal_config['portal_news_style'] ) ? 't.topic_first_post_id = p.post_id' : (( $portal_config['portal_news_show_last'] ) ? 't.topic_last_post_id = p.post_id' : 't.topic_first_post_id = p.post_id' ) ;
$topic_order = ( $portal_config['portal_news_show_last'] ) ? 't.topic_last_post_time DESC' : 't.topic_time DESC' ;
@@ -147,7 +149,7 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
$topic_type = '( t.topic_type <> ' . POST_ANNOUNCE . ' ) AND ( t.topic_type <> ' . POST_GLOBAL . ')';
$str_where = ( strlen($str_where) > 0 ) ? 'AND (' . trim(substr($str_where, 0, -4)) . ')' : '';
$user_link = ( $portal_config['portal_news_style'] ) ? 't.topic_poster = u.user_id' : (( $portal_config['portal_news_show_last'] ) ? 't.topic_last_poster_id = u.user_id' : 't.topic_poster = u.user_id' ) ;
$post_link = ( $portal_config['portal_news_show_last'] ) ? 't.topic_last_post_id = p.post_id' : 't.topic_first_post_id = p.post_id' ;
$post_link = ( $portal_config['portal_news_style'] ) ? 't.topic_first_post_id = p.post_id' : (( $portal_config['portal_news_show_last'] ) ? 't.topic_last_post_id = p.post_id' : 't.topic_first_post_id = p.post_id' ) ;
$topic_order = ( $portal_config['portal_news_show_last'] ) ? 't.topic_last_post_time DESC' : 't.topic_time DESC' ;
break;
@@ -318,11 +320,12 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
}
$topic_icons[] = $row['enable_icons'];
$have_icons = ( $row['icon_id'] > 0 ) ? 1 : $have_icons;
$posts[$i] = array_merge($posts[$i], array(
'post_text' => ap_validate($message),
'topic_id' => $row['topic_id'],
'topic_last_post_id' => $row['post_id'],
'topic_last_post_id' => $row['topic_last_post_id'],
'topic_type' => $row['topic_type'],
'topic_posted' => (isset($row['topic_posted']) && $row['topic_posted']) ? true : false,
'icon_id' => $row['icon_id'],
@@ -350,7 +353,8 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
$i++;
}
$posts['topic_icons'] = max($topic_icons);
$posts['topic_icons'] = ( max($topic_icons) > 0 && $have_icons ) ? true : false;
$posts['topic_count'] = $i;
if( $global_f < 1 )