[PC-BSD Commits] r2100 - websites/pbidir.com/bibivu/sbin

svn at pcbsd.org svn at pcbsd.org
Sun Jun 15 09:18:14 PDT 2008


Author: fabry
Date: 2008-06-15 09:18:14 -0700 (Sun, 15 Jun 2008)
New Revision: 2100

Modified:
   websites/pbidir.com/bibivu/sbin/user_info.php
Log:
trying to gather more information from the user_agent. more browsers added and aso a function that will try to return the bits used on the user machine (i386 or amd64)

Modified: websites/pbidir.com/bibivu/sbin/user_info.php
===================================================================
--- websites/pbidir.com/bibivu/sbin/user_info.php	2008-06-15 04:36:25 UTC (rev 2099)
+++ websites/pbidir.com/bibivu/sbin/user_info.php	2008-06-15 16:18:14 UTC (rev 2100)
@@ -9,6 +9,8 @@
  
  1.0.00: First release
  1.0.01: better way to discover browser
+ 1.1.00: more browsers added to the list, and modified the function to return if the browser is a crawler or not faster
+         added a new beta function that will try to see if the user is on a i386 or amd64 platform
 
  TO-DO:
   - add more possible OS and browser: look at this class:
@@ -30,7 +32,8 @@
 
 			$return['user_agent']		= $this->user_agent();
 			$return['browser']			= $this->broser('all');
-			$return['os']				= $this->os();
+			$return['os']				= $this->os('all');
+			$return['bits']				= $this->bits();		//beta
 			$return['language']			= $this->language();
 			$return['accept']			= $this->accept();
 			$return['encoding']			= $this->encoding();
@@ -71,6 +74,26 @@
 		}
 		return $return;
 	}
