/** * Displays a grid of titles with pagination. * * @return View */ public function index() { $input = Input::all(); $data = $this->title->titleIndex($input, 'movie'); if (isset($input['genre'])) { $genre = $input['genre']; $data = $data->genres($data, $genre); } else { $genre = 'all'; } if (isset($input['relevance'])) { $relevance = $input['relevance']; $data = $data->relevance($data, $relevance); } else { $relevance = 'all'; } if (isset($input['yearFrom'])) { $yearFrom = $input['yearFrom']; } else { $yearFrom = Title::getYearOldest(); } if (isset($input['yearTo'])) { $yearTo = $input['yearTo']; } else { $yearTo = Title::getYearNewest(); } $data = $data->yearsRange($data, $yearFrom, $yearTo); $yearFrom = Title::getYearOldest(); $yearTo = Title::getYearNewest(); if (isset($input['view'])) { if ($input['view'] > 1 || $input['view'] < 0) { $view = 0; } else { $view = $input['view']; } } else { $view = 0; } // Get only online movies if (!Helpers::hasAccess('titles.create')) { $data = $data->online($data); } if (isset($input['numRows'])) { $numRows = $input['numRows']; } else { $numRows = 18; } if (isset($input['sortBy'])) { $sortBy = Title::sortByString($input['sortBy']); } else { $sortBy = Title::sortByString('lastAdded'); } $data = $data->orderBy($sortBy['field'], $sortBy['direction'])->paginate($numRows); if (isset($input['sortBy'])) { $sortBy = $input['sortBy']; } else { $sortBy = 'lastAdded'; } return View::make('titles.index')->withData($data)->withView($view)->withGenre($genre)->withRelevance($relevance)->withYearfrom($yearFrom)->withYearto($yearTo)->withNumrows($numRows)->withSortby($sortBy); }
/** * Get the year of the newest movie. * * @param Illuminate\Database\Eloquent\Builder $query * @return string */ public static function getYearNewest() { if (Helpers::hasAccess('titles.create')) { $year = Title::max('year'); } else { $year = Title::where('type', '=', 'movie')->whereNotNull('video')->where('video', '<>', '')->whereNotNull('poster')->where('poster', '<>', '')->whereNotNull('background')->where('background', '<>', '')->max('year'); } return $year; }
/** * Detach link from specified title. * * @return Response */ public function detach() { $input = Input::except('_token'); if (!isset($input['title_id'])) { return Response::json(trans('dash.somethingWrong'), 500); } $link = $this->model->where('url', $input['url'])->where('title_id', $input['title_id'])->first(); if ($link && (!(int) $link->approved || Helpers::hasAccess('super'))) { $link->delete(); } return Response::json(trans('stream::main.detachSuccess'), 200); }
public function __construct(Search $search, SearchAdmin $searchAdmin, Auto $autocomplete, Cacher $cache) { $this->beforeFilter('csrf', array('on' => 'post')); $this->cache = $cache; $this->autocomplete = $autocomplete; //get search provider name for differianting between //different providers query caches $this->options = App::make('Options'); if (Helpers::hasAccess('super')) { $this->search = $searchAdmin; $this->provider = $this->options->getSearchProvider(); } else { $this->search = $search; $this->provider = 'db'; } }
<?php return array('uri' => 'dashboard', 'title' => trans('main.dashboard'), 'model_config_path' => app('path') . '/config/administrator', 'settings_config_path' => app('path') . '/config/administrator/settings', 'menu' => array('Movies & Series' => array('movies', 'series'), 'actors', 'directors', 'writers', 'users', 'groups', 'news', 'Settings' => array('settings.options', 'settings.backgrounds', 'settings.appearance', 'settings.ads')), 'permission' => function () { return Helpers::hasAccess('super'); }, 'use_dashboard' => true, 'dashboard_view' => 'dashboard.master', 'home_page' => 'settings.options', 'login_path' => 'login', 'logout_path' => 'logout', 'login_redirect_key' => 'redirect', 'global_rows_per_page' => 20, 'locales' => array());
<?php Lang::addNamespace('stream', public_path('plugins/streaming/plugin/lang')); //register plugin routes require public_path() . '/plugins/streaming/plugin/routes.php'; //register a filter for links Route::filter('links', function ($route, $request, $value) { if (!is_string($value)) { App::Abort(403); } if (!Helpers::hasAccess("links.{$value}")) { return Redirect::to('/'); } }); //make sure laravel can find and load plugin views View::addLocation(public_path('plugins/streaming/plugin/views')); //override mtdb controllers App::bind('DashboardController', function () { return new StreamingDashboardController(); }); App::bind('SeriesSeasonsController', function () { return new StreamingSeriesSeasonsController(); }); App::bind('SeasonsEpisodesController', function () { return new StreamingSeasonsEpisodesController(); }); //override other classes App::bind('Lib\\Repository', function () { return new Plugins\Streaming\Plugin\Lib\Repository(); }); App::bind('Lib\\Titles\\TitleRepository', function () {
Route::filter('people', function ($route, $request, $value) { if (!is_string($value)) { App::Abort(403); } if (!Helpers::hasAccess("people.{$value}")) { return Redirect::to('people'); } }); Route::filter('logged', function () { if (!Helpers::loggedInUser()) { Session::put('url.intended', Request::url()); return Redirect::to('login'); } }); //if we have options table and installed is //set to trudy value we'll bail with 404 Route::filter('installed', function () { if (Schema::hasTable('options')) { $installed = DB::table('options')->where('name', 'installed')->first(); if ($installed || $installed['value']) { App::abort(404, 'page not found'); } } }); //if we have options table and installed is //set to trudy value we'll bail with 404 Route::filter('updated', function () { if (!Helpers::hasAccess('super')) { App::abort(404); } });