Update Releases class, controllers and API responses

This commit is contained in:
DariusIII
2018-05-14 13:48:25 +02:00
parent 387e0fd452
commit df6f80b310
20 changed files with 665 additions and 576 deletions
+3 -9
View File
@@ -48,16 +48,14 @@ class ReleaseSearch
*
* @param array $options Array where keys are the column name, and value is the search string.
*
* @param null $query
* @param bool $builder
*
* @return string|\Illuminate\Database\Query\Builder
*/
public function getSearchSQL(array $options = [], $query = null, $builder = false)
public function getSearchSQL(array $options = [])
{
$this->searchOptions = $options;
return $this->sphinxSQL($query, $builder);
return $this->sphinxSQL();
}
/**
@@ -75,7 +73,7 @@ class ReleaseSearch
*
* @return string
*/
private function sphinxSQL($query = null, $builder = false)
private function sphinxSQL()
{
$searchQuery = $fullReturn = '';
@@ -97,10 +95,6 @@ class ReleaseSearch
}
}
if ($searchQuery !== '') {
if ($builder === true) {
return $query->whereRaw(sprintf("(rse.query = '@@relaxed %s')", trim($searchQuery).$this->sphinxQueryOpt));
}
$fullReturn = sprintf("AND (rse.query = '@@relaxed %s')", trim($searchQuery).$this->sphinxQueryOpt);
}
+336 -288
View File
@@ -558,29 +558,29 @@ class Releases
/**
* Function for searching on the site (by subject, searchname or advanced).
*
*
*
* @param $searchName
* @param $usenetName
* @param $posterName
* @param $fileName
* @param $groupName
* @param $sizeFrom
* @param $sizeTo
* @param $hasNfo
* @param $hasComments
* @param $daysNew
* @param $daysOld
* @param string|int $searchName
* @param string|int $usenetName
* @param string|int $posterName
* @param string|int $fileName
* @param string|int $groupName
* @param int $sizeFrom
* @param int $sizeTo
* @param int $hasNfo
* @param int $hasComments
* @param int $daysNew
* @param int $daysOld
* @param int $offset
* @param int $limit
* @param string|array $orderBy
* @param int $maxAge
* @param array $excludedCats
* @param int $maxAge
* @param int|array $excludedCats
* @param string $type
* @param array $cat
* @param int $minSize
* @param array $cat
*
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator|mixed
* @param int $minSize
* @return array
*/
public function search($searchName, $usenetName, $posterName, $fileName, $groupName, $sizeFrom, $sizeTo, $hasNfo, $hasComments, $daysNew, $daysOld, $orderBy = '', $maxAge = -1, array $excludedCats = [], $type = 'basic', array $cat = [-1], $minSize = 0)
public function search($searchName, $usenetName, $posterName, $fileName, $groupName, $sizeFrom, $sizeTo, $hasNfo, $hasComments, $daysNew, $daysOld, $offset = 0, $limit = 1000, $orderBy = '', $maxAge = -1, array $excludedCats = [], $type = 'basic', array $cat = [-1], $minSize = 0): array
{
$sizeRange = [
1 => 1,
@@ -595,15 +595,13 @@ class Releases
10 => 320,
11 => 640,
];
if ($orderBy === '') {
$orderBy = [];
$orderBy[0] = 'postdate';
$orderBy[1] = 'desc';
$orderBy[0] = 'postdate ';
$orderBy[1] = 'desc ';
} else {
$orderBy = $this->getBrowseOrder($orderBy);
}
$searchOptions = [];
if ($searchName !== -1) {
$searchOptions['searchname'] = $searchName;
@@ -617,122 +615,143 @@ class Releases
if ($fileName !== -1) {
$searchOptions['filename'] = $fileName;
}
return Release::query()
->remember(config('nntmux.cache_expiry_medium'))
->fromSub(function ($query) use ($maxAge, $groupName, $sizeFrom, $sizeRange, $sizeTo, $hasNfo, $hasComments, $cat, $excludedCats, $type, $daysNew, $daysOld, $searchOptions, $minSize) {
self::showPasswords($query, true);
$query->where('r.nzbstatus', '=', NZB::NZB_ADDED);
if ($maxAge > 0) {
$query->where('r.postdate', '>', Carbon::now()->subDays($maxAge));
}
if ((int) $groupName !== -1) {
$query->where('r.groups_id', '=', Group::getIDByName($groupName));
}
if (array_key_exists($sizeFrom, $sizeRange)) {
$query->where('r.size', '<', (string) (104857600 * (int) $sizeRange[$sizeTo]));
}
if ((int) $hasNfo !== 0) {
$query->where('r.nfostatus', '=', 1);
}
if ((int) $hasComments !== 0) {
$query->where('r.comments', '>', 0);
}
if ($type === 'basic') {
Category::getCategorySearch($cat, $query, true);
} elseif ($type === 'advanced' && (int) $cat[0] !== -1) {
$query->where('r.categories_id', '=', $cat[0]);
}
if ((int) $daysNew !== -1) {
$query->where('r.postdate', '<', Carbon::now()->subDays($daysNew));
}
if ((int) $daysOld !== -1) {
$query->where('r.postdate', '>', Carbon::now()->subDays($daysOld));
}
if (\count($excludedCats) > 0) {
$query->whereNotIn('r.categories_id', $excludedCats);
}
if (\count($searchOptions) > 0) {
$this->releaseSearch->getSearchSQL($searchOptions, $query, true);
}
if ($minSize > 0) {
$query->where('r.size', '>=', $minSize);
}
$query->select(['r.*', 'r.categories_id AS category_ids', 'df.failed as failed', 'g.name as group_name', 'rn.releases_id as nfoid', 're.releases_id as reid', 'cp.id as categoryparentid', 'v.tvdb', 'v.trakt', 'v.tvrage', 'v.tvmaze', 'v.imdb', 'v.tmdb', 'tve.firstaired', DB::raw("CONCAT(cp.title, ' > ', c.title) AS category_name")])
->from('releases as r')
->leftJoin('video_data as re', 're.releases_id', '=', 'r.id')
->leftJoin('videos as v', 'v.id', '=', 'r.videos_id')
->leftJoin('tv_episodes as tve', 'tve.id', '=', 'r.tv_episodes_id')
->leftJoin('release_nfos as rn', 'rn.releases_id', '=', 'r.id')
->leftJoin('groups as g', 'g.id', '=', 'r.groups_id')
->leftJoin('categories as c', 'c.id', '=', 'r.categories_id')
->leftJoin('categories as cp', 'cp.id', '=', 'c.parentid')
->leftJoin('dnzb_failures as df', 'df.release_id', '=', 'r.id')
->join('releases_se as rse', 'rse.id', '=', 'r.id');
}, 'r')
->orderBy('r.'.$orderBy[0], $orderBy[1])
->paginate(config('nntmux.items_per_page'));
$catQuery = '';
if ($type === 'basic') {
$catQuery = Category::getCategorySearch($cat);
} elseif ($type === 'advanced' && (int) $cat[0] !== -1) {
$catQuery = sprintf('AND r.categories_id = %d', $cat[0]);
}
$whereSql = sprintf(
'%s WHERE r.passwordstatus %s AND r.nzbstatus = %d %s %s %s %s %s %s %s %s %s %s %s %s',
$this->releaseSearch->getFullTextJoinString(),
$this->showPasswords,
NZB::NZB_ADDED,
($maxAge > 0 ? sprintf(' AND r.postdate > (NOW() - INTERVAL %d DAY) ', $maxAge) : ''),
((int) $groupName !== -1 ? sprintf(' AND r.groups_id = %d ', Group::getIDByName($groupName)) : ''),
(array_key_exists($sizeFrom, $sizeRange) ? ' AND r.size > '.(string) (104857600 * (int) $sizeRange[$sizeFrom]).' ' : ''),
(array_key_exists($sizeTo, $sizeRange) ? ' AND r.size < '.(string) (104857600 * (int) $sizeRange[$sizeTo]).' ' : ''),
((int) $hasNfo !== 0 ? ' AND r.nfostatus = 1 ' : ''),
((int) $hasComments !== 0 ? ' AND r.comments > 0 ' : ''),
$catQuery,
((int) $daysNew !== -1 ? sprintf(' AND r.postdate < (NOW() - INTERVAL %d DAY) ', $daysNew) : ''),
((int) $daysOld !== -1 ? sprintf(' AND r.postdate > (NOW() - INTERVAL %d DAY) ', $daysOld) : ''),
(\count($excludedCats) > 0 ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''),
(\count($searchOptions) > 0 ? $this->releaseSearch->getSearchSQL($searchOptions) : ''),
($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '')
);
$baseSql = sprintf(
"SELECT r.*,
CONCAT(cp.title, ' > ', c.title) AS category_name,
%s AS category_ids,
df.failed AS failed,
g.name AS group_name,
rn.releases_id AS nfoid,
re.releases_id AS reid,
cp.id AS categoryparentid,
v.tvdb, v.trakt, v.tvrage, v.tvmaze, v.imdb, v.tmdb,
tve.firstaired
FROM releases r
LEFT OUTER JOIN video_data re ON re.releases_id = r.id
LEFT OUTER JOIN videos v ON r.videos_id = v.id
LEFT OUTER JOIN tv_episodes tve ON r.tv_episodes_id = tve.id
LEFT OUTER JOIN release_nfos rn ON rn.releases_id = r.id
LEFT JOIN groups g ON g.id = r.groups_id
LEFT JOIN categories c ON c.id = r.categories_id
LEFT JOIN categories cp ON cp.id = c.parentid
LEFT OUTER JOIN dnzb_failures df ON df.release_id = r.id
%s",
$this->getConcatenatedCategoryIDs(),
$whereSql
);
$sql = sprintf(
'SELECT * FROM (
%s
) r
ORDER BY r.%s %s
LIMIT %d OFFSET %d',
$baseSql,
$orderBy[0],
$orderBy[1],
$limit,
$offset
);
$releases = Cache::get(md5($sql));
if ($releases !== null) {
return $releases;
}
$releases = DB::select($sql);
if (! empty($releases) && \count($releases) > 0) {
$releases['_totalrows'] = $this->getPagerCount($baseSql);
}
$expiresAt = Carbon::now()->addMinutes(config('nntmux.cache_expiry_medium'));
Cache::put(md5($sql), $releases, $expiresAt);
return $releases;
}
/**
* @param $page
* @param array $siteIdArr
* @param string $series
* @param string $episode
* @param string $airdate
* @param int $limit
* @param string $name
* @param array $cat
* @param int $maxAge
* @param int $minSize
*
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator|mixed
* @throws \Exception
*/
public function tvSearch($page, array $siteIdArr = [], $series = '', $episode = '', $airdate = '', $limit = 100, $name = '', array $cat = [-1], $maxAge = -1, $minSize = 0)
{
$show = null;
$showQry = Video::query()->where(function ($query) use ($siteIdArr) {
if (\is_array($siteIdArr) && ! empty($siteIdArr)) {
foreach ($siteIdArr as $column => $Id) {
if ($Id > 0) {
$query->orWhere('v.'.$column, $Id);
}
/**
* Search TV Shows via the API.
*
* @param array $siteIdArr Array containing all possible TV Processing site IDs desired
* @param string $series The series or season number requested
* @param string $episode The episode number requested
* @param string $airdate The airdate of the episode requested
* @param int $offset Skip this many releases
* @param int $limit Return this many releases
* @param string $name The show name to search
* @param array $cat The category to search
* @param int $maxAge The maximum age of releases to be returned
* @param int $minSize The minimum size of releases to be returned
*
* @return array
*/
public function tvSearch(array $siteIdArr = [], $series = '', $episode = '', $airdate = '', $offset = 0, $limit = 100, $name = '', array $cat = [-1], $maxAge = -1, $minSize = 0): array {
$siteSQL = [];
$showSql = '';
if (\is_array($siteIdArr)) {
foreach ($siteIdArr as $column => $Id) {
if ($Id > 0) {
$siteSQL[] = sprintf('v.%s = %d', $column, $Id);
}
}
})->from('videos as v')->leftJoin('tv_episodes as tve', 'v.id', '=', 'tve.videos_id')->select([
'v.id as video',
DB::raw("GROUP_CONCAT(tve.id SEPARATOR ',') AS episodes"),
]);
if ($series !== '') {
$showQry->where('tve.series', (int) preg_replace('/^s0*/i', '', $series));
}
if ($episode !== '') {
$showQry->where('tve.episode', (int) preg_replace('/^e0*/i', '', $episode));
if (\count($siteSQL) > 0) {
// If we have show info, find the Episode ID/Video ID first to avoid table scans
$showQry = sprintf(
"
SELECT
v.id AS video,
GROUP_CONCAT(tve.id SEPARATOR ',') AS episodes
FROM videos v
LEFT JOIN tv_episodes tve ON v.id = tve.videos_id
WHERE (%s) %s %s %s
GROUP BY v.id",
implode(' OR ', $siteSQL),
($series !== '' ? sprintf('AND tve.series = %d', (int) preg_replace('/^s0*/i', '', $series)) : ''),
($episode !== '' ? sprintf('AND tve.episode = %d', (int) preg_replace('/^e0*/i', '', $episode)) : ''),
($airdate !== '' ? sprintf('AND DATE(tve.firstaired) = %s', $this->pdo->escapeString($airdate)) : '')
);
$show = $this->pdo->queryOneRow($showQry);
if ($show !== false) {
if ((! empty($series) || ! empty($episode) || ! empty($airdate)) && strlen((string) $show['episodes']) > 0) {
$showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show['episodes']);
} elseif ((int) $show['video'] > 0) {
$showSql = 'AND r.videos_id = '.$show['video'];
// If $series is set but episode is not, return Season Packs only
if (! empty($series) && empty($episode)) {
$showSql .= ' AND r.tv_episodes_id = 0';
}
} else {
// If we were passed Episode Info and no match was found, do not run the query
return [];
}
} else {
// If we were passed Site ID Info and no match was found, do not run the query
return [];
}
}
if ($airdate !== '') {
$showQry->whereDate('tve.firstaired', $airdate);
}
$show = $showQry->first();
// If $name is set it is a fallback search, add available SxxExx/airdate info to the query
if (! empty($name)) {
if (! empty($name) && $showSql === '') {
if (! empty($series) && (int) $series < 1900) {
$name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT));
if (! empty($episode) && strpos($episode, '/') === false) {
@@ -742,185 +761,190 @@ class Releases
$name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airdate));
}
}
$query = Release::query()
->remember(config('nntmux.cache_expiry_medium'))
->where('r.nzbstatus', NZB::NZB_ADDED);
self::showPasswords($query, true);
if ($show !== null) {
if ((! empty($series) || ! empty($episode) || ! empty($airdate)) && \strlen((string) $show['episodes']) > 0) {
$query->whereIn('r.tv_episodes_id', $show['episodes']);
} elseif ((int) $show['video'] > 0) {
$query->where('r.videos_id', $show['video']);
// If $series is set but episode is not, return Season Packs only
if (! empty($series) && empty($episode)) {
$query->where('r.tv_epsiodes_id', '=', 0);
}
}
$whereSql = sprintf(
'%s
WHERE r.nzbstatus = %d
AND r.passwordstatus %s
%s %s %s %s %s',
($name !== '' ? $this->releaseSearch->getFullTextJoinString() : ''),
NZB::NZB_ADDED,
$this->showPasswords,
$showSql,
($name !== '' ? $this->releaseSearch->getSearchSQL(['searchname' => $name]) : ''),
Category::getCategorySearch($cat),
($maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : ''),
($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '')
);
$baseSql = sprintf(
"SELECT r.*,
v.title, v.countries_id, v.started, v.tvdb, v.trakt,
v.imdb, v.tmdb, v.tvmaze, v.tvrage, v.source,
tvi.summary, tvi.publisher, tvi.image,
tve.series, tve.episode, tve.se_complete, tve.title, tve.firstaired, tve.summary,
CONCAT(cp.title, ' > ', c.title) AS category_name,
%s AS category_ids,
g.name AS group_name,
rn.releases_id AS nfoid,
re.releases_id AS reid
FROM releases r
LEFT OUTER JOIN videos v ON r.videos_id = v.id AND v.type = 0
LEFT OUTER JOIN tv_info tvi ON v.id = tvi.videos_id
LEFT OUTER JOIN tv_episodes tve ON r.tv_episodes_id = tve.id
LEFT JOIN categories c ON c.id = r.categories_id
LEFT JOIN categories cp ON cp.id = c.parentid
LEFT JOIN groups g ON g.id = r.groups_id
LEFT OUTER JOIN video_data re ON re.releases_id = r.id
LEFT OUTER JOIN release_nfos rn ON rn.releases_id = r.id
%s",
$this->getConcatenatedCategoryIDs(),
$whereSql
);
$sql = sprintf(
'%s
ORDER BY postdate DESC
LIMIT %d OFFSET %d',
$baseSql,
$limit,
$offset
);
$releases = Cache::get(md5($sql));
if ($releases !== null) {
return $releases;
}
$query->select(
[
'r.*',
'v.title',
'v.countries_id',
'v.started',
'v.tvdb',
'v.trakt',
'v.imdb',
'v.tmdb',
'v.tvmaze',
'v.tvrage',
'v.source',
'tvi.summary',
'tvi.publisher',
'tvi.image',
'tve.series',
'tve.episode',
'tve.se_complete',
'tve.title',
'tve.firstaired',
'tve.summary',
DB::raw("CONCAT(cp.title, ' > ', c.title) AS category_name"),
'g.name as group_name',
'rn.releases_id as nfoid',
're.releases_id as reid',
]
)
->from('releases as r')
->leftJoin('videos as v', function ($query) {
$query->on('v.id', '=', 'r.videos_id')
->where('v.type', '=', 0);
})
->leftJoin('tv_info as tvi', 'tvi.videos_id', '=', 'v.id')
->leftJoin('tv_episodes as tve', 'tve.id', '=', 'r.tv_episodes_id')
->leftJoin('categories as c', 'c.id', '=', 'r.categories_id')
->leftJoin('categories as cp', 'cp.id', '=', 'c.parentid')
->leftJoin('groups as g', 'g.id', '=', 'r.groups_id')
->leftJoin('video_data as re', 're.releases_id', '=', 'r.id')
->leftJoin('release_nfos as rn', 'rn.releases_id', '=', 'r.id');
if ($name !== '') {
$this->releaseSearch->getSearchSQL(['searchname' => $name], $query, true);
$query->join('releases_se as rse', 'rse.id', '=', 'r.id');
$releases = DB::select($sql);
if (! empty($releases) && \count($releases) > 0) {
$releases['_totalrows'] = $this->getPagerCount(
preg_replace('#LEFT(\s+OUTER)?\s+JOIN\s+(?!tv_episodes)\s+.*ON.*=.*\n#i', ' ', $baseSql)
);
}
Category::getCategorySearch($cat, $query, true);
if ($maxAge > 0) {
$query->where('r.postdate', '>', Carbon::now()->subDays($maxAge));
}
if ($minSize > 0) {
$query->where('r.size', '>=', $minSize);
}
$query->orderByDesc('r.postdate')->limit($limit);
return $query->paginate(config('nntmux.items_per_page'));
$expiresAt = Carbon::now()->addMinutes(config('nntmux.cache_expiry_medium'));
Cache::put(md5($sql), $releases, $expiresAt);
return $releases;
}
/**
* @param $aniDbID
* @param int $offset
* @param int $limit
* @param string $name
* @param array $cat
* @param int $maxAge
*
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator|mixed
* @throws \Exception
* @return array
*/
public function animeSearch($aniDbID, $limit = 100, $name = '', array $cat = [-1], $maxAge = -1)
public function animeSearch($aniDbID, $offset = 0, $limit = 100, $name = '', array $cat = [-1], $maxAge = -1): array
{
$query = Release::query()->remember(config('nntmux.cache_expiry_medium'))->where('r.nzbstatus', NZB::NZB_ADDED);
if ($name !== '') {
$query->join('releases_se as rse', 'rse.id', '=', 'r.id');
$this->releaseSearch->getSearchSQL(['searchname' => $name], $query, true);
$whereSql = sprintf(
'%s
WHERE r.passwordstatus %s
AND r.nzbstatus = %d
%s %s %s %s',
($name !== '' ? $this->releaseSearch->getFullTextJoinString() : ''),
$this->showPasswords,
NZB::NZB_ADDED,
($aniDbID > -1 ? sprintf(' AND r.anidbid = %d ', $aniDbID) : ''),
($name !== '' ? $this->releaseSearch->getSearchSQL(['searchname' => $name]) : ''),
Category::getCategorySearch($cat),
($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '')
);
$baseSql = sprintf(
"SELECT r.*,
CONCAT(cp.title, ' > ', c.title) AS category_name,
%s AS category_ids,
g.name AS group_name,
rn.releases_id AS nfoid,
re.releases_id AS reid
FROM releases r
LEFT JOIN categories c ON c.id = r.categories_id
LEFT JOIN categories cp ON cp.id = c.parentid
LEFT JOIN groups g ON g.id = r.groups_id
LEFT OUTER JOIN release_nfos rn ON rn.releases_id = r.id
LEFT OUTER JOIN releaseextrafull re ON re.releases_id = r.id
%s",
$this->getConcatenatedCategoryIDs(),
$whereSql
);
$sql = sprintf(
'%s
ORDER BY postdate DESC
LIMIT %d OFFSET %d',
$baseSql,
$limit,
$offset
);
$releases = Cache::get(md5($sql));
if ($releases !== null) {
return $releases;
}
if ($aniDbID > -1) {
$query->where('r.anidbid', $aniDbID);
$releases = DB::select($sql);
if (! empty($releases) && \count($releases) > 0) {
$releases['_totalrows'] = $this->getPagerCount($baseSql);
}
self::showPasswords($query, true);
Category::getCategorySearch($cat, $query, true);
if ($maxAge > 0) {
$query->where('r.postdate', '>', Carbon::now()->subDays($maxAge));
}
$query->select(
[
'r.*',
DB::raw("CONCAT(cp.title, ' > ', c.title) as category_name"),
'g.name as group_name',
'rn.releases_id as nfoid',
're.releases_id as reid',
]
)
->from('releases as r')
->leftJoin('categories as c', 'c.id', '=', 'r.categories_id')
->leftJoin('categories as cp', 'cp.id', '=', 'c.parentid')
->leftJoin('groups as g', 'g.id', '=', 'r.groups_id')
->leftJoin('release_nfos as rn', 'rn.releases_id', '=', 'r.id')
->leftJoin('releaseextrafull as re', 're.releases_id', '=', 'r.id')
->orderByDesc('r.postdate')
->limit($limit);
return $query->paginate(config('nntmux.items_per_page'));
$expiresAt = Carbon::now()->addMinutes(config('nntmux.cache_expiry_medium'));
Cache::put(md5($sql), $releases, $expiresAt);
return $releases;
}
/**
* @param $imDbId
* @param int $limit
* @param int $imDbId
* @param int $offset
* @param int $limit
* @param string $name
* @param array $cat
* @param int $maxAge
* @param int $minSize
* @param array $cat
* @param int $maxAge
* @param int $minSize
*
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator|mixed
* @throws \Exception
* @return array
*/
public function moviesSearch($imDbId, $limit = 100, $name = '', array $cat = [-1], $maxAge = -1, $minSize = 0)
public function moviesSearch($imDbId, $offset = 0, $limit = 100, $name = '', array $cat = [-1], $maxAge = -1, $minSize = 0): array
{
$query = Release::query()->remember(config('nntmux.cache_expiry_medium'))->where('r.nzbstatus', NZB::NZB_ADDED)
->whereBetween('r.categories_id', [Category::MOVIE_ROOT, Category::MOVIE_OTHER]);
if ($name !== '') {
$query->join('releases_se as rse', 'rse.id', '=', 'r.id');
$this->releaseSearch->getSearchSQL(['searchname' => $name], $query, true);
$whereSql = sprintf(
'%s
WHERE r.categories_id BETWEEN '.Category::MOVIE_ROOT.' AND '.Category::MOVIE_OTHER.'
AND r.nzbstatus = %d
AND r.passwordstatus %s
%s %s %s %s %s',
($name !== '' ? $this->releaseSearch->getFullTextJoinString() : ''),
NZB::NZB_ADDED,
$this->showPasswords,
($name !== '' ? $this->releaseSearch->getSearchSQL(['searchname' => $name]) : ''),
(($imDbId !== -1 && is_numeric($imDbId)) ? sprintf(' AND imdbid = %d ', str_pad($imDbId, 7, '0', STR_PAD_LEFT)) : ''),
Category::getCategorySearch($cat),
($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : ''),
($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '')
);
$baseSql = sprintf(
"SELECT r.*,
concat(cp.title, ' > ', c.title) AS category_name,
%s AS category_ids,
g.name AS group_name,
rn.releases_id AS nfoid
FROM releases r
LEFT JOIN groups g ON g.id = r.groups_id
LEFT JOIN categories c ON c.id = r.categories_id
LEFT JOIN categories cp ON cp.id = c.parentid
LEFT OUTER JOIN release_nfos rn ON rn.releases_id = r.id
%s",
$this->getConcatenatedCategoryIDs(),
$whereSql
);
$sql = sprintf(
'%s
ORDER BY postdate DESC
LIMIT %d OFFSET %d',
$baseSql,
$limit,
$offset
);
$releases = Cache::get(md5($sql));
if ($releases !== null) {
return $releases;
}
if ($imDbId !== -1) {
$query->where('r.imdbid', str_pad($imDbId, 7, '0', STR_PAD_LEFT));
$releases = DB::select($sql);
if (! empty($releases) && \count($releases) > 0) {
$releases['_totalrows'] = $this->getPagerCount($baseSql);
}
self::showPasswords($query, true);
Category::getCategorySearch($cat, $query, true);
if ($maxAge > 0) {
$query->where('r.postdate', '>', Carbon::now()->subDays($maxAge));
}
if ($minSize > 0) {
$query->where('r.size', '>=', $minSize);
}
$query->select(
[
'r.*',
DB::raw("CONCAT(cp.title, ' > ', c.title) as category_name"),
'g.name as group_name',
'rn.releases_id as nfoid',
]
)
->from('releases as r')
->leftJoin('categories as c', 'c.id', '=', 'r.categories_id')
->leftJoin('categories as cp', 'cp.id', '=', 'c.parentid')
->leftJoin('groups as g', 'g.id', '=', 'r.groups_id')
->leftJoin('release_nfos as rn', 'rn.releases_id', '=', 'r.id')
->orderByDesc('r.postdate')
->limit($limit);
return $query->paginate(config('nntmux.items_per_page'));
$expiresAt = Carbon::now()->addMinutes(config('nntmux.cache_expiry_medium'));
Cache::put(md5($sql), $releases, $expiresAt);
return $releases;
}
/**
@@ -1000,4 +1024,28 @@ class Releases
return $zipFile->file();
}
/**
* Get count of releases for pager.
*
* @param string $query The query to get the count from.
*
* @return int
*/
private function getPagerCount($query): int
{
$sql = sprintf(
'SELECT COUNT(z.id) AS count FROM (%s LIMIT %s) z',
preg_replace('/SELECT.+?FROM\s+releases/is', 'SELECT r.id FROM releases', $query),
config('nntmux.max_pager_results')
);
$count = Cache::get(md5($sql));
if ($count !== null) {
return $count;
}
$count = DB::select($sql);
$expiresAt = Carbon::now()->addMinutes(config('nntmux.cache_expiry_short'));
Cache::put(md5($sql), $count[0]->count, $expiresAt);
return $count[0]->count ?? 0;
}
}
+7 -5
View File
@@ -60,10 +60,10 @@ class API extends Capabilities
{
if ($releases && \count($releases)) {
foreach ($releases as $key => $release) {
if (isset($release['id'])) {
$language = AudioData::query()->where('releases_id', $release['id'])->first(['audiolanguage']);
if (isset($release->id)) {
$language = AudioData::query()->where('releases_id', $release->id)->first(['audiolanguage']);
if ($language !== null) {
$releases[$key]['searchname'] = $releases[$key]['searchname'].' '.$language['audiolanguage'];
$releases[$key]->searchname = $releases[$key]->searchname.' '.$language['audiolanguage'];
}
}
}
@@ -177,8 +177,10 @@ class API extends Capabilities
{
if ($releases && \count($releases)) {
foreach ($releases as $key => $release) {
$coverURL = $getCoverURL($release);
$releases[$key]['coverurl'] = $coverURL;
if (isset($release->id)) {
$coverURL = $getCoverURL($release);
$releases[$key]->coverurl = $coverURL;
}
}
}
}
+59 -57
View File
@@ -348,8 +348,8 @@ class XML_Response
{
if ($this->releases instanceof LengthAwarePaginator) {
$total = $this->releases->total();
} elseif (isset($this->releases[0]['_totalrows'])) {
$total = $this->releases[0]['_totalrows'];
} elseif (isset($this->releases[0]->_totalrows)) {
$total = $this->releases[0]->_totalrows;
} else {
$total = 0;
}
@@ -366,10 +366,12 @@ class XML_Response
{
if (! empty($this->releases)) {
foreach ($this->releases as $this->release) {
$this->xml->startElement('item');
$this->includeReleaseMain();
$this->setZedAttributes();
$this->xml->endElement();
if (isset($this->release->id)) {
$this->xml->startElement('item');
$this->includeReleaseMain();
$this->setZedAttributes();
$this->xml->endElement();
}
}
}
}
@@ -379,22 +381,22 @@ class XML_Response
*/
public function includeReleaseMain(): void
{
$this->xml->writeElement('title', $this->release['searchname']);
$this->xml->writeElement('title', $this->release->searchname);
$this->xml->startElement('guid');
$this->xml->writeAttribute('isPermaLink', 'true');
$this->xml->text("{$this->server['server']['url']}details/{$this->release['guid']}");
$this->xml->text("{$this->server['server']['url']}details/{$this->release->guid}");
$this->xml->endElement();
$this->xml->writeElement(
'link',
"{$this->server['server']['url']}getnzb?id={$this->release['guid']}.nzb".
"{$this->server['server']['url']}getnzb?id={$this->release->guid}.nzb".
"&i={$this->parameters['uid']}"."&r={$this->parameters['token']}".
((int) $this->parameters['del'] === 1 ? '&del=1' : '')
);
$this->xml->writeElement('comments', "{$this->server['server']['url']}details/{$this->release['guid']}#comments");
$this->xml->writeElement('pubDate', date(DATE_RSS, strtotime($this->release['adddate'])));
$this->xml->writeElement('category', $this->release['category_name']);
$this->xml->writeElement('comments', "{$this->server['server']['url']}details/{$this->release->guid}#comments");
$this->xml->writeElement('pubDate', date(DATE_RSS, strtotime($this->release->adddate)));
$this->xml->writeElement('category', $this->release->category_name);
if ($this->namespace === 'newznab') {
$this->xml->writeElement('description', $this->release['searchname']);
$this->xml->writeElement('description', $this->release->searchname);
} else {
$this->writeRssCdata();
}
@@ -402,11 +404,11 @@ class XML_Response
$this->xml->startElement('enclosure');
$this->xml->writeAttribute(
'url',
"{$this->server['server']['url']}getnzb?id={$this->release['guid']}.nzb".
"{$this->server['server']['url']}getnzb?id={$this->release->guid}.nzb".
"&i={$this->parameters['uid']}"."&r={$this->parameters['token']}".
((int) $this->parameters['del'] === 1 ? '&del=1' : '')
);
$this->xml->writeAttribute('length', $this->release['size']);
$this->xml->writeAttribute('length', $this->release->size);
$this->xml->writeAttribute('type', 'application/x-nzb');
$this->xml->endElement();
}
@@ -417,45 +419,45 @@ class XML_Response
*/
protected function setZedAttributes(): void
{
$this->writeZedAttr('category', $this->release['categories_id']);
$this->writeZedAttr('size', $this->release['size']);
if (isset($this->release['coverurl']) && ! empty($this->release['coverurl'])) {
$this->writeZedAttr('category', $this->release->categories_id);
$this->writeZedAttr('size', $this->release->size);
if (isset($this->release->coverurl) && ! empty($this->release->coverurl)) {
$this->writeZedAttr(
'coverurl',
$this->server['server']['url']."covers/{$this->release['coverurl']}"
$this->server['server']['url']."covers/{$this->release->coverurl}"
);
}
if ((int) $this->parameters['extended'] === 1) {
$this->writeZedAttr('files', $this->release['totalpart']);
$this->writeZedAttr('poster', $this->release['fromname']);
if (($this->release['videos_id'] > 0 || $this->release['tv_episodes_id'] > 0) && $this->namespace === 'newznab') {
$this->writeZedAttr('files', $this->release->totalpart);
$this->writeZedAttr('poster', $this->release->fromname);
if (($this->release->videos_id > 0 || $this->release->tv_episodes_id > 0) && $this->namespace === 'newznab') {
$this->setTvAttr();
}
if (isset($this->release['imdbid']) && $this->release['imdbid'] > 0) {
$this->writeZedAttr('imdb', $this->release['imdbid']);
if (isset($this->release->imdbid) && $this->release->imdbid > 0) {
$this->writeZedAttr('imdb', $this->release->imdbid);
}
if (isset($this->release['anidbid']) && $this->release['anidbid'] > 0) {
$this->writeZedAttr('anidbid', $this->release['anidbid']);
if (isset($this->release->anidbid) && $this->release->anidbid > 0) {
$this->writeZedAttr('anidbid', $this->release->anidbid);
}
if (isset($this->release['predb_id']) && $this->release['predb_id'] > 0) {
if (isset($this->release->predb_id) && $this->release->predb_id > 0) {
$this->writeZedAttr('prematch', 1);
}
if (isset($this->release['nfostatus']) && (int) $this->release['nfostatus'] === 1) {
if (isset($this->release->nfostatus) && (int) $this->release->nfostatus === 1) {
$this->writeZedAttr(
'info',
$this->server['server']['url'].
"api?t=info&id={$this->release['guid']}&r={$this->parameters['token']}"
"api?t=info&id={$this->release->guid}&r={$this->parameters['token']}"
);
}
$this->writeZedAttr('grabs', $this->release['grabs']);
$this->writeZedAttr('comments', $this->release['comments']);
$this->writeZedAttr('password', $this->release['passwordstatus']);
$this->writeZedAttr('usenetdate', date_format(date_create($this->release['postdate']), 'D, d M Y H:i:s O'));
if (! empty($this->release['group_name'])) {
$this->writeZedAttr('group', $this->release['group_name']);
$this->writeZedAttr('grabs', $this->release->grabs);
$this->writeZedAttr('comments', $this->release->comments);
$this->writeZedAttr('password', $this->release->passwordstatus);
$this->writeZedAttr('usenetdate', date_format(date_create($this->release->postdate), 'D, d M Y H:i:s O'));
if (! empty($this->release->group_name)) {
$this->writeZedAttr('group', $this->release->group_name);
}
}
}
@@ -465,36 +467,36 @@ class XML_Response
*/
protected function setTvAttr(): void
{
if (! empty($this->release['title'])) {
$this->writeZedAttr('title', $this->release['title']);
if (! empty($this->release->title)) {
$this->writeZedAttr('title', $this->release->title);
}
if (isset($this->release['series']) && $this->release['series'] > 0) {
$this->writeZedAttr('season', $this->release['series']);
if (isset($this->release->series) && $this->release->series > 0) {
$this->writeZedAttr('season', $this->release->series);
}
if (isset($this->release['episode']) && $this->release['episode'] > 0) {
$this->writeZedAttr('episode', $this->release['episode']);
if (isset($this->release->episode) && $this->release->episode > 0) {
$this->writeZedAttr('episode', $this->release->episode);
}
if (! empty($this->release['firstaired'])) {
$this->writeZedAttr('tvairdate', $this->release['firstaired']);
if (! empty($this->release->firstaired)) {
$this->writeZedAttr('tvairdate', $this->release->firstaired);
}
if (isset($this->release['tvdb']) && $this->release['tvdb'] > 0) {
$this->writeZedAttr('tvdbid', $this->release['tvdb']);
if (isset($this->release->tvdb) && $this->release->tvdb > 0) {
$this->writeZedAttr('tvdbid', $this->release->tvdb);
}
if (isset($this->release['trakt']) && $this->release['trakt'] > 0) {
$this->writeZedAttr('traktid', $this->release['trakt']);
if (isset($this->release->trakt) && $this->release->trakt > 0) {
$this->writeZedAttr('traktid', $this->release->trakt);
}
if (isset($this->release['tvrage']) && $this->release['tvrage'] > 0) {
$this->writeZedAttr('tvrageid', $this->release['tvrage']);
$this->writeZedAttr('rageid', $this->release['tvrage']);
if (isset($this->release->tvrage) && $this->release->tvrage > 0) {
$this->writeZedAttr('tvrageid', $this->release->tvrage);
$this->writeZedAttr('rageid', $this->release->tvrage);
}
if (isset($this->release['tvmaze']) && $this->release['tvmaze'] > 0) {
$this->writeZedAttr('tvmazeid', $this->release['tvmaze']);
if (isset($this->release->tvmaze) && $this->release->tvmaze > 0) {
$this->writeZedAttr('tvmazeid', $this->release->tvmaze);
}
if (isset($this->release['imdb']) && $this->release['imdb'] > 0) {
$this->writeZedAttr('imdbid', str_pad($this->release['imdb'], 7, '0', STR_PAD_LEFT));
if (isset($this->release->imdb) && $this->release->imdb > 0) {
$this->writeZedAttr('imdbid', str_pad($this->release->imdb, 7, '0', STR_PAD_LEFT));
}
if (isset($this->release['tmdb']) && $this->release['tmdb'] > 0) {
$this->writeZedAttr('tmdbid', $this->release['tmdb']);
if (isset($this->release->tmdb) && $this->release->tmdb > 0) {
$this->writeZedAttr('tmdbid', $this->release->tmdb);
}
}
@@ -593,7 +595,7 @@ class XML_Response
$this->writeRssConsoleInfo();
}
$w->startElement('description');
$w->writeCData($this->cdata."\t</div>");
$w->writeCdata($this->cdata."\t</div>");
$w->endElement();
}
+2
View File
@@ -1,3 +1,5 @@
2018-05-14 DariusIII
* Chg: Update Releases class, controllers and API responses
2018-05-12 DariusIII
* Chg: Use function to call paginator
* Chg: Update Adult and Music pages
+1 -1
View File
@@ -50,7 +50,7 @@ class AdultController extends BasePageController
$page = $request->has('page') ? $request->input('page') : 1;
$offset = ($page - 1) * config('nntmux.items_per_cover_page');
$rslt = $adult->getXXXRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, -1, $this->userdata['categoryexclusions']);
$results = $this->paginate($rslt, $rslt['_totalcount'], config('nntmux.items_per_cover_page'), $page, $request->url());
$results = $this->paginate($rslt, $rslt['_totalcount'], config('nntmux.items_per_cover_page'), $page, $request->url(), $request->query());
foreach ($results as $result) {
if (! empty($result->id)) {
$result->genre = makeFieldLinks((array) $result, 'genre', 'movies');
+8 -2
View File
@@ -124,6 +124,7 @@ class ApiController extends BasePageController
$groupName = $api->group();
UserRequest::addApiRequest($uid, $request->getRequestUri());
$categoryID = $api->categoryID();
$limit = $api->limit();
if ($request->has('q')) {
$relData = $releases->search(
@@ -138,6 +139,7 @@ class ApiController extends BasePageController
0,
-1,
-1,
$limit,
'',
$maxAge,
$catExclusions,
@@ -147,7 +149,10 @@ class ApiController extends BasePageController
);
} else {
$relData = $releases->getBrowseRange(
1,
$categoryID,
$offset,
$limit,
'',
$maxAge,
$catExclusions,
@@ -192,11 +197,11 @@ class ApiController extends BasePageController
}
$relData = $releases->tvSearch(
1,
$siteIdArr,
$series,
$episode,
$airdate ?? '',
$api->offset(),
$api->limit(),
$request->input('q') ?? '',
$api->categoryID(),
@@ -219,6 +224,7 @@ class ApiController extends BasePageController
$relData = $releases->moviesSearch(
$imdbId,
$api->offset(),
$api->limit(),
$request->input('q') ?? '',
$api->categoryID(),
@@ -229,7 +235,7 @@ class ApiController extends BasePageController
$api->addCoverURL(
$relData,
function ($release) {
return Utility::getCoverURL(['type' => 'movies', 'id' => $release['imdbid']]);
return Utility::getCoverURL(['type' => 'movies', 'id' => $release->imdbid]);
}
);
+5 -3
View File
@@ -95,15 +95,17 @@ class BasePageController extends Controller
/**
* @param $query
* @param $totalcount
* @param $totalCount
* @param $items
* @param $page
* @param $path
* @param $reqQuery
*
* @return \Illuminate\Pagination\LengthAwarePaginator
*/
public function paginate($query, $totalcount, $items, $page, $path)
public function paginate($query, $totalCount, $items, $page, $path, $reqQuery)
{
return new LengthAwarePaginator($query, $totalcount, $items, $page, ['path' => $path]);
return new LengthAwarePaginator($query, $totalCount, $items, $page, ['path' => $path, 'query' => $reqQuery]);
}
/**
+1 -1
View File
@@ -53,7 +53,7 @@ class BooksController extends BasePageController
$page = $request->has('page') ? $request->input('page') : 1;
$offset = ($page - 1) * config('nntmux.items_per_cover_page');
$rslt = $book->getBookRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, $this->userdata['categoryexclusions']);
$results = $this->paginate($rslt, $rslt['_totalcount'], config('nntmux.items_per_cover_page'), $page, $request->url());
$results = $this->paginate($rslt, $rslt['_totalcount'], config('nntmux.items_per_cover_page'), $page, $request->url(), $request->query());
$maxwords = 50;
foreach ($results as $result) {
if (! empty($result->overview)) {
+3 -3
View File
@@ -28,7 +28,7 @@ class BrowseController extends BasePageController
$offset = ($page - 1) * config('nntmux.items_per_page');
$rslt = $releases->getBrowseRange($page, [-1], $offset, config('nntmux.items_per_page'), $orderby, -1, $this->userdata['categoryexclusions'], -1);
$results = $this->paginate($rslt, $rslt['_totalcount'], config('nntmux.items_per_page'), $page, request()->url());
$results = $this->paginate($rslt, $rslt['_totalcount'], config('nntmux.items_per_page'), $page, request()->url(), request()->query());
$this->smarty->assign('catname', 'All');
@@ -85,7 +85,7 @@ class BrowseController extends BasePageController
$offset = ($page - 1) * config('nntmux.items_per_page');
$rslt = $releases->getBrowseRange($page, $catarray, $offset, config('nntmux.items_per_page'), $orderby, -1, $this->userdata['categoryexclusions'], $grp);
$results = $this->paginate($rslt, $rslt['_totalcount'], config('nntmux.items_per_page'), $page, request()->url());
$results = $this->paginate($rslt, $rslt['_totalcount'], config('nntmux.items_per_page'), $page, request()->url(), request()->query());
$this->smarty->assign('catname', $id);
@@ -147,7 +147,7 @@ class BrowseController extends BasePageController
$page = \request()->has('page') ? \request()->input('page') : 1;
$offset = ($page - 1) * config('nntmux.items_per_page');
$rslt = $releases->getBrowseRange($page, [-1], $offset, config('nntmux.items_per_page'), '', -1, $this->userdata['categoryexclusions'], $group);
$results = $this->paginate($rslt, $rslt['_totalcount'], config('nntmux.items_per_page'), $page, request()->url());
$results = $this->paginate($rslt, $rslt['_totalcount'], config('nntmux.items_per_page'), $page, request()->url(), request()->query());
$this->smarty->assign('results', $results);
$meta_title = 'Browse Groups';
$meta_keywords = 'browse,nzb,description,details';
+1 -1
View File
@@ -53,7 +53,7 @@ class ConsoleController extends BasePageController
$consoles = [];
$rslt = $console->getConsoleRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, $this->userdata['categoryexclusions']);
$results = $this->paginate($rslt, $rslt['_totalcount'], config('nntmux.items_per_cover_page'), $page, $request->url());
$results = $this->paginate($rslt, $rslt['_totalcount'], config('nntmux.items_per_cover_page'), $page, $request->url(), $request->query());
$maxwords = 50;
foreach ($results as $result) {
+1 -1
View File
@@ -41,7 +41,7 @@ class GamesController extends BasePageController
$orderby = request()->has('ob') && \in_array(request()->input('ob'), $ordering, false) ? request()->input('ob') : '';
$offset = ($page - 1) * config('nntmux.items_per_cover_page');
$rslt = $games->getGamesRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, '', $this->userdata['categoryexclusions']);
$results = $this->paginate($rslt, $rslt['_totalcount'], config('nntmux.items_per_cover_page'), $page, $request->url());
$results = $this->paginate($rslt, $rslt['_totalcount'], config('nntmux.items_per_cover_page'), $page, $request->url(), $request->query());
$title = ($request->has('title') && ! empty($request->input('title'))) ? stripslashes($request->input('title')) : '';
$this->smarty->assign('title', $title);
+1 -1
View File
@@ -108,7 +108,7 @@ class MovieController extends BasePageController
$movies = [];
$rslt = $movie->getMovieRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, -1, $this->userdata['categoryexclusions']);
$results = $this->paginate($rslt, $rslt['_totalcount'], config('nntmux.items_per_cover_page'), $page, $request->url());
$results = $this->paginate($rslt, $rslt['_totalcount'], config('nntmux.items_per_cover_page'), $page, $request->url(), $request->query());
foreach ($results as $result) {
if (! empty($result->id)) {
+1 -1
View File
@@ -54,7 +54,7 @@ class MusicController extends BasePageController
$musics = [];
$rslt = $music->getMusicRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, $this->userdata['categoryexclusions']);
$results = $this->paginate($rslt, $rslt['_totalcount'][0]->total, config('nntmux.items_per_cover_page'), $page, $request->url());
$results = $this->paginate($rslt, $rslt['_totalcount'][0]->total, config('nntmux.items_per_cover_page'), $page, $request->url(), $request->query());
$artist = ($request->has('artist') && ! empty($request->input('artist'))) ? stripslashes($request->input('artist')) : '';
$this->smarty->assign('artist', $artist);
+9 -2
View File
@@ -32,6 +32,8 @@ class SearchController extends BasePageController
$ordering = $releases->getBrowseOrdering();
$orderBy = ($request->has('ob') && \in_array($request->input('ob'), $ordering, false) ? $request->input('ob') : '');
$page = $request->has('page') ? $request->input('page') : 1;
$offset = ($page - 1) * config('nntmux.items_per_page');
$this->smarty->assign(
[
@@ -63,7 +65,7 @@ class SearchController extends BasePageController
);
}
$results = $releases->search(
$rslt = $releases->search(
$searchString,
-1,
-1,
@@ -75,6 +77,8 @@ class SearchController extends BasePageController
0,
-1,
-1,
$offset,
config('nntmux.items_per_page'),
$orderBy,
-1,
$this->userdata['categoryexclusions'],
@@ -82,6 +86,8 @@ class SearchController extends BasePageController
$categoryID
);
$results = $this->paginate($rslt, $rslt['_totalrows'], config('nntmux.items_per_page'), $page, $request->url(), $request->query());
$this->smarty->assign(
[
'lastvisit' => $this->userdata['lastlogin'],
@@ -171,7 +177,8 @@ You can combine some of these rules, but not all.<br />';
-1 => '--Select--', 1 => '100MB', 2 => '250MB', 3 => '500MB', 4 => '1GB', 5 => '2GB',
6 => '3GB', 7 => '4GB', 8 => '8GB', 9 => '16GB', 10 => '32GB', 11 => '64GB',
],
'results' => $results, 'sadvanced' => $searchType !== 'basic',
'results' => $results,
'sadvanced' => $searchType !== 'basic',
'grouplist' => Group::getGroupsForSelect(),
'catlist' => Category::getForSelect(),
'search_description' => $search_description,
+2 -1
View File
@@ -35,8 +35,9 @@ class SeriesController extends BasePageController
$catarray[] = $category;
$page = $request->has('page') ? $request->input('page') : 1;
$offset = ($page - 1) * config('nntmux.items_per_page');
$rel = $releases->tvSearch($page, ['id' => $id], '', '', '', 1000, '', $catarray, -1);
$rel = $releases->tvSearch(['id' => $id], '', '', '', $offset, 1000, '', $catarray, -1);
$show = Video::getByVideoID($id);
Generated
+50 -25
View File
@@ -312,7 +312,8 @@
"Gemfile.lock",
"*.md"
]
}
},
"time": "2016-06-06T17:37:52+00:00"
},
{
"name": "bower-asset/autosize",
@@ -341,7 +342,8 @@
"form",
"textarea",
"ui"
]
],
"time": "2017-05-19T15:36:30+00:00"
},
{
"name": "bower-asset/bootstrap",
@@ -390,7 +392,8 @@
"mobile-first",
"responsive",
"web"
]
],
"time": "2016-07-25T15:51:55+00:00"
},
{
"name": "bower-asset/bootstrap-3.x",
@@ -439,7 +442,8 @@
"mobile-first",
"responsive",
"web"
]
],
"time": "2016-07-25T15:51:55+00:00"
},
{
"name": "bower-asset/bootstrap-datepicker",
@@ -468,7 +472,8 @@
},
"license": [
"Apache-2.0"
]
],
"time": "2016-08-05T09:50:13+00:00"
},
{
"name": "bower-asset/bootstrap-hover-dropdown",
@@ -498,7 +503,8 @@
"dropdowns",
"hover",
"twitter"
]
],
"time": "2015-12-01T23:35:57+00:00"
},
{
"name": "bower-asset/bootstrap-progressbar",
@@ -532,7 +538,8 @@
},
"license": [
"MIT"
]
],
"time": "2015-05-15T18:56:17+00:00"
},
{
"name": "bower-asset/bootswatch",
@@ -663,7 +670,8 @@
"modal",
"popup",
"ui"
]
],
"time": "2016-05-10T22:21:33+00:00"
},
{
"name": "bower-asset/datatables",
@@ -711,7 +719,8 @@
"jquery",
"library",
"table"
]
],
"time": "2017-08-31T13:52:17+00:00"
},
{
"name": "bower-asset/fancybox",
@@ -777,7 +786,8 @@
"tests",
"examples"
]
}
},
"time": "2015-01-26T21:19:01+00:00"
},
{
"name": "bower-asset/flexboxgrid",
@@ -813,7 +823,8 @@
"css",
"flexbox",
"grid"
]
],
"time": "2016-08-14T16:43:18+00:00"
},
{
"name": "bower-asset/font-awesome",
@@ -858,7 +869,8 @@
"src",
"build.xml"
]
}
},
"time": "2015-07-20T20:04:00+00:00"
},
{
"name": "bower-asset/icheck",
@@ -908,7 +920,8 @@
"replacement",
"skins",
"ui"
]
],
"time": "2014-03-03T17:36:28+00:00"
},
{
"name": "bower-asset/jquery",
@@ -971,7 +984,8 @@
"javascript",
"jquery",
"library"
]
],
"time": "2016-05-20T17:24:43+00:00"
},
{
"name": "bower-asset/jquery-3.2.x",
@@ -1038,7 +1052,8 @@
"scroll",
"scrolltop",
"scrolltotop"
]
],
"time": "2017-08-31T15:51:29+00:00"
},
{
"name": "bower-asset/jquery-migrate-1.4.x",
@@ -1057,7 +1072,8 @@
"type": "bower-asset-library",
"extra": {
"bower-asset-main": "jquery-migrate.js"
}
},
"time": "2016-04-15T06:38:34+00:00"
},
{
"name": "bower-asset/jquery-migrate-3.0.x",
@@ -1076,7 +1092,8 @@
"type": "bower-asset-library",
"extra": {
"bower-asset-main": "jquery-migrate.js"
}
},
"time": "2016-06-10T14:28:59+00:00"
},
{
"name": "bower-asset/jquery.nicescroll",
@@ -1106,7 +1123,8 @@
"demo",
"package.json"
]
}
},
"time": "2016-03-01T20:38:24+00:00"
},
{
"name": "bower-asset/material-design-iconic-font",
@@ -1145,7 +1163,8 @@
"font",
"icons",
"material"
]
],
"time": "2015-11-08T04:50:28+00:00"
},
{
"name": "bower-asset/materialize",
@@ -1204,7 +1223,8 @@
"responsive",
"sass",
"ux"
]
],
"time": "2017-04-15T01:39:28+00:00"
},
{
"name": "bower-asset/pace",
@@ -1250,7 +1270,8 @@
"progress",
"progress",
"spinner"
]
],
"time": "2014-11-06T16:31:34+00:00"
},
{
"name": "bower-asset/pnotify",
@@ -1302,7 +1323,8 @@
"license": [
"Apache-2.0"
],
"description": "JavaScript notification plugin."
"description": "JavaScript notification plugin.",
"time": "2017-07-31T21:50:29+00:00"
},
{
"name": "bower-asset/respond",
@@ -1326,7 +1348,8 @@
"test"
]
},
"description": "Fast and lightweight polyfill for min/max-width CSS3 Media Queries (for IE 6-8, and more)"
"description": "Fast and lightweight polyfill for min/max-width CSS3 Media Queries (for IE 6-8, and more)",
"time": "2013-12-19T04:44:31+00:00"
},
{
"name": "bower-asset/responsive-tables-js",
@@ -1356,7 +1379,8 @@
"jquery",
"responsive",
"table"
]
],
"time": "2015-10-08T14:18:04+00:00"
},
{
"name": "bower-asset/select2",
@@ -1424,7 +1448,8 @@
"scrolling",
"slimscroll",
"ui"
]
],
"time": "2016-06-11T09:19:14+00:00"
},
{
"name": "bower-asset/tinymce-dist",
+57 -57
View File
@@ -216,139 +216,139 @@
</thead>
<tbody>
{foreach $results as $result}
<tr class="{cycle values=",alt"}{if $lastvisit|strtotime<$result.adddate|strtotime} new{/if}"
id="guid{$result.guid}">
<tr class="{cycle values=",alt"}{if $lastvisit|strtotime<$result->adddate|strtotime} new{/if}"
id="guid{$result->guid}">
<td class="check">
<input id="chk{$result.guid|substr:0:7}" type="checkbox" class="square"
value="{$result.guid}">
<input id="chk{$result->guid|substr:0:7}" type="checkbox" class="square"
value="{$result->guid}">
</td>
<td class="item">
<label for="chk{$result.guid|substr:0:7}">
<label for="chk{$result->guid|substr:0:7}">
<a class="title" title="View details"
href="{$smarty.const.WWW_TOP}/details/{$result.guid}/{$result.searchname|escape:"htmlall"}">{$result.searchname|escape:"htmlall"|truncate:150:"...":true}</a>{if !empty($result.failed)}
href="{$smarty.const.WWW_TOP}/details/{$result->guid}/{$result->searchname|escape:"htmlall"}">{$result->searchname|escape:"htmlall"|truncate:150:"...":true}</a>{if !empty($result->failed)}
<i class="zmdi zmdi-alarm" style="color: red"
title="This release has failed to download for some users"></i>{/if}
</label value="Searchname">
<div class="resextra">
<div class="btns" style="float:right">
{release_flag($result.searchname, browse)}
{if $result.passwordstatus == 1}
{release_flag($result->searchname, browse)}
{if $result->passwordstatus == 1}
<img title="RAR/ZIP Possibly Passworded."
src="{$smarty.const.WWW_ASSETS}/images/icons/lock2.png"
alt="RAR/ZIP Possibly Passworded.">
{elseif $result.passwordstatus == 2}
{elseif $result->passwordstatus == 2}
<img title="RAR/ZIP Possibly Damaged."
src="{$smarty.const.WWW_ASSETS}/images/icons/broken.png"
alt="RAR/ZIP Possibly Damaged.">
{elseif $result.passwordstatus == 10}
{elseif $result->passwordstatus == 10}
<img title="RAR/ZIP is Passworded."
src="{$smarty.const.WWW_ASSETS}/images/icons/lock.gif"
alt="RAR/ZIP is Passworded.">
{/if}
{if $result.videostatus > 0}
{if $result->videostatus > 0}
<a
class="model_prev label label-default"
href="{$smarty.const.WWW_TOP}/details/{$result.guid}"
href="{$smarty.const.WWW_TOP}/details/{$result->guid}"
title="This release has a video preview."
rel="preview"
><i class="icon-youtube-play"></i>
</a>
{/if}
{if $result.nfoid > 0}
<a href="{$smarty.const.WWW_TOP}/nfo/{$result.guid}" title="View Nfo"
{if $result->nfoid > 0}
<a href="{$smarty.const.WWW_TOP}/nfo/{$result->guid}" title="View Nfo"
class="modal_nfo label label-default" rel="nfo">Nfo</a>
{/if}
{if $result.imdbid > 0}
<a href="#" name="name{$result.imdbid}" title="View movie info"
{if $result->imdbid > 0}
<a href="#" name="name{$result->imdbid}" title="View movie info"
class="modal_imdb label label-default" rel="movie">Cover</a>
{/if}
{if $result.haspreview == 1 && $userdata.canpreview == 1}
<a href="{$smarty.const.WWW_TOP}/covers/preview/{$result.guid}_thumb.jpg"
name="name{$result.guid}"
title="Screenshot of {$result.searchname|escape:"htmlall"}"
{if $result->haspreview == 1 && $userdata.canpreview == 1}
<a href="{$smarty.const.WWW_TOP}/covers/preview/{$result->guid}_thumb.jpg"
name="name{$result->guid}"
title="Screenshot of {$result->searchname|escape:"htmlall"}"
class="modal_prev label label-default" rel="preview">Preview</a>{/if}
{if $result.jpgstatus == 1 && $userdata.canpreview == 1}
<a href="{$smarty.const.WWW_TOP}/covers/sample/{$result.guid}_thumb.jpg"
name="name{$result.guid}"
title="Sample of {$result.searchname|escape:"htmlall"}"
{if $result->jpgstatus == 1 && $userdata.canpreview == 1}
<a href="{$smarty.const.WWW_TOP}/covers/sample/{$result->guid}_thumb.jpg"
name="name{$result->guid}"
title="Sample of {$result->searchname|escape:"htmlall"}"
class="modal_prev label label-default" rel="preview">Sample</a>{/if}
{if $result.musicinfo_id > 0}
<a href="#" name="name{$result.musicinfo_id}" title="View music info"
{if $result->musicinfo_id > 0}
<a href="#" name="name{$result->musicinfo_id}" title="View music info"
class="modal_music label label-default" rel="music">Cover</a>
{/if}
{if $result.consoleinfo_id > 0}
<a href="#" name="name{$result.consoleinfo_id}" title="View console info"
{if $result->consoleinfo_id > 0}
<a href="#" name="name{$result->consoleinfo_id}" title="View console info"
class="modal_console label label-default" rel="console">Cover</a>
{/if}
{if $result.videos_id > 0}
{if $result->videos_id > 0}
<a class="label label-default"
href="{$smarty.const.WWW_TOP}/series/{$result.videos_id}"
href="{$smarty.const.WWW_TOP}/series/{$result->videos_id}"
title="View all episodes">View
Series</a>
{/if}
{if $result.anidbid > 0}
{if $result->anidbid > 0}
<a class="label label-default"
href="{$smarty.const.WWW_TOP}/anime?id={$result.anidbid}"
href="{$smarty.const.WWW_TOP}/anime?id={$result->anidbid}"
title="View all episodes">View
Anime</a>
{/if}
{if isset($result.firstaired) && $result.firstaired != ''}
{if isset($result->firstaired) && $result->firstaired != ''}
<span class="seriesinfo label label-default"
title="{$result.guid}">Aired {if $result.firstaired|strtotime > $smarty.now}in future{else}{$result.firstaired|daysago}{/if}</span>
title="{$result->guid}">Aired {if $result->firstaired|strtotime > $smarty.now}in future{else}{$result->firstaired|daysago}{/if}</span>
{/if}
{if $result.group_name != ""}
{if $result->group_name != ""}
<a class="label label-default"
href="{$smarty.const.WWW_TOP}/browse/group?g={$result.group_name|escape:"htmlall"}"
title="Browse {$result.group_name}">{$result.group_name|escape:"htmlall"|replace:"alt.binaries.":"a.b."}</a>
href="{$smarty.const.WWW_TOP}/browse/group?g={$result->group_name|escape:"htmlall"}"
title="Browse {$result->group_name}">{$result->group_name|escape:"htmlall"|replace:"alt.binaries.":"a.b."}</a>
{/if}
{if !empty($result.failed)}<span class="label label-default">
{if !empty($result->failed)}<span class="label label-default">
<i class="zmdi zmdi-thumbs-o-up"></i>
{$result.grabs} Grab{if $result.grabs != 1}s{/if} /
{$result->grabs} Grab{if $result->grabs != 1}s{/if} /
<i class="zmdi zmdi-thumbs-o-down"></i>
{$result.failed} Failed Download{if $result.failed != 1}s{/if}</span>
{$result->failed} Failed Download{if $result->failed != 1}s{/if}</span>
{/if}
</div>
</div>
</td>
<td class="category">
<a title="Browse {$result.category_name}"
href="{$smarty.const.WWW_TOP}/browse/{$result.category_name}">{$result.category_name}</a>
<a title="Browse {$result->category_name}"
href="{$smarty.const.WWW_TOP}/browse/{$result->category_name}">{$result->category_name}</a>
</td>
<td class="posted" title="{$result.postdate}">
{$result.postdate|timeago}
<td class="posted" title="{$result->postdate}">
{$result->postdate|timeago}
</td>
<td class="size">
{$result.size|fsize_format:"MB"}
{if $result.completion > 0}
{$result->size|fsize_format:"MB"}
{if $result->completion > 0}
<br>
{if $result.completion < 100}
<span class="warning">{$result.completion}%</span>
{if $result->completion < 100}
<span class="warning">{$result->completion}%</span>
{else}
{$result.completion}%
{$result->completion}%
{/if}
{/if}
</td>
<td class="files">
<a title="View file list"
href="{$smarty.const.WWW_TOP}/filelist/{$result.guid}">{$result.totalpart}</a>
{if $result.rarinnerfilecount > 0}
href="{$smarty.const.WWW_TOP}/filelist/{$result->guid}">{$result->totalpart}</a>
{if $result->rarinnerfilecount > 0}
<div class="rarfilelist">
<img src="{$smarty.const.WWW_ASSETS}/images/icons/magnifier.png"
alt="{$result.guid}">
alt="{$result->guid}">
</div>
{/if}
</td>
<td class="stats">
<a title="View comments"
href="{$smarty.const.WWW_TOP}/details/{$result.guid}/#comments">{$result.comments}
cmt{if $result.comments != 1}s{/if}</a>
<br>{$result.grabs} grab{if $result.grabs != 1}s{/if}
href="{$smarty.const.WWW_TOP}/details/{$result->guid}/#comments">{$result->comments}
cmt{if $result->comments != 1}s{/if}</a>
<br>{$result->grabs} grab{if $result->grabs != 1}s{/if}
</td>
<td class="icon_nzb"><a
href="{$smarty.const.WWW_TOP}/getnzb?id={$result.guid}"><i
href="{$smarty.const.WWW_TOP}/getnzb?id={$result->guid}"><i
class="zmdi zmdi-cloud-download text-muted"
title="Download NZB"></i></a>
<a href="{$smarty.const.WWW_TOP}/details/{$result.guid}/#comments"><i
<a href="{$smarty.const.WWW_TOP}/details/{$result->guid}/#comments"><i
class="zmdi zmdi-comments-o text-muted"
title="Comments"></i></a>
<a href="#" class="icon_cart text-muted"><i
+59 -59
View File
@@ -225,159 +225,159 @@
</thead>
<tbody>
{foreach $results as $result}
<tr class="{cycle values=",alt"}{if $lastvisit|strtotime<$result.adddate|strtotime} new{/if}"
id="guid{$result.guid}">
<tr class="{cycle values=",alt"}{if $lastvisit|strtotime<$result->adddate|strtotime} new{/if}"
id="guid{$result->guid}">
<td>
<input id="chk{$result.guid|substr:0:7}" type="checkbox" class="flat"
value="{$result.guid}">
<input id="chk{$result->guid|substr:0:7}" type="checkbox" class="flat"
value="{$result->guid}">
</td>
<td class="item">
<label for="chk{$result.guid|substr:0:7}">
<label for="chk{$result->guid|substr:0:7}">
<a class="title" title="View details"
href="{$smarty.const.WWW_TOP}/details/{$result.guid}">{$result.searchname|escape:"htmlall"|truncate:150:"...":true}</a>{if !empty($result.failed)}
href="{$smarty.const.WWW_TOP}/details/{$result->guid}">{$result->searchname|escape:"htmlall"|truncate:150:"...":true}</a>{if !empty($result->failed)}
<i class="fa fa-exclamation-circle" style="color: red"
title="This release has failed to download for some users"></i>{/if}
</label value="Searchname">
<div class="resextra">
<div class="btns" style="float:right">
{release_flag($result.searchname, browse)}
{if $result.passwordstatus == 1}
{release_flag($result->searchname, browse)}
{if $result->passwordstatus == 1}
<img title="RAR/ZIP Possibly Passworded."
src="{$smarty.const.WWW_ASSETS}/images/icons/lock2.png"
alt="RAR/ZIP Possibly Passworded.">
{elseif $result.passwordstatus == 2}
{elseif $result->passwordstatus == 2}
<img title="RAR/ZIP Possibly Damaged."
src="{$smarty.const.WWW_ASSETS}/images/icons/broken.png"
alt="RAR/ZIP Possibly Damaged.">
{elseif $result.passwordstatus == 10}
{elseif $result->passwordstatus == 10}
<img title="RAR/ZIP is Passworded."
src="{$smarty.const.WWW_ASSETS}/images/icons/lock.gif"
alt="RAR/ZIP is Passworded.">
{/if}
{if $result.videostatus > 0}
{if $result->videostatus > 0}
<a
class="model_prev label label-primary"
href="{$smarty.const.WWW_TOP}/details/{$result.guid}"
href="{$smarty.const.WWW_TOP}/details/{$result->guid}"
title="This release has a video preview."
rel="preview"
><i class="icon-youtube-play"></i>
</a>
{/if}
{if $result.nfoid > 0}
<a href="{$smarty.const.WWW_TOP}/nfo/{$result.guid}"
{if $result->nfoid > 0}
<a href="{$smarty.const.WWW_TOP}/nfo/{$result->guid}"
title="View Nfo"
class="modal_nfo label label-primary" rel="nfo">Nfo</a>
{/if}
{if $result.imdbid > 0}
<a href="#" name="name{$result.imdbid}" title="View movie info"
{if $result->imdbid > 0}
<a href="#" name="name{$result->imdbid}" title="View movie info"
class="modal_imdb label label-primary" rel="movie">Cover</a>
{/if}
{if $result.haspreview == 1 && $userdata.canpreview == 1}
<a href="{$smarty.const.WWW_TOP}/covers/preview/{$result.guid}_thumb.jpg"
name="name{$result.guid}"
{if $result->haspreview == 1 && $userdata.canpreview == 1}
<a href="{$smarty.const.WWW_TOP}/covers/preview/{$result->guid}_thumb.jpg"
name="name{$result->guid}"
data-fancybox
title="Screenshot of {$result.searchname|escape:"htmlall"}"
title="Screenshot of {$result->searchname|escape:"htmlall"}"
class="label label-primary" rel="preview">Preview</a>{/if}
{if $result.jpgstatus == 1 && $userdata.canpreview == 1}
<a href="{$smarty.const.WWW_TOP}/covers/sample/{$result.guid}_thumb.jpg"
name="name{$result.guid}"
{if $result->jpgstatus == 1 && $userdata.canpreview == 1}
<a href="{$smarty.const.WWW_TOP}/covers/sample/{$result->guid}_thumb.jpg"
name="name{$result->guid}"
data-fancybox
title="Sample of {$result.searchname|escape:"htmlall"}"
title="Sample of {$result->searchname|escape:"htmlall"}"
class="label label-primary" rel="preview">Sample</a>{/if}
{if $result.musicinfo_id > 0}
<a href="#" name="name{$result.musicinfo_id}"
{if $result->musicinfo_id > 0}
<a href="#" name="name{$result->musicinfo_id}"
title="View music info"
class="modal_music label label-primary" rel="music">Cover</a>
{/if}
{if $result.consoleinfo_id > 0}
<a href="#" name="name{$result.consoleinfo_id}"
{if $result->consoleinfo_id > 0}
<a href="#" name="name{$result->consoleinfo_id}"
title="View console info"
class="modal_console label label-primary" rel="console">Cover</a>
{/if}
{if $result.videos_id > 0}
{if $result->videos_id > 0}
<a class="label label-primary"
href="{$smarty.const.WWW_TOP}/series/{$result.videos_id}"
href="{$smarty.const.WWW_TOP}/series/{$result->videos_id}"
title="View all episodes">View
Series</a>
{/if}
{if $result.anidbid > 0}
{if $result->anidbid > 0}
<a class="label label-primary"
href="{$smarty.const.WWW_TOP}/anime?id={$result.anidbid}"
href="{$smarty.const.WWW_TOP}/anime?id={$result->anidbid}"
title="View all episodes">View
Anime</a>
{/if}
{if isset($result.firstaired) && $result.firstaired != ''}
{if isset($result->firstaired) && $result->firstaired != ''}
<span class="seriesinfo label label-primary"
title="{$result.guid}">Aired {if $result.firstaired|strtotime > $smarty.now}in future{else}{$result.firstaired|daysago}{/if}</span>
title="{$result->guid}">Aired {if $result->firstaired|strtotime > $smarty.now}in future{else}{$result->firstaired|daysago}{/if}</span>
{/if}
{if $result.group_name != ""}
{if $result->group_name != ""}
<a class="label label-primary"
href="{$smarty.const.WWW_TOP}/browse/group?g={$result.group_name|escape:"htmlall"}"
title="Browse {$result.group_name}">{$result.group_name|escape:"htmlall"|replace:"alt.binaries.":"a.b."}</a>
href="{$smarty.const.WWW_TOP}/browse/group?g={$result->group_name|escape:"htmlall"}"
title="Browse {$result->group_name}">{$result->group_name|escape:"htmlall"|replace:"alt.binaries.":"a.b."}</a>
{/if}
{if !empty($result.failed)}<span class="label label-primary">
{if !empty($result->failed)}<span class="label label-primary">
<i class="fa fa-thumbs-o-up"></i>
{$result.grabs} Grab{if $result.grabs != 1}s{/if} /
{$result->grabs} Grab{if $result->grabs != 1}s{/if} /
<i class="fa fa-thumbs-o-down"></i>
{$result.failed} Failed Download{if $result.failed != 1}s{/if}
{$result->failed} Failed Download{if $result->failed != 1}s{/if}
</span>
{/if}
</div>
</div>
</td>
<td class="category">
<a title="Browse {$result.category_name}"
href="{$smarty.const.WWW_TOP}/browse/{$result.category_name}">{$result.category_name}</a>
<a title="Browse {$result->category_name}"
href="{$smarty.const.WWW_TOP}/browse/{$result->category_name}">{$result->category_name}</a>
</td>
<td class="posted" title="{$result.postdate}">
{$result.postdate|timeago}
<td class="posted" title="{$result->postdate}">
{$result->postdate|timeago}
</td>
<td class="size">
{$result.size|fsize_format:"MB"}
{if $result.completion > 0}
{$result->size|fsize_format:"MB"}
{if $result->completion > 0}
<br>
{if $result.completion < 100}
<span class="warning">{$result.completion}%</span>
{if $result->completion < 100}
<span class="warning">{$result->completion}%</span>
{else}
{$result.completion}%
{$result->completion}%
{/if}
{/if}
</td>
<td class="files">
<a title="View file list"
href="{$smarty.const.WWW_TOP}/filelist/{$result.guid}">{$result.totalpart}</a>
{if $result.rarinnerfilecount > 0}
href="{$smarty.const.WWW_TOP}/filelist/{$result->guid}">{$result->totalpart}</a>
{if $result->rarinnerfilecount > 0}
<div class="rarfilelist">
<img src="{$smarty.const.WWW_ASSETS}/images/icons/magnifier.png"
alt="{$result.guid}">
alt="{$result->guid}">
</div>
{/if}
</td>
<td class="stats">
<a title="View comments"
href="{$smarty.const.WWW_TOP}/details/{$result.guid}/#comments">{$result.comments}
cmt{if $result.comments != 1}s{/if}</a>
<br>{$result.grabs} grab{if $result.grabs != 1}s{/if}
href="{$smarty.const.WWW_TOP}/details/{$result->guid}/#comments">{$result->comments}
cmt{if $result->comments != 1}s{/if}</a>
<br>{$result->grabs} grab{if $result->grabs != 1}s{/if}
</td>
<td>
<a href="{$smarty.const.WWW_TOP}/getnzb?id={$result.guid}"
<a href="{$smarty.const.WWW_TOP}/getnzb?id={$result->guid}"
class="icon_nzb text-muted"><i
class="fa fa-cloud-download text-muted"
data-toggle="tooltip" data-placement="top" title
data-original-title="Download NZB"></i></a>
<a href="{$smarty.const.WWW_TOP}/details/{$result.guid}/#comments"><i
<a href="{$smarty.const.WWW_TOP}/details/{$result->guid}/#comments"><i
class="fa fa-comments-o text-muted"
data-toggle="tooltip" data-placement="top" title
data-original-title="Comments"></i></a>
<a href="#"><i
id="guid{$result.guid}"
id="guid{$result->guid}"
class="icon_cart text-muted fa fa-shopping-basket"
data-toggle="tooltip"
data-placement="top" title
data-original-title="Send to my download basket"></i></a>
{if isset($sabintegrated) && $sabintegrated !=""}
<a href="#">
<i id="guid{$result.guid}"
<i id="guid{$result->guid}"
class="icon_sab text-muted fa fa-share"
data-toggle="tooltip"
data-placement="top" title
+59 -59
View File
@@ -225,159 +225,159 @@
</thead>
<tbody>
{foreach $results as $result}
<tr class="{cycle values=",alt"}{if $lastvisit|strtotime<$result.adddate|strtotime} new{/if}"
id="guid{$result.guid}">
<tr class="{cycle values=",alt"}{if $lastvisit|strtotime<$result->adddate|strtotime} new{/if}"
id="guid{$result->guid}">
<td>
<input id="chk{$result.guid|substr:0:7}" type="checkbox" class="flat"
value="{$result.guid}">
<input id="chk{$result->guid|substr:0:7}" type="checkbox" class="flat"
value="{$result->guid}">
</td>
<td class="item">
<label for="chk{$result.guid|substr:0:7}">
<label for="chk{$result->guid|substr:0:7}">
<a class="title" title="View details"
href="{$smarty.const.WWW_TOP}/details/{$result.guid}">{$result.searchname|escape:"htmlall"|truncate:150:"...":true}</a>{if !empty($result.failed)}
href="{$smarty.const.WWW_TOP}/details/{$result->guid}">{$result->searchname|escape:"htmlall"|truncate:150:"...":true}</a>{if !empty($result->failed)}
<i class="fa fa-exclamation-circle" style="color: red"
title="This release has failed to download for some users"></i>{/if}
</label value="Searchname">
<div class="resextra">
<div class="btns" style="float:right">
{release_flag($result.searchname, browse)}
{if $result.passwordstatus == 1}
{release_flag($result->searchname, browse)}
{if $result->passwordstatus == 1}
<img title="RAR/ZIP Possibly Passworded."
src="{$smarty.const.WWW_ASSETS}/images/icons/lock2.png"
alt="RAR/ZIP Possibly Passworded.">
{elseif $result.passwordstatus == 2}
{elseif $result->passwordstatus == 2}
<img title="RAR/ZIP Possibly Damaged."
src="{$smarty.const.WWW_ASSETS}/images/icons/broken.png"
alt="RAR/ZIP Possibly Damaged.">
{elseif $result.passwordstatus == 10}
{elseif $result->passwordstatus == 10}
<img title="RAR/ZIP is Passworded."
src="{$smarty.const.WWW_ASSETS}/images/icons/lock.gif"
alt="RAR/ZIP is Passworded.">
{/if}
{if $result.videostatus > 0}
{if $result->videostatus > 0}
<a
class="model_prev label label-primary"
href="{$smarty.const.WWW_TOP}/details/{$result.guid}"
href="{$smarty.const.WWW_TOP}/details/{$result->guid}"
title="This release has a video preview."
rel="preview"
><i class="icon-youtube-play"></i>
</a>
{/if}
{if $result.nfoid > 0}
<a href="{$smarty.const.WWW_TOP}/nfo/{$result.guid}"
{if $result->nfoid > 0}
<a href="{$smarty.const.WWW_TOP}/nfo/{$result->guid}"
title="View Nfo"
class="modal_nfo label label-primary" rel="nfo">Nfo</a>
{/if}
{if $result.imdbid > 0}
<a href="#" name="name{$result.imdbid}" title="View movie info"
{if $result->imdbid > 0}
<a href="#" name="name{$result->imdbid}" title="View movie info"
class="modal_imdb label label-primary" rel="movie">Cover</a>
{/if}
{if $result.haspreview == 1 && $userdata.canpreview == 1}
<a href="{$smarty.const.WWW_TOP}/covers/preview/{$result.guid}_thumb.jpg"
name="name{$result.guid}"
{if $result->haspreview == 1 && $userdata.canpreview == 1}
<a href="{$smarty.const.WWW_TOP}/covers/preview/{$result->guid}_thumb.jpg"
name="name{$result->guid}"
data-fancybox
title="Screenshot of {$result.searchname|escape:"htmlall"}"
title="Screenshot of {$result->searchname|escape:"htmlall"}"
class="label label-primary" rel="preview">Preview</a>{/if}
{if $result.jpgstatus == 1 && $userdata.canpreview == 1}
<a href="{$smarty.const.WWW_TOP}/covers/sample/{$result.guid}_thumb.jpg"
name="name{$result.guid}"
{if $result->jpgstatus == 1 && $userdata.canpreview == 1}
<a href="{$smarty.const.WWW_TOP}/covers/sample/{$result->guid}_thumb.jpg"
name="name{$result->guid}"
data-fancybox
title="Sample of {$result.searchname|escape:"htmlall"}"
title="Sample of {$result->searchname|escape:"htmlall"}"
class="label label-primary" rel="preview">Sample</a>{/if}
{if $result.musicinfo_id > 0}
<a href="#" name="name{$result.musicinfo_id}"
{if $result->musicinfo_id > 0}
<a href="#" name="name{$result->musicinfo_id}"
title="View music info"
class="modal_music label label-primary" rel="music">Cover</a>
{/if}
{if $result.consoleinfo_id > 0}
<a href="#" name="name{$result.consoleinfo_id}"
{if $result->consoleinfo_id > 0}
<a href="#" name="name{$result->consoleinfo_id}"
title="View console info"
class="modal_console label label-primary" rel="console">Cover</a>
{/if}
{if $result.videos_id > 0}
{if $result->videos_id > 0}
<a class="label label-primary"
href="{$smarty.const.WWW_TOP}/series/{$result.videos_id}"
href="{$smarty.const.WWW_TOP}/series/{$result->videos_id}"
title="View all episodes">View
Series</a>
{/if}
{if $result.anidbid > 0}
{if $result->anidbid > 0}
<a class="label label-primary"
href="{$smarty.const.WWW_TOP}/anime?id={$result.anidbid}"
href="{$smarty.const.WWW_TOP}/anime?id={$result->anidbid}"
title="View all episodes">View
Anime</a>
{/if}
{if isset($result.firstaired) && $result.firstaired != ''}
{if isset($result->firstaired) && $result->firstaired != ''}
<span class="seriesinfo label label-primary"
title="{$result.guid}">Aired {if $result.firstaired|strtotime > $smarty.now}in future{else}{$result.firstaired|daysago}{/if}</span>
title="{$result->guid}">Aired {if $result->firstaired|strtotime > $smarty.now}in future{else}{$result->firstaired|daysago}{/if}</span>
{/if}
{if $result.group_name != ""}
{if $result->group_name != ""}
<a class="label label-primary"
href="{$smarty.const.WWW_TOP}/browse/group?g={$result.group_name|escape:"htmlall"}"
title="Browse {$result.group_name}">{$result.group_name|escape:"htmlall"|replace:"alt.binaries.":"a.b."}</a>
href="{$smarty.const.WWW_TOP}/browse/group?g={$result->group_name|escape:"htmlall"}"
title="Browse {$result->group_name}">{$result->group_name|escape:"htmlall"|replace:"alt.binaries.":"a.b."}</a>
{/if}
{if !empty($result.failed)}<span class="label label-primary">
{if !empty($result->failed)}<span class="label label-primary">
<i class="fa fa-thumbs-o-up"></i>
{$result.grabs} Grab{if $result.grabs != 1}s{/if} /
{$result->grabs} Grab{if $result->grabs != 1}s{/if} /
<i class="fa fa-thumbs-o-down"></i>
{$result.failed} Failed Download{if $result.failed != 1}s{/if}
{$result->failed} Failed Download{if $result->failed != 1}s{/if}
</span>
{/if}
</div>
</div>
</td>
<td class="category">
<a title="Browse {$result.category_name}"
href="{$smarty.const.WWW_TOP}/browse/{$result.category_name}">{$result.category_name}</a>
<a title="Browse {$result->category_name}"
href="{$smarty.const.WWW_TOP}/browse/{$result->category_name}">{$result->category_name}</a>
</td>
<td class="posted" title="{$result.postdate}">
{$result.postdate|timeago}
<td class="posted" title="{$result->postdate}">
{$result->postdate|timeago}
</td>
<td class="size">
{$result.size|fsize_format:"MB"}
{if $result.completion > 0}
{$result->size|fsize_format:"MB"}
{if $result->completion > 0}
<br>
{if $result.completion < 100}
<span class="warning">{$result.completion}%</span>
{if $result->completion < 100}
<span class="warning">{$result->completion}%</span>
{else}
{$result.completion}%
{$result->completion}%
{/if}
{/if}
</td>
<td class="files">
<a title="View file list"
href="{$smarty.const.WWW_TOP}/filelist/{$result.guid}">{$result.totalpart}</a>
{if $result.rarinnerfilecount > 0}
href="{$smarty.const.WWW_TOP}/filelist/{$result->guid}">{$result->totalpart}</a>
{if $result->rarinnerfilecount > 0}
<div class="rarfilelist">
<img src="{$smarty.const.WWW_ASSETS}/images/icons/magnifier.png"
alt="{$result.guid}">
alt="{$result->guid}">
</div>
{/if}
</td>
<td class="stats">
<a title="View comments"
href="{$smarty.const.WWW_TOP}/details/{$result.guid}/#comments">{$result.comments}
cmt{if $result.comments != 1}s{/if}</a>
<br>{$result.grabs} grab{if $result.grabs != 1}s{/if}
href="{$smarty.const.WWW_TOP}/details/{$result->guid}/#comments">{$result->comments}
cmt{if $result->comments != 1}s{/if}</a>
<br>{$result->grabs} grab{if $result->grabs != 1}s{/if}
</td>
<td>
<a href="{$smarty.const.WWW_TOP}/getnzb?id={$result.guid}"
<a href="{$smarty.const.WWW_TOP}/getnzb?id={$result->guid}"
class="icon_nzb text-muted"><i
class="fa fa-cloud-download text-muted"
data-toggle="tooltip" data-placement="top" title
data-original-title="Download NZB"></i></a>
<a href="{$smarty.const.WWW_TOP}/details/{$result.guid}/#comments"><i
<a href="{$smarty.const.WWW_TOP}/details/{$result->guid}/#comments"><i
class="fa fa-comments-o text-muted"
data-toggle="tooltip" data-placement="top" title
data-original-title="Comments"></i></a>
<a href="#"><i
id="guid{$result.guid}"
id="guid{$result->guid}"
class="icon_cart text-muted fa fa-shopping-basket"
data-toggle="tooltip"
data-placement="top" title
data-original-title="Send to my download basket"></i></a>
{if isset($sabintegrated) && $sabintegrated !=""}
<a href="#">
<i id="guid{$result.guid}"
<i id="guid{$result->guid}"
class="icon_sab text-muted fa fa-share"
data-toggle="tooltip"
data-placement="top" title