diff options
author | Andreas Gohr <andi@splitbrain.org> | 2005-08-30 20:16:51 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2005-08-30 20:16:51 +0200 |
commit | 89541d4b7dc947af15bd1e26777c11be11931e50 (patch) | |
tree | 6e90911cffa04d1067ae7832893d131f8942f451 | |
parent | 5397cb9776dac56cc5b050b86d6fb9bfcb63dc6d (diff) | |
download | rpg-89541d4b7dc947af15bd1e26777c11be11931e50.tar.gz rpg-89541d4b7dc947af15bd1e26777c11be11931e50.tar.bz2 |
fix for breaking singlequote in searchhighlight #519
darcs-hash:20050830181651-7ad00-c8ba03edc14cbe64c1572216bad0748d90a87f5e.gz
-rw-r--r-- | inc/common.php | 9 | ||||
-rw-r--r-- | inc/html.php | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/inc/common.php b/inc/common.php index 76540baee..24a8a1889 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1039,4 +1039,13 @@ function subscriber_addresslist($id){ return $emails; } +/** + * Removes quoting backslashes + * + * @author Andreas Gohr <andi@splitbrain.org> + */ +function unslash($string,$char="'"){ + return str_replace('\\'.$char,$char,$string); +} + //Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/inc/html.php b/inc/html.php index da27936e1..3078ff838 100644 --- a/inc/html.php +++ b/inc/html.php @@ -283,7 +283,7 @@ function html_hilight($html,$query){ $queries = preg_split ("/\s/",$query,-1,PREG_SPLIT_NO_EMPTY); foreach ($queries as $q){ $q = preg_quote($q,'/'); - $html = preg_replace("/((<[^>]*)|$q)/ie", '"\2"=="\1"? "\1":"<span class=\"search_hit\">\1</span>"', $html); + $html = preg_replace("/((<[^>]*)|$q)/ie", '"\2"=="\1"? unslash("\1"):"<span class=\"search_hit\">".unslash("\1")."</span>"', $html); } return $html; } |