2011-03-28 14:21:28 +00:00
< ?
authorize ();
2013-04-15 08:00:54 +00:00
if ( ! check_perms ( 'admin_reports' ) && ! check_perms ( 'project_team' ) && ! check_perms ( 'site_moderate_forums' )) {
2011-03-28 14:21:28 +00:00
error ( 403 );
}
2013-04-15 08:00:54 +00:00
if ( empty ( $_POST [ 'reportid' ]) && ! is_number ( $_POST [ 'reportid' ])) {
2011-03-28 14:21:28 +00:00
error ( 403 );
}
$ReportID = $_POST [ 'reportid' ];
$DB -> query ( " SELECT Type FROM reports WHERE ID = " . $ReportID );
list ( $Type ) = $DB -> next_record ();
2013-04-15 08:00:54 +00:00
if ( ! check_perms ( 'admin_reports' )) {
if ( check_perms ( 'site_moderate_forums' )) {
if ( ! in_array ( $Type , array ( 'collages_comment' , 'post' , 'requests_comment' , 'thread' , 'torrents_comment' ))) {
2011-06-30 08:00:06 +00:00
error ( $Type );
}
2013-04-15 08:00:54 +00:00
} elseif ( check_perms ( 'project_team' )) {
if ( $Type != 'request_update' ) {
2011-06-30 08:00:06 +00:00
error ( 403 );
}
2011-03-28 14:21:28 +00:00
}
}
2013-02-22 08:00:24 +00:00
$DB -> query ( " UPDATE reports
2011-03-28 14:21:28 +00:00
SET Status = 'Resolved' ,
ResolvedTime = '".sqltime()."' ,
ResolverID = '".$LoggedUser[' ID ']."'
WHERE ID = '".db_string($ReportID)."' " );
2011-06-30 08:00:06 +00:00
$Channels = array ();
2013-04-15 08:00:54 +00:00
if ( $Type == 'request_update' ) {
$Channels [] = '#requestedits' ;
2011-03-28 14:21:28 +00:00
$Cache -> decrement ( 'num_update_reports' );
}
2013-04-15 08:00:54 +00:00
if ( in_array ( $Type , array ( 'collages_comment' , 'post' , 'requests_comment' , 'thread' , 'torrents_comment' ))) {
$Channels [] = '#forumreports' ;
2011-06-30 08:00:06 +00:00
$Cache -> decrement ( 'num_forum_reports' );
}
2011-03-28 14:21:28 +00:00
$DB -> query ( " SELECT COUNT(ID) FROM reports WHERE Status = 'New' " );
list ( $Remaining ) = $DB -> next_record ();
2013-04-15 08:00:54 +00:00
foreach ( $Channels as $Channel ) {
2011-03-28 14:21:28 +00:00
send_irc ( " PRIVMSG " . $Channel . " :Report " . $ReportID . " resolved by " . preg_replace ( " /^(. { 2})/ " , " $ 1· " , $LoggedUser [ 'Username' ]) . " on site ( " . ( int ) $Remaining . " remaining). " );
}
$Cache -> delete_value ( 'num_other_reports' );
header ( 'Location: reports.php' );
?>