1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 04:23:01 +00:00

Properly escape search terms in the context highlighter.

This commit is contained in:
Starbeamrainbowlabs 2015-11-14 17:02:57 +00:00
parent b539cb4107
commit 0e3a7f345a
3 changed files with 3 additions and 3 deletions

View file

@ -1957,7 +1957,7 @@ class search
foreach($qterms as $qterm)
{
// From http://stackoverflow.com/a/2483859/1460422
$context = preg_replace("/" . preg_quote($qterm) . "/i", "<strong>$0</strong>", $context);
$context = preg_replace("/" . preg_quote(str_replace("/", "\/", $qterm)) . "/i", "<strong>$0</strong>", $context);
}
return $context;

View file

@ -50,7 +50,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds proper search functionality to Pepperminty Wiki. Note that this module, at the moment, just contains test code while I figure out how best to write a search engine.",
"id": "feature-search",
"lastupdate": 1447520172,
"lastupdate": 1447520515,
"optional": false
},
{

View file

@ -472,7 +472,7 @@ class search
foreach($qterms as $qterm)
{
// From http://stackoverflow.com/a/2483859/1460422
$context = preg_replace("/" . preg_quote($qterm) . "/i", "<strong>$0</strong>", $context);
$context = preg_replace("/" . preg_quote(str_replace("/", "\/", $qterm)) . "/i", "<strong>$0</strong>", $context);
}
return $context;