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/viewtopic.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 5f897e8d94..6ea9bc611e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -48,6 +48,7 @@ $sort_dir = request_var('sd', $default_sort_dir); $update = request_var('update', false); +/* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); $s_can_vote = false; @@ -62,6 +63,7 @@ if (!$topic_id && !$post_id) trigger_error('NO_TOPIC'); } +/* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); // Find topic id if user requested a newer or older topic @@ -1314,6 +1316,7 @@ $db->sql_freeresult($result); // Load custom profile fields if ($config['load_cpf_viewtopic']) { + /* @var $cp \phpbb\profilefields\manager */ $cp = $phpbb_container->get('profilefields.manager'); // Grab all profile fields from users in id cache for later use - similar to the poster cache -- 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/viewtopic.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 2e27871f2c..ac5b0730db 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -27,26 +27,26 @@ $user->session_begin(); $auth->acl($user->data); // Initial var setup -$forum_id = request_var('f', 0); -$topic_id = request_var('t', 0); -$post_id = request_var('p', 0); -$voted_id = request_var('vote_id', array('' => 0)); +$forum_id = $request->variable('f', 0); +$topic_id = $request->variable('t', 0); +$post_id = $request->variable('p', 0); +$voted_id = $request->variable('vote_id', array('' => 0)); $voted_id = (sizeof($voted_id) > 1) ? array_unique($voted_id) : $voted_id; -$start = request_var('start', 0); -$view = request_var('view', ''); +$start = $request->variable('start', 0); +$view = $request->variable('view', ''); $default_sort_days = (!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0; $default_sort_key = (!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'; $default_sort_dir = (!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'; -$sort_days = request_var('st', $default_sort_days); -$sort_key = request_var('sk', $default_sort_key); -$sort_dir = request_var('sd', $default_sort_dir); +$sort_days = $request->variable('st', $default_sort_days); +$sort_key = $request->variable('sk', $default_sort_key); +$sort_dir = $request->variable('sd', $default_sort_dir); -$update = request_var('update', false); +$update = $request->variable('update', false); /* @var $pagination \phpbb\pagination */ $pagination = $phpbb_container->get('pagination'); @@ -55,7 +55,7 @@ $s_can_vote = false; /** * @todo normalize? */ -$hilit_words = request_var('hilit', '', true); +$hilit_words = $request->variable('hilit', '', true); // Do we have a topic or post id? if (!$topic_id && !$post_id) @@ -498,9 +498,9 @@ if ($config['allow_topic_notify']) } // Bookmarks -if ($config['allow_bookmarks'] && $user->data['is_registered'] && request_var('bookmark', 0)) +if ($config['allow_bookmarks'] && $user->data['is_registered'] && $request->variable('bookmark', 0)) { - if (check_link_hash(request_var('hash', ''), "topic_$topic_id")) + if (check_link_hash($request->variable('hash', ''), "topic_$topic_id")) { if (!$topic_data['bookmarked']) { @@ -2141,13 +2141,13 @@ if ($s_can_vote || $s_quick_reply) // We overwrite $_REQUEST['f'] if there is no forum specified // to be able to display the correct online list. // One downside is that the user currently viewing this topic/post is not taken into account. -if (!request_var('f', 0)) +if (!$request->variable('f', 0)) { $request->overwrite('f', $forum_id); } // We need to do the same with the topic_id. See #53025. -if (!request_var('t', 0) && !empty($topic_id)) +if (!$request->variable('t', 0) && !empty($topic_id)) { $request->overwrite('t', $topic_id); } -- 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/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 76e7a59d5d..7b225ef3db 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1832,7 +1832,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'U_JABBER' => $user_cache[$poster_id]['jabber'], 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p={$row['post_id']}&f=$forum_id&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url . '&p=' . $row['post_id'] . '#p' . $row['post_id']))), - 'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $row['post_id']) : '', + 'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? $phpbb_container->get('controller.helper')->route('phpbb_report_post_controller', array('id' => $row['post_id'])) : '', 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', 'U_MCP_RESTORE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_data['topic_visibility'] != ITEM_DELETED) ? 'deleted_posts' : 'deleted_topics') . '&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', -- cgit v1.2.1 From 7d31232846e29311e5b76bf32f41f64da7985a79 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Wed, 16 Jul 2014 18:31:12 +0200 Subject: [ticket/8708] Apply permission 'f_announce_global' PHPBB3-8708 --- phpBB/viewtopic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 4a42d78b2b..b9cb226920 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -583,10 +583,10 @@ $quickmod_array = array( 'merge' => array('MERGE_POSTS', $auth->acl_get('m_merge', $forum_id)), 'merge_topic' => array('MERGE_TOPIC', $auth->acl_get('m_merge', $forum_id)), 'fork' => array('FORK_TOPIC', $auth->acl_get('m_move', $forum_id)), - 'make_normal' => array('MAKE_NORMAL', ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', $forum_id) && $topic_data['topic_type'] != POST_NORMAL)), + 'make_normal' => array('MAKE_NORMAL', ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', 'f_announce_global', $forum_id) && $topic_data['topic_type'] != POST_NORMAL)), 'make_sticky' => array('MAKE_STICKY', ($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY)), 'make_announce' => array('MAKE_ANNOUNCE', ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE)), - 'make_global' => array('MAKE_GLOBAL', ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL)), + 'make_global' => array('MAKE_GLOBAL', ($allow_change_type && $auth->acl_get('f_announce_global', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL)), 'topic_logs' => array('VIEW_TOPIC_LOGS', $auth->acl_get('m_', $forum_id)), ); -- cgit v1.2.1 From 5988e3a192ac7ce8e647bfdf35e60304e6dd566c Mon Sep 17 00:00:00 2001 From: Michael Miday Date: Tue, 15 Sep 2015 22:43:42 +0200 Subject: [ticket/12769] Delete imageset & consolidate imgs --- phpBB/viewtopic.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index b9cb226920..2908265a97 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1912,6 +1912,8 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'POST_ID' => $row['post_id'], 'POST_NUMBER' => $i + $start + 1, 'POSTER_ID' => $poster_id, + 'MINI_POST' => ($post_unread) ? $user->lang['UNREAD_POST'] : $user->lang['POST'], + 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, 'S_MULTIPLE_ATTACHMENTS' => !empty($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]) > 1, -- cgit v1.2.1 From 3937f1f4ae77b29faf69292783cc3ae267785ee4 Mon Sep 17 00:00:00 2001 From: Zoddo Date: Sat, 12 Sep 2015 00:53:33 +0200 Subject: [ticket/14157] Allow to set the alt/title attribute on post icons PHPBB3-14157 --- phpBB/viewtopic.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index b9cb226920..b446567c5f 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1885,6 +1885,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'POST_ICON_IMG' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['img'] : '', 'POST_ICON_IMG_WIDTH' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['width'] : '', 'POST_ICON_IMG_HEIGHT' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['height'] : '', + 'POST_ICON_IMG_ALT' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['alt'] : '', 'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), 'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false), -- cgit v1.2.1 From c5ef29a6f1729ddc6cfec18247c8a4fe13b6d333 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 24 Mar 2016 10:41:43 +0100 Subject: [ticket/14530] Add accidentally removed sig_parsed flag This was removed by accident previously while moving from the use of the old bbcode class to the generate_test_for_display function. PHPBB3-14530 --- phpBB/viewtopic.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 87de7c79a4..392b336ce6 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1597,6 +1597,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) { $parse_flags = ($user_cache[$poster_id]['sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; $user_cache[$poster_id]['sig'] = generate_text_for_display($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $user_cache[$poster_id]['sig_bbcode_bitfield'], $parse_flags, true); + $user_cache[$poster_id]['sig_parsed'] = true; } // Parse the message and subject -- cgit v1.2.1 From 4b6c2c8cde0b87d32f8df8af87239580ddc340c4 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Sun, 29 May 2016 12:42:57 +0200 Subject: [ticket/10961] Send HTTP 403 when applicable PHPBB3-10961 --- phpBB/viewtopic.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index ded0f9aacc..4325fafb43 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -376,6 +376,7 @@ if (!$overrides_f_read_check && !$auth->acl_get('f_read', $forum_id)) { if ($user->data['user_id'] != ANONYMOUS) { + send_status_line(403, 'Forbidden'); trigger_error('SORRY_AUTH_READ'); } -- cgit v1.2.1 From 7609ba71e98071cf5549de9d9baea253609ecd00 Mon Sep 17 00:00:00 2001 From: nomind60s Date: Mon, 20 Mar 2017 23:06:34 -0600 Subject: [ticket/15137] Global announcements can stick for a non-zero number of days To be consistent with Sticky and Announcements topic types, Global announcements can now stick for a non-zero number of days, i.e. they are no longer never ending. Before this change, if the topic type was Global and a non-zero number of days where set to stick topic, the number was silently ignored and a Global announcement was always never ending. PHPBB3-15137 --- phpBB/viewtopic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 378e2d8f97..e9cb2dd383 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -321,8 +321,8 @@ if ($post_id) $topic_id = (int) $topic_data['topic_id']; $topic_replies = $phpbb_content_visibility->get_count('topic_posts', $topic_data, $forum_id) - 1; -// Check sticky/announcement time limit -if (($topic_data['topic_type'] == POST_STICKY || $topic_data['topic_type'] == POST_ANNOUNCE) && $topic_data['topic_time_limit'] && ($topic_data['topic_time'] + $topic_data['topic_time_limit']) < time()) +// Check sticky/announcement/global time limit +if (($topic_data['topic_type'] != POST_NORMAL) && $topic_data['topic_time_limit'] && ($topic_data['topic_time'] + $topic_data['topic_time_limit']) < time()) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_type = ' . POST_NORMAL . ', topic_time_limit = 0 -- cgit v1.2.1 From bad711e0d96e6e78b67eba3b38a8bc283c5e3535 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 9 Oct 2017 17:54:48 +0200 Subject: [ticket/15394] Add $user_cache PHPBB3-15394 --- phpBB/viewtopic.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index d4bf5b2490..f044766098 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -2017,10 +2017,12 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @var array user_poster_data Poster's data from user cache * @var array post_row Template block array of the post * @var array topic_data Array with topic data + * @var array user_cache Array with cached user data * @since 3.1.0-a1 * @changed 3.1.0-a3 Added vars start, current_row_number, end, attachments * @changed 3.1.0-b3 Added topic_data array, total_posts * @changed 3.1.0-RC3 Added poster_id + * @changed 3.2.2-RC1 Added user_cache */ $vars = array( 'start', @@ -2034,6 +2036,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'user_poster_data', 'post_row', 'topic_data', + 'user_cache', ); extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_row', compact($vars))); -- cgit v1.2.1 From 5c16ef0657d6fb4d5b38bf14e698a4e7f0bb22a7 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 9 Oct 2017 19:08:16 +0200 Subject: [ticket/15394] Add $post_edit_list PHPBB3-15394 --- phpBB/viewtopic.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index f044766098..c94675a741 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -2018,11 +2018,12 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @var array post_row Template block array of the post * @var array topic_data Array with topic data * @var array user_cache Array with cached user data + * @var array post_edit_list Array with post edited list * @since 3.1.0-a1 * @changed 3.1.0-a3 Added vars start, current_row_number, end, attachments * @changed 3.1.0-b3 Added topic_data array, total_posts * @changed 3.1.0-RC3 Added poster_id - * @changed 3.2.2-RC1 Added user_cache + * @changed 3.2.2-RC1 Added user_cache and post_edit_list */ $vars = array( 'start', @@ -2037,6 +2038,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'post_row', 'topic_data', 'user_cache', + 'post_edit_list', ); extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_row', compact($vars))); -- cgit v1.2.1 From 60596eb6756e3d2181ee6670cd123911b04524bf Mon Sep 17 00:00:00 2001 From: kasimi Date: Mon, 23 Oct 2017 22:36:29 +0200 Subject: [ticket/15060] Set correct forum id in user session data if f= is missing PHPBB3-15060 --- phpBB/viewtopic.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index c94675a741..3f117eef6b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -263,6 +263,10 @@ if (!$topic_data) $forum_id = (int) $topic_data['forum_id']; +// If the request is missing the f parameter, the forum id in the user session data is 0 at the moment. +// Let's fix that now so that the user can't hide from the forum's Who Is Online list. +$user->page['forum'] = $forum_id; + // Now we know the forum_id and can check the permissions if ($topic_data['topic_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $forum_id)) { -- cgit v1.2.1 From bd81af3b9e3174d1ea2dbf405b694e535e8b1b40 Mon Sep 17 00:00:00 2001 From: javiexin Date: Wed, 12 Jul 2017 13:25:22 +0200 Subject: [ticket/15266] Expand functionality of content_visibility Added new function "is_visible", and replaced several immediate uses of the above, including a single event in the new function to handle change in all places consistently, and much simpler. PHPBB3-15266 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 378e2d8f97..0dad2796b3 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -262,7 +262,7 @@ if (!$topic_data) $forum_id = (int) $topic_data['forum_id']; // Now we know the forum_id and can check the permissions -if ($topic_data['topic_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $forum_id)) +if (!$phpbb_content_visibility->is_visible('topic', $forum_id, $topic_data)) { trigger_error('NO_TOPIC'); } -- cgit v1.2.1 From f8fbe3793680af1dae2db2829cfc84068831c52f Mon Sep 17 00:00:00 2001 From: rxu Date: Wed, 28 Jun 2017 00:58:03 +0700 Subject: [ticket/14972] replace all occurrences of sizeof() with the count() PHPBB3-14972 --- phpBB/viewtopic.php | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 9037918a20..38eba32374 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -32,7 +32,7 @@ $topic_id = $request->variable('t', 0); $post_id = $request->variable('p', 0); $voted_id = $request->variable('vote_id', array('' => 0)); -$voted_id = (sizeof($voted_id) > 1) ? array_unique($voted_id) : $voted_id; +$voted_id = (count($voted_id) > 1) ? array_unique($voted_id) : $voted_id; $start = $request->variable('start', 0); @@ -740,7 +740,7 @@ $template->assign_vars(array( 'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total_posts), 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', - 'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id])) ? implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]) : '', + 'MODERATORS' => (isset($forum_moderators[$forum_id]) && count($forum_moderators[$forum_id])) ? implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]) : '', 'POST_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'FORUM_LOCKED') : $user->img('button_topic_new', 'POST_NEW_TOPIC'), 'QUOTE_IMG' => $user->img('icon_post_quote', 'REPLY_WITH_QUOTE'), @@ -763,7 +763,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_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) > 1) ? false : true, + 'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && count($forum_moderators[$forum_id]) > 1) ? false : true, 'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")), 'S_MOD_ACTION' => $s_quickmod_action, @@ -856,9 +856,9 @@ if (!empty($topic_data['poll_start'])) (($topic_data['poll_length'] != 0 && $topic_data['poll_start'] + $topic_data['poll_length'] > time()) || $topic_data['poll_length'] == 0) && $topic_data['topic_status'] != ITEM_LOCKED && $topic_data['forum_status'] != ITEM_LOCKED && - (!sizeof($cur_voted_id) || + (!count($cur_voted_id) || ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']))) ? true : false; - $s_display_results = (!$s_can_vote || ($s_can_vote && sizeof($cur_voted_id)) || $view == 'viewpoll') ? true : false; + $s_display_results = (!$s_can_vote || ($s_can_vote && count($cur_voted_id)) || $view == 'viewpoll') ? true : false; /** * Event to manipulate the poll data @@ -893,16 +893,16 @@ if (!empty($topic_data['poll_start'])) if ($update && $s_can_vote) { - if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id) || !check_form_key('posting')) + if (!count($voted_id) || count($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id) || !check_form_key('posting')) { $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")); meta_refresh(5, $redirect_url); - if (!sizeof($voted_id)) + if (!count($voted_id)) { $message = 'NO_VOTE_OPTION'; } - else if (sizeof($voted_id) > $topic_data['poll_max_options']) + else if (count($voted_id) > $topic_data['poll_max_options']) { $message = 'TOO_MANY_VOTE_OPTIONS'; } @@ -996,7 +996,7 @@ if (!empty($topic_data['poll_start'])) 'user_votes' => array_flip($valid_user_votes), 'vote_counts' => $vote_counts, 'total_votes' => array_sum($vote_counts), - 'can_vote' => !sizeof($valid_user_votes) || ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']), + 'can_vote' => !count($valid_user_votes) || ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']), ); $json_response = new \phpbb\json_response(); $json_response->send($data); @@ -1016,7 +1016,7 @@ if (!empty($topic_data['poll_start'])) $parse_flags = ($poll_info[0]['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; - for ($i = 0, $size = sizeof($poll_info); $i < $size; $i++) + for ($i = 0, $size = count($poll_info); $i < $size; $i++) { $poll_info[$i]['poll_option_text'] = generate_text_for_display($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield'], $parse_flags, true); } @@ -1158,7 +1158,7 @@ while ($row = $db->sql_fetchrow($result)) } $db->sql_freeresult($result); -if (!sizeof($post_list)) +if (!count($post_list)) { if ($sort_days) { @@ -1482,7 +1482,7 @@ if ($config['load_cpf_viewtopic']) } // Generate online information for user -if ($config['load_onlinetrack'] && sizeof($id_cache)) +if ($config['load_onlinetrack'] && count($id_cache)) { $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline FROM ' . SESSIONS_TABLE . ' @@ -1500,7 +1500,7 @@ if ($config['load_onlinetrack'] && sizeof($id_cache)) unset($id_cache); // Pull attachment data -if (sizeof($attach_list)) +if (count($attach_list)) { if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) { @@ -1518,7 +1518,7 @@ if (sizeof($attach_list)) $db->sql_freeresult($result); // No attachments exist, but post table thinks they do so go ahead and reset post_attach flags - if (!sizeof($attachments)) + if (!count($attachments)) { $sql = 'UPDATE ' . POSTS_TABLE . ' SET post_attachment = 0 @@ -1526,7 +1526,7 @@ if (sizeof($attach_list)) $db->sql_query($sql); // We need to update the topic indicator too if the complete topic is now without an attachment - if (sizeof($rowset) != $total_posts) + if (count($rowset) != $total_posts) { // Not all posts are displayed so we query the db to find if there's any attachment for this topic $sql = 'SELECT a.post_msg_id as post_id @@ -1583,12 +1583,12 @@ $can_receive_pm_list = (empty($can_receive_pm_list) || !isset($can_receive_pm_li // Get the list of permanently banned users $permanently_banned_users = phpbb_get_banned_user_ids(array_keys($user_cache), false); -$i_total = sizeof($rowset) - 1; +$i_total = count($rowset) - 1; $prev_post_id = ''; $template->assign_vars(array( 'S_HAS_ATTACHMENTS' => $topic_data['topic_attachment'], - 'S_NUM_POSTS' => sizeof($post_list)) + 'S_NUM_POSTS' => count($post_list)) ); /** @@ -1633,7 +1633,7 @@ extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_data', comp // Output the posts $first_unread = $post_unread = false; -for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) +for ($i = 0, $end = count($post_list); $i < $end; ++$i) { // A non-existing rowset only happens if there was no user present for the entered poster_id // This could be a broken posts table. @@ -1676,7 +1676,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) if (($row['post_edit_count'] && $config['display_last_edited']) || $row['post_edit_reason']) { // Get usernames for all following posts if not already stored - if (!sizeof($post_edit_list) && ($row['post_edit_reason'] || ($row['post_edit_user'] && !isset($user_cache[$row['post_edit_user']])))) + if (!count($post_edit_list) && ($row['post_edit_reason'] || ($row['post_edit_user'] && !isset($user_cache[$row['post_edit_user']])))) { // Remove all post_ids already parsed (we do not have to check them) $post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i); @@ -1740,7 +1740,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) if ($row['post_visibility'] == ITEM_DELETED && $row['post_delete_user']) { // Get usernames for all following posts if not already stored - if (!sizeof($post_delete_list) && ($row['post_delete_reason'] || ($row['post_delete_user'] && !isset($user_cache[$row['post_delete_user']])))) + if (!count($post_delete_list) && ($row['post_delete_reason'] || ($row['post_delete_user'] && !isset($user_cache[$row['post_delete_user']])))) { // Remove all post_ids already parsed (we do not have to check them) $post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i); @@ -1983,7 +1983,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, - 'S_MULTIPLE_ATTACHMENTS' => !empty($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]) > 1, + 'S_MULTIPLE_ATTACHMENTS' => !empty($attachments[$row['post_id']]) && count($attachments[$row['post_id']]) > 1, 'S_POST_UNAPPROVED' => ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) ? true : false, 'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED) ? true : false, 'L_POST_DELETED_MESSAGE' => $l_deleted_message, @@ -1992,7 +1992,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'S_FRIEND' => ($row['friend']) ? true : false, 'S_UNREAD_POST' => $post_unread, 'S_FIRST_UNREAD' => $s_first_unread, - 'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false, + 'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && count($cp_row['row'])) ? true : false, 'S_TOPIC_POSTER' => ($topic_data['topic_poster'] == $poster_id) ? true : false, 'S_IGNORE_POST' => ($row['foe']) ? true : false, @@ -2048,7 +2048,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $i = $current_row_number; - if (isset($cp_row['row']) && sizeof($cp_row['row'])) + if (isset($cp_row['row']) && count($cp_row['row'])) { $post_row = array_merge($post_row, $cp_row['row']); } @@ -2161,7 +2161,7 @@ if (isset($user->data['session_page']) && !$user->data['is_bot'] && (strpos($use $db->sql_query($sql); // Update the attachment download counts - if (sizeof($update_count)) + if (count($update_count)) { $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET download_count = download_count + 1 -- cgit v1.2.1 From f01e29effe5bf053ac5205e47f8e0e90a262315a Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Wed, 17 Jan 2018 00:16:26 +0100 Subject: [ticket/15518] Add a setting to toggle permission checks for pms in viewtopic PHPBB3-15518 --- phpBB/viewtopic.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 38eba32374..9e6e4538d6 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1576,12 +1576,20 @@ if (count($attach_list)) } } -// Get the list of users who can receive private messages -$can_receive_pm_list = $auth->acl_get_list(array_keys($user_cache), 'u_readpm'); -$can_receive_pm_list = (empty($can_receive_pm_list) || !isset($can_receive_pm_list[0]['u_readpm'])) ? array() : $can_receive_pm_list[0]['u_readpm']; +if ($config['enable_accurate_pm_button']) +{ + // Get the list of users who can receive private messages + $can_receive_pm_list = $auth->acl_get_list(array_keys($user_cache), 'u_readpm'); + $can_receive_pm_list = (empty($can_receive_pm_list) || !isset($can_receive_pm_list[0]['u_readpm'])) ? array() : $can_receive_pm_list[0]['u_readpm']; -// Get the list of permanently banned users -$permanently_banned_users = phpbb_get_banned_user_ids(array_keys($user_cache), false); + // Get the list of permanently banned users + $permanently_banned_users = phpbb_get_banned_user_ids(array_keys($user_cache), false); +} +else +{ + $can_receive_pm_list = array_keys($user_cache); + $permanently_banned_users = []; +} $i_total = count($rowset) - 1; $prev_post_id = ''; -- cgit v1.2.1 From b68a64de84615930f54c691bc7bc3d35ca8f7dd3 Mon Sep 17 00:00:00 2001 From: Daniel Mota Date: Tue, 16 Jan 2018 13:07:32 +0000 Subject: [ticket/15535] Add S_FIRST_POST to postrow in viewtopic PHPBB3-15535 --- phpBB/viewtopic.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 38eba32374..155dca7788 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1994,6 +1994,7 @@ for ($i = 0, $end = count($post_list); $i < $end; ++$i) 'S_FIRST_UNREAD' => $s_first_unread, 'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && count($cp_row['row'])) ? true : false, 'S_TOPIC_POSTER' => ($topic_data['topic_poster'] == $poster_id) ? true : false, + 'S_FIRST_POST' => ($topic_data['topic_first_post_id'] == $row['post_id']) ? true : false, 'S_IGNORE_POST' => ($row['foe']) ? true : false, 'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '', -- cgit v1.2.1 From 5fbd4584be49e416642ca1593084bca15fc60d30 Mon Sep 17 00:00:00 2001 From: Toxyy Date: Mon, 9 Jul 2018 16:54:11 -0400 Subject: [ticket/15719] Add core events to viewtopic to edit the post_list sql query Event added in viewtopic.php so you can modify post_list sql The query, sql limit, sql start, sort keys and days are editable PHPBB3-15719 --- phpBB/viewtopic.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 3c25c3b037..20316afb32 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1148,6 +1148,29 @@ $sql = 'SELECT p.post_id " . (($join_user_sql[$sort_key]) ? 'AND u.user_id = p.poster_id': '') . " $limit_posts_time ORDER BY $sql_sort_order"; + +/** +* Event to modify the SQL query that gets post_list +* +* @event core.viewtopic_modify_post_list_sql +* @var string sql The SQL query to generate the post_list +* @var int sql_limit The number of posts the query fetches +* @var int sql_start The index the query starts to fetch from +* @var string sort_key Key the posts are sorted by +* @var string sort_days Display posts of previous x days +* @var int forum_id Forum ID +* @since 3.2.4-RC1 +*/ +$vars = array( + 'sql', + 'sql_limit', + 'sql_start', + 'sort_key', + 'sort_days', + 'forum_id', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_list_sql', compact($vars))); + $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); $i = ($store_reverse) ? $sql_limit - 1 : 0; -- cgit v1.2.1 From b2277e7bf688168acfa3097730f556b7218858ac Mon Sep 17 00:00:00 2001 From: MikelAlejoBR Date: Sat, 28 Jul 2018 14:29:37 +0200 Subject: [ticket/15733] Remove unused code related to deprecated flood control PHPBB3-15733 --- phpBB/viewtopic.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 3c25c3b037..79852330d9 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -2249,7 +2249,6 @@ if ($s_can_vote || $s_quick_reply) $qr_hidden_fields = array( 'topic_cur_post_id' => (int) $topic_data['topic_last_post_id'], - 'lastclick' => (int) time(), 'topic_id' => (int) $topic_data['topic_id'], 'forum_id' => (int) $forum_id, ); -- cgit v1.2.1 From fbd1741107c2eda9d009efcc794b53d3b703bd92 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 7 May 2018 18:36:51 +0200 Subject: [ticket/15661] Add core.viewtopic_modify_poll_ajax_data PHPBB3-15661 --- phpBB/viewtopic.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 3c25c3b037..a9f419b9aa 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -998,6 +998,29 @@ if (!empty($topic_data['poll_start'])) 'total_votes' => array_sum($vote_counts), 'can_vote' => !count($valid_user_votes) || ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']), ); + + /** + * Event to manipulate the poll data sent by AJAX response + * + * @event core.viewtopic_modify_poll_ajax_data + * @var array data JSON response data + * @var array valid_user_votes Valid user votes + * @var array vote_counts Vote counts + * @var int forum_id Forum ID + * @var array topic_data Topic data + * @var array poll_info Array with the poll information + * @since 3.2.4-RC1 + */ + $vars = array( + 'data', + 'valid_user_votes', + 'vote_counts', + 'forum_id', + 'topic_data', + 'poll_info', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_poll_ajax_data', compact($vars))); + $json_response = new \phpbb\json_response(); $json_response->send($data); } -- cgit v1.2.1 From f657ee51f89fcc0561155069c00957c46f31d96c Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Fri, 28 Sep 2018 12:55:45 +0200 Subject: [ticket/15593] Do not allow print view with direct URL PHPBB3-15593 --- phpBB/viewtopic.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 79852330d9..ba30fa9c58 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -342,6 +342,12 @@ if (($topic_data['topic_type'] != POST_NORMAL) && $topic_data['topic_time_limit' // Setup look and feel $user->setup('viewtopic', $topic_data['forum_style']); +if ($view == 'print' && !$auth->acl_get('f_print', $forum_id)) +{ + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_PRINT_TOPIC'); +} + $overrides_f_read_check = false; $overrides_forum_password_check = false; $topic_tracking_info = isset($topic_tracking_info) ? $topic_tracking_info : null; -- cgit v1.2.1 From 0bb87b2de1ce127e5766f8c5a34ae9135ac58913 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Mon, 1 Oct 2018 17:07:28 +0200 Subject: [ticket/12430] Remove hilit param from topic title link PHPBB3-12430 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 79852330d9..dfec925a67 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -780,7 +780,7 @@ $template->assign_vars(array( 'U_TOPIC' => "{$server_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id", 'U_FORUM' => $server_path, - 'U_VIEW_TOPIC' => $viewtopic_url, + 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . (strlen($u_sort_param) ? "&$u_sort_param" : '')), 'U_CANONICAL' => generate_board_url() . '/' . append_sid("viewtopic.$phpEx", "t=$topic_id" . (($start) ? "&start=$start" : ''), true, ''), 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), 'U_VIEW_OLDER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=previous"), -- cgit v1.2.1 From a62141ea68e904927032276cb73ad483cbb93a1d Mon Sep 17 00:00:00 2001 From: Alec Date: Mon, 15 Oct 2018 21:57:23 -0400 Subject: [ticket/15841] Allow postrow pm link to be modified by event Allow postrow.contact pm link to be modified by event above All other variables in postrow.contact can be modified by the event already This lets you hide all contact info on a per user basis PHPBB3-15841 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 28e00dc6fa..55b41aa7fa 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -2115,7 +2115,7 @@ for ($i = 0, $end = count($post_list); $i < $end; ++$i) array( 'ID' => 'pm', 'NAME' => $user->lang['SEND_PRIVATE_MESSAGE'], - 'U_CONTACT' => $u_pm, + 'U_CONTACT' => $post_row['U_PM'], ), array( 'ID' => 'email', -- cgit v1.2.1 From f3b94b118a6aa784deab101ff90d1ff39879095a Mon Sep 17 00:00:00 2001 From: 3D-I Date: Sat, 10 Nov 2018 01:43:02 +0100 Subject: [ticket/15870] Add core.viewtopic_modify_forum_id PHPBB3-15870 --- phpBB/viewtopic.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 0cbb5284c7..eb2d52cf61 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -263,6 +263,20 @@ if (!$topic_data) $forum_id = (int) $topic_data['forum_id']; +/** + * Modify the forum ID to handle the correct display of viewtopic if needed + * + * @event core.viewtopic_modify_forum_id + * @var string forum_id forum ID + * @var array topic_data array of topic's data + * @since 3.2.5-RC1 + */ +$vars = array( + 'forum_id', + 'topic_data', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_forum_id', compact($vars))); + // If the request is missing the f parameter, the forum id in the user session data is 0 at the moment. // Let's fix that now so that the user can't hide from the forum's Who Is Online list. $user->page['forum'] = $forum_id; -- cgit v1.2.1 From 1dbb5702847833653128e829d8bcfb79968067be Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 8 Jul 2019 09:00:30 +0200 Subject: [ticket/16097] Add core.viewtopic_gen_sort_selects_before PHPBB3-16097 --- phpBB/viewtopic.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index eb2d52cf61..57c9bc9f6a 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -453,6 +453,38 @@ $join_user_sql = array('a' => true, 't' => false, 's' => false); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; +/** +* Event to add new sorting options +* +* @event core.viewtopic_gen_sort_selects_before +* @var array limit_days Limit results by time +* @var array sort_by_text Language strings for sorting options +* @var array sort_by_sql SQL conditions for sorting options +* @var array join_user_sql SQL joins required for sorting options +* @var string sort_days User selected sort days +* @var string sort_key User selected sort key +* @var string sort_dir User selected sort direction +* @var string s_limit_days Initial value of limit days selectbox +* @var string s_sort_key Initial value of sort key selectbox +* @var string s_sort_dir Initial value of sort direction selectbox +* @var string u_sort_param Initial value of sorting form action +* @since 3.2.8-RC1 +*/ +$vars = array( + 'limit_days', + 'sort_by_text', + 'sort_by_sql', + 'join_user_sql', + 'sort_days', + 'sort_key', + 'sort_dir', + 's_limit_days', + 's_sort_key', + 's_sort_dir', + 'u_sort_param', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_gen_sort_selects_before', compact($vars))); + 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); // Obtain correct post count and ordering SQL if user has -- cgit v1.2.1 From cd6a0026d51f9f862228e45765c84fc151607125 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 29 Jul 2019 08:22:19 +0200 Subject: [ticket/16097] Correctly classify sort_days as int PHPBB3-16097 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 57c9bc9f6a..0c2be8c52e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -461,7 +461,7 @@ $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; * @var array sort_by_text Language strings for sorting options * @var array sort_by_sql SQL conditions for sorting options * @var array join_user_sql SQL joins required for sorting options -* @var string sort_days User selected sort days +* @var int sort_days User selected sort days * @var string sort_key User selected sort key * @var string sort_dir User selected sort direction * @var string s_limit_days Initial value of limit days selectbox -- cgit v1.2.1 From 694a90c18e52edb3860406a1381283cbb6fb6bcb Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Sun, 25 Aug 2019 23:16:51 +0200 Subject: [ticket/16139] Add core.viewtopic_modify_quick_reply_template_vars PHPBB3-16139 --- phpBB/viewtopic.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 0c2be8c52e..f0b0021626 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -2359,12 +2359,25 @@ if ($s_can_vote || $s_quick_reply) ($s_notify) ? $qr_hidden_fields['notify'] = 1 : true; ($topic_data['topic_status'] == ITEM_LOCKED) ? $qr_hidden_fields['lock_topic'] = 1 : true; - $template->assign_vars(array( + $tpl_ary = [ 'S_QUICK_REPLY' => true, 'U_QR_ACTION' => append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&f=$forum_id&t=$topic_id"), 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), 'SUBJECT' => 'Re: ' . censor_text($topic_data['topic_title']), - )); + ]; + + /** + * Event after the quick-reply has been setup + * + * @event core.viewtopic_modify_quick_reply_template_vars + * @var array tpl_ary Array with template data + * @var array topic_data Array with topic data + * @since 3.2.9-RC1 + */ + $vars = ['tpl_ary', 'topic_data']; + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_quick_reply_template_vars', compact($vars))); + + $template->assign_vars($tpl_ary); } } // now I have the urge to wash my hands :( -- cgit v1.2.1 From ce93b224107a65b43253c36812b636321eb55a78 Mon Sep 17 00:00:00 2001 From: stevendegroote Date: Tue, 17 Sep 2019 23:01:59 +0200 Subject: [ticket/16159] Wrap post times in html time tag PHPBB3-16159 --- phpBB/viewtopic.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index c94675a741..a1dc60955c 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1934,6 +1934,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'CONTACT_USER' => $user_cache[$poster_id]['contact_user'], 'POST_DATE' => $user->format_date($row['post_time'], false, ($view == 'print') ? true : false), + 'POST_DATE_RFC3339' => gmdate("Y-m-d H:i:sP", $row['post_time']), 'POST_SUBJECT' => $row['post_subject'], 'MESSAGE' => $message, 'SIGNATURE' => ($row['enable_sig']) ? $user_cache[$poster_id]['sig'] : '', -- cgit v1.2.1 From 8160a8a1efe06de06a199be5c7e8262e0c199873 Mon Sep 17 00:00:00 2001 From: stevendegroote Date: Wed, 18 Sep 2019 20:58:13 +0200 Subject: [ticket/16159] Use predefined DATE_RFC3339 PHPBB3-16159 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index e49959b3b5..dadbe9a06c 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -2044,7 +2044,7 @@ for ($i = 0, $end = count($post_list); $i < $end; ++$i) 'CONTACT_USER' => $user_cache[$poster_id]['contact_user'], 'POST_DATE' => $user->format_date($row['post_time'], false, ($view == 'print') ? true : false), - 'POST_DATE_RFC3339' => gmdate("Y-m-d H:i:sP", $row['post_time']), + 'POST_DATE_RFC3339' => gmdate(DATE_RFC3339, $row['post_time']), 'POST_SUBJECT' => $row['post_subject'], 'MESSAGE' => $message, 'SIGNATURE' => ($row['enable_sig']) ? $user_cache[$poster_id]['sig'] : '', -- cgit v1.2.1