aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/search
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2010-08-10 16:04:49 +0200
committerAndreas Fischer <bantu@phpbb.com>2010-08-10 16:04:49 +0200
commitd66aadc33fe8260b206222c9bf19d526f8372ee1 (patch)
tree9431de664e2fffa9dd3fecbe623e0702f2203791 /phpBB/includes/search
parent19599b4c69c93f9dbb02dd92281747798da391bc (diff)
parent76348ce43f0dc657182746d185f9882d3349cd2c (diff)
downloadforums-d66aadc33fe8260b206222c9bf19d526f8372ee1.tar
forums-d66aadc33fe8260b206222c9bf19d526f8372ee1.tar.gz
forums-d66aadc33fe8260b206222c9bf19d526f8372ee1.tar.bz2
forums-d66aadc33fe8260b206222c9bf19d526f8372ee1.tar.xz
forums-d66aadc33fe8260b206222c9bf19d526f8372ee1.zip
Merge branch 'ticket/cs278/9760' into develop-olympus
* ticket/cs278/9760: [ticket/9760] Remove unrestricted wildcards from search terms.
Diffstat (limited to 'phpBB/includes/search')
-rw-r--r--phpBB/includes/search/fulltext_native.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php
index c89e92711e..727e3aaffb 100644
--- a/phpBB/includes/search/fulltext_native.php
+++ b/phpBB/includes/search/fulltext_native.php
@@ -83,7 +83,9 @@ class fulltext_native extends search_backend
{
global $db, $user, $config;
- $keywords = trim($this->cleanup($keywords, '+-|()*'));
+ $tokens = '+-|()*';
+
+ $keywords = trim($this->cleanup($keywords, $tokens));
// allow word|word|word without brackets
if ((strpos($keywords, ' ') === false) && (strpos($keywords, '|') !== false) && (strpos($keywords, '(') === false))
@@ -114,6 +116,15 @@ class fulltext_native extends search_backend
case ' ':
$keywords[$i] = '|';
break;
+ case '*':
+ if ($i === 0 || ($keywords[$i - 1] !== '*' && strcspn($keywords[$i - 1], $tokens) === 0))
+ {
+ if ($i === $n - 1 || ($keywords[$i + 1] !== '*' && strcspn($keywords[$i + 1], $tokens) === 0))
+ {
+ $keywords = substr($keywords, 0, $i) . substr($keywords, $i + 1);
+ }
+ }
+ break;
}
}
else