From 4b2e2074289094ec1f85d35d8f41099619049486 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Barrois?= Date: Fri, 5 Feb 2010 16:32:01 +0100 Subject: [PATCH] Fix QuickSearch MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Barrois --- include/ufbuilder.inc.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/include/ufbuilder.inc.php b/include/ufbuilder.inc.php index 41e1cf4..d299d74 100644 --- a/include/ufbuilder.inc.php +++ b/include/ufbuilder.inc.php @@ -422,25 +422,27 @@ class UFBF_Quick extends UFB_Field } $this->val = str_replace('*', '%', replace_accent($ufb->s($this->envfield))); + + return true; } protected function buildUFC(UserFilterBuilder &$ufb) { - $conds = new PFC_And(); - $s = $this->val; + $r = $s = $this->val; /** Admin: Email, IP */ if (S::admin() && strpos($s, '@') !== false) { - $conds->addChild(new UFC_Email($s)); - return $conds; + return new UFC_Email($s); } else if (S::admin() && preg_match('/[0-9]+\.([0-9]+|%)\.([0-9]+|%)\.([0-9]+|%)/', $s)) { // TODO: create UFC_Ip // $this->conds->addChild(new UFC_Ip($s)); - return $conds; + return; } + $conds = new PFC_And(); + /** Name */ $s = preg_replace('!\d+!', ' ', $s); @@ -473,7 +475,7 @@ class UFBF_Quick extends UFB_Field } $conds->addChild(new UFC_NameTokens($st, $flags, $soundex, $exact)); - $ufb->addSort(new UFO_Score()); + $ufb->addOrder(new UFO_Score()); } /** Promo ranges @@ -496,7 +498,7 @@ class UFBF_Quick extends UFB_Field } elseif (preg_match('!^<(\d{4})!', $r, $matches)) { $conds->addChild(new UFC_Promo('<=', UserFilter::DISPLAY, 'X' . $matches[1])); } elseif (preg_match('!^>(\d{4})!', $r, $matches)) { - $this->conds->addChild(new UFC_Promo('>=', UserFilter::DISPLAY, 'X' . $matches[1])); + $conds->addChild(new UFC_Promo('>=', UserFilter::DISPLAY, 'X' . $matches[1])); } } -- 2.1.4