$TorrentID = $_GET['torrentid'];
if (!$TorrentID || !is_number($TorrentID)) { error(404); }
$DB->query("SELECT t.UserID, t.Time, COUNT(x.uid) FROM torrents AS t LEFT JOIN xbt_snatched AS x ON x.fid=t.ID WHERE t.ID=".$TorrentID." GROUP BY t.UserID");
if($DB->record_count() < 1) {
error('Torrent already deleted.');
}
list($UserID, $Time, $Snatches) = $DB->next_record();
if ($LoggedUser['ID']!=$UserID && !check_perms('torrents_delete')) {
error(403);
}
if(isset($_SESSION['logged_user']['multi_delete']) && $_SESSION['logged_user']['multi_delete']>=3 && !check_perms('torrents_delete_fast')) {
error('You have recently deleted 3 torrents, please contact a staff member if you need to delete more.');
}
if(time_ago($Time) > 3600*24*7 && !check_perms('torrents_delete')) { // Should this be torrents_delete or torrents_delete_fast?
error('You can no longer delete this torrent as it has been uploaded for over a week with no problems. If you now think there is a problem, please report it instead.');
}
if($Snatches > 4 && !check_perms('torrents_delete')) { // Should this be torrents_delete or torrents_delete_fast?
error('You can no longer delete this torrent as it has been snatched by 5 or more users. If you believe there is a problem with the torrent please report it instead.');
}
View::show_header('Delete torrent', 'reportsv2');
?>
require(SERVER_ROOT.'/sections/reportsv2/array.php');
require(SERVER_ROOT.'/classes/class_text.php');
$Text = NEW TEXT;
$ReportID = 0;
$DB->query("SELECT
tg.Name,
tg.ID,
CASE COUNT(ta.GroupID)
WHEN 1 THEN aa.ArtistID
WHEN 0 THEN '0'
ELSE '0'
END AS ArtistID,
CASE COUNT(ta.GroupID)
WHEN 1 THEN aa.Name
WHEN 0 THEN ''
ELSE 'Various Artists'
END AS ArtistName,
tg.Year,
tg.CategoryID,
t.Time,
t.Remastered,
t.RemasterTitle,
t.RemasterYear,
t.Media,
t.Format,
t.Encoding,
t.Size,
t.HasLog,
t.LogScore,
t.UserID AS UploaderID,
uploader.Username
FROM torrents AS t
LEFT JOIN torrents_group AS tg ON tg.ID=t.GroupID
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID AND ta.Importance='1'
LEFT JOIN artists_alias AS aa ON aa.AliasID=ta.AliasID
LEFT JOIN users_main AS uploader ON uploader.ID=t.UserID
WHERE t.ID=".$TorrentID);
if($DB->record_count() < 1) {
die();
}
list($GroupName, $GroupID, $ArtistID, $ArtistName, $Year, $CategoryID, $Time, $Remastered, $RemasterTitle,
$RemasterYear, $Media, $Format, $Encoding, $Size, $HasLog, $LogScore, $UploaderID, $UploaderName) = $DB->next_record();
$Type = 'dupe'; //hardcoded default
if (array_key_exists($Type, $Types[$CategoryID])) {
$ReportType = $Types[$CategoryID][$Type];
} else if(array_key_exists($Type,$Types['master'])) {
$ReportType = $Types['master'][$Type];
} else {
//There was a type but it wasn't an option!
$Type = 'other';
$ReportType = $Types['master']['other'];
}
if ($ArtistID == 0 && empty($ArtistName)) {
$RawName = $GroupName.($Year ? " ($Year)" : "").($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : "").($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasLog ? " ($LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$LinkName = "
$GroupName".($Year ? " ($Year)" : "")." ".($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : "").($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")."".($HasLog ? "
(Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$BBName = "[url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : "")."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")."[/url] ".($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID'](Log: $LogScore %)[/url]" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
} elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') {
$RawName = "Various Artists - $GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasLog ? " ($LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$LinkName = "Various Artists -
$GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")." ".($HasLog ? "
(Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$BBName = "Various Artists - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : "")."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")."[/url] ".($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID'](Log: $LogScore %)[/url]" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
} else {
$RawName = "$ArtistName - $GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "").($HasLog ? " ($LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$LinkName = "
$ArtistName -
$GroupName".($Year ? " ($Year)" : "")." [$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")." ".($HasLog ? "
(Log: $LogScore %)" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
$BBName = "[url=artist.php?id=$ArtistID]".$ArtistName."[/url] - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : "")."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]".($Remastered ? " <$RemasterTitle - $RemasterYear>" : "")."[/url] ".($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID'](Log: $LogScore %)[/url]" : "")." (".number_format($Size/(1024*1024), 2)." MB)";
}
?>
}
View::show_footer(); ?>