diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php
index e153b549d5..3738f4a80b 100644
--- a/phpBB/language/en/lang_main.php
+++ b/phpBB/language/en/lang_main.php
@@ -92,7 +92,7 @@ $lang = array_merge($lang, array(
'Click_return_login' => 'Click %sHere%s to try again',
'Click_return_forum' => 'Click %sHere%s to return to the forum',
'Click_view_message' => 'Click %sHere%s to view your message',
- 'Click_return_modcp' => 'Click %sHere%s to return to the Moderator Control Panel',
+ 'Click_return_mcp' => 'Click %sHere%s to return to the Moderator Control Panel',
'Click_return_group' => 'Click %sHere%s to return to group information',
'Admin_panel' => 'Go to Administration Panel',
'Board_disable' => 'Sorry but this board is currently unavailable',
diff --git a/phpBB/mcp.php b/phpBB/mcp.php
index 2024de4728..c765fe7cd2 100644
--- a/phpBB/mcp.php
+++ b/phpBB/mcp.php
@@ -69,14 +69,37 @@ $topic_id = (!empty($_REQUEST['t'])) ? intval($_REQUEST['t']) : '';
$post_id = (!empty($_REQUEST['p'])) ? intval($_REQUEST['p']) : '';
$start = (!empty($_GET['start'])) ? intval($_GET['start']) : 0;
+//
+// Check if user did or did not confirm
+// If they did not, forward them to the last page they were on
+//
+if (isset($_POST['cancel']))
+{
+ if ($topic_id)
+ {
+ $redirect = "viewtopic.$phpEx$SID&t=$topic_id&start=$start";
+ }
+ elseif ($forum_id)
+ {
+ $redirect = "viewforum.$phpEx$SID&f=$forum_id&start=$start";
+ }
+ else
+ {
+ $redirect = "index.$phpEx$SID";
+ }
+
+ redirect($redirect);
+}
+
// Continue var definitions
$forum_data = $topic_data = $post_data = array();
$topic_id_list = ($topic_id) ? array($topic_id) : array();
$post_id_list = ($post_id) ? array($post_id) : array();
-$return_mcp = '
' . sprintf($user->lang['Click_return_mcp'], '', '');
if ($forum_id)
{
@@ -376,15 +414,42 @@ foreach ($tabs as $tab_name => $tab_link)
}
//
-// Do major work ...
+// Do major work ... (<= being the 1-billion dollars man)
//
+// Current modes:
+// - resync Resyncs topics
+// - delete_posts Delete posts, displays confirmation if unconfirmed
+// - delete Delete topics, displays confirmation
+// - select_topic Forward the user to forum view to select a destination topic for the merge
+// - merge Topic view, only displays the Merge button
+// - split Topic view, only displays the split buttons
+// - massdelete Topic view, only displays the Delete button
+// - topic_view Topic view, similar to viewtopic.php
+// - forum_view Forum view, similar to viewforum.php
+// - move Move selected topic(s), displays the forums list for confirmation. Used for quickmod as well
+// - lock, unlock Lock or unlock topic(s). No confirmation. Used for quickmod.
+// - merge_posts Actually merge posts to selected topic. Untested yet.
+// - ip Displays poster's ip and other ips the user has posted from. (imported straight from 2.0.x)
+//
+// TODO:
+// - split_all Actually split selected topic
+// - split_beyond Actually split selected topic
+// - post_view Displays post details. Has quick links to (un)approve post.
+// - mod_queue Displays a list or unapproved posts and/or topics. I haven't designed the interface yet but it will have to be able to filter/order them by type (posts/topics), by timestamp or by forum.
+// - post_reports Displays a list of reported posts. No interface yet, must be able to order them by priority(?), type, timestamp or forum. Action: view all (default), read, delete.
+// - approve/unapprove Actually un/approve selected topic(s) or post(s). NOTE: after some second thoughts we'll need three modes: (which names are still to be decided) the first to approve items, the second to set them back as "unapproved" and a third one to "disapprove" them. (IOW, delete them and eventually send a notification to the user)
+// - notes Displays moderators notes for current forum or for all forums the user is a moderator of. Actions: view all (default), read, add, delete, edit(?).
+// - a hell lot of other things
+//
+// TODO: add needed acl checks for each mode.
+
switch ($mode)
{
case 'resync':
resync('topic', 'topic_id', $topic_id_list);
$redirect_page = "mcp.$phpEx$SID&f=$forum_id";
- $l_redirect = sprintf($user->lang['Click_return_modcp'], '', '');
+ $l_redirect = sprintf($user->lang['Click_return_mcp'], '', '');
$template->assign_vars(array(
'META' => '')
@@ -398,7 +463,7 @@ switch ($mode)
// TODO: what happens if the user deletes the first post? Currently, the topic is resync'ed normally and topic time/topic author are updated with the new first post
- if (!$post_id_list)
+ if (!count($post_id_list))
{
trigger_error($user->lang['None_selected']);
}
@@ -408,7 +473,7 @@ switch ($mode)
delete_posts('post_id', $post_id_list);
$redirect_page = "mcp.$phpEx$SID&f=$forum_id";
- $l_redirect = sprintf($user->lang['Click_return_modcp'], '', '');
+ $l_redirect = sprintf($user->lang['Click_return_mcp'], '', '');
$template->assign_vars(array(
'META' => '')
@@ -458,7 +523,7 @@ switch ($mode)
else
{
$redirect_page = "mcp.$phpEx$SID&f=$forum_id";
- $l_redirect = sprintf($user->lang['Click_return_modcp'], '', '');
+ $l_redirect = sprintf($user->lang['Click_return_mcp'], '', '');
}
$template->assign_vars(array(
@@ -491,22 +556,7 @@ switch ($mode)
break;
case 'select_topic':
- $max_len = 0;
- $short_id_list = array();
-
- foreach ($post_id_list as $post_id)
- {
- $short = base_convert($post_id, 10, 36);
- $max_len = max(strlen($short), $max_len);
- $short_id_list[] = $short;
- }
-
- $post_id_str = $max_len;
- foreach ($short_id_list as $short)
- {
- $post_id_str .= str_pad($short, $max_len, '0', STR_PAD_LEFT);
- }
-
+ $post_id_str = short_id_list($post_id_list);
redirect(str_replace('&', '&', $mcp_url) . '&mode=forum_view&post_id_list=' . $post_id_str);
break;
@@ -540,6 +590,7 @@ switch ($mode)
ORDER BY p.post_time ASC";
$result = $db->sql_query($sql);
+ $i = 1;
while ($row = $db->sql_fetchrow($result))
{
$poster = (!empty($row['username'])) ? $row['username'] : ((!$row['post_username']) ? $user->lang['Guest'] : $row['post_username']);
@@ -561,7 +612,7 @@ switch ($mode)
$message = nl2br($message);
- $checked = ($mode == 'merge' && in_array($row['post_id'], $selected_post_ids)) ? 'checked="checked" ' : '';
+ $checked = ($mode == 'merge' && in_array(intval($row['post_id']), $selected_post_ids)) ? 'checked="checked" ' : '';
$s_checkbox = ($is_first_post && $mode == 'split') ? ' ' : '';
$template->assign_block_vars('postrow', array(
@@ -571,23 +622,46 @@ switch ($mode)
'MESSAGE' => $message,
'POST_ID' => $row['post_id'],
- 'S_CHECKBOX' => $s_checkbox
+ 'S_CHECKBOX' => $s_checkbox,
+ 'ROW_CLASS' => 'row' . $i
));
$is_first_post = FALSE;
+ $i = 3 - $i;
}
break;
case 'move':
if ($confirm)
{
- if (!$new_forum_id = intval($_POST['new_forum_id']))
+ $return_move = '