From f4cff08a1943d2bd7f1fc18318fa73018bcf6499 Mon Sep 17 00:00:00 2001 From: Joas Schilling <nickvergessen@gmx.de> Date: Wed, 13 Nov 2013 14:29:24 +0100 Subject: [ticket/12015] Add more parameters to core.viewtopic_get_post_data PHPBB3-12015 --- 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 3a7e633c99..e6019c1ed6 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1001,10 +1001,17 @@ $sql_ary = array( * Event to modify the SQL query before the post and poster data is retrieved * * @event core.viewtopic_get_post_data +* @var int forum_id Forum ID +* @var int topic_id Topic ID +* @var array topic_data Array with topic data +* @var array post_list Array with post_ids we are going to retrieve +* @var int sort_days Display posts of previous x days +* @var string sort_key Key the posts are sorted by +* @var string sort_dir Direction the posts are sorted by * @var array sql_ary The SQL array to get the data of posts and posters * @since 3.1-A1 */ -$vars = array('sql_ary'); +$vars = array('forum_id', 'topic_id', 'topic_data', 'post_list', 'sort_days', 'sort_key', 'sort_dir', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_post_data', compact($vars))); $sql = $db->sql_build_query('SELECT', $sql_ary); -- cgit v1.2.1 From e3b70c4c08c82cbf365e9f5e8e402b1f4888cc53 Mon Sep 17 00:00:00 2001 From: Joas Schilling <nickvergessen@gmx.de> Date: Wed, 13 Nov 2013 14:30:20 +0100 Subject: [ticket/12015] Add attachments to core.viewtopic_modify_post_row PHPBB3-12015 --- 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 e6019c1ed6..c453e3c2a6 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1706,11 +1706,12 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @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 attachments List of attachments * @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'); + $vars = array('row', 'cp_row', 'attachments', 'user_poster_data', 'post_row'); 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 1efab9ec772f0b62572d28d1c2d57fdb998c5f8f Mon Sep 17 00:00:00 2001 From: Joas Schilling <nickvergessen@gmx.de> Date: Wed, 13 Nov 2013 14:31:51 +0100 Subject: [ticket/12015] Add an event after the post has been assigned to the template PHPBB3-12015 --- phpBB/viewtopic.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index c453e3c2a6..2f9a869bc6 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1747,6 +1747,20 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) } } + /** + * Event after the post data has been assigned to the template + * + * @event core.viewtopic_post_row_after + * @var array row Array with original post and user data + * @var array cp_row Custom profile field data of the poster + * @var array attachments List of attachments + * @var array user_poster_data Poster's data from user cache + * @var array post_row Template block array of the post + * @since 3.1-A2 + */ + $vars = array('row', 'cp_row', 'attachments', 'user_poster_data', 'post_row'); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_post_row_after', compact($vars))); + $prev_post_id = $row['post_id']; unset($rowset[$post_list[$i]]); -- cgit v1.2.1 From c2c976fe031b2904b3acbefb73f03827c55aa441 Mon Sep 17 00:00:00 2001 From: Joas Schilling <nickvergessen@gmx.de> Date: Wed, 13 Nov 2013 16:24:25 +0100 Subject: [ticket/12015] Add post counting information to event PHPBB3-12015 --- phpBB/viewtopic.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 2f9a869bc6..36669e7383 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1008,10 +1008,11 @@ $sql_ary = array( * @var int sort_days Display posts of previous x days * @var string sort_key Key the posts are sorted by * @var string sort_dir Direction the posts are sorted by +* @var int start Pagination information * @var array sql_ary The SQL array to get the data of posts and posters * @since 3.1-A1 */ -$vars = array('forum_id', 'topic_id', 'topic_data', 'post_list', 'sort_days', 'sort_key', 'sort_dir', 'sql_ary'); +$vars = array('forum_id', 'topic_id', 'topic_data', 'post_list', 'sort_days', 'sort_key', 'sort_dir', 'start', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_post_data', compact($vars))); $sql = $db->sql_build_query('SELECT', $sql_ary); @@ -1704,6 +1705,9 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * Modify the posts template block * * @event core.viewtopic_modify_post_row + * @var int start Start item of this page + * @var int i Number of the post on this page + * @var int end Number of posts on this page * @var array row Array with original post and user data * @var array cp_row Custom profile field data of the poster * @var array attachments List of attachments @@ -1711,7 +1715,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @var array post_row Template block array of the post * @since 3.1-A1 */ - $vars = array('row', 'cp_row', 'attachments', 'user_poster_data', 'post_row'); + $vars = array('start', 'i', 'end', 'row', 'cp_row', 'attachments', 'user_poster_data', 'post_row'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_row', compact($vars))); if (isset($cp_row['row']) && sizeof($cp_row['row'])) @@ -1751,6 +1755,9 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * Event after the post data has been assigned to the template * * @event core.viewtopic_post_row_after + * @var int start Start item of this page + * @var int i Number of the post on this page + * @var int end Number of posts on this page * @var array row Array with original post and user data * @var array cp_row Custom profile field data of the poster * @var array attachments List of attachments @@ -1758,7 +1765,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @var array post_row Template block array of the post * @since 3.1-A2 */ - $vars = array('row', 'cp_row', 'attachments', 'user_poster_data', 'post_row'); + $vars = array('start', 'i', 'end', 'row', 'cp_row', 'attachments', 'user_poster_data', 'post_row'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_post_row_after', compact($vars))); $prev_post_id = $row['post_id']; -- cgit v1.2.1 From ecda590b8657588b6b3719ca0d59ee824e5fc4b2 Mon Sep 17 00:00:00 2001 From: Joas Schilling <nickvergessen@gmx.de> Date: Wed, 13 Nov 2013 17:07:30 +0100 Subject: [ticket/12015] Add @change to events that got changed PHPBB3-12015 --- phpBB/viewtopic.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 36669e7383..bfe131dbc3 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1011,6 +1011,7 @@ $sql_ary = array( * @var int start Pagination information * @var array sql_ary The SQL array to get the data of posts and posters * @since 3.1-A1 +* @change 3.1.0-a2 Added vars forum_id, topic_id, topic_data, post_list, sort_days, sort_key, sort_dir, start */ $vars = array('forum_id', 'topic_id', 'topic_data', 'post_list', 'sort_days', 'sort_key', 'sort_dir', 'start', 'sql_ary'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_post_data', compact($vars))); @@ -1714,6 +1715,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @var array user_poster_data Poster's data from user cache * @var array post_row Template block array of the post * @since 3.1-A1 + * @change 3.1.0-a2 Added vars start, i, end and attachments */ $vars = array('start', 'i', 'end', 'row', 'cp_row', 'attachments', 'user_poster_data', 'post_row'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_row', compact($vars))); @@ -1763,7 +1765,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @var array attachments List of attachments * @var array user_poster_data Poster's data from user cache * @var array post_row Template block array of the post - * @since 3.1-A2 + * @since 3.1.0-a2 */ $vars = array('start', 'i', 'end', 'row', 'cp_row', 'attachments', 'user_poster_data', 'post_row'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_post_row_after', compact($vars))); -- cgit v1.2.1 From 0faafce4ce254ff282de801901372f67ca4f4415 Mon Sep 17 00:00:00 2001 From: callumacrae <callum@lynxphp.com> Date: Fri, 12 Jul 2013 21:52:10 -0400 Subject: [ticket/11672] Removed unnecessary text from alerts. Messages like "Return to forum last visited" are entirely unnecessary when using AJAX to delete a post, so this commit removes them. PHPBB3-11672 --- 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 3a7e633c99..ffb938a622 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -497,11 +497,20 @@ if ($config['allow_bookmarks'] && $user->data['is_registered'] && request_var('b AND topic_id = $topic_id"; $db->sql_query($sql); } - $message = (($topic_data['bookmarked']) ? $user->lang['BOOKMARK_REMOVED'] : $user->lang['BOOKMARK_ADDED']) . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $viewtopic_url . '">', '</a>'); + $message = (($topic_data['bookmarked']) ? $user->lang['BOOKMARK_REMOVED'] : $user->lang['BOOKMARK_ADDED']); + + if (!$request->is_ajax()) + { + $message .= '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $viewtopic_url . '">', '</a>'); + } } else { - $message = $user->lang['BOOKMARK_ERR'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $viewtopic_url . '">', '</a>'); + $message = $user->lang['BOOKMARK_ERR']; + if (!$request->is_ajax()) + { + $message .= '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $viewtopic_url . '">', '</a>'); + } } meta_refresh(3, $viewtopic_url); -- cgit v1.2.1 From c6473da412d1a572ed80ec10d826239ad5ce5098 Mon Sep 17 00:00:00 2001 From: Cesar G <prototech91@gmail.com> Date: Thu, 17 Oct 2013 20:14:14 -0700 Subject: [ticket/11672] Replace sprintf() usage with $user->lang(). PHPBB3-11672 --- 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 ffb938a622..75e21b374b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -501,15 +501,16 @@ if ($config['allow_bookmarks'] && $user->data['is_registered'] && request_var('b if (!$request->is_ajax()) { - $message .= '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $viewtopic_url . '">', '</a>'); + $message .= '<br /><br />' . $user->lang('RETURN_TOPIC', '<a href="' . $viewtopic_url . '">', '</a>'); } } else { $message = $user->lang['BOOKMARK_ERR']; + if (!$request->is_ajax()) { - $message .= '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $viewtopic_url . '">', '</a>'); + $message .= '<br /><br />' . $user->lang('RETURN_TOPIC', '<a href="' . $viewtopic_url . '">', '</a>'); } } meta_refresh(3, $viewtopic_url); -- cgit v1.2.1 From 44b6f45759485cc33bb71ff50a715f39a8d60089 Mon Sep 17 00:00:00 2001 From: Cesar G <prototech91@gmail.com> Date: Thu, 21 Nov 2013 08:11:17 -0800 Subject: [ticket/11484] Display login box for users following email notification link. The link used for the latest post now uses view=unread so redirecting the user using the value for the e parameter is no longer necessary. PHPBB3-11484 --- phpBB/viewtopic.php | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 3a7e633c99..fb30be5f27 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -347,23 +347,10 @@ if ($topic_data['forum_password']) login_forum_box($topic_data); } -// Redirect to login or to the correct post upon emailed notification links -if (isset($_GET['e'])) +// Redirect to login upon emailed notification links if user is not logged in. +if (isset($_GET['e']) && $user->data['user_id'] == ANONYMOUS) { - $jump_to = request_var('e', 0); - - $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id"); - - if ($user->data['user_id'] == ANONYMOUS) - { - login_box($redirect_url . "&p=$post_id&e=$jump_to", $user->lang['LOGIN_NOTIFY_TOPIC']); - } - - if ($jump_to > 0) - { - // We direct the already logged in user to the correct post... - redirect($redirect_url . ((!$post_id) ? "&p=$jump_to" : "&p=$post_id") . "#p$jump_to"); - } + login_box(build_url('e') . '#unread', $user->lang['LOGIN_NOTIFY_TOPIC']); } // What is start equal to? -- cgit v1.2.1 From e9e667762b9c8762c77f5dcfbaeca00683a3b993 Mon Sep 17 00:00:00 2001 From: Joas Schilling <nickvergessen@gmx.de> Date: Thu, 21 Nov 2013 23:18:29 +0100 Subject: [ticket/12015] Fix english grammar PHPBB3-12015 --- 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 bfe131dbc3..2332b87e42 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1715,7 +1715,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @var array user_poster_data Poster's data from user cache * @var array post_row Template block array of the post * @since 3.1-A1 - * @change 3.1.0-a2 Added vars start, i, end and attachments + * @change 3.1.0-a2 Added vars start, i, end, and attachments */ $vars = array('start', 'i', 'end', 'row', 'cp_row', 'attachments', 'user_poster_data', 'post_row'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_row', compact($vars))); -- cgit v1.2.1 From 2a154d0a1065b55bfc1cadcd2c460ddb9b95dd69 Mon Sep 17 00:00:00 2001 From: Joas Schilling <nickvergessen@gmx.de> Date: Thu, 21 Nov 2013 23:42:40 +0100 Subject: [ticket/12015] Fix variable name and event version PHPBB3-12015 --- phpBB/viewtopic.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 358dd56de2..a182268a71 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1689,12 +1689,14 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $user_poster_data = $user_cache[$poster_id]; + $current_row_number = $i; + /** * Modify the posts template block * * @event core.viewtopic_modify_post_row * @var int start Start item of this page - * @var int i Number of the post on this page + * @var int current_row_number Number of the post on this page * @var int end Number of posts on this page * @var array row Array with original post and user data * @var array cp_row Custom profile field data of the poster @@ -1702,11 +1704,13 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @var array user_poster_data Poster's data from user cache * @var array post_row Template block array of the post * @since 3.1-A1 - * @change 3.1.0-a2 Added vars start, i, end, and attachments + * @change 3.1.0-a3 Added vars start, current_row_number, end, attachments */ - $vars = array('start', 'i', 'end', 'row', 'cp_row', 'attachments', 'user_poster_data', 'post_row'); + $vars = array('start', 'current_row_number', 'end', 'row', 'cp_row', 'attachments', 'user_poster_data', 'post_row'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_row', compact($vars))); + $i = $current_row_number; + if (isset($cp_row['row']) && sizeof($cp_row['row'])) { $post_row = array_merge($post_row, $cp_row['row']); @@ -1740,23 +1744,27 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) } } + $current_row_number = $i; + /** * Event after the post data has been assigned to the template * * @event core.viewtopic_post_row_after * @var int start Start item of this page - * @var int i Number of the post on this page + * @var int current_row_number Number of the post on this page * @var int end Number of posts on this page * @var array row Array with original post and user data * @var array cp_row Custom profile field data of the poster * @var array attachments List of attachments * @var array user_poster_data Poster's data from user cache * @var array post_row Template block array of the post - * @since 3.1.0-a2 + * @since 3.1.0-a3 */ - $vars = array('start', 'i', 'end', 'row', 'cp_row', 'attachments', 'user_poster_data', 'post_row'); + $vars = array('start', 'current_row_number', 'end', 'row', 'cp_row', 'attachments', 'user_poster_data', 'post_row'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_post_row_after', compact($vars))); + $i = $current_row_number; + $prev_post_id = $row['post_id']; unset($rowset[$post_list[$i]]); -- cgit v1.2.1 From e110d591a93b518edca00f01823d62c4d1a0ca91 Mon Sep 17 00:00:00 2001 From: Cesar G <prototech91@gmail.com> Date: Fri, 11 Oct 2013 18:48:09 -0700 Subject: [ticket/11241] Consolidate topic actions into "Topic tools" dropdown. PHPBB3-11241 --- 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 3735bca83d..dd4f7e1b19 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1384,16 +1384,17 @@ if (sizeof($attach_list)) } } -$template->assign_vars(array( - 'S_HAS_ATTACHMENTS' => $topic_data['topic_attachment'], -)); - $methods = phpbb_gen_download_links('topic_id', $topic_id, $phpbb_root_path, $phpEx); foreach ($methods as $method) { $template->assign_block_vars('dl_method', $method); } +$template->assign_vars(array( + 'S_HAS_ATTACHMENTS' => $topic_data['topic_attachment'], + 'U_DOWNLOAD_ALL_ATTACHMENTS' => $methods[0]['LINK'], +)); + // Instantiate BBCode if need be if ($bbcode_bitfield !== '') { -- cgit v1.2.1