diff options
Diffstat (limited to 'site/app/controllers/search_controller.php')
-rw-r--r-- | site/app/controllers/search_controller.php | 75 |
1 files changed, 13 insertions, 62 deletions
diff --git a/site/app/controllers/search_controller.php b/site/app/controllers/search_controller.php index 670bc15..d2cba55 100644 --- a/site/app/controllers/search_controller.php +++ b/site/app/controllers/search_controller.php @@ -53,8 +53,8 @@ class SearchController extends AppController /** * Cake array for what tables this controller accesses */ - var $uses = array('Addon', 'Addontype', 'Collection', 'File', 'Translation', 'Platform', ); - var $beforeFilter = array('checkCSRF', 'getNamedArgs', '_checkSandbox', 'checkAdvancedSearch'); + var $uses = array('Addon', 'Addontype', 'Translation', 'Platform', ); + var $beforeFilter = array('checkCSRF', 'getNamedArgs', '_checkSandbox'); /** * Holds the sanitize component, used to clean variables in our custom queries @@ -66,7 +66,7 @@ class SearchController extends AppController var $helpers = array('Javascript', 'Pagination', 'Time'); // components to be used by this controller - var $components = array('Image', 'Pagination', 'Search', "Versioncompare", "Amo", "CollectionsListing"); + var $components = array('Image', 'Pagination', 'Search', "Versioncompare", "Amo"); // view layout var $layout = 'mozilla'; @@ -109,6 +109,15 @@ class SearchController extends AppController $_terms = ''; } $this->publish('search_terms', $_terms); + + if (!empty($this->params['url']['cat'])) { + $category = explode(',', $this->params['url']['cat']); + if (count($category) != 2 || !is_numeric($category[0]) || + !is_numeric($category[1])) + $category = array(0,0); + } else + $category = array(0,0); + $this->publish('category', $category); //if advanced search appid set, use it $appname = ""; @@ -121,21 +130,6 @@ class SearchController extends AppController } $this->publish('appid', APP_ID); //publish for element caching - // collection search is a special case - if (!empty($this->params['url']['cat']) && ($this->params['url']['cat'] == 'collections')) { - $this->_collections($_terms); - return; - } - - if (!empty($this->params['url']['cat'])) { - $category = explode(',', $this->params['url']['cat']); - if (count($category) != 2 || !is_numeric($category[0]) || - !is_numeric($category[1])) - $category = array(0,0); - } else - $category = array(0,0); - $this->publish('category', $category); - //if advanced search atype set, use it. $atype = -1; $addon_types = $this->Addontype->getNames(); @@ -166,8 +160,7 @@ class SearchController extends AppController $this->publish('sort', $sort); //publish for element caching //if advanced search hver and lver set (for version range), use the - $hver = 'any'; - $lver = -1; + $hver = $lver = -1; $vfuz = false; if (isset($this->params['url']['lver']) && isset( $this->params['url']['hver']) && isset( $this->params['url']['vfuz'])) { $hver = $this->params['url']['hver']; @@ -254,48 +247,6 @@ class SearchController extends AppController return $this->index(); // let index handle rss action } - - /** - * Search collections - */ - function _collections($terms = '') { - //search - $_result_ids = $this->Search->searchCollections($terms); - - //if advanced search pagination set, use it. - $pp = 10; - if (isset( $this->params['url']['pp']) && in_array($this->params['url']['pp'], $this->Pagination->resultsPerPage)) { - $pp = $this->params['url']['pp']; - } - $this->publish('pp', $pp); //publish for element caching - - // Fetch a sorted page of collections - $page_options = array('show' => $pp); - $collections = $this->CollectionsListing->fetchPage($_result_ids, $page_options); - - // Our view needs the current sort options - list($sort_opts, $sortby) = $this->CollectionsListing->sorting(); - - // Prep and render the view - $this->pageTitle = ___('search_collections_pagetitle', 'Collection Search Results').' :: '.sprintf(_('addons_home_pagetitle'), APP_PRETTYNAME); - - $this->publish('jsAdd', array('amo2009/collections', 'jquery-ui/jqModal.js')); - $this->publish('breadcrumbs', array( - sprintf(___('addons_home_pagetitle'), APP_PRETTYNAME) => '/', - ___('collections_breadcrumb') => '/collections' - )); - - $this->publish('collapse_categories', true); - $this->publish('collectionSearch', true); - $this->publish('query', $terms); - $this->publish('sort_opts', $sort_opts); - $this->publish('sortby', $sortby); - $this->publish('collections', $collections); - $this->forceCache(); - $this->render('collections'); - return; - } - } ?> |