aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/mcp
diff options
context:
space:
mode:
authorMaat <maat-pub@mageia.biz>2020-05-08 21:52:11 +0200
committerMaat <maat-pub@mageia.biz>2020-05-08 21:52:11 +0200
commit8ea437e30605e0f66b5220bf904a61d7c1d11ddd (patch)
treee0db2bb4a012d5b06a633160b19f62f4868ecd28 /phpBB/includes/mcp
parent36bc1870f21fac04736a1049c1d5b8e127d729f4 (diff)
parent2fdd46b36431ae0f58bb2e78e42553168db9a0ff (diff)
downloadforums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.gz
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.bz2
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.xz
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.zip
Merge remote-tracking branch 'upstream/prep-release-3.2.9'
Diffstat (limited to 'phpBB/includes/mcp')
-rw-r--r--phpBB/includes/mcp/info/mcp_ban.php1
-rw-r--r--phpBB/includes/mcp/info/mcp_logs.php1
-rw-r--r--phpBB/includes/mcp/info/mcp_main.php1
-rw-r--r--phpBB/includes/mcp/info/mcp_notes.php1
-rw-r--r--phpBB/includes/mcp/info/mcp_pm_reports.php1
-rw-r--r--phpBB/includes/mcp/info/mcp_queue.php1
-rw-r--r--phpBB/includes/mcp/info/mcp_reports.php1
-rw-r--r--phpBB/includes/mcp/info/mcp_warn.php1
-rw-r--r--phpBB/includes/mcp/mcp_ban.php9
-rw-r--r--phpBB/includes/mcp/mcp_forum.php159
-rw-r--r--phpBB/includes/mcp/mcp_front.php11
-rw-r--r--phpBB/includes/mcp/mcp_logs.php41
-rw-r--r--phpBB/includes/mcp/mcp_main.php314
-rw-r--r--phpBB/includes/mcp/mcp_notes.php47
-rw-r--r--phpBB/includes/mcp/mcp_pm_reports.php28
-rw-r--r--phpBB/includes/mcp/mcp_post.php45
-rw-r--r--phpBB/includes/mcp/mcp_queue.php214
-rw-r--r--phpBB/includes/mcp/mcp_reports.php134
-rw-r--r--phpBB/includes/mcp/mcp_topic.php153
-rw-r--r--phpBB/includes/mcp/mcp_warn.php64
20 files changed, 783 insertions, 444 deletions
diff --git a/phpBB/includes/mcp/info/mcp_ban.php b/phpBB/includes/mcp/info/mcp_ban.php
index 4aedbc8558..b4fd32792a 100644
--- a/phpBB/includes/mcp/info/mcp_ban.php
+++ b/phpBB/includes/mcp/info/mcp_ban.php
@@ -18,7 +18,6 @@ class mcp_ban_info
return array(
'filename' => 'mcp_ban',
'title' => 'MCP_BAN',
- 'version' => '1.0.0',
'modes' => array(
'user' => array('title' => 'MCP_BAN_USERNAMES', 'auth' => 'acl_m_ban', 'cat' => array('MCP_BAN')),
'ip' => array('title' => 'MCP_BAN_IPS', 'auth' => 'acl_m_ban', 'cat' => array('MCP_BAN')),
diff --git a/phpBB/includes/mcp/info/mcp_logs.php b/phpBB/includes/mcp/info/mcp_logs.php
index c6482c1255..7a0205fce9 100644
--- a/phpBB/includes/mcp/info/mcp_logs.php
+++ b/phpBB/includes/mcp/info/mcp_logs.php
@@ -18,7 +18,6 @@ class mcp_logs_info
return array(
'filename' => 'mcp_logs',
'title' => 'MCP_LOGS',
- 'version' => '1.0.0',
'modes' => array(
'front' => array('title' => 'MCP_LOGS_FRONT', 'auth' => 'acl_m_ || aclf_m_', 'cat' => array('MCP_LOGS')),
'forum_logs' => array('title' => 'MCP_LOGS_FORUM_VIEW', 'auth' => 'acl_m_,$id', 'cat' => array('MCP_LOGS')),
diff --git a/phpBB/includes/mcp/info/mcp_main.php b/phpBB/includes/mcp/info/mcp_main.php
index 81ccdbd1cd..c0f0363255 100644
--- a/phpBB/includes/mcp/info/mcp_main.php
+++ b/phpBB/includes/mcp/info/mcp_main.php
@@ -18,7 +18,6 @@ class mcp_main_info
return array(
'filename' => 'mcp_main',
'title' => 'MCP_MAIN',
- 'version' => '1.0.0',
'modes' => array(
'front' => array('title' => 'MCP_MAIN_FRONT', 'auth' => '', 'cat' => array('MCP_MAIN')),
'forum_view' => array('title' => 'MCP_MAIN_FORUM_VIEW', 'auth' => 'acl_m_,$id', 'cat' => array('MCP_MAIN')),
diff --git a/phpBB/includes/mcp/info/mcp_notes.php b/phpBB/includes/mcp/info/mcp_notes.php
index 4b8c255fe2..de4a41dd80 100644
--- a/phpBB/includes/mcp/info/mcp_notes.php
+++ b/phpBB/includes/mcp/info/mcp_notes.php
@@ -18,7 +18,6 @@ class mcp_notes_info
return array(
'filename' => 'mcp_notes',
'title' => 'MCP_NOTES',
- 'version' => '1.0.0',
'modes' => array(
'front' => array('title' => 'MCP_NOTES_FRONT', 'auth' => '', 'cat' => array('MCP_NOTES')),
'user_notes' => array('title' => 'MCP_NOTES_USER', 'auth' => '', 'cat' => array('MCP_NOTES')),
diff --git a/phpBB/includes/mcp/info/mcp_pm_reports.php b/phpBB/includes/mcp/info/mcp_pm_reports.php
index c80f3b86a3..2a57c0c49a 100644
--- a/phpBB/includes/mcp/info/mcp_pm_reports.php
+++ b/phpBB/includes/mcp/info/mcp_pm_reports.php
@@ -18,7 +18,6 @@ class mcp_pm_reports_info
return array(
'filename' => 'mcp_pm_reports',
'title' => 'MCP_PM_REPORTS',
- 'version' => '1.0.0',
'modes' => array(
'pm_reports' => array('title' => 'MCP_PM_REPORTS_OPEN', 'auth' => 'acl_m_pm_report', 'cat' => array('MCP_REPORTS')),
'pm_reports_closed' => array('title' => 'MCP_PM_REPORTS_CLOSED', 'auth' => 'acl_m_pm_report', 'cat' => array('MCP_REPORTS')),
diff --git a/phpBB/includes/mcp/info/mcp_queue.php b/phpBB/includes/mcp/info/mcp_queue.php
index 556c3902b0..d5605aa50e 100644
--- a/phpBB/includes/mcp/info/mcp_queue.php
+++ b/phpBB/includes/mcp/info/mcp_queue.php
@@ -18,7 +18,6 @@ class mcp_queue_info
return array(
'filename' => 'mcp_queue',
'title' => 'MCP_QUEUE',
- 'version' => '1.0.0',
'modes' => array(
'unapproved_topics' => array('title' => 'MCP_QUEUE_UNAPPROVED_TOPICS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')),
'unapproved_posts' => array('title' => 'MCP_QUEUE_UNAPPROVED_POSTS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')),
diff --git a/phpBB/includes/mcp/info/mcp_reports.php b/phpBB/includes/mcp/info/mcp_reports.php
index 31fee19d79..76e62efe9c 100644
--- a/phpBB/includes/mcp/info/mcp_reports.php
+++ b/phpBB/includes/mcp/info/mcp_reports.php
@@ -18,7 +18,6 @@ class mcp_reports_info
return array(
'filename' => 'mcp_reports',
'title' => 'MCP_REPORTS',
- 'version' => '1.0.0',
'modes' => array(
'reports' => array('title' => 'MCP_REPORTS_OPEN', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')),
'reports_closed' => array('title' => 'MCP_REPORTS_CLOSED', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')),
diff --git a/phpBB/includes/mcp/info/mcp_warn.php b/phpBB/includes/mcp/info/mcp_warn.php
index d85499f280..b4f83e77c6 100644
--- a/phpBB/includes/mcp/info/mcp_warn.php
+++ b/phpBB/includes/mcp/info/mcp_warn.php
@@ -18,7 +18,6 @@ class mcp_warn_info
return array(
'filename' => 'mcp_warn',
'title' => 'MCP_WARN',
- 'version' => '1.0.0',
'modes' => array(
'front' => array('title' => 'MCP_WARN_FRONT', 'auth' => 'aclf_m_warn', 'cat' => array('MCP_WARN')),
'list' => array('title' => 'MCP_WARN_LIST', 'auth' => 'aclf_m_warn', 'cat' => array('MCP_WARN')),
diff --git a/phpBB/includes/mcp/mcp_ban.php b/phpBB/includes/mcp/mcp_ban.php
index 2f3405f915..6f748f5433 100644
--- a/phpBB/includes/mcp/mcp_ban.php
+++ b/phpBB/includes/mcp/mcp_ban.php
@@ -34,7 +34,10 @@ class mcp_ban
}
// Include the admin banning interface...
- include($phpbb_root_path . 'includes/acp/acp_ban.' . $phpEx);
+ if (!class_exists('acp_ban'))
+ {
+ include($phpbb_root_path . 'includes/acp/acp_ban.' . $phpEx);
+ }
$bansubmit = $request->is_set_post('bansubmit');
$unbansubmit = $request->is_set_post('unbansubmit');
@@ -266,9 +269,9 @@ class mcp_ban
}
else if ($post_id)
{
- $post_info = phpbb_get_post_data($post_id, 'm_ban');
+ $post_info = phpbb_get_post_data(array($post_id), 'm_ban');
- if (sizeof($post_info) && !empty($post_info[$post_id]))
+ if (count($post_info) && !empty($post_info[$post_id]))
{
switch ($mode)
{
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php
index 3deb58b96a..19f71e092a 100644
--- a/phpBB/includes/mcp/mcp_forum.php
+++ b/phpBB/includes/mcp/mcp_forum.php
@@ -36,11 +36,11 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$merge_select = ($action == 'merge_select' || $action == 'merge_topic' || $action == 'merge_topics') ? true : false;
$forum_id = $forum_info['forum_id'];
- $start = request_var('start', 0);
- $topic_id_list = request_var('topic_id_list', array(0));
- $post_id_list = request_var('post_id_list', array(0));
- $source_topic_ids = array(request_var('t', 0));
- $to_topic_id = request_var('to_topic_id', 0);
+ $start = $request->variable('start', 0);
+ $topic_id_list = $request->variable('topic_id_list', array(0));
+ $post_id_list = $request->variable('post_id_list', array(0));
+ $source_topic_ids = array($request->variable('t', 0));
+ $to_topic_id = $request->variable('to_topic_id', 0);
$url_extra = '';
$url_extra .= ($forum_id) ? "&amp;f=$forum_id" : '';
@@ -54,7 +54,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
switch ($action)
{
case 'resync':
- $topic_ids = request_var('topic_id_list', array(0));
+ $topic_ids = $request->variable('topic_id_list', array(0));
mcp_resync_topics($topic_ids);
break;
@@ -92,17 +92,18 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
);
extract($phpbb_dispatcher->trigger_event('core.mcp_forum_view_before', compact($vars)));
+ /* @var $pagination \phpbb\pagination */
$pagination = $phpbb_container->get('pagination');
$selected_ids = '';
- if (sizeof($post_id_list) && $action != 'merge_topics')
+ if (count($post_id_list) && $action != 'merge_topics')
{
foreach ($post_id_list as $num => $post_id)
{
$selected_ids .= '&amp;post_id_list[' . $num . ']=' . $post_id;
}
}
- else if (sizeof($topic_id_list) && $action == 'merge_topics')
+ else if (count($topic_id_list) && $action == 'merge_topics')
{
foreach ($topic_id_list as $num => $topic_id)
{
@@ -145,9 +146,10 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
'S_CAN_SYNC' => $auth->acl_get('m_', $forum_id),
'S_CAN_APPROVE' => $auth->acl_get('m_approve', $forum_id),
'S_MERGE_SELECT' => ($merge_select) ? true : false,
- 'S_CAN_MAKE_NORMAL' => $auth->acl_gets('f_sticky', 'f_announce', $forum_id),
+ 'S_CAN_MAKE_NORMAL' => $auth->acl_gets('f_sticky', 'f_announce', 'f_announce_global', $forum_id),
'S_CAN_MAKE_STICKY' => $auth->acl_get('f_sticky', $forum_id),
'S_CAN_MAKE_ANNOUNCE' => $auth->acl_get('f_announce', $forum_id),
+ 'S_CAN_MAKE_ANNOUNCE_GLOBAL' => $auth->acl_get('f_announce_global', $forum_id),
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
'U_VIEW_FORUM_LOGS' => ($auth->acl_gets('a_', 'm_', $forum_id) && $module->loaded('logs')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=logs&amp;mode=forum_logs&amp;f=' . $forum_id) : '',
@@ -172,6 +174,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$read_tracking_join = $read_tracking_select = '';
}
+ /* @var $phpbb_content_visibility \phpbb\content_visibility */
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
$sql = 'SELECT t.topic_id
@@ -200,9 +203,9 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$topic_list = $topic_tracking_info = array();
- while ($row = $db->sql_fetchrow($result))
+ while ($row_ary = $db->sql_fetchrow($result))
{
- $topic_list[] = $row['topic_id'];
+ $topic_list[] = $row_ary['topic_id'];
}
$db->sql_freeresult($result);
@@ -211,20 +214,20 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
WHERE " . $db->sql_in_set('t.topic_id', $topic_list, false, true);
$result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
+ while ($row_ary = $db->sql_fetchrow($result))
{
- $topic_rows[$row['topic_id']] = $row;
+ $topic_rows[$row_ary['topic_id']] = $row_ary;
}
$db->sql_freeresult($result);
// If there is more than one page, but we have no topic list, then the start parameter is... erm... out of sync
- if (!sizeof($topic_list) && $forum_topics && $start > 0)
+ if (!count($topic_list) && $forum_topics && $start > 0)
{
redirect($url . "&amp;i=$id&amp;action=$action&amp;mode=$mode");
}
// Get topic tracking info
- if (sizeof($topic_list))
+ if (count($topic_list))
{
if ($config['load_db_lastread'])
{
@@ -238,109 +241,110 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
foreach ($topic_list as $topic_id)
{
- $topic_title = '';
+ $row_ary = &$topic_rows[$topic_id];
- $row = &$topic_rows[$topic_id];
+ $replies = $phpbb_content_visibility->get_count('topic_posts', $row_ary, $forum_id) - 1;
- $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1;
-
- if ($row['topic_status'] == ITEM_MOVED)
+ if ($row_ary['topic_status'] == ITEM_MOVED)
{
$unread_topic = false;
}
else
{
- $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
+ $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row_ary['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
}
// Get folder img, topic status/type related information
$folder_img = $folder_alt = $topic_type = '';
- topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
+ topic_status($row_ary, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
- $topic_title = censor_text($row['topic_title']);
+ $topic_title = censor_text($row_ary['topic_title']);
- $topic_unapproved = (($row['topic_visibility'] == ITEM_UNAPPROVED || $row['topic_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
- $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;
- $topic_deleted = $row['topic_visibility'] == ITEM_DELETED;
- $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? $url . '&amp;i=queue&amp;mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . '&amp;t=' . $row['topic_id'] : '';
+ $topic_unapproved = (($row_ary['topic_visibility'] == ITEM_UNAPPROVED || $row_ary['topic_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $row_ary['forum_id'])) ? true : false;
+ $posts_unapproved = ($row_ary['topic_visibility'] == ITEM_APPROVED && $row_ary['topic_posts_unapproved'] && $auth->acl_get('m_approve', $row_ary['forum_id'])) ? true : false;
+ $topic_deleted = $row_ary['topic_visibility'] == ITEM_DELETED;
+ $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? $url . '&amp;i=queue&amp;mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . '&amp;t=' . $row_ary['topic_id'] : '';
$u_mcp_queue = (!$u_mcp_queue && $topic_deleted) ? $url . '&amp;i=queue&amp;mode=deleted_topics&amp;t=' . $topic_id : $u_mcp_queue;
$topic_row = array(
- 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
+ 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row_ary['forum_id']) && $row_ary['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
'TOPIC_IMG_STYLE' => $folder_img,
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
- 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
- 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
- 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
+ 'TOPIC_ICON_IMG' => (!empty($icons[$row_ary['icon_id']])) ? $icons[$row_ary['icon_id']]['img'] : '',
+ 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row_ary['icon_id']])) ? $icons[$row_ary['icon_id']]['width'] : '',
+ 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row_ary['icon_id']])) ? $icons[$row_ary['icon_id']]['height'] : '',
'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',
'DELETED_IMG' => ($topic_deleted) ? $user->img('icon_topic_deleted', 'TOPIC_DELETED') : '',
- 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
- 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
- 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
- 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
+ 'TOPIC_AUTHOR' => get_username_string('username', $row_ary['topic_poster'], $row_ary['topic_first_poster_name'], $row_ary['topic_first_poster_colour']),
+ 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row_ary['topic_poster'], $row_ary['topic_first_poster_name'], $row_ary['topic_first_poster_colour']),
+ 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row_ary['topic_poster'], $row_ary['topic_first_poster_name'], $row_ary['topic_first_poster_colour']),
+ 'U_TOPIC_AUTHOR' => get_username_string('profile', $row_ary['topic_poster'], $row_ary['topic_first_poster_name'], $row_ary['topic_first_poster_colour']),
- 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
- 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
- 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
- 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
+ 'LAST_POST_AUTHOR' => get_username_string('username', $row_ary['topic_last_poster_id'], $row_ary['topic_last_poster_name'], $row_ary['topic_last_poster_colour']),
+ 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row_ary['topic_last_poster_id'], $row_ary['topic_last_poster_name'], $row_ary['topic_last_poster_colour']),
+ 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row_ary['topic_last_poster_id'], $row_ary['topic_last_poster_name'], $row_ary['topic_last_poster_colour']),
+ 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row_ary['topic_last_poster_id'], $row_ary['topic_last_poster_name'], $row_ary['topic_last_poster_colour']),
'TOPIC_TYPE' => $topic_type,
'TOPIC_TITLE' => $topic_title,
- 'REPLIES' => $phpbb_content_visibility->get_count('topic_posts', $row, $row['forum_id']) - 1,
- 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']),
- 'FIRST_POST_TIME' => $user->format_date($row['topic_time']),
- 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'],
- 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']),
+ 'REPLIES' => $phpbb_content_visibility->get_count('topic_posts', $row_ary, $row_ary['forum_id']) - 1,
+ 'LAST_POST_TIME' => $user->format_date($row_ary['topic_last_post_time']),
+ 'FIRST_POST_TIME' => $user->format_date($row_ary['topic_time']),
+ 'LAST_POST_SUBJECT' => $row_ary['topic_last_post_subject'],
+ 'LAST_VIEW_TIME' => $user->format_date($row_ary['topic_last_view_time']),
- 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && empty($row['topic_moved_id']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false,
+ 'S_TOPIC_REPORTED' => (!empty($row_ary['topic_reported']) && empty($row_ary['topic_moved_id']) && $auth->acl_get('m_report', $row_ary['forum_id'])) ? true : false,
'S_TOPIC_UNAPPROVED' => $topic_unapproved,
'S_POSTS_UNAPPROVED' => $posts_unapproved,
'S_TOPIC_DELETED' => $topic_deleted,
'S_UNREAD_TOPIC' => $unread_topic,
);
- if ($row['topic_status'] == ITEM_MOVED)
+ if ($row_ary['topic_status'] == ITEM_MOVED)
{
$topic_row = array_merge($topic_row, array(
- 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_moved_id']}"),
- 'U_DELETE_TOPIC' => ($auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;f=$forum_id&amp;topic_id_list[]={$row['topic_id']}&amp;mode=forum_view&amp;action=delete_topic") : '',
+ 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row_ary['topic_moved_id']}"),
+ 'U_DELETE_TOPIC' => ($auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;f=$forum_id&amp;topic_id_list[]={$row_ary['topic_id']}&amp;mode=forum_view&amp;action=delete_topic") : '',
'S_MOVED_TOPIC' => true,
- 'TOPIC_ID' => $row['topic_moved_id'],
+ 'TOPIC_ID' => $row_ary['topic_moved_id'],
));
}
else
{
if ($action == 'merge_topic' || $action == 'merge_topics')
{
- $u_select_topic = $url . "&amp;i=$id&amp;mode=forum_view&amp;action=$action&amp;to_topic_id=" . $row['topic_id'] . $selected_ids;
+ $u_select_topic = $url . "&amp;i=$id&amp;mode=forum_view&amp;action=$action&amp;to_topic_id=" . $row_ary['topic_id'] . $selected_ids;
}
else
{
- $u_select_topic = $url . "&amp;i=$id&amp;mode=topic_view&amp;action=merge&amp;to_topic_id=" . $row['topic_id'] . $selected_ids;
+ $u_select_topic = $url . "&amp;i=$id&amp;mode=topic_view&amp;action=merge&amp;to_topic_id=" . $row_ary['topic_id'] . $selected_ids;
}
$topic_row = array_merge($topic_row, array(
- 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;f=$forum_id&amp;t={$row['topic_id']}&amp;mode=topic_view"),
+ 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;f=$forum_id&amp;t={$row_ary['topic_id']}&amp;mode=topic_view"),
- 'S_SELECT_TOPIC' => ($merge_select && !in_array($row['topic_id'], $source_topic_ids)) ? true : false,
+ 'S_SELECT_TOPIC' => ($merge_select && !in_array($row_ary['topic_id'], $source_topic_ids)) ? true : false,
'U_SELECT_TOPIC' => $u_select_topic,
'U_MCP_QUEUE' => $u_mcp_queue,
- 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=topic_view&amp;t=' . $row['topic_id'] . '&amp;action=reports') : '',
- 'TOPIC_ID' => $row['topic_id'],
- 'S_TOPIC_CHECKED' => ($topic_id_list && in_array($row['topic_id'], $topic_id_list)) ? true : false,
+ 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=topic_view&amp;t=' . $row_ary['topic_id'] . '&amp;action=reports') : '',
+ 'TOPIC_ID' => $row_ary['topic_id'],
+ 'S_TOPIC_CHECKED' => ($topic_id_list && in_array($row_ary['topic_id'], $topic_id_list)) ? true : false,
));
}
+ $row = $row_ary;
/**
* Modify the topic data before it is assigned to the template in MCP
*
* @event core.mcp_view_forum_modify_topicrow
- * @var array row Array with topic data
+ * @var array row Array with topic data
* @var array topic_row Template array with topic data
* @since 3.1.0-a1
*/
$vars = array('row', 'topic_row');
extract($phpbb_dispatcher->trigger_event('core.mcp_view_forum_modify_topicrow', compact($vars)));
+ $row_ary = $row;
+ unset($row);
$template->assign_block_vars('topicrow', $topic_row);
}
@@ -352,9 +356,9 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
*/
function mcp_resync_topics($topic_ids)
{
- global $auth, $db, $template, $phpEx, $user, $phpbb_root_path;
+ global $db, $user, $phpbb_log, $request;
- if (!sizeof($topic_ids))
+ if (!count($topic_ids))
{
trigger_error('NO_TOPIC_SELECTED');
}
@@ -377,13 +381,17 @@ function mcp_resync_topics($topic_ids)
// Log this action
while ($row = $db->sql_fetchrow($result))
{
- add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_TOPIC_RESYNC', $row['topic_title']);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_TOPIC_RESYNC', false, array(
+ 'forum_id' => $row['forum_id'],
+ 'topic_id' => $row['topic_id'],
+ $row['topic_title']
+ ));
}
$db->sql_freeresult($result);
- $msg = (sizeof($topic_ids) == 1) ? $user->lang['TOPIC_RESYNC_SUCCESS'] : $user->lang['TOPICS_RESYNC_SUCCESS'];
+ $msg = (count($topic_ids) == 1) ? $user->lang['TOPIC_RESYNC_SUCCESS'] : $user->lang['TOPICS_RESYNC_SUCCESS'];
- $redirect = request_var('redirect', $user->data['session_page']);
+ $redirect = $request->variable('redirect', $user->data['session_page']);
meta_refresh(3, $redirect);
trigger_error($msg . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
@@ -396,9 +404,9 @@ function mcp_resync_topics($topic_ids)
*/
function merge_topics($forum_id, $topic_ids, $to_topic_id)
{
- global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $phpbb_dispatcher;
+ global $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_log, $request, $phpbb_dispatcher;
- if (!sizeof($topic_ids))
+ if (!count($topic_ids))
{
$template->assign_var('MESSAGE', $user->lang['NO_TOPIC_SELECTED']);
return;
@@ -413,7 +421,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
$all_topic_data = phpbb_get_topic_data($sync_topics, 'm_merge');
- if (!sizeof($all_topic_data) || empty($all_topic_data[$to_topic_id]))
+ if (!count($all_topic_data) || empty($all_topic_data[$to_topic_id]))
{
$template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
return;
@@ -429,10 +437,10 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
$to_topic_data = $all_topic_data[$to_topic_id];
- $post_id_list = request_var('post_id_list', array(0));
- $start = request_var('start', 0);
+ $post_id_list = $request->variable('post_id_list', array(0));
+ $start = $request->variable('start', 0);
- if (!sizeof($post_id_list) && sizeof($topic_ids))
+ if (!count($post_id_list) && count($topic_ids))
{
$sql = 'SELECT post_id
FROM ' . POSTS_TABLE . '
@@ -447,7 +455,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
$db->sql_freeresult($result);
}
- if (!sizeof($post_id_list))
+ if (!count($post_id_list))
{
$template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
return;
@@ -458,7 +466,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
return;
}
- $redirect = request_var('redirect', "{$phpbb_root_path}mcp.$phpEx?f=$forum_id&amp;i=main&amp;mode=forum_view");
+ $redirect = $request->variable('redirect', "{$phpbb_root_path}mcp.$phpEx?f=$forum_id&amp;i=main&amp;mode=forum_view");
$s_hidden_fields = build_hidden_fields(array(
'i' => 'main',
@@ -471,14 +479,19 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
'redirect' => $redirect,
'topic_id_list' => $topic_ids)
);
- $success_msg = $return_link = '';
+ $return_link = '';
if (confirm_box(true))
{
$to_forum_id = $to_topic_data['forum_id'];
move_posts($post_id_list, $to_topic_id, false);
- add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $to_topic_data['topic_title']);
+
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MERGE', false, array(
+ 'forum_id' => $to_forum_id,
+ 'topic_id' => $to_topic_id,
+ $to_topic_data['topic_title']
+ ));
// Update topic views count
$sql = 'UPDATE ' . TOPICS_TABLE . '
@@ -508,7 +521,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
// Link to the new topic
$return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
- $redirect = request_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&amp;t=$to_topic_id");
+ $redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&amp;t=$to_topic_id");
$redirect = reapply_sid($redirect);
/**
diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php
index 5d8aa18c16..918a98734b 100644
--- a/phpBB/includes/mcp/mcp_front.php
+++ b/phpBB/includes/mcp/mcp_front.php
@@ -24,9 +24,9 @@ if (!defined('IN_PHPBB'))
*/
function mcp_front_view($id, $mode, $action)
{
- global $phpEx, $phpbb_root_path, $config;
+ global $phpEx, $phpbb_root_path;
global $template, $db, $user, $auth, $module;
- global $phpbb_dispatcher;
+ global $phpbb_dispatcher, $request;
// Latest 5 unapproved
if ($module->loaded('queue'))
@@ -35,7 +35,7 @@ function mcp_front_view($id, $mode, $action)
$post_list = array();
$forum_names = array();
- $forum_id = request_var('f', 0);
+ $forum_id = $request->variable('f', 0);
$template->assign_var('S_SHOW_UNAPPROVED', (!empty($forum_list)) ? true : false);
@@ -290,7 +290,10 @@ function mcp_front_view($id, $mode, $action)
if ($total)
{
- include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
+ if (!function_exists('get_recipient_strings'))
+ {
+ include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
+ }
$sql_ary = array(
'SELECT' => 'r.report_id, r.report_time, p.msg_id, p.message_subject, p.message_time, p.to_address, p.bcc_address, p.message_attachment, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id',
diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php
index 9c76f0df90..79f9d35ebe 100644
--- a/phpBB/includes/mcp/mcp_logs.php
+++ b/phpBB/includes/mcp/mcp_logs.php
@@ -28,19 +28,19 @@ class mcp_logs
var $u_action;
var $p_master;
- function mcp_logs(&$p_master)
+ function __construct($p_master)
{
- $this->p_master = &$p_master;
+ $this->p_master = $p_master;
}
function main($id, $mode)
{
- global $auth, $db, $user, $template;
- global $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_log;
+ global $auth, $db, $user, $template, $request;
+ global $config, $phpbb_container, $phpbb_log;
$user->add_lang('acp/common');
- $action = request_var('action', array('' => ''));
+ $action = $request->variable('action', array('' => ''));
if (is_array($action))
{
@@ -48,23 +48,24 @@ class mcp_logs
}
else
{
- $action = request_var('action', '');
+ $action = $request->variable('action', '');
}
// Set up general vars
- $start = request_var('start', 0);
+ $start = $request->variable('start', 0);
$deletemark = ($action == 'del_marked') ? true : false;
$deleteall = ($action == 'del_all') ? true : false;
- $marked = request_var('mark', array(0));
+ $marked = $request->variable('mark', array(0));
// Sort keys
- $sort_days = request_var('st', 0);
- $sort_key = request_var('sk', 't');
- $sort_dir = request_var('sd', 'd');
+ $sort_days = $request->variable('st', 0);
+ $sort_key = $request->variable('sk', 't');
+ $sort_dir = $request->variable('sd', 'd');
$this->tpl_name = 'mcp_logs';
$this->page_title = 'MCP_LOGS';
+ /* @var $pagination \phpbb\pagination */
$pagination = $phpbb_container->get('pagination');
$forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_')));
@@ -78,10 +79,11 @@ class mcp_logs
break;
case 'forum_logs':
- $forum_id = request_var('f', 0);
+ $forum_id = $request->variable('f', 0);
if (!in_array($forum_id, $forum_list))
{
+ send_status_line(403, 'Forbidden');
trigger_error('NOT_AUTHORISED');
}
@@ -89,7 +91,7 @@ class mcp_logs
break;
case 'topic_logs':
- $topic_id = request_var('t', 0);
+ $topic_id = $request->variable('t', 0);
$sql = 'SELECT forum_id
FROM ' . TOPICS_TABLE . '
@@ -100,6 +102,7 @@ class mcp_logs
if (!in_array($forum_id, $forum_list))
{
+ send_status_line(403, 'Forbidden');
trigger_error('NOT_AUTHORISED');
}
@@ -112,7 +115,7 @@ class mcp_logs
{
if (confirm_box(true))
{
- if ($deletemark && sizeof($marked))
+ if ($deletemark && count($marked))
{
$conditions = array(
'forum_id' => array('IN' => $forum_list),
@@ -123,7 +126,7 @@ class mcp_logs
}
else if ($deleteall)
{
- $keywords = utf8_normalize_nfc(request_var('keywords', '', true));
+ $keywords = $request->variable('keywords', '', true);
$conditions = array(
'forum_id' => array('IN' => $forum_list),
@@ -157,7 +160,7 @@ class mcp_logs
'sd' => $sort_dir,
'i' => $id,
'mode' => $mode,
- 'action' => request_var('action', array('' => ''))))
+ 'action' => $request->variable('action', array('' => ''))))
);
}
}
@@ -174,7 +177,7 @@ class mcp_logs
$sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;
$sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
- $keywords = utf8_normalize_nfc(request_var('keywords', '', true));
+ $keywords = $request->variable('keywords', '', true);
$keywords_param = !empty($keywords) ? '&amp;keywords=' . urlencode(htmlspecialchars_decode($keywords)) : '';
// Grab log data
@@ -204,7 +207,7 @@ class mcp_logs
{
$data = array();
- $checks = array('viewtopic', 'viewforum');
+ $checks = array('viewpost', 'viewtopic', 'viewforum');
foreach ($checks as $check)
{
if (isset($row[$check]) && $row[$check])
@@ -218,7 +221,7 @@ class mcp_logs
'IP' => $row['ip'],
'DATE' => $user->format_date($row['time']),
'ACTION' => $row['action'],
- 'DATA' => (sizeof($data)) ? implode(' | ', $data) : '',
+ 'DATA' => (count($data)) ? implode(' | ', $data) : '',
'ID' => $row['id'],
)
);
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 69c66639df..744eaebd7d 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -28,26 +28,42 @@ class mcp_main
var $p_master;
var $u_action;
- function mcp_main(&$p_master)
+ function __construct($p_master)
{
- $this->p_master = &$p_master;
+ $this->p_master = $p_master;
}
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;
+ /**
+ * Event to perform additional actions before an MCP action is executed.
+ *
+ * @event core.mcp_main_before
+ * @var string action The action that is about to be performed
+ * @var string mode The mode in which the MCP is accessed, e.g. front, forum_view, topic_view, post_details, quickmod
+ * @var boolean quickmod Whether or not the action is performed via QuickMod
+ * @since 3.2.8-RC1
+ */
+ $vars = [
+ 'action',
+ 'mode',
+ 'quickmod',
+ ];
+ extract($phpbb_dispatcher->trigger_event('core.mcp_main_before', compact($vars)));
+
switch ($action)
{
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 +74,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 +89,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 +102,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 +115,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 +134,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 +151,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 +164,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');
}
@@ -174,7 +190,10 @@ class mcp_main
switch ($mode)
{
case 'front':
- include($phpbb_root_path . 'includes/mcp/mcp_front.' . $phpEx);
+ if (!function_exists('mcp_front_view'))
+ {
+ include($phpbb_root_path . 'includes/mcp/mcp_front.' . $phpEx);
+ }
$user->add_lang('acp/common');
@@ -185,15 +204,18 @@ class mcp_main
break;
case 'forum_view':
- include($phpbb_root_path . 'includes/mcp/mcp_forum.' . $phpEx);
+ if (!function_exists('mcp_forum_view'))
+ {
+ include($phpbb_root_path . 'includes/mcp/mcp_forum.' . $phpEx);
+ }
$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;
@@ -208,7 +230,10 @@ class mcp_main
break;
case 'topic_view':
- include($phpbb_root_path . 'includes/mcp/mcp_topic.' . $phpEx);
+ if (!function_exists('mcp_topic_view'))
+ {
+ include($phpbb_root_path . 'includes/mcp/mcp_topic.' . $phpEx);
+ }
mcp_topic_view($id, $mode, $action);
@@ -217,7 +242,10 @@ class mcp_main
break;
case 'post_details':
- include($phpbb_root_path . 'includes/mcp/mcp_post.' . $phpEx);
+ if (!function_exists('mcp_post_details'))
+ {
+ include($phpbb_root_path . 'includes/mcp/mcp_post.' . $phpEx);
+ }
mcp_post_details($id, $mode, $action);
@@ -262,7 +290,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 +326,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 +334,6 @@ function lock_unlock($action, $ids)
'action' => $action,
'redirect' => $redirect)
);
- $success_msg = '';
if (confirm_box(true))
{
@@ -319,7 +346,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 +370,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 +383,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 +394,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, $phpbb_dispatcher;
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 +430,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,40 +439,75 @@ function change_topic_type($action, $topic_ids)
'action' => $action,
'redirect' => $redirect,
);
- $success_msg = '';
if (confirm_box(true))
{
+
+ /**
+ * Perform additional actions before changing topic(s) type
+ *
+ * @event core.mcp_change_topic_type_before
+ * @var int new_topic_type The candidated topic type.
+ * @var int forum_id The forum ID for the topic ID(s).
+ * @var array topic_ids Array containing the topic ID(s) that will be changed
+ * @since 3.2.6-RC1
+ */
+ $vars = array(
+ 'new_topic_type',
+ 'forum_id',
+ 'topic_ids',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_change_topic_type_before', compact($vars)));
+
+ $db->sql_transaction('begin');
+
$sql = 'UPDATE ' . TOPICS_TABLE . "
SET topic_type = $new_topic_type
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 . '
WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids);
$db->sql_query($sql);
-
- $sql = 'UPDATE ' . TOPICS_TABLE . "
- SET topic_type = $new_topic_type
- WHERE " . $db->sql_in_set('topic_id', $topic_ids);
- $db->sql_query($sql);
}
- $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED';
+ $db->sql_transaction('commit');
+
+ $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']
+ ));
}
}
+ /**
+ * Perform additional actions after changing topic types
+ *
+ * @event core.mcp_change_topic_type_after
+ * @var int new_topic_type The newly changed topic type.
+ * @var int forum_id The forum ID where the newly changed topic type belongs to.
+ * @var array topic_ids Array containing the topic IDs that have been changed
+ * @since 3.2.6-RC1
+ */
+ $vars = array(
+ 'new_topic_type',
+ 'forum_id',
+ 'topic_ids',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_change_topic_type_after', compact($vars)));
+
meta_refresh(2, $redirect);
$message = $user->lang[$success_msg];
@@ -474,8 +541,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 +556,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 +751,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 +774,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 +802,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 +822,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 +881,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 +902,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 +910,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,13 +987,14 @@ 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';
+ $count = count($topic_ids);
+ $l_confirm = $count === 1 ? 'DELETE_TOPIC' : 'DELETE_TOPICS';
if ($only_softdeleted)
{
- $l_confirm .= '_PERMANENTLY';
+ $l_confirm = array($l_confirm . '_PERMANENTLY', $count);
$s_hidden_fields['delete_permanent'] = '1';
}
else if ($only_shadow || !$auth->acl_get('m_softdelete', $forum_id))
@@ -948,7 +1039,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 +1089,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 +1097,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 +1154,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 +1162,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 +1193,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,13 +1242,14 @@ 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';
+ $count = count($post_ids);
+ $l_confirm = $count === 1 ? 'DELETE_POST' : 'DELETE_POSTS';
if ($only_softdeleted)
{
- $l_confirm .= '_PERMANENTLY';
+ $l_confirm = array($l_confirm . '_PERMANENTLY', $count);
$s_hidden_fields['delete_permanent'] = '1';
}
else if (!$auth->acl_get('m_softdelete', $forum_id))
@@ -1177,16 +1285,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 +1309,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 +1439,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 +1471,7 @@ function mcp_fork_topic($topic_ids)
}
$db->sql_freeresult($result);
- if (!sizeof($post_rows))
+ if (!count($post_rows))
{
continue;
}
@@ -1414,6 +1520,24 @@ function mcp_fork_topic($topic_ids)
$db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
$new_post_id = $db->sql_nextid();
+ /**
+ * Perform actions after forked topic is created.
+ *
+ * @event core.mcp_main_fork_sql_after
+ * @var int new_topic_id The newly created topic ID
+ * @var int to_forum_id The forum ID where the forked topic has been moved to
+ * @var int new_post_id The newly created post ID
+ * @var array row Post data
+ * @since 3.2.4-RC1
+ */
+ $vars = array(
+ 'new_topic_id',
+ 'to_forum_id',
+ 'new_post_id',
+ 'row',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_main_fork_sql_after', compact($vars)));
+
switch ($row['post_visibility'])
{
case ITEM_APPROVED:
@@ -1468,7 +1592,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 +1616,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 +1637,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 +1669,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 +1691,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)
diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php
index 465ee63a98..a4c2356a43 100644
--- a/phpBB/includes/mcp/mcp_notes.php
+++ b/phpBB/includes/mcp/mcp_notes.php
@@ -28,17 +28,17 @@ class mcp_notes
var $p_master;
var $u_action;
- function mcp_notes(&$p_master)
+ function __construct($p_master)
{
- $this->p_master = &$p_master;
+ $this->p_master = $p_master;
}
function main($id, $mode)
{
- global $auth, $db, $user, $template;
- global $config, $phpbb_root_path, $phpEx;
+ global $user, $template, $request;
+ global $phpbb_root_path, $phpEx;
- $action = request_var('action', array('' => ''));
+ $action = $request->variable('action', array('' => ''));
if (is_array($action))
{
@@ -74,15 +74,17 @@ class mcp_notes
*/
function mcp_notes_user_view($action)
{
- global $phpEx, $phpbb_root_path, $config;
+ global $config, $phpbb_log, $request;
global $template, $db, $user, $auth, $phpbb_container;
- $user_id = request_var('u', 0);
- $username = request_var('username', '', true);
- $start = request_var('start', 0);
- $st = request_var('st', 0);
- $sk = request_var('sk', 'b');
- $sd = request_var('sd', 'd');
+ $user_id = $request->variable('u', 0);
+ $username = $request->variable('username', '', true);
+ $start = $request->variable('start', 0);
+ $st = $request->variable('st', 0);
+ $sk = $request->variable('sk', 'b');
+ $sd = $request->variable('sd', 'd');
+
+ /* @var $pagination \phpbb\pagination */
$pagination = $phpbb_container->get('pagination');
add_form_key('mcp_notes');
@@ -114,8 +116,8 @@ class mcp_notes
$deletemark = ($action == 'del_marked') ? true : false;
$deleteall = ($action == 'del_all') ? true : false;
- $marked = request_var('marknote', array(0));
- $usernote = utf8_normalize_nfc(request_var('usernote', '', true));
+ $marked = $request->variable('marknote', array(0));
+ $usernote = $request->variable('usernote', '', true);
// Handle any actions
if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs'))
@@ -142,7 +144,7 @@ class mcp_notes
$where_sql";
$db->sql_query($sql);
- add_log('admin', 'LOG_CLEAR_USER', $userrow['username']);
+ $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CLEAR_USER', false, array($userrow['username']));
$msg = ($deletemark) ? 'MARKED_NOTES_DELETED' : 'ALL_NOTES_DELETED';
}
@@ -160,10 +162,17 @@ class mcp_notes
{
if (check_form_key('mcp_notes'))
{
- add_log('admin', 'LOG_USER_FEEDBACK', $userrow['username']);
- add_log('mod', 0, 0, 'LOG_USER_FEEDBACK', $userrow['username']);
+ $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_FEEDBACK', false, array($userrow['username']));
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_USER_FEEDBACK', false, array(
+ 'forum_id' => 0,
+ 'topic_id' => 0,
+ $userrow['username']
+ ));
+ $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GENERAL', false, array(
+ 'reportee_id' => $user_id,
+ $usernote
+ ));
- add_log('user', $user_id, 'LOG_USER_GENERAL', $usernote);
$msg = $user->lang['USER_FEEDBACK_ADDED'];
}
else
@@ -192,7 +201,7 @@ class mcp_notes
$sql_where = ($st) ? (time() - ($st * 86400)) : 0;
$sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC');
- $keywords = utf8_normalize_nfc(request_var('keywords', '', true));
+ $keywords = $request->variable('keywords', '', true);
$keywords_param = !empty($keywords) ? '&amp;keywords=' . urlencode(htmlspecialchars_decode($keywords)) : '';
$log_data = array();
diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php
index d76bedba98..eecfe9cbc8 100644
--- a/phpBB/includes/mcp/mcp_pm_reports.php
+++ b/phpBB/includes/mcp/mcp_pm_reports.php
@@ -28,21 +28,22 @@ class mcp_pm_reports
var $p_master;
var $u_action;
- function mcp_pm_reports(&$p_master)
+ function __construct($p_master)
{
- $this->p_master = &$p_master;
+ $this->p_master = $p_master;
}
function main($id, $mode)
{
- global $auth, $db, $user, $template, $cache;
+ global $auth, $db, $user, $template, $request;
global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container;
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
- $start = request_var('start', 0);
+ /* @var $pagination \phpbb\pagination */
$pagination = $phpbb_container->get('pagination');
+ $start = $request->variable('start', 0);
$this->page_title = 'MCP_PM_REPORTS';
@@ -52,9 +53,9 @@ class mcp_pm_reports
case 'delete':
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
- $report_id_list = request_var('report_id_list', array(0));
+ $report_id_list = $request->variable('report_id_list', array(0));
- if (!sizeof($report_id_list))
+ if (!count($report_id_list))
{
trigger_error('NO_REPORT_SELECTED');
}
@@ -75,7 +76,7 @@ class mcp_pm_reports
$user->add_lang(array('posting', 'viewforum', 'viewtopic', 'ucp'));
- $report_id = request_var('r', 0);
+ $report_id = $request->variable('r', 0);
$sql = 'SELECT r.pm_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour
FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u
@@ -93,16 +94,17 @@ class mcp_pm_reports
trigger_error('NO_REPORT');
}
+ /* @var $phpbb_notifications \phpbb\notification\manager */
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->mark_notifications_read_by_parent('notification.type.report_pm', $report_id, $user->data['user_id']);
+ $phpbb_notifications->mark_notifications_by_parent('report_pm', $report_id, $user->data['user_id']);
$pm_id = $report['pm_id'];
$report_id = $report['report_id'];
$pm_info = phpbb_get_pm_data(array($pm_id));
- if (!sizeof($pm_info))
+ if (!count($pm_info))
{
trigger_error('NO_REPORT_SELECTED');
}
@@ -139,7 +141,7 @@ class mcp_pm_reports
}
$db->sql_freeresult($result);
- if (sizeof($attachments))
+ if (count($attachments))
{
$update_count = array();
parse_attachments(0, $message, $attachments, $update_count);
@@ -199,7 +201,7 @@ class mcp_pm_reports
'POST_SUBJECT' => ($pm_info['message_subject']) ? $pm_info['message_subject'] : $user->lang['NO_SUBJECT'],
'POST_DATE' => $user->format_date($pm_info['message_time']),
'POST_IP' => $pm_info['author_ip'],
- 'POST_IPADDR' => ($auth->acl_getf_global('m_info') && request_var('lookup', '')) ? @gethostbyaddr($pm_info['author_ip']) : '',
+ 'POST_IPADDR' => ($auth->acl_getf_global('m_info') && $request->variable('lookup', '')) ? @gethostbyaddr($pm_info['author_ip']) : '',
'POST_ID' => $pm_info['msg_id'],
'U_LOOKUP_IP' => ($auth->acl_getf_global('m_info')) ? $this->u_action . '&amp;r=' . $report_id . '&amp;pm=' . $pm_id . '&amp;lookup=' . $pm_info['author_ip'] . '#ip' : '',
@@ -249,7 +251,7 @@ class mcp_pm_reports
}
$db->sql_freeresult($result);
- if (sizeof($report_ids))
+ if (count($report_ids))
{
$sql = 'SELECT p.*, u.username, u.username_clean, u.user_colour, r.user_id as reporter_id, ru.username as reporter_name, ru.user_colour as reporter_colour, r.report_time, r.report_id
FROM ' . REPORTS_TABLE . ' r, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u, ' . USERS_TABLE . ' ru
@@ -268,7 +270,7 @@ class mcp_pm_reports
}
$db->sql_freeresult($result);
- if (sizeof($pm_list))
+ if (count($pm_list))
{
$address_list = get_recipient_strings($pm_by_id);
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index 1cf4a74234..8d278079fb 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -25,20 +25,20 @@ if (!defined('IN_PHPBB'))
function mcp_post_details($id, $mode, $action)
{
global $phpEx, $phpbb_root_path, $config, $request;
- global $template, $db, $user, $auth, $cache, $phpbb_container;
- global $phpbb_dispatcher;
+ global $template, $db, $user, $auth;
+ global $phpbb_container, $phpbb_dispatcher;
$user->add_lang('posting');
- $post_id = request_var('p', 0);
- $start = request_var('start', 0);
+ $post_id = $request->variable('p', 0);
+ $start = $request->variable('start', 0);
// Get post data
$post_info = phpbb_get_post_data(array($post_id), false, true);
add_form_key('mcp_post_details');
- if (!sizeof($post_info))
+ if (!count($post_info))
{
trigger_error('POST_NOT_EXIST');
}
@@ -52,7 +52,7 @@ function mcp_post_details($id, $mode, $action)
if ($auth->acl_get('m_info', $post_info['forum_id']))
{
- $ip = request_var('ip', '');
+ $ip = $request->variable('ip', '');
if (!function_exists('user_ipwhois'))
{
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
@@ -76,12 +76,12 @@ function mcp_post_details($id, $mode, $action)
if ($action == 'chgposter')
{
- $username = request_var('username', '', true);
+ $username = $request->variable('username', '', true);
$sql_where = "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
}
else
{
- $new_user_id = request_var('u', 0);
+ $new_user_id = $request->variable('u', 0);
$sql_where = 'user_id = ' . $new_user_id;
}
@@ -131,7 +131,6 @@ function mcp_post_details($id, $mode, $action)
$users_ary = $usernames_ary = array();
$attachments = $extensions = array();
$post_id = $post_info['post_id'];
- $topic_tracking_info = array();
// Get topic tracking info
if ($config['load_db_lastread'])
@@ -153,8 +152,6 @@ function mcp_post_details($id, $mode, $action)
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{
- $extensions = $cache->obtain_attach_extensions($post_info['forum_id']);
-
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
WHERE post_msg_id = ' . $post_id . '
@@ -168,7 +165,7 @@ function mcp_post_details($id, $mode, $action)
}
$db->sql_freeresult($result);
- if (sizeof($attachments))
+ if (count($attachments))
{
$user->add_lang('viewtopic');
$update_count = array();
@@ -216,6 +213,10 @@ function mcp_post_details($id, $mode, $action)
$l_deleted_by = '';
}
+ // parse signature
+ $parse_flags = ($post_info['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
+ $post_info['user_sig'] = generate_text_for_display($post_info['user_sig'], $post_info['user_sig_bbcode_uid'], $post_info['user_sig_bbcode_bitfield'], $parse_flags, true);
+
$mcp_post_template_data = array(
'U_MCP_ACTION' => "$url&amp;i=main&amp;quickmod=1&amp;mode=post_details", // Use this for mode paramaters
'U_POST_ACTION' => "$url&amp;i=$id&amp;mode=post_details", // Use this for action parameters
@@ -263,8 +264,9 @@ function mcp_post_details($id, $mode, $action)
'POST_SUBJECT' => $post_info['post_subject'],
'POST_DATE' => $user->format_date($post_info['post_time']),
'POST_IP' => $post_info['poster_ip'],
- 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
+ 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && $request->variable('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
'POST_ID' => $post_info['post_id'],
+ 'SIGNATURE' => $post_info['user_sig'],
'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? "$url&amp;i=$id&amp;mode=$mode&amp;lookup={$post_info['poster_ip']}#ip" : '',
'U_WHOIS' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;mode=$mode&amp;action=whois&amp;p=$post_id&amp;ip={$post_info['poster_ip']}") : '',
@@ -412,7 +414,7 @@ function mcp_post_details($id, $mode, $action)
);
}
- if (sizeof($users_ary))
+ if (count($users_ary))
{
// Get the usernames
$sql = 'SELECT user_id, username
@@ -498,7 +500,7 @@ function mcp_post_details($id, $mode, $action)
$user_select = '';
- if (sizeof($usernames_ary))
+ if (count($usernames_ary))
{
ksort($usernames_ary);
@@ -556,7 +558,7 @@ function phpbb_get_num_ips_for_poster(\phpbb\db\driver\driver_interface $db, $po
*/
function change_poster(&$post_info, $userdata)
{
- global $auth, $db, $config, $phpbb_root_path, $phpEx, $user, $phpbb_dispatcher;
+ global $auth, $db, $config, $phpbb_root_path, $phpEx, $user, $phpbb_log, $phpbb_dispatcher;
if (empty($userdata) || $userdata['user_id'] == $post_info['user_id'])
{
@@ -659,7 +661,7 @@ function change_poster(&$post_info, $userdata)
// Renew post info
$post_info = phpbb_get_post_data(array($post_id), false, true);
- if (!sizeof($post_info))
+ if (!count($post_info))
{
trigger_error('POST_NOT_EXIST');
}
@@ -667,5 +669,12 @@ function change_poster(&$post_info, $userdata)
$post_info = $post_info[$post_id];
// Now add log entry
- add_log('mod', $post_info['forum_id'], $post_info['topic_id'], 'LOG_MCP_CHANGE_POSTER', $post_info['topic_title'], $from_username, $to_username);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MCP_CHANGE_POSTER', false, array(
+ 'forum_id' => $post_info['forum_id'],
+ 'topic_id' => $post_info['topic_id'],
+ 'post_id' => $post_info['post_id'],
+ $post_info['topic_title'],
+ $from_username,
+ $to_username
+ ));
}
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index 3567e545f0..dec583f6f4 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -28,21 +28,21 @@ class mcp_queue
var $p_master;
var $u_action;
- public function mcp_queue(&$p_master)
+ public function __construct($p_master)
{
- $this->p_master = &$p_master;
+ $this->p_master = $p_master;
}
public function main($id, $mode)
{
- global $auth, $db, $user, $template, $cache, $request;
+ global $auth, $db, $user, $template, $request;
global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container;
global $phpbb_dispatcher;
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
- $forum_id = request_var('f', 0);
- $start = request_var('start', 0);
+ $forum_id = $request->variable('f', 0);
+ $start = $request->variable('start', 0);
$this->page_title = 'MCP_QUEUE';
@@ -104,7 +104,7 @@ class mcp_queue
if (!empty($topic_id_list) && $mode == 'deleted_topics')
{
- if (!function_exists('mcp_delete_topics'))
+ if (!function_exists('mcp_delete_topic'))
{
global $phpbb_root_path, $phpEx;
include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx);
@@ -154,9 +154,10 @@ class mcp_queue
$user->add_lang(array('posting', 'viewtopic'));
- $post_id = request_var('p', 0);
- $topic_id = request_var('t', 0);
+ $post_id = $request->variable('p', 0);
+ $topic_id = $request->variable('t', 0);
+ /* @var $phpbb_notifications \phpbb\notification\manager */
$phpbb_notifications = $phpbb_container->get('notification_manager');
if ($topic_id)
@@ -166,7 +167,7 @@ class mcp_queue
{
$post_id = (int) $topic_info[$topic_id]['topic_first_post_id'];
- $phpbb_notifications->mark_notifications_read('notification.type.topic_in_queue', $topic_id, $user->data['user_id']);
+ $phpbb_notifications->mark_notifications('topic_in_queue', $topic_id, $user->data['user_id']);
}
else
{
@@ -174,11 +175,11 @@ class mcp_queue
}
}
- $phpbb_notifications->mark_notifications_read('notification.type.post_in_queue', $post_id, $user->data['user_id']);
+ $phpbb_notifications->mark_notifications('post_in_queue', $post_id, $user->data['user_id']);
$post_info = phpbb_get_post_data(array($post_id), 'm_approve', true);
- if (!sizeof($post_info))
+ if (!count($post_info))
{
trigger_error('NO_POST_SELECTED');
}
@@ -194,7 +195,7 @@ class mcp_queue
));
}
- $extensions = $attachments = $topic_tracking_info = array();
+ $attachments = $topic_tracking_info = array();
// Get topic tracking info
if ($config['load_db_lastread'])
@@ -216,8 +217,6 @@ class mcp_queue
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{
- $extensions = $cache->obtain_attach_extensions($post_info['forum_id']);
-
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
WHERE post_msg_id = ' . $post_id . '
@@ -231,7 +230,7 @@ class mcp_queue
}
$db->sql_freeresult($result);
- if (sizeof($attachments))
+ if (count($attachments))
{
$update_count = array();
parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
@@ -281,7 +280,7 @@ class mcp_queue
$post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;p=' . $post_info['post_id'] . '#p' . $post_info['post_id']);
$topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']);
- $template->assign_vars(array(
+ $post_data = array(
'S_MCP_QUEUE' => true,
'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&amp;p=$post_id&amp;f=$forum_id"),
'S_CAN_DELETE_POST' => $auth->acl_get('m_delete', $post_info['forum_id']),
@@ -320,12 +319,40 @@ class mcp_queue
'POST_SUBJECT' => $post_info['post_subject'],
'POST_DATE' => $user->format_date($post_info['post_time']),
'POST_IP' => $post_info['poster_ip'],
- 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
+ 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && $request->variable('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
'POST_ID' => $post_info['post_id'],
'S_FIRST_POST' => ($post_info['topic_first_post_id'] == $post_id),
'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id . '&amp;lookup=' . $post_info['poster_ip']) . '#ip' : '',
- ));
+ );
+
+ /**
+ * Alter post awaiting approval template before it is rendered
+ *
+ * @event core.mcp_queue_approve_details_template
+ * @var int post_id Post ID
+ * @var int topic_id Topic ID
+ * @var array topic_info Topic data
+ * @var array post_info Post data
+ * @var array post_data Post template data
+ * @var string message Post message
+ * @var string post_url Post URL
+ * @var string topic_url Topic URL
+ * @since 3.2.2-RC1
+ */
+ $vars = array(
+ 'post_id',
+ 'topic_id',
+ 'topic_info',
+ 'post_info',
+ 'post_data',
+ 'message',
+ 'post_url',
+ 'topic_url',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_queue_approve_details_template', compact($vars)));
+
+ $template->assign_vars($post_data);
break;
@@ -342,13 +369,15 @@ class mcp_queue
$topic_id = $request->variable('t', 0);
$forum_info = array();
+
+ /* @var $pagination \phpbb\pagination */
$pagination = $phpbb_container->get('pagination');
if ($topic_id)
{
$topic_info = phpbb_get_topic_data(array($topic_id));
- if (!sizeof($topic_info))
+ if (!count($topic_info))
{
trigger_error('TOPIC_NOT_EXIST');
}
@@ -378,7 +407,7 @@ class mcp_queue
$forum_list[] = $row['forum_id'];
}
- if (!sizeof($forum_list))
+ if (!count($forum_list))
{
trigger_error('NOT_MODERATOR');
}
@@ -394,12 +423,11 @@ class mcp_queue
{
$forum_info = phpbb_get_forum_data(array($forum_id), $m_perm);
- if (!sizeof($forum_info))
+ if (!count($forum_info))
{
trigger_error('NOT_MODERATOR');
}
- $forum_info = $forum_info[$forum_id];
$forum_list = $forum_id;
}
@@ -414,7 +442,6 @@ class mcp_queue
$sort_by_sql = $sort_order_sql = array();
phpbb_mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
- $forum_topics = ($total == -1) ? $forum_info['forum_topics_approved'] : $total;
$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';
$forum_names = array();
@@ -466,7 +493,7 @@ class mcp_queue
}
$db->sql_freeresult($result);
- if (sizeof($post_ids))
+ if (count($post_ids))
{
$sql = 'SELECT t.topic_id, t.topic_title, t.forum_id, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, p.post_attachment, u.username, u.username_clean, u.user_colour
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u
@@ -474,6 +501,29 @@ class mcp_queue
AND t.topic_id = p.topic_id
AND u.user_id = p.poster_id
ORDER BY ' . $sort_order_sql;
+
+ /**
+ * Alter sql query to get information on all posts in queue
+ *
+ * @event core.mcp_queue_get_posts_for_posts_query_before
+ * @var string sql String with the query to be executed
+ * @var array forum_list List of forums that contain the posts
+ * @var int visibility_const Integer with one of the possible ITEM_* constant values
+ * @var int topic_id topic_id in the page request
+ * @var string limit_time_sql String with the SQL code to limit the time interval of the post (Note: May be empty string)
+ * @var string sort_order_sql String with the ORDER BY SQL code used in this query
+ * @since 3.2.3-RC2
+ */
+ $vars = array(
+ 'sql',
+ 'forum_list',
+ 'visibility_const',
+ 'topic_id',
+ 'limit_time_sql',
+ 'sort_order_sql',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_queue_get_posts_for_posts_query_before', compact($vars)));
+
$result = $db->sql_query($sql);
$post_data = $rowset = array();
@@ -538,7 +588,7 @@ class mcp_queue
$db->sql_freeresult($result);
}
- if (sizeof($forum_names))
+ if (count($forum_names))
{
// Select the names for the forum_ids
$sql = 'SELECT forum_id, forum_name
@@ -561,7 +611,7 @@ class mcp_queue
$row['post_username'] = $row['username'] ?: $user->lang['GUEST'];
}
- $template->assign_block_vars('postrow', array(
+ $post_row = array(
'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),
'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']) . (($mode == 'unapproved_posts') ? '#p' . $row['post_id'] : ''),
@@ -578,8 +628,26 @@ class mcp_queue
'POST_SUBJECT' => ($row['post_subject'] != '') ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
'TOPIC_TITLE' => $row['topic_title'],
'POST_TIME' => $user->format_date($row['post_time']),
- 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
- ));
+ 'S_HAS_ATTACHMENTS' => $auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment'],
+ );
+
+ /**
+ * Alter sql query to get information on all topics in the list of forums provided.
+ *
+ * @event core.mcp_queue_get_posts_modify_post_row
+ * @var array post_row Template variables for current post
+ * @var array row Post data
+ * @var array forum_names Forum names
+ * @since 3.2.3-RC2
+ */
+ $vars = array(
+ 'post_row',
+ 'row',
+ 'forum_names',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_queue_get_posts_modify_post_row', compact($vars)));
+
+ $template->assign_block_vars('postrow', $post_row);
}
unset($rowset, $forum_names);
@@ -618,17 +686,18 @@ class mcp_queue
*/
static public function approve_posts($action, $post_id_list, $id, $mode)
{
- global $db, $template, $user, $config, $request, $phpbb_container, $phpbb_dispatcher;
- global $phpEx, $phpbb_root_path;
+ global $template, $user, $request, $phpbb_container, $phpbb_dispatcher;
+ global $phpEx, $phpbb_root_path, $phpbb_log;
if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
{
+ send_status_line(403, 'Forbidden');
trigger_error('NOT_AUTHORISED');
}
$redirect = $request->variable('redirect', build_url(array('quickmod')));
$redirect = reapply_sid($redirect);
- $success_msg = $post_url = '';
+ $post_url = '';
$approve_log = array();
$num_topics = 0;
@@ -677,10 +746,12 @@ class mcp_queue
$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'],
);
}
+ /* @var $phpbb_content_visibility \phpbb\content_visibility */
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
foreach ($topic_info as $topic_id => $topic_data)
{
@@ -689,12 +760,18 @@ class mcp_queue
foreach ($approve_log as $log_data)
{
- add_log('mod', $log_data['forum_id'], $log_data['topic_id'], 'LOG_POST_' . strtoupper($action) . 'D', $log_data['post_subject']);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_POST_' . strtoupper($action) . 'D', false, array(
+ 'forum_id' => $log_data['forum_id'],
+ 'topic_id' => $log_data['topic_id'],
+ 'post_id' => $log_data['post_id'],
+ $log_data['post_subject']
+ ));
}
// Only send out the mails, when the posts are being approved
if ($action == 'approve')
{
+ /* @var $phpbb_notifications \phpbb\notification\manager */
$phpbb_notifications = $phpbb_container->get('notification_manager');
// Handle notifications
@@ -731,7 +808,7 @@ class mcp_queue
$phpbb_notifications->add_notifications(array('notification.type.quote'), $post_data);
$phpbb_notifications->delete_notifications('notification.type.post_in_queue', $post_id);
- $phpbb_notifications->mark_notifications_read(array(
+ $phpbb_notifications->mark_notifications(array(
'notification.type.quote',
'notification.type.bookmark',
'notification.type.post',
@@ -763,7 +840,7 @@ class mcp_queue
}
else
{
- $success_msg = (sizeof($post_info) == 1) ? 'POST_' . strtoupper($action) . 'D_SUCCESS' : 'POSTS_' . strtoupper($action) . 'D_SUCCESS';
+ $success_msg = (count($post_info) == 1) ? 'POST_' . strtoupper($action) . 'D_SUCCESS' : 'POSTS_' . strtoupper($action) . 'D_SUCCESS';
}
/**
@@ -806,7 +883,7 @@ class mcp_queue
$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)
+ if (count($post_info) == 1 && $post_url)
{
$message .= '<br /><br />' . $user->lang('RETURN_POST', '<a href="' . $post_url . '">', '</a>');
}
@@ -839,14 +916,14 @@ class mcp_queue
// Create the confirm box message
$action_msg = strtoupper($action);
- $num_posts = sizeof($post_id_list) - $num_topics;
+ $num_posts = count($post_id_list) - $num_topics;
if ($num_topics > 0 && $num_posts <= 0)
{
$action_msg .= '_TOPIC' . (($num_topics == 1) ? '' : 'S');
}
else
{
- $action_msg .= '_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S');
+ $action_msg .= '_POST' . ((count($post_id_list) == 1) ? '' : 'S');
}
confirm_box(false, $action_msg, $s_hidden_fields, 'mcp_approve.html');
}
@@ -865,11 +942,12 @@ class mcp_queue
*/
static public function approve_topics($action, $topic_id_list, $id, $mode)
{
- global $db, $template, $user, $config;
+ global $db, $template, $user, $phpbb_log;
global $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_dispatcher;
if (!phpbb_check_ids($topic_id_list, TOPICS_TABLE, 'topic_id', array('m_approve')))
{
+ send_status_line(403, 'Forbidden');
trigger_error('NOT_AUTHORISED');
}
@@ -892,6 +970,7 @@ class mcp_queue
{
$notify_poster = ($action == 'approve' && isset($_REQUEST['notify_poster'])) ? true : false;
+ /* @var $phpbb_content_visibility \phpbb\content_visibility */
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
$first_post_ids = array();
@@ -909,14 +988,18 @@ class mcp_queue
);
}
- if (sizeof($topic_info) >= 1)
+ if (count($topic_info) >= 1)
{
- $success_msg = (sizeof($topic_info) == 1) ? 'TOPIC_' . strtoupper($action) . 'D_SUCCESS' : 'TOPICS_' . strtoupper($action) . 'D_SUCCESS';
+ $success_msg = (count($topic_info) == 1) ? 'TOPIC_' . strtoupper($action) . 'D_SUCCESS' : 'TOPICS_' . strtoupper($action) . 'D_SUCCESS';
}
foreach ($approve_log as $log_data)
{
- add_log('mod', $log_data['forum_id'], $log_data['topic_id'], 'LOG_TOPIC_' . strtoupper($action) . 'D', $log_data['topic_title']);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_TOPIC_' . strtoupper($action) . 'D', false, array(
+ 'forum_id' => $log_data['forum_id'],
+ 'topic_id' => $log_data['topic_id'],
+ $log_data['topic_title']
+ ));
}
// Only send out the mails, when the posts are being approved
@@ -935,6 +1018,7 @@ class mcp_queue
$db->sql_freeresult($result);
// Handle notifications
+ /* @var $phpbb_notifications \phpbb\notification\manager */
$phpbb_notifications = $phpbb_container->get('notification_manager');
foreach ($topic_info as $topic_id => $topic_data)
@@ -961,8 +1045,8 @@ class mcp_queue
), $topic_data);
}
- $phpbb_notifications->mark_notifications_read('notification.type.quote', $topic_data['post_id'], $user->data['user_id']);
- $phpbb_notifications->mark_notifications_read('notification.type.topic', $topic_id, $user->data['user_id']);
+ $phpbb_notifications->mark_notifications('quote', $topic_data['post_id'], $user->data['user_id']);
+ $phpbb_notifications->mark_notifications('topic', $topic_id, $user->data['user_id']);
if ($notify_poster)
{
@@ -1009,7 +1093,7 @@ class mcp_queue
$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)
+ if (count($topic_info) == 1 && $topic_url)
{
$message .= '<br /><br />' . $user->lang('RETURN_TOPIC', '<a href="' . $topic_url . '">', '</a>');
}
@@ -1040,7 +1124,7 @@ class mcp_queue
'S_' . strtoupper($action) => true,
));
- confirm_box(false, strtoupper($action) . '_TOPIC' . ((sizeof($topic_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html');
+ confirm_box(false, strtoupper($action) . '_TOPIC' . ((count($topic_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html');
}
redirect($redirect);
@@ -1056,11 +1140,12 @@ class mcp_queue
*/
static public function disapprove_posts($post_id_list, $id, $mode)
{
- global $db, $template, $user, $config, $phpbb_container, $phpbb_dispatcher;
- global $phpEx, $phpbb_root_path, $request;
+ global $db, $template, $user, $phpbb_container, $phpbb_dispatcher;
+ global $phpEx, $phpbb_root_path, $request, $phpbb_log;
if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
{
+ send_status_line(403, 'Forbidden');
trigger_error('NOT_AUTHORISED');
}
@@ -1068,7 +1153,7 @@ class mcp_queue
$redirect = reapply_sid($redirect);
$reason = $request->variable('reason', '', true);
$reason_id = $request->variable('reason_id', 0);
- $success_msg = $additional_msg = '';
+ $additional_msg = '';
$s_hidden_fields = build_hidden_fields(array(
'i' => $id,
@@ -1126,7 +1211,7 @@ class mcp_queue
if (confirm_box(true))
{
- $disapprove_log = $disapprove_log_topics = $disapprove_log_posts = array();
+ $disapprove_log_topics = $disapprove_log_posts = array();
$topic_posts_unapproved = $post_disapprove_list = $topic_information = array();
// Build a list of posts to be disapproved and get the related topics real replies count
@@ -1190,8 +1275,8 @@ class mcp_queue
}
// Get disapproved posts/topics counts separately
- $num_disapproved_topics = sizeof($disapprove_log_topics);
- $num_disapproved_posts = sizeof($disapprove_log_posts);
+ $num_disapproved_topics = count($disapprove_log_topics);
+ $num_disapproved_posts = count($disapprove_log_posts);
// Build the whole log
$disapprove_log = array_merge($disapprove_log_topics, $disapprove_log_posts);
@@ -1200,7 +1285,7 @@ class mcp_queue
unset($post_data, $disapprove_log_topics, $disapprove_log_posts);
// Let's do the job - delete disapproved posts
- if (sizeof($post_disapprove_list))
+ if (count($post_disapprove_list))
{
if (!function_exists('delete_posts'))
{
@@ -1217,16 +1302,28 @@ class mcp_queue
if ($is_disapproving)
{
$l_log_message = ($log_data['type'] == 'topic') ? 'LOG_TOPIC_DISAPPROVED' : 'LOG_POST_DISAPPROVED';
- add_log('mod', $log_data['forum_id'], $log_data['topic_id'], $l_log_message, $log_data['post_subject'], $disapprove_reason, $log_data['post_username']);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, $l_log_message, false, array(
+ 'forum_id' => $log_data['forum_id'],
+ 'topic_id' => $log_data['topic_id'],
+ $log_data['post_subject'],
+ $disapprove_reason,
+ $log_data['post_username']
+ ));
}
else
{
$l_log_message = ($log_data['type'] == 'topic') ? 'LOG_DELETE_TOPIC' : 'LOG_DELETE_POST';
- add_log('mod', $log_data['forum_id'], $log_data['topic_id'], $l_log_message, $log_data['post_subject'], $log_data['post_username']);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, $l_log_message, false, array(
+ 'forum_id' => $log_data['forum_id'],
+ 'topic_id' => $log_data['topic_id'],
+ $log_data['post_subject'],
+ $log_data['post_username']
+ ));
}
}
}
+ /* @var $phpbb_notifications \phpbb\notification\manager */
$phpbb_notifications = $phpbb_container->get('notification_manager');
$lang_reasons = array();
@@ -1388,11 +1485,6 @@ class mcp_queue
}
else
{
- if (!function_exists('display_reasons'))
- {
- include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
- }
-
$show_notify = false;
foreach ($post_info as $post_data)
@@ -1412,7 +1504,7 @@ class mcp_queue
$confirm_template = 'mcp_approve.html';
if ($is_disapproving)
{
- display_reasons($reason_id);
+ $phpbb_container->get('phpbb.report.report_reason_list_provider')->display_reasons($reason_id);
}
else
{
@@ -1421,7 +1513,7 @@ class mcp_queue
$l_confirm_msg = 'DELETE_POST_PERMANENTLY';
$confirm_template = 'confirm_delete_body.html';
}
- $l_confirm_msg .= ((sizeof($post_id_list) == 1) ? '' : 'S');
+ $l_confirm_msg .= ((count($post_id_list) == 1) ? '' : 'S');
$template->assign_vars(array(
'S_NOTIFY_POSTER' => $show_notify,
diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index 6bb606a990..4600257344 100644
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -28,20 +28,20 @@ class mcp_reports
var $p_master;
var $u_action;
- function mcp_reports(&$p_master)
+ function __construct($p_master)
{
- $this->p_master = &$p_master;
+ $this->p_master = $p_master;
}
function main($id, $mode)
{
- global $auth, $db, $user, $template, $cache;
+ global $auth, $db, $user, $template, $request;
global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container, $phpbb_dispatcher;
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
- $forum_id = request_var('f', 0);
- $start = request_var('start', 0);
+ $forum_id = $request->variable('f', 0);
+ $start = $request->variable('start', 0);
$this->page_title = 'MCP_REPORTS';
@@ -51,9 +51,9 @@ class mcp_reports
case 'delete':
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
- $report_id_list = request_var('report_id_list', array(0));
+ $report_id_list = $request->variable('report_id_list', array(0));
- if (!sizeof($report_id_list))
+ if (!count($report_id_list))
{
trigger_error('NO_REPORT_SELECTED');
}
@@ -69,10 +69,11 @@ class mcp_reports
$user->add_lang(array('posting', 'viewforum', 'viewtopic'));
- $post_id = request_var('p', 0);
+ $post_id = $request->variable('p', 0);
// closed reports are accessed by report id
- $report_id = request_var('r', 0);
+ $report_id = $request->variable('r', 0);
+
$sql_ary = array(
'SELECT' => 'r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, r.reported_post_text, r.reported_post_uid, r.reported_post_bitfield, r.reported_post_enable_magic_url, r.reported_post_enable_smilies, r.reported_post_enable_bbcode, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour',
@@ -138,9 +139,10 @@ class mcp_reports
trigger_error('NO_REPORT');
}
+ /* @var $phpbb_notifications \phpbb\notification\manager */
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->mark_notifications_read('notification.type.report_post', $post_id, $user->data['user_id']);
+ $phpbb_notifications->mark_notifications('report_post', $post_id, $user->data['user_id']);
if (!$report_id && $report['report_closed'])
{
@@ -156,7 +158,7 @@ class mcp_reports
$post_info = phpbb_get_post_data(array($post_id), 'm_report', true);
- if (!sizeof($post_info))
+ if (!count($post_info))
{
trigger_error('NO_REPORT_SELECTED');
}
@@ -180,7 +182,7 @@ class mcp_reports
));
}
- $topic_tracking_info = $extensions = $attachments = array();
+ $attachments = array();
// Get topic tracking info
if ($config['load_db_lastread'])
{
@@ -220,7 +222,7 @@ class mcp_reports
}
$db->sql_freeresult($result);
- if (sizeof($attachments))
+ if (count($attachments))
{
$update_count = array();
parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
@@ -240,7 +242,14 @@ class mcp_reports
}
}
- $template->assign_vars(array(
+ // parse signature
+ $parse_flags = ($post_info['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
+ $post_info['user_sig'] = generate_text_for_display($post_info['user_sig'], $post_info['user_sig_bbcode_uid'], $post_info['user_sig_bbcode_bitfield'], $parse_flags, true);
+
+ $topic_id = (int) $post_info['topic_id'];
+
+ // So it can be sent through the event below.
+ $report_template = array(
'S_MCP_REPORT' => true,
'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id),
'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']),
@@ -287,11 +296,38 @@ class mcp_reports
'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'],
'POST_DATE' => $user->format_date($post_info['post_time']),
'POST_IP' => $post_info['poster_ip'],
- 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
+ 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && $request->variable('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
'POST_ID' => $post_info['post_id'],
+ 'SIGNATURE' => $post_info['user_sig'],
'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? $this->u_action . '&amp;r=' . $report_id . '&amp;p=' . $post_id . '&amp;f=' . $forum_id . '&amp;lookup=' . $post_info['poster_ip'] . '#ip' : '',
- ));
+ );
+
+ /**
+ * Event to add/modify MCP report details template data.
+ *
+ * @event core.mcp_report_template_data
+ * @var int forum_id The forum_id, the number in the f GET parameter
+ * @var int topic_id The topic_id of the report being viewed
+ * @var int post_id The post_id of the report being viewed (if 0, it is meaningless)
+ * @var int report_id The report_id of the report being viewed
+ * @var array report Array with the report data
+ * @var array report_template Array with the report template data
+ * @var array post_info Array with the reported post data
+ * @since 3.2.5-RC1
+ */
+ $vars = array(
+ 'forum_id',
+ 'topic_id',
+ 'post_id',
+ 'report_id',
+ 'report',
+ 'report_template',
+ 'post_info',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_report_template_data', compact($vars)));
+
+ $template->assign_vars($report_template);
$this->tpl_name = 'mcp_post';
@@ -299,7 +335,7 @@ class mcp_reports
case 'reports':
case 'reports_closed':
- $topic_id = request_var('t', 0);
+ $topic_id = $request->variable('t', 0);
$forum_info = array();
$forum_list_reports = get_forum_list('m_report', false, true);
@@ -319,7 +355,7 @@ class mcp_reports
{
$topic_info = phpbb_get_topic_data(array($topic_id));
- if (!sizeof($topic_info))
+ if (!count($topic_info))
{
trigger_error('TOPIC_NOT_EXIST');
}
@@ -344,13 +380,11 @@ class mcp_reports
$forum_list[] = $row['forum_id'];
}
- if (!sizeof($forum_list))
+ if (!count($forum_list))
{
trigger_error('NOT_MODERATOR');
}
- $global_id = $forum_list[0];
-
$sql = 'SELECT SUM(forum_topics_approved) as sum_forum_topics
FROM ' . FORUMS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_list);
@@ -362,18 +396,18 @@ class mcp_reports
{
$forum_info = phpbb_get_forum_data(array($forum_id), 'm_report');
- if (!sizeof($forum_info))
+ if (!count($forum_info))
{
trigger_error('NOT_MODERATOR');
}
- $forum_info = $forum_info[$forum_id];
$forum_list = array($forum_id);
}
+ /* @var $pagination \phpbb\pagination */
+ $pagination = $phpbb_container->get('pagination');
$forum_list[] = 0;
$forum_data = array();
- $pagination = $phpbb_container->get('pagination');
$forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
foreach ($forum_list_reports as $row)
@@ -388,7 +422,6 @@ class mcp_reports
$sort_by_sql = $sort_order_sql = array();
phpbb_mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
- $forum_topics = ($total == -1) ? $forum_info['forum_topics_approved'] : $total;
$limit_time_sql = ($sort_days) ? 'AND r.report_time >= ' . (time() - ($sort_days * 86400)) : '';
if ($mode == 'reports')
@@ -444,7 +477,7 @@ class mcp_reports
}
$db->sql_freeresult($result);
- if (sizeof($report_ids))
+ if (count($report_ids))
{
$sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, p.post_attachment, u.username, u.username_clean, u.user_colour, r.user_id as reporter_id, ru.username as reporter_name, ru.user_colour as reporter_colour, r.report_time, r.report_id
FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u, ' . USERS_TABLE . ' ru
@@ -457,7 +490,6 @@ class mcp_reports
ORDER BY ' . $sort_order_sql;
$result = $db->sql_query($sql);
- $report_data = $rowset = array();
while ($row = $db->sql_fetchrow($result))
{
$template->assign_block_vars('postrow', array(
@@ -519,7 +551,7 @@ class mcp_reports
*/
function close_report($report_id_list, $mode, $action, $pm = false)
{
- global $db, $template, $user, $config, $auth;
+ global $db, $user, $auth, $phpbb_log, $request;
global $phpEx, $phpbb_root_path, $phpbb_container;
$pm_where = ($pm) ? ' AND r.post_id = 0 ' : ' AND r.pm_id = 0 ';
@@ -544,6 +576,7 @@ function close_report($report_id_list, $mode, $action, $pm = false)
{
if (!$auth->acl_getf_global('m_report'))
{
+ send_status_line(403, 'Forbidden');
trigger_error('NOT_AUTHORISED');
}
}
@@ -551,25 +584,26 @@ function close_report($report_id_list, $mode, $action, $pm = false)
{
if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_report')))
{
+ send_status_line(403, 'Forbidden');
trigger_error('NOT_AUTHORISED');
}
}
if ($action == 'delete' && strpos($user->data['session_page'], 'mode=report_details') !== false)
{
- $redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&amp;mode=reports');
+ $redirect = $request->variable('redirect', build_url(array('mode', 'r', 'quickmod')) . '&amp;mode=reports');
}
else if ($action == 'delete' && strpos($user->data['session_page'], 'mode=pm_report_details') !== false)
{
- $redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&amp;mode=pm_reports');
+ $redirect = $request->variable('redirect', build_url(array('mode', 'r', 'quickmod')) . '&amp;mode=pm_reports');
}
- else if ($action == 'close' && !request_var('r', 0))
+ else if ($action == 'close' && !$request->variable('r', 0))
{
- $redirect = request_var('redirect', build_url(array('mode', 'p', 'quickmod')) . '&amp;mode=' . $module);
+ $redirect = $request->variable('redirect', build_url(array('mode', 'p', 'quickmod')) . '&amp;mode=' . $module);
}
else
{
- $redirect = request_var('redirect', build_url(array('quickmod')));
+ $redirect = $request->variable('redirect', build_url(array('quickmod')));
}
$success_msg = '';
$forum_ids = array();
@@ -617,12 +651,12 @@ function close_report($report_id_list, $mode, $action, $pm = false)
}
$db->sql_freeresult($result);
- if (sizeof($reports))
+ if (count($reports))
{
$close_report_posts = array_unique($close_report_posts);
$close_report_topics = array_unique($close_report_topics);
- if (!$pm && sizeof($close_report_posts))
+ if (!$pm && count($close_report_posts))
{
// Get a list of topics that still contain reported posts
$sql = 'SELECT DISTINCT topic_id
@@ -658,7 +692,7 @@ function close_report($report_id_list, $mode, $action, $pm = false)
}
$db->sql_query($sql);
- if (sizeof($close_report_posts))
+ if (count($close_report_posts))
{
if ($pm)
{
@@ -679,7 +713,7 @@ function close_report($report_id_list, $mode, $action, $pm = false)
WHERE ' . $db->sql_in_set('post_id', $close_report_posts);
$db->sql_query($sql);
- if (sizeof($close_report_topics))
+ if (count($close_report_topics))
{
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_reported = 0
@@ -694,24 +728,34 @@ function close_report($report_id_list, $mode, $action, $pm = false)
}
unset($close_report_posts, $close_report_topics);
+ /* @var $phpbb_notifications \phpbb\notification\manager */
$phpbb_notifications = $phpbb_container->get('notification_manager');
foreach ($reports as $report)
{
if ($pm)
{
- add_log('mod', 0, 0, 'LOG_PM_REPORT_' . strtoupper($action) . 'D', $post_info[$report['pm_id']]['message_subject']);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_PM_REPORT_' . strtoupper($action) . 'D', false, array(
+ 'forum_id' => 0,
+ 'topic_id' => 0,
+ $post_info[$report['pm_id']]['message_subject']
+ ));
$phpbb_notifications->delete_notifications('notification.type.report_pm', $report['pm_id']);
}
else
{
- add_log('mod', $post_info[$report['post_id']]['forum_id'], $post_info[$report['post_id']]['topic_id'], 'LOG_REPORT_' . strtoupper($action) . 'D', $post_info[$report['post_id']]['post_subject']);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_REPORT_' . strtoupper($action) . 'D', false, array(
+ 'forum_id' => $post_info[$report['post_id']]['forum_id'],
+ 'topic_id' => $post_info[$report['post_id']]['topic_id'],
+ 'post_id' => $report['post_id'],
+ $post_info[$report['post_id']]['post_subject']
+ ));
$phpbb_notifications->delete_notifications('notification.type.report_post', $report['post_id']);
}
}
// Notify reporters
- if (sizeof($notify_reporters))
+ if (count($notify_reporters))
{
foreach ($notify_reporters as $report_id => $reporter)
{
@@ -751,14 +795,14 @@ function close_report($report_id_list, $mode, $action, $pm = false)
unset($notify_reporters, $post_info, $reports);
- $success_msg = (sizeof($report_id_list) == 1) ? "{$pm_prefix}REPORT_" . strtoupper($action) . 'D_SUCCESS' : "{$pm_prefix}REPORTS_" . strtoupper($action) . 'D_SUCCESS';
+ $success_msg = (count($report_id_list) == 1) ? "{$pm_prefix}REPORT_" . strtoupper($action) . 'D_SUCCESS' : "{$pm_prefix}REPORTS_" . strtoupper($action) . 'D_SUCCESS';
}
else
{
- confirm_box(false, $user->lang[strtoupper($action) . "_{$pm_prefix}REPORT" . ((sizeof($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields);
+ confirm_box(false, $user->lang[strtoupper($action) . "_{$pm_prefix}REPORT" . ((count($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields);
}
- $redirect = request_var('redirect', "index.$phpEx");
+ $redirect = $request->variable('redirect', "index.$phpEx");
$redirect = reapply_sid($redirect);
if (!$success_msg)
@@ -774,12 +818,12 @@ function close_report($report_id_list, $mode, $action, $pm = false)
if (!$pm)
{
- if (sizeof($forum_ids) === 1)
+ if (count($forum_ids) === 1)
{
$return_forum = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
}
- if (sizeof($topic_ids) === 1)
+ if (count($topic_ids) === 1)
{
$return_topic = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . current($topic_ids) . '&amp;f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
}
diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php
index d5415302c8..83ad56f3e4 100644
--- a/phpBB/includes/mcp/mcp_topic.php
+++ b/phpBB/includes/mcp/mcp_topic.php
@@ -24,18 +24,19 @@ if (!defined('IN_PHPBB'))
*/
function mcp_topic_view($id, $mode, $action)
{
- global $phpEx, $phpbb_root_path, $config;
- global $template, $db, $user, $auth, $cache, $phpbb_container, $phpbb_dispatcher;
+ global $phpEx, $phpbb_root_path, $config, $request;
+ global $template, $db, $user, $auth, $phpbb_container, $phpbb_dispatcher;
$url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . phpbb_extra_url());
- $user->add_lang('viewtopic');
+ /* @var $pagination \phpbb\pagination */
$pagination = $phpbb_container->get('pagination');
+ $user->add_lang('viewtopic');
- $topic_id = request_var('t', 0);
+ $topic_id = $request->variable('t', 0);
$topic_info = phpbb_get_topic_data(array($topic_id), false, true);
- if (!sizeof($topic_info))
+ if (!count($topic_info))
{
trigger_error('TOPIC_NOT_EXIST');
}
@@ -43,16 +44,16 @@ function mcp_topic_view($id, $mode, $action)
$topic_info = $topic_info[$topic_id];
// Set up some vars
- $icon_id = request_var('icon', 0);
- $subject = utf8_normalize_nfc(request_var('subject', '', true));
- $start = request_var('start', 0);
- $sort_days_old = request_var('st_old', 0);
- $forum_id = request_var('f', 0);
- $to_topic_id = request_var('to_topic_id', 0);
- $to_forum_id = request_var('to_forum_id', 0);
+ $icon_id = $request->variable('icon', 0);
+ $subject = $request->variable('subject', '', true);
+ $start = $request->variable('start', 0);
+ $sort_days_old = $request->variable('st_old', 0);
+ $forum_id = $request->variable('f', 0);
+ $to_topic_id = $request->variable('to_topic_id', 0);
+ $to_forum_id = $request->variable('to_forum_id', 0);
$sort = isset($_POST['sort']) ? true : false;
- $submitted_id_list = request_var('post_ids', array(0));
- $checked_ids = $post_id_list = request_var('post_id_list', array(0));
+ $submitted_id_list = $request->variable('post_ids', array(0));
+ $checked_ids = $post_id_list = $request->variable('post_id_list', array(0));
// Resync Topic?
if ($action == 'resync')
@@ -92,11 +93,15 @@ function mcp_topic_view($id, $mode, $action)
// Restore or pprove posts?
if (($action == 'restore' || $action == 'approve') && $auth->acl_get('m_approve', $topic_info['forum_id']))
{
- include($phpbb_root_path . 'includes/mcp/mcp_queue.' . $phpEx);
+ if (!class_exists('mcp_queue'))
+ {
+ include($phpbb_root_path . 'includes/mcp/mcp_queue.' . $phpEx);
+ }
+
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
- if (!sizeof($post_id_list))
+ if (!count($post_id_list))
{
trigger_error('NO_POST_SELECTED');
}
@@ -116,15 +121,16 @@ function mcp_topic_view($id, $mode, $action)
$sort_by_sql = $sort_order_sql = array();
phpbb_mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $topic_info['forum_id'], $topic_id, $where_sql);
- $limit_time_sql = ($sort_days) ? 'AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
+ /* @var $phpbb_content_visibility \phpbb\content_visibility */
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
+ $limit_time_sql = ($sort_days) ? 'AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
if ($total == -1)
{
$total = $phpbb_content_visibility->get_count('topic_posts', $topic_info, $topic_info['forum_id']);
}
- $posts_per_page = max(0, request_var('posts_per_page', intval($config['posts_per_page'])));
+ $posts_per_page = max(0, $request->variable('posts_per_page', intval($config['posts_per_page'])));
if ($posts_per_page == 0)
{
$posts_per_page = $total;
@@ -136,14 +142,36 @@ function mcp_topic_view($id, $mode, $action)
}
$start = $pagination->validate_start($start, $posts_per_page, $total);
- $sql = 'SELECT u.username, u.username_clean, u.user_colour, p.*
- FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
- WHERE ' . (($action == 'reports') ? 'p.post_reported = 1 AND ' : '') . '
+ $sql_where = (($action == 'reports') ? 'p.post_reported = 1 AND ' : '') . '
p.topic_id = ' . $topic_id . '
AND ' . $phpbb_content_visibility->get_visibility_sql('post', $topic_info['forum_id'], 'p.') . '
AND p.poster_id = u.user_id ' .
- $limit_time_sql . '
- ORDER BY ' . $sort_order_sql;
+ $limit_time_sql;
+
+ $sql_ary = array(
+ 'SELECT' => 'u.username, u.username_clean, u.user_colour, p.*',
+ 'FROM' => array(
+ POSTS_TABLE => 'p',
+ USERS_TABLE => 'u'
+ ),
+ 'LEFT_JOIN' => array(),
+ 'WHERE' => $sql_where,
+ 'ORDER_BY' => $sort_order_sql,
+ );
+
+ /**
+ * Event to modify the SQL query before the MCP topic review posts is queried
+ *
+ * @event core.mcp_topic_modify_sql_ary
+ * @var array sql_ary The SQL array to get the data of the MCP topic review posts
+ * @since 3.2.8-RC1
+ */
+ $vars = array('sql_ary');
+ extract($phpbb_dispatcher->trigger_event('core.mcp_topic_modify_sql_ary', compact($vars)));
+
+ $sql = $db->sql_build_query('SELECT', $sql_ary);
+ unset($sql_ary);
+
$result = $db->sql_query_limit($sql, $posts_per_page, $start);
$rowset = $post_id_list = array();
@@ -154,8 +182,6 @@ function mcp_topic_view($id, $mode, $action)
}
$db->sql_freeresult($result);
- $topic_tracking_info = array();
-
// Get topic tracking info
if ($config['load_db_lastread'])
{
@@ -171,11 +197,9 @@ function mcp_topic_view($id, $mode, $action)
$has_unapproved_posts = $has_deleted_posts = false;
// Grab extensions
- $extensions = $attachments = array();
- if ($topic_info['topic_attachment'] && sizeof($post_id_list))
+ $attachments = array();
+ if ($topic_info['topic_attachment'] && count($post_id_list))
{
- $extensions = $cache->obtain_attach_extensions($topic_info['forum_id']);
-
// Get attachments...
if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_info['forum_id']))
{
@@ -269,8 +293,6 @@ function mcp_topic_view($id, $mode, $action)
'U_MCP_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=report_details&amp;f=' . $topic_info['forum_id'] . '&amp;p=' . $row['post_id']) : '',
);
- $current_row_number = $i;
-
/**
* Event to modify the template data block for topic reviews in the MCP
*
@@ -330,7 +352,7 @@ function mcp_topic_view($id, $mode, $action)
{
$to_topic_info = phpbb_get_topic_data(array($to_topic_id), 'm_merge');
- if (!sizeof($to_topic_info))
+ if (!count($to_topic_info))
{
$to_topic_id = 0;
}
@@ -406,14 +428,13 @@ function mcp_topic_view($id, $mode, $action)
*/
function split_topic($action, $topic_id, $to_forum_id, $subject)
{
- global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $config;
- global $phpbb_dispatcher;
+ global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $config, $phpbb_log, $request, $phpbb_dispatcher;
- $post_id_list = request_var('post_id_list', array(0));
- $forum_id = request_var('forum_id', 0);
- $start = request_var('start', 0);
+ $post_id_list = $request->variable('post_id_list', array(0));
+ $forum_id = $request->variable('forum_id', 0);
+ $start = $request->variable('start', 0);
- if (!sizeof($post_id_list))
+ if (!count($post_id_list))
{
$template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
return;
@@ -427,7 +448,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
$post_id = $post_id_list[0];
$post_info = phpbb_get_post_data(array($post_id));
- if (!sizeof($post_info))
+ if (!count($post_info))
{
$template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
return;
@@ -451,7 +472,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
$forum_info = phpbb_get_forum_data(array($to_forum_id), 'f_post');
- if (!sizeof($forum_info))
+ if (!count($forum_info))
{
$template->assign_var('MESSAGE', $user->lang['USER_CANNOT_POST']);
return;
@@ -465,7 +486,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
return;
}
- $redirect = request_var('redirect', build_url(array('quickmod')));
+ $redirect = $request->variable('redirect', build_url(array('quickmod')));
$s_hidden_fields = build_hidden_fields(array(
'i' => 'main',
@@ -478,9 +499,8 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
'redirect' => $redirect,
'subject' => $subject,
'to_forum_id' => $to_forum_id,
- 'icon' => request_var('icon', 0))
+ 'icon' => $request->variable('icon', 0))
);
- $success_msg = $return_link = '';
if (confirm_box(true))
{
@@ -536,12 +556,12 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
$db->sql_freeresult($result);
}
- if (!sizeof($post_id_list))
+ if (!count($post_id_list))
{
trigger_error('NO_POST_SELECTED');
}
- $icon_id = request_var('icon', 0);
+ $icon_id = $request->variable('icon', 0);
$sql_ary = array(
'forum_id' => $to_forum_id,
@@ -559,8 +579,16 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
$topic_info = phpbb_get_topic_data(array($topic_id));
$topic_info = $topic_info[$topic_id];
- add_log('mod', $to_forum_id, $to_topic_id, 'LOG_SPLIT_DESTINATION', $subject);
- add_log('mod', $forum_id, $topic_id, 'LOG_SPLIT_SOURCE', $topic_info['topic_title']);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SPLIT_DESTINATION', false, array(
+ 'forum_id' => $to_forum_id,
+ 'topic_id' => $to_topic_id,
+ $subject
+ ));
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SPLIT_SOURCE', false, array(
+ 'forum_id' => $forum_id,
+ 'topic_id' => $topic_id,
+ $topic_info['topic_title']
+ ));
// Change topic title of first post
$sql = 'UPDATE ' . POSTS_TABLE . "
@@ -626,7 +654,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
}
$db->sql_freeresult($result);
- if (sizeof($sql_ary))
+ if (count($sql_ary))
{
$db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary);
}
@@ -647,7 +675,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
}
$db->sql_freeresult($result);
- if (sizeof($sql_ary))
+ if (count($sql_ary))
{
$db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary);
}
@@ -655,11 +683,11 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
$success_msg = 'TOPIC_SPLIT_SUCCESS';
// Update forum statistics
- set_config_count('num_topics', 1, true);
+ $config->increment('num_topics', 1, false);
// Link back to both topics
$return_link = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
- $redirect = request_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&amp;t=$to_topic_id");
+ $redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&amp;t=$to_topic_id");
$redirect = reapply_sid($redirect);
meta_refresh(3, $redirect);
@@ -676,7 +704,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
*/
function merge_posts($topic_id, $to_topic_id)
{
- global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $phpbb_dispatcher;
+ global $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_log, $request, $phpbb_dispatcher;
if (!$to_topic_id)
{
@@ -688,7 +716,7 @@ function merge_posts($topic_id, $to_topic_id)
$topic_data = phpbb_get_topic_data($sync_topics, 'm_merge');
- if (!sizeof($topic_data) || empty($topic_data[$to_topic_id]))
+ if (!count($topic_data) || empty($topic_data[$to_topic_id]))
{
$template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
return;
@@ -702,10 +730,10 @@ function merge_posts($topic_id, $to_topic_id)
$topic_data = $topic_data[$to_topic_id];
- $post_id_list = request_var('post_id_list', array(0));
- $start = request_var('start', 0);
+ $post_id_list = $request->variable('post_id_list', array(0));
+ $start = $request->variable('start', 0);
- if (!sizeof($post_id_list))
+ if (!count($post_id_list))
{
$template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
return;
@@ -716,7 +744,7 @@ function merge_posts($topic_id, $to_topic_id)
return;
}
- $redirect = request_var('redirect', build_url(array('quickmod')));
+ $redirect = $request->variable('redirect', build_url(array('quickmod')));
$s_hidden_fields = build_hidden_fields(array(
'i' => 'main',
@@ -728,14 +756,19 @@ function merge_posts($topic_id, $to_topic_id)
'redirect' => $redirect,
't' => $topic_id)
);
- $success_msg = $return_link = '';
+ $return_link = '';
if (confirm_box(true))
{
$to_forum_id = $topic_data['forum_id'];
move_posts($post_id_list, $to_topic_id, false);
- add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $topic_data['topic_title']);
+
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MERGE', false, array(
+ 'forum_id' => $to_forum_id,
+ 'topic_id' => $to_topic_id,
+ $topic_data['topic_title']
+ ));
// Message and return links
$success_msg = 'POSTS_MERGED_SUCCESS';
@@ -774,7 +807,7 @@ function merge_posts($topic_id, $to_topic_id)
// Link to the new topic
$return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
- $redirect = request_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&amp;t=$to_topic_id");
+ $redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&amp;t=$to_topic_id");
$redirect = reapply_sid($redirect);
/**
diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php
index 33c898ffc2..df175133fc 100644
--- a/phpBB/includes/mcp/mcp_warn.php
+++ b/phpBB/includes/mcp/mcp_warn.php
@@ -28,17 +28,16 @@ class mcp_warn
var $p_master;
var $u_action;
- function mcp_warn(&$p_master)
+ function __construct($p_master)
{
- $this->p_master = &$p_master;
+ $this->p_master = $p_master;
}
function main($id, $mode)
{
- global $auth, $db, $user, $template;
- global $config, $phpbb_root_path, $phpEx;
+ global $request;
- $action = request_var('action', array('' => ''));
+ $action = $request->variable('action', array('' => ''));
if (is_array($action))
{
@@ -78,8 +77,8 @@ class mcp_warn
*/
function mcp_warn_front_view()
{
- global $phpEx, $phpbb_root_path, $config;
- global $template, $db, $user, $auth;
+ global $phpEx, $phpbb_root_path;
+ global $template, $db, $user;
$template->assign_vars(array(
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=mcp&amp;field=username&amp;select_single=true'),
@@ -132,15 +131,16 @@ class mcp_warn
function mcp_warn_list_view($action)
{
global $phpEx, $phpbb_root_path, $config, $phpbb_container;
- global $template, $db, $user, $auth;
+ global $template, $user, $auth, $request;
- $user->add_lang('memberlist');
+ /* @var $pagination \phpbb\pagination */
$pagination = $phpbb_container->get('pagination');
+ $user->add_lang('memberlist');
- $start = request_var('start', 0);
- $st = request_var('st', 0);
- $sk = request_var('sk', 'b');
- $sd = request_var('sd', 'd');
+ $start = $request->variable('start', 0);
+ $st = $request->variable('st', 0);
+ $sk = $request->variable('sk', 'b');
+ $sd = $request->variable('sd', 'd');
$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_WARNINGS']);
@@ -189,13 +189,13 @@ class mcp_warn
*/
function mcp_warn_post_view($action)
{
- global $phpEx, $phpbb_root_path, $config;
- global $template, $db, $user, $auth, $phpbb_dispatcher;
+ global $phpEx, $phpbb_root_path, $config, $request;
+ global $template, $db, $user, $phpbb_dispatcher;
- $post_id = request_var('p', 0);
- $forum_id = request_var('f', 0);
+ $post_id = $request->variable('p', 0);
+ $forum_id = $request->variable('f', 0);
$notify = (isset($_REQUEST['notify_user'])) ? true : false;
- $warning = utf8_normalize_nfc(request_var('warning', '', true));
+ $warning = $request->variable('warning', '', true);
$sql = 'SELECT u.*, p.*
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
@@ -369,13 +369,13 @@ class mcp_warn
*/
function mcp_warn_user_view($action)
{
- global $phpEx, $phpbb_root_path, $config, $module;
- global $template, $db, $user, $auth, $phpbb_dispatcher;
+ global $phpEx, $phpbb_root_path, $config, $request;
+ global $template, $db, $user, $phpbb_dispatcher;
- $user_id = request_var('u', 0);
- $username = request_var('username', '', true);
+ $user_id = $request->variable('u', 0);
+ $username = $request->variable('username', '', true);
$notify = (isset($_REQUEST['notify_user'])) ? true : false;
- $warning = utf8_normalize_nfc(request_var('warning', '', true));
+ $warning = $request->variable('warning', '', true);
$sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
@@ -522,8 +522,8 @@ class mcp_warn
*/
function add_warning($user_row, $warning, $send_pm = true, $post_id = 0)
{
- global $phpEx, $phpbb_root_path, $config;
- global $template, $db, $user, $auth;
+ global $phpEx, $phpbb_root_path, $config, $phpbb_log;
+ global $db, $user;
if ($send_pm)
{
@@ -572,8 +572,11 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0)
submit_pm('post', $warn_pm_subject, $pm_data, false);
}
- add_log('admin', 'LOG_USER_WARNING', $user_row['username']);
- $log_id = add_log('user', $user_row['user_id'], 'LOG_USER_WARNING_BODY', $warning);
+ $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING', false, array($user_row['username']));
+ $log_id = $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING_BODY', false, array(
+ 'reportee_id' => $user_row['user_id'],
+ $warning
+ ));
$sql_ary = array(
'user_id' => $user_row['user_id'],
@@ -598,5 +601,10 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0)
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
- add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_USER_WARNING', $user_row['username']);
+ $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING', false, array(
+ 'forum_id' => $row['forum_id'],
+ 'topic_id' => $row['topic_id'],
+ 'post_id' => $post_id,
+ $user_row['username']
+ ));
}