diff --git a/data/script/furatalog.lib.php b/data/script/furatalog.lib.php index 7ad2f4f..9256f3e 100644 --- a/data/script/furatalog.lib.php +++ b/data/script/furatalog.lib.php @@ -114,12 +114,28 @@ class furatalogLib { $whereRequest .= " AND "; } - $tmpVal = implode('%', str_split($tmpVal)); + //$tmpVal = implode('%', str_split($tmpVal)); + $newtmpVal = ""; - $whereRequest .= "(content.name LIKE '%" . $tmpVal . "%' OR - creator.name LIKE '%" . $tmpVal . "%' + + $maxStringPos = strlen($tmpVal); + $currentStringPos = 1; + foreach (str_split($tmpVal) as $key2 => $value2) { + if ($currentStringPos < $maxStringPos) { + $newtmpVal .= $value2 . "[^" . $value2 . "]{0,2}"; + } else { + $newtmpVal .= $value2; + } + $currentStringPos++; + } + + $tmpVal = $newtmpVal; + + + $whereRequest .= "(content.name REGEXP '%" . $tmpVal . "%' OR + creator.name REGEXP '%" . $tmpVal . "%' " . ($section==1 ? - " OR species.name LIKE '%" . $tmpVal . "%' OR species.tag LIKE '%" . $tmpVal . "%') " : + " OR species.name REGEXP '%" . $tmpVal . "%' OR species.tag REGEXP '%" . $tmpVal . "%') " : ")") . ""; } } else {