Gazelle/sections/better/upload.php

122 lines
3.9 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
// Get list of FLAC uploads
if(!empty($_GET['userid']) && is_number($_GET['userid'])) {
if (check_perms('users_override_paranoia')) {
$UserID = $_GET['userid'];
} else {
error(403);
}
} else {
$UserID = $LoggedUser['ID'];
}
$DB->query("SELECT t.GroupID, t.ID
FROM torrents AS t
WHERE
t.Format='FLAC'
AND ((t.LogScore = '100' AND t.Media = 'CD')
OR t.Media = 'Vinyl')
AND t.UserID='$UserID'");
$UploadedGroupIDs = $DB->collect('GroupID');
$Uploads = $DB->to_array('GroupID');
if(count($UploadedGroupIDs) == 0) { error('You haven\'t uploaded any 100% flacs!'); }
// Create hash table
$DB->query("CREATE TEMPORARY TABLE temp_sections_better_upload
2011-03-28 14:21:28 +00:00
SELECT t.GroupID,
GROUP_CONCAT(t.Encoding SEPARATOR ' ') AS EncodingList
FROM torrents AS t
WHERE t.GroupID IN(".implode(',',$UploadedGroupIDs).")
GROUP BY t.GroupID");
//$DB->query('SELECT * FROM t');
2011-03-28 14:21:28 +00:00
$DB->query("SELECT GroupID FROM temp_sections_better_upload
2011-03-28 14:21:28 +00:00
WHERE EncodingList NOT LIKE '%V0 (VBR)%'
OR EncodingList NOT LIKE '%V2 (VBR)%'
OR EncodingList NOT LIKE '%320%'");
$GroupIDs = $DB->collect('GroupID');
if(count($GroupIDs) == 0) { error('No results found'); }
2012-10-11 08:00:15 +00:00
$Results = Torrents::get_groups($GroupIDs);
2011-03-28 14:21:28 +00:00
2012-10-11 08:00:15 +00:00
View::show_header('Transcode Uploads');
2011-03-28 14:21:28 +00:00
?>
<div class="thin">
2012-09-01 08:00:24 +00:00
<table width="100%" class="torrent_table">
2011-03-28 14:21:28 +00:00
<tr class="colhead">
<td>Torrent</td>
<td>V2</td>
<td>V0</td>
<td>320</td>
</tr>
<?
$Results = $Results['matches'];
foreach ($Results as $GroupID=>$Group) {
2012-12-06 08:00:17 +00:00
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TorrentTags, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists, $ExtendedArtists, $GroupFlags) = array_values($Group);
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName = Artists::display_artists($ExtendedArtists);
} else {
$DisplayName = '';
}
2011-03-28 14:21:28 +00:00
$FlacID = $Uploads[$GroupID]['ID'];
$DisplayName = '';
if(count($Artists)>0) {
2012-10-11 08:00:15 +00:00
$DisplayName = Artists::display_artists(array('1'=>$Artists));
2011-03-28 14:21:28 +00:00
}
2012-12-06 08:00:17 +00:00
$DisplayName.='<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$FlacID.'#torrent'.$FlacID.'" title="View Torrent">'.$GroupName.'</a>';
2011-03-28 14:21:28 +00:00
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
2012-02-09 08:00:20 +00:00
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
2012-12-06 08:00:17 +00:00
$ExtraInfo = Torrents::torrent_info($Torrents[$FlacID]);
if($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo;
}
2011-03-28 14:21:28 +00:00
$MissingEncodings = array('V0 (VBR)'=>1, 'V2 (VBR)'=>1, '320'=>1);
foreach($Torrents as $Torrent) {
if(!empty($MissingEncodings[$Torrent['Encoding']])) {
$MissingEncodings[$Torrent['Encoding']] = 0;
}
}
2012-02-05 08:00:20 +00:00
$TagList=array();
if($TorrentTags!='') {
$TorrentTags=explode(' ',$TorrentTags);
foreach ($TorrentTags as $TagKey => $TagName) {
$TagName = str_replace('_','.',$TagName);
2013-02-11 08:00:34 +00:00
$TagList[]='<a href="torrents.php?taglist='.$TagName.'">'.$TagName.'</a>';
2012-02-05 08:00:20 +00:00
}
$PrimaryTag = $TorrentTags[0];
$TagList = implode(', ', $TagList);
$TorrentTags='<br /><div class="tags">'.$TagList.'</div>';
}
2011-03-28 14:21:28 +00:00
?>
2012-12-06 08:00:17 +00:00
<tr<?=$Torrents[$FlacID]['IsSnatched'] ? ' class="snatched_torrent"' : ''?>>
2011-03-28 14:21:28 +00:00
<td>
2012-12-06 08:00:17 +00:00
<span class="torrent_links_block">
[ <a href="torrents.php?action=download&amp;id=<?=$FlacID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>">DL</a> ]
</span>
2011-03-28 14:21:28 +00:00
<?=$DisplayName?>
2012-02-05 08:00:20 +00:00
<?=$TorrentTags?>
2011-03-28 14:21:28 +00:00
</td>
2012-02-05 08:00:20 +00:00
<td><strong><?=($MissingEncodings['V2 (VBR)'] == 0)?'<span style="color: green;">YES</span>':'<span style="color: red;">NO</span>'?></strong></td>
<td><strong><?=($MissingEncodings['V0 (VBR)'] == 0)?'<span style="color: green;">YES</span>':'<span style="color: red;">NO</span>'?></strong></td>
<td><strong><?=($MissingEncodings['320'] == 0)?'<span style="color: green;">YES</span>':'<span style="color: red;">NO</span>'?></strong></td>
2011-03-28 14:21:28 +00:00
</tr>
<? } ?>
</table>
</div>
<?
2012-10-11 08:00:15 +00:00
View::show_footer();
2011-03-28 14:21:28 +00:00
?>