From 60cae20fd836dad7c18a93fead4293e0187959bf Mon Sep 17 00:00:00 2001 From: SiskelDev Date: Sat, 7 Jun 2025 20:48:01 +0200 Subject: [PATCH] extendet the search function --- data/script/furatalog.lib.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/data/script/furatalog.lib.php b/data/script/furatalog.lib.php index 5d493d8..7ad2f4f 100644 --- a/data/script/furatalog.lib.php +++ b/data/script/furatalog.lib.php @@ -107,28 +107,26 @@ class furatalogLib { $searchSplitArray = explode(" ", $this->secureGET["s"]); foreach ($searchSplitArray as $key => $value) { - $tmpVal = str_replace("'","\'", $value); + //$tmpVal = str_replace("'","\'", $value); + $tmpVal = preg_replace("/[^a-zA-Z0-9\s]/", "", $value); if ($whereRequest != "") { $whereRequest .= " AND "; } - /// WHERE `name` REGEXP '^(?=.*k.*i.*t.*a.*v.*l.*i).*$'; - // 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 .* + $tmpVal = implode('%', str_split($tmpVal)); $whereRequest .= "(content.name LIKE '%" . $tmpVal . "%' OR creator.name LIKE '%" . $tmpVal . "%' " . ($section==1 ? - " OR species.name LIKE '%" . $tmpVal . "%') " : + " OR species.name LIKE '%" . $tmpVal . "%' OR species.tag LIKE '%" . $tmpVal . "%') " : ")") . ""; } } else { $whereRequest .= "(content.name LIKE '%%' OR creator.name LIKE '%%' " . ($section==1 ? - " OR species.name LIKE '%%') " : + " OR species.name LIKE '%%' OR species.tag LIKE '%%') " : ")") . ""; }