Fix QuickSearch
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Fri, 5 Feb 2010 15:32:01 +0000 (16:32 +0100)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Sat, 13 Feb 2010 23:34:00 +0000 (00:34 +0100)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
include/ufbuilder.inc.php

index 41e1cf4..d299d74 100644 (file)
@@ -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]));
             }
         }