if (!check_perms('users_mod')) {
error(404);
}
// if (!check_perms('site_top10_history')) {
// error(403);
// }
View::show_header('Top 10 Torrents history!');
?>
if (!empty($_GET['date'])) {
$Date = $_GET['date'];
$SQLTime = $Date.' 00:00:00';
if (!validDate($SQLTime)) {
error('Something is wrong with the date you provided');
}
if (empty($_GET['datetype']) || $_GET['datetype'] == 'day') {
$Type = 'day';
$Where = "WHERE th.Date BETWEEN '".$SQLTime."' AND '".$SQLTime."' + INTERVAL 24 HOUR AND Type='Daily'";
} else {
$Type = 'week';
$Where = "WHERE th.Date BETWEEN '".$SQLTime."' - AND '".$SQLTime."' + INTERVAL 7 DAY' AND Type='Weekly'";
}
$Details = $Cache->get_value('top10_history_'.$SQLTime);
if ($Details === false) {
$DB->query("SELECT
tht.Rank,
tht.TitleString,
tht.TagString,
tht.TorrentID,
g.ID,
g.Name,
g.CategoryID,
g.TagList,
t.Format,
t.Encoding,
t.Media,
t.Scene,
t.HasLog,
t.HasCue,
t.LogScore,
t.RemasterYear,
g.Year,
t.RemasterTitle
FROM top10_history AS th
LEFT JOIN top10_history_torrents AS tht ON tht.HistoryID = th.ID
LEFT JOIN torrents AS t ON t.ID = tht.TorrentID
LEFT JOIN torrents_group AS g ON g.ID = t.GroupID
".$Where."
ORDER BY tht.Rank ASC");
$Details = $DB->to_array();
$Cache->cache_value('top10_history_'.$SQLTime, $Details, 3600*24);
}
?>
Top 10 for =($Type == 'day' ? $Date : 'the first week after '.$Date)?>
|
|
Name |
foreach ($Details as $Detail) :
list($Rank, $TitleString, $TagString, $TorrentID, $GroupID,$GroupName,$GroupCategoryID,$TorrentTags,
$Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data) = $Detail;
// highlight every other row
$Highlight = ($Rank % 2 ? 'a' : 'b');
if ($GroupID) :
//Group still exists
$DisplayName='';
$Artists = Artists::get_artist($GroupID);
if (!empty($Artists)) {
$DisplayName = Artists::display_artists($Artists, true, true);
}
$DisplayName .= "$GroupName";
if ($GroupCategoryID == 1 && $GroupYear > 0) {
$DisplayName.= " [$GroupYear]";
}
// append extra info to torrent title
$ExtraInfo = '';
$AddExtra = '';
if ($Format) {
$ExtraInfo.= $Format;
$AddExtra = ' / ';
}
if ($Encoding) {
$ExtraInfo.= $AddExtra.$Encoding;
$AddExtra = ' / ';
}
//"FLAC / Lossless / Log (100%) / Cue / CD";
if ($HasLog) {
$ExtraInfo.= "$AddExtra Log ($LogScore".'%)';
$AddExtra = ' / ';
}
if ($HasCue) {
$ExtraInfo.= $AddExtra.'Cue';
$AddExtra = ' / ';
}
if ($Media) {
$ExtraInfo.= $AddExtra.$Media;
$AddExtra = ' / ';
}
if ($Scene) {
$ExtraInfo.= $AddExtra.'Scene';
$AddExtra = ' / ';
}
if ($Year > 0) {
$ExtraInfo.= $AddExtra.$Year;
$AddExtra = ' ';
}
if ($RemasterTitle) {
$ExtraInfo.= $AddExtra.$RemasterTitle;
}
if ($ExtraInfo != '') {
$ExtraInfo = "- [$ExtraInfo]";
}
$DisplayName .= $ExtraInfo;
$TorrentTags = new Tags($TorrentTags);
else:
$DisplayName = $TitleString.' (Deleted)';
$TorrentTags = new Tags($TagString);
endif;
?>
=$Rank?> |
|
=($GroupID ? 'DL' : '(Deleted)')?>
=$DisplayName?>
=$TorrentTags->format()?>
|
endforeach;
?>
}
View::show_footer();
?>