public function add_advanced_search_filters($criteria, $registry) { if ($registry->GPC['threadlimit']) { $criteria->add_display_strings('forumthreadlimit', vB_Search_Searchtools::getCompareString($registry->GPC['threadless']) . $registry->GPC['threadlimit'] . ' ' . $vbphrase['threads']); $op = $registry->GPC['threadless'] ? vB_Search_Core::OP_LT : vB_Search_Core::OP_GT; $criteria->add_filter('forumthreadlimit', $op, $registry->GPC['threadlimit'], true); } if ($registry->GPC['postlimit']) { $criteria->add_display_strings('forumthreadlimit', vB_Search_Searchtools::getCompareString($registry->GPC['postless']) . $registry->GPC['postlimit'] . ' ' . $vbphrase['posts']); $op = $registry->GPC['postless'] ? vB_Search_Core::OP_LT : vB_Search_Core::OP_GT; $criteria->add_filter('forumpostlimit', $op, $registry->GPC['postlimit'], true); } if ($registry->GPC['forumdateline']) { if (is_numeric($registry->GPC['forumdateline'])) { $dateline = TIMENOW - $this->forumdateline * 86400; } else { $current_user = new vB_Legacy_CurrentUser(); $dateline = $current_user->get_field('lastvisit'); } $op = $registry->GPC['beforeafter'] == 'before' ? vB_Search_Core::OP_LT : vB_Search_Core::OP_GT; $criteria->add_filter('forumpostdateline', $op, $dateline, true); $this->set_display_date($criteria, $registry->GPC['forumdateline'], $registry->GPC['beforeafter']); } ($hook = vBulletinHook::fetch_hook('search_advanced_filters')) ? eval($hook) : false; }
/** * Add a filter for date * * @param array $forumids * @param boolean $include_children -- If the children should be included. */ public function add_date_filter($direction, $dateline) { global $vbulletin, $vbphrase; $field = $this->switch_field('dateline'); $this->add_filter($field, $direction, $dateline, true); if (is_numeric($dateline)) { $this->add_display_strings('date', $vbphrase['date'] . ' ' . vB_Search_Searchtools::getCompareString($direction, true) . ' ' . date($vbulletin->options['dateformat'], $dateline)); } else { $current_user = new vB_Legacy_CurrentUser(); $this->add_display_strings('date', $vbphrase['date'] . ' ' . vB_Search_Searchtools::getCompareString($direction, true) . ' ' . $vbphrase['last_visit']); } }
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; }
protected function add_pollid_filter($criteria, $pollids, $op) { global $vbphrase; if (!is_array($pollids) and $pollids and $op = vB_Search_Core::OP_EQ) { $criteria->add_filter('pollid', $op, $pollids, $restrictive); $criteria->add_display_strings($field, $vbphrase['poll'] . ' ' . $vbphrase['at_least'] . ' ' . $pollid); return; } if (!is_array($pollids)) { $pollids = array($pollids); } //if "everything" is selected, bail -- we don't need to filter. if (in_array(' ', $pollids) or in_array('', $pollids)) { return; } $restrictive = true; $pos = array_search('-1', $pollids); if ($pos !== false) { //convert to the actual database value for no prefix $pollids[$pos] = ''; //if "no prefix" is selected, then this isn't a restrictive filter //otherwise it is. $restrictive = false; } $criteria->add_filter('pollid', $op, $pollids, $restrictive); $criteria->add_display_strings($field, $vbphrase['poll'] . vB_Search_Searchtools::getCompareString($op) . implode(', ', $pollids)); }