From 5b5ed96bc5097bebf3d1ec0c6af87588a53f4e05 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 9 Jun 2011 09:41:29 +0200 Subject: [ticket/7888] Swap in-forum/topic search to GET forms. This will allow sending URLs to search results to other users. The advanced search page has always worked like this, but these special pages used to cause problems. PHPBB3-7888 --- phpBB/viewtopic.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 53da7f539f..e4c02a88fb 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -585,6 +585,15 @@ $server_path = (!$view) ? $phpbb_root_path : generate_board_url() . '/'; // Replace naughty words in title $topic_data['topic_title'] = censor_text($topic_data['topic_title']); +$s_search_hidden_fields = array( + 't' => $topic_id, + 'sf' => 'msgonly', +); +if ($_SID) +{ + $s_search_hidden_fields['sid'] = $_SID; +} + // Send vars to template $template->assign_vars(array( 'FORUM_ID' => $forum_id, @@ -636,7 +645,8 @@ $template->assign_vars(array( 'S_VIEWTOPIC' => true, '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", 't=' . $topic_id), + 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx"), + 'S_SEARCH_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields), 'S_DISPLAY_POST_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false, 'S_DISPLAY_REPLY_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false, -- cgit v1.2.1 From 6458a1a16ac3d9935a4933b0de7b6e464b33fce3 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 18 Jun 2011 23:21:45 +0200 Subject: [ticket/10232] Renamed S_SEARCH_HIDDEN_FIELDS to S_SEARCH_LOCAL_HIDDEN_FIELDS Avoids the global hidden fields from functions.php overwriting local searches. PHPBB3-10232 --- 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 e4c02a88fb..08e82591de 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -646,7 +646,7 @@ $template->assign_vars(array( 'S_VIEWTOPIC' => true, '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_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields), + 'S_SEARCH_LOCAL_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields), 'S_DISPLAY_POST_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false, 'S_DISPLAY_REPLY_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false, -- cgit v1.2.1 From 773561f862e9cf4016a4176454e3fb59489259ac Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 11 Jul 2011 19:20:45 +0200 Subject: [ticket/10237] Handle watching and unwatching the same way. Also add some information to the confirm-box (forum_name / topic title) PHPBB3-10237 --- 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 08e82591de..8b081b4aec 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -488,7 +488,7 @@ $s_watching_topic = array( if (($config['email_enable'] || $config['jab_enable']) && $config['allow_topic_notify'] && $user->data['is_registered']) { - watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $topic_data['notify_status'], $start); + watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $topic_data['notify_status'], $start, $topic_data['topic_title']); // Reset forum notification if forum notify is set if ($config['allow_forum_notify'] && $auth->acl_get('f_subscribe', $forum_id)) -- cgit v1.2.1 From 91fd6df4308583c570dd7710d80a142a84c106aa Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 13 Jul 2011 00:01:37 +0200 Subject: [ticket/10243] Call phpbb_gmgetdate() from various places. PHPBB3-10243 --- 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 08e82591de..3f73fe356a 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -995,7 +995,7 @@ $sql = $db->sql_build_query('SELECT', array( $result = $db->sql_query($sql); -$now = getdate(time() + $user->timezone + $user->dst - date('Z')); +$now = phpbb_gmgetdate(time() + $user->timezone + $user->dst); // Posts are stored in the $rowset array while $attach_list, $user_cache // and the global bbcode_bitfield are built -- cgit v1.2.1 From 4bdad7125a34e121f7857c34480d0527c1925384 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Wed, 13 Jul 2011 11:32:38 +0200 Subject: [ticket/9608] Remove use of references in captcha and other places References are not really needed in PHP due to copy-on-write. Since PHP5, objects are always passed around as identifiers, which means they are mutable. So it is no longer required to pass these by reference either. PHPBB3-9608 --- 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 c8768e9ff4..ab58048c86 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1303,7 +1303,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) continue; } - $row =& $rowset[$post_list[$i]]; + $row = $rowset[$post_list[$i]]; $poster_id = $row['user_id']; // End signature parsing, only if needed -- cgit v1.2.1 From 0648923b19e450d44e02426e7a510efb831f78d1 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Mon, 9 May 2011 02:04:58 -0400 Subject: [ticket/10199] Delete a useless join in viewtopic. PHPBB3-10199 --- phpBB/viewtopic.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 2f3a4cf2e4..f1ab30aad3 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -196,7 +196,7 @@ if ($db->sql_layer === 'firebird') // The FROM-Order is quite important here, else t.* columns can not be correctly bound. if ($post_id) { - $sql_array['SELECT'] .= ', p.post_approved'; + $sql_array['SELECT'] .= ', p.post_approved, p.post_time'; $sql_array['FROM'][POSTS_TABLE] = 'p'; } @@ -314,12 +314,11 @@ if ($post_id) } else { - $sql = 'SELECT COUNT(p1.post_id) AS prev_posts - FROM ' . POSTS_TABLE . ' p1, ' . POSTS_TABLE . " p2 - WHERE p1.topic_id = {$topic_data['topic_id']} - AND p2.post_id = {$post_id} - " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p1.post_approved = 1' : '') . ' - AND ' . (($sort_dir == 'd') ? 'p1.post_time >= p2.post_time' : 'p1.post_time <= p2.post_time'); + $sql = 'SELECT COUNT(p.post_id) AS prev_posts + FROM ' . POSTS_TABLE . " p + WHERE p.topic_id = {$topic_data['topic_id']} + " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . ' + AND ' . (($sort_dir == 'd') ? "p.post_time >= {$topic_data['post_time']}" : "p.post_time <= {$topic_data['post_time']}"); $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); -- cgit v1.2.1 From bb7e8bb4244eece7dbbe2a81216b9da976f6c0e9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 8 Apr 2011 14:44:21 +0200 Subject: [ticket/9976] Fix link to post when two posts have the same post_time. When two posts have the same post_time, a link to the first post being on page 1, leads you to the second post with the same timestamp on page two. So in case the post_times are equal, we need to use the post_id to correctly order the posts. PHPBB3-9976 --- phpBB/viewtopic.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index f1ab30aad3..203b8586ce 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -196,7 +196,7 @@ if ($db->sql_layer === 'firebird') // The FROM-Order is quite important here, else t.* columns can not be correctly bound. if ($post_id) { - $sql_array['SELECT'] .= ', p.post_approved, p.post_time'; + $sql_array['SELECT'] .= ', p.post_approved, p.post_time, p.post_id'; $sql_array['FROM'][POSTS_TABLE] = 'p'; } @@ -317,8 +317,16 @@ if ($post_id) $sql = 'SELECT COUNT(p.post_id) AS prev_posts FROM ' . POSTS_TABLE . " p WHERE p.topic_id = {$topic_data['topic_id']} - " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . ' - AND ' . (($sort_dir == 'd') ? "p.post_time >= {$topic_data['post_time']}" : "p.post_time <= {$topic_data['post_time']}"); + " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : ''); + + if ($sort_dir == 'd') + { + $sql .= " AND (p.post_time > {$topic_data['post_time']} OR (p.post_time = {$topic_data['post_time']} AND p.post_id >= {$topic_data['post_id']}))"; + } + else + { + $sql .= " AND (p.post_time < {$topic_data['post_time']} OR (p.post_time = {$topic_data['post_time']} AND p.post_id <= {$topic_data['post_id']}))"; + } $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); -- cgit v1.2.1 From 830c3f4047d0718ed398c38d4640cc0f1fe77a7f Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 3 Sep 2011 23:50:00 +0300 Subject: [feature/remove-imagesets] Adjustments to php files Removing imagesets. Adjustments to php files PHPBB3-10336 --- 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 2c5b4e3fc5..a1976e169d 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -840,7 +840,7 @@ if (!empty($topic_data['poll_start'])) 'POLL_OPTION_RESULT' => $poll_option['poll_option_total'], 'POLL_OPTION_PERCENT' => $option_pct_txt, 'POLL_OPTION_PCT' => round($option_pct * 100), - 'POLL_OPTION_IMG' => $user->img('poll_center', $option_pct_txt, round($option_pct * 250)), + 'POLL_OPTION_WIDTH' => round($option_pct * 250), 'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false) ); } -- cgit v1.2.1 From 1a19388aa38113262db648caedd4a745f5691ed1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 20 Jul 2011 00:55:49 +0200 Subject: [ticket/10237] Display login-box for guests, when (un)subscribing Also initialise $is_watching for PHP Notice: Undefined variable is_watching PHPBB3-10237 --- phpBB/viewtopic.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 8b081b4aec..bb88241481 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -486,9 +486,10 @@ $s_watching_topic = array( 'is_watching' => false, ); -if (($config['email_enable'] || $config['jab_enable']) && $config['allow_topic_notify'] && $user->data['is_registered']) +if (($config['email_enable'] || $config['jab_enable']) && $config['allow_topic_notify']) { - watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $topic_data['notify_status'], $start, $topic_data['topic_title']); + $notify_status = (isset($topic_data['notify_status'])) ? $topic_data['notify_status'] : null; + watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $notify_status, $start, $topic_data['topic_title']); // Reset forum notification if forum notify is set if ($config['allow_forum_notify'] && $auth->acl_get('f_subscribe', $forum_id)) -- cgit v1.2.1 From 4c77903129749008cd08c346006d2a57cf6ff544 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 21 Nov 2011 16:22:07 +0100 Subject: [ticket/10484] Use variables for sql_build_query() calls It's easier for mods/extensions to extend the arrays. PHPBB3-10484 --- phpBB/viewtopic.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index ceb9f3ea1c..e78ba73cd7 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -943,7 +943,7 @@ if (!sizeof($post_list)) // We need to grab it because we do reverse ordering sometimes $max_post_time = 0; -$sql = $db->sql_build_query('SELECT', array( +$sql_ary = array( 'SELECT' => 'u.*, z.friend, z.foe, p.*', 'FROM' => array( @@ -954,14 +954,15 @@ $sql = $db->sql_build_query('SELECT', array( 'LEFT_JOIN' => array( array( 'FROM' => array(ZEBRA_TABLE => 'z'), - 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id' - ) + 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id', + ), ), 'WHERE' => $db->sql_in_set('p.post_id', $post_list) . ' - AND u.user_id = p.poster_id' -)); + AND u.user_id = p.poster_id', +); +$sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); $now = phpbb_gmgetdate(time() + $user->timezone + $user->dst); -- cgit v1.2.1 From 88ae40a4b19360645d5e5a614cc378e7cce4afe3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 14 Sep 2011 00:28:52 +0200 Subject: [ticket/10345] Make use of the plural function in some basic places PHPBB3-10345 --- phpBB/viewtopic.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index e78ba73cd7..a56012bcf2 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -578,7 +578,7 @@ $template->assign_vars(array( 'PAGINATION' => $pagination, 'PAGE_NUMBER' => on_page($total_posts, $config['posts_per_page'], $start), - 'TOTAL_POSTS' => ($total_posts == 1) ? $user->lang['VIEW_TOPIC_POST'] : sprintf($user->lang['VIEW_TOPIC_POSTS'], $total_posts), + '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(', ', $forum_moderators[$forum_id]) : '', @@ -854,7 +854,7 @@ if (!empty($topic_data['poll_start'])) 'POLL_LEFT_CAP_IMG' => $user->img('poll_left'), 'POLL_RIGHT_CAP_IMG'=> $user->img('poll_right'), - 'L_MAX_VOTES' => ($topic_data['poll_max_options'] == 1) ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $topic_data['poll_max_options']), + 'L_MAX_VOTES' => $user->lang('MAX_OPTIONS_SELECT', (int) $topic_data['poll_max_options']), 'L_POLL_LENGTH' => ($topic_data['poll_length']) ? sprintf($user->lang[($poll_end > time()) ? 'POLL_RUN_TILL' : 'POLL_ENDED_AT'], $user->format_date($poll_end)) : '', 'S_HAS_POLL' => true, @@ -1382,8 +1382,6 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) unset($post_storage_list); } - $l_edit_time_total = ($row['post_edit_count'] == 1) ? $user->lang['EDITED_TIME_TOTAL'] : $user->lang['EDITED_TIMES_TOTAL']; - if ($row['post_edit_reason']) { // User having edited the post also being the post author? @@ -1396,7 +1394,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $display_username = get_username_string('full', $row['post_edit_user'], $post_edit_list[$row['post_edit_user']]['username'], $post_edit_list[$row['post_edit_user']]['user_colour']); } - $l_edited_by = sprintf($l_edit_time_total, $display_username, $user->format_date($row['post_edit_time'], false, true), $row['post_edit_count']); + $l_edited_by = $user->lang('EDITED_TIMES_TOTAL', (int) $row['post_edit_count'], $display_username, $user->format_date($row['post_edit_time'], false, true)); } else { @@ -1415,7 +1413,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $display_username = get_username_string('full', $row['post_edit_user'], $user_cache[$row['post_edit_user']]['username'], $user_cache[$row['post_edit_user']]['user_colour']); } - $l_edited_by = sprintf($l_edit_time_total, $display_username, $user->format_date($row['post_edit_time'], false, true), $row['post_edit_count']); + $l_edited_by = $user->lang('EDITED_TIMES_TOTAL', (int) $row['post_edit_count'], $display_username, $user->format_date($row['post_edit_time'], false, true)); } } else -- cgit v1.2.1 From dfb7cc625a37c6345fa647ee3a21f890ba5c9649 Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Thu, 8 Dec 2011 23:35:26 +0200 Subject: [ticket/10319] Missing hidden fields in search form Missing hidden fields in search form (bug added in 3.0.9) PHPBB3-10319 --- phpBB/viewtopic.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index df631a474c..01cd6a28a8 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -602,6 +602,15 @@ if ($_SID) $s_search_hidden_fields['sid'] = $_SID; } +if (!empty($_EXTRA_URL)) +{ + foreach ($_EXTRA_URL as $url_param) + { + $url_param = explode('=', $url_param, 2); + $s_hidden_fields[$url_param[0]] = $url_param[1]; + } +} + // Send vars to template $template->assign_vars(array( 'FORUM_ID' => $forum_id, -- cgit v1.2.1 From 7a04c9048c110f0bd21ea3e9e869e17b408d640e Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 31 Dec 2011 13:32:52 +0000 Subject: [ticket/9916] Updating header license and removing Version $Id$ PHPBB3-9916 --- phpBB/viewtopic.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index e441ac49b0..cb6edf8423 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -2,9 +2,8 @@ /** * * @package phpBB3 -* @version $Id$ * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ -- cgit v1.2.1 From a962e788542dac43a365afde295babf3ee681535 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 9 Feb 2012 15:29:21 +0100 Subject: [ticket/10606] Also correctly use $s_search_hidden_fields in view(forum|topic). Regression from dfb7cc625a37c6345fa647ee3a21f890ba5c9649. PHPBB3-10606 --- 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 01cd6a28a8..74420a25c7 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -607,7 +607,7 @@ if (!empty($_EXTRA_URL)) foreach ($_EXTRA_URL as $url_param) { $url_param = explode('=', $url_param, 2); - $s_hidden_fields[$url_param[0]] = $url_param[1]; + $s_search_hidden_fields[$url_param[0]] = $url_param[1]; } } -- cgit v1.2.1 From c5de658c7f15a6ab0028353684323c3ef21521c9 Mon Sep 17 00:00:00 2001 From: callumacrae Date: Fri, 2 Dec 2011 17:26:39 +0000 Subject: [ticket/10510] Moved quick-mod tools markup to template. PHPBB3-10510 --- phpBB/viewtopic.php | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 7cb6df3660..450ebfeda8 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -517,20 +517,6 @@ gen_forum_auth_level('topic', $forum_id, $topic_data['forum_status']); // Quick mod tools $allow_change_type = ($auth->acl_get('m_', $forum_id) || ($user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? true : false; -$topic_mod = ''; -$topic_mod .= ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED)) ? (($topic_data['topic_status'] == ITEM_UNLOCKED) ? '' : '') : ''; -$topic_mod .= ($auth->acl_get('m_delete', $forum_id)) ? '' : ''; -$topic_mod .= ($auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED) ? '' : ''; -$topic_mod .= ($auth->acl_get('m_split', $forum_id)) ? '' : ''; -$topic_mod .= ($auth->acl_get('m_merge', $forum_id)) ? '' : ''; -$topic_mod .= ($auth->acl_get('m_merge', $forum_id)) ? '' : ''; -$topic_mod .= ($auth->acl_get('m_move', $forum_id)) ? '' : ''; -$topic_mod .= ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', $forum_id) && $topic_data['topic_type'] != POST_NORMAL) ? '' : ''; -$topic_mod .= ($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY) ? '' : ''; -$topic_mod .= ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE) ? '' : ''; -$topic_mod .= ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL) ? '' : ''; -$topic_mod .= ($auth->acl_get('m_', $forum_id)) ? '' : ''; - // If we've got a hightlight set pass it on to pagination. $pagination = generate_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')), $total_posts, $config['posts_per_page'], $start); @@ -617,7 +603,19 @@ $template->assign_vars(array( 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && sizeof($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_TOPIC_MOD' => ($topic_mod != '') ? '' : '', + 'S_TOPIC_MOD_LOCK' => ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED)) ? (($topic_data['topic_status'] == ITEM_UNLOCKED) ? 'lock' : 'unlock') : '', + 'S_TOPIC_MOD_DELETE' => ($auth->acl_get('m_delete', $forum_id)) ? true : false, + 'S_TOPIC_MOD_MOVE' => ($auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED) ? true : false, + 'S_TOPIC_MOD_SPLIT' => ($auth->acl_get('m_split', $forum_id)) ? true : false, + 'S_TOPIC_MOD_MERGE' => ($auth->acl_get('m_merge', $forum_id)) ? true : false, + 'S_TOPIC_MOD_MERGE_TOPIC' => ($auth->acl_get('m_merge', $forum_id)) ? true : false, + 'S_TOPIC_MOD_FORK' => ($auth->acl_get('m_move', $forum_id)) ? true : false, + 'S_TOPIC_MOD_MAKE_NORMAL' => ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', $forum_id) && $topic_data['topic_type'] != POST_NORMAL) ? true : false, + 'S_TOPIC_MOD_MAKE_STICKY' => ($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY) ? true : false, + 'S_TOPIC_MOD_MAKE_ANNOUNCE' => ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE) ? true : false, + 'S_TOPIC_MOD_MAKE_GLOBAL' => ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL) ? true : false, + 'S_TOPIC_MOD_TOPIC_LOGS' => ($auth->acl_get('m_', $forum_id)), + 'S_MOD_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . "&quickmod=1&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url)), true, $user->session_id), 'S_VIEWTOPIC' => true, -- cgit v1.2.1 From 1665434853fb09e70337d23955e1c9a5f3f0d19d Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 7 Jul 2010 23:42:54 +0100 Subject: [feature/new-tz-handling] Remove code using legacy timezone properties. Code accessing the legacy user::$timezone and user::$dst properties has been removed and replaced with code utilising user::create_datetime(). Changed by Oleg: in viewtopic, memberlist and index use getTimestamp() + getOffset(). We show members that have birthdays on the specified date. getTimestamp() returns the current date in UTC. We add getOffset() to obtain the current local time in the viewing user's timezone. Then we find members having birthday on this date. Changed by Oleg again: Take leap year status out of the datetime object we have, this seems like it should work as one would expect. PHPBB3-9558 --- phpBB/viewtopic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index e78ba73cd7..782f02fd4b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -965,7 +965,8 @@ $sql_ary = array( $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); -$now = phpbb_gmgetdate(time() + $user->timezone + $user->dst); +$now = $user->create_datetime(); +$now = phpbb_gmgetdate($now->getTimestamp() + $now->getOffset()); // Posts are stored in the $rowset array while $attach_list, $user_cache // and the global bbcode_bitfield are built -- cgit v1.2.1 From 9a07f5287c91549dc989615f0cf6dc1fd8f82e5f Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Sun, 4 Mar 2012 10:32:06 +0000 Subject: [ticket/10510] Moved quick-mod tools into a loop. PHPBB3-10510 --- phpBB/viewtopic.php | 106 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 93 insertions(+), 13 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 450ebfeda8..12a611ce6f 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -517,6 +517,99 @@ gen_forum_auth_level('topic', $forum_id, $topic_data['forum_status']); // Quick mod tools $allow_change_type = ($auth->acl_get('m_', $forum_id) || ($user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? true : false; +if ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED)) +{ + $template->assign_block_vars('quickmod', array( + 'VALUE' => (($topic_data['topic_status'] == ITEM_UNLOCKED) ? 'lock' : 'unlock'), + 'TITLE' => $user->lang[(($topic_data['topic_status'] == ITEM_UNLOCKED) ? 'LOCK' : 'UNLOCK') . '_TOPIC'] + )); +} + +if ($auth->acl_get('m_delete', $forum_id)) +{ + $template->assign_block_vars('quickmod', array( + 'VALUE' => 'delete_topic', + 'TITLE' => $user->lang['DELETE_TOPIC'] + )); +} + +if ($auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED) +{ + $template->assign_block_vars('quickmod', array( + 'VALUE' => 'move', + 'TITLE' => $user->lang['MOVE_TOPIC'] + )); +} + +if ($auth->acl_get('m_split', $forum_id)) +{ + $template->assign_block_vars('quickmod', array( + 'VALUE' => 'split', + 'TITLE' => $user->lang['SPLIT_TOPIC'] + )); +} + +if ($auth->acl_get('m_merge', $forum_id)) +{ + $template->assign_block_vars('quickmod', array( + 'VALUE' => 'merge', + 'TITLE' => $user->lang['MERGE_POSTS'] + )); + + $template->assign_block_vars('quickmod', array( + 'VALUE' => 'merge_topic', + 'TITLE' => $user->lang['MERGE_TOPIC'] + )); +} + +if ($auth->acl_get('m_move', $forum_id)) +{ + $template->assign_block_vars('quickmod', array( + 'VALUE' => 'fork', + 'TITLE' => $user->lang['FORK_TOPIC'] + )); +} + +if ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', $forum_id) && $topic_data['topic_type'] != POST_NORMAL) +{ + $template->assign_block_vars('quickmod', array( + 'VALUE' => 'make_normal', + 'TITLE' => $user->lang['MAKE_NORMAL'] + )); +} + +if ($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY) +{ + $template->assign_block_vars('quickmod', array( + 'VALUE' => 'make_sticky', + 'TITLE' => $user->lang['MAKE_STICKY'] + )); +} + +if ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE) +{ + $template->assign_block_vars('quickmod', array( + 'VALUE' => 'make_announce', + 'TITLE' => $user->lang['MAKE_ANNOUNCE'] + )); +} + +if ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL) +{ + $template->assign_block_vars('quickmod', array( + 'VALUE' => 'make_global', + 'TITLE' => $user->lang['MAKE_GLOBAL'] + )); +} + +if ($auth->acl_get('m_', $forum_id)) +{ + $template->assign_block_vars('quickmod', array( + 'VALUE' => 'topic_logs', + 'TITLE' => $user->lang['VIEW_TOPIC_LOGS'] + )); +} + // If we've got a hightlight set pass it on to pagination. $pagination = generate_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')), $total_posts, $config['posts_per_page'], $start); @@ -603,19 +696,6 @@ $template->assign_vars(array( 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && sizeof($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_TOPIC_MOD_LOCK' => ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED)) ? (($topic_data['topic_status'] == ITEM_UNLOCKED) ? 'lock' : 'unlock') : '', - 'S_TOPIC_MOD_DELETE' => ($auth->acl_get('m_delete', $forum_id)) ? true : false, - 'S_TOPIC_MOD_MOVE' => ($auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED) ? true : false, - 'S_TOPIC_MOD_SPLIT' => ($auth->acl_get('m_split', $forum_id)) ? true : false, - 'S_TOPIC_MOD_MERGE' => ($auth->acl_get('m_merge', $forum_id)) ? true : false, - 'S_TOPIC_MOD_MERGE_TOPIC' => ($auth->acl_get('m_merge', $forum_id)) ? true : false, - 'S_TOPIC_MOD_FORK' => ($auth->acl_get('m_move', $forum_id)) ? true : false, - 'S_TOPIC_MOD_MAKE_NORMAL' => ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', $forum_id) && $topic_data['topic_type'] != POST_NORMAL) ? true : false, - 'S_TOPIC_MOD_MAKE_STICKY' => ($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY) ? true : false, - 'S_TOPIC_MOD_MAKE_ANNOUNCE' => ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE) ? true : false, - 'S_TOPIC_MOD_MAKE_GLOBAL' => ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL) ? true : false, - 'S_TOPIC_MOD_TOPIC_LOGS' => ($auth->acl_get('m_', $forum_id)), - 'S_MOD_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . "&quickmod=1&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url)), true, $user->session_id), 'S_VIEWTOPIC' => true, -- cgit v1.2.1 From 4f59990d900b699cdd2cfe4b43e6972bf99d977b Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Fri, 9 Mar 2012 07:34:52 +0000 Subject: [ticket/10510] Added phpbb_add_quickmod_option and moved existing to it. PHPBB3-10510 --- phpBB/viewtopic.php | 110 ++++++++++------------------------------------------ 1 file changed, 21 insertions(+), 89 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 12a611ce6f..717e1515a8 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -517,97 +517,29 @@ gen_forum_auth_level('topic', $forum_id, $topic_data['forum_status']); // Quick mod tools $allow_change_type = ($auth->acl_get('m_', $forum_id) || ($user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? true : false; -if ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED)) -{ - $template->assign_block_vars('quickmod', array( - 'VALUE' => (($topic_data['topic_status'] == ITEM_UNLOCKED) ? 'lock' : 'unlock'), - 'TITLE' => $user->lang[(($topic_data['topic_status'] == ITEM_UNLOCKED) ? 'LOCK' : 'UNLOCK') . '_TOPIC'] - )); -} - -if ($auth->acl_get('m_delete', $forum_id)) -{ - $template->assign_block_vars('quickmod', array( - 'VALUE' => 'delete_topic', - 'TITLE' => $user->lang['DELETE_TOPIC'] - )); -} - -if ($auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED) -{ - $template->assign_block_vars('quickmod', array( - 'VALUE' => 'move', - 'TITLE' => $user->lang['MOVE_TOPIC'] - )); -} - -if ($auth->acl_get('m_split', $forum_id)) -{ - $template->assign_block_vars('quickmod', array( - 'VALUE' => 'split', - 'TITLE' => $user->lang['SPLIT_TOPIC'] - )); -} - -if ($auth->acl_get('m_merge', $forum_id)) -{ - $template->assign_block_vars('quickmod', array( - 'VALUE' => 'merge', - 'TITLE' => $user->lang['MERGE_POSTS'] - )); - - $template->assign_block_vars('quickmod', array( - 'VALUE' => 'merge_topic', - 'TITLE' => $user->lang['MERGE_TOPIC'] - )); -} - -if ($auth->acl_get('m_move', $forum_id)) -{ - $template->assign_block_vars('quickmod', array( - 'VALUE' => 'fork', - 'TITLE' => $user->lang['FORK_TOPIC'] - )); -} - -if ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', $forum_id) && $topic_data['topic_type'] != POST_NORMAL) -{ - $template->assign_block_vars('quickmod', array( - 'VALUE' => 'make_normal', - 'TITLE' => $user->lang['MAKE_NORMAL'] - )); -} - -if ($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY) -{ - $template->assign_block_vars('quickmod', array( - 'VALUE' => 'make_sticky', - 'TITLE' => $user->lang['MAKE_STICKY'] - )); -} - -if ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE) -{ - $template->assign_block_vars('quickmod', array( - 'VALUE' => 'make_announce', - 'TITLE' => $user->lang['MAKE_ANNOUNCE'] - )); -} - -if ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL) -{ - $template->assign_block_vars('quickmod', array( - 'VALUE' => 'make_global', - 'TITLE' => $user->lang['MAKE_GLOBAL'] - )); -} +$quickmod_array = array( + 'lock' => array('LOCK_TOPIC', ($topic_data['topic_status'] == ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED))), + 'unlock' => array('UNLOCK_TOPIC', ($topic_data['topic_status'] != ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED))), + 'delete_topic' => array('DELETE_TOPIC', $auth->acl_get('m_delete', $forum_id)), + 'move' => array('MOVE_TOPIC', $auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED), + 'split' => array('SPLIT_TOPIC', $auth->acl_get('m_split', $forum_id)), + '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_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)), + 'topic_logs' => array('VIEW_TOPIC_LOGS', $auth->acl_get('m_', $forum_id)), +); -if ($auth->acl_get('m_', $forum_id)) +foreach($quickmod_array as $option => $qm_ary) { - $template->assign_block_vars('quickmod', array( - 'VALUE' => 'topic_logs', - 'TITLE' => $user->lang['VIEW_TOPIC_LOGS'] - )); + $lang_string = $user->lang[$qm_ary[0]]; + if ((isset($qm_ary[1])) ? $qm_ary[1] : true) + { + phpbb_add_quickmod_option($option, $lang_string); + } } // If we've got a hightlight set pass it on to pagination. -- cgit v1.2.1 From 784c9725f3394ce866ab260485b32d501e07a628 Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Sun, 11 Mar 2012 19:20:13 +0000 Subject: [ticket/10510] Made a couple improvements to phpbb_add_quickmod_option. PHPBB3-10510 --- 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 717e1515a8..46c25cba81 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -535,8 +535,8 @@ $quickmod_array = array( foreach($quickmod_array as $option => $qm_ary) { - $lang_string = $user->lang[$qm_ary[0]]; - if ((isset($qm_ary[1])) ? $qm_ary[1] : true) + $lang_string = $user->lang($qm_ary[0]); + if (isset($qm_ary[1]) && $qm_ary[1]) { phpbb_add_quickmod_option($option, $lang_string); } -- cgit v1.2.1 From b530a4ede452dc52f8d960cb1e6a608ceca00565 Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Mon, 12 Mar 2012 06:40:10 +0000 Subject: [ticket/10510] Shortened an if statement. Replaced an isset() and var check with a !empty. PHPBB3-10510 --- 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 46c25cba81..1c03aae39e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -536,7 +536,7 @@ $quickmod_array = array( foreach($quickmod_array as $option => $qm_ary) { $lang_string = $user->lang($qm_ary[0]); - if (isset($qm_ary[1]) && $qm_ary[1]) + if (!empty($qm_ary[1])) { phpbb_add_quickmod_option($option, $lang_string); } -- cgit v1.2.1 From 79a987ffcb19832e1ddefe8be535b181f8acbd73 Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Mon, 12 Mar 2012 07:43:01 +0000 Subject: [ticket/10510] Moved a $user->lang call into the function. PHPBB3-10510 --- phpBB/viewtopic.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 1c03aae39e..cf97196e31 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -535,10 +535,9 @@ $quickmod_array = array( foreach($quickmod_array as $option => $qm_ary) { - $lang_string = $user->lang($qm_ary[0]); if (!empty($qm_ary[1])) { - phpbb_add_quickmod_option($option, $lang_string); + phpbb_add_quickmod_option($option, $qm_ary[0]); } } -- cgit v1.2.1 From ddf1a05ad018404f57472068cd533e121343e907 Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Thu, 29 Mar 2012 21:09:02 +0100 Subject: [ticket/10510] Added docs to viewtopic quick mod tools array. PHPBB3-10510 --- 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 cf97196e31..8a95851b7e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -518,6 +518,8 @@ gen_forum_auth_level('topic', $forum_id, $topic_data['forum_status']); $allow_change_type = ($auth->acl_get('m_', $forum_id) || ($user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? true : false; $quickmod_array = array( +// 'key' => array('LANG_KEY', $userHasPermissions), + 'lock' => array('LOCK_TOPIC', ($topic_data['topic_status'] == ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED))), 'unlock' => array('UNLOCK_TOPIC', ($topic_data['topic_status'] != ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED))), 'delete_topic' => array('DELETE_TOPIC', $auth->acl_get('m_delete', $forum_id)), -- cgit v1.2.1 From 8a28456f759747fc34aaf9a6589102fcace3acb6 Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Sat, 16 Jul 2011 17:53:22 +0100 Subject: [ticket/10273] AJAXified approve / disapprove posts (in viewtopic). This commit AJAXifies the moderator approval functionality, and adds it to viewtopic instead of the MCP. This commit has involved some language changes, which may affect fallbacks. PHPBB3-10273 --- 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 8a95851b7e..1ce80568b6 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1534,6 +1534,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'U_YIM' => $user_cache[$poster_id]['yim'], '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"), 'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $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) : '', -- cgit v1.2.1 From 0e55b2393dffa269a724f3090469dad563217dff Mon Sep 17 00:00:00 2001 From: Callum Macrae Date: Sun, 25 Sep 2011 16:02:26 +0100 Subject: [ticket/10270] Removed all the inline language and HTML from the JS. PHPBB3-10270 --- 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 1ce80568b6..a43edee5da 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -655,6 +655,8 @@ $template->assign_vars(array( 'U_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks']) ? $viewtopic_url . '&bookmark=1&hash=' . generate_link_hash("topic_$topic_id") : '', 'L_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], + 'L_BOOKMARK_TOPIC_REAL' => $user->lang['BOOKMARK_TOPIC'], + 'S_BOOKMARKED_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? true : false, 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=post&f=$forum_id") : '', 'U_POST_REPLY_TOPIC' => ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&f=$forum_id&t=$topic_id") : '', -- cgit v1.2.1 From 779b16041cf270f1fd0873e6490ce5f5cc11d5e4 Mon Sep 17 00:00:00 2001 From: Rahul R Date: Tue, 10 Apr 2012 21:27:09 +0530 Subject: [ticket/10777] Corrected typo in comment savely was corrected to safely PHPBB3-10777 --- 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 a43edee5da..df6ccc5905 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1629,7 +1629,7 @@ else $all_marked_read = true; } -// If there are absolutely no more unread posts in this forum and unread posts shown, we can savely show the #unread link +// If there are absolutely no more unread posts in this forum and unread posts shown, we can safely show the #unread link if ($all_marked_read) { if ($post_unread) -- cgit v1.2.1 From f8a5a16d0b8ed23653e1ce261c569fafe0bd6365 Mon Sep 17 00:00:00 2001 From: Rahul R Date: Wed, 11 Apr 2012 06:10:45 +0530 Subject: [ticket/10777] Split the comment into 2 lines Split the comment into 2 lines each having less than 79 characters. PHPBB3-10777 --- phpBB/viewtopic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index df6ccc5905..1f167ed722 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1629,7 +1629,8 @@ else $all_marked_read = true; } -// If there are absolutely no more unread posts in this forum and unread posts shown, we can safely show the #unread link +// If there are absolutely no more unread posts in this forum +// and unread posts shown, we can safely show the #unread link if ($all_marked_read) { if ($post_unread) -- cgit v1.2.1 From b83fa0349ad30eefed3e8064d29793a9b3dd17f7 Mon Sep 17 00:00:00 2001 From: Senky Date: Mon, 30 Apr 2012 21:55:24 +0200 Subject: [ticket/10847] fixing all misspelled "dependant" to "dependent" PHPBB3-10847 --- 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 1f167ed722..b75f4aeccf 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1099,7 +1099,7 @@ while ($row = $db->sql_fetchrow($result)) { $user_sig = ''; - // We add the signature to every posters entry because enable_sig is post dependant + // We add the signature to every posters entry because enable_sig is post dependent if ($row['user_sig'] && $config['allow_sig'] && $user->optionget('viewsigs')) { $user_sig = $row['user_sig']; -- cgit v1.2.1 From fc3a19567f1852389dfa78472cca4b1d01387bfa Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 16 May 2012 13:44:40 +0200 Subject: [ticket/10811] Make it easier for MODs/Extensions to define the alt-text PHPBB3-10811 --- phpBB/viewtopic.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index a43edee5da..6a15d4e15b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -450,6 +450,7 @@ $viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&a $s_watching_topic = array( 'link' => '', 'title' => '', + 'toggle' => '', 'is_watching' => false, ); @@ -649,13 +650,14 @@ $template->assign_vars(array( 'U_PRINT_TOPIC' => ($auth->acl_get('f_print', $forum_id)) ? $viewtopic_url . '&view=print' : '', 'U_EMAIL_TOPIC' => ($auth->acl_get('f_email', $forum_id) && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&t=$topic_id") : '', - 'U_WATCH_TOPIC' => $s_watching_topic['link'], - 'L_WATCH_TOPIC' => $s_watching_topic['title'], + 'U_WATCH_TOPIC' => $s_watching_topic['link'], + 'S_WATCH_TOPIC_TITLE' => $s_watching_topic['title'], + 'S_WATCH_TOPIC_TOGGLE' => $s_watching_topic['toggle'], 'S_WATCHING_TOPIC' => $s_watching_topic['is_watching'], 'U_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks']) ? $viewtopic_url . '&bookmark=1&hash=' . generate_link_hash("topic_$topic_id") : '', - 'L_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], - 'L_BOOKMARK_TOPIC_REAL' => $user->lang['BOOKMARK_TOPIC'], + 'S_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], + 'S_BOOKMARK_TOGGLE' => (!$user->data['is_registered'] || !$config['allow_bookmarks'] || !$topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], 'S_BOOKMARKED_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? true : false, 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=post&f=$forum_id") : '', -- cgit v1.2.1 From f1056a9b2fd6e4ff7bc107372e9210bae9e077f0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 5 Jul 2012 00:30:02 +0200 Subject: [ticket/10811] Make toogle_subscribe more generic so it can toogle all links PHPBB3-10811 --- phpBB/viewtopic.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 6a15d4e15b..a5561e4f4a 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -449,8 +449,9 @@ $viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&a // Are we watching this topic? $s_watching_topic = array( 'link' => '', + 'link_toggle' => '', 'title' => '', - 'toggle' => '', + 'title_toggle' => '', 'is_watching' => false, ); @@ -651,8 +652,9 @@ $template->assign_vars(array( 'U_EMAIL_TOPIC' => ($auth->acl_get('f_email', $forum_id) && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&t=$topic_id") : '', 'U_WATCH_TOPIC' => $s_watching_topic['link'], + 'U_WATCH_TOPIC_TOGGLE' => $s_watching_topic['link_toggle'], 'S_WATCH_TOPIC_TITLE' => $s_watching_topic['title'], - 'S_WATCH_TOPIC_TOGGLE' => $s_watching_topic['toggle'], + 'S_WATCH_TOPIC_TOGGLE' => $s_watching_topic['title_toggle'], 'S_WATCHING_TOPIC' => $s_watching_topic['is_watching'], 'U_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks']) ? $viewtopic_url . '&bookmark=1&hash=' . generate_link_hash("topic_$topic_id") : '', -- cgit v1.2.1 From 922147f05a75d5a0e00b34f0102bc014583df984 Mon Sep 17 00:00:00 2001 From: Drae Date: Wed, 4 Jul 2012 23:19:59 +0100 Subject: [ticket/10968] Render pagination within the template Since phpBB 2 pagination has been rendered mostly within the source. This limits just what designers can do with pagination. The current form is also questionable in terms of "best practice". The aim is to move rendering completely to the template via the use of a block element. Enabling S_ template vars also allows for control over specific aspects of the pagination output such as next, previous, active and ellipsis. Related to this - merging the capabilities of the topic_generate_pagination with generate_pagination removes an element of duplication. PHPBB3-10968 --- phpBB/viewtopic.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 0d6e9afd54..98a4f123be 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -546,7 +546,7 @@ foreach($quickmod_array as $option => $qm_ary) } // If we've got a hightlight set pass it on to pagination. -$pagination = generate_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')), $total_posts, $config['posts_per_page'], $start); +generate_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')), $total_posts, $config['posts_per_page'], $start); // Navigation links generate_forum_nav($topic_data); @@ -598,7 +598,6 @@ $template->assign_vars(array( 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'TOPIC_AUTHOR' => get_username_string('username', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), - 'PAGINATION' => $pagination, 'PAGE_NUMBER' => on_page($total_posts, $config['posts_per_page'], $start), '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) : '', -- cgit v1.2.1 From dc71c0629e60acccd39b59538f2e7f5b09b32509 Mon Sep 17 00:00:00 2001 From: Drae Date: Thu, 5 Jul 2012 18:56:14 +0100 Subject: [feature/pagination-as-list] Various fixes and improvements Extracted common template code for prosilver as per subsilver2. Various other fixups and oversight corrections, changed name of the "new" template function and re-introduced existing version. Altered on_page to compensate for removal of some templating vars from pagination routine. PHPBB3-10968 --- phpBB/viewtopic.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 98a4f123be..969f6fb63e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -545,9 +545,6 @@ foreach($quickmod_array as $option => $qm_ary) } } -// If we've got a hightlight set pass it on to pagination. -generate_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')), $total_posts, $config['posts_per_page'], $start); - // Navigation links generate_forum_nav($topic_data); @@ -585,6 +582,10 @@ if (!empty($_EXTRA_URL)) } } +// If we've got a hightlight set pass it on to pagination. +$base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); +generate_template_pagination($base_url, 'pagination', $total_posts, $config['posts_per_page'], $start); + // Send vars to template $template->assign_vars(array( 'FORUM_ID' => $forum_id, @@ -598,7 +599,7 @@ $template->assign_vars(array( 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'TOPIC_AUTHOR' => get_username_string('username', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), - 'PAGE_NUMBER' => on_page($total_posts, $config['posts_per_page'], $start), + 'PAGE_NUMBER' => on_page($base_url, $total_posts, $config['posts_per_page'], $start), '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(', ', $forum_moderators[$forum_id]) : '', -- cgit v1.2.1 From cf4d6e926dd83d61073ac355cdaf7778a18dcbf8 Mon Sep 17 00:00:00 2001 From: Drae Date: Fri, 6 Jul 2012 14:44:04 +0100 Subject: [feature/pagination-as-list] Rename and deprecate functions Returned and marked deprecated topic_generate_pagination. Rename new function in line with coding guidelines. PHPBB3-10968 --- 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 969f6fb63e..2e197932af 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -584,7 +584,7 @@ if (!empty($_EXTRA_URL)) // If we've got a hightlight set pass it on to pagination. $base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); -generate_template_pagination($base_url, 'pagination', $total_posts, $config['posts_per_page'], $start); +phpbb_generate_template_pagination($base_url, 'pagination', $total_posts, $config['posts_per_page'], $start); // Send vars to template $template->assign_vars(array( -- cgit v1.2.1 From 27d8aef528460e87efc90bc4fffc82c0d1fa87d9 Mon Sep 17 00:00:00 2001 From: Drae Date: Sun, 8 Jul 2012 21:07:28 +0100 Subject: [feature/pagination-as-list] Updates for nils comments Re-remove deprecated functions, change on_page to phpbb_on_page, add null returns, remove globals and pass as params. PHPBB3-10968 --- 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 2e197932af..51c92df1af 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -584,7 +584,7 @@ if (!empty($_EXTRA_URL)) // If we've got a hightlight set pass it on to pagination. $base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); -phpbb_generate_template_pagination($base_url, 'pagination', $total_posts, $config['posts_per_page'], $start); +phpbb_generate_template_pagination($template, $base_url, 'pagination', $total_posts, $config['posts_per_page'], $start); // Send vars to template $template->assign_vars(array( @@ -599,7 +599,7 @@ $template->assign_vars(array( 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'TOPIC_AUTHOR' => get_username_string('username', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), - 'PAGE_NUMBER' => on_page($base_url, $total_posts, $config['posts_per_page'], $start), + 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total_posts, $config['posts_per_page'], $start), '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(', ', $forum_moderators[$forum_id]) : '', -- cgit v1.2.1 From 584d49459d22ebf47239fc97ad8358a5404dacf4 Mon Sep 17 00:00:00 2001 From: Drae Date: Thu, 12 Jul 2012 02:36:00 +0100 Subject: [feature/pagination-as-list] New parameter for name of start var Add a new parameter to hold the name of the start variable. This fulfills ticket PHPBB3-8535. PHPBB3-10968 --- 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 51c92df1af..c0dbc12fca 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -584,7 +584,7 @@ if (!empty($_EXTRA_URL)) // If we've got a hightlight set pass it on to pagination. $base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); -phpbb_generate_template_pagination($template, $base_url, 'pagination', $total_posts, $config['posts_per_page'], $start); +phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total_posts, $config['posts_per_page'], $start); // Send vars to template $template->assign_vars(array( -- cgit v1.2.1 From 67665f59577092badf7eb0b5585e5ae39c52c8da Mon Sep 17 00:00:00 2001 From: Nathan Date: Sat, 14 Jul 2012 18:12:57 -0500 Subject: [ticket/10990] Use $user->lang['COMMA_SEPARATOR'] when appropriate PHPBB3-10990 --- 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 349f53cbe2..b6df14d42d 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -602,7 +602,7 @@ $template->assign_vars(array( 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total_posts, $config['posts_per_page'], $start), '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(', ', $forum_moderators[$forum_id]) : '', + 'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($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'), -- cgit v1.2.1 From 54caef8f902cf5ea40da0d818b770d15b6d7e7e2 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Thu, 15 Mar 2012 20:49:33 +0000 Subject: [feature/events] Add core.viewtopic_postrow ledge PHPBB3-9550 --- phpBB/viewtopic.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 349f53cbe2..4f95d40e73 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1574,6 +1574,11 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $postrow = array_merge($postrow, $cp_row['row']); } + $vars = array('postrow'); + $event = new phpbb_event_data(compact($vars)); + $phpbb_dispatcher->dispatch('core.viewtopic_postrow', $event); + extract($event->get_data_filtered($vars)); + // Dump vars into template $template->assign_block_vars('postrow', $postrow); -- cgit v1.2.1 From a47ac64e5f5ad1c01e6ecbb64a5e1c80ab2c90b2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 16 Mar 2012 10:30:28 +0100 Subject: [feature/events] Adding ledge viewtopic_page_header Used by phpBB Gallery PHPBB3-9550 --- phpBB/viewtopic.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 4f95d40e73..148446490e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1734,8 +1734,15 @@ if (!request_var('t', 0) && !empty($topic_id)) $request->overwrite('t', $topic_id); } +$page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], floor($start / $config['posts_per_page']) + 1) : ''); + +$vars = array('page_title', 'topic_data', 'forum_id', 'start'); +$event = new phpbb_event_data(compact($vars)); +$phpbb_dispatcher->dispatch('core.viewtopic_page_header', $event); +extract($event->get_data_filtered($vars)); + // Output the page -page_header($topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], floor($start / $config['posts_per_page']) + 1) : ''), true, $forum_id); +page_header($page_title, true, $forum_id); $template->set_filenames(array( 'body' => ($view == 'print') ? 'viewtopic_print.html' : 'viewtopic_body.html') -- cgit v1.2.1 From dcf97714a56801bcaf41addeadb08bcacc4514df Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 16 Mar 2012 10:38:29 +0100 Subject: [feature/events] Adding ledge viewtopic_get_userdata Used by phpBB Gallery PHPBB3-9550 --- phpBB/viewtopic.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 148446490e..8bca1973a7 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -987,6 +987,11 @@ $sql_ary = array( AND u.user_id = p.poster_id', ); +$vars = array('sql_ary'); +$event = new phpbb_event_data(compact($vars)); +$phpbb_dispatcher->dispatch('core.viewtopic_get_userdata', $event); +extract($event->get_data_filtered($vars)); + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); -- cgit v1.2.1 From 2581b0e1e3c68bfae8357dddc1d379914fd67654 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 16 Mar 2012 10:42:40 +0100 Subject: [feature/events] Adding ledge viewtopic_user_cache_guest Used by phpBB Gallery PHPBB3-9550 --- phpBB/viewtopic.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 8bca1973a7..256bada0d9 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1068,7 +1068,7 @@ while ($row = $db->sql_fetchrow($result)) { if ($poster_id == ANONYMOUS) { - $user_cache[$poster_id] = array( + $user_cache_data = array( 'joined' => '', 'posts' => '', 'from' => '', @@ -1103,6 +1103,13 @@ while ($row = $db->sql_fetchrow($result)) 'allow_pm' => 0, ); + $vars = array('user_cache_data', 'row', 'poster_id'); + $event = new phpbb_event_data(compact($vars)); + $phpbb_dispatcher->dispatch('core.viewtopic_user_cache_guest', $event); + extract($event->get_data_filtered($vars)); + + $user_cache[$poster_id] = $user_cache_data; + get_user_rank($row['user_rank'], false, $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); } else -- cgit v1.2.1 From 713f8e4782cd4c808d6f4a1cbb26f45144eef74e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 16 Mar 2012 10:51:35 +0100 Subject: [feature/events] Adding ledge viewtopic_user_cache Used by phpBB Gallery PHPBB3-9550 --- phpBB/viewtopic.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 256bada0d9..99b875ae3d 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1124,7 +1124,7 @@ while ($row = $db->sql_fetchrow($result)) $id_cache[] = $poster_id; - $user_cache[$poster_id] = array( + $user_cache_data = array( 'joined' => $user->format_date($row['user_regdate']), 'posts' => $row['user_posts'], 'warnings' => (isset($row['user_warnings'])) ? $row['user_warnings'] : 0, @@ -1162,6 +1162,13 @@ while ($row = $db->sql_fetchrow($result)) 'author_profile' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour']), ); + $vars = array('user_cache_data', 'row', 'poster_id'); + $event = new phpbb_event_data(compact($vars)); + $phpbb_dispatcher->dispatch('core.viewtopic_user_cache', $event); + extract($event->get_data_filtered($vars)); + + $user_cache[$poster_id] = $user_cache_data; + get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); if ((!empty($row['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_email')) -- cgit v1.2.1 From 8af7d225ef481cd26e6fd7862847183d25727117 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Tue, 20 Mar 2012 11:23:03 +0000 Subject: [feature/events] Change to use the new method of adding events PHPBB3-9550 --- phpBB/viewtopic.php | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 99b875ae3d..34c8bfbc0f 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -988,9 +988,7 @@ $sql_ary = array( ); $vars = array('sql_ary'); -$event = new phpbb_event_data(compact($vars)); -$phpbb_dispatcher->dispatch('core.viewtopic_get_userdata', $event); -extract($event->get_data_filtered($vars)); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_userdata', compact($vars), $vars)); $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); @@ -1104,9 +1102,7 @@ while ($row = $db->sql_fetchrow($result)) ); $vars = array('user_cache_data', 'row', 'poster_id'); - $event = new phpbb_event_data(compact($vars)); - $phpbb_dispatcher->dispatch('core.viewtopic_user_cache_guest', $event); - extract($event->get_data_filtered($vars)); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_user_cache_guest', compact($vars), $vars)); $user_cache[$poster_id] = $user_cache_data; @@ -1163,9 +1159,7 @@ while ($row = $db->sql_fetchrow($result)) ); $vars = array('user_cache_data', 'row', 'poster_id'); - $event = new phpbb_event_data(compact($vars)); - $phpbb_dispatcher->dispatch('core.viewtopic_user_cache', $event); - extract($event->get_data_filtered($vars)); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_user_cache', compact($vars), $vars)); $user_cache[$poster_id] = $user_cache_data; @@ -1594,9 +1588,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) } $vars = array('postrow'); - $event = new phpbb_event_data(compact($vars)); - $phpbb_dispatcher->dispatch('core.viewtopic_postrow', $event); - extract($event->get_data_filtered($vars)); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_postrow', compact($vars), $vars)); // Dump vars into template $template->assign_block_vars('postrow', $postrow); @@ -1756,9 +1748,7 @@ if (!request_var('t', 0) && !empty($topic_id)) $page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], floor($start / $config['posts_per_page']) + 1) : ''); $vars = array('page_title', 'topic_data', 'forum_id', 'start'); -$event = new phpbb_event_data(compact($vars)); -$phpbb_dispatcher->dispatch('core.viewtopic_page_header', $event); -extract($event->get_data_filtered($vars)); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_page_header', compact($vars), $vars)); // Output the page page_header($page_title, true, $forum_id); -- cgit v1.2.1 From 3f1b4e83aef7f7344cd551463b59de71bb4bd6fe Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Sat, 31 Mar 2012 13:39:41 +0100 Subject: [feature/events] Removing the third trigger_event parameter PHPBB3-9550 --- phpBB/viewtopic.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 34c8bfbc0f..7a1b9ba9e4 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -988,7 +988,7 @@ $sql_ary = array( ); $vars = array('sql_ary'); -extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_userdata', compact($vars), $vars)); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_userdata', compact($vars))); $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); @@ -1102,7 +1102,7 @@ while ($row = $db->sql_fetchrow($result)) ); $vars = array('user_cache_data', 'row', 'poster_id'); - extract($phpbb_dispatcher->trigger_event('core.viewtopic_user_cache_guest', compact($vars), $vars)); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_user_cache_guest', compact($vars))); $user_cache[$poster_id] = $user_cache_data; @@ -1159,7 +1159,7 @@ while ($row = $db->sql_fetchrow($result)) ); $vars = array('user_cache_data', 'row', 'poster_id'); - extract($phpbb_dispatcher->trigger_event('core.viewtopic_user_cache', compact($vars), $vars)); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_user_cache', compact($vars))); $user_cache[$poster_id] = $user_cache_data; @@ -1588,7 +1588,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) } $vars = array('postrow'); - extract($phpbb_dispatcher->trigger_event('core.viewtopic_postrow', compact($vars), $vars)); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_postrow', compact($vars))); // Dump vars into template $template->assign_block_vars('postrow', $postrow); @@ -1748,7 +1748,7 @@ if (!request_var('t', 0) && !empty($topic_id)) $page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], floor($start / $config['posts_per_page']) + 1) : ''); $vars = array('page_title', 'topic_data', 'forum_id', 'start'); -extract($phpbb_dispatcher->trigger_event('core.viewtopic_page_header', compact($vars), $vars)); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_page_header', compact($vars))); // Output the page page_header($page_title, true, $forum_id); -- cgit v1.2.1 From f01d742b5649678de3e5ba4aa45f4176c8ff5aac Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 20 Jun 2012 16:07:49 +0200 Subject: [feature/php-events] Add additional vars and control to viewtopic_postrow event PHPBB3-9550 --- phpBB/viewtopic.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 7a1b9ba9e4..20d4c2af1b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1582,14 +1582,16 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'L_IGNORE_POST' => ($row['hide_post']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), '', '') : '', ); + $user_poster_data = $user_cache[$poster_id]; + + $vars = array('row', 'cp_row', 'user_poster_data', 'postrow'); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_postrow', compact($vars))); + if (isset($cp_row['row']) && sizeof($cp_row['row'])) { $postrow = array_merge($postrow, $cp_row['row']); } - $vars = array('postrow'); - extract($phpbb_dispatcher->trigger_event('core.viewtopic_postrow', compact($vars))); - // Dump vars into template $template->assign_block_vars('postrow', $postrow); -- cgit v1.2.1 From 16736d4e4cfabc65f84c6339bf81ae01f1edffc2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 20 Jun 2012 16:43:48 +0200 Subject: [feature/php-events] Make naming of postrow consistent with others (post_row) PHPBB3-9550 --- phpBB/viewtopic.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 20d4c2af1b..ce73001c78 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1506,7 +1506,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) ))); // - $postrow = array( + $post_row = array( 'POST_AUTHOR_FULL' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_full'] : get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_colour'] : get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_username'] : get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), @@ -1584,16 +1584,16 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $user_poster_data = $user_cache[$poster_id]; - $vars = array('row', 'cp_row', 'user_poster_data', 'postrow'); + $vars = array('row', 'cp_row', 'user_poster_data', 'post_row'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_postrow', compact($vars))); if (isset($cp_row['row']) && sizeof($cp_row['row'])) { - $postrow = array_merge($postrow, $cp_row['row']); + $post_row = array_merge($post_row, $cp_row['row']); } // Dump vars into template - $template->assign_block_vars('postrow', $postrow); + $template->assign_block_vars('postrow', $post_row); if (!empty($cp_row['blockrow'])) { -- cgit v1.2.1 From 5bffd9883de02807817838cd840a5293b6b908ac Mon Sep 17 00:00:00 2001 From: Fyorl Date: Thu, 2 Aug 2012 20:47:09 +0100 Subject: [feature/attach-dl] Added links to the templates PHPBB3-11042 --- phpBB/viewtopic.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index b6df14d42d..fce1be7784 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1314,6 +1314,11 @@ if (sizeof($attach_list)) } } +$template->assign_vars(array( + 'S_HAS_ATTACHMENTS' => !empty($attachments), + 'U_DL_ALL_LINK' => append_sid("{$phpbb_root_path}download/file.$phpEx", "topic_id=$topic_id"), +)); + // Instantiate BBCode if need be if ($bbcode_bitfield !== '') { @@ -1556,6 +1561,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'POSTER_ID' => $poster_id, 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, + 'S_MULTIPLE_ATTACH' => !empty($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]) > 1, 'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true, 'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $forum_id)) ? true : false, 'S_DISPLAY_NOTICE' => $display_notice && $row['post_attachment'], @@ -1567,6 +1573,8 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'S_IGNORE_POST' => ($row['hide_post']) ? true : false, 'L_IGNORE_POST' => ($row['hide_post']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), '', '') : '', + + 'U_DL_ALL_LINK' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'post_id=' . $row['post_id']), ); if (isset($cp_row['row']) && sizeof($cp_row['row'])) -- cgit v1.2.1 From ee7d9614c07c3961d62edbd0e8bf5ef1e2d75ff8 Mon Sep 17 00:00:00 2001 From: Fyorl Date: Sat, 4 Aug 2012 13:18:20 +0100 Subject: [feature/attach-dl] Downloading all attachments fully implemented Added a function to list all available archiving methods and integrated it with the prosilver style. Heavy modifications to download/file.php to support archiving and downloading of multiple files at once. PHPBB3-11042 --- phpBB/viewtopic.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index fce1be7784..1199fc4d14 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -15,6 +15,7 @@ $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); include($phpbb_root_path . 'includes/functions_display.' . $phpEx); +include($phpbb_root_path . 'includes/functions_compress.' . $phpEx); include($phpbb_root_path . 'includes/bbcode.' . $phpEx); // Start session management @@ -1316,9 +1317,14 @@ if (sizeof($attach_list)) $template->assign_vars(array( 'S_HAS_ATTACHMENTS' => !empty($attachments), - 'U_DL_ALL_LINK' => append_sid("{$phpbb_root_path}download/file.$phpEx", "topic_id=$topic_id"), )); +$methods = gen_download_links('topic_id', $topic_id, $phpbb_root_path, $phpEx); +foreach ($methods as $method) +{ + $template->assign_block_vars('dl_method', $method); +} + // Instantiate BBCode if need be if ($bbcode_bitfield !== '') { @@ -1573,8 +1579,6 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'S_IGNORE_POST' => ($row['hide_post']) ? true : false, 'L_IGNORE_POST' => ($row['hide_post']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), '', '') : '', - - 'U_DL_ALL_LINK' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'post_id=' . $row['post_id']), ); if (isset($cp_row['row']) && sizeof($cp_row['row'])) @@ -1602,6 +1606,12 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'DISPLAY_ATTACHMENT' => $attachment) ); } + + $methods = gen_download_links('post_id', $row['post_id'], $phpbb_root_path, $phpEx); + foreach ($methods as $method) + { + $template->assign_block_vars('postrow.dl_method', $method); + } } $prev_post_id = $row['post_id']; -- cgit v1.2.1 From 18d7210a11b4d98c50ad55bb427c8cd2cc14a2f1 Mon Sep 17 00:00:00 2001 From: Fyorl Date: Sat, 4 Aug 2012 13:58:50 +0100 Subject: [feature/attach-dl] Prefixed gen_download_links with phpbb_ PHPBB3-11042 --- 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 1199fc4d14..a4d7c8baa1 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1319,7 +1319,7 @@ $template->assign_vars(array( 'S_HAS_ATTACHMENTS' => !empty($attachments), )); -$methods = gen_download_links('topic_id', $topic_id, $phpbb_root_path, $phpEx); +$methods = phpbb_gen_download_links('topic_id', $topic_id, $phpbb_root_path, $phpEx); foreach ($methods as $method) { $template->assign_block_vars('dl_method', $method); @@ -1607,7 +1607,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) ); } - $methods = gen_download_links('post_id', $row['post_id'], $phpbb_root_path, $phpEx); + $methods = phpbb_gen_download_links('post_id', $row['post_id'], $phpbb_root_path, $phpEx); foreach ($methods as $method) { $template->assign_block_vars('postrow.dl_method', $method); -- cgit v1.2.1 From 3f710b58a5a7c371b8016c808a756616a77f4503 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 6 Aug 2012 15:37:02 +0200 Subject: [feature/php-events] Fix doc and naming of core.viewtopic_get_post_data PHPBB3-9550 --- phpBB/viewtopic.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index ce73001c78..22b1bd9dea 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -987,8 +987,15 @@ $sql_ary = array( AND u.user_id = p.poster_id', ); +/** +* Event to modify the SQL query before the post and poster data is queried +* +* @event core.viewtopic_get_post_data +* @var array sql_ary The SQL array to get the data of posts and posters +* @since 3.1-A1 +*/ $vars = array('sql_ary'); -extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_userdata', compact($vars))); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_post_data', compact($vars))); $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); -- cgit v1.2.1 From ff12de97b72ef46a8bde5aca561e3cc18b7fa614 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 6 Aug 2012 16:12:17 +0200 Subject: [feature/php-events] Fix doc and naming of core.viewtopic_cache_guest_data PHPBB3-9550 --- phpBB/viewtopic.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 22b1bd9dea..1939d1f73b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1108,8 +1108,17 @@ while ($row = $db->sql_fetchrow($result)) 'allow_pm' => 0, ); - $vars = array('user_cache_data', 'row', 'poster_id'); - extract($phpbb_dispatcher->trigger_event('core.viewtopic_user_cache_guest', compact($vars))); + /** + * Modify the guests user data displayed with the posts + * + * @event core.viewtopic_cache_guest_data + * @var array user_cache_data Array with the user's data + * @var int poster_id Poster's user id + * @var array row Array with original user and post data + * @since 3.1-A1 + */ + $vars = array('user_cache_data', 'poster_id', 'row'); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_cache_guest_data', compact($vars))); $user_cache[$poster_id] = $user_cache_data; -- cgit v1.2.1 From eb80d280b15ddb442f290c9722d394f63a9036e3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 6 Aug 2012 16:17:29 +0200 Subject: [feature/php-events] Fix doc and naming of core.viewtopic_cache_user_data PHPBB3-9550 --- phpBB/viewtopic.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 1939d1f73b..cad3789fd4 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1174,8 +1174,17 @@ while ($row = $db->sql_fetchrow($result)) 'author_profile' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour']), ); - $vars = array('user_cache_data', 'row', 'poster_id'); - extract($phpbb_dispatcher->trigger_event('core.viewtopic_user_cache', compact($vars))); + /** + * Modify the users' data displayed with their posts + * + * @event core.viewtopic_cache_user_data + * @var array user_cache_data Array with the user's data + * @var int poster_id Poster's user id + * @var array row Array with original user and post data + * @since 3.1-A1 + */ + $vars = array('user_cache_data', 'poster_id', 'row'); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_cache_user_data', compact($vars))); $user_cache[$poster_id] = $user_cache_data; -- cgit v1.2.1 From dcb4d3b92612faefc9c7b08c843be24f79d31c21 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 6 Aug 2012 16:42:13 +0200 Subject: [feature/php-events] Fix doc and naming of core.viewtopic_modify_post_row PHPBB3-9550 --- phpBB/viewtopic.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index cad3789fd4..0881fb3e48 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1609,8 +1609,18 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $user_poster_data = $user_cache[$poster_id]; + /** + * Modify the posts template block + * + * @event core.viewtopic_modify_post_row + * @var array row Array with original post and user data + * @var array cp_row Custom profile field data of the poster + * @var array user_poster_data Poster's data from user cache + * @var array post_row Template block array of the post + * @since 3.1-A1 + */ $vars = array('row', 'cp_row', 'user_poster_data', 'post_row'); - extract($phpbb_dispatcher->trigger_event('core.viewtopic_postrow', compact($vars))); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_row', compact($vars))); if (isset($cp_row['row']) && sizeof($cp_row['row'])) { -- cgit v1.2.1 From c277c240f83780b527511339068bd25d793712a9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 6 Aug 2012 17:05:22 +0200 Subject: [feature/php-events] Fix doc and naming of core.viewtopic_modify_page_title PHPBB3-9550 --- phpBB/viewtopic.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 0881fb3e48..43aacbff0c 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1784,8 +1784,18 @@ if (!request_var('t', 0) && !empty($topic_id)) $page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], floor($start / $config['posts_per_page']) + 1) : ''); +/** +* You can use this event to modify the page title of the viewtopic page +* +* @event core.viewtopic_modify_page_title +* @var string page_title Title of the index page +* @var array topic_data Array with topic data +* @var int forum_id Forum ID of the topic +* @var int start Start offset used to calculate the page +* @since 3.1-A1 +*/ $vars = array('page_title', 'topic_data', 'forum_id', 'start'); -extract($phpbb_dispatcher->trigger_event('core.viewtopic_page_header', compact($vars))); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_page_title', compact($vars))); // Output the page page_header($page_title, true, $forum_id); -- cgit v1.2.1 From 058bf77a397aa49d1dfc76d95b2c2fde124cf984 Mon Sep 17 00:00:00 2001 From: Fyorl Date: Tue, 7 Aug 2012 12:00:10 +0100 Subject: [feature/attach-dl] Moved functions_compress include PHPBB3-11042 --- 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 a4d7c8baa1..a65944742e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -15,7 +15,6 @@ $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); include($phpbb_root_path . 'includes/functions_display.' . $phpEx); -include($phpbb_root_path . 'includes/functions_compress.' . $phpEx); include($phpbb_root_path . 'includes/bbcode.' . $phpEx); // Start session management @@ -1319,6 +1318,7 @@ $template->assign_vars(array( 'S_HAS_ATTACHMENTS' => !empty($attachments), )); +require_once $phpbb_root_path . 'includes/functions_compress.' . $phpEx; $methods = phpbb_gen_download_links('topic_id', $topic_id, $phpbb_root_path, $phpEx); foreach ($methods as $method) { -- cgit v1.2.1 From 773c513ac0a0d3b580462a5eec2f65782f26b3c3 Mon Sep 17 00:00:00 2001 From: Fyorl Date: Tue, 7 Aug 2012 16:59:57 +0100 Subject: [feature/attach-dl] Moved include of compress class inside function PHPBB3-11042 --- 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 a65944742e..9f044e0a89 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1318,7 +1318,6 @@ $template->assign_vars(array( 'S_HAS_ATTACHMENTS' => !empty($attachments), )); -require_once $phpbb_root_path . 'includes/functions_compress.' . $phpEx; $methods = phpbb_gen_download_links('topic_id', $topic_id, $phpbb_root_path, $phpEx); foreach ($methods as $method) { -- cgit v1.2.1 From 53aadd60a66c813db90aa1d54e649384679f2614 Mon Sep 17 00:00:00 2001 From: Fyorl Date: Fri, 17 Aug 2012 16:16:02 +0100 Subject: [feature/attach-dl] Renamed $post_id to $post_msg_id PHPBB3-11042 --- 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 9f044e0a89..41566219b9 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1606,7 +1606,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) ); } - $methods = phpbb_gen_download_links('post_id', $row['post_id'], $phpbb_root_path, $phpEx); + $methods = phpbb_gen_download_links('post_msg_id', $row['post_id'], $phpbb_root_path, $phpEx); foreach ($methods as $method) { $template->assign_block_vars('postrow.dl_method', $method); -- cgit v1.2.1 From 6ad805713d4105372d4b4aabd8f2498662a10369 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 20 Aug 2012 09:52:35 +0200 Subject: [feature/php-events] Fix doc of core.viewtopic_cache_guest_data PHPBB3-9550 --- 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 43aacbff0c..1da962bbaa 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1109,7 +1109,7 @@ while ($row = $db->sql_fetchrow($result)) ); /** - * Modify the guests user data displayed with the posts + * Modify the guest user's data displayed with the posts * * @event core.viewtopic_cache_guest_data * @var array user_cache_data Array with the user's data -- cgit v1.2.1 From 64bc658c044451c4808fac3bd5781196c604ac38 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 20 Aug 2012 09:54:12 +0200 Subject: [feature/php-events] Fix doc of core.viewtopic_get_post_data PHPBB3-9550 --- 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 1da962bbaa..c0dd800a99 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -988,7 +988,7 @@ $sql_ary = array( ); /** -* Event to modify the SQL query before the post and poster data is queried +* Event to modify the SQL query before the post and poster data is retrieved * * @event core.viewtopic_get_post_data * @var array sql_ary The SQL array to get the data of posts and posters -- cgit v1.2.1 From e1a4aa3ea255874660d31e13c0b4cadc8993ef4f Mon Sep 17 00:00:00 2001 From: Fyorl Date: Mon, 20 Aug 2012 21:52:42 +0100 Subject: [feature/attach-dl] Removed the use of some abbreviations PHPBB3-11042 --- 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 41566219b9..036f70e729 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1566,7 +1566,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'POSTER_ID' => $poster_id, 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, - 'S_MULTIPLE_ATTACH' => !empty($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]) > 1, + 'S_MULTIPLE_ATTACHMENTS' => !empty($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]) > 1, 'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true, 'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $forum_id)) ? true : false, 'S_DISPLAY_NOTICE' => $display_notice && $row['post_attachment'], -- cgit v1.2.1