' . sprintf($user->lang['RETURN_MCP'], '', '');
-
-// Build up return links and acl list
-// $acl_src contains the acl list for source forum(s)
-// $acl_trg contains the acl list for destination forum(s)
-
-$acl_src = 'm_';
-$acl_trg = 'm_';
-$return_mode = '
' . sprintf($user->lang['RETURN_MCP'], '', '');
-
-switch ($mode)
-{
- case 'make_global':
- case 'make_announce':
- $acl_src = 'f_announce';
- break;
-
- case 'make_sticky':
- $acl_src = 'f_sticky';
- break;
-
- case 'approve':
- case 'unapprove':
- case 'disapprove':
- $acl_src = 'm_approve';
- break;
-
- case 'split':
- case 'split_all':
- case 'split_beyond':
- $acl_src = 'a_';
- $acl_trg = 'f_post';
-
- $return_mode = '
' . sprintf($user->lang['RETURN_TOPIC'], '', '');
+ $mode = $_REQUEST['mode'];
}
}
else
{
- // There's no forums list available so the user either submitted an empty or invalid list of posts/topics or isn't a moderator
-
- if ($not_moderator || !get_forum_list('m_', TRUE, TRUE, TRUE))
- {
- trigger_error($user->lang['NOT_MODERATOR']);
- }
- else
- {
- // TODO: drop this and deal with each mode individually?
- $forumless_modes = array('front', 'reports', 'mod_queue', 'viewlogs', 'forum_info');
- if ($mode != '' && !in_array($mode, $forumless_modes))
- {
- // The user has submitted invalid post_ids or topic_ids
- trigger_error($user->lang['TOPIC_NOT_EXIST'] . $return_mcp);
- }
- }
+ $mode = 'front';
}
-//
-// There we're done validating input.
-//
-// $post_id_list contains the complete list of post_id's, same for $topic_id_list and $forum_id_list
-// $post_id, $topic_id, $forum_id have all been set.
-//
-// $forum_data is an array where $forum_data[] contains the corresponding row, same for $topic_data and $post_data.
-// $forum_info is set to $forum_data[$forum_id] for quick reference, same for topic and post.
-//
-// We know that the user has m_ or a_ access to all the selected forums/topics/posts but we still have to check for specific authorisations.
-//
-
-// Build links and tabs
-$mcp_url = "mcp.$phpEx$SID";
-$tabs = array(
- array(
- 'mode' => 'front',
- 'title' => $user->lang['FRONT_PAGE'],
- 'url' => $mcp_url . '&mode=front'
- ),
- array(
- 'mode' => 'mod_queue',
- 'title' => $user->lang['MOD_QUEUE'],
- 'url' => $mcp_url . '&f=' . $forum_id . '&mode=mod_queue'
- ),
- array(
- 'mode' => 'reports',
- 'title' => $user->lang['REPORTED_POSTS'],
- 'url' => $mcp_url . '&f=' . $forum_id . '&mode=reports'
- )
-);
-
-$mcp_url .= ($forum_id) ? '&f=' . $forum_id : '';
-$mcp_url .= ($topic_id) ? '&t=' . $topic_id : '';
-$mcp_url .= ($post_id) ? '&p=' . $post_id : '';
-$return_mcp = '
' . sprintf($user->lang['RETURN_MCP'], '', '');
-
-$tabs[] = array(
- 'mode' => 'viewlogs',
- 'title' => ($topic_id) ? $user->lang['VIEW_TOPIC_LOGS'] : $user->lang['VIEW_LOGS'],
- 'url' => $mcp_url . '&mode=viewlogs'
-);
-
-if ($auth->acl_get('m_info', $forum_id))
+// Basic "global" modes
+if (!$module)
{
- $tabs[] = array(
- 'mode' => 'forum_info',
- 'title' => $user->lang['FORUM_INFO'],
- 'url' => $mcp_url . '&mode=forum_info&f=' . $forum_id
- );
-}
-
-if ($forum_id && $forum_data[$forum_id]['forum_type'] == FORUM_POST && $auth->acl_get('m_', $forum_id))
-{
- $tabs[] = array(
- 'mode' => 'forum_view',
- 'title' => $user->lang['VIEW_FORUM'],
- 'url' => $mcp_url . '&mode=forum_view'
- );
-}
-
-if ($topic_id && $auth->acl_gets('m_delete', 'm_split', 'm_merge', 'm_approve', $forum_id))
-{
- $tabs[] = array(
- 'mode' => 'topic_view',
- 'title' => $user->lang['VIEW_TOPIC'],
- 'url' => $mcp_url . '&mode=topic_view'
- );
-}
-
-if ($post_id && $auth->acl_gets('m_', $forum_id))
-{
- $tabs[] = array(
- 'modes' => array('post_details', 'change_poster', 'change_poster_search', 'delete_report'),
- 'title' => $user->lang['POST_DETAILS'],
- 'url' => $mcp_url . '&mode=post_details'
- );
-}
-
-if (!$mode)
-{
- if ($post_id)
- {
- $mode = 'post_details';
- }
- elseif ($topic_id)
- {
- $mode = 'topic_view';
- }
- elseif ($forum_id && $forum_data[$forum_id]['forum_type'] == FORUM_POST)
- {
- $mode = 'forum_view';
- }
- else
- {
- $mode = 'front';
- }
-}
-
-switch ($mode)
-{
- case 'select_topic':
- if ($url_extra)
- {
- $tabs[] = array(
- 'mode' => 'merge',
- 'title' => $user->lang['MERGE_TOPIC'],
- 'url' => $mcp_url . '&mode=merge' . $url_extra
- );
- }
- break;
-
- case 'merge':
- case 'split':
- $tabs[] = array(
- 'mode' => $mode,
- 'title' => $user->lang[strtoupper($mode) . '_TOPIC'],
- 'url' => $mcp_url . '&mode=' . $mode . $url_extra
- );
- break;
-}
-
-foreach ($tabs as $tab)
-{
- $template->assign_block_vars('tab', array(
- 'S_IS_SELECTED' => ((!empty($tab['mode']) && $tab['mode'] == $mode) || (!empty($tab['modes']) && in_array($mode, $tab['modes']))) ? TRUE : FALSE,
- 'NAME' => $tab['title'],
- 'U_LINK' => $tab['url'])
- );
-}
-
-//
-// Do major work ...
-//
-// Current modes:
-// - make_* Change topic type
-// - resync Resyncs topics
-// - delete_post Delete posts, displays confirmation if unconfirmed
-// - delete_topic 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
-// - delete 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.
-// - split_all Actually split selected topic
-// - split_beyond Actually split selected topic
-// - 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.s
-// - post_details Displays post details, IP informations and moderator options.
-//
-// TODO:
-// - 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.
-// - 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
-//
-
-switch ($mode)
-{
- case 'forum_info':
- if (!$auth->acl_get('m_info', $forum_id))
- {
- trigger_error($user->lang['NOT_MODERATOR']);
- }
-
- if ($confirm)
- {
- $sql_ary = array(
- 'forum_name' => (string) (!empty($_POST['forum_name'])) ? $_POST['forum_name'] : $forum_info['forum_name'],
- 'forum_desc' => (string) $_POST['forum_desc'],
- 'forum_style' => (int) $_POST['forum_style'],
- 'forum_status' => (int) $_POST['forum_status']
- );
-
- $sql = 'UPDATE ' . FORUMS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
- WHERE forum_id = ' . $forum_id;
- $db->sql_query($sql);
-
- $return_mcp = '
' . sprintf($user->lang['RETURN_FORUM'], "", '');
- trigger_error($message);
- break;
-
- case 'disapprove':
- // NOTE: what happens if the user disapproves the first post of the topic? Answer: the topic is deleted
- $redirect_page = "mcp.$phpEx$SID&f=$forum_id";
- $l_redirect = sprintf($user->lang['RETURN_MCP'], "", '');
-
- if (!count($post_id_list))
- {
- trigger_error($user->lang['NO_POST_SELECTED'] . '
' . $return);
- break;
-
- case 'delete_post':
- // NOTE: what happens if the user deletes the first post of the topic? The topic is resync'ed normally and topic time/topic author are updated by the new first post
- $redirect_page = "mcp.$phpEx$SID&f=$forum_id";
- $l_redirect = sprintf($user->lang['RETURN_MCP'], '', '');
-
- if (!count($post_id_list))
- {
- trigger_error($user->lang['NO_POST_SELECTED'] . '