public function action_search_file() { $auth = Auth::check(); if ($auth and is_numeric(AUTHORID)) { //LOAD FANCYBOX LIBS Asset::container('header')->add('fancyboxcss', 'bundles/cms/css/fancybox.css', 'main'); Asset::container('footer')->add('fancybox', 'bundles/cms/js/jquery.fancybox.js', 'jquery'); //LOAD JS LIBS Asset::container('footer')->add('ias', 'bundles/cms/js/jquery.ias.js', 'jquery'); Asset::container('footer')->add('files', 'bundles/cms/js/sections/files_list.js', 'cms'); if (Input::has('q')) { $q = Input::get('q'); $this->layout->header_data = array('title' => $q); $this->layout->top_data = array('search' => '/cms/file/search', 'q' => $q); //ALLOWED EXTENSIONS $ext_str = str_replace(' ', '', Config::get('cms::settings.mimes')); $extensions = explode(',', $ext_str); //GET PAGE DATA $data = CmsFile::where('name', 'LIKE', '%' . $q . '%')->or_where('ext', 'LIKE', '%' . $q . '%')->order_by('ext', 'asc')->order_by('size', 'desc')->order_by('name', 'asc')->paginate(Config::get('cms::settings.pag')); $this->layout->content = View::make('cms::interface.pages.file_list')->with('data', $data)->with('page', 0)->with('ext', '')->with('extensions_selected', array())->with('extensions', $extensions); } else { $this->layout->header_data = array('title' => LL('cms::title.files', CMSLANG)); $this->layout->top_data = array('search' => '/cms/file/search', 'q' => ''); //ALLOWED EXTENSIONS $ext_str = str_replace(' ', '', Config::get('cms::settings.mimes')); $extensions = explode(',', $ext_str); //GET DATA $data = CmsFile::with('pages')->order_by('ext', 'asc')->order_by('size', 'desc')->order_by('name', 'asc')->paginate(Config::get('cms::settings.pag')); $this->layout->content = View::make('cms::interface.pages.file_list')->with('data', $data)->with('page', 0)->with('ext', '')->with('extensions_selected', array())->with('extensions', $extensions); } } }