aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/mcp/mcp_main.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/mcp/mcp_main.php')
-rw-r--r--phpBB/includes/mcp/mcp_main.php208
1 files changed, 128 insertions, 80 deletions
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 69c66639df..2133bd9a19 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -35,8 +35,8 @@ class mcp_main
function main($id, $mode)
{
- global $auth, $db, $user, $template, $action;
- global $config, $phpbb_root_path, $phpEx, $request;
+ global $auth, $user, $action;
+ global $phpbb_root_path, $phpEx, $request;
global $phpbb_dispatcher;
$quickmod = ($mode == 'quickmod') ? true : false;
@@ -45,9 +45,9 @@ class mcp_main
{
case 'lock':
case 'unlock':
- $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
+ $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
- if (!sizeof($topic_ids))
+ if (!count($topic_ids))
{
trigger_error('NO_TOPIC_SELECTED');
}
@@ -58,9 +58,9 @@ class mcp_main
case 'lock_post':
case 'unlock_post':
- $post_ids = (!$quickmod) ? request_var('post_id_list', array(0)) : array(request_var('p', 0));
+ $post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0));
- if (!sizeof($post_ids))
+ if (!count($post_ids))
{
trigger_error('NO_POST_SELECTED');
}
@@ -73,9 +73,9 @@ class mcp_main
case 'make_global':
case 'make_normal':
- $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
+ $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
- if (!sizeof($topic_ids))
+ if (!count($topic_ids))
{
trigger_error('NO_TOPIC_SELECTED');
}
@@ -86,9 +86,9 @@ class mcp_main
case 'move':
$user->add_lang('viewtopic');
- $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
+ $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
- if (!sizeof($topic_ids))
+ if (!count($topic_ids))
{
trigger_error('NO_TOPIC_SELECTED');
}
@@ -99,9 +99,9 @@ class mcp_main
case 'fork':
$user->add_lang('viewtopic');
- $topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));
+ $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
- if (!sizeof($topic_ids))
+ if (!count($topic_ids))
{
trigger_error('NO_TOPIC_SELECTED');
}
@@ -118,7 +118,7 @@ class mcp_main
$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
$soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false;
- if (!sizeof($topic_ids))
+ if (!count($topic_ids))
{
trigger_error('NO_TOPIC_SELECTED');
}
@@ -135,7 +135,7 @@ class mcp_main
$post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0));
$soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false;
- if (!sizeof($post_ids))
+ if (!count($post_ids))
{
trigger_error('NO_POST_SELECTED');
}
@@ -148,7 +148,7 @@ class mcp_main
$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
- if (!sizeof($topic_ids))
+ if (!count($topic_ids))
{
trigger_error('NO_TOPIC_SELECTED');
}
@@ -189,11 +189,11 @@ class mcp_main
$user->add_lang('viewforum');
- $forum_id = request_var('f', 0);
+ $forum_id = $request->variable('f', 0);
$forum_info = phpbb_get_forum_data($forum_id, 'm_', true);
- if (!sizeof($forum_info))
+ if (!count($forum_info))
{
$this->main('main', 'front');
return;
@@ -262,7 +262,7 @@ class mcp_main
*/
function lock_unlock($action, $ids)
{
- global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_dispatcher;
+ global $user, $db, $request, $phpbb_log, $phpbb_dispatcher;
if ($action == 'lock' || $action == 'unlock')
{
@@ -298,7 +298,7 @@ function lock_unlock($action, $ids)
}
unset($orig_ids);
- $redirect = request_var('redirect', build_url(array('action', 'quickmod')));
+ $redirect = $request->variable('redirect', build_url(array('action', 'quickmod')));
$redirect = reapply_sid($redirect);
$s_hidden_fields = build_hidden_fields(array(
@@ -306,7 +306,6 @@ function lock_unlock($action, $ids)
'action' => $action,
'redirect' => $redirect)
);
- $success_msg = '';
if (confirm_box(true))
{
@@ -319,7 +318,12 @@ function lock_unlock($action, $ids)
foreach ($data as $id => $row)
{
- add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_' . strtoupper($action), $row['topic_title']);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_' . strtoupper($action), false, array(
+ 'forum_id' => $row['forum_id'],
+ 'topic_id' => $row['topic_id'],
+ 'post_id' => isset($row['post_id']) ? $row['post_id'] : 0,
+ $row['topic_title']
+ ));
}
/**
@@ -338,7 +342,7 @@ function lock_unlock($action, $ids)
);
extract($phpbb_dispatcher->trigger_event('core.mcp_lock_unlock_after', compact($vars)));
- $success_msg = $l_prefix . ((sizeof($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS';
+ $success_msg = $l_prefix . ((count($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS';
meta_refresh(2, $redirect);
$message = $user->lang[$success_msg];
@@ -351,7 +355,7 @@ function lock_unlock($action, $ids)
}
else
{
- confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((sizeof($ids) == 1) ? '' : 'S'), $s_hidden_fields);
+ confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((count($ids) == 1) ? '' : 'S'), $s_hidden_fields);
}
redirect($redirect);
@@ -362,32 +366,32 @@ function lock_unlock($action, $ids)
*/
function change_topic_type($action, $topic_ids)
{
- global $auth, $user, $db, $phpEx, $phpbb_root_path, $request;
+ global $user, $db, $request, $phpbb_log;
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';
+ $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_ANNOUNCEMENT' : 'MCP_MAKE_ANNOUNCEMENTS';
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';
+ $check_acl = 'f_announce_global';
+ $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_GLOBAL' : 'MCP_MAKE_GLOBALS';
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';
+ $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_STICKY' : 'MCP_MAKE_STICKIES';
break;
default:
$new_topic_type = POST_NORMAL;
$check_acl = false;
- $l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_NORMAL' : 'MCP_MAKE_NORMALS';
+ $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_NORMAL' : 'MCP_MAKE_NORMALS';
break;
}
@@ -398,7 +402,7 @@ function change_topic_type($action, $topic_ids)
return;
}
- $redirect = request_var('redirect', build_url(array('action', 'quickmod')));
+ $redirect = $request->variable('redirect', build_url(array('action', 'quickmod')));
$redirect = reapply_sid($redirect);
$s_hidden_fields = array(
@@ -407,7 +411,6 @@ function change_topic_type($action, $topic_ids)
'action' => $action,
'redirect' => $redirect,
);
- $success_msg = '';
if (confirm_box(true))
{
@@ -416,7 +419,7 @@ function change_topic_type($action, $topic_ids)
WHERE " . $db->sql_in_set('topic_id', $topic_ids);
$db->sql_query($sql);
- if (($new_topic_type == POST_GLOBAL) && sizeof($topic_ids))
+ if (($new_topic_type == POST_GLOBAL) && count($topic_ids))
{
// Delete topic shadows for global announcements
$sql = 'DELETE FROM ' . TOPICS_TABLE . '
@@ -429,15 +432,19 @@ function change_topic_type($action, $topic_ids)
$db->sql_query($sql);
}
- $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED';
+ $success_msg = (count($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED';
- if (sizeof($topic_ids))
+ if (count($topic_ids))
{
$data = phpbb_get_topic_data($topic_ids);
foreach ($data as $topic_id => $row)
{
- add_log('mod', $forum_id, $topic_id, 'LOG_TOPIC_TYPE_CHANGED', $row['topic_title']);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_TOPIC_TYPE_CHANGED', false, array(
+ 'forum_id' => $forum_id,
+ 'topic_id' => $topic_id,
+ $row['topic_title']
+ ));
}
}
@@ -474,8 +481,8 @@ function mcp_move_topic($topic_ids)
return;
}
- $to_forum_id = request_var('to_forum_id', 0);
- $redirect = request_var('redirect', build_url(array('action', 'quickmod')));
+ $to_forum_id = $request->variable('to_forum_id', 0);
+ $redirect = $request->variable('redirect', build_url(array('action', 'quickmod')));
$additional_msg = $success_msg = '';
$s_hidden_fields = build_hidden_fields(array(
@@ -489,7 +496,7 @@ function mcp_move_topic($topic_ids)
{
$forum_data = phpbb_get_forum_data($to_forum_id, 'f_post');
- if (!sizeof($forum_data))
+ if (!count($forum_data))
{
$additional_msg = $user->lang['FORUM_NOT_EXIST'];
}
@@ -684,7 +691,7 @@ function mcp_move_topic($topic_ids)
$sync_sql[$forum_id][] = 'forum_topics_softdeleted = forum_topics_softdeleted - ' . (int) $topics_moved_softdeleted;
}
- $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_MOVED_SUCCESS' : 'TOPICS_MOVED_SUCCESS';
+ $success_msg = (count($topic_ids) == 1) ? 'TOPIC_MOVED_SUCCESS' : 'TOPICS_MOVED_SUCCESS';
foreach ($sync_sql as $forum_id_key => $array)
{
@@ -707,10 +714,10 @@ function mcp_move_topic($topic_ids)
'ADDITIONAL_MSG' => $additional_msg)
);
- confirm_box(false, 'MOVE_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');
+ confirm_box(false, 'MOVE_TOPIC' . ((count($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');
}
- $redirect = request_var('redirect', "index.$phpEx");
+ $redirect = $request->variable('redirect', "index.$phpEx");
$redirect = reapply_sid($redirect);
if (!$success_msg)
@@ -735,7 +742,7 @@ function mcp_move_topic($topic_ids)
*/
function mcp_restore_topic($topic_ids)
{
- global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container;
+ global $user, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log;
if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_approve')))
{
@@ -755,23 +762,29 @@ function mcp_restore_topic($topic_ids)
if (confirm_box(true))
{
- $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_RESTORED_SUCCESS' : 'TOPICS_RESTORED_SUCCESS';
+ $success_msg = (count($topic_ids) == 1) ? 'TOPIC_RESTORED_SUCCESS' : 'TOPICS_RESTORED_SUCCESS';
$data = phpbb_get_topic_data($topic_ids);
+ /* @var $phpbb_content_visibility \phpbb\content_visibility */
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
foreach ($data as $topic_id => $row)
{
$return = $phpbb_content_visibility->set_topic_visibility(ITEM_APPROVED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), '');
if (!empty($return))
{
- add_log('mod', $row['forum_id'], $topic_id, 'LOG_RESTORE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_RESTORE_TOPIC', false, array(
+ 'forum_id' => $row['forum_id'],
+ 'topic_id' => $topic_id,
+ $row['topic_title'],
+ $row['topic_first_poster_name']
+ ));
}
}
}
else
{
- confirm_box(false, (sizeof($topic_ids) == 1) ? 'RESTORE_TOPIC' : 'RESTORE_TOPICS', $s_hidden_fields);
+ confirm_box(false, (count($topic_ids) == 1) ? 'RESTORE_TOPIC' : 'RESTORE_TOPICS', $s_hidden_fields);
}
$topic_id = $request->variable('t', 0);
@@ -808,7 +821,7 @@ function mcp_restore_topic($topic_ids)
*/
function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_topic')
{
- global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container;
+ global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log;
$check_permission = ($is_soft) ? 'm_softdelete' : 'm_delete';
if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array($check_permission)))
@@ -829,7 +842,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = ''
if (confirm_box(true))
{
- $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_DELETED_SUCCESS' : 'TOPICS_DELETED_SUCCESS';
+ $success_msg = (count($topic_ids) == 1) ? 'TOPIC_DELETED_SUCCESS' : 'TOPICS_DELETED_SUCCESS';
$data = phpbb_get_topic_data($topic_ids);
@@ -837,30 +850,47 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = ''
{
if ($row['topic_moved_id'])
{
- add_log('mod', $row['forum_id'], $topic_id, 'LOG_DELETE_SHADOW_TOPIC', $row['topic_title']);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_SHADOW_TOPIC', false, array(
+ 'forum_id' => $row['forum_id'],
+ 'topic_id' => $topic_id,
+ $row['topic_title']
+ ));
}
else
{
// Only soft delete non-shadow topics
if ($is_soft)
{
+ /* @var $phpbb_content_visibility \phpbb\content_visibility */
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
$return = $phpbb_content_visibility->set_topic_visibility(ITEM_DELETED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), $soft_delete_reason);
if (!empty($return))
{
- add_log('mod', $row['forum_id'], $topic_id, 'LOG_SOFTDELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name'], $soft_delete_reason);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SOFTDELETE_TOPIC', false, array(
+ 'forum_id' => $row['forum_id'],
+ 'topic_id' => $topic_id,
+ $row['topic_title'],
+ $row['topic_first_poster_name'],
+ $soft_delete_reason
+ ));
}
}
else
{
- add_log('mod', $row['forum_id'], $topic_id, 'LOG_DELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name'], $soft_delete_reason);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_TOPIC', false, array(
+ 'forum_id' => $row['forum_id'],
+ 'topic_id' => $topic_id,
+ $row['topic_title'],
+ $row['topic_first_poster_name'],
+ $soft_delete_reason
+ ));
}
}
}
if (!$is_soft)
{
- $return = delete_topics('topic_id', $topic_ids);
+ delete_topics('topic_id', $topic_ids);
}
}
else
@@ -897,10 +927,10 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = ''
'S_TOPIC_MODE' => true,
'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id),
'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id),
- 'DELETE_TOPIC_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_TOPIC_PERMANENTLY', sizeof($topic_ids)),
+ 'DELETE_TOPIC_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_TOPIC_PERMANENTLY', count($topic_ids)),
));
- $l_confirm = (sizeof($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS';
+ $l_confirm = (count($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS';
if ($only_softdeleted)
{
$l_confirm .= '_PERMANENTLY';
@@ -948,7 +978,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = ''
*/
function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_post')
{
- global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container;
+ global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log;
$check_permission = ($is_soft) ? 'm_softdelete' : 'm_delete';
if (!phpbb_check_ids($post_ids, POSTS_TABLE, 'post_id', array($check_permission)))
@@ -998,6 +1028,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
$approve_log[] = array(
'forum_id' => $post_data['forum_id'],
'topic_id' => $post_data['topic_id'],
+ 'post_id' => $post_id,
'post_subject' => $post_data['post_subject'],
'poster_id' => $post_data['poster_id'],
'post_username' => $post_data['post_username'],
@@ -1005,21 +1036,29 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
);
}
+ /* @var $phpbb_content_visibility \phpbb\content_visibility */
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
foreach ($topic_info as $topic_id => $topic_data)
{
$phpbb_content_visibility->set_post_visibility(ITEM_DELETED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), $soft_delete_reason, isset($topic_data['first_post']), isset($topic_data['last_post']));
}
- $affected_topics = sizeof($topic_info);
+ $affected_topics = count($topic_info);
// None of the topics is really deleted, so a redirect won't hurt much.
$deleted_topics = 0;
- $success_msg = (sizeof($post_info) == 1) ? $user->lang['POST_DELETED_SUCCESS'] : $user->lang['POSTS_DELETED_SUCCESS'];
+ $success_msg = (count($post_info) == 1) ? $user->lang['POST_DELETED_SUCCESS'] : $user->lang['POSTS_DELETED_SUCCESS'];
foreach ($approve_log as $row)
{
$post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username'];
- add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_SOFTDELETE_POST', $row['post_subject'], $post_username, $soft_delete_reason);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SOFTDELETE_POST', false, array(
+ 'forum_id' => $row['forum_id'],
+ 'topic_id' => $row['topic_id'],
+ 'post_id' => $row['post_id'],
+ $row['post_subject'],
+ $post_username,
+ $soft_delete_reason
+ ));
}
$topic_id = $request->variable('t', 0);
@@ -1054,7 +1093,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
{
$topic_id_list[] = $row['topic_id'];
}
- $affected_topics = sizeof($topic_id_list);
+ $affected_topics = count($topic_id_list);
$db->sql_freeresult($result);
$post_data = phpbb_get_post_data($post_ids);
@@ -1062,7 +1101,14 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
foreach ($post_data as $id => $row)
{
$post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username'];
- add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_DELETE_POST', $row['post_subject'], $post_username, $soft_delete_reason);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_POST', false, array(
+ 'forum_id' => $row['forum_id'],
+ 'topic_id' => $row['topic_id'],
+ 'post_id' => $row['post_id'],
+ $row['post_subject'],
+ $post_username,
+ $soft_delete_reason
+ ));
}
// Now delete the posts, topics and forums are automatically resync'ed
@@ -1086,7 +1132,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
}
$return_link[] = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) . '">', '</a>');
- if (sizeof($post_ids) == 1)
+ if (count($post_ids) == 1)
{
if ($deleted_topics)
{
@@ -1135,10 +1181,10 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
'S_SOFTDELETED' => $only_softdeleted,
'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id),
'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id),
- 'DELETE_POST_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_POST_PERMANENTLY', sizeof($post_ids)),
+ 'DELETE_POST_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_POST_PERMANENTLY', count($post_ids)),
));
- $l_confirm = (sizeof($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS';
+ $l_confirm = (count($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS';
if ($only_softdeleted)
{
$l_confirm .= '_PERMANENTLY';
@@ -1177,16 +1223,16 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
function mcp_fork_topic($topic_ids)
{
global $auth, $user, $db, $template, $config;
- global $phpEx, $phpbb_root_path, $phpbb_dispatcher;
+ global $phpEx, $phpbb_root_path, $phpbb_log, $request, $phpbb_dispatcher;
if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_')))
{
return;
}
- $to_forum_id = request_var('to_forum_id', 0);
- $forum_id = request_var('f', 0);
- $redirect = request_var('redirect', build_url(array('action', 'quickmod')));
+ $to_forum_id = $request->variable('to_forum_id', 0);
+ $forum_id = $request->variable('f', 0);
+ $redirect = $request->variable('redirect', build_url(array('action', 'quickmod')));
$additional_msg = $success_msg = '';
$counter = array();
@@ -1201,11 +1247,11 @@ function mcp_fork_topic($topic_ids)
{
$forum_data = phpbb_get_forum_data($to_forum_id, 'f_post');
- if (!sizeof($topic_ids))
+ if (!count($topic_ids))
{
$additional_msg = $user->lang['NO_TOPIC_SELECTED'];
}
- else if (!sizeof($forum_data))
+ else if (!count($forum_data))
{
$additional_msg = $user->lang['FORUM_NOT_EXIST'];
}
@@ -1331,8 +1377,6 @@ function mcp_fork_topic($topic_ids)
if ($topic_row['poll_start'])
{
- $poll_rows = array();
-
$sql = 'SELECT *
FROM ' . POLL_OPTIONS_TABLE . "
WHERE topic_id = $topic_id";
@@ -1365,7 +1409,7 @@ function mcp_fork_topic($topic_ids)
}
$db->sql_freeresult($result);
- if (!sizeof($post_rows))
+ if (!count($post_rows))
{
continue;
}
@@ -1468,7 +1512,7 @@ function mcp_fork_topic($topic_ids)
}
$db->sql_freeresult($result);
- if (sizeof($sql_ary))
+ if (count($sql_ary))
{
$db->sql_multi_insert(ATTACHMENTS_TABLE, $sql_ary);
}
@@ -1492,7 +1536,7 @@ function mcp_fork_topic($topic_ids)
}
$db->sql_freeresult($result);
- if (sizeof($sql_ary))
+ if (count($sql_ary))
{
$db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary);
}
@@ -1513,7 +1557,7 @@ function mcp_fork_topic($topic_ids)
}
$db->sql_freeresult($result);
- if (sizeof($sql_ary))
+ if (count($sql_ary))
{
$db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary);
}
@@ -1545,15 +1589,19 @@ function mcp_fork_topic($topic_ids)
sync('topic', 'topic_id', $new_topic_id_list);
sync('forum', 'forum_id', $to_forum_id);
- set_config_count('num_topics', sizeof($new_topic_id_list), true);
- set_config_count('num_posts', $total_posts, true);
+ $config->increment('num_topics', count($new_topic_id_list), false);
+ $config->increment('num_posts', $total_posts, false);
foreach ($new_topic_id_list as $topic_id => $new_topic_id)
{
- add_log('mod', $to_forum_id, $new_topic_id, 'LOG_FORK', $topic_row['forum_name']);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_FORK', false, array(
+ 'forum_id' => $to_forum_id,
+ 'topic_id' => $new_topic_id,
+ $topic_row['forum_name']
+ ));
}
- $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS';
+ $success_msg = (count($topic_ids) == 1) ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS';
}
else
{
@@ -1563,10 +1611,10 @@ function mcp_fork_topic($topic_ids)
'ADDITIONAL_MSG' => $additional_msg)
);
- confirm_box(false, 'FORK_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');
+ confirm_box(false, 'FORK_TOPIC' . ((count($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');
}
- $redirect = request_var('redirect', "index.$phpEx");
+ $redirect = $request->variable('redirect', "index.$phpEx");
$redirect = reapply_sid($redirect);
if (!$success_msg)