2011-03-28 14:21:28 +00:00
|
|
|
<?
|
|
|
|
authorize();
|
|
|
|
|
|
|
|
$TorrentID = $_POST['torrentid'];
|
2013-05-01 08:00:16 +00:00
|
|
|
if (!$TorrentID || !is_number($TorrentID)) {
|
|
|
|
error(404);
|
|
|
|
}
|
2011-03-28 14:21:28 +00:00
|
|
|
|
2013-07-04 08:00:56 +00:00
|
|
|
if ($Cache->get_value("torrent_{$TorrentID}_lock")) {
|
2013-06-27 08:01:06 +00:00
|
|
|
error('Torrent cannot be deleted because the upload process is not completed yet. Please try again later.');
|
|
|
|
}
|
|
|
|
|
2013-07-04 08:00:56 +00:00
|
|
|
$DB->query("
|
|
|
|
SELECT
|
|
|
|
t.UserID,
|
|
|
|
t.GroupID,
|
|
|
|
t.Size,
|
|
|
|
t.info_hash,
|
|
|
|
tg.Name,
|
|
|
|
ag.Name,
|
|
|
|
t.Time,
|
|
|
|
COUNT(x.uid)
|
2011-03-28 14:21:28 +00:00
|
|
|
FROM torrents AS t
|
2013-07-04 08:00:56 +00:00
|
|
|
LEFT JOIN torrents_group AS tg ON tg.ID = t.GroupID
|
|
|
|
LEFT JOIN artists_group AS ag ON ag.ArtistID = tg.ArtistID
|
|
|
|
LEFT JOIN xbt_snatched AS x ON x.fid = t.ID
|
|
|
|
WHERE t.ID = '$TorrentID'");
|
2012-07-25 08:00:15 +00:00
|
|
|
list($UserID, $GroupID, $Size, $InfoHash, $Name, $ArtistName, $Time, $Snatches) = $DB->next_record(MYSQLI_NUM, false);
|
2011-03-28 14:21:28 +00:00
|
|
|
|
2013-05-01 08:00:16 +00:00
|
|
|
if (($LoggedUser['ID'] != $UserID || time_ago($Time) > 3600 * 24 * 7 || $Snatches > 4) && !check_perms('torrents_delete')) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error(403);
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:00:16 +00:00
|
|
|
if ($ArtistName) {
|
2013-07-04 08:00:56 +00:00
|
|
|
$Name = "$ArtistName - $Name";
|
2011-03-28 14:21:28 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 08:00:16 +00:00
|
|
|
if (isset($_SESSION['logged_user']['multi_delete'])) {
|
|
|
|
if ($_SESSION['logged_user']['multi_delete'] >= 3 && !check_perms('torrents_delete_fast')) {
|
2013-07-04 08:00:56 +00:00
|
|
|
error('You have recently deleted 3 torrents. Please contact a staff member if you need to delete more.');
|
2011-03-28 14:21:28 +00:00
|
|
|
}
|
|
|
|
$_SESSION['logged_user']['multi_delete']++;
|
|
|
|
} else {
|
|
|
|
$_SESSION['logged_user']['multi_delete'] = 1;
|
|
|
|
}
|
|
|
|
|
2013-07-04 08:00:56 +00:00
|
|
|
$InfoHash = unpack('H*', $InfoHash);
|
2012-10-11 08:00:15 +00:00
|
|
|
Torrents::delete_torrent($TorrentID, $GroupID);
|
2013-07-04 08:00:56 +00:00
|
|
|
Misc::write_log("Torrent $TorrentID ($Name) (".number_format($Size / (1024 * 1024), 2).' MB) ('.strtoupper($InfoHash[1]).') was deleted by '.$LoggedUser['Username'].': ' .$_POST['reason'].' '.$_POST['extra']);
|
|
|
|
Torrents::write_group_log($GroupID, $TorrentID, $LoggedUser['ID'], 'deleted torrent ('.number_format($Size / (1024 * 1024), 2).' MB, '.strtoupper($InfoHash[1]).') for reason: '.$_POST['reason'].' '.$_POST['extra'], 0);
|
2011-03-28 14:21:28 +00:00
|
|
|
|
2012-10-11 08:00:15 +00:00
|
|
|
View::show_header('Torrent deleted');
|
2011-03-28 14:21:28 +00:00
|
|
|
?>
|
|
|
|
<div class="thin">
|
|
|
|
<h3>Torrent was successfully deleted.</h3>
|
|
|
|
</div>
|
|
|
|
<?
|
2012-10-11 08:00:15 +00:00
|
|
|
View::show_footer();
|