Commit 919a4e75 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Fix MATCH statement. Also improve search.

parent c4e5bb42
...@@ -45,7 +45,7 @@ $extraclause = ""; ...@@ -45,7 +45,7 @@ $extraclause = "";
PAGEHEADER("Image Search"); PAGEHEADER("Image Search");
if (isset($searchfor) && isset($searchby)) { if (isset($searchfor) && isset($searchby)) {
if (! preg_match('/^[-\w\:,\.\+]+$/', $searchfor)) { if (! preg_match('/^[\w\:,\.\+]+$/', $searchfor)) {
USERERROR("Illegal characters in search clause", 1); USERERROR("Illegal characters in search clause", 1);
} }
if ($searchby == "nodetype") { if ($searchby == "nodetype") {
...@@ -68,8 +68,8 @@ if (isset($searchfor) && isset($searchby)) { ...@@ -68,8 +68,8 @@ if (isset($searchfor) && isset($searchby)) {
} }
elseif ($searchby == "namedesc") { elseif ($searchby == "namedesc") {
$safe_searchfor = addslashes($searchfor); $safe_searchfor = addslashes($searchfor);
$extraclause = "and (match (i.imagename,iv.description) ". $extraclause = "and (match (iv.imagename,iv.description) ".
"against('$safe_searchfor'))"; "against('*${safe_searchfor}*'))";
} }
} }
else { else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment