From 0faafce4ce254ff282de801901372f67ca4f4415 Mon Sep 17 00:00:00 2001 From: callumacrae Date: Fri, 12 Jul 2013 21:52:10 -0400 Subject: [PATCH 1/8] [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/includes/functions_display.php | 27 +++++++++++++++++++++------ phpBB/includes/mcp/mcp_queue.php | 6 +++++- phpBB/posting.php | 21 ++++++++++++++++----- phpBB/viewtopic.php | 13 +++++++++++-- 4 files changed, 53 insertions(+), 14 deletions(-) diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index f03e4c01d0..8829554276 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1128,7 +1128,7 @@ function display_user_activity(&$userdata) */ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0, $item_title = '') { - global $template, $db, $user, $phpEx, $start, $phpbb_root_path; + global $template, $db, $user, $phpEx, $start, $phpbb_root_path, $request; global $request; $table_sql = ($mode == 'forum') ? FORUMS_WATCH_TABLE : TOPICS_WATCH_TABLE; @@ -1167,7 +1167,11 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, if ($uid != $user_id || $request->variable('unwatch', '', false, \phpbb\request\request_interface::GET) != $mode) { $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); - $message = $user->lang['ERR_UNWATCHING'] . '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + $message = $user->lang['ERR_UNWATCHING']; + if (!$request->is_ajax()) + { + $message .= '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + } trigger_error($message); } @@ -1177,8 +1181,11 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $db->sql_query($sql); $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); - $message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '

