mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-31 12:01:48 +02:00
Merge branch '3.2.x' into ticket/16159
This commit is contained in:
@@ -87,7 +87,7 @@ if (isset($_GET['e']) && !$user->data['is_registered'])
|
||||
}
|
||||
|
||||
// Permissions check
|
||||
if (!$auth->acl_gets('f_list', 'f_read', $forum_id) || ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link'] && !$auth->acl_get('f_read', $forum_id)))
|
||||
if (!$auth->acl_gets('f_list', 'f_list_topics', 'f_read', $forum_id) || ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link'] && !$auth->acl_get('f_read', $forum_id)))
|
||||
{
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
{
|
||||
@@ -161,7 +161,22 @@ $phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||
$topics_count = $phpbb_content_visibility->get_count('forum_topics', $forum_data, $forum_id);
|
||||
$start = $pagination->validate_start($start, $config['topics_per_page'], $topics_count);
|
||||
|
||||
page_header($forum_data['forum_name'] . ($start ? ' - ' . $user->lang('PAGE_TITLE_NUMBER', $pagination->get_on_page($config['topics_per_page'], $start)) : ''), true, $forum_id);
|
||||
$page_title = $forum_data['forum_name'] . ($start ? ' - ' . $user->lang('PAGE_TITLE_NUMBER', $pagination->get_on_page($config['topics_per_page'], $start)) : '');
|
||||
|
||||
/**
|
||||
* You can use this event to modify the page title of the viewforum page
|
||||
*
|
||||
* @event core.viewforum_modify_page_title
|
||||
* @var string page_title Title of the viewforum page
|
||||
* @var array forum_data Array with forum data
|
||||
* @var int forum_id The forum ID
|
||||
* @var int start Start offset used to calculate the page
|
||||
* @since 3.2.2-RC1
|
||||
*/
|
||||
$vars = array('page_title', 'forum_data', 'forum_id', 'start');
|
||||
extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_page_title', compact($vars)));
|
||||
|
||||
page_header($page_title, true, $forum_id);
|
||||
|
||||
$template->set_filenames(array(
|
||||
'body' => 'viewforum_body.html')
|
||||
@@ -181,7 +196,7 @@ if (!($forum_data['forum_type'] == FORUM_POST || (($forum_data['forum_flags'] &
|
||||
|
||||
// Ok, if someone has only list-access, we only display the forum list.
|
||||
// We also make this circumstance available to the template in case we want to display a notice. ;)
|
||||
if (!$auth->acl_get('f_read', $forum_id))
|
||||
if (!$auth->acl_gets('f_read', 'f_list_topics', $forum_id))
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_NO_READ_ACCESS' => true,
|
||||
@@ -270,6 +285,20 @@ $limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7
|
||||
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
|
||||
$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 'LOWER(t.topic_title)', 'v' => 't.topic_views');
|
||||
|
||||
/**
|
||||
* Modify the topic ordering if needed
|
||||
*
|
||||
* @event core.viewforum_modify_topic_ordering
|
||||
* @var array sort_by_text Topic ordering options
|
||||
* @var array sort_by_sql Topic orderings options SQL equivalent
|
||||
* @since 3.2.5-RC1
|
||||
*/
|
||||
$vars = array(
|
||||
'sort_by_text',
|
||||
'sort_by_sql',
|
||||
);
|
||||
extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topic_ordering', compact($vars)));
|
||||
|
||||
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
|
||||
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir);
|
||||
|
||||
@@ -385,7 +414,7 @@ $template->assign_vars(array(
|
||||
'S_SELECT_SORT_DIR' => $s_sort_dir,
|
||||
'S_SELECT_SORT_KEY' => $s_sort_key,
|
||||
'S_SELECT_SORT_DAYS' => $s_limit_days,
|
||||
'S_TOPIC_ICONS' => ($s_display_active && sizeof($active_forum_ary)) ? max($active_forum_ary['enable_icons']) : (($forum_data['enable_icons']) ? true : false),
|
||||
'S_TOPIC_ICONS' => ($s_display_active && count($active_forum_ary)) ? max($active_forum_ary['enable_icons']) : (($forum_data['enable_icons']) ? true : false),
|
||||
'U_WATCH_FORUM_LINK' => $s_watching_forum['link'],
|
||||
'U_WATCH_FORUM_TOGGLE' => $s_watching_forum['link_toggle'],
|
||||
'S_WATCH_FORUM_TITLE' => $s_watching_forum['title'],
|
||||
@@ -395,7 +424,7 @@ $template->assign_vars(array(
|
||||
'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false,
|
||||
'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx"),
|
||||
'S_SEARCH_LOCAL_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields),
|
||||
'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && sizeof($moderators[$forum_id]) > 1) ? false : true,
|
||||
'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && count($moderators[$forum_id]) > 1) ? false : true,
|
||||
'S_IS_LOCKED' => ($forum_data['forum_status'] == ITEM_LOCKED) ? true : false,
|
||||
'S_VIEWFORUM' => true,
|
||||
|
||||
@@ -465,7 +494,7 @@ if ($user->data['is_registered'])
|
||||
$sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id']);
|
||||
$sql_array['SELECT'] .= ', tt.mark_time';
|
||||
|
||||
if ($s_display_active && sizeof($active_forum_ary))
|
||||
if ($s_display_active && count($active_forum_ary))
|
||||
{
|
||||
$sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id']);
|
||||
$sql_array['SELECT'] .= ', ft.mark_time AS forum_mark_time';
|
||||
@@ -491,7 +520,7 @@ if ($forum_data['forum_type'] == FORUM_POST)
|
||||
|
||||
'WHERE' => '(t.forum_id = ' . $forum_id . '
|
||||
AND t.topic_type = ' . POST_ANNOUNCE . ') OR
|
||||
(' . $db->sql_in_set('t.forum_id', $g_forum_ary) . '
|
||||
(' . $db->sql_in_set('t.forum_id', $g_forum_ary, false, true) . '
|
||||
AND t.topic_type = ' . POST_GLOBAL . ')',
|
||||
|
||||
'ORDER_BY' => 't.topic_time DESC',
|
||||
@@ -523,7 +552,7 @@ if ($forum_data['forum_type'] == FORUM_POST)
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['topic_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $row['forum_id']))
|
||||
if (!$phpbb_content_visibility->is_visible('topic', $row['forum_id'], $row))
|
||||
{
|
||||
// Do not display announcements that are waiting for approval or soft deleted.
|
||||
continue;
|
||||
@@ -573,8 +602,8 @@ if ($start > $topics_count / 2)
|
||||
// Select the sort order
|
||||
$direction = (($sort_dir == 'd') ? 'ASC' : 'DESC');
|
||||
|
||||
$sql_limit = $pagination->reverse_limit($start, $sql_limit, $topics_count - sizeof($announcement_list));
|
||||
$sql_start = $pagination->reverse_start($start, $sql_limit, $topics_count - sizeof($announcement_list));
|
||||
$sql_limit = $pagination->reverse_limit($start, $sql_limit, $topics_count - count($announcement_list));
|
||||
$sql_start = $pagination->reverse_start($start, $sql_limit, $topics_count - count($announcement_list));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -583,6 +612,18 @@ else
|
||||
$sql_start = $start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify the topics sort ordering if needed
|
||||
*
|
||||
* @event core.viewforum_modify_sort_direction
|
||||
* @var string direction Topics sort order
|
||||
* @since 3.2.5-RC1
|
||||
*/
|
||||
$vars = array(
|
||||
'direction',
|
||||
);
|
||||
extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_sort_direction', compact($vars)));
|
||||
|
||||
if (is_array($sort_by_sql[$sort_key]))
|
||||
{
|
||||
$sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction;
|
||||
@@ -592,7 +633,7 @@ else
|
||||
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction;
|
||||
}
|
||||
|
||||
if ($forum_data['forum_type'] == FORUM_POST || !sizeof($active_forum_ary))
|
||||
if ($forum_data['forum_type'] == FORUM_POST || !count($active_forum_ary))
|
||||
{
|
||||
$sql_where = 't.forum_id = ' . $forum_id;
|
||||
}
|
||||
@@ -603,7 +644,7 @@ else if (empty($active_forum_ary['exclude_forum_id']))
|
||||
else
|
||||
{
|
||||
$get_forum_ids = array_diff($active_forum_ary['forum_id'], $active_forum_ary['exclude_forum_id']);
|
||||
$sql_where = (sizeof($get_forum_ids)) ? $db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id;
|
||||
$sql_where = (count($get_forum_ids)) ? $db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id;
|
||||
}
|
||||
|
||||
// Grab just the sorted topic ids
|
||||
@@ -662,7 +703,7 @@ $db->sql_freeresult($result);
|
||||
// For storing shadow topics
|
||||
$shadow_topic_list = array();
|
||||
|
||||
if (sizeof($topic_list))
|
||||
if (count($topic_list))
|
||||
{
|
||||
// SQL array for obtaining topics/stickies
|
||||
$sql_array = array(
|
||||
@@ -692,7 +733,7 @@ if (sizeof($topic_list))
|
||||
}
|
||||
|
||||
// If we have some shadow topics, update the rowset to reflect their topic information
|
||||
if (sizeof($shadow_topic_list))
|
||||
if (count($shadow_topic_list))
|
||||
{
|
||||
// SQL array for obtaining shadow topics
|
||||
$sql_array = array(
|
||||
@@ -732,7 +773,7 @@ if (sizeof($shadow_topic_list))
|
||||
}
|
||||
|
||||
// Do not include those topics the user has no permission to access
|
||||
if (!$auth->acl_get('f_read', $row['forum_id']))
|
||||
if (!$auth->acl_gets('f_read', 'f_list_topics', $row['forum_id']))
|
||||
{
|
||||
// We need to remove any trace regarding this topic. :)
|
||||
unset($rowset[$orig_topic_id]);
|
||||
@@ -767,7 +808,7 @@ if ($s_display_active)
|
||||
|
||||
// We need to remove the global announcements from the forums total topic count,
|
||||
// otherwise the number is different from the one on the forum list
|
||||
$total_topic_count = $topics_count - sizeof($announcement_list);
|
||||
$total_topic_count = $topics_count - count($announcement_list);
|
||||
|
||||
$base_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''));
|
||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_topic_count, $config['topics_per_page'], $start);
|
||||
@@ -794,7 +835,7 @@ $vars = array('topic_list', 'rowset', 'total_topic_count', 'forum_id');
|
||||
extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topics_data', compact($vars)));
|
||||
|
||||
// Okay, lets dump out the page ...
|
||||
if (sizeof($topic_list))
|
||||
if (count($topic_list))
|
||||
{
|
||||
$mark_forum_read = true;
|
||||
$mark_time_forum = 0;
|
||||
@@ -875,7 +916,7 @@ if (sizeof($topic_list))
|
||||
|
||||
// Generate all the URIs ...
|
||||
$view_topic_url_params = 'f=' . $row['forum_id'] . '&t=' . $topic_id;
|
||||
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
|
||||
$view_topic_url = $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params) : false;
|
||||
|
||||
$topic_unapproved = (($row['topic_visibility'] == ITEM_UNAPPROVED || $row['topic_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $row['forum_id']));
|
||||
$posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $row['forum_id']));
|
||||
@@ -932,8 +973,8 @@ if (sizeof($topic_list))
|
||||
'S_TOPIC_LOCKED' => ($row['topic_status'] == ITEM_LOCKED) ? true : false,
|
||||
'S_TOPIC_MOVED' => ($row['topic_status'] == ITEM_MOVED) ? true : false,
|
||||
|
||||
'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&view=unread') . '#unread',
|
||||
'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
|
||||
'U_NEWEST_POST' => $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&view=unread') . '#unread' : false,
|
||||
'U_LAST_POST' => $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'] : false,
|
||||
'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
|
||||
'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
|
||||
'U_VIEW_TOPIC' => $view_topic_url,
|
||||
@@ -1010,7 +1051,7 @@ extract($phpbb_dispatcher->trigger_event('core.viewforum_generate_page_after', c
|
||||
// on all topics (as we do in 2.0.x). It looks for unread or new topics, if it doesn't find
|
||||
// any it updates the forum last read cookie. This requires that the user visit the forum
|
||||
// after reading a topic
|
||||
if ($forum_data['forum_type'] == FORUM_POST && sizeof($topic_list) && $mark_forum_read)
|
||||
if ($forum_data['forum_type'] == FORUM_POST && count($topic_list) && $mark_forum_read)
|
||||
{
|
||||
update_forum_tracking_info($forum_id, $forum_data['forum_last_post_time'], false, $mark_time_forum);
|
||||
}
|
||||
|
Reference in New Issue
Block a user