mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-30 18:24:29 +01:00
fully replace SQL wildcard with *
This commit is contained in:
parent
233cb44f18
commit
835d3bfc79
4
mod.php
4
mod.php
@ -317,7 +317,7 @@
|
|||||||
$_body = '';
|
$_body = '';
|
||||||
|
|
||||||
// Remove SQL wildcard
|
// Remove SQL wildcard
|
||||||
$phrase = str_replace('%', '%%', $phrase);
|
$phrase = str_replace('%', '!%', $phrase);
|
||||||
|
|
||||||
// Use asterisk as wildcard to suit convention
|
// Use asterisk as wildcard to suit convention
|
||||||
$phrase = str_replace('*', '%', $phrase);
|
$phrase = str_replace('*', '%', $phrase);
|
||||||
@ -345,7 +345,7 @@
|
|||||||
if(!empty($like))
|
if(!empty($like))
|
||||||
$like .= ' AND ';
|
$like .= ' AND ';
|
||||||
$phrase = preg_replace('/^\'(.+)\'$/', '\'%$1%\'', $phrase);
|
$phrase = preg_replace('/^\'(.+)\'$/', '\'%$1%\'', $phrase);
|
||||||
$like .= '`body` LIKE ' . $phrase;
|
$like .= '`body` LIKE ' . $phrase . ' ESCAPE \'!\'';
|
||||||
}
|
}
|
||||||
|
|
||||||
$like = str_replace('%', '%%', $like);
|
$like = str_replace('%', '%%', $like);
|
||||||
|
Loading…
Reference in New Issue
Block a user