2011-03-28 14:21:28 +00:00
|
|
|
<?
|
|
|
|
authorize();
|
|
|
|
|
2013-11-19 08:00:48 +00:00
|
|
|
if (empty($_POST['id']) || !is_number($_POST['id']) || empty($_POST['type']) || ($_POST['type'] !== 'request_update' && empty($_POST['reason']))) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error(404);
|
|
|
|
}
|
|
|
|
|
|
|
|
include(SERVER_ROOT.'/sections/reports/array.php');
|
|
|
|
|
2013-05-01 08:00:16 +00:00
|
|
|
if (!array_key_exists($_POST['type'], $Types)) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error(403);
|
|
|
|
}
|
|
|
|
$Short = $_POST['type'];
|
2013-02-22 08:00:24 +00:00
|
|
|
$Type = $Types[$Short];
|
2011-03-28 14:21:28 +00:00
|
|
|
$ID = $_POST['id'];
|
2013-11-19 08:00:48 +00:00
|
|
|
if ($Short === 'request_update') {
|
2013-05-01 08:00:16 +00:00
|
|
|
if (empty($_POST['year']) || !is_number($_POST['year'])) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error('Year must be specified.');
|
2013-07-04 08:00:56 +00:00
|
|
|
header("Location: reports.php?action=report&type=request_update&id=$ID");
|
2011-03-28 14:21:28 +00:00
|
|
|
die();
|
|
|
|
}
|
2013-05-30 08:00:30 +00:00
|
|
|
$Reason = '[b]Year[/b]: '.$_POST['year'].".\n\n";
|
2012-10-02 08:00:20 +00:00
|
|
|
// If the release type is somehow invalid, return "Not given"; otherwise, return the release type.
|
2013-11-19 08:00:48 +00:00
|
|
|
$Reason .= '[b]Release type[/b]: '.((empty($_POST['releasetype']) || !is_number($_POST['releasetype']) || $_POST['releasetype'] === '0') ? 'Not given' : $ReleaseTypes[$_POST['releasetype']]).". \n\n";
|
2013-05-15 08:00:54 +00:00
|
|
|
$Reason .= '[b]Additional comments[/b]: '.$_POST['comment'];
|
2011-03-28 14:21:28 +00:00
|
|
|
} else {
|
|
|
|
$Reason = $_POST['reason'];
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:00:16 +00:00
|
|
|
switch ($Short) {
|
2013-07-04 08:00:56 +00:00
|
|
|
case 'request':
|
|
|
|
case 'request_update':
|
|
|
|
$Link = "requests.php?action=view&id=$ID";
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
2013-07-04 08:00:56 +00:00
|
|
|
case 'user':
|
|
|
|
$Link = "user.php?id=$ID";
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
2013-07-04 08:00:56 +00:00
|
|
|
case 'collage':
|
|
|
|
$Link = "collages.php?id=$ID";
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
2013-07-04 08:00:56 +00:00
|
|
|
case 'thread':
|
|
|
|
$Link = "forums.php?action=viewthread&threadid=$ID";
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
2013-07-04 08:00:56 +00:00
|
|
|
case 'post':
|
2013-05-15 08:00:54 +00:00
|
|
|
$DB->query("
|
|
|
|
SELECT
|
|
|
|
p.ID,
|
|
|
|
p.TopicID,
|
2013-11-19 08:00:48 +00:00
|
|
|
(
|
|
|
|
SELECT COUNT(p2.ID)
|
2013-11-17 08:00:47 +00:00
|
|
|
FROM forums_posts AS p2
|
|
|
|
WHERE p2.TopicID = p.TopicID
|
|
|
|
AND p2.ID <= p.ID
|
2013-05-15 08:00:54 +00:00
|
|
|
) AS PostNum
|
|
|
|
FROM forums_posts AS p
|
2013-11-17 08:00:47 +00:00
|
|
|
WHERE p.ID = $ID");
|
2013-07-04 08:00:56 +00:00
|
|
|
list($PostID, $TopicID, $PostNum) = $DB->next_record();
|
|
|
|
$Link = "forums.php?action=viewthread&threadid=$TopicID&post=$PostNum#post$PostID";
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
2013-08-28 23:08:41 +00:00
|
|
|
case 'comment':
|
|
|
|
$Link = "comments.php?action=jump&postid=$ID";
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-05-15 08:00:54 +00:00
|
|
|
$DB->query('
|
|
|
|
INSERT INTO reports
|
|
|
|
(UserID, ThingID, Type, ReportedTime, Reason)
|
|
|
|
VALUES
|
2013-11-19 08:00:48 +00:00
|
|
|
('.db_string($LoggedUser['ID']).", $ID, '$Short', '".sqltime()."', '".db_string($Reason)."')");
|
2011-03-28 14:21:28 +00:00
|
|
|
$ReportID = $DB->inserted_id();
|
|
|
|
|
2011-06-30 08:00:06 +00:00
|
|
|
$Channels = array();
|
2011-03-28 14:21:28 +00:00
|
|
|
|
2013-11-19 08:00:48 +00:00
|
|
|
if ($Short === 'request_update') {
|
2013-05-15 08:00:54 +00:00
|
|
|
$Channels[] = '#requestedits';
|
2011-03-28 14:21:28 +00:00
|
|
|
$Cache->increment('num_update_reports');
|
|
|
|
}
|
2013-08-28 23:08:41 +00:00
|
|
|
if (in_array($Short, array('comment', 'post', 'thread'))) {
|
2013-05-15 08:00:54 +00:00
|
|
|
$Channels[] = '#forumreports';
|
2011-06-30 08:00:06 +00:00
|
|
|
}
|
2011-03-28 14:21:28 +00:00
|
|
|
|
2014-01-20 08:01:21 +00:00
|
|
|
|
2013-05-06 08:00:32 +00:00
|
|
|
foreach ($Channels as $Channel) {
|
2013-11-19 08:00:48 +00:00
|
|
|
send_irc("PRIVMSG $Channel :$ReportID - ".$LoggedUser['Username']." just reported a $Short: ".site_url()."$Link : ".strtr($Reason, "\n", ' '));
|
2011-03-28 14:21:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$Cache->delete_value('num_other_reports');
|
|
|
|
|
2013-07-04 08:00:56 +00:00
|
|
|
header("Location: $Link");
|
2011-03-28 14:21:28 +00:00
|
|
|
?>
|