'; - $message .= sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + $message = $user->lang['NOT_WATCHING_' . strtoupper($mode)]; + if (!$request->is_ajax()) + { + $message .= '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + } meta_refresh(3, $redirect_url); trigger_error($message); } @@ -1232,7 +1239,11 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, if ($uid != $user_id || $request->variable('watch', '', false, \phpbb\request\request_interface::GET) != $mode) { $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); - $message = $user->lang['ERR_WATCHING'] . '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + $message = $user->lang['ERR_WATCHING']; + if (!$request->is_ajax()) + { + $message .= '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + } trigger_error($message); } @@ -1243,7 +1254,11 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $db->sql_query($sql); $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); - $message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + $message = $user->lang['ARE_WATCHING_' . strtoupper($mode)]; + if (!$request->is_ajax()) + { + $message .= '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + } meta_refresh(3, $redirect_url); trigger_error($message); } diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index db461d07fa..365a794253 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -873,7 +873,7 @@ class mcp_queue $add_message = '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); } - $message = $user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '') . $add_message; + $message = $user->lang[$success_msg]; if ($request->is_ajax()) { @@ -885,6 +885,10 @@ class mcp_queue 'visible' => true, )); } + else + { + $message .= '

' . sprintf($user->lang['RETURN_PAGE'], "", '') . $add_message; + } trigger_error($message); } diff --git a/phpBB/posting.php b/phpBB/posting.php index 5db36007c2..6e9cc1aa94 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -386,8 +386,12 @@ if ($mode == 'bump') $meta_url = phpbb_bump_topic($forum_id, $topic_id, $post_data, $current_time); meta_refresh(3, $meta_url); - $message = $user->lang['TOPIC_BUMPED'] . '

' . $user->lang('VIEW_MESSAGE', '', ''); - $message .= '

' . sprintf($user->lang['RETURN_FORUM'], '', ''); + $message = $user->lang['TOPIC_BUMPED']; + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('VIEW_MESSAGE', '', ''); + $message .= '

' . sprintf($user->lang['RETURN_FORUM'], '', ''); + } trigger_error($message); } @@ -1616,7 +1620,7 @@ function upload_popup($forum_style = 0) */ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $soft_delete_reason = '') { - global $user, $db, $auth, $config; + global $user, $db, $auth, $config, $request; global $phpbb_root_path, $phpEx; $perm_check = ($is_soft) ? 'softdelete' : 'delete'; @@ -1662,11 +1666,18 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_sof add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), $post_data['post_subject'], $post_username); $meta_info = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p=$next_post_id") . "#p$next_post_id"; - $message = $user->lang['POST_DELETED'] . '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); + $message = $user->lang['POST_DELETED']; + if (!$request->is_ajax()) + { + $message .= '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); + } } meta_refresh(3, $meta_info); - $message .= '

' . sprintf($user->lang['RETURN_FORUM'], '', ''); + if (!$request->is_ajax()) + { + $message .= '

' . sprintf($user->lang['RETURN_FORUM'], '', ''); + } trigger_error($message); } else 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']) . '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); + $message = (($topic_data['bookmarked']) ? $user->lang['BOOKMARK_REMOVED'] : $user->lang['BOOKMARK_ADDED']); + + if (!$request->is_ajax()) + { + $message .= '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); + } } else { - $message = $user->lang['BOOKMARK_ERR'] . '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); + $message = $user->lang['BOOKMARK_ERR']; + if (!$request->is_ajax()) + { + $message .= '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); + } } meta_refresh(3, $viewtopic_url); From c6473da412d1a572ed80ec10d826239ad5ce5098 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Thu, 17 Oct 2013 20:14:14 -0700 Subject: [PATCH 2/8] [ticket/11672] Replace sprintf() usage with $user->lang(). PHPBB3-11672 --- phpBB/includes/functions_display.php | 12 ++++++++---- phpBB/includes/mcp/mcp_queue.php | 2 +- phpBB/posting.php | 9 +++++---- phpBB/viewtopic.php | 5 +++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 8829554276..140ffc42f0 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1168,9 +1168,10 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, { $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); $message = $user->lang['ERR_UNWATCHING']; + if (!$request->is_ajax()) { - $message .= '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + $message .= '

' . $user->lang('RETURN_' . strtoupper($mode), '', ''); } trigger_error($message); } @@ -1182,9 +1183,10 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); $message = $user->lang['NOT_WATCHING_' . strtoupper($mode)]; + if (!$request->is_ajax()) { - $message .= '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + $message .= '

' . $user->lang('RETURN_' . strtoupper($mode), '', ''); } meta_refresh(3, $redirect_url); trigger_error($message); @@ -1240,9 +1242,10 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, { $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); $message = $user->lang['ERR_WATCHING']; + if (!$request->is_ajax()) { - $message .= '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + $message .= '

' . $user->lang('RETURN_' . strtoupper($mode), '', ''); } trigger_error($message); } @@ -1255,9 +1258,10 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); $message = $user->lang['ARE_WATCHING_' . strtoupper($mode)]; + if (!$request->is_ajax()) { - $message .= '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + $message .= '

' . $user->lang('RETURN_' . strtoupper($mode), '', ''); } meta_refresh(3, $redirect_url); trigger_error($message); diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 365a794253..e529960c99 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -887,7 +887,7 @@ class mcp_queue } else { - $message .= '

' . sprintf($user->lang['RETURN_PAGE'], "", '') . $add_message; + $message .= '

' . $user->lang('RETURN_PAGE', '', '') . $add_message; } trigger_error($message); diff --git a/phpBB/posting.php b/phpBB/posting.php index 6e9cc1aa94..0d2cff40bc 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -385,12 +385,12 @@ if ($mode == 'bump') { $meta_url = phpbb_bump_topic($forum_id, $topic_id, $post_data, $current_time); meta_refresh(3, $meta_url); - $message = $user->lang['TOPIC_BUMPED']; + if (!$request->is_ajax()) { $message .= '

' . $user->lang('VIEW_MESSAGE', '', ''); - $message .= '

' . sprintf($user->lang['RETURN_FORUM'], '', ''); + $message .= '

' . $user->lang('RETURN_FORUM', '', ''); } trigger_error($message); @@ -1667,16 +1667,17 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_sof $meta_info = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p=$next_post_id") . "#p$next_post_id"; $message = $user->lang['POST_DELETED']; + if (!$request->is_ajax()) { - $message .= '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); + $message .= '

