2011-03-28 14:21:28 +00:00
< ?
/************************************************************************
************************************************************************/
2012-12-10 08:00:21 +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 ( 404 );
}
// Number of reports per page
define ( 'REPORTS_PER_PAGE' , '10' );
2012-12-10 08:00:21 +00:00
include ( SERVER_ROOT . '/classes/class_text.php' );
2011-03-28 14:21:28 +00:00
$Text = NEW TEXT ;
2012-12-10 08:00:21 +00:00
list ( $Page , $Limit ) = Format :: page_limit ( REPORTS_PER_PAGE );
2011-03-28 14:21:28 +00:00
2012-12-10 08:00:21 +00:00
include ( SERVER_ROOT . '/sections/reports/array.php' );
2011-03-28 14:21:28 +00:00
// Header
2012-12-10 08:00:21 +00:00
View :: show_header ( 'Reports' , 'bbcode,reports' );
2011-03-28 14:21:28 +00:00
2012-12-10 08:00:21 +00:00
if ( $_GET [ 'id' ] && is_number ( $_GET [ 'id' ])) {
2011-03-28 14:21:28 +00:00
$View = " Single report " ;
2012-12-10 08:00:21 +00:00
$Where = " r.ID = " . $_GET [ 'id' ];
} else if ( empty ( $_GET [ 'view' ])) {
2011-03-28 14:21:28 +00:00
$View = " New " ;
$Where = " Status='New' " ;
} else {
$View = $_GET [ 'view' ];
2012-12-10 08:00:21 +00:00
switch ( $_GET [ 'view' ]) {
2011-03-28 14:21:28 +00:00
case 'old' :
$Where = " Status='Resolved' " ;
break ;
2012-12-10 08:00:21 +00:00
default :
2011-03-28 14:21:28 +00:00
error ( 404 );
break ;
}
}
2012-12-10 08:00:21 +00:00
if ( ! check_perms ( 'admin_reports' )) {
if ( check_perms ( 'project_team' )) {
2011-06-30 08:00:06 +00:00
$Where .= " AND Type = 'request_update' " ;
}
2012-12-10 08:00:21 +00:00
if ( check_perms ( 'site_moderate_forums' )) {
2012-10-27 08:00:09 +00:00
$Where .= " AND Type IN('collages_comment', 'Post', 'requests_comment', 'thread', 'torrents_comment', 'torrent_comments') " ;
2011-06-30 08:00:06 +00:00
}
2011-03-28 14:21:28 +00:00
}
2013-02-22 08:00:24 +00:00
$Reports = $DB -> query ( " SELECT SQL_CALC_FOUND_ROWS
r . ID ,
2011-03-28 14:21:28 +00:00
r . UserID ,
2013-02-22 08:00:24 +00:00
um . Username ,
r . ThingID ,
r . Type ,
r . ReportedTime ,
r . Reason ,
2012-12-10 08:00:21 +00:00
r . Status ,
r . ClaimerID ,
2013-01-29 08:00:36 +00:00
r . Notes ,
r . ResolverID
2013-02-22 08:00:24 +00:00
FROM reports AS r
2012-09-04 08:00:23 +00:00
JOIN users_main AS um ON r . UserID = um . ID
2012-12-10 08:00:21 +00:00
WHERE " . $Where . "
2013-02-22 08:00:24 +00:00
ORDER BY ReportedTime
2012-12-10 08:00:21 +00:00
DESC LIMIT " . $Limit );
2011-03-28 14:21:28 +00:00
// Number of results (for pagination)
$DB -> query ( 'SELECT FOUND_ROWS()' );
list ( $Results ) = $DB -> next_record ();
// Done with the number of results. Move $DB back to the result set for the reports
$DB -> set_query_id ( $Reports );
// Start printing stuff
?>
< div class = " thin " >
2013-01-16 08:00:31 +00:00
< div class = " header " >
< h2 > Active Reports </ h2 >
2012-12-10 08:00:21 +00:00
2013-01-16 08:00:31 +00:00
< div class = " linkbox " >
< a href = " reports.php " > New </ a > |
< a href = " reports.php?view=old " > Old </ a > |
< a href = " reports.php?action=stats " > Stats </ a >
</ div >
</ div >
< div class = " linkbox " >
2012-12-10 08:00:21 +00:00
< ?
2012-08-19 08:00:19 +00:00
// pagination
2012-12-10 08:00:21 +00:00
$Pages = Format :: get_pages ( $Page , $Results , REPORTS_PER_PAGE , 11 );
echo $Pages ;
?>
2013-01-16 08:00:31 +00:00
</ div >
2012-12-10 08:00:21 +00:00
< ?
2013-01-29 08:00:36 +00:00
while ( list ( $ReportID , $SnitchID , $SnitchName , $ThingID , $Short , $ReportedTime , $Reason , $Status , $ClaimerID , $Notes , $ResolverID ) = $DB -> next_record ()) {
2012-12-10 08:00:21 +00:00
$Type = $Types [ $Short ];
$Reference = " reports.php?id= " . $ReportID . " #report " . $ReportID ;
?>
2013-01-19 08:00:51 +00:00
< div id = " report_<?= $ReportID ?> " >
2013-01-16 08:00:31 +00:00
< table cellpadding = " 5 " id = " report_<?= $ReportID ?> " >
< tr >
< td >< strong >< a href = " <?= $Reference ?> " > Report #<?=$ReportID?></a></strong></td>
< td >
< strong >< ? = $Type [ 'title' ] ?> </strong> was reported by <a href="user.php?id=<?=$SnitchID?>"><?=$SnitchName?></a> <?=time_diff($ReportedTime)?>
2013-02-09 08:01:01 +00:00
< a href = " reports.php?action=compose&to=<?= $SnitchID ?>&reportid=<?= $ReportID ?>&type=<?= $Short ?>&thingid=<?= $ThingID ?> " class = " brackets " > Contact </ a >
2013-01-16 08:00:31 +00:00
</ td >
</ tr >
< tr >
< td class = " center " colspan = " 2 " >
< strong >
2012-12-10 08:00:21 +00:00
< ?
switch ( $Short ) {
case " user " :
$DB -> query ( " SELECT Username FROM users_main WHERE ID= " . $ThingID );
if ( $DB -> record_count () < 1 ) {
echo " No user with the reported ID found " ;
} else {
list ( $Username ) = $DB -> next_record ();
echo " <a href='user.php?id= " . $ThingID . " '> " . display_str ( $Username ) . " </a> " ;
}
break ;
case " request " :
case " request_update " :
$DB -> query ( " SELECT Title FROM requests WHERE ID= " . $ThingID );
if ( $DB -> record_count () < 1 ) {
echo " No request with the reported ID found " ;
} else {
list ( $Name ) = $DB -> next_record ();
echo " <a href='requests.php?action=view&id= " . $ThingID . " '> " . display_str ( $Name ) . " </a> " ;
}
break ;
case " collage " :
$DB -> query ( " SELECT Name FROM collages WHERE ID= " . $ThingID );
if ( $DB -> record_count () < 1 ) {
echo " No collage with the reported ID found " ;
} else {
list ( $Name ) = $DB -> next_record ();
echo " <a href='collages.php?id= " . $ThingID . " '> " . display_str ( $Name ) . " </a> " ;
}
break ;
case " thread " :
$DB -> query ( " SELECT Title FROM forums_topics WHERE ID= " . $ThingID );
if ( $DB -> record_count () < 1 ) {
echo " No forum thread with the reported ID found " ;
} else {
list ( $Title ) = $DB -> next_record ();
echo " <a href='forums.php?action=viewthread&threadid= " . $ThingID . " '> " . display_str ( $Title ) . " </a> " ;
}
break ;
case " post " :
if ( isset ( $LoggedUser [ 'PostsPerPage' ])) {
$PerPage = $LoggedUser [ 'PostsPerPage' ];
} else {
$PerPage = POSTS_PER_PAGE ;
}
$DB -> query ( " SELECT p.ID, p.Body, p.TopicID, (SELECT COUNT(ID) FROM forums_posts WHERE forums_posts.TopicID = p.TopicID AND forums_posts.ID<=p.ID) AS PostNum FROM forums_posts AS p WHERE ID= " . $ThingID );
if ( $DB -> record_count () < 1 ) {
echo " No forum post with the reported ID found " ;
} else {
list ( $PostID , $Body , $TopicID , $PostNum ) = $DB -> next_record ();
echo " <a href='forums.php?action=viewthread&threadid= " . $TopicID . " &post= " . $PostNum . " #post " . $PostID . " '>FORUM POST</a> " ;
}
break ;
case " requests_comment " :
$DB -> query ( " SELECT rc.RequestID, rc.Body, (SELECT COUNT(ID) FROM requests_comments WHERE ID <= " . $ThingID . " AND requests_comments.RequestID = rc.RequestID) AS CommentNum FROM requests_comments AS rc WHERE ID= " . $ThingID );
if ( $DB -> record_count () < 1 ) {
echo " No request comment with the reported ID found " ;
} else {
list ( $RequestID , $Body , $PostNum ) = $DB -> next_record ();
$PageNum = ceil ( $PostNum / TORRENT_COMMENTS_PER_PAGE );
echo " <a href='requests.php?action=view&id= " . $RequestID . " &page= " . $PageNum . " #post " . $ThingID . " '>REQUEST COMMENT</a> " ;
}
break ;
case " torrents_comment " :
$DB -> query ( " SELECT tc.GroupID, tc.Body, (SELECT COUNT(ID) FROM torrents_comments WHERE ID <= " . $ThingID . " AND torrents_comments.GroupID = tc.GroupID) AS CommentNum FROM torrents_comments AS tc WHERE ID= " . $ThingID );
if ( $DB -> record_count () < 1 ) {
echo " No torrent comment with the reported ID found " ;
} else {
list ( $GroupID , $Body , $PostNum ) = $DB -> next_record ();
$PageNum = ceil ( $PostNum / TORRENT_COMMENTS_PER_PAGE );
echo " <a href='torrents.php?id= " . $GroupID . " &page= " . $PageNum . " #post " . $ThingID . " '>TORRENT COMMENT</a> " ;
}
break ;
case " artist_comment " :
$DB -> query ( " SELECT ac.ArtistID, ac.Body, (SELECT COUNT(ID) FROM artist_comments WHERE ID <= " . $ThingID . " AND artist_comments.ArtistID = ac.ArtistID) AS CommentNum FROM artist_comments AS ac WHERE ID= " . $ThingID );
if ( $DB -> record_count () < 1 ) {
echo " No comment with the reported ID found " ;
} else {
list ( $ArtistID , $Body , $PostNum ) = $DB -> next_record ();
$PageNum = ceil ( $PostNum / TORRENT_COMMENTS_PER_PAGE );
2013-01-16 08:00:31 +00:00
echo " <a href='artist.php?id= " . $ArtistID . " &page= " . $PageNum . " #post " . $ThingID . " '>ARTIST COMMENT</a> " ;
2012-12-10 08:00:21 +00:00
}
break ;
case " collages_comment " :
$DB -> query ( " SELECT cc.CollageID, cc.Body, (SELECT COUNT(ID) FROM collages_comments WHERE ID <= " . $ThingID . " AND collages_comments.CollageID = cc.CollageID) AS CommentNum FROM collages_comments AS cc WHERE ID= " . $ThingID );
if ( $DB -> record_count () < 1 ) {
echo " No collage comment with the reported ID found " ;
} else {
list ( $CollageID , $Body , $PostNum ) = $DB -> next_record ();
$PerPage = POSTS_PER_PAGE ;
$PageNum = ceil ( $PostNum / $PerPage );
echo " <a href='collage.php?action=comments&collageid= " . $CollageID . " &page= " . $PageNum . " #post " . $ThingID . " '>COLLAGE COMMENT</a> " ;
}
break ;
}
?>
2013-01-15 08:00:37 +00:00
</ strong >
</ td >
</ tr >
< tr >
< td colspan = " 2 " >< ? = $Text -> full_format ( $Reason ) ?> </td>
</ tr >
< tr >
< td colspan = " 2 " >
2012-12-12 08:00:17 +00:00
< ? if ( $ClaimerID == $LoggedUser [ 'ID' ]) { ?>
2013-02-09 08:01:01 +00:00
< span id = " claimed_<?= $ReportID ?> " > Claimed by < ? = Users :: format_username ( $ClaimerID , false , false , false , false ) ?> <a href="#" onclick="unClaim(<?=$ReportID?>); return false;" class="brackets">Unclaim</a></span>
2012-12-12 08:00:17 +00:00
< ? } else if ( $ClaimerID ) { ?>
2013-01-15 08:00:37 +00:00
< span id = " claimed_<?= $ReportID ?> " > Claimed by < ? = Users :: format_username ( $ClaimerID , false , false , false , false ) ?> </span>
2012-12-10 08:00:21 +00:00
< ? } else { ?>
2013-02-09 08:01:01 +00:00
< a href = " # " id = " claim_<?= $ReportID ?> " onclick = " claim(<?= $ReportID ?>); return false; " class = " brackets " > Claim </ a >
2013-01-15 08:00:37 +00:00
< ? } ?>
& nbsp ; & nbsp ;
2013-02-22 08:00:24 +00:00
< a href = " # " onclick = " toggleNotes(<?= $ReportID ?>); return false; " class = " brackets " > Toggle notes </ a >
2012-12-10 08:00:21 +00:00
2013-01-15 08:00:37 +00:00
< div id = " notes_div_<?= $ReportID ?> " style = " display: <?=empty( $Notes ) ? " none " : " block " ?>; " >
< textarea cols = " 50 " rows = " 3 " id = " notes_<?= $ReportID ?> " >< ? = $Notes ?> </textarea>
< br />
< input type = " submit " onclick = " saveNotes(<?= $ReportID ?>) " value = " Save " />
</ div >
</ td >
</ tr >
2012-12-10 08:00:21 +00:00
< ? if ( $Status != " Resolved " ) { ?>
2013-01-15 08:00:37 +00:00
< tr >
< td class = " center " colspan = " 2 " >
2013-01-19 08:00:51 +00:00
< form id = " report_form_<?= $ReportID ?> " >
2013-01-15 08:00:37 +00:00
< input type = " hidden " name = " reportid " value = " <?= $ReportID ?> " />
< input type = " hidden " name = " auth " value = " <?= $LoggedUser['AuthKey'] ?> " />
< input type = " submit " onclick = " return resolve(<?= $ReportID ?>, <?=( $ClaimerID == $LoggedUser['ID'] || ! $ClaimerID ) ? " true " : " false " ?>) " name = " submit " value = " Resolve " />
</ form >
</ td >
</ tr >
2013-02-22 08:00:24 +00:00
< ? } else {
2013-01-29 08:00:36 +00:00
$ResolverInfo = Users :: user_info ( $ResolverID );
?>
< tr >
< td colspan = " 2 " >
Resolved By < a href = " users.php?id=<?= $ResolverID ?> " >< ? = $ResolverInfo [ 'Username' ] ?> </a>
</ td >
</ tr >
< ? } ?>
2013-01-15 08:00:37 +00:00
</ table >
</ div >
< br />
2012-12-10 08:00:21 +00:00
< ?
$DB -> set_query_id ( $Reports );
2011-03-28 14:21:28 +00:00
}
2012-12-10 08:00:21 +00:00
?>
2013-01-15 08:00:37 +00:00
< div class = " linkbox " >
2012-12-10 08:00:21 +00:00
< ?
echo $Pages ;
?>
2013-01-15 08:00:37 +00:00
</ div >
2011-03-28 14:21:28 +00:00
</ div >
< ?
2012-10-11 08:00:15 +00:00
View :: show_footer ();
2011-03-28 14:21:28 +00:00
?>