mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-09-03 11:49:03 +00:00
Add MovieController
This commit is contained in:
+52
-103
@@ -217,122 +217,71 @@ class Movie
|
||||
return MovieInfo::query()->where('imdbid', $imdbId)->first();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get movie releases with covers for movie browse page.
|
||||
*
|
||||
*
|
||||
* @param $page
|
||||
* @param $cat
|
||||
* @param $start
|
||||
* @param $num
|
||||
* @param $orderBy
|
||||
* @param int $maxAge
|
||||
* @param array $excludedCats
|
||||
* @param array $excludedcats
|
||||
*
|
||||
* @return array|bool
|
||||
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator|mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getMovieRange($cat, $start, $num, $orderBy, $maxAge = -1, array $excludedCats = [])
|
||||
public function getMovieRange($page, $cat, array $excludedcats = [])
|
||||
{
|
||||
$catsrch = '';
|
||||
|
||||
$sql = Release::query()->selectRaw("GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id,
|
||||
GROUP_CONCAT(r.rarinnerfilecount ORDER BY r.postdate DESC SEPARATOR ',') as grp_rarinnerfilecount,
|
||||
GROUP_CONCAT(r.haspreview ORDER BY r.postdate DESC SEPARATOR ',') AS grp_haspreview,
|
||||
GROUP_CONCAT(r.passwordstatus ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_password,
|
||||
GROUP_CONCAT(r.guid ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_guid,
|
||||
GROUP_CONCAT(rn.releases_id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid,
|
||||
GROUP_CONCAT(g.name ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grpname,
|
||||
GROUP_CONCAT(r.searchname ORDER BY r.postdate DESC SEPARATOR '#') AS grp_release_name,
|
||||
GROUP_CONCAT(r.postdate ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_postdate,
|
||||
GROUP_CONCAT(r.size ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_size,
|
||||
GROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts,
|
||||
GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments,
|
||||
GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs,
|
||||
GROUP_CONCAT(df.failed ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_failed,
|
||||
GROUP_CONCAT(cp.title, ' > ', c.title ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_catname")
|
||||
->select(
|
||||
[
|
||||
'm.*',
|
||||
'releases.gamesinfo_id',
|
||||
'g.name as group_name',
|
||||
'rn.releases_id as nfoid',
|
||||
]
|
||||
)
|
||||
->leftJoin('groups as g', 'g.id', '=', 'releases.groups_id')
|
||||
->leftJoin('release_nfos as rn', 'rn.releases_id', '=', 'releases.id')
|
||||
->leftJoin('dnzb_failures as df', 'df.release_id', '=', 'releases.id')
|
||||
->leftJoin('categories as c', 'c.id', '=', 'releases.categories_id')
|
||||
->leftJoin('categories as cp', 'cp.id', '=', 'c.parentid')
|
||||
->join('movieinfo as m', 'm.imdbid', '=', 'releases.imdbid')
|
||||
->where('releases.nzbstatus', '=', 1)
|
||||
->where('m.title', '!=', '')
|
||||
->where('m.imdbid', '!=', '0000000');
|
||||
Releases::showPasswords($sql, true);
|
||||
if (\count($excludedcats) > 0) {
|
||||
$sql->whereNotIn('releases.categories_id', $excludedcats);
|
||||
}
|
||||
|
||||
if (\count($cat) > 0 && $cat[0] !== -1) {
|
||||
$catsrch = Category::getCategorySearch($cat);
|
||||
Category::getCategorySearch($cat, $sql, true);
|
||||
}
|
||||
|
||||
$order = $this->getMovieOrder($orderBy);
|
||||
$expiresAt = Carbon::now()->addSeconds(config('nntmux.cache_expiry_medium'));
|
||||
$sql->groupBy('m.imdbid')
|
||||
->orderBy('releases.postdate', 'desc');
|
||||
|
||||
$moviesSql =
|
||||
sprintf(
|
||||
"
|
||||
SELECT SQL_CALC_FOUND_ROWS
|
||||
m.imdbid,
|
||||
GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id
|
||||
FROM movieinfo m
|
||||
LEFT JOIN releases r USING (imdbid)
|
||||
WHERE r.nzbstatus = 1
|
||||
AND m.title != ''
|
||||
AND m.imdbid != '0000000'
|
||||
AND r.passwordstatus %s
|
||||
%s %s %s %s
|
||||
GROUP BY m.imdbid
|
||||
ORDER BY %s %s %s",
|
||||
$this->showPasswords,
|
||||
$this->getBrowseBy(),
|
||||
(! empty($catsrch) ? $catsrch : ''),
|
||||
(
|
||||
$maxAge > 0
|
||||
? 'AND r.postdate > NOW() - INTERVAL '.$maxAge.'DAY '
|
||||
: ''
|
||||
),
|
||||
(\count($excludedCats) > 0 ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''),
|
||||
$order[0],
|
||||
$order[1],
|
||||
($start === false ? '' : ' LIMIT '.$num.' OFFSET '.$start)
|
||||
);
|
||||
$movieCache = Cache::get(md5($moviesSql));
|
||||
if ($movieCache !== null) {
|
||||
$movies = $movieCache;
|
||||
} else {
|
||||
$movies = $this->pdo->queryCalc($moviesSql);
|
||||
Cache::put(md5($moviesSql), $movies, $expiresAt);
|
||||
}
|
||||
|
||||
$movieIDs = $releaseIDs = [];
|
||||
|
||||
if (\is_array($movies['result'])) {
|
||||
foreach ($movies['result'] as $movie => $id) {
|
||||
$movieIDs[] = $id['imdbid'];
|
||||
$releaseIDs[] = $id['grp_release_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
"
|
||||
SELECT
|
||||
GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id,
|
||||
GROUP_CONCAT(r.rarinnerfilecount ORDER BY r.postdate DESC SEPARATOR ',') AS grp_rarinnerfilecount,
|
||||
GROUP_CONCAT(r.haspreview ORDER BY r.postdate DESC SEPARATOR ',') AS grp_haspreview,
|
||||
GROUP_CONCAT(r.passwordstatus ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_password,
|
||||
GROUP_CONCAT(r.guid ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_guid,
|
||||
GROUP_CONCAT(rn.releases_id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid,
|
||||
GROUP_CONCAT(g.name ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grpname,
|
||||
GROUP_CONCAT(r.searchname ORDER BY r.postdate DESC SEPARATOR '#') AS grp_release_name,
|
||||
GROUP_CONCAT(r.postdate ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_postdate,
|
||||
GROUP_CONCAT(r.size ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_size,
|
||||
GROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts,
|
||||
GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments,
|
||||
GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs,
|
||||
GROUP_CONCAT(df.failed ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_failed,
|
||||
GROUP_CONCAT(cp.title, ' > ', c.title ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_catname,
|
||||
m.*,
|
||||
g.name AS group_name,
|
||||
rn.releases_id AS nfoid
|
||||
FROM releases r
|
||||
LEFT OUTER JOIN groups g ON g.id = r.groups_id
|
||||
LEFT OUTER JOIN release_nfos rn ON rn.releases_id = r.id
|
||||
LEFT OUTER JOIN dnzb_failures df ON df.release_id = r.id
|
||||
LEFT OUTER JOIN categories c ON c.id = r.categories_id
|
||||
LEFT OUTER JOIN categories cp ON cp.id = c.parentid
|
||||
INNER JOIN movieinfo m ON m.imdbid = r.imdbid
|
||||
WHERE m.imdbid IN (%s)
|
||||
AND r.id IN (%s) %s
|
||||
GROUP BY m.imdbid
|
||||
ORDER BY %s %s",
|
||||
(\is_array($movieIDs) ? implode(',', $movieIDs) : -1),
|
||||
(\is_array($releaseIDs) ? implode(',', $releaseIDs) : -1),
|
||||
(! empty($catsrch) ? $catsrch : ''),
|
||||
$order[0],
|
||||
$order[1]
|
||||
);
|
||||
$return = Cache::get(md5($sql));
|
||||
$return = Cache::get(md5($page.implode('.', $cat).implode('.', $excludedcats)));
|
||||
if ($return !== null) {
|
||||
return $return;
|
||||
}
|
||||
$return = $this->pdo->query($sql);
|
||||
if (! empty($return)) {
|
||||
$return[0]['_totalcount'] = $movies['total'] ?? 0;
|
||||
}
|
||||
|
||||
Cache::put(md5($sql), $return, $expiresAt);
|
||||
$return = $sql->paginate(config('nntmux.items_per_cover_page'));
|
||||
|
||||
$expiresAt = Carbon::now()->addSeconds(config('nntmux.cache_expiry_long'));
|
||||
Cache::put(md5($page.implode('.', $cat).implode('.', $excludedcats)), $return, $expiresAt);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
2018-04-11 DariusIII
|
||||
* Chg: Add MovieController
|
||||
* Chg: Add GamesController, adjust themes and classes
|
||||
* Chg: Update CartController
|
||||
* Chg: Update returned response in FailedReleasesController
|
||||
|
||||
@@ -32,7 +32,7 @@ class ConsoleController extends BasePageController
|
||||
$this->smarty->assign('catlist', $ctmp);
|
||||
$this->smarty->assign('category', $category->title);
|
||||
|
||||
$page = \request()->has('page') ? \request()->input('page') : 1;
|
||||
$page = $request->has('page') ? $request->input('page') : 1;
|
||||
|
||||
$consoles = [];
|
||||
$results = $console->getConsoleRange($page, $catarray, $this->userdata['categoryexclusions']);
|
||||
|
||||
@@ -36,7 +36,7 @@ class GamesController extends BasePageController
|
||||
$this->smarty->assign('catlist', $ctmp);
|
||||
$this->smarty->assign('category', $category);
|
||||
|
||||
$page = \request()->has('page') ? \request()->input('page') : 1;
|
||||
$page = $request->has('page') ? $request->input('page') : 1;
|
||||
|
||||
$games2 = [];
|
||||
$results = $games->getGamesRange($page, $catarray, $this->userdata['categoryexclusions']);
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Category;
|
||||
use App\Models\User;
|
||||
use Blacklight\Movie;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class MovieController extends BasePageController
|
||||
{
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function showMovie(Request $request)
|
||||
{
|
||||
$this->setPrefs();
|
||||
if ($request->has('modal') && $request->has('id') && ctype_digit($request->input('id'))) {
|
||||
$movie = new Movie(['Settings' => $this->settings]);
|
||||
$mov = $movie->getMovieInfo($request->input('id'));
|
||||
|
||||
if (! $mov) {
|
||||
$this->show404();
|
||||
}
|
||||
|
||||
$mov['actors'] = makeFieldLinks($mov, 'actors', 'movies');
|
||||
$mov['genre'] = makeFieldLinks($mov, 'genre', 'movies');
|
||||
$mov['director'] = makeFieldLinks($mov, 'director', 'movies');
|
||||
|
||||
$this->smarty->assign(['movie' => $mov, 'modal' => true]);
|
||||
|
||||
$title = 'Info for '.$mov['title'];
|
||||
$meta_title = '';
|
||||
$meta_keywords = '';
|
||||
$meta_description = '';
|
||||
$this->smarty->registerPlugin('modifier', 'ss', 'stripslashes');
|
||||
|
||||
if ($request->has('modal')) {
|
||||
$content = $this->smarty->fetch('viewmovie.tpl');
|
||||
$this->smarty->assign('modal', true);
|
||||
echo $this->content;
|
||||
} else {
|
||||
$content = $this->smarty->fetch('viewmoviefull.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
$this->smarty->assign([
|
||||
'content' => $content,
|
||||
'title' => $title,
|
||||
'meta_title' => $meta_title,
|
||||
'meta_keywords' => $meta_keywords,
|
||||
'meta_description' => $meta_description,
|
||||
]);
|
||||
$this->pagerender();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function showMovies(Request $request)
|
||||
{
|
||||
$this->setPrefs();
|
||||
$movie = new Movie(['Settings' => $this->settings]);
|
||||
|
||||
$moviecats = Category::getChildren(Category::MOVIE_ROOT);
|
||||
$mtmp = [];
|
||||
foreach ($moviecats as $mcat) {
|
||||
$mtmp[$mcat['id']] = $mcat;
|
||||
}
|
||||
|
||||
$category = $request->has('imdb') ? -1 : Category::MOVIE_ROOT;
|
||||
if ($request->has('t') && array_key_exists($request->input('t'), $mtmp)) {
|
||||
$category = $request->input('t') + 0;
|
||||
}
|
||||
|
||||
$user = User::find(Auth::id());
|
||||
$cpapi = $user['cp_api'];
|
||||
$cpurl = $user['cp_url'];
|
||||
$this->smarty->assign('cpapi', $cpapi);
|
||||
$this->smarty->assign('cpurl', $cpurl);
|
||||
|
||||
$catarray = [];
|
||||
if ((int) $category !== -1) {
|
||||
$catarray[] = $category;
|
||||
}
|
||||
|
||||
$this->smarty->assign('catlist', $mtmp);
|
||||
$this->smarty->assign('category', $category);
|
||||
|
||||
$page = $request->has('page') ? $request->input('page') : 1;
|
||||
|
||||
$movies = [];
|
||||
$results = $movie->getMovieRange($page, $catarray, $this->userdata['categoryexclusions']);
|
||||
foreach ($results as $result) {
|
||||
$result['genre'] = makeFieldLinks($result, 'genre', 'movies');
|
||||
$result['actors'] = makeFieldLinks($result, 'actors', 'movies');
|
||||
$result['director'] = makeFieldLinks($result, 'director', 'movies');
|
||||
$result['languages'] = explode(', ', $result['language']);
|
||||
|
||||
$movies[] = $result;
|
||||
}
|
||||
|
||||
$title = ($request->has('title') && ! empty($request->input('title'))) ? stripslashes($request->input('title')) : '';
|
||||
$this->smarty->assign('title', $title);
|
||||
|
||||
$actors = ($request->has('actors') && ! empty($request->input('actors'))) ? stripslashes($request->input('actors')) : '';
|
||||
$this->smarty->assign('actors', $actors);
|
||||
|
||||
$director = ($request->has('director') && ! empty($request->input('director'))) ? stripslashes($request->input('director')) : '';
|
||||
$this->smarty->assign('director', $director);
|
||||
|
||||
$ratings = range(1, 9);
|
||||
$rating = ($request->has('rating') && \in_array($request->input('rating'), $ratings, false)) ? $request->input('rating') : '';
|
||||
$this->smarty->assign('ratings', $ratings);
|
||||
$this->smarty->assign('rating', $rating);
|
||||
|
||||
$genres = $movie->getGenres();
|
||||
$genre = ($request->has('genre') && \in_array($request->input('genre'), $genres, false)) ? $request->input('genre') : '';
|
||||
$this->smarty->assign('genres', $genres);
|
||||
$this->smarty->assign('genre', $genre);
|
||||
|
||||
$years = range(1903, Carbon::now()->addYear()->year);
|
||||
rsort($years);
|
||||
$year = ($request->has('year') && \in_array($request->input('year'), $years, false)) ? $request->input('year') : '';
|
||||
$this->smarty->assign('years', $years);
|
||||
$this->smarty->assign('year', $year);
|
||||
|
||||
if ((int) $category === -1) {
|
||||
$this->smarty->assign('catname', 'All');
|
||||
} else {
|
||||
$cdata = Category::find($category);
|
||||
if ($cdata) {
|
||||
$this->smarty->assign('catname', $cdata->parent !== null ? $cdata->parent->title.' > '.$cdata->title : $cdata->title);
|
||||
} else {
|
||||
$this->show404();
|
||||
}
|
||||
}
|
||||
|
||||
$this->smarty->assign('results', $movies);
|
||||
|
||||
$meta_title = 'Browse Nzbs';
|
||||
$meta_keywords = 'browse,nzb,description,details';
|
||||
$meta_description = 'Browse for Nzbs';
|
||||
|
||||
if ($request->has('imdb')) {
|
||||
$content = $this->smarty->fetch('viewmoviefull.tpl');
|
||||
} else {
|
||||
$content = $this->smarty->fetch('movies.tpl');
|
||||
}
|
||||
|
||||
$this->smarty->assign([
|
||||
'content' => $content,
|
||||
'meta_title' => $meta_title,
|
||||
'meta_keywords' => $meta_keywords,
|
||||
'meta_description' => $meta_description,
|
||||
]);
|
||||
$this->pagerender();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function showTrailer(Request $request)
|
||||
{
|
||||
$movie = new Movie;
|
||||
|
||||
if ($request->has('id') && ctype_digit($request->input('id'))) {
|
||||
$mov = $movie->getMovieInfo($request->input('id'));
|
||||
|
||||
if (! $mov) {
|
||||
$this->show404();
|
||||
}
|
||||
|
||||
$this->smarty->assign('movie', $mov);
|
||||
|
||||
$title = 'Info for '.$mov['title'];
|
||||
$meta_title = '';
|
||||
$meta_keywords = '';
|
||||
$meta_description = '';
|
||||
$this->smarty->registerPlugin('modifier', 'ss', 'stripslashes');
|
||||
|
||||
$modal = false;
|
||||
if ($request->has('modal')) {
|
||||
$modal = true;
|
||||
$this->smarty->assign('modal', true);
|
||||
}
|
||||
|
||||
$content = $this->smarty->fetch('viewmovietrailer.tpl');
|
||||
|
||||
if ($modal) {
|
||||
echo $content;
|
||||
} else {
|
||||
$this->smarty->assign([
|
||||
'content' => $content,
|
||||
'title' => $title,
|
||||
'meta_title' => $meta_title,
|
||||
'meta_keywords' => $meta_keywords,
|
||||
'meta_description' => $meta_description,
|
||||
]);
|
||||
$this->pagerender();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Blacklight\Movie;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
if (! Auth::check()) {
|
||||
$page->show403();
|
||||
}
|
||||
|
||||
if (request()->has('modal') && request()->has('id') && ctype_digit(request()->input('id'))) {
|
||||
$movie = new Movie(['Settings' => $page->settings]);
|
||||
$mov = $movie->getMovieInfo(request()->input('id'));
|
||||
|
||||
if (! $mov) {
|
||||
$page->show404();
|
||||
}
|
||||
|
||||
$mov['actors'] = makeFieldLinks($mov, 'actors', 'movies');
|
||||
$mov['genre'] = makeFieldLinks($mov, 'genre', 'movies');
|
||||
$mov['director'] = makeFieldLinks($mov, 'director', 'movies');
|
||||
|
||||
$page->smarty->assign(['movie' => $mov, 'modal' => true]);
|
||||
|
||||
$page->title = 'Info for '.$mov['title'];
|
||||
$page->meta_title = '';
|
||||
$page->meta_keywords = '';
|
||||
$page->meta_description = '';
|
||||
$page->smarty->registerPlugin('modifier', 'ss', 'stripslashes');
|
||||
|
||||
if (request()->has('modal')) {
|
||||
$page->content = $page->smarty->fetch('viewmovie.tpl');
|
||||
$page->smarty->assign('modal', true);
|
||||
echo $page->content;
|
||||
} else {
|
||||
$page->content = $page->smarty->fetch('viewmoviefull.tpl');
|
||||
$page->pagerender();
|
||||
}
|
||||
} else {
|
||||
$page->pagerender();
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Blacklight\Movie;
|
||||
use App\Models\Category;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
if (! Auth::check()) {
|
||||
$page->show403();
|
||||
}
|
||||
|
||||
$movie = new Movie(['Settings' => $page->settings]);
|
||||
|
||||
$moviecats = Category::getChildren(Category::MOVIE_ROOT);
|
||||
$mtmp = [];
|
||||
foreach ($moviecats as $mcat) {
|
||||
$mtmp[$mcat['id']] = $mcat;
|
||||
}
|
||||
|
||||
$category = request()->has('imdb') ? -1 : Category::MOVIE_ROOT;
|
||||
if (request()->has('t') && array_key_exists(request()->input('t'), $mtmp)) {
|
||||
$category = request()->input('t') + 0;
|
||||
}
|
||||
|
||||
$user = User::find(Auth::id());
|
||||
$cpapi = $user['cp_api'];
|
||||
$cpurl = $user['cp_url'];
|
||||
$page->smarty->assign('cpapi', $cpapi);
|
||||
$page->smarty->assign('cpurl', $cpurl);
|
||||
|
||||
$catarray = [];
|
||||
if ((int) $category !== -1) {
|
||||
$catarray[] = $category;
|
||||
}
|
||||
|
||||
$page->smarty->assign('catlist', $mtmp);
|
||||
$page->smarty->assign('category', $category);
|
||||
|
||||
$offset = (request()->has('offset') && ctype_digit(request()->input('offset'))) ? request()->input('offset') : 0;
|
||||
$ordering = $movie->getMovieOrdering();
|
||||
$orderby = request()->has('ob') && in_array(request()->input('ob'), $ordering, false) ? request()->input('ob') : '';
|
||||
|
||||
$movies = [];
|
||||
$results = $movie->getMovieRange($catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, -1, $page->userdata['categoryexclusions']);
|
||||
foreach ($results as $result) {
|
||||
$result['genre'] = makeFieldLinks($result, 'genre', 'movies');
|
||||
$result['actors'] = makeFieldLinks($result, 'actors', 'movies');
|
||||
$result['director'] = makeFieldLinks($result, 'director', 'movies');
|
||||
$result['languages'] = explode(', ', $result['language']);
|
||||
|
||||
$movies[] = $result;
|
||||
}
|
||||
|
||||
$title = (request()->has('title') && ! empty(request()->input('title'))) ? stripslashes(request()->input('title')) : '';
|
||||
$page->smarty->assign('title', $title);
|
||||
|
||||
$actors = (request()->has('actors') && ! empty(request()->input('actors'))) ? stripslashes(request()->input('actors')) : '';
|
||||
$page->smarty->assign('actors', $actors);
|
||||
|
||||
$director = (request()->has('director') && ! empty(request()->input('director'))) ? stripslashes(request()->input('director')) : '';
|
||||
$page->smarty->assign('director', $director);
|
||||
|
||||
$ratings = range(1, 9);
|
||||
$rating = (request()->has('rating') && in_array(request()->input('rating'), $ratings, false)) ? request()->input('rating') : '';
|
||||
$page->smarty->assign('ratings', $ratings);
|
||||
$page->smarty->assign('rating', $rating);
|
||||
|
||||
$genres = $movie->getGenres();
|
||||
$genre = (request()->has('genre') && in_array(request()->input('genre'), $genres, false)) ? request()->input('genre') : '';
|
||||
$page->smarty->assign('genres', $genres);
|
||||
$page->smarty->assign('genre', $genre);
|
||||
|
||||
$years = range(1903, Carbon::now()->addYear()->year);
|
||||
rsort($years);
|
||||
$year = (request()->has('year') && in_array(request()->input('year'), $years, false)) ? request()->input('year') : '';
|
||||
$page->smarty->assign('years', $years);
|
||||
$page->smarty->assign('year', $year);
|
||||
|
||||
$browseby_link = '&title='.$title.'&actors='.$actors.'&director='.$director.'&rating='.$rating.'&genre='.$genre.'&year='.$year;
|
||||
|
||||
$page->smarty->assign('pagertotalitems', $results[0]['_totalcount'] ?? 0);
|
||||
$page->smarty->assign('pageroffset', $offset);
|
||||
$page->smarty->assign('pageritemsperpage', config('nntmux.items_per_cover_page'));
|
||||
$page->smarty->assign('pagerquerybase', WWW_TOP.'/movies?t='.$category.$browseby_link.'&ob='.$orderby.'&offset=');
|
||||
$page->smarty->assign('pagerquerysuffix', '#results');
|
||||
|
||||
$pager = $page->smarty->fetch('pager.tpl');
|
||||
$page->smarty->assign('pager', $pager);
|
||||
|
||||
if ((int) $category === -1) {
|
||||
$page->smarty->assign('catname', 'All');
|
||||
} else {
|
||||
$cdata = Category::find($category);
|
||||
if ($cdata) {
|
||||
$page->smarty->assign('catname', $cdata->parent !== null ? $cdata->parent->title.' > '.$cdata->title : $cdata->title);
|
||||
} else {
|
||||
$page->show404();
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($ordering as $ordertype) {
|
||||
$page->smarty->assign('orderby'.$ordertype, WWW_TOP.'/movies?t='.$category.$browseby_link.'&ob='.$ordertype.'&offset=0');
|
||||
}
|
||||
|
||||
$page->smarty->assign('results', $movies);
|
||||
|
||||
$page->meta_title = 'Browse Nzbs';
|
||||
$page->meta_keywords = 'browse,nzb,description,details';
|
||||
$page->meta_description = 'Browse for Nzbs';
|
||||
|
||||
if (request()->has('imdb')) {
|
||||
$page->content = $page->smarty->fetch('viewmoviefull.tpl');
|
||||
} else {
|
||||
$page->content = $page->smarty->fetch('movies.tpl');
|
||||
}
|
||||
$page->pagerender();
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Blacklight\Movie;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
if (! Auth::check()) {
|
||||
$page->show403();
|
||||
}
|
||||
|
||||
$movie = new Movie;
|
||||
|
||||
if (request()->has('id') && ctype_digit(request()->input('id'))) {
|
||||
$mov = $movie->getMovieInfo(request()->input('id'));
|
||||
|
||||
if (! $mov) {
|
||||
$page->show404();
|
||||
}
|
||||
|
||||
$page->smarty->assign('movie', $mov);
|
||||
|
||||
$page->title = 'Info for '.$mov['title'];
|
||||
$page->meta_title = '';
|
||||
$page->meta_keywords = '';
|
||||
$page->meta_description = '';
|
||||
$page->smarty->registerPlugin('modifier', 'ss', 'stripslashes');
|
||||
|
||||
$modal = false;
|
||||
if (request()->has('modal')) {
|
||||
$modal = true;
|
||||
$page->smarty->assign('modal', true);
|
||||
}
|
||||
|
||||
$page->content = $page->smarty->fetch('viewmovietrailer.tpl');
|
||||
|
||||
if ($modal) {
|
||||
echo $page->content;
|
||||
} else {
|
||||
$page->pagerender();
|
||||
}
|
||||
}
|
||||
+11
-3
@@ -82,9 +82,17 @@ Route::post('failed', 'FailedReleasesController@show');
|
||||
|
||||
Route::get('games', 'GamesController@show');
|
||||
|
||||
Route::get('/movies', function () {
|
||||
redirect('/movies');
|
||||
})->middleware('auth');
|
||||
Route::get('movies', 'MovieController@showMovies');
|
||||
|
||||
Route::get('movie', 'MovieController@showMovie');
|
||||
|
||||
Route::get('movietrailers', 'MovieController@showTrailer');
|
||||
|
||||
Route::post('movies', 'MovieController@showMovies');
|
||||
|
||||
Route::post('movie', 'MovieController@showMovie');
|
||||
|
||||
Route::post('movietrailers', 'MovieController@showTrailer');
|
||||
|
||||
Route::get('/pc', function () {
|
||||
redirect('/pc');
|
||||
|
||||
Reference in New Issue
Block a user