extendet the search function
This commit is contained in:
@@ -107,28 +107,26 @@ class furatalogLib {
|
|||||||
$searchSplitArray = explode(" ", $this->secureGET["s"]);
|
$searchSplitArray = explode(" ", $this->secureGET["s"]);
|
||||||
|
|
||||||
foreach ($searchSplitArray as $key => $value) {
|
foreach ($searchSplitArray as $key => $value) {
|
||||||
$tmpVal = str_replace("'","\'", $value);
|
//$tmpVal = str_replace("'","\'", $value);
|
||||||
|
$tmpVal = preg_replace("/[^a-zA-Z0-9\s]/", "", $value);
|
||||||
|
|
||||||
if ($whereRequest != "") {
|
if ($whereRequest != "") {
|
||||||
$whereRequest .= " AND ";
|
$whereRequest .= " AND ";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// WHERE `name` REGEXP '^(?=.*k.*i.*t.*a.*v.*l.*i).*$';
|
$tmpVal = implode('%', str_split($tmpVal));
|
||||||
// this searches for a string if present in a string regardless of the characters between the serached ones
|
|
||||||
// has to be made for every word and for every column
|
|
||||||
// change this system to regex with every character being seperated by a .*
|
|
||||||
|
|
||||||
$whereRequest .= "(content.name LIKE '%" . $tmpVal . "%' OR
|
$whereRequest .= "(content.name LIKE '%" . $tmpVal . "%' OR
|
||||||
creator.name LIKE '%" . $tmpVal . "%'
|
creator.name LIKE '%" . $tmpVal . "%'
|
||||||
" . ($section==1 ?
|
" . ($section==1 ?
|
||||||
" OR species.name LIKE '%" . $tmpVal . "%') " :
|
" OR species.name LIKE '%" . $tmpVal . "%' OR species.tag LIKE '%" . $tmpVal . "%') " :
|
||||||
")") . "";
|
")") . "";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$whereRequest .= "(content.name LIKE '%%' OR
|
$whereRequest .= "(content.name LIKE '%%' OR
|
||||||
creator.name LIKE '%%'
|
creator.name LIKE '%%'
|
||||||
" . ($section==1 ?
|
" . ($section==1 ?
|
||||||
" OR species.name LIKE '%%') " :
|
" OR species.name LIKE '%%' OR species.tag LIKE '%%') " :
|
||||||
")") . "";
|
")") . "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user