diff options
author | Andreas Gohr <andi@splitbrain.org> | 2007-08-04 14:51:24 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2007-08-04 14:51:24 +0200 |
commit | 71f7bde7834ef576e5312e68d5e739bfe70afbcb (patch) | |
tree | b33cb5bb532ae333c821bbe7bf78aa8d7d7854dc /inc/common.php | |
parent | 8ef9da354015afa9415848e942c924ce6b12288c (diff) | |
download | rpg-71f7bde7834ef576e5312e68d5e739bfe70afbcb.tar.gz rpg-71f7bde7834ef576e5312e68d5e739bfe70afbcb.tar.bz2 |
generic search engines result highlighting
darcs-hash:20070804125124-7ad00-5558de577207bb63af7629f278c24991f23924bc.gz
Diffstat (limited to 'inc/common.php')
-rw-r--r-- | inc/common.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/inc/common.php b/inc/common.php index 4f61db560..e812d181d 100644 --- a/inc/common.php +++ b/inc/common.php @@ -893,20 +893,27 @@ function notify($id,$who,$rev='',$summary='',$minor=false,$replace=array()){ } /** - * extracts the query from a google referer + * extracts the query from a search engine referrer * - * @todo should be more generic and support yahoo et al * @author Andreas Gohr <andi@splitbrain.org> + * @author Todd Augsburger <todd@rollerorgans.com> */ function getGoogleQuery(){ $url = parse_url($_SERVER['HTTP_REFERER']); if(!$url) return ''; - if(!preg_match("#google\.#i",$url['host'])) return ''; $query = array(); parse_str($url['query'],$query); - - return $query['q']; + if(isset($query['q'])) + return $query['q']; // google, live/msn, aol, ask, altavista, alltheweb, gigablast + elseif(isset($query['p'])) + return $query['p']; // yahoo + elseif(isset($query['query'])) + return $query['query']; // lycos, netscape, clusty, hotbot + elseif(preg_match("#a9\.com#i",$url['host'])) // a9 + return urldecode(ltrim($url['path'],'/')); + + return ''; } /** |