Gazelle/sections/torrents/delete.php

307 lines
13 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
$TorrentID = $_GET['torrentid'];
2013-04-15 08:00:54 +00:00
if (!$TorrentID || !is_number($TorrentID)) {
error(404);
}
2011-03-28 14:21:28 +00:00
2012-10-16 08:00:18 +00:00
2013-05-21 08:01:09 +00:00
$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");
2012-10-16 08:00:18 +00:00
2013-04-15 08:00:54 +00:00
if ($DB->record_count() < 1) {
2011-03-28 14:21:28 +00:00
error('Torrent already deleted.');
}
2012-10-16 08:00:18 +00:00
2011-03-28 14:21:28 +00:00
list($UserID, $Time, $Snatches) = $DB->next_record();
2012-10-16 08:00:18 +00:00
2013-04-15 08:00:54 +00:00
if ($LoggedUser['ID'] != $UserID && !check_perms('torrents_delete')) {
2011-03-28 14:21:28 +00:00
error(403);
}
2013-04-15 08:00:54 +00:00
if (isset($_SESSION['logged_user']['multi_delete']) && $_SESSION['logged_user']['multi_delete'] >= 3 && !check_perms('torrents_delete_fast')) {
2013-05-21 08:01:09 +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
}
2013-04-15 08:00:54 +00:00
if (time_ago($Time) > 3600 * 24 * 7 && !check_perms('torrents_delete')) { // Should this be torrents_delete or torrents_delete_fast?
2013-05-21 08:01:09 +00:00
error('You can no longer delete this torrent as it has been uploaded for over a week. If you now think there is a problem, please report the torrent instead.');
2011-03-28 14:21:28 +00:00
}
2013-04-15 08:00:54 +00:00
if ($Snatches > 4 && !check_perms('torrents_delete')) { // Should this be torrents_delete or torrents_delete_fast?
2013-05-21 08:01:09 +00:00
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 this torrent, please report it instead.');
2011-03-28 14:21:28 +00:00
}
2012-10-16 08:00:18 +00:00
2012-10-11 08:00:15 +00:00
View::show_header('Delete torrent', 'reportsv2');
2011-03-28 14:21:28 +00:00
?>
<div class="thin center">
2013-05-08 08:00:26 +00:00
<div class="box" style="width: 600px; margin: 0px auto;">
2011-03-28 14:21:28 +00:00
<div class="head colhead">
Delete torrent
</div>
<div class="pad">
2012-09-15 08:00:25 +00:00
<form class="delete_form" name="torrent" action="torrents.php" method="post">
2011-03-28 14:21:28 +00:00
<input type="hidden" name="action" value="takedelete" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="torrentid" value="<?=$TorrentID?>" />
<strong>Reason: </strong>
<select name="reason">
<option value="Dead">Dead</option>
<option value="Dupe">Dupe</option>
<option value="Trumped">Trumped</option>
<option value="Rules Broken">Rules broken</option>
<option value="" selected="selected">Other</option>
</select>
&nbsp;
<strong>Extra info: </strong>
<input type="text" name="extra" size="30" />
<input value="Delete" type="submit" />
</form>
</div>
</div>
</div>
<?
2013-04-15 08:00:54 +00:00
if (check_perms('admin_reports')) {
2011-03-28 14:21:28 +00:00
?>
2013-05-08 08:00:26 +00:00
<div id="all_reports" style="width: 80%; margin-left: auto; margin-right: auto;">
2011-03-28 14:21:28 +00:00
<?
2013-05-27 08:00:58 +00:00
include(SERVER_ROOT.'/classes/reports.class.php');
2013-05-21 08:01:09 +00:00
2011-03-28 14:21:28 +00:00
require(SERVER_ROOT.'/sections/reportsv2/array.php');
2013-05-27 08:00:58 +00:00
require(SERVER_ROOT.'/classes/text.class.php');
2011-03-28 14:21:28 +00:00
$Text = NEW TEXT;
$ReportID = 0;
2013-05-08 08:00:26 +00:00
$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
2011-03-28 14:21:28 +00:00
FROM torrents AS t
2013-05-08 08:00:26 +00:00
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
2011-03-28 14:21:28 +00:00
WHERE t.ID=".$TorrentID);
2013-04-15 08:00:54 +00:00
if ($DB->record_count() < 1) {
2011-03-28 14:21:28 +00:00
die();
}
2013-02-22 08:00:24 +00:00
list($GroupName, $GroupID, $ArtistID, $ArtistName, $Year, $CategoryID, $Time, $Remastered, $RemasterTitle,
2011-03-28 14:21:28 +00:00
$RemasterYear, $Media, $Format, $Encoding, $Size, $HasLog, $LogScore, $UploaderID, $UploaderName) = $DB->next_record();
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
$Type = 'dupe'; //hardcoded default
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
if (array_key_exists($Type, $Types[$CategoryID])) {
$ReportType = $Types[$CategoryID][$Type];
2013-04-15 08:00:54 +00:00
} elseif (array_key_exists($Type,$Types['master'])) {
2011-03-28 14:21:28 +00:00
$ReportType = $Types['master'][$Type];
} else {
//There was a type but it wasn't an option!
$Type = 'other';
$ReportType = $Types['master']['other'];
}
2013-05-21 08:01:09 +00:00
$RemasterDisplayString = Reports::format_reports_remaster_info($Remastered, $RemasterTitle, $RemasterYear);
2011-03-28 14:21:28 +00:00
if ($ArtistID == 0 && empty($ArtistName)) {
2013-05-21 08:01:09 +00:00
$RawName = $GroupName.($Year ? " ($Year)" : '').($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : '') . $RemasterDisplayString . ($HasLog ? " ({$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
$LinkName = "<a href=\"torrents.php?id=$GroupID\">$GroupName".($Year ? " ($Year)" : '')."</a> <a href=\"torrents.php?torrentid=$TorrentID\">".($Format || $Encoding || $Media ? " [$Format/$Encoding/$Media]" : '') . "$RemasterDisplayString</a>" . ($HasLog ? " <a href=\"torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID\">(Log: {$LogScore}%)</a>" : '').' ('.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]{$RemasterDisplayString}[/url] " . ($HasLog ? " [url=torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID](Log: {$LogScore}%)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
2011-03-28 14:21:28 +00:00
} elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') {
2013-05-21 08:01:09 +00:00
$RawName = "Various Artists - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]$RemasterDisplayString" . ($HasLog ? " ({$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
$LinkName = "Various Artists - <a href=\"torrents.php?id=$GroupID\">$GroupName".($Year ? " ($Year)" : '')."</a> <a href=\"torrents.php?torrentid=$TorrentID\"> [$Format/$Encoding/$Media]$RemasterDisplayString</a> ".($HasLog ? " <a href=\"torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID\">(Log: {$LogScore}%)</a>" : '').' ('.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]{$RemasterDisplayString}[/url] ".($HasLog ? " [url=torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID](Log: {$LogScore}%)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
2011-03-28 14:21:28 +00:00
} else {
2013-05-21 08:01:09 +00:00
$RawName = "$ArtistName - $GroupName".($Year ? " ($Year)" : '')." [$Format/$Encoding/$Media]$RemasterDisplayString" . ($HasLog ? " ({$LogScore}%)" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
$LinkName = "<a href=\"artist.php?id=$ArtistID\">$ArtistName</a> - <a href=\"torrents.php?id=$GroupID\">$GroupName".($Year ? " ($Year)" : '')."</a> <a href=\"torrents.php?torrentid=$TorrentID\"> [$Format/$Encoding/$Media]$RemasterDisplayString</a> ".($HasLog ? " <a href=\"torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID\">(Log: {$LogScore}%)</a>" : '').' ('.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]{$RemasterDisplayString}[/url] " . ($HasLog ? " [url=torrents.php?action=viewlog&amp;torrentid=$TorrentID&amp;groupid=$GroupID](Log: {$LogScore}%)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)';
2013-02-22 08:00:24 +00:00
}
?>
2011-03-28 14:21:28 +00:00
<div id="report<?=$ReportID?>">
2012-09-15 08:00:25 +00:00
<form class="create_form" name="report" id="reportform_<?=$ReportID?>" action="reports.php" method="post">
2013-05-21 08:01:09 +00:00
<?
2011-03-28 14:21:28 +00:00
/*
2013-05-21 08:01:09 +00:00
* Some of these are for takeresolve, some for the JavaScript.
2011-03-28 14:21:28 +00:00
*/
?>
<div>
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" id="newreportid" name="newreportid" value="<?=$ReportID?>" />
<input type="hidden" id="reportid<?=$ReportID?>" name="reportid" value="<?=$ReportID?>" />
<input type="hidden" id="torrentid<?=$ReportID?>" name="torrentid" value="<?=$TorrentID?>" />
<input type="hidden" id="uploader<?=$ReportID?>" name="uploader" value="<?=$UploaderName?>" />
<input type="hidden" id="uploaderid<?=$ReportID?>" name="uploaderid" value="<?=$UploaderID?>" />
<input type="hidden" id="reporterid<?=$ReportID?>" name="reporterid" value="<?=$ReporterID?>" />
<input type="hidden" id="raw_name<?=$ReportID?>" name="raw_name" value="<?=$RawName?>" />
<input type="hidden" id="type<?=$ReportID?>" name="type" value="<?=$Type?>" />
<input type="hidden" id="categoryid<?=$ReportID?>" name="categoryid" value="<?=$CategoryID?>" />
<input type="hidden" id="pm_type<?=$ReportID?>" name="pm_type" value="Uploader" />
<input type="hidden" id="from_delete<?=$ReportID?>" name="from_delete" value="<?=$GroupID?>" />
</div>
2012-09-01 08:00:24 +00:00
<table cellpadding="5" class="layout">
2011-03-28 14:21:28 +00:00
<tr>
<td class="label">Torrent:</td>
<td colspan="3">
2013-04-15 08:00:54 +00:00
<? if (!$GroupID) { ?>
2011-03-28 14:21:28 +00:00
<a href="log.php?search=Torrent+<?=$TorrentID?>"><?=$TorrentID?></a> (Deleted)
2013-04-15 08:00:54 +00:00
<? } else { ?>
2011-03-28 14:21:28 +00:00
<?=$LinkName?>
2013-02-09 08:01:01 +00:00
<a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" class="brackets" title="Download">DL</a>
2011-03-28 14:21:28 +00:00
uploaded by <a href="user.php?id=<?=$UploaderID?>"><?=$UploaderName?></a> <?=time_diff($Time)?>
<br />
2013-05-21 08:01:09 +00:00
<? $DB->query("
SELECT r.ID
FROM reportsv2 AS r
LEFT JOIN torrents AS t ON t.ID=r.TorrentID
WHERE r.Status != 'Resolved'
AND t.GroupID=$GroupID");
2011-03-28 14:21:28 +00:00
$GroupOthers = ($DB->record_count());
2013-02-22 08:00:24 +00:00
2013-04-15 08:00:54 +00:00
if ($GroupOthers > 0) { ?>
2011-03-28 14:21:28 +00:00
<div style="text-align: right;">
<a href="reportsv2.php?view=group&amp;id=<?=$GroupID?>">There <?=(($GroupOthers > 1) ? "are $GroupOthers reports" : "is 1 other report")?> for torrent(s) in this group</a>
</div>
2013-04-15 08:00:54 +00:00
<? }
2013-02-22 08:00:24 +00:00
2013-05-21 08:01:09 +00:00
$DB->query("
SELECT t.UserID
FROM reportsv2 AS r
JOIN torrents AS t ON t.ID=r.TorrentID
WHERE r.Status != 'Resolved'
AND t.UserID=$UploaderID");
2011-03-28 14:21:28 +00:00
$UploaderOthers = ($DB->record_count());
2013-04-15 08:00:54 +00:00
if ($UploaderOthers > 0) { ?>
2011-03-28 14:21:28 +00:00
<div style="text-align: right;">
<a href="reportsv2.php?view=uploader&amp;id=<?=$UploaderID?>">There <?=(($UploaderOthers > 1) ? "are $UploaderOthers reports" : "is 1 other report")?> for torrent(s) uploaded by this user</a>
</div>
2013-04-15 08:00:54 +00:00
<? }
2013-02-22 08:00:24 +00:00
2013-05-21 08:01:09 +00:00
$DB->query("
SELECT DISTINCT req.ID,
req.FillerID,
um.Username,
req.TimeFilled
FROM requests AS req
JOIN users_main AS um ON um.ID=req.FillerID
AND req.TorrentID=$TorrentID");
2011-03-28 14:21:28 +00:00
$Requests = ($DB->record_count());
2013-04-15 08:00:54 +00:00
if ($Requests > 0) {
2013-05-06 08:00:32 +00:00
while (list($RequestID, $FillerID, $FillerName, $FilledTime) = $DB->next_record()) {
2011-03-28 14:21:28 +00:00
?>
2013-05-21 08:01:09 +00:00
<div style="text-align: right;">
2012-02-27 08:00:22 +00:00
<a href="user.php?id=<?=$FillerID?>"><?=$FillerName?></a> used this torrent to fill <a href="requests.php?action=viewrequest&amp;id=<?=$RequestID?>">this request</a> <?=time_diff($FilledTime)?>
2013-05-21 08:01:09 +00:00
</div>
2013-04-15 08:00:54 +00:00
<? }
2011-03-28 14:21:28 +00:00
}
}
?>
</td>
</tr>
2013-04-15 08:00:54 +00:00
<? // END REPORTED STUFF :|: BEGIN MOD STUFF ?>
2011-03-28 14:21:28 +00:00
<tr>
<td class="label">
<a href="javascript:Load('<?=$ReportID?>')">Resolve</a>
</td>
<td colspan="3">
<select name="resolve_type" id="resolve_type<?=$ReportID?>" onchange="ChangeResolve(<?=$ReportID?>)">
<?
$TypeList = $Types['master'] + $Types[$CategoryID];
$Priorities = array();
foreach ($TypeList as $Key => $Value) {
$Priorities[$Key] = $Value['priority'];
}
array_multisort($Priorities, SORT_ASC, $TypeList);
2013-04-15 08:00:54 +00:00
foreach ($TypeList as $IType => $Data) {
?>
2013-05-21 08:01:09 +00:00
<option value="<?=$IType?>"<?=(($Type == $IType) ? ' selected="selected"' : '')?>><?=$Data['title']?></option>
2013-04-15 08:00:54 +00:00
<?
}
2011-03-28 14:21:28 +00:00
?>
</select>
<span id="options<?=$ReportID?>">
2012-12-21 08:00:21 +00:00
<span title="Delete torrent?">
2011-03-28 14:21:28 +00:00
<strong>Delete</strong>
2013-04-15 08:00:54 +00:00
<input type="checkbox" name="delete" id="delete<?=$ReportID?>"<?=($ReportType['resolve_options']['delete'] ? ' checked="checked"' : '')?> />
2011-03-28 14:21:28 +00:00
</span>
<span title="Warning length in weeks">
<strong>Warning</strong>
<select name="warning" id="warning<?=$ReportID?>">
2013-05-06 08:00:32 +00:00
<? for ($i = 0; $i < 9; $i++) { ?>
2013-05-21 08:01:09 +00:00
<option value="<?=$i?>"<?=(($ReportType['resolve_options']['warn'] == $i) ? ' selected="selected"' : '')?>><?=$i?></option>
2013-04-15 08:00:54 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
</select>
</span>
<span title="Remove upload privileges?">
<strong>Upload</strong>
2013-04-15 08:00:54 +00:00
<input type="checkbox" name="upload" id="upload<?=$ReportID?>"<?=($ReportType['resolve_options']['upload'] ? ' checked="checked"' : '')?> />
2011-03-28 14:21:28 +00:00
</span>
</span>
2013-05-21 08:01:09 +00:00
</td>
2011-03-28 14:21:28 +00:00
</tr>
<tr>
2013-05-25 08:01:03 +00:00
<td class="label">PM uploader</td>
2011-03-28 14:21:28 +00:00
<td colspan="3">
2012-12-21 08:00:21 +00:00
<span title="Appended to the regular message unless using &quot;Send Now&quot;.">
2011-03-28 14:21:28 +00:00
<textarea name="uploader_pm" id="uploader_pm<?=$ReportID?>" cols="50" rows="1"></textarea>
</span>
<input type="button" value="Send Now" onclick="SendPM(<?=$ReportID?>)" />
</td>
</tr>
<tr>
2013-05-25 08:01:03 +00:00
<td class="label"><strong>Extra</strong> log message:</td>
2011-03-28 14:21:28 +00:00
<td>
<input type="text" name="log_message" id="log_message<?=$ReportID?>" size="40" />
</td>
2013-05-25 08:01:03 +00:00
<td class="label"><strong>Extra</strong> staff notes:</td>
2011-03-28 14:21:28 +00:00
<td>
<input type="text" name="admin_message" id="admin_message<?=$ReportID?>" size="40" />
</td>
</tr>
<tr>
<td colspan="4" style="text-align: center;">
<input type="button" value="Submit" onclick="TakeResolve(<?=$ReportID?>);" />
</td>
</tr>
</table>
</form>
<br />
</div>
</div>
<?
}
2012-12-21 08:00:21 +00:00
View::show_footer(); ?>