1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/13468] Update calls to add_log()

PHPBB3-13468
This commit is contained in:
Gaëtan Muller
2015-01-05 22:21:31 +01:00
parent e2786c37dc
commit 7fc586080b
58 changed files with 568 additions and 329 deletions

View File

@@ -339,7 +339,7 @@ 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 $auth, $db, $template, $phpEx, $user, $phpbb_root_path, $phpbb_log;
if (!sizeof($topic_ids))
{
@@ -364,7 +364,11 @@ 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);
@@ -383,7 +387,7 @@ 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;
global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $phpbb_log;
if (!sizeof($topic_ids))
{
@@ -463,7 +467,12 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
$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';

View File

@@ -237,7 +237,7 @@ class mcp_main
*/
function lock_unlock($action, $ids)
{
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request;
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_log;
if ($action == 'lock' || $action == 'unlock')
{
@@ -294,7 +294,11 @@ 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'],
$row['topic_title']
));
}
$success_msg = $l_prefix . ((sizeof($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS';
@@ -321,7 +325,7 @@ function lock_unlock($action, $ids)
*/
function change_topic_type($action, $topic_ids)
{
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request;
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_log;
switch ($action)
{
@@ -396,7 +400,11 @@ function change_topic_type($action, $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']
));
}
}
@@ -679,7 +687,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 $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log;
if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_approve')))
{
@@ -710,7 +718,12 @@ function mcp_restore_topic($topic_ids)
$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']
));
}
}
}
@@ -753,7 +766,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)))
@@ -782,7 +795,11 @@ 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
{
@@ -794,12 +811,24 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = ''
$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
));
}
}
}
@@ -893,7 +922,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)))
@@ -965,7 +994,13 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
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'],
$row['post_subject'],
$post_username,
$soft_delete_reason
));
}
$topic_id = $request->variable('t', 0);
@@ -1008,7 +1043,13 @@ 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'],
$row['post_subject'],
$post_username,
$soft_delete_reason
));
}
// Now delete the posts, topics and forums are automatically resync'ed
@@ -1122,7 +1163,7 @@ 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;
global $phpEx, $phpbb_root_path, $phpbb_log;
if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_')))
{
@@ -1479,7 +1520,11 @@ function mcp_fork_topic($topic_ids)
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';

View File

@@ -74,7 +74,7 @@ class mcp_notes
*/
function mcp_notes_user_view($action)
{
global $phpEx, $phpbb_root_path, $config;
global $phpEx, $phpbb_root_path, $config, $phpbb_log;
global $template, $db, $user, $auth, $phpbb_container;
$user_id = request_var('u', 0);
@@ -144,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';
}
@@ -162,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

View File

@@ -420,7 +420,7 @@ function mcp_post_details($id, $mode, $action)
*/
function change_poster(&$post_info, $userdata)
{
global $auth, $db, $config, $phpbb_root_path, $phpEx, $user;
global $auth, $db, $config, $phpbb_root_path, $phpEx, $user, $phpbb_log;
if (empty($userdata) || $userdata['user_id'] == $post_info['user_id'])
{
@@ -519,5 +519,11 @@ 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_info['topic_title'],
$from_username,
$to_username
));
}

View File

@@ -620,7 +620,7 @@ class mcp_queue
static public function approve_posts($action, $post_id_list, $id, $mode)
{
global $db, $template, $user, $config, $request, $phpbb_container;
global $phpEx, $phpbb_root_path;
global $phpEx, $phpbb_root_path, $phpbb_log;
if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
{
@@ -691,7 +691,11 @@ 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'],
$log_data['post_subject']
));
}
// Only send out the mails, when the posts are being approved
@@ -844,7 +848,7 @@ class mcp_queue
*/
static public function approve_topics($action, $topic_id_list, $id, $mode)
{
global $db, $template, $user, $config;
global $db, $template, $user, $config, $phpbb_log;
global $phpEx, $phpbb_root_path, $request, $phpbb_container;
if (!phpbb_check_ids($topic_id_list, TOPICS_TABLE, 'topic_id', array('m_approve')))
@@ -896,7 +900,11 @@ class mcp_queue
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
@@ -1016,7 +1024,7 @@ class mcp_queue
static public function disapprove_posts($post_id_list, $id, $mode)
{
global $db, $template, $user, $config, $phpbb_container;
global $phpEx, $phpbb_root_path, $request;
global $phpEx, $phpbb_root_path, $request, $phpbb_log;
if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
{
@@ -1165,12 +1173,23 @@ 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']
));
}
}
}

View File

@@ -473,7 +473,7 @@ class mcp_reports
*/
function close_report($report_id_list, $mode, $action, $pm = false)
{
global $db, $template, $user, $config, $auth;
global $db, $template, $user, $config, $auth, $phpbb_log;
global $phpEx, $phpbb_root_path, $phpbb_container;
$pm_where = ($pm) ? ' AND r.post_id = 0 ' : ' AND r.pm_id = 0 ';
@@ -654,12 +654,20 @@ function close_report($report_id_list, $mode, $action, $pm = false)
{
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_info[$report['post_id']]['post_subject']
));
$phpbb_notifications->delete_notifications('notification.type.report_post', $report['post_id']);
}
}

View File

@@ -358,7 +358,7 @@ 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 $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $config, $phpbb_log;
$post_id_list = request_var('post_id_list', array(0));
$forum_id = request_var('forum_id', 0);
@@ -510,8 +510,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 . "
@@ -586,7 +594,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;
global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $phpbb_log;
if (!$to_topic_id)
{
@@ -645,7 +653,12 @@ function merge_posts($topic_id, $to_topic_id)
$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';

View File

@@ -523,7 +523,7 @@ class mcp_warn
*/
function add_warning($user_row, $warning, $send_pm = true, $post_id = 0)
{
global $phpEx, $phpbb_root_path, $config;
global $phpEx, $phpbb_root_path, $config, $phpbb_log;
global $template, $db, $user, $auth;
if ($send_pm)
@@ -557,8 +557,11 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0)
submit_pm('post', $user->lang('WARNING_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'],
@@ -583,5 +586,9 @@ 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'],
$user_row['username']
));
}