private function onQuickSearch($term) { $fields = array('link_href', 'link_descr'); if ($this->module->cfgLongDescription()) { $fields[] = 'link_descr2'; } $links = GDO::table('GWF_Links'); $by = $links->getWhitelistedBy(Common::getGet('by'), 'link_id'); $dir = GDO::getWhitelistedDirS(Common::getGet('dir'), 'DESC'); $conditions = $this->module->getPermQuery(GWF_Session::getUser()); $limit = 50; $from = 0; if (false === ($matches = GWF_QuickSearch::search($links, $fields, $term, "{$by} {$dir}", $limit, $from, $conditions))) { return $this->templateSearch(array(), ''); } return $this->templateSearch($matches, $term); }
public function onQuickSearch($term) { $posts = GDO::table('GWF_ForumPost'); $fields = $posts->getSearchableFields(GWF_User::getStaticOrGuest()); $_GET['term'] = $term = trim($term); // $term = Common::getRequest('term', ''); if (false === ($conditions = GWF_QuickSearch::getQuickSearchConditions($posts, $fields, $term))) { $conditions = '0'; } $permQuery = GWF_ForumPost::getPermQuery(); $conditions .= ' AND (' . $permQuery . ')'; $by = Common::getGet('by', 'post_date'); $dir = Common::getGet('dir', 'DESC'); $orderby = $posts->getMultiOrderby($by, $dir); $ipp = $this->module->getThreadsPerPage(); $nItems = $posts->countRows($conditions); $nPages = GWF_PageMenu::getPagecount($ipp, $nItems); $page = Common::clamp(Common::getGet('page', 1), 1, $nPages); $href = $this->getMethodHref(sprintf('&term=%s&by=%s&dir=%s&page=%%PAGE%%', urlencode($term), urlencode($by), urlencode($dir))); $this->pagemenu = GWF_PageMenu::display($page, $nPages, $href); $result = GWF_QuickSearch::search($posts, $fields, $term, $orderby, $ipp, GWF_PageMenu::getFrom($page, $ipp), $permQuery); $this->sortURL = $this->getMethodHref(sprintf('&term=%s&by=%%BY%%&dir=%%DIR%%&page=1', urlencode($term))); return $this->templateSearch($result, $term); }