aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2013-12-03 21:10:25 +0100
committerJoas Schilling <nickvergessen@gmx.de>2013-12-03 21:10:25 +0100
commit8b2d515736ffc9e9497e35f0db2e8357f91805d5 (patch)
tree68c24e1227fb34d82d328ceee070eb1aec150f90 /phpBB/includes
parent8f504b1ca59b4dd3fc721e2833c070f9a624221d (diff)
parent6d45146df7e7b19d6286f09370950fda207e309e (diff)
downloadforums-8b2d515736ffc9e9497e35f0db2e8357f91805d5.tar
forums-8b2d515736ffc9e9497e35f0db2e8357f91805d5.tar.gz
forums-8b2d515736ffc9e9497e35f0db2e8357f91805d5.tar.bz2
forums-8b2d515736ffc9e9497e35f0db2e8357f91805d5.tar.xz
forums-8b2d515736ffc9e9497e35f0db2e8357f91805d5.zip
Merge remote-tracking branch 'prototech/ticket/11672' into develop
* prototech/ticket/11672: [ticket/11672] Move the reapply_sid() call before meta_refresh() is called. [ticket/11672] Remove duplicate $request global. [ticket/11672] The json response call exits so the else is not necessary. [ticket/11672] Remove the messages for lock/unlock/change topic type. [ticket/11672] Clean up the logic in mcp_queue.php. [ticket/11672] Remove some messages that were missed in mcp_queue.php. [ticket/11672] Replace sprintf() usage with $user->lang(). [ticket/11672] Removed unnecessary text from alerts.
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions_display.php29
-rw-r--r--phpBB/includes/mcp/mcp_main.php50
-rw-r--r--phpBB/includes/mcp/mcp_queue.php157
3 files changed, 114 insertions, 122 deletions
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index f03e4c01d0..5592aa89ba 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -1167,7 +1167,12 @@ 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&amp;start=$start");
- $message = $user->lang['ERR_UNWATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
+ $message = $user->lang['ERR_UNWATCHING'];
+
+ if (!$request->is_ajax())
+ {
+ $message .= '<br /><br />' . $user->lang('RETURN_' . strtoupper($mode), '<a href="' . $redirect_url . '">', '</a>');
+ }
trigger_error($message);
}
@@ -1177,8 +1182,12 @@ 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&amp;start=$start");
- $message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '<br /><br />';
- $message .= sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
+ $message = $user->lang['NOT_WATCHING_' . strtoupper($mode)];
+
+ if (!$request->is_ajax())
+ {
+ $message .= '<br /><br />' . $user->lang('RETURN_' . strtoupper($mode), '<a href="' . $redirect_url . '">', '</a>');
+ }
meta_refresh(3, $redirect_url);
trigger_error($message);
}
@@ -1232,7 +1241,12 @@ 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&amp;start=$start");
- $message = $user->lang['ERR_WATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
+ $message = $user->lang['ERR_WATCHING'];
+
+ if (!$request->is_ajax())
+ {
+ $message .= '<br /><br />' . $user->lang('RETURN_' . strtoupper($mode), '<a href="' . $redirect_url . '">', '</a>');
+ }
trigger_error($message);
}
@@ -1243,7 +1257,12 @@ 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&amp;start=$start");
- $message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
+ $message = $user->lang['ARE_WATCHING_' . strtoupper($mode)];
+
+ if (!$request->is_ajax())
+ {
+ $message .= '<br /><br />' . $user->lang('RETURN_' . strtoupper($mode), '<a href="' . $redirect_url . '">', '</a>');
+ }
meta_refresh(3, $redirect_url);
trigger_error($message);
}
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 7a22c31248..d9197da07e 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')
{
@@ -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,
@@ -279,24 +280,22 @@ function lock_unlock($action, $ids)
}
$success_msg = $l_prefix . ((sizeof($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS';
- }
- else
- {
- confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((sizeof($ids) == 1) ? '' : 'S'), $s_hidden_fields);
- }
- $redirect = request_var('redirect', "index.$phpEx");
- $redirect = reapply_sid($redirect);
+ meta_refresh(2, $redirect);
+ $message = $user->lang[$success_msg];
- if (!$success_msg)
- {
- redirect($redirect);
+ if (!$request->is_ajax())
+ {
+ $message .= '<br /><br />' . $user->lang('RETURN_PAGE', '<a href="' . $redirect . '">', '</a>');
+ }
+ trigger_error($message);
}
else
{
- meta_refresh(2, $redirect);
- trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
+ confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((sizeof($ids) == 1) ? '' : 'S'), $s_hidden_fields);
}
+
+ redirect($redirect);
}
/**
@@ -304,7 +303,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)
{
@@ -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,
@@ -381,24 +381,22 @@ function change_topic_type($action, $topic_ids)
add_log('mod', $forum_id, $topic_id, 'LOG_TOPIC_TYPE_CHANGED', $row['topic_title']);
}
}
- }
- else
- {
- confirm_box(false, $l_new_type, build_hidden_fields($s_hidden_fields));
- }
- $redirect = request_var('redirect', "index.$phpEx");
- $redirect = reapply_sid($redirect);
+ meta_refresh(2, $redirect);
+ $message = $user->lang[$success_msg];
- if (!$success_msg)
- {
- redirect($redirect);
+ if (!$request->is_ajax())
+ {
+ $message .= '<br /><br />' . $user->lang('RETURN_PAGE', '<a href="' . $redirect . '">', '</a>');
+ }
+ trigger_error($message);
}
else
{
- meta_refresh(2, $redirect);
- trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
+ confirm_box(false, $l_new_type, build_hidden_fields($s_hidden_fields));
}
+
+ redirect($redirect);
}
/**
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index db461d07fa..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();
@@ -678,6 +679,28 @@ 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,
+ ));
+ }
+ $message .= '<br /><br />' . $user->lang('RETURN_PAGE', '<a href="' . $redirect . '">', '</a>');
+
+ // If approving one post, also give links back to post...
+ if (sizeof($post_info) == 1 && $post_url)
+ {
+ $message .= '<br /><br />' . $user->lang('RETURN_POST', '<a href="' . $post_url . '">', '</a>');
+ }
+ trigger_error($message);
}
else
{
@@ -707,39 +730,7 @@ 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);
-
- 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 = '<br /><br />' . sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>');
- }
-
- $message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>') . $add_message;
-
- 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,
- ));
- }
-
- trigger_error($message);
- }
+ redirect($redirect);
}
/**
@@ -762,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();
@@ -826,6 +818,28 @@ 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,
+ ));
+ }
+ $message .= '<br /><br />' . $user->lang('RETURN_PAGE', '<a href="' . $redirect . '">', '</a>');
+
+ // If approving one topic, also give links back to topic...
+ if (sizeof($topic_info) == 1 && $topic_url)
+ {
+ $message .= '<br /><br />' . $user->lang('RETURN_TOPIC', '<a href="' . $topic_url . '">', '</a>');
+ }
+ trigger_error($message);
}
else
{
@@ -855,39 +869,7 @@ 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);
-
- 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 = '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $topic_url . '">', '</a>');
- }
-
- $message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>') . $add_message;
-
- 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,
- ));
- }
-
- trigger_error($message);
- }
+ redirect($redirect);
}
/**
@@ -909,6 +891,7 @@ class mcp_queue
}
$redirect = $request->variable('redirect', build_url(array('t', 'mode', 'quickmod')) . "&amp;mode=$mode");
+ $redirect = reapply_sid($redirect);
$reason = $request->variable('reason', '', true);
$reason_id = $request->variable('reason_id', 0);
$success_msg = $additional_msg = '';
@@ -1151,6 +1134,22 @@ 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,
+ ));
+ }
+ $message .= '<br /><br />' . $user->lang('RETURN_PAGE', '<a href="' . $redirect . '">', '</a>');
+ trigger_error($message);
}
else
{
@@ -1199,30 +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);
-
- if (!$success_msg)
- {
- redirect($redirect);
- }
- else
- {
- $message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>');
-
- 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,
- ));
- }
-
- meta_refresh(3, $redirect);
- trigger_error($message);
- }
+ redirect($redirect);
}
}