public function browseResults () { $this->q = trim ($_GET['q']); $this->searchType = htmlentities ($_GET['type']); $this->searchOptions = $this->getSearchOptions (); if (! empty ($this->cities)) $this->searchOptions->cities = $this->cities; $this->sort = htmlentities ($_REQUEST['sort']); $this->setupPerf (); $this->getSearchResults (); $this->result = $this->findResult ($this->permalink); if (! empty ($this->result)) { $this->setupMeta (); $this->render ('browseFrame.php'); } else { if ($this->searchOptions->type) { UrlUtil::redirect ('/' . urlencode ($this->searchOptions->type) . '?q=' . urlencode ($this->searchOptions->q) . '&e=1', ($_GET['p'] && ! $permaLinkOK)); exit; } else { $this->render404 (); } } }
public function goto () { $this->searchType = $_GET['section']; $this->q = trim ($_GET['q']); $this->searchOptions = $this->getSearchOptions (); $this->sort = $_REQUEST['sort']; $this->setupPerf (); $this->getSearchResults (); $numToSkip = 0; foreach ($this->countByDomain as $k => $v) { if ($k == $_GET['city']) break; $numToSkip += $v; } $page = (floor ($numToSkip / self::RESULTS_PER_PAGE)) + 1; $url = "/{$this->searchType}?q=" . urlencode ($this->q) . "&sort=" . self::SORT_CITY . (($page != 1) ? "&page={$page}" : '' ) ."#{$_GET['city']}"; UrlUtil::redirect ($url); }