X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fsearch%2Fclasses.inc.php;h=8a2710146b7de268cfff5bbdf065e0149e209a8b;hb=295d4c48a12e49274135d9f781862a45e5b8c5dc;hp=edebc8cffffd67c898bb7486cfe74adbcb6886d5;hpb=787bb3d745141f2f85bd947ad7dd775d2c63f908;p=platal.git diff --git a/modules/search/classes.inc.php b/modules/search/classes.inc.php index edebc8c..8a27101 100644 --- a/modules/search/classes.inc.php +++ b/modules/search/classes.inc.php @@ -252,6 +252,11 @@ class QuickSearch extends SField $s = preg_replace('!\d+!', ' ', $s); $this->strings = preg_split("![^a-zA-Z%]+!",$s, -1, PREG_SPLIT_NO_EMPTY); + if (count($this->strings) > 5) { + global $page; + $page->trig("Tu as indiqué trop d'éléments dans ta recherche, seuls les 5 premiers seront pris en compte"); + $this->strings = array_slice($this->strings, 0, 5); + } $s = preg_replace('! *- *!', '-', $r); $s = preg_replace('!([<>]) *!', ' \1', $s); @@ -468,7 +473,16 @@ class RefSField extends SField return false; } $res = implode(' OR ', array_filter(array_map(array($this, 'get_single_match_statement'), $this->fieldDbName))); - return "INNER JOIN {$this->refTable} AS {$this->refAlias} ON ({$this->refCondition} AND ($res) )"; + if (is_array($this->refTable)) { + foreach ($this->refTable as $i => $refT) + $last = $i; + $inner = ""; + foreach ($this->refTable as $i => $refT) + $inner .= " INNER JOIN {$refT} AS {$this->refAlias[$i]} ON ({$this->refCondition[$i]} ".(($i == $last)?"AND ($res) ":"").")\n"; + return $inner; + } else { + return "INNER JOIN {$this->refTable} AS {$this->refAlias} ON ({$this->refCondition} AND ($res) )"; + } } // }}}