+	public function bits(){
+		//this is beta
+		$return = '';
+		$ua = strtolower($this->user_agent());
+		if(($pos = strpos($ua,'a64')) !== false || ($pos = strpos($ua,'amd64')) !== false) {
+			$return = 'amd64';
+		}elseif(($pos = strpos($ua,'i386')) !== false) {
+			$return = 'i386';
+		}elseif(($pos = strpos($ua,'i486')) !== false) {
+			$return = 'i486';
+		}elseif(($pos = strpos($ua,'i586')) !== false) {
+			$return = 'i586';
+		}elseif(($pos = strpos($ua,'i686')) !== false) {
+			$return = 'i686';
+		}else{
+			//is this the right assumption?
+			$return = 'i386';
+		}
+		return $return;
+	}
 	public function user_agent(){
 		//return the user agent
 		return isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:'';
@@ -92,47 +115,223 @@
 		$ua				= strtolower($this->user_agent());
 		$Browser		= 'Not Detected';
 		$BrowserVersion = '';
-		$browsers['MSIE']		= 'Internet Explorer';
-		$browsers['Firefox']	= 'Mozilla Firefox';
-		$browsers['Firebird']	= 'Mozilla Firebird';
-		$browsers['Netscape']	= 'Netscape Navigator';
-		$browsers['Konqueror']	= 'Konqueror';
-		$browsers['Mozilla']	= 'Mozilla';
-		$browsers['Opera']		= 'Opera';
-		$browsers['msnbot']		= 'MSNBot';
-		$browsers['HTMLParser']	= 'HTMLParser';
-		$browsers['SurveyBot']	= 'SurveyBot - Whois Source';
-		$browsers['Googlebot-Image']	= 'Google Image';
-		$browsers['Googlebot']	= 'Google';
-		$browsers['Feedfetcher']	= 'Feedfetcher-Google';
-		$browsers['Gigabot']	= 'Gigabot';
-		$browsers['Slurp']		= 'Yahoo! Slurp';
-		$browsers['Alexa']		= 'Alexa (IA Archive)';
+		$browsers['Alexa']				= array('name'=>'Alexa (IA Archive)','is_crawler'=>true, 'get_version'=>true);
+		$browsers['ia_archiver']		= array('name'=>'Alexa (IA Archive)','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Acorn Browse']		= array('name'=>'Acorn Browse','is_crawler'=>false, 'get_version'=>true);
+		$browsers['amaya']				= array('name'=>'Amaya','is_crawler'=>false, 'get_version'=>true);
+		$browsers['almaden']			= array('name'=>'IBM Almaden Crawler','is_crawler'=>true, 'get_version'=>true);
+		$browsers['AmigaVoyager']		= array('name'=>'Amiga Voyager','is_crawler'=>false, 'get_version'=>true);
+		$browsers['amigaweb']			= array('name'=>'aweb','is_crawler'=>false, 'get_version'=>true);
+		$browsers['archive']			= array('name'=>'generic (archive)','is_crawler'=>true, 'get_version'=>true);
+		$browsers['askjeeves']			= array('name'=>'Ask Jeeves','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Avant Browser']		= array('name'=>'Avant Browser','is_crawler'=>false, 'get_version'=>true);
+		$browsers['aweb']				= array('name'=>'aweb','is_crawler'=>false, 'get_version'=>true);
+
+		$browsers['beonex']				= array('name'=>'Beonex','is_crawler'=>false, 'get_version'=>true);
+		$browsers['BecomeBot']			= array('name'=>'BecomeBot','is_crawler'=>true, 'get_version'=>true);
+		$browsers['bluefish']			= array('name'=>'Bluefish','is_crawler'=>false, 'get_version'=>true);
+		$browsers['bot']				= array('name'=>'generic (bot)','is_crawler'=>true, 'get_version'=>false);
+		$browsers['BrowseX']			= array('name'=>'BrowseX','is_crawler'=>false, 'get_version'=>true);
+
+		$browsers['camino']				= array('name'=>'Camino','is_crawler'=>false, 'get_version'=>true);
+		$browsers['charon']				= array('name'=>'Charon','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Check&Get']			= array('name'=>'Check&Get','is_crawler'=>true, 'get_version'=>true);
+		$browsers['chimera']			= array('name'=>'Chimera','is_crawler'=>false, 'get_version'=>true);
+		$browsers['converacrawler']		= array('name'=>'ConveraCrawler','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Contiki']			= array('name'=>'Contiki','is_crawler'=>true, 'get_version'=>true);
+		$browsers['crawl']				= array('name'=>'generic (crawl)','is_crawler'=>true, 'get_version'=>false);
+		$browsers['cURL']				= array('name'=>'cURL','is_crawler'=>false, 'get_version'=>true);
+		$browsers['cyberdog']			= array('name'=>'CyberDog','is_crawler'=>false, 'get_version'=>true);
+
+		$browsers['democracy']			= array('name'=>'Democracy','is_crawler'=>false, 'get_version'=>true);
+		$browsers['desktop/1x']			= array('name'=>'Lycoris Desktop/LX','is_crawler'=>false, 'get_version'=>true);
+		$browsers['dillo']				= array('name'=>'Dillo','is_crawler'=>false, 'get_version'=>true);
+		$browsers['doczilla']			= array('name'=>'DocZilla','is_crawler'=>false, 'get_version'=>true);
+		$browsers['doris']				= array('name'=>'Doris','is_crawler'=>false, 'get_version'=>true);
+
+		$browsers['echo!']				= array('name'=>'Echo!','is_crawler'=>true, 'get_version'=>false);
+		$browsers['edbrowse']			= array('name'=>'edbrowse','is_crawler'=>true, 'get_version'=>true);
+		$browsers['edintorni']			= array('name'=>'EDintorni','is_crawler'=>true, 'get_version'=>true);
+		$browsers['ELinks']				= array('name'=>'ELinks','is_crawler'=>false, 'get_version'=>true);
+		$browsers['emacs']				= array('name'=>'EMacs','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Epiphany']			= array('name'=>'Epiphany','is_crawler'=>false, 'get_version'=>true);
+
+		$browsers['Fast Webcrawler']	= array('name'=>'Fast Webcrawler','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Feedfetcher']		= array('name'=>'Feedfetcher-Google','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Fetch']				= array('name'=>'generic (fetch)','is_crawler'=>true, 'get_version'=>false);
+		$browsers['Firebird']			= array('name'=>'Mozilla Firebird','is_crawler'=>false, 'get_version'=>true);
+		$browsers['FindLinks']			= array('name'=>'FindLinks','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Flock']				= array('name'=>'Flock','is_crawler'=>false, 'get_version'=>true);
+		$browsers['frontpage']			= array('name'=>'Microsoft Frontpage','is_crawler'=>false, 'get_version'=>true);
+
+		$browsers['galeon']				= array('name'=>'Galeon','is_crawler'=>false, 'get_version'=>true);
+		$browsers['gaisbot']			= array('name'=>'GaisBot','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Gigabot']			= array('name'=>'GigaBot','is_crawler'=>true, 'get_version'=>true);
+		$browsers['GirafaBot']			= array('name'=>'GirafaBot','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Gnuzilla']			= array('name'=>'Gnuzilla','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Googlebot-Image']	= array('name'=>'Google Image','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Googlebot']			= array('name'=>'Google','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Grab']				= array('name'=>'generic (grab)','is_crawler'=>true, 'get_version'=>false);
+		$browsers['GreenBrowser']		= array('name'=>'GreenBrowser','is_crawler'=>false, 'get_version'=>true);
+		$browsers['grub-client']		= array('name'=>'Grub Client','is_crawler'=>true, 'get_version'=>true);
+
+		$browsers['HTMLParser']			= array('name'=>'HTMLParser','is_crawler'=>true, 'get_version'=>true);
+		$browsers['holmes']				= array('name'=>'Holmes','is_crawler'=>true, 'get_version'=>true);
+		$browsers['HotJava']			= array('name'=>'HotJava','is_crawler'=>false, 'get_version'=>true);
+		$browsers['HP Web PrintSmart']	= array('name'=>'HP Web PrintSmart','is_crawler'=>false, 'get_version'=>true);
+		$browsers['HTTPClient']			= array('name'=>'HTTPClient','is_crawler'=>false, 'get_version'=>true);
+
+		$browsers['IBM Web Browser']	= array('name'=>'IBM Web Browser','is_crawler'=>false, 'get_version'=>true);
+		$browsers['IBrowse']			= array('name'=>'IBrowse','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Icab']				= array('name'=>'ICab','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Ice']				= array('name'=>'ICE','is_crawler'=>false, 'get_version'=>true);
+		$browsers['iconsurf']			= array('name'=>'IconSurf','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Ichiro']				= array('name'=>'Ichiro','is_crawler'=>true, 'get_version'=>true);
+		$browsers['innerprisebot']		= array('name'=>'Innerprise','is_crawler'=>true, 'get_version'=>true);
+		$browsers['ipd']				= array('name'=>'AlertSite','is_crawler'=>true, 'get_version'=>false);
+
+		$browsers['Kazehakase']			= array('name'=>'Kazehakase','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Kkman']				= array('name'=>'Kkman','is_crawler'=>false, 'get_version'=>true);
+		$browsers['K-Meleon']			= array('name'=>'K-Meleon','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Konqueror']			= array('name'=>'Konqueror','is_crawler'=>false, 'get_version'=>true);
+
+		$browsers['liberate']			= array('name'=>'Liberate','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Links']				= array('name'=>'Links','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Link-Checker-Pro']	= array('name'=>'Link Checker Pro','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Link Checker Pro']	= array('name'=>'Link Checker Pro','is_crawler'=>true, 'get_version'=>true);
+		$browsers['linkwalker']			= array('name'=>'LinkWalker','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Lobo']				= array('name'=>'Lobo','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Lynx']				= array('name'=>'Lynx','is_crawler'=>false, 'get_version'=>true);
+
+		$browsers['Maxthon']			= array('name'=>'Maxthon','is_crawler'=>false, 'get_version'=>true);
+		$browsers['MediaPartner']		= array('name'=>'MediaPartner','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Midori']				= array('name'=>'Midori','is_crawler'=>false, 'get_version'=>true);
+		$browsers['mirago']				= array('name'=>'Mirago','is_crawler'=>true, 'get_version'=>true);
+		$browsers['moget']				= array('name'=>'Moget','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Mosaic']				= array('name'=>'Mosaic','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Mothra']				= array('name'=>'Mothra','is_crawler'=>false, 'get_version'=>true);
+		$browsers['msnbot']				= array('name'=>'MSNBot','is_crawler'=>true, 'get_version'=>true);
+		$browsers['mj12bot']			= array('name'=>'MJ12Bot','is_crawler'=>true, 'get_version'=>true);
+
+		$browsers['naverbot']			= array('name'=>'NaverBot','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Netbox']				= array('name'=>'NetBox','is_crawler'=>false, 'get_version'=>true);
+		$browsers['netcaptor']			= array('name'=>'NetCaptor','is_crawler'=>false, 'get_version'=>true);
+		$browsers['netcraft']			= array('name'=>'NetCraft','is_crawler'=>true, 'get_version'=>true);
+		$browsers['netpliance']			= array('name'=>'Netpliance','is_crawler'=>false, 'get_version'=>true);
+		$browsers['netpositive']		= array('name'=>'NetPositice','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Netsurf']			= array('name'=>'Netsurf','is_crawler'=>false, 'get_version'=>true);
+		$browsers['NewsGator']			= array('name'=>'NewsGator','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Nomad']				= array('name'=>'Nomad','is_crawler'=>true, 'get_version'=>true);
+		$browsers['ng']					= array('name'=>'Exabot NG','is_crawler'=>true, 'get_version'=>false);
+		$browsers['nextgensearchbot']	= array('name'=>'NextGenSearchBot','is_crawler'=>true, 'get_version'=>true);
+
+		$browsers['offbyone']			= array('name'=>'OffByOne','is_crawler'=>false, 'get_version'=>true);
+		$browsers['omniweb']			= array('name'=>'omniweb','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Opera']				= array('name'=>'Opera','is_crawler'=>false, 'get_version'=>true);
+		$browsers['oracle']				= array('name'=>'Oracle PowerBrowser','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Oregano']			= array('name'=>'Oregano','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Oxygen']				= array('name'=>'Oxygen','is_crawler'=>false, 'get_version'=>true);
+
+		$browsers['poodle predictor']	= array('name'=>'Poodle Predictor','is_crawler'=>true, 'get_version'=>true);
+		$browsers['phoenix']			= array('name'=>'Phoenix','is_crawler'=>false, 'get_version'=>true);
+		$browsers['PlanetWeb']			= array('name'=>'PlanetWeb','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Prodigy']			= array('name'=>'Prodigy','is_crawler'=>false, 'get_version'=>true);
+		$browsers['PowerTV']			= array('name'=>'PowerTV','is_crawler'=>false, 'get_version'=>true);
+		$browsers['psbot']				= array('name'=>'PSBot','is_crawler'=>true, 'get_version'=>true);
+
+		$browsers['QuickTime']			= array('name'=>'QuickTime','is_crawler'=>false, 'get_version'=>true);
+		$browsers['qtver']				= array('name'=>'QuickTime','is_crawler'=>false, 'get_version'=>true);
+
+		$browsers['retawq']				= array('name'=>'Retawq','is_crawler'=>false, 'get_version'=>true);
+		$browsers['robot']				= array('name'=>'generic (robot)','is_crawler'=>true, 'get_version'=>false);
+
+		$browsers['Science Traveller International 1X']				= array('name'=>'Science Traveller International 1X','is_crawler'=>false, 'get_version'=>false);
+		$browsers['sbider']				= array('name'=>'SiteSell','is_crawler'=>true, 'get_version'=>true);
+		$browsers['scooter']			= array('name'=>'Scooter','is_crawler'=>true, 'get_version'=>true);
+		$browsers['seekbot']			= array('name'=>'generic (seekbot)','is_crawler'=>true, 'get_version'=>false);
+		$browsers['SeaMonkey']			= array('name'=>'SeaMonkey','is_crawler'=>false, 'get_version'=>true);
+		$browsers['seeker']				= array('name'=>'generic (seeker)','is_crawler'=>true, 'get_version'=>false);
+		$browsers['sextatnt']			= array('name'=>'Tango','is_crawler'=>false, 'get_version'=>true);
+		$browsers['SharpReader']		= array('name'=>'SharpReader','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Shiira']				= array('name'=>'Shiira','is_crawler'=>false, 'get_version'=>true);
+		$browsers['sis']				= array('name'=>'Spectrum Internet Suite','is_crawler'=>false, 'get_version'=>false);
+		$browsers['Slurp']				= array('name'=>'Yahoo! Slurp','is_crawler'=>true, 'get_version'=>true);
+		$browsers['Songbird']			= array('name'=>'Songbird','is_crawler'=>false, 'get_version'=>true);
+		$browsers['spider']				= array('name'=>'generic (spider)','is_crawler'=>true, 'get_version'=>false);
+		$browsers['survey']				= array('name'=>'generic (survey)','is_crawler'=>true, 'get_version'=>false);
+		$browsers['Sylera']				= array('name'=>'Sylera','is_crawler'=>false, 'get_version'=>true);
+		$browsers['SqWorm']				= array('name'=>'SqWorm','is_crawler'=>true, 'get_version'=>true);
+		
+		$browsers['SurveyBot']			= array('name'=>'SurveyBot - Whois Source','is_crawler'=>true, 'get_version'=>true);
+
+		$browsers['topicspy']			= array('name'=>'Topicspy Checkbot','is_crawler'=>true, 'get_version'=>true);
+		$browsers['tutorgigbot']		= array('name'=>'TutorGigBot','is_crawler'=>true, 'get_version'=>true);
+		$browsers['turnitinbot']		= array('name'=>'TurnitinBot','is_crawler'=>true, 'get_version'=>true);
+		$browsers['T-H-U-N-D-E-R-S-T-O-N-E']		= array('name'=>'T-H-U-N-D-E-R-S-T-O-N-E','is_crawler'=>true, 'get_version'=>false);
+
+		$browsers['UP.Browser']			= array('name'=>'UP Browser','is_crawler'=>false, 'get_version'=>true);
+
+		$browsers['validator']			= array('name'=>'generic (validator)','is_crawler'=>true, 'get_version'=>false);
+		$browsers['Voyager']			= array('name'=>'Voyager','is_crawler'=>false, 'get_version'=>true);
+
+		$browsers['w3c-checklink']		= array('name'=>'W3C Checklink','is_crawler'=>true, 'get_version'=>true);
+		$browsers['w3c_validator']		= array('name'=>'W3C Validator','is_crawler'=>true, 'get_version'=>true);
+		$browsers['W3CLineMode']		= array('name'=>'W3C Line Mode','is_crawler'=>false, 'get_version'=>true);
+		$browsers['W3M']				= array('name'=>'W3M','is_crawler'=>false, 'get_version'=>true);
+		$browsers['walhello']			= array('name'=>'WalHello','is_crawler'=>true, 'get_version'=>true);
+		$browsers['WebCapture']			= array('name'=>'WebCapture','is_crawler'=>false, 'get_version'=>true);
+		$browsers['WebExplorer']		= array('name'=>'WebExplorer','is_crawler'=>false, 'get_version'=>true);
+		$browsers['webtv']				= array('name'=>'WebTV','is_crawler'=>false, 'get_version'=>true);
+		$browsers['WGet']				= array('name'=>'WGet','is_crawler'=>false, 'get_version'=>true);
+
+		$browsers['xenu link sleuth']	= array('name'=>'Xenu\'s Link Analyser','is_crawler'=>true, 'get_version'=>true);
+		$browsers['xChaos_Arachne']		= array('name'=>'Arachne','is_crawler'=>true, 'get_version'=>true);
+
+		$browsers['Yandex']				= array('name'=>'Yandex','is_crawler'=>true, 'get_version'=>true);
+
+		$browsers['zyborg']				= array('name'=>'ZyBorg','is_crawler'=>true, 'get_version'=>true);
+		$browsers['zoe indexer']		= array('name'=>'Zoe Indexer','is_crawler'=>true, 'get_version'=>true);
+		
+		//those needs to be at the end, as many browser are based on those and they would be recognisex wrongly
+		$browsers['aol']				= array('name'=>'AOL','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Bison']				= array('name'=>'Bison','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Firefox']			= array('name'=>'Mozilla Firefox','is_crawler'=>false, 'get_version'=>true);
+		$browsers['iexplorer']			= array('name'=>'Internet Explorer','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Mozilla']			= array('name'=>'Mozilla','is_crawler'=>false, 'get_version'=>true);
+		$browsers['MSIE']				= array('name'=>'Internet Explorer','is_crawler'=>false, 'get_version'=>true);
+		$browsers['Netscape']			= array('name'=>'Netscape Navigator','is_crawler'=>false, 'get_version'=>true);
+		$browsers['safari']				= array('name'=>'safari','is_crawler'=>false, 'get_version'=>true);
+
 		foreach($browsers as $k=>$v){
 			$k = strtolower($k);
 			if(($pos = strpos($ua,$k)) !== false) {
-				$Browser=$v;
-				$pos+=strlen($k)+1;
-				$endPos=strpos($ua,' ',$pos);
-				$endPos = ($endPos===false) ? strlen($ua) : $endPos-$pos;
-				$BrowserVersion = substr($ua,$pos,$endPos);
+				$browser	= $v['name'];
+				$is_crawler	= $v['is_crawler'];
+				$pos		+= strlen($k)+1;
+				$endPos		= strpos($ua,' ',$pos);
+				$endPos		= ($endPos===false) ? strlen($ua) : $endPos-$pos;
+				$version	= substr($ua,$pos,$endPos);
 			}
 		}
 
 		switch($what){
 			case 'all':
-				$return['browser'] = $Browser.' v.'.$BrowserVersion;
-				$return['name'] = $Browser;
-				$return['version'] = $BrowserVersion;
+				$return['browser'] = $browser.' v.'.$version;
+				$return['name'] = $browser;
+				$return['version'] = $version;
+				$return['is_crawler'] = $is_crawler;
 				break;
 			case 'name':
-				$return		= $Browser;
+				$return = $browser;
 				break;
+			case 'is_crawler':
+				$return = $is_crawler;
+				break;
 			case 'version':
-				$return	= $BrowserVersion;
+				$return	= $version;
 				break;
 			default:
-				$return	= $Browser.' v.'.$BrowserVersion;
+				$return	= $browser.' v.'.$version;
 				break;
 		}
 		return $return;
@@ -143,6 +342,9 @@
 		$os = array();
 		//amiga
 		$os['amiga'] 		= array('name'=>'amiga','version'=>'');
+		//commodore
+		$os['Commodore 64'] 		= array('name'=>'Commodore','version'=>'64');
+		$os['Commodore 128'] 		= array('name'=>'Commodore','version'=>'128');
 		//dreamcast
 		$os['dreamcast']	= array('name'=>'sega dreamcast','version'=>'');
 		//googlebot
@@ -215,6 +417,8 @@
 		$os['openbsd i386']	= array('name'=>'openbsd','version'=>'i386');
 		//palm
 		$os['palm']			= array('name'=>'palm','version'=>'');
+		//PC-BSD
+		$os['pcbsd 7']		= array('name'=>'pcbsd','version'=>'7');
 		//power tv
 		$os['powertv']		= array('name'=>'powertv','version'=>'');
 		//prodigy
@@ -266,14 +470,15 @@
 		$os['windows ce']		= array('name'=>'windows','version'=>'ce');
 
 
-		$ua = $this->user_agent();
+		$ua = strtolower($this->user_agent());
 		$name = 'Not Detected';
 		$version = '';
 		if($ua!=''){
-			foreach($os as $key=>$value){
-				if(eregi($key, $ua)!==false){
-					$name = $value['name'];
-					$version = $value['version'];
+			foreach($os as $k=>$v){
+				$k = strtolower($k);
+				if(eregi($k, $ua)!==false){
+					$name = $v['name'];
+					$version = $v['version'];
 				}
 			}
 		}
@@ -533,57 +738,7 @@
 		}
 	}
 	public function is_crawler(){
-		$is_crawler = false;
-		$_crawlers = array();
-
-		$_crawlers[] = 'alexa';
-		$_crawlers[] = 'archive';
-		$_crawlers[] = 'askjeeves';
-		$_crawlers[] = 'bot';
-		$_crawlers[] = 'crawl';
-		$_crawlers[] = 'echo!';
-		$_crawlers[] = 'edintorni';
-		$_crawlers[] = 'feedfetcher';
-		$_crawlers[] = 'findlinks';
-		//$_crawlers[] = 'funwebproducts';		//this is not a crawler, just junk installed in the browser
-		$_crawlers[] = 'gigabot';
-		$_crawlers[] = 'girafabot';
-		$_crawlers[] = 'google';
-		$_crawlers[] = 'holmes';
-		$_crawlers[] = 'maxthon';
-		$_crawlers[] = 'mediapartner';
-		$_crawlers[] = 'mj12bot';
-		$_crawlers[] = 'mirago';
-		$_crawlers[] = 'moget';
-		$_crawlers[] = 'msnbot';
-		$_crawlers[] = 'netcraft';
-		$_crawlers[] = 'newsgator';
-		$_crawlers[] = 'nomad';
-		$_crawlers[] = 'robot';
-		$_crawlers[] = 'sbider';
-		$_crawlers[] = 'spider';
-		$_crawlers[] = 'scooter';
-		$_crawlers[] = 'seekbot';
-		$_crawlers[] = 'seeker';
-		$_crawlers[] = 'spider';
-		$_crawlers[] = 'survey';
-		$_crawlers[] = 'T-H-U-N-D-E-R-S-T-O-N-E';
-		$_crawlers[] = 'validator';
-		$_crawlers[] = 'walhello';
-		$_crawlers[] = 'yahoo';
-		$_crawlers[] = 'zyborg';
-		$ua = $this->user_agent();
-		if($ua!=''){
-			foreach($_crawlers as $value){
-				if(strpos($ua, $value)!==false){
-					$is_crawler = true;
-					break;
-				}
-			}
-		} else {
-			$is_crawler = true;
-		}
-		return $is_crawler;
+		return $this->browser('is_crawler');
 	}
 }
 /*
@@ -607,8 +762,10 @@
 	<ul>
 		<li>name: <?=$uinfo->browser('name');?></li>
 		<li>version: <?=$uinfo->browser('version');?></li>
+		<li>Is Crawler: <?=$uinfo->browser('is_crawler')?'Yes':'No'?></li>
 	</ul>
 </li>
+<li>Bits: <?=$uinfo->bits();?></li>
 <li>Security: <?=$uinfo->security();?></li>
 <li>Languages:
 	<ul><?php



More information about the Commits mailing list