From f93b3b503d8e2938a107d1c12bed1fd65308f933 Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Fri, 15 Feb 2008 18:58:16 +0100 Subject: [PATCH] fix highlighting of search engine referer keywords for recent highlight change darcs-hash:20080215175816-7ad00-f12f54210dceacf4b3580e78b2f86a21a23b4315.gz --- inc/common.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/inc/common.php b/inc/common.php index 25dffdf94..3cacc8ec0 100644 --- a/inc/common.php +++ b/inc/common.php @@ -986,15 +986,17 @@ function getGoogleQuery(){ $query = array(); parse_str($url['query'],$query); if(isset($query['q'])) - return $query['q']; // google, live/msn, aol, ask, altavista, alltheweb, gigablast + $q = $query['q']; // google, live/msn, aol, ask, altavista, alltheweb, gigablast elseif(isset($query['p'])) - return $query['p']; // yahoo + $q = $query['p']; // yahoo elseif(isset($query['query'])) - return $query['query']; // lycos, netscape, clusty, hotbot + $q = $query['query']; // lycos, netscape, clusty, hotbot elseif(preg_match("#a9\.com#i",$url['host'])) // a9 - return urldecode(ltrim($url['path'],'/')); + $q = urldecode(ltrim($url['path'],'/')); - return ''; + if(!$q) return ''; + $q = join('|',preg_split('/[\s\'"\\\\`()\]\[?:!\.{};,#+*<>\\/]+/',$q,-1,PREG_SPLIT_NO_EMPTY)); + return $q; } /** -- GitLab