Gazelle/sections/better/folders.php

92 lines
2.9 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?php
if(check_perms('admin_reports') && !empty($_GET['remove']) && is_number($_GET['remove'])) {
$DB->query("DELETE FROM torrents_bad_folders WHERE TorrentID = ".$_GET['remove']);
$DB->query("SELECT GroupID FROM torrents WHERE ID = ".$_GET['remove']);
list($GroupID) = $DB->next_record();
$Cache->delete_value('torrents_details_'.$GroupID);
}
if(!empty($_GET['filter']) && $_GET['filter'] == "all") {
$Join = "";
$All = true;
} else {
$Join = "JOIN xbt_snatched as x ON x.fid=tbf.TorrentID AND x.uid = ".$LoggedUser['ID'];
$All = false;
}
show_header('Torrents with bad folder names');
$DB->query("SELECT tbf.TorrentID, t.GroupID FROM torrents_bad_folders AS tbf JOIN torrents AS t ON t.ID = tbf.TorrentID ".$Join." ORDER BY tbf.TimeAdded ASC");
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
foreach($TorrentsInfo as $Torrent) {
$GroupIDs[] = $Torrent['GroupID'];
}
$Results = get_groups($GroupIDs);
$Results = $Results['matches'];
?>
2012-08-19 08:00:19 +00:00
<div class="header">
2011-03-28 14:21:28 +00:00
<? if($All) { ?>
2012-08-19 08:00:19 +00:00
<h2>All torrents trumpable for folder names</h2>
2011-03-28 14:21:28 +00:00
<? } else { ?>
2012-08-19 08:00:19 +00:00
<h2>Torrents trumpable for folder names, that you've snatched</h2>
2011-03-28 14:21:28 +00:00
<? } ?>
2012-08-19 08:00:19 +00:00
<div class="linkbox">
2011-03-28 14:21:28 +00:00
<? if($All) { ?>
2012-08-19 08:00:19 +00:00
<a href="better.php?method=folders">Just those you've snatched</a>
2011-03-28 14:21:28 +00:00
<? } else { ?>
2012-08-19 08:00:19 +00:00
<a href="better.php?method=folders&amp;filter=all">Show all</a>
2011-03-28 14:21:28 +00:00
<? } ?>
2012-08-19 08:00:19 +00:00
</div>
</div>
2011-03-28 14:21:28 +00:00
<div class="thin box pad">
<h3>There are <?=count($TorrentsInfo)?> torrents remaining</h3>
2012-09-01 08:00:24 +00:00
<table class="torrent_table">
2011-03-28 14:21:28 +00:00
<?
foreach($TorrentsInfo as $TorrentID => $Info) {
2012-02-05 08:00:20 +00:00
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TorrentTags, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists) = array_values($Results[$Info['GroupID']]);
2011-03-28 14:21:28 +00:00
$DisplayName = '';
if(count($Artists)>0) {
$DisplayName = display_artists(array('1'=>$Artists));
}
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) {
$DisplayName.=" [".$GroupYear."]";
}
2012-02-09 08:00:20 +00:00
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
2011-03-28 14:21:28 +00:00
$ExtraInfo = torrent_info($Torrents[$TorrentID]);
if($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo;
}
2012-02-05 08:00:20 +00:00
$TagList=array();
if($TorrentTags!='') {
$TorrentTags=explode(' ',$TorrentTags);
foreach ($TorrentTags as $TagKey => $TagName) {
$TagName = str_replace('_','.',$TagName);
$TagList[]='<a href="torrents.php?searchtags='.$TagName.'">'.$TagName.'</a>';
}
$PrimaryTag = $TorrentTags[0];
$TagList = implode(', ', $TagList);
$TorrentTags='<br /><div class="tags">'.$TagList.'</div>';
}
2011-03-28 14:21:28 +00:00
?>
<tr><td><?=$DisplayName?>
2012-08-14 08:00:18 +00:00
[ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>">DL</a> ]
2011-03-28 14:21:28 +00:00
<? if(check_perms('admin_reports')) { ?>
2012-02-05 08:00:20 +00:00
<a href="better.php?method=folders&amp;remove=<?=$TorrentID?>">[X]</a>
2011-03-28 14:21:28 +00:00
<? } ?>
2012-02-05 08:00:20 +00:00
<?=$TorrentTags?>
2011-03-28 14:21:28 +00:00
</td></tr>
<?
}
?>
</table>
</div>
<?
show_footer();
?>