' . $user->lang('RETURN_TOPIC', '', ''); } } meta_refresh(3, $meta_info); if (!$request->is_ajax()) { - $message .= '

' . sprintf($user->lang['RETURN_FORUM'], '', ''); + $message .= '

' . $user->lang('RETURN_FORUM', '', ''); } trigger_error($message); } 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 .= '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); + $message .= '

' . $user->lang('RETURN_TOPIC', '', ''); } } else { $message = $user->lang['BOOKMARK_ERR']; + if (!$request->is_ajax()) { - $message .= '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); + $message .= '

' . $user->lang('RETURN_TOPIC', '', ''); } } meta_refresh(3, $viewtopic_url); From 3eda261b8d591ebd6a3d20b1f85c418c9c02f84a Mon Sep 17 00:00:00 2001 From: Cesar G Date: Fri, 18 Oct 2013 02:37:11 -0700 Subject: [PATCH 3/8] [ticket/11672] Remove some messages that were missed in mcp_queue.php. PHPBB3-11672 --- phpBB/includes/mcp/mcp_queue.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index e529960c99..48b6740583 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -725,7 +725,7 @@ class mcp_queue $add_message = '

' . sprintf($user->lang['RETURN_POST'], '', ''); } - $message = $user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '') . $add_message; + $message = $user->lang[$success_msg]; if ($request->is_ajax()) { @@ -737,6 +737,10 @@ class mcp_queue 'visible' => true, )); } + else + { + $message .= '

