/** * Add a filter for forums which should not be searched. * * @param array $forumids */ public function add_excludeforumid_filter($forumids) { global $vbphrase; $this->add_filter('forumid', vB_Search_Core::OP_NEQ, $forumids); $this->add_display_strings('exclude_forum', vB_Search_Searchtools::getDisplayString('forum', $vbphrase['excluded_forums'], 'title', 'forumid', $forumids, vB_Search_Core::OP_NEQ, false)); }
public function add_advanced_search_filters($criteria, $registry) { if ($registry->GPC['memberlimit']) { $criteria->add_display_strings('sgmemberlimit', vB_Search_Searchtools::getCompareString($registry->GPC['memberless']) . $registry->GPC['memberlimit'] . ' ' . $vbphrase['members']); $op = $registry->GPC['memberless'] ? vB_Search_Core::OP_LT : vB_Search_Core::OP_GT; $criteria->add_filter('sgmemberlimit', $op, $registry->GPC['memberlimit'], true); } if ($registry->GPC['messagelimit']) { $criteria->add_display_strings('sgmessagelimit', vB_Search_Searchtools::getCompareString($registry->GPC['messageless']) . $registry->GPC['messagelimit'] . ' ' . $vbphrase['messages']); $op = $registry->GPC['messageless'] ? vB_Search_Core::OP_LT : vB_Search_Core::OP_GT; $criteria->add_filter('sgmessagelimit', $op, $registry->GPC['messagelimit'], true); } if ($registry->GPC['discussionlimit']) { $criteria->add_display_strings('sgdiscussionlimit', vB_Search_Searchtools::getCompareString($registry->GPC['discussionless']) . $registry->GPC['discussionlimit'] . ' ' . $vbphrase['discussions']); $op = $registry->GPC['discussionless'] ? vB_Search_Core::OP_LT : vB_Search_Core::OP_GT; $criteria->add_filter('sgdiscussionlimit', $op, $registry->GPC['discussionlimit'], true); } if ($registry->GPC['picturelimit']) { $criteria->add_display_strings('sgpicturelimit', vB_Search_Searchtools::getCompareString($registry->GPC['pictureless']) . $registry->GPC['picturelimit'] . ' ' . $vbphrase['pictures']); $op = $registry->GPC['pictureless'] ? vB_Search_Core::OP_LT : vB_Search_Core::OP_GT; $criteria->add_filter('sgpicturelimit', $op, $registry->GPC['picturelimit'], true); } if (count($registry->GPC['cat']) > 0) { $value = $registry->GPC['cat']; if (!is_array($value)) { $value = array($value); } if (!(in_array(' ', $value) or in_array('', $value))) { $criteria->add_filter('sgcategory', vB_Search_Core::OP_EQ, $value); $criteria->add_display_strings('sgcategory', vB_Search_Searchtools::getDisplayString('socialgroupcategory', $vbphrase['categories'], 'title', 'socialgroupcategoryid', $value, vB_Search_Core::OP_EQ, true)); } } $year = $registry->GPC["group_filter_date_lteq_year"]; $month = $registry->GPC["group_filter_date_lteq_month"]; $day = $registry->GPC["group_filter_date_lteq_day"]; $ltdate = $this->get_date($year, $month, $day); if ($ltdate) { //this is actually a core field with an odd UI, we don't need to handle it in //the db_fields function. $criteria->add_filter('dateline', vB_Search_Core::OP_LT, $ltdate, true); $criteria->add_display_strings('sgdate_before', $vbphrase['before'] . ' ' . date($vbulletin->options['dateformat'], $ltdate)); } $year = $registry->GPC["group_filter_date_gteq_year"]; $month = $registry->GPC["group_filter_date_gteq_month"]; $day = $registry->GPC["group_filter_date_gteq_day"]; $gtdate = $this->get_date($year, $month, $day); if ($gtdate) { $criteria->add_filter('dateline', vB_Search_Core::OP_GT, $gtdate, true); $criteria->add_display_strings('sgdate_after', $vbphrase['after'] . ' ' . date($vbulletin->options['dateformat'], $gtdate)); } ($hook = vBulletinHook::fetch_hook('search_advanced_filters')) ? eval($hook) : false; }
/** * Add a filter for forums to search. * * @param array $forumids * @param boolean $include_children -- If the children should be included. */ protected function add_forumid_filter($criteria, $forumids, $include_children) { if (in_array(' ', $forumids) OR in_array('', $forumids)) { return; } global $vbulletin, $vbphrase; $all_forumids = fetch_search_forumids($forumids, $include_children); if ($all_forumids) { $criteria->add_filter('forumid', vB_Search_Core::OP_EQ, $all_forumids); $forum_strings = vB_Search_Searchtools::getDisplayString('forum', $vbphrase['forum'], 'title', 'forumid', $all_forumids, vB_Search_Core::OP_EQ, false); $criteria->add_display_strings('forumid', $forum_strings . ( $include_children ? ' ' . $vbphrase['and_child_forums'] : '')); } else { $criteria->add_error('invalidid', $vbphrase['forum'], $vbulletin->options['contactuslink']); } }