diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions_admin.php | 10 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_forum.php | 42 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_front.php | 32 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_main.php | 169 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_post.php | 214 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_topic.php | 64 |
6 files changed, 243 insertions, 288 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 0061a236db..32cb2b383d 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1869,11 +1869,11 @@ function cache_moderators() */ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC') { - global $db, $user, $auth, $phpEx, $SID; + global $db, $user, $auth, $phpEx, $SID, $phpbb_root_path; $topic_id_list = $is_auth = $is_mod = array(); - $profile_url = (defined('IN_ADMIN')) ? "index.$phpEx$SID&i=users&mode=overview" : "memberlist.$phpEx$SID&mode=viewprofile"; + $profile_url = (defined('IN_ADMIN')) ? "{$phpbb_root_path}index.$phpEx$SID&i=users&mode=overview" : "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile"; switch ($mode) { @@ -1937,7 +1937,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id $log[$i]['time'] = $row['log_time']; $log[$i]['forum_id'] = $row['forum_id']; $log[$i]['topic_id'] = $row['topic_id']; - $log[$i]['viewforum'] = ($row['forum_id'] && $auth->acl_get('f_read', $row['forum_id'])) ? ((defined('IN_ADMIN')) ? '../' : '') . "viewforum.$phpEx$SID&f=" . $row['forum_id'] : ''; + $log[$i]['viewforum'] = ($row['forum_id'] && $auth->acl_get('f_read', $row['forum_id'])) ? "{$phpbb_root_path}viewforum.$phpEx$SID&f=" . $row['forum_id'] : ''; $log[$i]['action'] = (isset($user->lang[$row['log_operation']])) ? $user->lang[$row['log_operation']] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}'; @@ -1992,8 +1992,8 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id foreach ($log as $key => $row) { - $log[$key]['viewtopic'] = (isset($is_auth[$row['topic_id']])) ? ((defined('IN_ADMIN')) ? '../' : '') . "viewtopic.$phpEx$SID&f=" . $is_auth[$row['topic_id']] . '&t=' . $row['topic_id'] : ''; - $log[$key]['viewlogs'] = (isset($is_mod[$row['topic_id']])) ? ((defined('IN_ADMIN')) ? '../' : '') . "mcp.$phpEx$SID&mode=logs&action=topic_logs&t=" . $row['topic_id'] : ''; + $log[$key]['viewtopic'] = (isset($is_auth[$row['topic_id']])) ? "{$phpbb_root_path}viewtopic.$phpEx$SID&f=" . $is_auth[$row['topic_id']] . '&t=' . $row['topic_id'] : ''; + $log[$key]['viewlogs'] = (isset($is_mod[$row['topic_id']])) ? "{$phpbb_root_path}mcp.$phpEx$SID&i=logs&mode=topic_logs&t=" . $row['topic_id'] : ''; } } diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index 4ced2b77bf..ce99fc05d7 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -11,11 +11,13 @@ /** * MCP Forum View */ -function mcp_forum_view($id, $mode, $action, $url, $forum_info) +function mcp_forum_view($id, $mode, $action, $forum_info) { global $template, $db, $user, $auth, $cache; global $SID, $phpEx, $phpbb_root_path, $config; + $url = "{$phpbb_root_path}mcp.$phpEx$SID" . extra_url(); + if ($action == 'merge_select') { // Fixes a "bug" that makes forum_view use the same ordering as topic_view @@ -33,14 +35,7 @@ function mcp_forum_view($id, $mode, $action, $url, $forum_info) { $topic_ids = request_var('topic_id_list', array(0)); - if (!sizeof($topic_ids)) - { - $template->assign_var('MESSAGE', $user->lang['NO_TOPIC_SELECTED']); - } - else - { - mcp_resync_topics($topic_ids); - } + mcp_resync_topics($topic_ids); } $selected_ids = ''; @@ -52,7 +47,7 @@ function mcp_forum_view($id, $mode, $action, $url, $forum_info) } } - make_jumpbox($url . "&action=$action&mode=$mode", $forum_id . (($action == 'merge_select') ? $selected_ids : ''), false, 'm_'); + make_jumpbox($url . "&i=$id&action=$action&mode=$mode", $forum_id . (($action == 'merge_select') ? $selected_ids : ''), false, 'm_'); $topics_per_page = ($forum_info['forum_topics_per_page']) ? $forum_info['forum_topics_per_page'] : $config['topics_per_page']; @@ -62,6 +57,7 @@ function mcp_forum_view($id, $mode, $action, $url, $forum_info) $template->assign_vars(array( 'FORUM_NAME' => $forum_info['forum_name'], + 'FORUM_DESCRIPTION' => $forum_info['forum_desc'], 'REPORTED_IMG' => $user->img('icon_reported', 'TOPIC_REPORTED'), 'UNAPPROVED_IMG' => $user->img('icon_unapproved', 'TOPIC_UNAPPROVED'), @@ -73,10 +69,12 @@ function mcp_forum_view($id, $mode, $action, $url, $forum_info) 'S_CAN_SYNC' => $auth->acl_get('m_', $forum_id), 'S_CAN_APPROVE' => $auth->acl_get('m_approve', $forum_id), - 'U_VIEW_FORUM' => "viewforum.$phpEx$SID&f=" . $forum_id, - 'S_MCP_ACTION' => $url . "&action=$action&mode=$mode&start=$start" . (($action == 'merge_select') ? $selected_ids : ''), + 'U_VIEW_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&f=" . $forum_id, + 'U_VIEW_FORUM_LOGS' => ($auth->acl_gets('a_', 'm_', $forum_id)) ? "{$phpbb_root_path}mcp.$phpEx$SID&i=logs&mode=forum_logs&f=" . $forum_id : '', - 'PAGINATION' => generate_pagination($url . "&action=$action&mode=$mode" . (($action == 'merge_select') ? $selected_ids : ''), $forum_topics, $topics_per_page, $start), + 'S_MCP_ACTION' => $url . "&i=$id&action=$action&mode=$mode&start=$start" . (($action == 'merge_select') ? $selected_ids : ''), + + 'PAGINATION' => generate_pagination($url . "&i=$id&action=$action&mode=$mode" . (($action == 'merge_select') ? $selected_ids : ''), $forum_topics, $topics_per_page, $start), 'PAGE_NUMBER' => on_page($forum_topics, $topics_per_page, $start), 'TOTAL' => $forum_topics) ); @@ -178,14 +176,14 @@ function mcp_forum_view($id, $mode, $action, $url, $forum_info) } $topic_title = censor_text($row['topic_title']); - + $template->assign_block_vars('topicrow', array( - 'U_VIEW_TOPIC' => "mcp.$phpEx$SID&f=$forum_id&t={$row['topic_id']}&mode=topic_view", + 'U_VIEW_TOPIC' => "{$phpbb_root_path}mcp.$phpEx$SID&i=$id&f=$forum_id&t={$row['topic_id']}&mode=topic_view", 'S_SELECT_TOPIC' => ($action == 'merge_select' && $row['topic_id'] != $topic_id) ? true : false, - 'U_SELECT_TOPIC' => $url . '&mode=topic_view&action=merge&to_topic_id=' . $row['topic_id'] . $selected_ids, + 'U_SELECT_TOPIC' => $url . "&i=$id&mode=topic_view&action=merge&to_topic_id=" . $row['topic_id'] . $selected_ids, 'U_MCP_QUEUE' => $url . '&i=queue&mode=approve_details&t=' . $row['topic_id'], - 'U_MCP_REPORT' => "mcp.$phpEx$SID&i=main&mode=topic_view&t={$row['topic_id']}&action=reports", + 'U_MCP_REPORT' => "{$phpbb_root_path}mcp.$phpEx$SID&i=main&mode=topic_view&t={$row['topic_id']}&action=reports", 'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), @@ -222,10 +220,10 @@ function mcp_resync_topics($topic_ids) if (!sizeof($topic_ids)) { - $template->assign_var('MESSAGE', $user->lang['NO_TOPIC_SELECTED']); + trigger_error($user->lang['NO_TOPIC_SELECTED']); return; } - + // Sync everything and perform extra checks separately sync('topic_reported', 'topic_id', $topic_ids, false, true); sync('topic_attachment', 'topic_id', $topic_ids, false, true); @@ -243,7 +241,11 @@ function mcp_resync_topics($topic_ids) } $msg = (sizeof($topic_ids) == 1) ? $user->lang['TOPIC_RESYNC_SUCCESS'] : $user->lang['TOPICS_RESYNC_SUCCESS']; - $template->assign_var('MESSAGE', $msg); + + $redirect = request_var('redirect', $user->data['session_page']); + + meta_refresh(2, $redirect); + trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); return; } diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index 8659c0b2f1..c0d6ce19d5 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -11,11 +11,13 @@ /** * MCP Front Panel */ -function mcp_front_view($id, $mode, $action, $url) +function mcp_front_view($id, $mode, $action) { global $SID, $phpEx, $phpbb_root_path, $config; global $template, $db, $user, $auth; + $url = "{$phpbb_root_path}mcp.$phpEx$SID" . extra_url(); + // Latest 5 unapproved $forum_list = get_forum_list('m_approve'); $post_list = array(); @@ -39,8 +41,8 @@ function mcp_front_view($id, $mode, $action, $url) $sql = 'SELECT forum_id, forum_name FROM ' . FORUMS_TABLE . ' WHERE forum_id IN (' . implode(', ', $forum_list) . ')'; - $result = $db->sql_query_limit($sql); - + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) { $forum_names[$row['forum_id']] = $row['forum_name']; @@ -69,19 +71,19 @@ function mcp_front_view($id, $mode, $action, $url) while ($row = $db->sql_fetchrow($result)) { $template->assign_block_vars('unapproved', array( - 'U_POST_DETAILS'=> $url . '&p=' . $row['post_id'] . '&mode=post_details', - 'U_MCP_FORUM' => ($row['forum_id']) ? $url . '&f=' . $row['forum_id'] . '&mode=forum_view' : '', - 'U_MCP_TOPIC' => $url . '&t=' . $row['topic_id'] . '&mode=topic_view', - 'U_FORUM' => ($row['forum_id']) ? 'viewforum.' . $phpEx . $SID . '&f=' . $row['forum_id'] : '', - 'U_TOPIC' => $phpbb_root_path . 'viewtopic.' . $phpEx . $SID . '&f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . '&t=' . $row['topic_id'], - 'U_AUTHOR' => ($row['poster_id'] == ANONYMOUS) ? '' : 'memberlist.' . $phpEx . $SID . '&mode=viewprofile&u=' . $row['poster_id'], + 'U_POST_DETAILS'=> $url . '&i=main&mode=post_details&p=' . $row['post_id'], + 'U_MCP_FORUM' => ($row['forum_id']) ? $url . '&i=main&mode=forum_view&f=' . $row['forum_id'] : '', + 'U_MCP_TOPIC' => $url . '&i=main&mode=topic_view&t=' . $row['topic_id'], + 'U_FORUM' => ($row['forum_id']) ? "{$phpbb_root_path}viewforum.$phpEx$SID&f=" . $row['forum_id'] : '', + 'U_TOPIC' => $phpbb_root_path . "{$phpbb_root_path}viewtopic.$phpEx$SID&f=" . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . '&t=' . $row['topic_id'], + 'U_AUTHOR' => ($row['poster_id'] == ANONYMOUS) ? '' : "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['poster_id'], 'FORUM_NAME' => ($row['forum_id']) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'], 'TOPIC_TITLE' => $row['topic_title'], 'AUTHOR' => ($row['poster_id'] == ANONYMOUS) ? (($row['post_username']) ? $row['post_username'] : $user->lang['GUEST']) : $row['username'], 'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'], 'POST_TIME' => $user->format_date($row['post_time'])) - ); + ); } } @@ -103,7 +105,7 @@ function mcp_front_view($id, $mode, $action, $url) // Latest 5 reported $forum_list = get_forum_list('m_'); - + $template->assign_var('S_SHOW_REPORTS', (!empty($forum_list)) ? true : false); if (!empty($forum_list)) { @@ -134,16 +136,16 @@ function mcp_front_view($id, $mode, $action, $url) 'U_POST_DETAILS'=> $url . '&p=' . $row['post_id'] . '&mode=post_details', 'U_MCP_FORUM' => ($row['forum_id']) ? $url . '&f=' . $row['forum_id'] . '&mode=forum_view' : '', 'U_MCP_TOPIC' => $url . '&t=' . $row['topic_id'] . '&mode=topic_view', - 'U_FORUM' => ($row['forum_id']) ? 'viewforum.' . $phpEx . $SID . '&f=' . $row['forum_id'] : '', - 'U_TOPIC' => 'viewtopic.' . $phpEx . $SID . '&f=' . $row['forum_id'] . '&t=' . $row['topic_id'], - 'U_REPORTER' => ($row['user_id'] == ANONYMOUS) ? '' : 'memberlist.' . $phpEx . $SID . '&mode=viewprofile&u=' . $row['user_id'], + 'U_FORUM' => ($row['forum_id']) ? "{$phpbb_root_path}viewforum.$phpEx$SID&f=" . $row['forum_id'] : '', + 'U_TOPIC' => "{$phpbb_root_path}viewtopic.$phpEx$SID&f=" . $row['forum_id'] . '&t=' . $row['topic_id'], + 'U_REPORTER' => ($row['user_id'] == ANONYMOUS) ? '' : "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['user_id'], 'FORUM_NAME' => ($row['forum_id']) ? $row['forum_name'] : $user->lang['POST_GLOBAL'], 'TOPIC_TITLE' => $row['topic_title'], 'REPORTER' => ($row['user_id'] == ANONYMOUS) ? $user->lang['GUEST'] : $row['username'], 'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'], 'REPORT_TIME' => $user->format_date($row['report_time'])) - ); + ); } } diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index ef92a41399..8862cf31dd 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -17,7 +17,7 @@ class mcp_main { var $p_master; - + function mcp_main(&$p_master) { $this->p_master = &$p_master; @@ -25,30 +25,24 @@ class mcp_main function main($id, $mode) { - global $auth, $db, $user, $template; + global $auth, $db, $user, $template, $action; global $config, $phpbb_root_path, $phpEx, $SID; - - $action = request_var('action', ''); - $quickmod = request_var('quickmod', ''); - if (is_array($action)) - { - list($action, ) = each($action); - } + $quickmod = ($mode == 'quickmod') ? true : false; - switch ($mode) + switch ($action) { case 'lock': case 'unlock': $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0)); - + if (!sizeof($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } - lock_unlock($mode, $topic_ids); - break; + lock_unlock($action, $topic_ids); + break; case 'lock_post': case 'unlock_post': @@ -60,65 +54,62 @@ class mcp_main trigger_error('NO_POST_SELECTED'); } - lock_unlock($mode, $post_ids); - break; + lock_unlock($action, $post_ids); + break; case 'make_announce': case 'make_sticky': case 'make_global': case 'make_normal': - + $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0)); - + if (!sizeof($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } - change_topic_type($mode, $topic_ids); - - break; + change_topic_type($action, $topic_ids); + break; case 'move': $user->add_lang('viewtopic'); $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0)); - + if (!sizeof($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } mcp_move_topic($topic_ids); - - break; + break; case 'fork': $user->add_lang('viewtopic'); $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0)); - + if (!sizeof($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } mcp_fork_topic($topic_ids); - - break; + break; case 'delete_topic': $user->add_lang('viewtopic'); $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0)); - + if (!sizeof($topic_ids)) { trigger_error('NO_TOPIC_SELECTED'); } mcp_delete_topic($topic_ids); - break; + break; case 'delete_post': $user->add_lang('posting'); @@ -131,19 +122,22 @@ class mcp_main } mcp_delete_post($post_ids); - break; + break; + } + switch ($mode) + { case 'front': include($phpbb_root_path . 'includes/mcp/mcp_front.' . $phpEx); - mcp_front_view($id, $mode, $action, $url); + mcp_front_view($id, $mode, $action); $this->tpl_name = 'mcp_front'; - break; + break; case 'forum_view': include($phpbb_root_path . 'includes/mcp/mcp_forum.' . $phpEx); - + $user->add_lang('viewforum'); $forum_id = request_var('f', 0); @@ -152,32 +146,32 @@ class mcp_main if (!sizeof($forum_info)) { - $this->mcp_main('mcp', 'front', $url); - exit; + $this->main('main', 'front'); + return; } $forum_info = $forum_info[$forum_id]; - mcp_forum_view($id, $mode, $action, $url, $forum_info); - + mcp_forum_view($id, $mode, $action, $forum_info); + $this->tpl_name = 'mcp_forum'; - break; + break; case 'topic_view': include($phpbb_root_path . 'includes/mcp/mcp_topic.' . $phpEx); - - mcp_topic_view($id, $mode, $action, $url); - + + mcp_topic_view($id, $mode, $action); + $this->tpl_name = 'mcp_topic'; - break; - + break; + case 'post_details': include($phpbb_root_path . 'includes/mcp/mcp_post.' . $phpEx); - - mcp_post_details($id, $mode, $action, $url); - + + mcp_post_details($id, $mode, $action); + $this->tpl_name = 'mcp_post'; - break; + break; default: trigger_error("Unknown mode: $mode"); @@ -188,11 +182,11 @@ class mcp_main /** * Lock/Unlock Topic/Post */ -function lock_unlock($mode, $ids) +function lock_unlock($action, $ids) { global $auth, $user, $db, $SID, $phpEx, $phpbb_root_path; - if ($mode == 'lock' || $mode == 'unlock') + if ($action == 'lock' || $action == 'unlock') { $table = TOPICS_TABLE; $sql_id = 'topic_id'; @@ -206,17 +200,17 @@ function lock_unlock($mode, $ids) $set_id = 'post_edit_locked'; $l_prefix = 'POST'; } - + if (!($forum_id = check_ids($ids, $table, $sql_id, 'm_lock'))) { return; } - + $redirect = request_var('redirect', $user->data['session_page']); $s_hidden_fields = build_hidden_fields(array( $sql_id . '_list' => $ids, - 'mode' => $mode, + 'action' => $action, 'redirect' => $redirect) ); $success_msg = ''; @@ -224,22 +218,22 @@ function lock_unlock($mode, $ids) if (confirm_box(true)) { $sql = "UPDATE $table - SET $set_id = " . (($mode == 'lock' || $mode == 'lock_post') ? ITEM_LOCKED : ITEM_UNLOCKED) . " + SET $set_id = " . (($action == 'lock' || $action == 'lock_post') ? ITEM_LOCKED : ITEM_UNLOCKED) . " WHERE $sql_id IN (" . implode(', ', $ids) . ")"; $db->sql_query($sql); - $data = ($mode == 'lock' || $mode == 'unlock') ? get_topic_data($ids) : get_post_data($ids); + $data = ($action == 'lock' || $action == 'unlock') ? get_topic_data($ids) : get_post_data($ids); foreach ($data as $id => $row) { - add_log('mod', $forum_id, $row['topic_id'], 'LOG_' . strtoupper($mode), $row['topic_title']); + add_log('mod', $forum_id, $row['topic_id'], 'LOG_' . strtoupper($action), $row['topic_title']); } - - $success_msg = $l_prefix . ((sizeof($ids) == 1) ? '' : 'S') . '_' . (($mode == 'lock' || $mode == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS'; + + $success_msg = $l_prefix . ((sizeof($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS'; } else { - confirm_box(false, strtoupper($mode) . '_' . $l_prefix . ((sizeof($ids) == 1) ? '' : 'S'), $s_hidden_fields); + confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((sizeof($ids) == 1) ? '' : 'S'), $s_hidden_fields); } $redirect = request_var('redirect', "index.$phpEx$SID"); @@ -263,7 +257,7 @@ function lock_unlock($mode, $ids) /** * Change Topic Type */ -function change_topic_type($mode, $topic_ids) +function change_topic_type($action, $topic_ids) { global $auth, $user, $db, $SID, $phpEx, $phpbb_root_path; @@ -272,28 +266,31 @@ function change_topic_type($mode, $topic_ids) return; } - switch ($mode) + switch ($action) { case 'make_announce': $new_topic_type = POST_ANNOUNCE; $check_acl = 'f_announce'; $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_ANNOUNCEMENT' : 'MCP_MAKE_ANNOUNCEMENTS'; - break; + break; + case 'make_global': $new_topic_type = POST_GLOBAL; $check_acl = 'f_announce'; $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_GLOBAL' : 'MCP_MAKE_GLOBALS'; - break; + break; + case 'make_sticky': $new_topic_type = POST_STICKY; $check_acl = 'f_sticky'; $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_STICKY' : 'MCP_MAKE_STICKIES'; - break; + break; + default: $new_topic_type = POST_NORMAL; $check_acl = ''; $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_NORMAL' : 'MCP_MAKE_NORMALS'; - break; + break; } $redirect = request_var('redirect', $user->data['session_page']); @@ -301,7 +298,7 @@ function change_topic_type($mode, $topic_ids) $s_hidden_fields = build_hidden_fields(array( 'topic_id_list' => $topic_ids, 'f' => $forum_id, - 'mode' => $mode, + 'action' => $action, 'redirect' => $redirect) ); $success_msg = ''; @@ -378,7 +375,7 @@ function mcp_move_topic($topic_ids) { return; } - + $to_forum_id = request_var('to_forum_id', 0); $redirect = request_var('redirect', $user->data['session_page']); $additional_msg = $success_msg = ''; @@ -386,7 +383,7 @@ function mcp_move_topic($topic_ids) $s_hidden_fields = build_hidden_fields(array( 'topic_id_list' => $topic_ids, 'f' => $forum_id, - 'mode' => 'move', + 'action' => 'move', 'redirect' => $redirect) ); @@ -401,7 +398,7 @@ function mcp_move_topic($topic_ids) else { $forum_data = $forum_data[$to_forum_id]; - + if ($forum_data['forum_type'] != FORUM_POST) { $additional_msg = $user->lang['FORUM_NOT_POSTABLE']; @@ -421,7 +418,7 @@ function mcp_move_topic($topic_ids) { unset($_POST['confirm']); } - + if (confirm_box(true)) { $topic_data = get_topic_data($topic_ids); @@ -473,7 +470,7 @@ function mcp_move_topic($topic_ids) ); $db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow)); - + // $next_id = $db->sql_nextid(); // Mark Shadow topic read // markread('topic', $row['forum_id'], $next_id); @@ -511,7 +508,7 @@ function mcp_move_topic($topic_ids) else { meta_refresh(3, $redirect); - + $message = $user->lang[$success_msg]; $message .= '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'); $message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], "<a href=\"{$phpbb_root_path}viewforum.$phpEx$SID&f=$forum_id\">", '</a>'); @@ -538,7 +535,7 @@ function mcp_delete_topic($topic_ids) $s_hidden_fields = build_hidden_fields(array( 'topic_id_list' => $topic_ids, 'f' => $forum_id, - 'mode' => 'delete_topic', + 'action' => 'delete_topic', 'redirect' => $redirect) ); $success_msg = ''; @@ -598,7 +595,7 @@ function mcp_delete_post($post_ids) $s_hidden_fields = build_hidden_fields(array( 'post_id_list' => $post_ids, 'f' => $forum_id, - 'mode' => 'delete_post', + 'action' => 'delete_post', 'redirect' => $redirect) ); $success_msg = ''; @@ -623,7 +620,7 @@ function mcp_delete_post($post_ids) $db->sql_freeresult($result); $post_data = get_post_data($post_ids); - + foreach ($post_data as $id => $row) { add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_DELETE_POST', $row['post_subject']); @@ -631,7 +628,7 @@ function mcp_delete_post($post_ids) // Now delete the posts, topics and forums are automatically resync'ed delete_posts('post_id', $post_ids); - + $sql = 'SELECT COUNT(topic_id) AS topics_left FROM ' . TOPICS_TABLE . ' WHERE topic_id IN (' . implode(', ', $topic_id_list) . ')'; @@ -711,7 +708,7 @@ function mcp_fork_topic($topic_ids) { return; } - + $to_forum_id = request_var('to_forum_id', 0); $redirect = request_var('redirect', $user->data['session_page']); $additional_msg = $success_msg = ''; @@ -719,7 +716,7 @@ function mcp_fork_topic($topic_ids) $s_hidden_fields = build_hidden_fields(array( 'topic_id_list' => $topic_ids, 'f' => $forum_id, - 'mode' => 'fork', + 'action' => 'fork', 'redirect' => $redirect) ); @@ -738,7 +735,7 @@ function mcp_fork_topic($topic_ids) else { $forum_data = $forum_data[$to_forum_id]; - + if ($forum_data['forum_type'] != FORUM_POST) { $additional_msg = $user->lang['FORUM_NOT_POSTABLE']; @@ -754,11 +751,11 @@ function mcp_fork_topic($topic_ids) { unset($_POST['confirm']); } - + if (confirm_box(true)) { $topic_data = get_topic_data($topic_ids); - + $total_posts = 0; $new_topic_id_list = array(); foreach ($topic_data as $topic_id => $topic_row) @@ -801,8 +798,8 @@ function mcp_fork_topic($topic_ids) { $poll_rows = array(); - $sql = 'SELECT * - FROM ' . POLL_OPTIONS_TABLE . " + $sql = 'SELECT * + FROM ' . POLL_OPTIONS_TABLE . " WHERE topic_id = $topic_id"; $result = $db->sql_query($sql); @@ -819,7 +816,7 @@ function mcp_fork_topic($topic_ids) WHERE topic_id = $topic_id ORDER BY post_id ASC"; $result = $db->sql_query($sql); - + $post_rows = array(); while ($row = $db->sql_fetchrow($result)) { @@ -875,7 +872,7 @@ function mcp_fork_topic($topic_ids) AND topic_id = $topic_id AND in_message = 0"; $result = $db->sql_query($sql); - + while ($attach_row = $db->sql_fetchrow($result)) { $sql_ary = array( @@ -893,7 +890,7 @@ function mcp_fork_topic($topic_ids) 'filetime' => (int) $attach_row['filetime'], 'thumbnail' => (int) $attach_row['thumbnail'] ); - + $db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); } $db->sql_freeresult($result); @@ -962,10 +959,10 @@ class mcp_main_info 'title' => 'MCP_MAIN', 'version' => '1.0.0', 'modes' => array( - 'front' => array('title' => 'MCP_MAIN_FRONT', 'auth' => ''), 'forum_view' => array('title' => 'MCP_MAIN_FORUM_VIEW', 'auth' => 'acl_m_,$id'), - 'topic_view' => array('title' => 'MCP_MAIN_TOPIC_VIEW', 'auth' => 'acl_m_,$id'), + 'front' => array('title' => 'MCP_MAIN_FRONT', 'auth' => ''), 'post_details' => array('title' => 'MCP_MAIN_POST_DETAILS', 'auth' => 'acl_m_,$id'), + 'topic_view' => array('title' => 'MCP_MAIN_TOPIC_VIEW', 'auth' => 'acl_m_,$id'), ), ); } diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 65ef3f7805..cbdf6d4f6a 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -11,7 +11,7 @@ /** * Handling actions in post details screen */ -function mcp_post_details($id, $mode, $action, $url) +function mcp_post_details($id, $mode, $action) { global $SID, $phpEx, $phpbb_root_path, $config; global $template, $db, $user, $auth; @@ -30,135 +30,55 @@ function mcp_post_details($id, $mode, $action, $url) } $post_info = $post_info[$post_id]; + $url = "{$phpbb_root_path}mcp.$phpEx$SID" . extra_url(); switch ($action) { - case 'chgposter_search': - + case 'chgposter': + $username = request_var('username', ''); - if ($username) + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE username = \'' . $db->sql_escape($username) . '\''; + $result = $db->sql_query($sql); + + if (!($row = $db->sql_fetchrow($result))) { - $users_ary = array(); - - if (strpos($username, '*') === false) - { - $username = "*$username*"; - } - $username = str_replace('*', '%', str_replace('%', '\%', $username)); - - $sql = 'SELECT user_id, username - FROM ' . USERS_TABLE . " - WHERE username LIKE '" . $db->sql_escape($username) . "' - AND user_type NOT IN (" . USER_INACTIVE . ', ' . USER_IGNORE . ') - AND user_id <> ' . $post_info['user_id']; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $users_ary[strtolower($row['username'])] = $row; - } - - $user_select = ''; - ksort($users_ary); - foreach ($users_ary as $row) - { - $user_select .= '<option value="' . $row['user_id'] . '">' . $row['username'] . "</option>\n"; - } + trigger_error($user->lang['NO_USER']); } + $new_user = $row['user_id']; - if (!$user_select) + if ($auth->acl_get('m_', $post_info['forum_id'])) { - $template->assign_var('MESSAGE', $user->lang['NO_MATCHES_FOUND']); + change_poster($post_info, $new_user); } + break; - $template->assign_vars(array( - 'S_USER_SELECT' => $user_select, - 'SEARCH_USERNAME' => request_var('username', '')) - ); - break; - - case 'chgposter': + case 'chgposter_ip': $new_user = request_var('u', 0); - if ($new_user && $auth->acl_get('m_', $post_info['forum_id']) && $new_user != $post_info['user_id']) - { - $sql = 'UPDATE ' . POSTS_TABLE . " - SET poster_id = $new_user - WHERE post_id = $post_id"; - $db->sql_query($sql); - - if ($post_info['topic_last_post_id'] == $post_info['post_id'] || $post_info['forum_last_post_id'] == $post_info['post_id']) - { - sync('topic', 'topic_id', $post_info['topic_id'], false, false); - sync('forum', 'forum_id', $post_info['forum_id'], false, false); - } - - // Renew post info - $post_info = get_post_data(array($post_id)); - - if (!sizeof($post_info)) - { - trigger_error($user->lang['POST_NOT_EXIST']); - } - - $post_info = $post_info[$post_id]; - } - break; - - case 'del_marked': - case 'del_all': - case 'add_feedback': - - $deletemark = ($action == 'del_marked') ? true : false; - $deleteall = ($action == 'del_all') ? true : false; - $marked = request_var('marknote', 0); - $usernote = request_var('usernote', ''); - - if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $new_user; + $result = $db->sql_query($sql); + + if (!($row = $db->sql_fetchrow($result))) { - $where_sql = ''; - if ($deletemark && $marked) - { - $sql_in = array(); - foreach ($marked as $mark) - { - $sql_in[] = $mark; - } - $where_sql = ' AND log_id IN (' . implode(', ', $sql_in) . ')'; - unset($sql_in); - } - - $sql = 'DELETE FROM ' . LOG_TABLE . ' - WHERE log_type = ' . LOG_USERS . " - $where_sql"; - $db->sql_query($sql); - - add_log('admin', 'LOG_USERS_CLEAR'); - - $msg = ($deletemark) ? 'MARKED_DELETED' : 'ALL_DELETED'; - $redirect = "$url&i=$id&mode=post_details"; - meta_refresh(2, $redirect); - trigger_error($user->lang[$msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); + trigger_error($user->lang['NO_USER']); } - if ($usernote && $action == 'add_feedback') + if ($auth->acl_get('m_', $post_info['forum_id'])) { - add_log('admin', 'LOG_USER_FEEDBACK', $post_info['username']); - add_log('user', $post_info['user_id'], 'LOG_USER_GENERAL', $usernote); - - $redirect = "$url&i=$id&mode=post_details"; - meta_refresh(2, $redirect); - trigger_error($user->lang['USER_FEEDBACK_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>')); + change_poster($post_info, $new_user); } - break; - - default: + break; } // Set some vars $users_ary = array(); + $post_id = $post_info['post_id']; $poster = ($post_info['user_colour']) ? '<span style="color:#' . $post_info['user_colour'] . '">' . $post_info['username'] . '</span>' : $post_info['username']; // Process message, leave it uncensored @@ -184,17 +104,17 @@ function mcp_post_details($id, $mode, $action, $url) 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => !$post_info['post_approved'], 'S_POST_LOCKED' => $post_info['post_edit_locked'], - 'S_USER_WARNINGS' => ($post_info['user_warnings']) ? true : false, - 'S_SHOW_USER_NOTES' => true, + 'S_USER_NOTES' => $auth->acl_gets('m_', 'a_') ? true : false, 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, - 'U_VIEW_PROFILE' => "memberlist.$phpEx$SID&mode=viewprofile&u=" . $post_info['user_id'], -// 'U_MCP_USERNOTES' => "mcp.$phpEx$SID&i=notes&mode=user_notes&u=" . $post_info['user_id'], -// 'U_MCP_WARNINGS' => "mcp.$phpEx$SID&i=warnings&mode=view_user&u=" . $post_info['user_id'], + 'U_FIND_MEMBER' => "{$phpbb_root_path}memberlist.$phpEx$SID&mode=searchuser&form=mcp_chgposter&field=username", + 'U_VIEW_PROFILE' => "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $post_info['user_id'], + 'U_MCP_USER_NOTES' => $auth->acl_gets('m_', 'a_') ? "{$phpbb_root_path}mcp.$phpEx$SID&i=notes&mode=user_notes&u=" . $post_info['user_id'] : '', + 'U_MCP_WARN_USER' => "{$phpbb_root_path}mcp.$phpEx$SID&i=warn&mode=warn_user&u=" . $post_info['user_id'], 'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? "{$phpbb_root_path}posting.$phpEx$SID&mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}" : '', - 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&p=$post_id#$post_id\">", '</a>'), - 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], "<a href=\"viewforum.$phpEx$SID&f={$post_info['forum_id']}&start={$start}\">", '</a>'), + 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], "<a href=\"{$phpbb_root_path}viewtopic.$phpEx$SID&p=$post_id#$post_id\">", '</a>'), + 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], "<a href=\"{$phpbb_root_path}viewforum.$phpEx$SID&f={$post_info['forum_id']}&start={$start}\">", '</a>'), 'REPORTED_IMG' => $user->img('icon_reported', $user->lang['POST_REPORTED']), 'UNAPPROVED_IMG' => $user->img('icon_unapproved', $user->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $user->img('btn_edit', $user->lang['EDIT_POST']), @@ -231,7 +151,7 @@ function mcp_post_details($id, $mode, $action, $url) // Get Reports if ($auth->acl_get('m_', $post_info['forum_id'])) { - $sql = 'SELECT r.*, re.*, u.user_id, u.username + $sql = 'SELECT r.*, re.*, u.user_id, u.username FROM ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u, ' . REASONS_TABLE . " re WHERE r.post_id = $post_id AND r.reason_id = re.reason_id @@ -250,7 +170,7 @@ function mcp_post_details($id, $mode, $action, $url) 'REASON_TITLE' => $user->lang['report_reasons']['TITLE'][strtoupper($row['reason_name'])], 'REASON_DESC' => $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_name'])], 'REPORTER' => ($row['user_id'] != ANONYMOUS) ? $row['username'] : $user->lang['GUEST'], - 'U_REPORTER' => ($row['user_id'] != ANONYMOUS) ? "memberlist.$phpEx$SID&mode=viewprofile&u={$row['user_id']}" : '', + 'U_REPORTER' => ($row['user_id'] != ANONYMOUS) ? "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u={$row['user_id']}" : '', 'USER_NOTIFY' => ($row['user_notify']) ? true : false, 'REPORT_TIME' => $user->format_date($row['report_time']), 'REPORT_TEXT' => str_replace("\n", '<br />', trim($row['report_text']))) @@ -260,7 +180,7 @@ function mcp_post_details($id, $mode, $action, $url) } $db->sql_freeresult($result); } - + // Get IP if ($auth->acl_get('m_ip', $post_info['forum_id'])) { @@ -294,11 +214,11 @@ function mcp_post_details($id, $mode, $action, $url) $template->assign_block_vars('userrow', array( 'USERNAME' => ($row['user_id'] == ANONYMOUS) ? $user->lang['GUEST'] : $row['username'], - 'NUM_POSTS' => $row['postings'], + 'NUM_POSTS' => $row['postings'], 'L_POST_S' => ($row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'], - 'U_PROFILE' => ($row['user_id'] == ANONYMOUS) ? '' : "memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['user_id'], - 'U_SEARCHPOSTS' => "search.$phpEx$SID&search_author=" . urlencode($row['username']) . "&showresults=topics") + 'U_PROFILE' => ($row['user_id'] == ANONYMOUS) ? '' : "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $row['user_id'], + 'U_SEARCHPOSTS' => "{$phpbb_root_path}search.$phpEx$SID&author=" . urlencode($row['username']) . "&sr=topics") ); } $db->sql_freeresult($result); @@ -318,30 +238,58 @@ function mcp_post_details($id, $mode, $action, $url) $template->assign_block_vars('iprow', array( 'IP' => $row['poster_ip'], 'HOSTNAME' => $hostname, - 'NUM_POSTS' => $row['postings'], + 'NUM_POSTS' => $row['postings'], 'L_POST_S' => ($row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'], 'U_LOOKUP_IP' => ($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') ? '' : "$url&i=$id&mode=post_details&rdns={$row['poster_ip']}#ip", - 'U_WHOIS' => "mcp.$phpEx$SID&i=$id&mode=whois&ip={$row['poster_ip']}") + 'U_WHOIS' => "{$phpbb_root_path}mcp.$phpEx$SID&i=$id&mode=whois&ip={$row['poster_ip']}") ); } $db->sql_freeresult($result); - // If we were not searching for a specific username fill - // the user_select box with users who have posted under - // the same IP - if ($action != 'chgposter_search') + $user_select = ''; + ksort($users_ary); + foreach ($users_ary as $row) { - $user_select = ''; - ksort($users_ary); - foreach ($users_ary as $row) - { - $user_select .= '<option value="' . $row['user_id'] . '">' . $row['username'] . "</option>\n"; - } - $template->assign_var('S_USER_SELECT', $user_select); + $user_select .= '<option value="' . $row['user_id'] . '">' . $row['username'] . "</option>\n"; } + $template->assign_var('S_USER_SELECT', $user_select); } } +/** +* Changes a post's poster_id +*/ +function change_poster(&$post_info, $new_user) +{ + global $auth, $db; + + if ($new_user && $new_user != $post_info['user_id']) + { + $post_id = $post_info['post_id']; + + $sql = 'UPDATE ' . POSTS_TABLE . " + SET poster_id = $new_user + WHERE post_id = " . $post_id; + $db->sql_query($sql); + + if ($post_info['topic_last_post_id'] == $post_id || $post_info['forum_last_post_id'] == $post_id) + { + sync('topic', 'topic_id', $post_info['topic_id'], false, false); + sync('forum', 'forum_id', $post_info['forum_id'], false, false); + } + + // Renew post info + $post_info = get_post_data(array($post_id)); + + if (!sizeof($post_info)) + { + trigger_error($user->lang['POST_NOT_EXIST']); + } + + $post_info = $post_info[$post_id]; + } +} + ?>
\ No newline at end of file diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index e4879288a7..7109aecab7 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -11,11 +11,13 @@ /** * View topic in MCP */ -function mcp_topic_view($id, $mode, $action, $url) +function mcp_topic_view($id, $mode, $action) { global $SID, $phpEx, $phpbb_root_path, $config; global $template, $db, $user, $auth; + $url = "{$phpbb_root_path}mcp.$phpEx$SID" . extra_url(); + $user->add_lang('viewtopic'); $topic_id = request_var('t', 0); @@ -49,8 +51,6 @@ function mcp_topic_view($id, $mode, $action, $url) merge_posts($topic_id, $to_topic_id); $action = 'merge'; } - - $topics_per_page = ($topic_info['forum_topics_per_page']) ? $topic_info['forum_topics_per_page'] : $config['topics_per_page']; if ($action == 'split' && !$subject) { @@ -58,11 +58,10 @@ function mcp_topic_view($id, $mode, $action, $url) } // Jumpbox, sort selects and that kind of things - make_jumpbox($url . '&mode=forum_view', $topic_info['forum_id'], false, 'm_'); + make_jumpbox($url . "&i=$id&mode=forum_view", $topic_info['forum_id'], false, 'm_'); $where_sql = ($action == 'reports') ? 'WHERE post_reported = 1 AND ' : 'WHERE'; mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $topic_info['forum_id'], $topic_id, $where_sql); - $forum_topics = ($total == -1) ? $topic_info['forum_topics'] : $total; $limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : ''; if ($total == -1) @@ -70,6 +69,10 @@ function mcp_topic_view($id, $mode, $action, $url) $total = $topic_info['topic_replies'] + 1; } $posts_per_page = max(0, request_var('posts_per_page', intval($config['posts_per_page']))); + if ($posts_per_page == 0) + { + $posts_per_page = $total; + } $sql = 'SELECT u.username, u.user_colour, p.* FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u @@ -137,9 +140,9 @@ function mcp_topic_view($id, $mode, $action, $url) 'S_CHECKBOX' => $s_checkbox, 'S_POST_REPORTED' => ($row['post_reported']) ? true : false, 'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true, - - 'U_POST_DETAILS' => "$url&p={$row['post_id']}&mode=post_details", - 'U_MCP_APPROVE' => "mcp.$phpEx$SID&i=queue&mode=approve&post_id_list[]=" . $row['post_id']) + + 'U_POST_DETAILS' => "$url&i=$id&p={$row['post_id']}&mode=post_details", + 'U_MCP_APPROVE' => "{$phpbb_root_path}mcp.$phpEx$SID&i=queue&mode=approve&post_id_list[]=" . $row['post_id']) ); unset($rowset[$i]); @@ -157,7 +160,7 @@ function mcp_topic_view($id, $mode, $action, $url) if ($to_topic_id) { $to_topic_info = get_topic_data(array($to_topic_id), 'm_merge'); - + if (!sizeof($to_topic_info)) { $to_topic_id = 0; @@ -166,7 +169,6 @@ function mcp_topic_view($id, $mode, $action, $url) { $to_topic_info = $to_topic_info[$to_topic_id]; } - if (!$to_topic_info['enable_icons']) { @@ -177,10 +179,10 @@ function mcp_topic_view($id, $mode, $action, $url) $template->assign_vars(array( 'TOPIC_TITLE' => $topic_info['topic_title'], - 'U_VIEWTOPIC' => "viewtopic.$phpEx$SID&f=" . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id'], + 'U_VIEWTOPIC' => "{$phpbb_root_path}viewtopic.$phpEx$SID&f=" . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id'], 'TO_TOPIC_ID' => $to_topic_id, - 'TO_TOPIC_INFO' => ($to_topic_id) ? sprintf($user->lang['YOU_SELECTED_TOPIC'], $to_topic_id, '<a href="viewtopic.' . $phpEx . $SID . '&f=' . $to_topic_info['forum_id'] . '&t=' . $to_topic_id . '" target="_new">' . $to_topic_info['topic_title'] . '</a>') : '', + 'TO_TOPIC_INFO' => ($to_topic_id) ? sprintf($user->lang['YOU_SELECTED_TOPIC'], $to_topic_id, '<a href="' . $phpbb_root_path . "viewtopic.$phpEx$SID&f=" . $to_topic_info['forum_id'] . '&t=' . $to_topic_id . '" target="_new">' . $to_topic_info['topic_title'] . '</a>') : '', 'SPLIT_SUBJECT' => $subject, 'POSTS_PER_PAGE' => $posts_per_page, @@ -189,7 +191,7 @@ function mcp_topic_view($id, $mode, $action, $url) 'REPORTED_IMG' => $user->img('icon_reported', 'POST_REPORTED', false, true), 'UNAPPROVED_IMG' => $user->img('icon_unapproved', 'POST_UNAPPROVED', false, true), - 'S_MCP_ACTION' => "$url&mode=$mode&action=$action&start=$start", + 'S_MCP_ACTION' => "$url&i=$id&mode=$mode&action=$action&start=$start", 'S_FORUM_SELECT' => '<select name="to_forum_id">' . (($to_forum_id) ? make_forum_select($to_forum_id) : make_forum_select($topic_info['forum_id'])) . '</select>', 'S_CAN_SPLIT' => ($auth->acl_get('m_split', $topic_info['forum_id']) && $action != 'merge') ? true : false, 'S_CAN_MERGE' => ($auth->acl_get('m_merge', $topic_info['forum_id']) && $action != 'split') ? true : false, @@ -201,11 +203,13 @@ function mcp_topic_view($id, $mode, $action, $url) 'S_SHOW_TOPIC_ICONS'=> $s_topic_icons, 'S_TOPIC_ICON' => $icon_id, - 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&f={$topic_info['forum_id']}&t={$topic_info['topic_id']}&start=$start\">", '</a>'), - 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], "<a href=\"viewforum.$phpEx$SID&f={$topic_info['forum_id']}&start=$start\">", '</a>'), + 'U_SELECT_TOPIC' => "$url&i=$id&mode=forum_view&action=merge_select", + + 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], "<a href=\"{$phpbb_root_path}viewtopic.$phpEx$SID&f={$topic_info['forum_id']}&t={$topic_info['topic_id']}&start=$start\">", '</a>'), + 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], "<a href=\"{$phpbb_root_path}viewforum.$phpEx$SID&f={$topic_info['forum_id']}&start=$start\">", '</a>'), 'PAGE_NUMBER' => on_page($total, $posts_per_page, $start), - 'PAGINATION' => (!$posts_per_page) ? '' : generate_pagination("mcp.$phpEx$SID&t=" . $topic_info['topic_id'] . "&mode=$mode&action=$action&to_topic_id=$to_topic_id&posts_per_page=$posts_per_page&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $posts_per_page, $start), + 'PAGINATION' => (!$posts_per_page) ? '' : generate_pagination("{$phpbb_root_path}mcp.$phpEx$SID&i=$id&t=" . $topic_info['topic_id'] . "&mode=$mode&action=$action&to_topic_id=$to_topic_id&posts_per_page=$posts_per_page&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $posts_per_page, $start), 'TOTAL' => $total) ); } @@ -213,18 +217,18 @@ function mcp_topic_view($id, $mode, $action, $url) /** * Split topic */ -function split_topic($mode, $topic_id, $to_forum_id, $subject) +function split_topic($action, $topic_id, $to_forum_id, $subject) { global $db, $template, $user, $phpEx, $SID, $phpbb_root_path, $auth; $post_id_list = request_var('post_id_list', array(0)); $start = request_var('start', 0); - + if (!sizeof($post_id_list)) { trigger_error('NO_POST_SELECTED'); } - + if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_split'))) { return; @@ -274,11 +278,12 @@ function split_topic($mode, $topic_id, $to_forum_id, $subject) $redirect = request_var('redirect', $user->data['session_page']); $s_hidden_fields = build_hidden_fields(array( + 'i' => 'main', 'post_id_list' => $post_id_list, 'f' => $forum_id, 'mode' => 'topic_view', 'start' => $start, - 'action' => $mode, + 'action' => $action, 't' => $topic_id, 'redirect' => $redirect, 'subject' => $subject, @@ -289,7 +294,7 @@ function split_topic($mode, $topic_id, $to_forum_id, $subject) if (confirm_box(true)) { - if ($mode == 'split_beyond') + if ($action == 'split_beyond') { mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id); $limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : ''; @@ -349,7 +354,7 @@ function split_topic($mode, $topic_id, $to_forum_id, $subject) 'icon_id' => $icon_id, 'topic_approved'=> 1 ); - + $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); $db->sql_query($sql); @@ -357,7 +362,7 @@ function split_topic($mode, $topic_id, $to_forum_id, $subject) move_posts($post_id_list, $to_topic_id); // Change topic title of first post - $sql = 'UPDATE ' . POSTS_TABLE . " + $sql = 'UPDATE ' . POSTS_TABLE . " SET post_subject = '" . $db->sql_escape($subject) . "' WHERE post_id = {$post_id_list[0]}"; $db->sql_query($sql); @@ -365,11 +370,11 @@ function split_topic($mode, $topic_id, $to_forum_id, $subject) $success_msg = 'TOPIC_SPLIT_SUCCESS'; // Link back to both topics - $return_link = sprintf($user->lang['RETURN_TOPIC'], '<a href="viewtopic.' . $phpEx . $SID . '&f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id'] . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="viewtopic.' . $phpEx . $SID . '&f=' . $to_forum_id . '&t=' . $to_topic_id . '">', '</a>'); + $return_link = sprintf($user->lang['RETURN_TOPIC'], "<a href=\"{$phpbb_root_path}viewtopic.$phpEx$SID&f=" . $post_info['forum_id'] . '&t=' . $post_info['topic_id'] . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_NEW_TOPIC'], "<a href=\"{$phpbb_root_path}viewtopic.$phpEx$SID&f=" . $to_forum_id . '&t=' . $to_topic_id . '">', '</a>'); } else { - confirm_box(false, ($mode == 'split_all') ? 'SPLIT_TOPIC_ALL' : 'SPLIT_TOPIC_BEYOND', $s_hidden_fields); + confirm_box(false, ($action == 'split_all') ? 'SPLIT_TOPIC_ALL' : 'SPLIT_TOPIC_BEYOND', $s_hidden_fields); } $redirect = request_var('redirect', "index.$phpEx$SID"); @@ -415,13 +420,13 @@ function merge_posts($topic_id, $to_topic_id) $post_id_list = request_var('post_id_list', array(0)); $start = request_var('start', 0); - + if (!sizeof($post_id_list)) { $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); return; } - + if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_merge'))) { return; @@ -430,6 +435,7 @@ function merge_posts($topic_id, $to_topic_id) $redirect = request_var('redirect', $user->data['session_page']); $s_hidden_fields = build_hidden_fields(array( + 'i' => 'main', 'post_id_list' => $post_id_list, 'to_topic_id' => $to_topic_id, 'mode' => 'topic_view', @@ -447,7 +453,7 @@ function merge_posts($topic_id, $to_topic_id) move_posts($post_id_list, $to_topic_id); add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $topic_data['topic_title']); - + // Message and return links $success_msg = 'POSTS_MERGED_SUCCESS'; @@ -480,7 +486,7 @@ function merge_posts($topic_id, $to_topic_id) } else { - meta_refresh(3, "viewtopic.$phpEx$SID&f=$to_forum_id&t=$to_topic_id"); + meta_refresh(3, "{$phpbb_root_path}viewtopic.$phpEx$SID&f=$to_forum_id&t=$to_topic_id"); trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link); } } |