From ee54e839e8a28c0d7b2f2a622158749313f7c0b6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Sun, 13 Dec 2009 16:43:16 +0100 Subject: [PATCH] Fixes conditions build for the advanced search. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- modules/search/classes.inc.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/search/classes.inc.php b/modules/search/classes.inc.php index 4f7b4a3..62ec5d5 100644 --- a/modules/search/classes.inc.php +++ b/modules/search/classes.inc.php @@ -443,7 +443,7 @@ class RefSField extends SField function too_large() { - return ($this->value==''); + return ($this->value == ''); } // }}} @@ -581,7 +581,7 @@ class StringSField extends SField function too_large() { - return ($this->length()<2); + return ($this->length() < 2); } // }}} @@ -767,11 +767,14 @@ class SFieldGroup { $this->fields = $_fields; $this->and = $_and; - foreach ($this->fields as $key=>&$field) { - if (is_null($field)) { - unset($this->fields[$key]); + + $cleanFields = array(); + foreach ($this->fields as $field) { + if (!is_null($field)) { + $cleanFields[] = $field; } } + $this->fields = $cleanFields; } // }}} @@ -780,7 +783,7 @@ class SFieldGroup function too_large() { $b = true; - for ($i=0 ; $b && $ifields) ; $i++) { + for ($i = 0; $b && $i < count($this->fields); ++$i) { if (!is_null($this->fields[$i])) { $b = $b && $this->fields[$i]->too_large(); } -- 2.1.4