From e6126bd49fa2eee78127045d3f0743edd3b5d834 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Fri, 13 Apr 2018 14:53:41 +0200 Subject: [PATCH] Add AdultController --- Changelog | 1 + app/Http/Controllers/AdultController.php | 108 +++++++++++++++++++++++ app/Http/Controllers/MovieController.php | 4 +- 3 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 app/Http/Controllers/AdultController.php diff --git a/Changelog b/Changelog index a16f13993..409b46a7b 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2018-04-13 DariusIII + * Chg: Add AdultController * Chg: Adjust queries in classes related to browsing * Chg: Update redirect on new rss key generation * Chg: Add option to edit profile to ProfileController diff --git a/app/Http/Controllers/AdultController.php b/app/Http/Controllers/AdultController.php new file mode 100644 index 000000000..803183fd8 --- /dev/null +++ b/app/Http/Controllers/AdultController.php @@ -0,0 +1,108 @@ +setPrefs(); + $adult = new XXX(); + + $moviecats = Category::getChildren(Category::XXX_ROOT); + $mtmp = []; + foreach ($moviecats as $mcat) { + $mtmp[$mcat['id']] = $mcat; + } + $category = Category::XXX_ROOT; + if ($request->has('t') && array_key_exists($request->input('t'), $mtmp)) { + $category = $request->input('t') + 0; + } + $catarray = []; + $catarray[] = $category; + + $this->smarty->assign('catlist', $mtmp); + $this->smarty->assign('category', $category); + + $offset = ($request->has('offset') && ctype_digit($request->input('offset'))) ? $request->input('offset') : 0; + $ordering = $adult->getXXXOrdering(); + $orderby = $request->has('ob') && \in_array($request->input('ob'), $ordering, false) ? $request->input('ob') : ''; + + $movies = []; + $results = $adult->getXXXRange($catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, -1, $this->userdata['categoryexclusions']); + foreach ($results as $result) { + $result['genre'] = makeFieldLinks($result, 'genre', 'xxx'); + $result['actors'] = makeFieldLinks($result, 'actors', 'xxx'); + $result['director'] = makeFieldLinks($result, 'director', 'xxx'); + $movies[] = $result; + } + $title = ($request->has('title') && ! empty($request->input('title'))) ? stripslashes($request->input('title')) : ''; + $this->smarty->assign('title', stripslashes($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); + + $genres = $adult->getAllGenres(true); + $genre = ($request->has('genre') && \in_array($request->input('genre'), $genres, false)) ? $request->input('genre') : ''; + $this->smarty->assign('genres', $genres); + $this->smarty->assign('genre', $genre); + + $browseby_link = '&title='.$title.'&actors='.$actors.'&director='.$director.'&genre='.$genre; + + $this->smarty->assign('pagertotalitems', $results[0]['_totalcount'] ?? 0); + $this->smarty->assign('pageroffset', $offset); + $this->smarty->assign('pageritemsperpage', config('nntmux.items_per_cover_page')); + $this->smarty->assign('pagerquerybase', WWW_TOP.'/xxx?t='.$category.$browseby_link.'&ob='.$orderby.'&offset='); + $this->smarty->assign('pagerquerysuffix', '#results'); + + $pager = $this->smarty->fetch('pager.tpl'); + $this->smarty->assign('pager', $pager); + + 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(); + } + } + + foreach ($ordering as $ordertype) { + $this->smarty->assign('orderby'.$ordertype, WWW_TOP.'/xxx?t='.$category.$browseby_link.'&ob='.$ordertype.'&offset=0'); + } + + $this->smarty->assign('results', $movies); + + $meta_title = 'Browse XXX'; + $meta_keywords = 'browse,xxx,nzb,description,details'; + $meta_description = 'Browse for XXX Movies'; + + if ($request->has('id')) { + $content = $this->smarty->fetch('viewxxxfull.tpl'); + } else { + $content = $this->smarty->fetch('xxx.tpl'); + } + $this->smarty->assign([ + 'content' => $content, + 'meta_title' => $meta_title, + 'meta_keywords' => $meta_keywords, + 'meta_description' => $meta_description, + ]); + $this->pagerender(); + + } +} diff --git a/app/Http/Controllers/MovieController.php b/app/Http/Controllers/MovieController.php index 3cce6ea04..c50b61d19 100644 --- a/app/Http/Controllers/MovieController.php +++ b/app/Http/Controllers/MovieController.php @@ -144,9 +144,9 @@ class MovieController extends BasePageController $this->smarty->assign('results', $movies); - $meta_title = 'Browse Nzbs'; + $meta_title = 'Browse Movies'; $meta_keywords = 'browse,nzb,description,details'; - $meta_description = 'Browse for Nzbs'; + $meta_description = 'Browse for Movies'; if ($request->has('imdb')) { $content = $this->smarty->fetch('viewmoviefull.tpl');