summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-07-18 14:35:34 -0400
committerEvan Prodromou <evan@prodromou.name>2008-07-18 14:35:34 -0400
commit7853df51cec346ac2479cb25d5224b6ad69135c8 (patch)
tree935e05476f94a79826e78d198aa13bbd160d6009
parentf50bc7044552955af29b2a7426bdd72bfdf9ca8f (diff)
quote match terms
darcs-hash:20080718183534-84dde-a8cdb4cbcb3eb67152eb74179e3b00061e2287cf.gz
-rw-r--r--actions/peoplesearch.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php
index 323065d7a..f700cf46e 100644
--- a/actions/peoplesearch.php
+++ b/actions/peoplesearch.php
@@ -115,7 +115,8 @@ class PeoplesearchAction extends SearchAction {
}
function highlight($text, $terms) {
- $pattern = '/('.implode('|',array_map('htmlspecialchars', $terms)).')/i';
+ $terms = array_map('preg_quote', array_map('htmlspecialchars', $terms));
+ $pattern = '/('.implode('|',$terms).')/i';
$result = preg_replace($pattern, '<strong>\\1</strong>', htmlspecialchars($text));
return $result;
}