From b5544b2f471ce4c93b08d19919ab062725545ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gae=CC=88tan=20Muller?= Date: Sat, 3 Jan 2015 11:39:29 +0100 Subject: [ticket/13450] Type-hint return value of $phpbb_container->get() PHPBB3-13450 --- phpBB/includes/functions_display.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 31cf43e599..2810a23c05 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -153,6 +153,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_tracking_info = array(); $branch_root_id = $root_data['forum_id']; + /* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); while ($row = $db->sql_fetchrow($result)) @@ -1134,6 +1135,7 @@ function display_user_activity(&$userdata) $active_f_row = $active_t_row = array(); if (!empty($forum_ary)) { + /* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); // Obtain active forum -- cgit v1.2.1 From f6e06da4c68917dafb057bf7fe19f884a3e148c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gae=CC=88tan=20Muller?= Date: Sun, 4 Jan 2015 20:41:04 +0100 Subject: [ticket/13455] Update calls to `request_var()` PHPBB3-13455 --- phpBB/includes/functions_display.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 2810a23c05..1d208a272b 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -33,7 +33,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $sql_from = ''; // Mark forums read? - $mark_read = request_var('mark', ''); + $mark_read = $request->variable('mark', ''); if ($mark_read == 'all') { @@ -61,9 +61,9 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $redirect = build_url(array('mark', 'hash', 'mark_time')); meta_refresh(3, $redirect); - if (check_link_hash(request_var('hash', ''), 'global')) + if (check_link_hash($request->variable('hash', ''), 'global')) { - markread('all', false, false, request_var('mark_time', 0)); + markread('all', false, false, $request->variable('mark_time', 0)); if ($request->is_ajax()) { @@ -334,10 +334,10 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod if ($mark_read == 'forums') { $redirect = build_url(array('mark', 'hash', 'mark_time')); - $token = request_var('hash', ''); + $token = $request->variable('hash', ''); if (check_link_hash($token, 'global')) { - markread('topics', $forum_ids, false, request_var('mark_time', 0)); + markread('topics', $forum_ids, false, $request->variable('mark_time', 0)); $message = sprintf($user->lang['RETURN_FORUM'], '', ''); meta_refresh(3, $redirect); @@ -1267,8 +1267,8 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, { if (isset($_GET['unwatch'])) { - $uid = request_var('uid', 0); - $token = request_var('hash', ''); + $uid = $request->variable('uid', 0); + $token = $request->variable('hash', ''); if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true)) { @@ -1341,8 +1341,8 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, { if (isset($_GET['watch'])) { - $uid = request_var('uid', 0); - $token = request_var('hash', ''); + $uid = $request->variable('uid', 0); + $token = $request->variable('hash', ''); if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true)) { -- cgit v1.2.1 From a089ff5eb0dcdab83c6c2e64cb0e7cb618aec41f Mon Sep 17 00:00:00 2001 From: MateBartus Date: Wed, 25 Feb 2015 21:13:20 +0100 Subject: [ticket/13654] Moving reporting into controller Moving report.php's content into different services and controllers to better comply with the MVC model. Also implementing: * Replacement for reasons_display() * Adding assign_meta_refresh_var() to \controller\helper * Adding separate routes for easy configuration * Updating unit tests to expect to correct results * Add BC tests PHPBB3-13654 --- phpBB/includes/functions_display.php | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index a6c9c529d6..64d20924d9 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1097,33 +1097,14 @@ function display_custom_bbcodes() /** * Display reasons +* +* @deprecated 3.2.0-dev */ function display_reasons($reason_id = 0) { - global $db, $user, $template; - - $sql = 'SELECT * - FROM ' . REPORTS_REASONS_TABLE . ' - ORDER BY reason_order ASC'; - $result = $db->sql_query($sql); + global $phpbb_container; - while ($row = $db->sql_fetchrow($result)) - { - // If the reason is defined within the language file, we will use the localized version, else just use the database entry... - if (isset($user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) - { - $row['reason_description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]; - $row['reason_title'] = $user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]; - } - - $template->assign_block_vars('reason', array( - 'ID' => $row['reason_id'], - 'TITLE' => $row['reason_title'], - 'DESCRIPTION' => $row['reason_description'], - 'S_SELECTED' => ($row['reason_id'] == $reason_id) ? true : false) - ); - } - $db->sql_freeresult($result); + $phpbb_container->get('phpbb.report.report_reason_list_provider')->display_reasons($reason_id); } /** -- cgit v1.2.1 From 185fbe41c954640a0aa5632b541055005ef776c2 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Thu, 28 May 2015 17:31:21 +0200 Subject: [ticket/12143] Replace group name output So now we can use translated group names for non-special groups PHPBB3-12143 --- phpBB/includes/functions_display.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 3a96119dbe..c53a9f3bc0 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -886,6 +886,7 @@ function get_forum_parents(&$forum_data) function get_moderators(&$forum_moderators, $forum_id = false) { global $config, $template, $db, $phpbb_root_path, $phpEx, $user, $auth; + global $phpbb_container; $forum_id_ary = array(); @@ -921,6 +922,9 @@ function get_moderators(&$forum_moderators, $forum_id = false) 'WHERE' => 'm.display_on_index = 1', ); + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + // We query every forum here because for caching we should not have any parameter. $sql = $db->sql_build_query('SELECT', $sql_array); $result = $db->sql_query($sql, 3600); @@ -940,7 +944,7 @@ function get_moderators(&$forum_moderators, $forum_id = false) } else { - $group_name = (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']); + $group_name = $group_helper->get_name($row['group_name']); if ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')) { -- cgit v1.2.1 From f3e2bd9273e69445923c940b4588c8e4a7fdf1db Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 12 Oct 2015 18:50:14 +0200 Subject: [ticket/14234] Replace more references with variables PHPBB3-14234 --- phpBB/includes/functions_display.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 3d61b5c098..0143a2b9ab 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -438,15 +438,14 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod * * @event core.display_forums_modify_category_template_vars * @var array cat_row Template data of the 'category' - * @var bool catless The flag indicating whether the 'category' has a parent category * @var bool last_catless The flag indicating whether the last forum had a parent category * @var array root_data Array with the root forum data * @var array row The data of the 'category' * @since 3.1.0-RC4 + * @change 3.1.7-RC1 Removed undefined catless variable */ $vars = array( 'cat_row', - 'catless', 'last_catless', 'root_data', 'row', @@ -811,25 +810,29 @@ function generate_forum_nav(&$forum_data) 'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_data['forum_type'] == FORUM_POST && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data['forum_options'])) ? true : false, ); + $forum_data_ary = $forum_data; /** * Event to modify the navlinks text * * @event core.generate_forum_nav - * @var array forum_data Array with the forum data + * @var array forum_data_ary Array with the forum data * @var array forum_template_data Array with generic forum template data * @var string microdata_attr The microdata attribute * @var array navlinks_parents Array with the forum parents navlinks data * @var array navlinks Array with the forum navlinks data * @since 3.1.5-RC1 + * @change 3.2.0-a1 Replaced forum_data with forum_data_ary */ $vars = array( - 'forum_data', + 'forum_data_ary', 'forum_template_data', 'microdata_attr', 'navlinks_parents', 'navlinks', ); extract($phpbb_dispatcher->trigger_event('core.generate_forum_nav', compact($vars))); + $forum_data = $forum_data_ary; + unset($forum_data_ary); $template->assign_block_vars_array('navlinks', $navlinks_parents); $template->assign_block_vars('navlinks', $navlinks); @@ -1237,17 +1240,21 @@ function display_user_activity(&$userdata) } } + $userdata_ary = $userdata; /** * Alter list of forums and topics to display as active * * @event core.display_user_activity_modify_actives - * @var array userdata User's data + * @var array userdata_ary User's data * @var array active_f_row List of active forums * @var array active_t_row List of active posts * @since 3.1.0-RC3 + * @change 3.1.7-RC1 Replaced userdata with userdata_ary */ - $vars = array('userdata', 'active_f_row', 'active_t_row'); + $vars = array('userdata_ary', 'active_f_row', 'active_t_row'); extract($phpbb_dispatcher->trigger_event('core.display_user_activity_modify_actives', compact($vars))); + $userdata = $userdata_ary; + unset($userdata_ary); $userdata['active_t_row'] = $active_t_row; $userdata['active_f_row'] = $active_f_row; -- cgit v1.2.1 From 578ee077c114f63a6de0c277669ba91bd9f1219f Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 12 Oct 2015 19:26:59 +0200 Subject: [ticket/14234] Fix change version and remove more references PHPBB3-14234 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 0143a2b9ab..9e45f32689 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1249,7 +1249,7 @@ function display_user_activity(&$userdata) * @var array active_f_row List of active forums * @var array active_t_row List of active posts * @since 3.1.0-RC3 - * @change 3.1.7-RC1 Replaced userdata with userdata_ary + * @change 3.2.0-a1 Replaced userdata with userdata_ary */ $vars = array('userdata_ary', 'active_f_row', 'active_t_row'); extract($phpbb_dispatcher->trigger_event('core.display_user_activity_modify_actives', compact($vars))); -- cgit v1.2.1 From 065b0a632f308366c7383a322c620b7f2db7b97d Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Mon, 30 Nov 2015 18:05:46 +0100 Subject: [ticket/14325] Preserve event variable BC PHPBB3-14325 --- phpBB/includes/functions_display.php | 68 +++++++++++++++++------------------- 1 file changed, 33 insertions(+), 35 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 9e45f32689..e3412c9875 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -750,12 +750,12 @@ function generate_forum_rules(&$forum_data) * Create forum navigation links for given forum, create parent * list if currently null, assign basic forum info to template */ -function generate_forum_nav(&$forum_data) +function generate_forum_nav(&$forum_data_ary) { global $db, $user, $template, $auth, $config; global $phpEx, $phpbb_root_path, $phpbb_dispatcher; - if (!$auth->acl_get('f_list', $forum_data['forum_id'])) + if (!$auth->acl_get('f_list', $forum_data_ary['forum_id'])) { return; } @@ -763,7 +763,7 @@ function generate_forum_nav(&$forum_data) $navlinks = $navlinks_parents = $forum_template_data = array(); // Get forum parents - $forum_parents = get_forum_parents($forum_data); + $forum_parents = get_forum_parents($forum_data_ary); $microdata_attr = 'data-forum-id'; @@ -793,46 +793,45 @@ function generate_forum_nav(&$forum_data) } $navlinks = array( - 'S_IS_CAT' => ($forum_data['forum_type'] == FORUM_CAT) ? true : false, - 'S_IS_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false, - 'S_IS_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false, - 'FORUM_NAME' => $forum_data['forum_name'], - 'FORUM_ID' => $forum_data['forum_id'], - 'MICRODATA' => $microdata_attr . '="' . $forum_data['forum_id'] . '"', - 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data['forum_id']), + 'S_IS_CAT' => ($forum_data_ary['forum_type'] == FORUM_CAT) ? true : false, + 'S_IS_LINK' => ($forum_data_ary['forum_type'] == FORUM_LINK) ? true : false, + 'S_IS_POST' => ($forum_data_ary['forum_type'] == FORUM_POST) ? true : false, + 'FORUM_NAME' => $forum_data_ary['forum_name'], + 'FORUM_ID' => $forum_data_ary['forum_id'], + 'MICRODATA' => $microdata_attr . '="' . $forum_data_ary['forum_id'] . '"', + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data_ary['forum_id']), ); $forum_template_data = array( - 'FORUM_ID' => $forum_data['forum_id'], - 'FORUM_NAME' => $forum_data['forum_name'], - 'FORUM_DESC' => generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options']), + 'FORUM_ID' => $forum_data_ary['forum_id'], + 'FORUM_NAME' => $forum_data_ary['forum_name'], + 'FORUM_DESC' => generate_text_for_display($forum_data_ary['forum_desc'], $forum_data_ary['forum_desc_uid'], $forum_data_ary['forum_desc_bitfield'], $forum_data_ary['forum_desc_options']), - 'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_data['forum_type'] == FORUM_POST && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data['forum_options'])) ? true : false, + 'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_data_ary['forum_type'] == FORUM_POST && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data_ary['forum_options'])) ? true : false, ); - $forum_data_ary = $forum_data; + $forum_data = $forum_data_ary; /** * Event to modify the navlinks text * * @event core.generate_forum_nav - * @var array forum_data_ary Array with the forum data + * @var array forum_data Array with the forum data * @var array forum_template_data Array with generic forum template data * @var string microdata_attr The microdata attribute * @var array navlinks_parents Array with the forum parents navlinks data * @var array navlinks Array with the forum navlinks data * @since 3.1.5-RC1 - * @change 3.2.0-a1 Replaced forum_data with forum_data_ary */ $vars = array( - 'forum_data_ary', + 'forum_data', 'forum_template_data', 'microdata_attr', 'navlinks_parents', 'navlinks', ); extract($phpbb_dispatcher->trigger_event('core.generate_forum_nav', compact($vars))); - $forum_data = $forum_data_ary; - unset($forum_data_ary); + $forum_data_ary = $forum_data; + unset($forum_data); $template->assign_block_vars_array('navlinks', $navlinks_parents); $template->assign_block_vars('navlinks', $navlinks); @@ -1164,14 +1163,14 @@ function display_reasons($reason_id = 0) /** * Display user activity (action forum/topic) */ -function display_user_activity(&$userdata) +function display_user_activity(&$userdata_ary) { global $auth, $template, $db, $user; global $phpbb_root_path, $phpEx; global $phpbb_container, $phpbb_dispatcher; // Do not display user activity for users having more than 5000 posts... - if ($userdata['user_posts'] > 5000) + if ($userdata_ary['user_posts'] > 5000) { return; } @@ -1198,7 +1197,7 @@ function display_user_activity(&$userdata) // Obtain active forum $sql = 'SELECT forum_id, COUNT(post_id) AS num_posts FROM ' . POSTS_TABLE . ' - WHERE poster_id = ' . $userdata['user_id'] . ' + WHERE poster_id = ' . $userdata_ary['user_id'] . ' AND post_postcount = 1 AND ' . $phpbb_content_visibility->get_forums_visibility_sql('post', $forum_ary) . ' GROUP BY forum_id @@ -1220,7 +1219,7 @@ function display_user_activity(&$userdata) // Obtain active topic $sql = 'SELECT topic_id, COUNT(post_id) AS num_posts FROM ' . POSTS_TABLE . ' - WHERE poster_id = ' . $userdata['user_id'] . ' + WHERE poster_id = ' . $userdata_ary['user_id'] . ' AND post_postcount = 1 AND ' . $phpbb_content_visibility->get_forums_visibility_sql('post', $forum_ary) . ' GROUP BY topic_id @@ -1240,24 +1239,23 @@ function display_user_activity(&$userdata) } } - $userdata_ary = $userdata; + $userdata = $userdata_ary; /** * Alter list of forums and topics to display as active * * @event core.display_user_activity_modify_actives - * @var array userdata_ary User's data + * @var array userdata User's data * @var array active_f_row List of active forums * @var array active_t_row List of active posts * @since 3.1.0-RC3 - * @change 3.2.0-a1 Replaced userdata with userdata_ary */ - $vars = array('userdata_ary', 'active_f_row', 'active_t_row'); + $vars = array('userdata', 'active_f_row', 'active_t_row'); extract($phpbb_dispatcher->trigger_event('core.display_user_activity_modify_actives', compact($vars))); - $userdata = $userdata_ary; - unset($userdata_ary); + $userdata_ary = $userdata; + unset($userdata); - $userdata['active_t_row'] = $active_t_row; - $userdata['active_f_row'] = $active_f_row; + $userdata_ary['active_t_row'] = $active_t_row; + $userdata_ary['active_f_row'] = $active_f_row; $active_f_name = $active_f_id = $active_f_count = $active_f_pct = ''; if (!empty($active_f_row['num_posts'])) @@ -1265,7 +1263,7 @@ function display_user_activity(&$userdata) $active_f_name = $active_f_row['forum_name']; $active_f_id = $active_f_row['forum_id']; $active_f_count = $active_f_row['num_posts']; - $active_f_pct = ($userdata['user_posts']) ? ($active_f_count / $userdata['user_posts']) * 100 : 0; + $active_f_pct = ($userdata_ary['user_posts']) ? ($active_f_count / $userdata_ary['user_posts']) * 100 : 0; } $active_t_name = $active_t_id = $active_t_count = $active_t_pct = ''; @@ -1274,10 +1272,10 @@ function display_user_activity(&$userdata) $active_t_name = $active_t_row['topic_title']; $active_t_id = $active_t_row['topic_id']; $active_t_count = $active_t_row['num_posts']; - $active_t_pct = ($userdata['user_posts']) ? ($active_t_count / $userdata['user_posts']) * 100 : 0; + $active_t_pct = ($userdata_ary['user_posts']) ? ($active_t_count / $userdata_ary['user_posts']) * 100 : 0; } - $l_active_pct = ($userdata['user_id'] != ANONYMOUS && $userdata['user_id'] == $user->data['user_id']) ? $user->lang['POST_PCT_ACTIVE_OWN'] : $user->lang['POST_PCT_ACTIVE']; + $l_active_pct = ($userdata_ary['user_id'] != ANONYMOUS && $userdata_ary['user_id'] == $user->data['user_id']) ? $user->lang['POST_PCT_ACTIVE_OWN'] : $user->lang['POST_PCT_ACTIVE']; $template->assign_vars(array( 'ACTIVE_FORUM' => $active_f_name, -- cgit v1.2.1 From 73e6e5b77faadbb7676961bf38122d669de111db Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 3 Dec 2015 17:50:29 +0100 Subject: [ticket/13454] Remove unused variables This is the first part of the changes. More to come. PHPBB3-13454 --- phpBB/includes/functions_display.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index e3412c9875..e4df57265d 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -30,7 +30,6 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_rows = $subforums = $forum_ids = $forum_ids_moderator = $forum_moderators = $active_forum_ary = array(); $parent_id = $visible_forums = 0; - $sql_from = ''; // Mark forums read? $mark_read = $request->variable('mark', ''); -- cgit v1.2.1 From 266576c6a4224f4b803040c678020e825a1510b5 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 4 Dec 2015 11:50:39 +0100 Subject: [ticket/13454] Remove unused variables Part 4 PHPBB3-13454 --- phpBB/includes/functions_display.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index e4df57265d..7eb800167b 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -731,7 +731,7 @@ function generate_forum_rules(&$forum_data) return; } - global $template, $phpbb_root_path, $phpEx; + global $template; if ($forum_data['forum_rules']) { @@ -751,7 +751,7 @@ function generate_forum_rules(&$forum_data) */ function generate_forum_nav(&$forum_data_ary) { - global $db, $user, $template, $auth, $config; + global $template, $auth, $config; global $phpEx, $phpbb_root_path, $phpbb_dispatcher; if (!$auth->acl_get('f_list', $forum_data_ary['forum_id'])) @@ -759,7 +759,7 @@ function generate_forum_nav(&$forum_data_ary) return; } - $navlinks = $navlinks_parents = $forum_template_data = array(); + $navlinks_parents = $forum_template_data = array(); // Get forum parents $forum_parents = get_forum_parents($forum_data_ary); -- cgit v1.2.1 From 7a6a16e3a52128179a4f518958f22e773dd94084 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 5 Dec 2015 13:45:16 +0100 Subject: [ticket/13454] Remove unused variables This is part 5 and there is more to come. PHPBB3-13454 --- phpBB/includes/functions_display.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 7eb800167b..3e5d85c99c 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -886,7 +886,7 @@ function get_forum_parents(&$forum_data) */ function get_moderators(&$forum_moderators, $forum_id = false) { - global $config, $template, $db, $phpbb_root_path, $phpEx, $user, $auth; + global $db, $phpbb_root_path, $phpEx, $user, $auth; global $phpbb_container; $forum_id_ary = array(); @@ -1002,8 +1002,6 @@ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$fold { global $user, $config; - $folder = $folder_new = ''; - if ($topic_row['topic_status'] == ITEM_MOVED) { $topic_type = $user->lang['VIEW_TOPIC_MOVED']; -- cgit v1.2.1 From 73900d1857a9a59eff82b224537a79110466ce7e Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 5 Dec 2015 16:07:14 +0100 Subject: [ticket/13454] Remove more unused variables This should be the last part. Off to checking if the changes were correct. PHPBB3-13454 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 3e5d85c99c..afda10ebee 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1292,7 +1292,7 @@ function display_user_activity(&$userdata_ary) */ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0, $item_title = '') { - global $template, $db, $user, $phpEx, $start, $phpbb_root_path; + global $db, $user, $phpEx, $start, $phpbb_root_path; global $request; $table_sql = ($mode == 'forum') ? FORUMS_WATCH_TABLE : TOPICS_WATCH_TABLE; -- cgit v1.2.1 From 0f7d08c1214bc31936228488895e33f53446277e Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Fri, 18 Mar 2016 10:58:43 +0100 Subject: [ticket/9435] Add NUM_PREDEFINED_BBCODES constant PHPBB3-9435 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index afda10ebee..4726676e2d 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1076,7 +1076,7 @@ function display_custom_bbcodes() global $db, $template, $user, $phpbb_dispatcher; // Start counting from 22 for the bbcode ids (every bbcode takes two ids - opening/closing) - $num_predefined_bbcodes = 22; + $num_predefined_bbcodes = NUM_PREDEFINED_BBCODES; $sql_ary = array( 'SELECT' => 'b.bbcode_id, b.bbcode_tag, b.bbcode_helpline', -- cgit v1.2.1 From 5a82061c3af79c09e5f95a562e477caa283a7b47 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 12 Nov 2016 18:19:18 +0100 Subject: [ticket/9211] Use different icon for link subforum in forum legend PHPBB3-9211 --- phpBB/includes/functions_display.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 4726676e2d..53d485cae3 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -282,6 +282,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $subforums[$parent_id][$forum_id]['name'] = $row['forum_name']; $subforums[$parent_id][$forum_id]['orig_forum_last_post_time'] = $row['forum_last_post_time']; $subforums[$parent_id][$forum_id]['children'] = array(); + $subforums[$parent_id][$forum_id]['type'] = $row['forum_type']; if (isset($subforums[$parent_id][$row['parent_id']]) && !$row['display_on_index']) { @@ -490,6 +491,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'link' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $subforum_id), 'name' => $subforum_row['name'], 'unread' => $subforum_unread, + 'type' => $subforum_row['type'], ); } else @@ -571,6 +573,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'U_SUBFORUM' => $subforum['link'], 'SUBFORUM_NAME' => $subforum['name'], 'S_UNREAD' => $subforum['unread'], + 'IS_LINK' => $subforum['type'] == FORUM_LINK, ); } $s_subforums_list = (string) implode($user->lang['COMMA_SEPARATOR'], $s_subforums_list); -- cgit v1.2.1 From 0881bbbb64197107d1ca284a6022ef88548ca334 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Wed, 30 Nov 2016 11:26:15 -0800 Subject: [ticket/14883] Do not display empty forum rules (after reparsing) PHPBB3-14883 --- phpBB/includes/functions_display.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 4726676e2d..0a3c698551 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -738,6 +738,11 @@ function generate_forum_rules(&$forum_data) $forum_data['forum_rules'] = generate_text_for_display($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options']); } + if (!$forum_data['forum_rules']) + { + return; + } + $template->assign_vars(array( 'S_FORUM_RULES' => true, 'U_FORUM_RULES' => $forum_data['forum_rules_link'], -- cgit v1.2.1 From 2fcc1b4d188b7e2fc77baa4ddb1ee4cfe154d92a Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Thu, 1 Dec 2016 08:09:21 -0800 Subject: [ticket/14883] Refactor forum rules logic PHPBB3-14883 --- phpBB/includes/functions_display.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 0a3c698551..34f0d518a2 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -726,27 +726,22 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod */ function generate_forum_rules(&$forum_data) { - if (!$forum_data['forum_rules'] && !$forum_data['forum_rules_link']) - { - return; - } - - global $template; - if ($forum_data['forum_rules']) { $forum_data['forum_rules'] = generate_text_for_display($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options']); } - if (!$forum_data['forum_rules']) + if (!$forum_data['forum_rules'] && !$forum_data['forum_rules_link']) { return; } + global $template; + $template->assign_vars(array( - 'S_FORUM_RULES' => true, - 'U_FORUM_RULES' => $forum_data['forum_rules_link'], - 'FORUM_RULES' => $forum_data['forum_rules']) + 'S_FORUM_RULES' => true, + 'U_FORUM_RULES' => $forum_data['forum_rules_link'], + 'FORUM_RULES' => $forum_data['forum_rules']) ); } -- cgit v1.2.1 From bad9943208c9ec07851bd368215c200a3c064e98 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Thu, 1 Dec 2016 08:10:08 -0800 Subject: [ticket/14883] Remove extra tabbage PHPBB3-14883 --- phpBB/includes/functions_display.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 34f0d518a2..de7dfa0399 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -739,9 +739,9 @@ function generate_forum_rules(&$forum_data) global $template; $template->assign_vars(array( - 'S_FORUM_RULES' => true, - 'U_FORUM_RULES' => $forum_data['forum_rules_link'], - 'FORUM_RULES' => $forum_data['forum_rules']) + 'S_FORUM_RULES' => true, + 'U_FORUM_RULES' => $forum_data['forum_rules_link'], + 'FORUM_RULES' => $forum_data['forum_rules']) ); } -- cgit v1.2.1 From aa37e9b7fc60bd443c6abbcdc3adbf28ae010f32 Mon Sep 17 00:00:00 2001 From: lr94 Date: Sun, 16 Apr 2017 16:28:38 +0200 Subject: [ticket/15176] Add setting for user activity display limit. Up to phpBB 3.2 the maximum number of posts a user must have to have his activity shown is 5000. This limit is hardcoded in functions_display.php. It would be useful if board administrators could choose to disable the limit or to set an higher value. PHPBB3-15176 --- phpBB/includes/functions_display.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index c8b5ec8b1a..32bee14eef 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1165,12 +1165,13 @@ function display_reasons($reason_id = 0) */ function display_user_activity(&$userdata_ary) { - global $auth, $template, $db, $user; + global $auth, $template, $db, $user, $config; global $phpbb_root_path, $phpEx; global $phpbb_container, $phpbb_dispatcher; - // Do not display user activity for users having more than 5000 posts... - if ($userdata_ary['user_posts'] > 5000) + // Do not display user activity for users having too many posts... + $limit = $config['load_user_activity_limit']; + if ($userdata_ary['user_posts'] > $limit && $limit != 0) { return; } -- cgit v1.2.1