Gazelle/sections/torrents/user.php

551 lines
17 KiB
PHP
Raw Normal View History

2013-07-10 00:08:53 +00:00
<?php
2013-03-01 08:00:40 +00:00
2011-03-28 14:21:28 +00:00
$Orders = array('Time', 'Name', 'Seeders', 'Leechers', 'Snatched', 'Size');
2013-07-10 00:08:53 +00:00
$Ways = array('ASC' => 'Ascending', 'DESC' => 'Descending');
2012-11-02 08:00:18 +00:00
$UserVotes = Votes::get_user_votes($LoggedUser['ID']);
2011-03-28 14:21:28 +00:00
// The "order by x" links on columns headers
2013-07-10 00:08:53 +00:00
function header_link($SortKey, $DefaultWay = 'DESC') {
global $Order, $Way;
2013-04-19 08:00:55 +00:00
if ($SortKey == $Order) {
if ($Way == 'DESC') {
$NewWay = 'ASC';
} else {
$NewWay = 'DESC';
}
} else {
$NewWay = $DefaultWay;
}
2013-02-16 08:00:57 +00:00
2013-07-10 00:08:53 +00:00
return "torrents.php?way=$NewWay&amp;order=$SortKey&amp;" . Format::get_url(array('way','order'));
2011-03-28 14:21:28 +00:00
}
$UserID = $_GET['userid'];
2013-04-19 08:00:55 +00:00
if (!is_number($UserID)) {
error(0);
}
2011-03-28 14:21:28 +00:00
2013-04-19 08:00:55 +00:00
if (!empty($_GET['page']) && is_number($_GET['page']) && $_GET['page'] > 0) {
2011-03-28 14:21:28 +00:00
$Page = $_GET['page'];
2013-05-16 16:15:57 +00:00
$Limit = ($Page - 1) * TORRENTS_PER_PAGE.', '.TORRENTS_PER_PAGE;
2011-03-28 14:21:28 +00:00
} else {
$Page = 1;
$Limit = TORRENTS_PER_PAGE;
}
2013-04-19 08:00:55 +00:00
if (!empty($_GET['order']) && in_array($_GET['order'], $Orders)) {
2011-03-28 14:21:28 +00:00
$Order = $_GET['order'];
} else {
$Order = 'Time';
}
2013-04-19 08:00:55 +00:00
if (!empty($_GET['way']) && array_key_exists($_GET['way'], $Ways)) {
2011-03-28 14:21:28 +00:00
$Way = $_GET['way'];
} else {
$Way = 'DESC';
}
$SearchWhere = array();
2013-04-19 08:00:55 +00:00
if (!empty($_GET['format'])) {
if (in_array($_GET['format'], $Formats)) {
2013-07-10 00:08:53 +00:00
$SearchWhere[] = "t.Format = '".db_string($_GET['format'])."'";
2013-04-19 08:00:55 +00:00
} elseif ($_GET['format'] == 'perfectflac') {
2011-03-28 14:21:28 +00:00
$_GET['filter'] = 'perfectflac';
}
}
2013-04-19 08:00:55 +00:00
if (!empty($_GET['bitrate']) && in_array($_GET['bitrate'], $Bitrates)) {
2013-07-10 00:08:53 +00:00
$SearchWhere[] = "t.Encoding = '".db_string($_GET['bitrate'])."'";
2011-03-28 14:21:28 +00:00
}
2013-04-19 08:00:55 +00:00
if (!empty($_GET['media']) && in_array($_GET['media'], $Media)) {
2013-07-10 00:08:53 +00:00
$SearchWhere[] = "t.Media = '".db_string($_GET['media'])."'";
2011-03-28 14:21:28 +00:00
}
2013-04-19 08:00:55 +00:00
if (!empty($_GET['releasetype']) && array_key_exists($_GET['releasetype'], $ReleaseTypes)) {
2013-07-10 00:08:53 +00:00
$SearchWhere[] = "tg.ReleaseType = '".db_string($_GET['releasetype'])."'";
2011-03-28 14:21:28 +00:00
}
2013-07-10 00:08:53 +00:00
if (isset($_GET['scene']) && in_array($_GET['scene'], array('1', '0'))) {
$SearchWhere[] = "t.Scene = '".db_string($_GET['scene'])."'";
2011-03-28 14:21:28 +00:00
}
2013-07-10 00:08:53 +00:00
if (isset($_GET['vanityhouse']) && in_array($_GET['vanityhouse'], array('1', '0'))) {
$SearchWhere[] = "tg.VanityHouse = '".db_string($_GET['vanityhouse'])."'";
}
2013-07-10 00:08:53 +00:00
if (isset($_GET['cue']) && in_array($_GET['cue'], array('1', '0'))) {
$SearchWhere[] = "t.HasCue = '".db_string($_GET['cue'])."'";
2011-03-28 14:21:28 +00:00
}
2013-07-10 00:08:53 +00:00
if (isset($_GET['log']) && in_array($_GET['log'], array('1', '0', '100', '-1'))) {
2013-07-17 08:00:52 +00:00
if ($_GET['log'] === '100') {
2013-07-10 00:08:53 +00:00
$SearchWhere[] = "t.HasLog = '1'";
$SearchWhere[] = "t.LogScore = '100'";
2013-07-17 08:00:52 +00:00
} elseif ($_GET['log'] === '-1') {
2013-07-10 00:08:53 +00:00
$SearchWhere[] = "t.HasLog = '1'";
$SearchWhere[] = "t.LogScore < '100'";
2011-03-28 14:21:28 +00:00
} else {
2013-07-10 00:08:53 +00:00
$SearchWhere[] = "t.HasLog = '".db_string($_GET['log'])."'";
2011-03-28 14:21:28 +00:00
}
}
2013-04-19 08:00:55 +00:00
if (!empty($_GET['categories'])) {
2011-03-28 14:21:28 +00:00
$Cats = array();
2013-04-19 08:00:55 +00:00
foreach (array_keys($_GET['categories']) as $Cat) {
if (!is_number($Cat)) {
2011-03-28 14:21:28 +00:00
error(0);
}
2013-07-10 00:08:53 +00:00
$Cats[] = "tg.CategoryID = '".db_string($Cat)."'";
2011-03-28 14:21:28 +00:00
}
2013-07-10 00:08:53 +00:00
$SearchWhere[] = '('.implode(' OR ', $Cats).')';
2011-03-28 14:21:28 +00:00
}
2013-04-19 08:00:55 +00:00
if (!isset($_GET['tags_type'])) {
2012-03-16 08:00:25 +00:00
$_GET['tags_type'] = '1';
}
2013-04-19 08:00:55 +00:00
if (!empty($_GET['tags'])) {
2013-07-10 00:08:53 +00:00
$Tags = explode(',', $_GET['tags']);
2011-03-28 14:21:28 +00:00
$TagList = array();
2013-04-19 08:00:55 +00:00
foreach ($Tags as $Tag) {
2013-07-10 00:08:53 +00:00
$Tag = trim(str_replace('.', '_', $Tag));
2013-04-19 08:00:55 +00:00
if (empty($Tag)) {
continue;
}
if ($Tag[0] == '!') {
2013-07-10 00:08:53 +00:00
$Tag = ltrim(substr($Tag, 1));
2013-04-19 08:00:55 +00:00
if (empty($Tag)) {
continue;
}
2013-07-10 00:08:53 +00:00
$TagList[] = "CONCAT(' ', tg.TagList, ' ') NOT LIKE '% ".db_string($Tag)." %'";
2012-03-16 08:00:25 +00:00
} else {
2013-07-10 00:08:53 +00:00
$TagList[] = "CONCAT(' ', tg.TagList, ' ') LIKE '% ".db_string($Tag)." %'";
2012-03-16 08:00:25 +00:00
}
2011-03-28 14:21:28 +00:00
}
2013-04-19 08:00:55 +00:00
if (!empty($TagList)) {
2013-07-17 08:00:52 +00:00
if (isset($_GET['tags_type']) && $_GET['tags_type'] !== '1') {
2012-03-16 08:00:25 +00:00
$_GET['tags_type'] = '0';
2013-07-10 00:08:53 +00:00
$SearchWhere[] = '('.implode(' OR ', $TagList).')';
2012-03-16 08:00:25 +00:00
} else {
$_GET['tags_type'] = '1';
2013-07-10 00:08:53 +00:00
$SearchWhere[] = '('.implode(' AND ', $TagList).')';
2012-03-16 08:00:25 +00:00
}
2011-03-28 14:21:28 +00:00
}
}
$SearchWhere = implode(' AND ', $SearchWhere);
2013-04-19 08:00:55 +00:00
if (!empty($SearchWhere)) {
2013-07-10 00:08:53 +00:00
$SearchWhere = " AND $SearchWhere";
2011-03-28 14:21:28 +00:00
}
2012-10-11 08:00:15 +00:00
$User = Users::user_info($UserID);
$Perms = Permissions::get_permissions($User['PermissionID']);
2011-03-28 14:21:28 +00:00
$UserClass = $Perms['Class'];
2013-04-19 08:00:55 +00:00
switch ($_GET['type']) {
2011-03-28 14:21:28 +00:00
case 'snatched':
2013-04-19 08:00:55 +00:00
if (!check_paranoia('snatched', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
2011-03-28 14:21:28 +00:00
$Time = 'xs.tstamp';
$UserField = 'xs.uid';
$ExtraWhere = '';
2013-07-10 00:08:53 +00:00
$From = "
xbt_snatched AS xs
JOIN torrents AS t ON t.ID = xs.fid";
2011-03-28 14:21:28 +00:00
break;
case 'seeding':
2013-04-19 08:00:55 +00:00
if (!check_paranoia('seeding', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
2013-03-02 08:00:34 +00:00
$Time = '(xfu.mtime - xfu.timespent)';
2011-03-28 14:21:28 +00:00
$UserField = 'xfu.uid';
2013-07-10 00:08:53 +00:00
$ExtraWhere = '
AND xfu.active = 1
AND xfu.Remaining = 0';
$From = "
xbt_files_users AS xfu
JOIN torrents AS t ON t.ID = xfu.fid";
2011-03-28 14:21:28 +00:00
break;
2012-03-16 08:00:25 +00:00
case 'contest':
$Time = 'unix_timestamp(t.Time)';
$UserField = 't.UserID';
2013-07-10 00:08:53 +00:00
$ExtraWhere = "
AND t.ID IN (
SELECT TorrentID
FROM library_contest
WHERE UserID = $UserID
)";
$From = 'torrents AS t';
2012-03-16 08:00:25 +00:00
break;
2011-03-28 14:21:28 +00:00
case 'leeching':
2013-04-19 08:00:55 +00:00
if (!check_paranoia('leeching', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
2013-03-02 08:00:34 +00:00
$Time = '(xfu.mtime - xfu.timespent)';
2011-03-28 14:21:28 +00:00
$UserField = 'xfu.uid';
2013-07-10 00:08:53 +00:00
$ExtraWhere = '
AND xfu.active = 1
AND xfu.Remaining > 0';
$From = "
xbt_files_users AS xfu
JOIN torrents AS t ON t.ID = xfu.fid";
2011-03-28 14:21:28 +00:00
break;
case 'uploaded':
2013-07-17 08:00:52 +00:00
if ((empty($_GET['filter']) || $_GET['filter'] !== 'perfectflac') && !check_paranoia('uploads', $User['Paranoia'], $UserClass, $UserID)) {
2013-04-19 08:00:55 +00:00
error(403);
}
2011-03-28 14:21:28 +00:00
$Time = 'unix_timestamp(t.Time)';
$UserField = 't.UserID';
2012-03-16 08:00:25 +00:00
$ExtraWhere = '';
2011-03-28 14:21:28 +00:00
$From = "torrents AS t";
break;
case 'downloaded':
2013-04-19 08:00:55 +00:00
if (!check_perms('site_view_torrent_snatchlist')) {
error(403);
}
2011-03-28 14:21:28 +00:00
$Time = 'unix_timestamp(ud.Time)';
$UserField = 'ud.UserID';
$ExtraWhere = '';
2013-07-10 00:08:53 +00:00
$From = "
users_downloads AS ud
JOIN torrents AS t ON t.ID = ud.TorrentID";
2011-03-28 14:21:28 +00:00
break;
default:
error(404);
}
2013-04-19 08:00:55 +00:00
if (!empty($_GET['filter'])) {
2013-07-17 08:00:52 +00:00
if ($_GET['filter'] === 'perfectflac') {
2013-04-19 08:00:55 +00:00
if (!check_paranoia('perfectflacs', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
$ExtraWhere .= " AND t.Format = 'FLAC'";
2013-04-19 08:00:55 +00:00
if (empty($_GET['media'])) {
2013-07-10 00:08:53 +00:00
$ExtraWhere .= "
AND (
t.LogScore = 100 OR
t.Media IN ('Vinyl', 'WEB', 'DVD', 'Soundboard', 'Cassette', 'SACD', 'Blu-ray', 'DAT')
)";
2013-07-17 08:00:52 +00:00
} elseif (strtoupper($_GET['media']) === 'CD' && empty($_GET['log'])) {
2013-07-10 00:08:53 +00:00
$ExtraWhere .= "
AND t.LogScore = 100";
2011-03-28 14:21:28 +00:00
}
2013-07-17 08:00:52 +00:00
} elseif ($_GET['filter'] === 'uniquegroup') {
2013-04-19 08:00:55 +00:00
if (!check_paranoia('uniquegroups', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
$GroupBy = 'tg.ID';
2011-03-28 14:21:28 +00:00
}
}
2013-04-19 08:00:55 +00:00
if (empty($GroupBy)) {
$GroupBy = 't.ID';
2011-03-28 14:21:28 +00:00
}
2013-07-17 08:00:52 +00:00
if ((empty($_GET['search']) || trim($_GET['search']) === '') && $Order != 'Name') {
2013-04-19 08:00:55 +00:00
$SQL = "
SELECT
2013-05-29 08:00:51 +00:00
SQL_CALC_FOUND_ROWS
t.GroupID,
2013-04-19 08:00:55 +00:00
t.ID AS TorrentID,
$Time AS Time,
tg.CategoryID
2011-03-28 14:21:28 +00:00
FROM $From
2013-07-10 00:08:53 +00:00
JOIN torrents_group AS tg ON tg.ID = t.GroupID
WHERE $UserField = '$UserID'
2013-05-29 08:00:51 +00:00
$ExtraWhere
$SearchWhere
GROUP BY $GroupBy
ORDER BY $Order $Way
LIMIT $Limit";
2011-03-28 14:21:28 +00:00
} else {
2013-04-19 08:00:55 +00:00
$DB->query("
CREATE TEMPORARY TABLE temp_sections_torrents_user (
GroupID int(10) unsigned not null,
TorrentID int(10) unsigned not null,
Time int(12) unsigned not null,
CategoryID int(3) unsigned,
Seeders int(6) unsigned,
Leechers int(6) unsigned,
Snatched int(10) unsigned,
Name mediumtext,
Size bigint(12) unsigned,
2011-03-28 14:21:28 +00:00
PRIMARY KEY (TorrentID)) CHARSET=utf8");
2013-04-19 08:00:55 +00:00
$DB->query("
INSERT IGNORE INTO temp_sections_torrents_user
SELECT
2013-05-15 08:00:54 +00:00
t.GroupID,
t.ID AS TorrentID,
$Time AS Time,
tg.CategoryID,
t.Seeders,
t.Leechers,
t.Snatched,
CONCAT_WS(' ', GROUP_CONCAT(aa.Name SEPARATOR ' '), ' ', tg.Name, ' ', tg.Year, ' ') AS Name,
t.Size
2013-04-19 08:00:55 +00:00
FROM $From
2013-07-10 00:08:53 +00:00
JOIN torrents_group AS tg ON tg.ID = t.GroupID
LEFT JOIN torrents_artists AS ta ON ta.GroupID = tg.ID
LEFT JOIN artists_alias AS aa ON aa.AliasID = ta.AliasID
WHERE $UserField = '$UserID'
2013-05-29 08:00:51 +00:00
$ExtraWhere
$SearchWhere
2013-04-19 08:00:55 +00:00
GROUP BY TorrentID, Time");
2013-07-17 08:00:52 +00:00
if (!empty($_GET['search']) && trim($_GET['search']) !== '') {
2011-03-28 14:21:28 +00:00
$Words = array_unique(explode(' ', db_string($_GET['search'])));
}
2013-05-15 08:00:54 +00:00
$SQL = "
2013-05-29 08:00:51 +00:00
SELECT
SQL_CALC_FOUND_ROWS
GroupID,
TorrentID,
Time,
CategoryID
FROM temp_sections_torrents_user";
2013-04-19 08:00:55 +00:00
if (!empty($Words)) {
2011-03-28 14:21:28 +00:00
$SQL .= "
WHERE Name LIKE '%".implode("%' AND Name LIKE '%", $Words)."%'";
}
$SQL .= "
2013-05-15 08:00:54 +00:00
ORDER BY $Order $Way
LIMIT $Limit";
2011-03-28 14:21:28 +00:00
}
$DB->query($SQL);
$GroupIDs = $DB->collect('GroupID');
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
2013-07-10 00:08:53 +00:00
$DB->query('SELECT FOUND_ROWS()');
2011-03-28 14:21:28 +00:00
list($TorrentCount) = $DB->next_record();
2012-10-11 08:00:15 +00:00
$Results = Torrents::get_groups($GroupIDs);
2011-03-28 14:21:28 +00:00
$Action = display_str($_GET['type']);
2012-10-11 08:00:15 +00:00
$User = Users::user_info($UserID);
2011-03-28 14:21:28 +00:00
2013-07-10 00:08:53 +00:00
View::show_header($User['Username']."'s $Action torrents",'voting');
2011-03-28 14:21:28 +00:00
2013-05-15 08:00:54 +00:00
$Pages = Format::get_pages($Page, $TorrentCount, TORRENTS_PER_PAGE);
2011-03-28 14:21:28 +00:00
?>
<div class="thin">
2012-08-19 08:00:19 +00:00
<div class="header">
2013-07-10 00:08:53 +00:00
<h2><a href="user.php?id=<?=$UserID?>"><?=$User['Username']?></a><?="'s $Action torrents"?></h2>
2012-08-19 08:00:19 +00:00
</div>
2011-03-28 14:21:28 +00:00
<div>
2012-09-15 08:00:25 +00:00
<form class="search_form" name="torrents" action="" method="get">
2012-09-01 08:00:24 +00:00
<table class="layout">
2011-03-28 14:21:28 +00:00
<tr>
<td class="label"><strong>Search for:</strong></td>
<td>
<input type="hidden" name="type" value="<?=$_GET['type']?>" />
<input type="hidden" name="userid" value="<?=$UserID?>" />
2012-10-11 08:00:15 +00:00
<input type="text" name="search" size="60" value="<?Format::form('search')?>" />
2011-03-28 14:21:28 +00:00
</td>
</tr>
<tr>
2012-12-27 08:00:27 +00:00
<td class="label"><strong>Rip specifics:</strong></td>
2011-03-28 14:21:28 +00:00
<td class="nobr" colspan="3">
2012-11-19 08:00:20 +00:00
<select id="bitrate" name="bitrate" class="ft_bitrate">
2011-03-28 14:21:28 +00:00
<option value="">Bitrate</option>
2013-04-19 08:00:55 +00:00
<? foreach ($Bitrates as $BitrateName) { ?>
<option value="<?=display_str($BitrateName); ?>"<?Format::selected('bitrate', $BitrateName)?>><?=display_str($BitrateName); ?></option>
2011-03-28 14:21:28 +00:00
<? } ?> </select>
2013-02-16 08:00:57 +00:00
2012-11-19 08:00:20 +00:00
<select name="format" class="ft_format">
2011-03-28 14:21:28 +00:00
<option value="">Format</option>
2013-04-19 08:00:55 +00:00
<? foreach ($Formats as $FormatName) { ?>
<option value="<?=display_str($FormatName); ?>"<?Format::selected('format', $FormatName)?>><?=display_str($FormatName); ?></option>
2013-02-16 08:00:57 +00:00
<? } ?>
2013-04-19 08:00:55 +00:00
<option value="perfectflac"<?Format::selected('filter', 'perfectflac')?>>Perfect FLACs</option>
2011-03-28 14:21:28 +00:00
</select>
2012-11-19 08:00:20 +00:00
<select name="media" class="ft_media">
2011-03-28 14:21:28 +00:00
<option value="">Media</option>
2013-04-19 08:00:55 +00:00
<? foreach ($Media as $MediaName) { ?>
<option value="<?=display_str($MediaName); ?>"<?Format::selected('media',$MediaName)?>><?=display_str($MediaName); ?></option>
2011-03-28 14:21:28 +00:00
<? } ?>
</select>
2012-11-19 08:00:20 +00:00
<select name="releasetype" class="ft_releasetype">
2011-03-28 14:21:28 +00:00
<option value="">Release type</option>
2013-04-19 08:00:55 +00:00
<? foreach ($ReleaseTypes as $ID=>$Type) { ?>
<option value="<?=display_str($ID); ?>"<?Format::selected('releasetype',$ID)?>><?=display_str($Type); ?></option>
2011-03-28 14:21:28 +00:00
<? } ?>
</select>
</td>
</tr>
<tr>
<td class="label"><strong>Misc:</strong></td>
<td class="nobr" colspan="3">
2012-11-19 08:00:20 +00:00
<select name="log" class="ft_haslog">
2013-04-19 08:00:55 +00:00
<option value="">Has log</option>
<option value="1"<?Format::selected('log','1')?>>Yes</option>
<option value="0"<?Format::selected('log','0')?>>No</option>
<option value="100"<?Format::selected('log','100')?>>100% only</option>
<option value="-1"<?Format::selected('log','-1')?>>&lt;100%/unscored</option>
2011-03-28 14:21:28 +00:00
</select>
2012-11-19 08:00:20 +00:00
<select name="cue" class="ft_hascue">
2013-04-19 08:00:55 +00:00
<option value="">Has cue</option>
<option value="1"<?Format::selected('cue',1)?>>Yes</option>
<option value="0"<?Format::selected('cue',0)?>>No</option>
2011-03-28 14:21:28 +00:00
</select>
2012-11-19 08:00:20 +00:00
<select name="scene" class="ft_scene">
2011-03-28 14:21:28 +00:00
<option value="">Scene</option>
2013-04-19 08:00:55 +00:00
<option value="1"<?Format::selected('scene',1)?>>Yes</option>
<option value="0"<?Format::selected('scene',0)?>>No</option>
2011-03-28 14:21:28 +00:00
</select>
2012-11-19 08:00:20 +00:00
<select name="vanityhouse" class="ft_vanityhouse">
<option value="">Vanity House</option>
2013-04-19 08:00:55 +00:00
<option value="1"<?Format::selected('vanityhouse',1)?>>Yes</option>
<option value="0"<?Format::selected('vanityhouse',0)?>>No</option>
</select>
2011-03-28 14:21:28 +00:00
</td>
</tr>
<tr>
<td class="label"><strong>Tags:</strong></td>
<td>
2013-08-28 23:08:41 +00:00
<input type="text" name="tags" size="60" class="tooltip" title="Use !tag to exclude tag" value="<?Format::form('tags')?>" />&nbsp;
2013-07-17 08:00:52 +00:00
<input type="radio" name="tags_type" id="tags_type0" value="0"<?Format::selected('tags_type', 0, 'checked')?> /><label for="tags_type0"> Any</label>&nbsp;&nbsp;
<input type="radio" name="tags_type" id="tags_type1" value="1"<?Format::selected('tags_type', 1, 'checked')?> /><label for="tags_type1"> All</label>
2011-03-28 14:21:28 +00:00
</td>
</tr>
2013-02-16 08:00:57 +00:00
2011-03-28 14:21:28 +00:00
<tr>
<td class="label"><strong>Order by</strong></td>
<td>
2012-11-19 08:00:20 +00:00
<select name="order" class="ft_order_by">
2013-04-19 08:00:55 +00:00
<? foreach ($Orders as $OrderText) { ?>
<option value="<?=$OrderText?>"<?Format::selected('order', $OrderText)?>><?=$OrderText?></option>
<? } ?>
2011-03-28 14:21:28 +00:00
</select>&nbsp;
2012-11-19 08:00:20 +00:00
<select name="way" class="ft_order_way">
2013-04-19 08:00:55 +00:00
<? foreach ($Ways as $WayKey=>$WayText) { ?>
<option value="<?=$WayKey?>"<?Format::selected('way', $WayKey)?>><?=$WayText?></option>
<? } ?>
2011-03-28 14:21:28 +00:00
</select>
</td>
</tr>
</table>
2013-02-16 08:00:57 +00:00
2012-09-01 08:00:24 +00:00
<table class="layout cat_list">
2011-03-28 14:21:28 +00:00
<?
2013-04-19 08:00:55 +00:00
$x = 0;
2011-03-28 14:21:28 +00:00
reset($Categories);
2013-04-19 08:00:55 +00:00
foreach ($Categories as $CatKey => $CatName) {
2013-07-17 08:00:52 +00:00
if ($x % 7 === 0) {
2013-04-19 08:00:55 +00:00
if ($x > 0) {
2011-03-28 14:21:28 +00:00
?>
</tr>
<? } ?>
<tr>
<?
}
$x++;
?>
<td>
2013-04-19 08:00:55 +00:00
<input type="checkbox" name="categories[<?=($CatKey+1)?>]" id="cat_<?=($CatKey+1)?>" value="1"<? if (isset($_GET['categories'][$CatKey + 1])) { ?> checked="checked"<? } ?> />
<label for="cat_<?=($CatKey + 1)?>"><?=$CatName?></label>
2011-03-28 14:21:28 +00:00
</td>
<?
}
?>
</tr>
</table>
<div class="submit">
<input type="submit" value="Search torrents" />
</div>
</form>
</div>
2013-07-17 08:00:52 +00:00
<? if (count($GroupIDs) === 0) { ?>
2011-03-28 14:21:28 +00:00
<div class="center">
Nothing found!
</div>
<? } else { ?>
<div class="linkbox"><?=$Pages?></div>
2012-09-01 08:00:24 +00:00
<table class="torrent_table cats" width="100%">
2011-03-28 14:21:28 +00:00
<tr class="colhead">
2012-10-04 08:00:22 +00:00
<td class="cats_col"></td>
2011-03-28 14:21:28 +00:00
<td><a href="<?=header_link('Name', 'ASC')?>">Torrent</a></td>
<td><a href="<?=header_link('Time')?>">Time</a></td>
<td><a href="<?=header_link('Size')?>">Size</a></td>
<td class="sign">
<a href="<?=header_link('Snatched')?>"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/snatched.png" alt="Snatches" title="Snatches" /></a>
</td>
<td class="sign">
<a href="<?=header_link('Seeders')?>"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/seeders.png" alt="Seeders" title="Seeders" /></a>
</td>
<td class="sign">
<a href="<?=header_link('Leechers')?>"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/leechers.png" alt="Leechers" title="Leechers" /></a>
</td>
</tr>
<?
$Results = $Results['matches'];
2013-04-19 08:00:55 +00:00
foreach ($TorrentsInfo as $TorrentID => $Info) {
2013-02-25 21:16:55 +00:00
list($GroupID, , $Time) = array_values($Info);
2013-02-16 08:00:57 +00:00
2013-02-25 21:16:55 +00:00
extract(Torrents::array_group($Results[$GroupID]));
2011-03-28 14:21:28 +00:00
$Torrent = $Torrents[$TorrentID];
2013-05-16 16:15:57 +00:00
2013-02-25 21:16:55 +00:00
$TorrentTags = new Tags($TagList);
2013-02-16 08:00:57 +00:00
2011-11-20 08:00:18 +00:00
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5])) {
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
2012-10-11 08:00:15 +00:00
$DisplayName = Artists::display_artists($ExtendedArtists);
2013-04-19 08:00:55 +00:00
} elseif (!empty($Artists)) {
2013-07-17 08:00:52 +00:00
$DisplayName = Artists::display_artists(array(1 => $Artists));
2011-11-20 08:00:18 +00:00
} else {
2013-04-19 08:00:55 +00:00
$DisplayName = '';
2011-03-28 14:21:28 +00:00
}
2013-07-17 08:00:52 +00:00
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$TorrentID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
2013-04-19 08:00:55 +00:00
if ($GroupYear > 0) {
2013-07-17 08:00:52 +00:00
$DisplayName .= " [$GroupYear]";
2013-04-19 08:00:55 +00:00
}
if ($GroupVanityHouse) {
$DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]';
}
2013-02-16 08:00:57 +00:00
2012-10-11 08:00:15 +00:00
$ExtraInfo = Torrents::torrent_info($Torrent);
2013-04-19 08:00:55 +00:00
if ($ExtraInfo) {
2013-08-28 23:08:41 +00:00
$DisplayName .= " - $ExtraInfo";
2011-03-28 14:21:28 +00:00
}
?>
2012-12-06 08:00:17 +00:00
<tr class="torrent torrent_row<?=($Torrent['IsSnatched'] ? ' snatched_torrent' : '') . ($GroupFlags['IsSnatched'] ? ' snatched_group' : '')?>">
2011-03-28 14:21:28 +00:00
<td class="center cats_col">
2013-02-25 21:16:55 +00:00
<div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div>
2011-03-28 14:21:28 +00:00
</td>
2013-02-25 21:16:55 +00:00
<td class="big_info">
2013-08-28 23:08:41 +00:00
<? if ($LoggedUser['CoverArt']) { ?>
2013-02-25 21:16:55 +00:00
<div class="group_image float_left clear">
2013-04-30 18:18:07 +00:00
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?>
2013-02-25 21:16:55 +00:00
</div>
2013-08-28 23:08:41 +00:00
<? } ?>
2013-02-25 21:16:55 +00:00
<div class="group_info clear">
<span class="torrent_links_block">
[ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a> ]
</span>
2013-06-08 08:01:02 +00:00
<? echo "$DisplayName\n"; ?>
2013-08-28 23:08:41 +00:00
<? Votes::vote_link($GroupID, $UserVotes[$GroupID]['Type']); ?>
2013-02-25 21:16:55 +00:00
<div class="tags"><?=$TorrentTags->format('torrents.php?type='.$Action.'&amp;userid='.$UserID.'&amp;tags=')?></div>
2011-03-28 14:21:28 +00:00
</div>
</td>
2013-07-17 08:00:52 +00:00
<td class="nobr"><?=time_diff($Time, 1)?></td>
2013-08-28 23:08:41 +00:00
<td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td class="number_column"><?=number_format($Torrent['Snatched'])?></td>
<td class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>"><?=number_format($Torrent['Seeders'])?></td>
<td class="number_column"><?=number_format($Torrent['Leechers'])?></td>
2011-03-28 14:21:28 +00:00
</tr>
2013-05-16 16:15:57 +00:00
<? }?>
2013-02-28 08:00:29 +00:00
</table>
<? } ?>
2011-03-28 14:21:28 +00:00
<div class="linkbox"><?=$Pages?></div>
</div>
2012-10-11 08:00:15 +00:00
<? View::show_footer(); ?>