Gazelle/sections/reportsv2/ajax_take_pm.php

75 lines
2.0 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
/*
* This is the AJAX backend for the SendNow() function.
*/
authorize();
2013-05-04 08:00:48 +00:00
if (!check_perms('admin_reports')) {
2011-03-28 14:21:28 +00:00
echo 'HAX on premissions!';
die();
}
$Recipient = $_POST['pm_type'];
$TorrentID = $_POST['torrentid'];
2013-05-04 08:00:48 +00:00
if (isset($_POST['uploader_pm']) && $_POST['uploader_pm'] != '') {
2011-03-28 14:21:28 +00:00
$Message = $_POST['uploader_pm'];
} else {
//No message given
die();
}
2013-05-04 08:00:48 +00:00
if (!is_number($_POST['categoryid']) || !is_number($TorrentID)) {
2011-03-28 14:21:28 +00:00
echo 'HAX on categoryid!';
die();
} else {
$CategoryID = $_POST['categoryid'];
}
if (array_key_exists($_POST['type'], $Types[$CategoryID])) {
$ReportType = $Types[$CategoryID][$_POST['type']];
2013-07-10 00:08:53 +00:00
} else if (array_key_exists($_POST['type'], $Types['master'])) {
2011-03-28 14:21:28 +00:00
$ReportType = $Types['master'][$_POST['type']];
} else {
//There was a type but it wasn't an option!
echo 'HAX on section type';
die();
}
2013-05-04 08:00:48 +00:00
if (!isset($_POST['from_delete'])) {
2011-03-28 14:21:28 +00:00
$Report = true;
2013-05-04 08:00:48 +00:00
} else if (!is_number($_POST['from_delete'])) {
2011-03-28 14:21:28 +00:00
echo 'Hax occured in from_delete';
}
2013-05-04 08:00:48 +00:00
if ($Recipient == 'Uploader') {
2011-03-28 14:21:28 +00:00
$ToID = $_POST['uploaderid'];
2013-05-04 08:00:48 +00:00
if ($Report) {
2013-07-10 00:08:53 +00:00
$Message = "You uploaded [url=https://".SSL_SITE_URL."/torrents.php?torrentid=$TorrentID]the above torrent[/url]. It has been reported for the reason: ".$ReportType['title']."\n\n$Message";
2011-03-28 14:21:28 +00:00
} else {
2013-07-10 00:08:53 +00:00
$Message = "I am PMing you as you are the uploader of [url=https://".SSL_SITE_URL."/torrents.php?torrentid=$TorrentID]the above torrent[/url].\n\n$Message";
2011-03-28 14:21:28 +00:00
}
2013-05-04 08:00:48 +00:00
} else if ($Recipient == 'Reporter') {
2011-03-28 14:21:28 +00:00
$ToID = $_POST['reporterid'];
2013-07-10 00:08:53 +00:00
$Message = "You reported [url=https://".SSL_SITE_URL."/torrents.php?torrentid=$TorrentID]the above torrent[/url] for the reason ".$ReportType['title'].":\n[quote]".$_POST['report_reason']."[/quote]\n$Message";
2011-03-28 14:21:28 +00:00
} else {
$Err = "Something went horribly wrong";
}
$Subject = $_POST['raw_name'];
2013-05-04 08:00:48 +00:00
if (!is_number($ToID)) {
2011-03-28 14:21:28 +00:00
$Err = "Haxx occuring, non number present";
}
2013-05-04 08:00:48 +00:00
if ($ToID == $LoggedUser['ID']) {
2011-03-28 14:21:28 +00:00
$Err = "That's you!";
}
2013-05-04 08:00:48 +00:00
if (isset($Err)) {
2011-03-28 14:21:28 +00:00
echo $Err;
} else {
2013-03-10 08:00:41 +00:00
Misc::send_pm($ToID, $LoggedUser['ID'], $Subject, $Message);
2011-03-28 14:21:28 +00:00
}