' . $user->lang('RETURN_PAGE', '', '') . $add_message; + } trigger_error($message); } @@ -1212,7 +1216,7 @@ class mcp_queue } else { - $message = $user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_PAGE'], '', ''); + $message = $user->lang[$success_msg]; if ($request->is_ajax()) { @@ -1224,6 +1228,10 @@ class mcp_queue 'visible' => false, )); } + else + { + $message .= '

' . $user->lang('RETURN_PAGE', '', ''); + } meta_refresh(3, $redirect); trigger_error($message); From 10bfb212c45c23b84c2d961902613fd869553173 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Fri, 18 Oct 2013 04:33:22 -0700 Subject: [PATCH 4/8] [ticket/11672] Clean up the logic in mcp_queue.php. PHPBB3-11672 --- phpBB/includes/mcp/mcp_queue.php | 172 ++++++++++++++----------------- 1 file changed, 75 insertions(+), 97 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 48b6740583..c782d98fbc 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -678,6 +678,32 @@ class mcp_queue } } } + + meta_refresh(3, $redirect); + $message = $user->lang[$success_msg]; + + if ($request->is_ajax()) + { + $json_response = new \phpbb\json_response; + $json_response->send(array( + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $message, + 'REFRESH_DATA' => null, + 'visible' => true, + )); + } + else + { + $message .= '

' . $user->lang('RETURN_PAGE', '', ''); + + // If approving one post, also give links back to post... + if (sizeof($post_info) == 1 && $post_url) + { + $message .= '

' . $user->lang('RETURN_POST', '', ''); + } + } + + trigger_error($message); } else { @@ -709,41 +735,7 @@ class mcp_queue $redirect = $request->variable('redirect', "index.$phpEx"); $redirect = reapply_sid($redirect); - - if (!$success_msg) - { - redirect($redirect); - } - else - { - meta_refresh(3, $redirect); - - // If approving one post, also give links back to post... - $add_message = ''; - if (sizeof($post_info) == 1 && $post_url) - { - $add_message = '

' . sprintf($user->lang['RETURN_POST'], '', ''); - } - - $message = $user->lang[$success_msg]; - - if ($request->is_ajax()) - { - $json_response = new \phpbb\json_response; - $json_response->send(array( - 'MESSAGE_TITLE' => $user->lang['INFORMATION'], - 'MESSAGE_TEXT' => $message, - 'REFRESH_DATA' => null, - 'visible' => true, - )); - } - else - { - $message .= '

' . $user->lang('RETURN_PAGE', '', '') . $add_message; - } - - trigger_error($message); - } + redirect($redirect); } /** @@ -830,6 +822,32 @@ class mcp_queue } } } + + meta_refresh(3, $redirect); + $message = $user->lang[$success_msg]; + + if ($request->is_ajax()) + { + $json_response = new \phpbb\json_response; + $json_response->send(array( + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $message, + 'REFRESH_DATA' => null, + 'visible' => true, + )); + } + else + { + $message .= '

' . $user->lang('RETURN_PAGE', '', ''); + + // If approving one topic, also give links back to topic... + if (sizeof($topic_info) == 1 && $topic_url) + { + $message .= '

' . $user->lang('RETURN_TOPIC', '', ''); + } + } + + trigger_error($message); } else { @@ -861,41 +879,7 @@ class mcp_queue $redirect = $request->variable('redirect', "index.$phpEx"); $redirect = reapply_sid($redirect); - - if (!$success_msg) - { - redirect($redirect); - } - else - { - meta_refresh(3, $redirect); - - // If approving one topic, also give links back to topic... - $add_message = ''; - if (sizeof($topic_info) == 1 && $topic_url) - { - $add_message = '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); - } - - $message = $user->lang[$success_msg]; - - if ($request->is_ajax()) - { - $json_response = new \phpbb\json_response; - $json_response->send(array( - 'MESSAGE_TITLE' => $user->lang['INFORMATION'], - 'MESSAGE_TEXT' => $message, - 'REFRESH_DATA' => null, - 'visible' => true, - )); - } - else - { - $message .= '

' . $user->lang('RETURN_PAGE', '', '') . $add_message; - } - - trigger_error($message); - } + redirect($redirect); } /** @@ -1159,6 +1143,26 @@ class mcp_queue { $success_msg .= '_DELETED_SUCCESS'; } + + meta_refresh(3, $redirect); + $message = $user->lang[$success_msg]; + + if ($request->is_ajax()) + { + $json_response = new \phpbb\json_response; + $json_response->send(array( + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $message, + 'REFRESH_DATA' => null, + 'visible' => false, + )); + } + else + { + $message .= '

' . $user->lang('RETURN_PAGE', '', ''); + } + + trigger_error($message); } else { @@ -1209,32 +1213,6 @@ class mcp_queue $redirect = $request->variable('redirect', "index.$phpEx"); $redirect = reapply_sid($redirect); - - if (!$success_msg) - { - redirect($redirect); - } - else - { - $message = $user->lang[$success_msg]; - - if ($request->is_ajax()) - { - $json_response = new \phpbb\json_response; - $json_response->send(array( - 'MESSAGE_TITLE' => $user->lang['INFORMATION'], - 'MESSAGE_TEXT' => $message, - 'REFRESH_DATA' => null, - 'visible' => false, - )); - } - else - { - $message .= '

' . $user->lang('RETURN_PAGE', '', ''); - } - - meta_refresh(3, $redirect); - trigger_error($message); - } + redirect($redirect); } } From cccb4fb83d364015962f5f77537ca1a242e03961 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Thu, 24 Oct 2013 05:48:30 -0700 Subject: [PATCH 5/8] [ticket/11672] Remove the messages for lock/unlock/change topic type. PHPBB3-11672 --- phpBB/includes/mcp/mcp_main.php | 44 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 7a22c31248..5491af0859 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -219,7 +219,7 @@ class mcp_main */ function lock_unlock($action, $ids) { - global $auth, $user, $db, $phpEx, $phpbb_root_path; + global $auth, $user, $db, $phpEx, $phpbb_root_path, $request; if ($action == 'lock' || $action == 'unlock') { @@ -279,6 +279,15 @@ function lock_unlock($action, $ids) } $success_msg = $l_prefix . ((sizeof($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS'; + + meta_refresh(2, $redirect); + $message = $user->lang[$success_msg]; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_PAGE', '', ''); + } + trigger_error($message); } else { @@ -287,16 +296,7 @@ function lock_unlock($action, $ids) $redirect = request_var('redirect', "index.$phpEx"); $redirect = reapply_sid($redirect); - - if (!$success_msg) - { - redirect($redirect); - } - else - { - meta_refresh(2, $redirect); - trigger_error($user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); - } + redirect($redirect); } /** @@ -304,7 +304,7 @@ function lock_unlock($action, $ids) */ function change_topic_type($action, $topic_ids) { - global $auth, $user, $db, $phpEx, $phpbb_root_path; + global $auth, $user, $db, $phpEx, $phpbb_root_path, $request; switch ($action) { @@ -381,6 +381,15 @@ function change_topic_type($action, $topic_ids) add_log('mod', $forum_id, $topic_id, 'LOG_TOPIC_TYPE_CHANGED', $row['topic_title']); } } + + meta_refresh(2, $redirect); + $message = $user->lang[$success_msg]; + + if (!$request->is_ajax()) + { + $message .= $user->lang('RETURN_PAGE', '', ''); + } + trigger_error($message); } else { @@ -389,16 +398,7 @@ function change_topic_type($action, $topic_ids) $redirect = request_var('redirect', "index.$phpEx"); $redirect = reapply_sid($redirect); - - if (!$success_msg) - { - redirect($redirect); - } - else - { - meta_refresh(2, $redirect); - trigger_error($user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); - } + redirect($redirect); } /** From 03e78c33fa85fab86ab0cb0802b33beada2a08d3 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Sat, 2 Nov 2013 14:09:21 -0700 Subject: [PATCH 6/8] [ticket/11672] The json response call exits so the else is not necessary. PHPBB3-11672 --- phpBB/includes/mcp/mcp_queue.php | 34 +++++++++++--------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index c782d98fbc..3b5e3752f8 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -692,17 +692,13 @@ class mcp_queue 'visible' => true, )); } - else + $message .= '

' . $user->lang('RETURN_PAGE', '', ''); + + // If approving one post, also give links back to post... + if (sizeof($post_info) == 1 && $post_url) { - $message .= '

' . $user->lang('RETURN_PAGE', '', ''); - - // If approving one post, also give links back to post... - if (sizeof($post_info) == 1 && $post_url) - { - $message .= '

' . $user->lang('RETURN_POST', '', ''); - } + $message .= '

' . $user->lang('RETURN_POST', '', ''); } - trigger_error($message); } else @@ -836,17 +832,13 @@ class mcp_queue 'visible' => true, )); } - else + $message .= '

' . $user->lang('RETURN_PAGE', '', ''); + + // If approving one topic, also give links back to topic... + if (sizeof($topic_info) == 1 && $topic_url) { - $message .= '

' . $user->lang('RETURN_PAGE', '', ''); - - // If approving one topic, also give links back to topic... - if (sizeof($topic_info) == 1 && $topic_url) - { - $message .= '

' . $user->lang('RETURN_TOPIC', '', ''); - } + $message .= '

' . $user->lang('RETURN_TOPIC', '', ''); } - trigger_error($message); } else @@ -1157,11 +1149,7 @@ class mcp_queue 'visible' => false, )); } - else - { - $message .= '

' . $user->lang('RETURN_PAGE', '', ''); - } - + $message .= '

' . $user->lang('RETURN_PAGE', '', ''); trigger_error($message); } else From bc33fd9950e6aad4abed3f22f44e2590f1749eab Mon Sep 17 00:00:00 2001 From: Cesar G Date: Tue, 19 Nov 2013 07:34:37 -0800 Subject: [PATCH 7/8] [ticket/11672] Remove duplicate $request global. PHPBB3-11672 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 140ffc42f0..5592aa89ba 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1128,7 +1128,7 @@ function display_user_activity(&$userdata) */ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0, $item_title = '') { - global $template, $db, $user, $phpEx, $start, $phpbb_root_path, $request; + global $template, $db, $user, $phpEx, $start, $phpbb_root_path; global $request; $table_sql = ($mode == 'forum') ? FORUMS_WATCH_TABLE : TOPICS_WATCH_TABLE; From 6d45146df7e7b19d6286f09370950fda207e309e Mon Sep 17 00:00:00 2001 From: Cesar G Date: Thu, 21 Nov 2013 04:37:37 -0800 Subject: [PATCH 8/8] [ticket/11672] Move the reapply_sid() call before meta_refresh() is called. The $redirect assignment is not necessary because the variable has already been set near the start of the functions. The redirect value will also never default to index.php because a default value has already been provided when $redirect is initially assigned and passed to the template as a hidden field. PHPBB3-11672 --- phpBB/includes/mcp/mcp_main.php | 8 +++----- phpBB/includes/mcp/mcp_queue.php | 9 +++------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 5491af0859..d9197da07e 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -256,6 +256,7 @@ function lock_unlock($action, $ids) unset($orig_ids); $redirect = request_var('redirect', build_url(array('action', 'quickmod'))); + $redirect = reapply_sid($redirect); $s_hidden_fields = build_hidden_fields(array( $sql_id . '_list' => $ids, @@ -294,8 +295,6 @@ function lock_unlock($action, $ids) confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((sizeof($ids) == 1) ? '' : 'S'), $s_hidden_fields); } - $redirect = request_var('redirect', "index.$phpEx"); - $redirect = reapply_sid($redirect); redirect($redirect); } @@ -341,6 +340,7 @@ function change_topic_type($action, $topic_ids) } $redirect = request_var('redirect', build_url(array('action', 'quickmod'))); + $redirect = reapply_sid($redirect); $s_hidden_fields = array( 'topic_id_list' => $topic_ids, @@ -387,7 +387,7 @@ function change_topic_type($action, $topic_ids) if (!$request->is_ajax()) { - $message .= $user->lang('RETURN_PAGE', '', ''); + $message .= '

' . $user->lang('RETURN_PAGE', '', ''); } trigger_error($message); } @@ -396,8 +396,6 @@ function change_topic_type($action, $topic_ids) confirm_box(false, $l_new_type, build_hidden_fields($s_hidden_fields)); } - $redirect = request_var('redirect', "index.$phpEx"); - $redirect = reapply_sid($redirect); redirect($redirect); } diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 3b5e3752f8..0318bc5e15 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -576,6 +576,7 @@ class mcp_queue } $redirect = $request->variable('redirect', build_url(array('quickmod'))); + $redirect = reapply_sid($redirect); $success_msg = $post_url = ''; $approve_log = array(); @@ -729,8 +730,6 @@ class mcp_queue confirm_box(false, strtoupper($action) . '_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); } - $redirect = $request->variable('redirect', "index.$phpEx"); - $redirect = reapply_sid($redirect); redirect($redirect); } @@ -754,6 +753,7 @@ class mcp_queue } $redirect = $request->variable('redirect', build_url(array('quickmod'))); + $redirect = reapply_sid($redirect); $success_msg = $topic_url = ''; $approve_log = array(); @@ -869,8 +869,6 @@ class mcp_queue confirm_box(false, strtoupper($action) . '_TOPIC' . ((sizeof($topic_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); } - $redirect = $request->variable('redirect', "index.$phpEx"); - $redirect = reapply_sid($redirect); redirect($redirect); } @@ -893,6 +891,7 @@ class mcp_queue } $redirect = $request->variable('redirect', build_url(array('t', 'mode', 'quickmod')) . "&mode=$mode"); + $redirect = reapply_sid($redirect); $reason = $request->variable('reason', '', true); $reason_id = $request->variable('reason_id', 0); $success_msg = $additional_msg = ''; @@ -1199,8 +1198,6 @@ class mcp_queue confirm_box(false, $l_confirm_msg, $s_hidden_fields, $confirm_template); } - $redirect = $request->variable('redirect', "index.$phpEx"); - $redirect = reapply_sid($redirect); redirect($redirect); } }