mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-01 20:19:13 +02:00
- create log entries on (dis)approving and handling reports
git-svn-id: file:///svn/phpbb/trunk@7493 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
7caa3b02db
commit
27a0e285a0
@ -426,7 +426,7 @@ function approve_post($post_id_list, $id, $mode)
|
||||
// If Post -> total_posts = total_posts+1, forum_posts = forum_posts+1, topic_replies = topic_replies+1
|
||||
|
||||
$total_topics = $total_posts = 0;
|
||||
$forum_topics_posts = $topic_approve_sql = $topic_replies_sql = $post_approve_sql = $topic_id_list = $forum_id_list = array();
|
||||
$forum_topics_posts = $topic_approve_sql = $topic_replies_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array();
|
||||
|
||||
$update_forum_information = false;
|
||||
|
||||
@ -455,8 +455,14 @@ function approve_post($post_id_list, $id, $mode)
|
||||
$total_topics++;
|
||||
$forum_topics_posts[$post_data['forum_id']]['forum_topics']++;
|
||||
}
|
||||
|
||||
$topic_approve_sql[] = $post_data['topic_id'];
|
||||
|
||||
$approve_log[] = array(
|
||||
'type' => 'topic',
|
||||
'post_subject' => $post_data['post_subject'],
|
||||
'forum_id' => $post_data['forum_id'],
|
||||
'topic_id' => $post_data['topic_id'],
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -465,6 +471,13 @@ function approve_post($post_id_list, $id, $mode)
|
||||
$topic_replies_sql[$post_data['topic_id']] = 0;
|
||||
}
|
||||
$topic_replies_sql[$post_data['topic_id']]++;
|
||||
|
||||
$approve_log[] = array(
|
||||
'type' => 'post',
|
||||
'post_subject' => $post_data['post_subject'],
|
||||
'forum_id' => $post_data['forum_id'],
|
||||
'topic_id' => $post_data['topic_id'],
|
||||
);
|
||||
}
|
||||
|
||||
if ($post_data['forum_id'])
|
||||
@ -514,6 +527,11 @@ function approve_post($post_id_list, $id, $mode)
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
foreach ($approve_log as $log_data)
|
||||
{
|
||||
add_log('mod', $log_data['forum_id'], $log_data['topic_id'], ($log_data['type'] == 'topic') ? 'LOG_TOPIC_APPROVED' : 'LOG_POST_APPROVED', $log_data['post_subject']);
|
||||
}
|
||||
|
||||
if (sizeof($topic_replies_sql))
|
||||
{
|
||||
foreach ($topic_replies_sql as $topic_id => $num_replies)
|
||||
@ -703,7 +721,7 @@ function disapprove_post($post_id_list, $id, $mode)
|
||||
// If Post -> topic_replies_real -= 1
|
||||
|
||||
$num_disapproved = 0;
|
||||
$forum_topics_real = $topic_id_list = $forum_id_list = $topic_replies_real_sql = $post_disapprove_sql = array();
|
||||
$forum_topics_real = $topic_id_list = $forum_id_list = $topic_replies_real_sql = $post_disapprove_sql = $disapprove_log = array();
|
||||
|
||||
foreach ($post_info as $post_id => $post_data)
|
||||
{
|
||||
@ -715,6 +733,9 @@ function disapprove_post($post_id_list, $id, $mode)
|
||||
}
|
||||
|
||||
// Topic or Post. ;)
|
||||
/**
|
||||
* @todo this probably is a different method than the one used by delete_posts, does this cause counter inconsistency?
|
||||
*/
|
||||
if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_last_post_id'] == $post_id)
|
||||
{
|
||||
if ($post_data['forum_id'])
|
||||
@ -726,6 +747,13 @@ function disapprove_post($post_id_list, $id, $mode)
|
||||
$forum_topics_real[$post_data['forum_id']]++;
|
||||
$num_disapproved++;
|
||||
}
|
||||
|
||||
$disapprove_log[] = array(
|
||||
'type' => 'topic',
|
||||
'post_subject' => $post_data['post_subject'],
|
||||
'forum_id' => $post_data['forum_id'],
|
||||
'topic_id' => 0, // useless to log a topic id, as it will be deleted
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -734,11 +762,20 @@ function disapprove_post($post_id_list, $id, $mode)
|
||||
$topic_replies_real_sql[$post_data['topic_id']] = 0;
|
||||
}
|
||||
$topic_replies_real_sql[$post_data['topic_id']]++;
|
||||
|
||||
$disapprove_log[] = array(
|
||||
'type' => 'post',
|
||||
'post_subject' => $post_data['post_subject'],
|
||||
'forum_id' => $post_data['forum_id'],
|
||||
'topic_id' => $post_data['topic_id'],
|
||||
);
|
||||
}
|
||||
|
||||
$post_disapprove_sql[] = $post_id;
|
||||
}
|
||||
|
||||
unset($post_data);
|
||||
|
||||
if (sizeof($forum_topics_real))
|
||||
{
|
||||
foreach ($forum_topics_real as $forum_id => $topics_real)
|
||||
@ -770,6 +807,11 @@ function disapprove_post($post_id_list, $id, $mode)
|
||||
|
||||
// We do not check for permissions here, because the moderator allowed approval/disapproval should be allowed to delete the disapproved posts
|
||||
delete_posts('post_id', $post_disapprove_sql);
|
||||
|
||||
foreach ($disapprove_log as $log_data)
|
||||
{
|
||||
add_log('mod', $log_data['forum_id'], $log_data['topic_id'], ($log_data['type'] == 'topic') ? 'LOG_TOPIC_DISAPPROVED' : 'LOG_POST_DISAPPROVED', $log_data['post_subject'], $disapprove_reason);
|
||||
}
|
||||
}
|
||||
unset($post_disapprove_sql, $topic_replies_real_sql);
|
||||
|
||||
|
@ -513,6 +513,11 @@ function close_report($report_id_list, $mode, $action)
|
||||
}
|
||||
unset($close_report_posts, $close_report_topics);
|
||||
|
||||
foreach ($reports as $report)
|
||||
{
|
||||
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']);
|
||||
}
|
||||
|
||||
$messenger = new messenger();
|
||||
|
||||
// Notify reporters
|
||||
|
@ -463,11 +463,17 @@ $lang = array_merge($lang, array(
|
||||
'LOG_LOCK_POST' => '<strong>Locked post</strong><br />» %s',
|
||||
'LOG_MERGE' => '<strong>Merged posts</strong> into topic<br />» %s',
|
||||
'LOG_MOVE' => '<strong>Moved topic</strong><br />» from %s',
|
||||
'LOG_POST_APPROVED' => '<strong>Approved post</strong><br />» %s',
|
||||
'LOG_POST_DISAPPROVED' => '<strong>Disapproved post “%1$s” with the following reason</strong><br />%2$s',
|
||||
'LOG_POST_EDITED' => '<strong>Edited post “%1$s” written by “%3$s”</strong><br />» Link to post: %2$s',
|
||||
'LOG_REPORT_CLOSED' => '<strong>Closed report</strong><br />» %s',
|
||||
'LOG_REPORT_DELETED' => '<strong>Deleted report</strong><br />» %s',
|
||||
'LOG_SPLIT_DESTINATION' => '<strong>Moved splitted posts</strong><br />» to %s',
|
||||
'LOG_SPLIT_SOURCE' => '<strong>Splitted posts</strong><br />» from %s',
|
||||
|
||||
'LOG_TOPIC_DELETED' => '<strong>Deleted topic</strong><br />» %s',
|
||||
'LOG_TOPIC_APPROVED' => '<strong>Approved topic</strong><br />» %s',
|
||||
'LOG_TOPIC_DISAPPROVED' => '<strong>Disapproved topic “%1$s” with the following reason</strong><br />%2$s',
|
||||
'LOG_TOPIC_RESYNC' => '<strong>Resynchronised topic counters</strong><br />» %s',
|
||||
'LOG_TOPIC_TYPE_CHANGED' => '<strong>Changed topic type</strong><br />» %s',
|
||||
'LOG_UNLOCK' => '<strong>Unlocked topic</strong><br />» %s',
|
||||
|
Loading…
x
Reference in New Issue
Block a user