fix Gecko version for Firefox 110 and later
[php-utility-classes.git] / classes / useragent.php-class
CommitLineData
31733e08 1<?php
880bcb60
RK
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
a5813ca3 5
31733e08 6class userAgent {
7 // userAgent PHP class
8 // get user agent and tell us what Browser is accessing
9 //
3077a4f6 10 // function __construct([$ua_string])
1defa974 11 // CONSTRUCTOR; reads UA string (or takes the optional given UA string) and gets info from that into our variables.
31733e08 12 //
3077a4f6 13 // private $uastring
31733e08 14 // the plain User Agent string
3077a4f6 15 // private $brand
bf78d3ed 16 // the User Agent brand name
3077a4f6 17 // private $version
31733e08 18 // the User Agent version
3077a4f6 19 // private $bot
a8464009 20 // bool: true if this agent is a bot
31fe75cc
RK
21 // private $mobile
22 // bool: true if this agent is a mobile phone
3077a4f6 23 // private $uadata
f983aa36 24 // array of static user agent data (static vars in functions are set for all objects of this class!)
31733e08 25 //
3077a4f6 26 // public function getBrand()
23585ba2 27 // returns the User Agent Brand Name
bf78d3ed 28 //
3077a4f6 29 // public function getVersion()
23585ba2 30 // returns the User Agent version
31 //
3077a4f6 32 // public function getAcceptLanguages()
4210e7b0 33 // returns an associated array with the accepted languages of this UA
34 // keys are language codes, values are q factors (weights)
35 //
3077a4f6 36 // public function getUAString()
f983aa36 37 // returns the full User Agent string
38 //
3077a4f6 39 // public function getEngine()
bf78d3ed 40 // returns a string telling the detected rendering engine, null if we can't detect
c18a4476 41 // one of gecko|khtml|trident|tasman|nscp|presto|gzilla|gtkhtml|links|icestorm|unknown
bf78d3ed 42 //
3077a4f6 43 // public function hasEngine($rnd_engine)
bf78d3ed 44 // returns true if the given rendering engine was detected
45 //
3077a4f6 46 // public function getEngineVersion()
bf78d3ed 47 // returns a the version number for the rendering engine
48 // this may be the same as getVersion() for many engines, or null if we don't know
49 //
3077a4f6 50 // public function getOS()
bf78d3ed 51 // returns a string telling the detected operating system, null if we can't detect
52 // might be very verbose, uses no abbreviations for most names
53 //
3077a4f6 54 // public function getPlatform()
bf78d3ed 55 // returns a string telling the detected OS platform, null if we can't detect
ac9220c2 56 // one of windows|linux|mac|solaris|unknown
bf78d3ed 57 //
3077a4f6 58 // public function getLanguage() {
bf78d3ed 59 // returns a string telling the detected browser UI language, null if we can't detect
60 // should be an ISO code
61 //
3077a4f6 62 // public function isBot()
a8464009 63 // returns true if User Agent seems to be a bot
bf78d3ed 64 //
31fe75cc
RK
65 // public function isMobile()
66 // returns true if User Agent seems to be a mobile phone
67 //
bf78d3ed 68 // *** functions that only return useable info for some agents ***
69 //
3077a4f6 70 // public function getGeckoDate()
bf78d3ed 71 // returns the Gecko date for Gecko-based browsers, null for others
72 //
a3e499ad
RK
73 // public function getGeckoTime()
74 // returns the Gecko build date/time as a unix epoch time number for Gecko-based browsers, null for others
75 //
bf78d3ed 76 // *** functions for compat to older versions of this class ***
77 //
3077a4f6 78 // public function isns()
31733e08 79 // returns true if User Agent seems to be Netscape brand, false if not
3077a4f6 80 // public function isns4()
31733e08 81 // returns true if User Agent seems to be Netscape Communicator 4.x, false if not
3077a4f6 82 // public function isie()
31733e08 83 // returns true if User Agent seems to be a version of Internet Exploder, false if not
3077a4f6 84 // public function geckobased()
31733e08 85 // returns true if User Agent seems to be a Gecko-based browser, false if not
3077a4f6 86 // public function geckodate()
31733e08 87 // returns the Gecko date when it's a Gecko-based browser, 0 if not
3077a4f6 88 // public function khtmlbased()
1defa974 89 // returns true if User Agent seems to be a KHTML-based browser, false if not
90
91 // collection of some known User Agent Strings:
bf78d3ed 92 // *** see testbed/ua_list_raw.txt ***
93 // *** see also http://www.pgts.com.au/pgtsj/pgtsj0208c.html ***
31733e08 94
3077a4f6 95 private $uastring;
96 private $brand;
97 private $version;
98 private $bot = false;
31fe75cc 99 private $mobile = false;
e78a7538 100 private $uadata = [];
31733e08 101
3077a4f6 102 function __construct($ua_string = '') {
31733e08 103 // *** constructor ***
1defa974 104 if (strlen($ua_string)) {
105 $this->uastring = $ua_string;
106 }
107 else {
108 // read raw UA string
4210e7b0 109 $this->uastring = $_SERVER['HTTP_USER_AGENT'];
1defa974 110 }
31733e08 111
112 // get UA brand and version
bf78d3ed 113 $this->brand = 'Unknown'; $this->version = null;
114 // find reasonable defaults
06c9b824 115 if (preg_match('|([0-9a-zA-Z\.:()_ -]+)/(\d[0-9a-zA-Z\._+-]*)|', $this->uastring, $regs)) {
bf78d3ed 116 $this->brand = trim($regs[1]);
117 $this->version = $regs[2];
118 }
06c9b824 119 elseif (preg_match('|^([a-zA-Z\._ -]+)[_ -][vV]?(\d[0-9a-zA-Z\.+]*)|', $this->uastring, $regs)) {
bf78d3ed 120 $this->brand = trim($regs[1]);
121 $this->version = $regs[2];
122 }
06c9b824 123 elseif (preg_match('|^([0-9a-zA-Z\._ -]+)|', $this->uastring, $regs)) {
bf78d3ed 124 $this->brand = trim($regs[1]);
125 $this->version = null;
126 }
81e72a3e 127 $this->bot = (strpos(strtolower($this->brand), 'bot') !== false)
128 || (strpos(strtolower($this->brand), 'crawler') !== false)
06c9b824
RK
129 || (strpos(strtolower($this->brand), 'spider') !== false)
130 || (strpos(strtolower($this->brand), 'search') !== false)
131 || (strpos(strtolower($this->brand), 'seek') !== false);
81e72a3e 132
bf78d3ed 133 // search for any real and/or special UAs
134 if (preg_match('|Netscape6/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
135 $this->brand = 'Netscape';
31733e08 136 $this->version = $regs[1];
81e72a3e 137 $this->bot = false;
31733e08 138 }
bf78d3ed 139 elseif (preg_match('|Netscape/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
140 $this->brand = 'Netscape';
31733e08 141 $this->version = $regs[1];
81e72a3e 142 $this->bot = false;
31733e08 143 }
208cf837
RK
144 elseif (preg_match('|Navigator/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
145 $this->brand = 'Netscape';
146 $this->version = $regs[1];
147 $this->bot = false;
148 }
bf78d3ed 149 elseif (preg_match('|Chimera/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
150 $this->brand = 'Chimera';
1defa974 151 $this->version = $regs[1];
81e72a3e 152 $this->bot = false;
1defa974 153 }
bf78d3ed 154 elseif (preg_match('|Camino/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
155 $this->brand = 'Camino';
a5813ca3 156 $this->version = $regs[1];
81e72a3e 157 $this->bot = false;
a5813ca3 158 }
bf78d3ed 159 elseif (preg_match('|Phoenix/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
160 $this->brand = 'Phoenix';
1defa974 161 $this->version = $regs[1];
81e72a3e 162 $this->bot = false;
1defa974 163 }
bf78d3ed 164 elseif (preg_match('|Mozilla Firebird/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
165 $this->brand = 'Mozilla Firebird';
23585ba2 166 $this->version = $regs[1];
81e72a3e 167 $this->bot = false;
23585ba2 168 }
c18a4476 169 elseif (preg_match('|Flock/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
170 $this->brand = 'Flock';
171 $this->version = $regs[1];
172 $this->bot = false;
173 }
b24eb888 174 elseif (preg_match('|SeaMonkey/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
175 $this->brand = 'SeaMonkey';
176 $this->version = $regs[1];
81e72a3e 177 $this->bot = false;
b24eb888 178 }
c18a4476 179 elseif (preg_match('|Iceape/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
9c17eb15 180 $this->brand = 'IceApe'; // Debian-rebranded SeaMonkey
c18a4476 181 $this->version = $regs[1];
182 $this->bot = false;
183 }
184 elseif (preg_match('|Iceweasel/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
9c17eb15
RK
185 $this->brand = 'IceWeasel'; // Debian-rebranded Firefox
186 $this->version = $regs[1];
187 $this->bot = false;
188 }
189 elseif (preg_match('|Icedove/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
190 $this->brand = 'IceDove'; // Debian-rebranded Thunderbird
c18a4476 191 $this->version = $regs[1];
192 $this->bot = false;
193 }
1c090da4 194 elseif (preg_match('|BonEcho/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
9c17eb15 195 $this->brand = 'Bon Echo'; // Firefox 2.0 code name
1c090da4
RK
196 $this->version = $regs[1];
197 $this->bot = false;
198 }
199 elseif (preg_match('|GranParadiso/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
9c17eb15 200 $this->brand = 'Gran Paradiso'; // Firefox 3.0 code name
1c090da4
RK
201 $this->version = $regs[1];
202 $this->bot = false;
203 }
204 elseif (preg_match('|Shiretoko/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
9c17eb15 205 $this->brand = 'Shiretoko'; // Firefox 3.5 code name
1c090da4
RK
206 $this->version = $regs[1];
207 $this->bot = false;
208 }
209 elseif (preg_match('|Namoroka/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
9c17eb15
RK
210 $this->brand = 'Namoroka'; // Firefox 3.6 code name
211 $this->version = $regs[1];
212 $this->bot = false;
213 }
214 elseif (preg_match('|Lorentz/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
215 $this->brand = 'Lorentz'; // Firefox 3.6 (with OOPP) code name
1c090da4
RK
216 $this->version = $regs[1];
217 $this->bot = false;
218 }
208cf837 219 elseif (preg_match('|Minefield/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
9c17eb15 220 $this->brand = 'Minefield'; // Firefox development nightly code name
208cf837
RK
221 $this->version = $regs[1];
222 $this->bot = false;
223 }
1c090da4
RK
224 elseif (preg_match('|PmWFx/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
225 $this->brand = 'PmW-Firefox';
226 $this->version = $regs[1];
227 $this->bot = false;
228 }
229 elseif (preg_match('|BeZillaBrowser/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
230 $this->brand = 'BeZillaBrowser';
231 $this->version = $regs[1];
232 $this->bot = false;
233 }
234 elseif (preg_match('|Songbird/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
235 $this->brand = 'Songbird';
236 $this->version = $regs[1];
237 $this->bot = false;
238 }
9c17eb15
RK
239 elseif (preg_match('|Lanikai/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
240 $this->brand = 'Lanikai'; // Thunderbird 3.1 code name
241 $this->version = $regs[1];
242 $this->bot = false;
243 }
1c090da4 244 elseif (preg_match('|Shredder/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
9c17eb15 245 $this->brand = 'Shredder'; // Thunderbird development nightly code name
1c090da4
RK
246 $this->version = $regs[1];
247 $this->bot = false;
248 }
249 elseif (preg_match('|prism/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
250 $this->brand = 'Prism';
251 $this->version = $regs[1];
252 $this->bot = false;
253 }
208cf837
RK
254 elseif (preg_match('|Minimo/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
255 $this->brand = 'Minimo';
256 $this->version = $regs[1];
257 $this->bot = false;
31fe75cc 258 $this->mobile = true;
208cf837 259 }
1c090da4 260 elseif (preg_match('|Fennec/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
9c17eb15 261 $this->brand = 'Fennec'; // Firefox mobile code name
1c090da4
RK
262 $this->version = $regs[1];
263 $this->bot = false;
31fe75cc 264 $this->mobile = true;
1c090da4 265 }
bf78d3ed 266 elseif (preg_match('|Galeon/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
267 $this->brand = 'Galeon';
31733e08 268 $this->version = $regs[1];
81e72a3e 269 $this->bot = false;
31733e08 270 }
6e783db6 271 elseif (preg_match('|Epiphany/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
272 $this->brand = 'Epiphany';
273 $this->version = $regs[1];
81e72a3e 274 $this->bot = false;
6e783db6 275 }
276 elseif (preg_match('|K-Meleon/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
277 $this->brand = 'K-Meleon';
278 $this->version = $regs[1];
81e72a3e 279 $this->bot = false;
6e783db6 280 }
281 elseif (preg_match('|AOL[/ ]([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
282 $this->brand = 'AOL';
283 $this->version = $regs[1];
81e72a3e 284 $this->bot = false;
6e783db6 285 }
646effd3
RK
286 elseif (preg_match('|Tablet browser ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
287 $this->brand = 'microB';
288 $this->version = $regs[1];
289 $this->bot = false;
31fe75cc 290 $this->mobile = true;
646effd3 291 }
fe42635c
RK
292 elseif (preg_match('|Maemo Browser ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
293 $this->brand = 'microB';
294 $this->version = $regs[1];
295 $this->bot = false;
31fe75cc 296 $this->mobile = true;
fe42635c 297 }
c18a4476 298 elseif (preg_match('|Opera\/([^\(]+) \(.*; Opera Mini; |', $this->uastring, $regs)) {
299 $this->brand = 'Opera Mini';
300 $this->version = $regs[1];
301 $this->bot = false;
31fe75cc 302 $this->mobile = true;
c18a4476 303 }
304 elseif (preg_match('/Opera\/[^\(]+ \(.*; Opera Mini\/([^;]+); /i', $this->uastring, $regs)) {
305 $this->brand = 'Opera Mini';
306 $this->version = $regs[1];
307 $this->bot = false;
31fe75cc 308 $this->mobile = true;
c18a4476 309 }
bf78d3ed 310 elseif (preg_match('|Opera[ /]([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
311 $this->brand = 'Opera';
31733e08 312 $this->version = $regs[1];
81e72a3e 313 $this->bot = false;
31733e08 314 }
c18a4476 315 elseif (preg_match('|OmniWeb/([0-9a-zA-Z\.+-]+)|', $this->uastring, $regs)) {
bf78d3ed 316 $this->brand = 'OmniWeb';
1defa974 317 $this->version = $regs[1];
81e72a3e 318 $this->bot = false;
1defa974 319 }
d7aaf1da 320 elseif (preg_match('|Konqueror/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
bf78d3ed 321 $this->brand = 'Konqueror';
31733e08 322 $this->version = $regs[1];
81e72a3e 323 $this->bot = false;
31733e08 324 }
c18a4476 325 elseif (preg_match('|Shiira/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
326 $this->brand = 'Shiira';
327 $this->version = $regs[1];
328 $this->bot = false;
329 }
3cd2b543 330 elseif (preg_match('|Edge/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
cbdcb617
RK
331 $this->brand = 'Edge';
332 $this->version = $regs[1];
3cd2b543 333 $this->bot = false;
d87e7412 334 $this->mobile = preg_match('| Mobile |', $this->uastring);
3cd2b543 335 }
d09178b6
RK
336 elseif (preg_match('|Chromium/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
337 $this->brand = 'Chromium';
338 $this->version = $regs[1];
339 $this->bot = false;
340 }
895f2433
RK
341 elseif (preg_match('|Chrome/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
342 $this->brand = 'Chrome';
343 $this->version = $regs[1];
344 $this->bot = false;
345 }
1c6b27e7
RK
346 elseif (preg_match('|NokiaBrowser/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
347 $this->brand = 'NokiaBrowser';
348 $this->version = $regs[1];
349 $this->bot = false;
350 }
ff8d4ab2
RK
351 elseif (preg_match('|wOSBrowser/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
352 $this->brand = 'webOS Browser';
353 $this->version = $regs[1];
354 $this->bot = false;
355 }
356 elseif (preg_match('|Silk/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
357 $this->brand = 'Silk';
358 $this->version = $regs[1];
359 $this->bot = false;
360 }
361 elseif (preg_match('|Kindle/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
362 $this->brand = 'Kindle';
363 $this->version = $regs[1];
364 $this->bot = false;
365 }
366 elseif (preg_match('|Pre/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
367 $this->brand = 'Pre';
368 $this->version = $regs[1];
369 $this->bot = false;
370 }
371 elseif (preg_match('|BOLT/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
372 $this->brand = 'BOLT';
373 $this->version = $regs[1];
374 $this->bot = false;
375 }
d09178b6
RK
376 elseif (preg_match('|Googlebot-Mobile/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { /* looks like Webkit! */
377 $this->brand = 'Googlebot-Mobile';
378 $this->version = $regs[1];
379 $this->bot = true;
380 $this->mobile = true;
381 }
38123d97
RK
382 elseif (preg_match('|FxiOS/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
383 $this->brand = 'Firefox for iOS';
384 $this->version = $regs[1];
385 $this->bot = false;
386 $this->mobile = true;
387 }
bf78d3ed 388 elseif (preg_match('|Safari/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
31fe75cc 389 if (preg_match('| Mobile(/[0-9a-zA-Z\.+]+)? ?Safari/|', $this->uastring)) {
ff8d4ab2 390 $this->brand = 'Mobile Safari';
31fe75cc 391 $this->mobile = true;
ff8d4ab2
RK
392 }
393 else {
394 $this->brand = 'Safari';
395 }
588763e6
RK
396 if (preg_match('|Version/([0-9a-zA-Z\.+]+)|', $this->uastring, $vregs)) {
397 $this->version = $vregs[1];
398 }
399 else {
400 $this->version = '('.$regs[1].')';
401 }
81e72a3e 402 $this->bot = false;
1defa974 403 }
bf78d3ed 404 elseif (preg_match('|AppleWebKit/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
405 $this->brand = 'AppleWebKit';
1defa974 406 $this->version = $regs[1];
81e72a3e 407 $this->bot = false;
1defa974 408 }
1c090da4
RK
409 elseif (preg_match('|Spinn3r ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { /* looks like Gecko! */
410 $this->brand = 'Spinn3r';
411 $this->version = $regs[1];
412 $this->bot = true;
413 }
414 elseif (preg_match('|Butterfly/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { /* looks like Gecko! */
415 $this->brand = 'Butterfly';
416 $this->version = $regs[1];
417 $this->bot = true;
418 }
419 elseif (preg_match('|Googlebot/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { /* looks like Gecko! */
420 $this->brand = 'Googlebot';
421 $this->version = $regs[1];
422 $this->bot = true;
423 }
208cf837
RK
424 elseif (preg_match('|Firefox/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
425 $this->brand = 'Firefox';
426 $this->version = $regs[1];
427 $this->bot = false;
428 }
1c090da4
RK
429 elseif (preg_match('|Thunderbird/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
430 $this->brand = 'Thunderbird';
431 $this->version = $regs[1];
432 $this->bot = false;
433 }
208cf837
RK
434 elseif (preg_match('|rv:([0-9a-zA-Z\.+]+)|', $this->uastring, $regs) &&
435 strstr($this->uastring, "Mozilla/") && strstr($this->uastring, "Gecko/")) {
436 $this->brand = 'Mozilla';
437 $this->version = $regs[1];
438 $this->bot = false;
439 }
440 elseif (preg_match('|m([0-9]+)\)|', $this->uastring, $regs) &&
441 strstr($this->uastring, "Mozilla/") && strstr($this->uastring, "Gecko/")) {
442 $this->brand = 'Mozilla';
443 $this->version = 'M'.$regs[1];
444 $this->bot = false;
445 }
1c090da4
RK
446 elseif (preg_match('|Baiduspider|i', $this->uastring)) {
447 $this->brand = 'BaiDuSpider';
448 $this->version = null;
449 $this->bot = true;
450 }
451 elseif (preg_match('|YodaoBot-Mobile/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { /* looks like Gecko! */
452 $this->brand = 'YodaoBot-Mobile';
453 $this->version = $regs[1];
454 $this->bot = true;
31fe75cc 455 $this->mobile = true;
1c090da4 456 }
1c090da4
RK
457 elseif (preg_match('|FASTMobileCrawl/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { /* looks like Gecko! */
458 $this->brand = 'FASTMobileCrawl';
459 $this->version = $regs[1];
460 $this->bot = true;
31fe75cc 461 $this->mobile = true;
1c090da4 462 }
bf78d3ed 463 elseif (preg_match('|MSFrontPage/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
464 $this->brand = 'Microsoft FrontPage';
f983aa36 465 $this->version = $regs[1];
81e72a3e 466 $this->bot = false;
f983aa36 467 }
bf78d3ed 468 elseif (preg_match('|iCab[/ ]([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
469 $this->brand = 'iCab';
a8464009 470 $this->version = $regs[1];
81e72a3e 471 $this->bot = false;
a8464009 472 }
bf78d3ed 473 elseif (preg_match('|IBrowse[/ ]([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
474 $this->brand = 'IBrowse';
a8464009 475 $this->version = $regs[1];
81e72a3e 476 $this->bot = false;
a8464009 477 }
c18a4476 478 elseif (preg_match('|ICEbrowser/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
479 $this->brand = 'ICEbrowser';
480 $this->version = $regs[1];
481 $this->bot = false;
482 }
483 elseif (preg_match('|ICE Browser/v([0-9a-zA-Z\._+]+)|', $this->uastring, $regs)) {
484 $this->brand = 'ICEbrowser';
485 $this->version = str_replace('_', '.', $regs[1]);
486 $this->bot = false;
487 }
488 elseif (preg_match('|NetPositive/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
489 $this->brand = 'NetPositive';
490 $this->version = $regs[1];
491 $this->bot = false;
492 }
493 elseif (preg_match('|WebPro/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
494 $this->brand = 'WebPro (Novarra)';
495 $this->version = $regs[1];
496 $this->bot = false;
497 }
498 elseif (preg_match('|; OffByOne;|', $this->uastring, $regs)) {
499 $this->brand = 'Off By One';
500 $this->version = null;
501 $this->bot = false;
502 }
503 elseif (preg_match('|PSP \(PlayStation Portable\); ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
504 $this->brand = 'PlayStation Portable';
505 $this->version = $regs[1];
506 $this->bot = false;
31fe75cc 507 $this->mobile = true;
c18a4476 508 }
b50f91ef 509 elseif (preg_match('|PLAYSTATION 3; ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
510 $this->brand = 'PlayStation 3';
511 $this->version = $regs[1];
512 $this->bot = false;
513 }
c18a4476 514 elseif (preg_match('|NetFront/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
515 $this->brand = 'NetFront';
a8464009 516 $this->version = $regs[1];
81e72a3e 517 $this->bot = false;
31fe75cc 518 $this->mobile = true;
a8464009 519 }
6e783db6 520 elseif (preg_match('|UP.Browser/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
521 $this->brand = 'UP.Browser';
522 $this->version = $regs[1];
81e72a3e 523 $this->bot = false;
31fe75cc 524 $this->mobile = true;
6e783db6 525 }
c18a4476 526 elseif (preg_match('|UP.Link/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
527 $this->brand = 'UP.Link';
528 $this->version = $regs[1];
529 $this->bot = false;
31fe75cc 530 $this->mobile = true;
c18a4476 531 }
532 elseif (preg_match('|AU-MIC-([0-9A-Z]+/[0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
533 $this->brand = 'Obigo';
534 $this->version = $regs[1];
535 $this->bot = false;
31fe75cc 536 $this->mobile = true;
c18a4476 537 }
1c090da4
RK
538 elseif (preg_match('|Browser/Obigo-([0-9A-Z]+/[0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
539 $this->brand = 'Obigo';
540 $this->version = $regs[1];
541 $this->bot = false;
31fe75cc 542 $this->mobile = true;
1c090da4 543 }
c18a4476 544 elseif (preg_match('|Nokia([0-9a-zA-Z]+/[0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
545 $this->brand = 'Nokia';
546 $this->version = $regs[1];
547 $this->bot = false;
31fe75cc 548 $this->mobile = true;
c18a4476 549 }
550 elseif (preg_match('|SonyEricsson([0-9a-zA-Z]+/[0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
551 $this->brand = 'SonyEricsson';
552 $this->version = $regs[1];
553 $this->bot = false;
31fe75cc 554 $this->mobile = true;
c18a4476 555 }
556 elseif (preg_match('|SIE-([0-9a-zA-Z]+/[0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
557 $this->brand = 'Siemens';
558 $this->version = $regs[1];
559 $this->bot = false;
31fe75cc 560 $this->mobile = true;
c18a4476 561 }
562 elseif (preg_match('|MOT-([0-9a-zA-Z]+/[0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
563 $this->brand = 'Motorola';
564 $this->version = $regs[1];
565 $this->bot = false;
31fe75cc 566 $this->mobile = true;
c18a4476 567 }
b50f91ef 568 elseif (preg_match('|IXI/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
569 $this->brand = 'IXI';
570 $this->version = $regs[1];
571 $this->bot = false;
31fe75cc 572 $this->mobile = true;
b50f91ef 573 }
1c090da4
RK
574 elseif (preg_match('|NewsFox/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
575 $this->brand = 'NewsFox';
576 $this->version = $regs[1];
577 $this->bot = false;
578 }
579 elseif (preg_match('|rdfbot/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
580 $this->brand = 'rdfbot';
581 $this->version = $regs[1];
582 $this->bot = false;
583 }
c18a4476 584 elseif (preg_match('|IBM-WebExplorer-DLL/v([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
585 $this->brand = 'WebExplorer';
586 $this->version = $regs[1];
587 $this->bot = false;
588 }
bf78d3ed 589 elseif (preg_match('|ELinks \(([0-9a-zA-Z\.+]+);|', $this->uastring, $regs)) {
590 $this->brand = 'ELinks';
a8464009 591 $this->version = $regs[1];
81e72a3e 592 $this->bot = false;
a8464009 593 }
6e783db6 594 elseif (preg_match('|Links \(([0-9a-zA-Z\.+]+);|', $this->uastring, $regs)) {
595 $this->brand = 'Links';
596 $this->version = $regs[1];
81e72a3e 597 $this->bot = false;
6e783db6 598 }
b50f91ef 599 elseif (preg_match('|WinHttp.WinHttpRequest.([0-9\.]+)|i', $this->uastring, $regs)) {
600 $this->brand = 'WinHttpRequest';
601 $this->version = $regs[1];
602 $this->bot = false;
603 }
604 elseif (preg_match('|alpha[/ ]06; AmigaOS|i', $this->uastring, $regs)) {
605 $this->brand = 'Alpha 06';
606 $this->version = null;
607 $this->bot = false;
608 }
609 elseif (preg_match('|; arexx[\);]|i', $this->uastring, $regs)) {
c18a4476 610 $this->brand = 'ARexx';
611 $this->version = null;
612 $this->bot = false;
613 }
b50f91ef 614 elseif (preg_match('|; Voyager; AmigaOS[\);]|i', $this->uastring, $regs)) {
615 $this->brand = 'AmigaVoyager';
616 $this->version = null;
617 $this->bot = false;
618 }
619 elseif (preg_match('|AWEB ([0-9a-zA-Z\.+ ]+)|', $this->uastring, $regs)) {
620 $this->brand = 'AWEB';
621 $this->version = $regs[1];
622 $this->bot = false;
623 }
624 elseif (preg_match('|X ([0-9a-zA-Z\.+ ]+); Commodore 64|', $this->uastring, $regs)) {
625 $this->brand = 'X';
626 $this->version = $regs[1];
627 $this->bot = false;
628 }
629 elseif (preg_match('|DB Browse ([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
630 $this->brand = 'DB Browse';
631 $this->version = $regs[1];
632 $this->bot = false;
633 }
bf78d3ed 634 elseif (preg_match('|ZyBorg/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
635 $this->brand = 'ZyBorg';
a8464009 636 $this->version = $regs[1];
637 $this->bot = true;
638 }
bf78d3ed 639 elseif (preg_match('|Ask Jeeves/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
640 $this->brand = 'Ask Jeeves';
a8464009 641 $this->version = $regs[1];
642 $this->bot = true;
643 }
4e8c44da 644 elseif (preg_match('|heritrix/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
645 $this->brand = 'Heritrix';
646 $this->version = $regs[1];
647 $this->bot = true;
648 }
1c090da4
RK
649 elseif (preg_match('|heritrix([0-9a-zA-Z\.+-]+)|', $this->uastring, $regs)) {
650 $this->brand = 'Heritrix';
651 $this->version = str_replace('-', '.', $regs[1]);
652 $this->bot = true;
653 }
654 elseif (preg_match('|SBSearch/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
655 $this->brand = 'SBSearch';
656 $this->version = $regs[1];
657 $this->bot = true;
658 }
659 elseif (preg_match('|Powermarks/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
660 $this->brand = 'Powermarks';
661 $this->version = $regs[1];
662 $this->bot = true;
663 }
664 elseif (preg_match('|TopBlogsInfo/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
665 $this->brand = 'TopBlogsInfo';
666 $this->version = $regs[1];
667 $this->bot = true;
668 }
669 elseif (preg_match('|picmole/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
670 $this->brand = 'picmole';
671 $this->version = $regs[1];
672 $this->bot = true;
673 }
674 elseif (preg_match('|([0-9a-zA-Z\._+-]+bot)/([0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
b50f91ef 675 $this->brand = $regs[1];
676 $this->version = $regs[2];
677 $this->bot = true;
678 }
679 elseif (preg_match('|VoilaBot ((BETA )?[0-9a-zA-Z\.+]+)|i', $this->uastring, $regs)) {
680 $this->brand = 'VoilaBot';
681 $this->version = $regs[1];
682 $this->bot = true;
683 }
c51ab9a2 684 elseif (preg_match('|Slurp|', $this->uastring, $regs)) {
bf78d3ed 685 $this->brand = 'Slurp';
c51ab9a2 686 $this->version = null;
a8464009 687 $this->bot = true;
688 }
b50f91ef 689 elseif (preg_match('|Check&amp;Get ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
690 $this->brand = 'Check&Get';
691 $this->version = $regs[1];
692 $this->bot = true;
693 }
694 elseif (preg_match('|WebCapture ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
695 $this->brand = 'WebCapture';
696 $this->version = $regs[1];
697 $this->bot = true;
698 }
699 elseif (preg_match('|WebMon ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
700 $this->brand = 'WebMon';
701 $this->version = $regs[1];
702 $this->bot = true;
703 }
bf78d3ed 704 elseif (preg_match('|Gulper Web Bot ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
705 $this->brand = 'Gulper Web Bot';
a8464009 706 $this->version = $regs[1];
707 $this->bot = true;
708 }
bf78d3ed 709 elseif (preg_match('|HTTrack ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
710 $this->brand = 'HTTrack';
a8464009 711 $this->version = $regs[1];
712 $this->bot = true;
713 }
1c090da4
RK
714 elseif (preg_match('|Advista Crawler ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
715 $this->brand = 'HTTrack';
716 $this->version = $regs[1];
717 $this->bot = true;
718 }
719 elseif (preg_match('|Seznam screenshot-generator ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
720 $this->brand = 'Seznam screenshot-generator';
721 $this->version = $regs[1];
722 $this->bot = true;
723 }
724 elseif (preg_match('|Yahoo! SearchMonkey ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
725 $this->brand = 'Yahoo! SearchMonkey';
726 $this->version = $regs[1];
727 $this->bot = true;
728 }
729 elseif (preg_match('|Yahoo Pipes ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
730 $this->brand = 'Yahoo! Pipes';
731 $this->version = $regs[1];
732 $this->bot = true;
733 }
734 elseif (preg_match('|Firebat ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
735 $this->brand = 'Firebat';
736 $this->version = $regs[1];
737 $this->bot = true;
738 }
b50f91ef 739 elseif (preg_match('|Twiceler-([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
740 $this->brand = 'Twiceler';
741 $this->version = $regs[1];
742 $this->bot = true;
743 }
1c090da4
RK
744 elseif (preg_match('|Nu_?tch-([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
745 $this->brand = 'Nutch';
746 $this->version = $regs[1];
747 $this->bot = true;
748 }
5b8eba2a 749 elseif (preg_match('|Microsoft URL Control - ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
750 $this->brand = 'Microsoft URL Control';
751 $this->version = $regs[1];
752 $this->bot = true;
753 }
81e72a3e 754 elseif (preg_match('|([0-9a-zA-Z\.+]+)_AC-Plug|', $this->uastring, $regs)) {
755 $this->brand = 'AC-Plug';
756 $this->version = $regs[1];
757 $this->bot = true;
758 }
bf78d3ed 759 elseif (preg_match('|^Internet Explorer 5.5|', $this->uastring)) {
760 $this->brand = 'Unknown bot (IE5.5)';
761 $this->version = null;
a8464009 762 $this->bot = true;
763 }
bf78d3ed 764 elseif (preg_match('|^Mozilla[\s ]*$|', $this->uastring)) {
765 $this->brand = 'Unknown bot (Mozilla)';
766 $this->version = null;
a8464009 767 $this->bot = true;
768 }
1c090da4
RK
769 elseif (preg_match('|ICCrawler|i', $this->uastring, $regs)) {
770 $this->brand = 'ICCrawler';
771 $this->version = null;
772 $this->bot = true;
773 }
774 elseif (preg_match('|KaloogaBot|', $this->uastring, $regs)) {
775 $this->brand = 'KaloogaBot';
776 $this->version = null;
777 $this->bot = true;
778 }
779 elseif (preg_match('|ScoutJet|', $this->uastring, $regs)) {
780 $this->brand = 'ScoutJet';
781 $this->version = null;
782 $this->bot = true;
783 }
b50f91ef 784 elseif (preg_match('|http://www.livedir.net|', $this->uastring, $regs)) {
785 $this->brand = 'livedir.net';
786 $this->version = null;
787 $this->bot = true;
788 }
789 elseif (preg_match('|WebClipping.com|', $this->uastring, $regs)) {
790 $this->brand = 'WebClipping.com';
791 $this->version = null;
792 $this->bot = true;
793 }
1c090da4
RK
794 elseif (preg_match('|newstin.com|', $this->uastring, $regs)) {
795 $this->brand = 'newstin.com';
796 $this->version = null;
797 $this->bot = true;
798 }
bf78d3ed 799 elseif (preg_match('|http://www.almaden.ibm.com/cs/crawler|', $this->uastring)) {
800 $this->brand = 'almaden crawler';
801 $this->version = null;
a8464009 802 $this->bot = true;
803 }
b50f91ef 804 elseif (preg_match('|B-l-i-t-z-B-O-T|', $this->uastring) ||
805 preg_match('|B l i t z B O T @ t r i c u s . n e t|', $this->uastring)) {
bf78d3ed 806 $this->brand = 'BlitzBOT';
807 $this->version = null;
a8464009 808 $this->bot = true;
809 }
b50f91ef 810 elseif (preg_match('|Really Gmane.org\'s favicon grabber|', $this->uastring)) {
811 $this->brand = 'Really Gmane.org\'s favicon grabber';
812 $this->version = null;
813 $this->bot = true;
814 }
bf78d3ed 815 elseif (preg_match('|Girafabot|', $this->uastring)) {
816 $this->brand = 'Girafabot';
817 $this->version = null;
a8464009 818 $this->bot = true;
819 }
b50f91ef 820 elseif (preg_match('|Arachmo|', $this->uastring)) {
821 $this->brand = 'Arachmo';
822 $this->version = null;
823 $this->bot = true;
824 }
825 elseif (preg_match('|OsO|', $this->uastring)) {
826 $this->brand = 'OsO';
827 $this->version = null;
828 $this->bot = true;
829 }
830 elseif (preg_match('|Yoono|', $this->uastring)) {
831 $this->brand = 'Yoono';
832 $this->version = null;
833 $this->bot = true;
834 }
bf78d3ed 835 elseif (preg_match('|efp@gmx.net|', $this->uastring)) {
836 $this->brand = 'efp';
837 $this->version = null;
a8464009 838 $this->bot = true;
839 }
81e72a3e 840 elseif (preg_match('|Indy Library|', $this->uastring)) {
841 $this->brand = 'Indy Library';
842 $this->version = null;
843 $this->bot = true;
844 }
b50f91ef 845 elseif (preg_match('|Linkman|', $this->uastring)) {
846 $this->brand = 'Linkman';
847 $this->version = null;
848 $this->bot = true;
849 }
850 elseif (preg_match('|Sage|', $this->uastring, $regs)) {
851 $this->brand = 'Sage';
852 $this->version = null;
853 $this->bot = true;
854 }
855 elseif (preg_match('|Google Desktop|', $this->uastring)) {
856 $this->brand = 'Google Desktop';
857 $this->version = null;
858 $this->bot = true;
859 }
bf78d3ed 860 elseif (preg_match('|^Firefly|', $this->uastring)) {
861 // comes here with correct value but would be detected as MSIE
a8464009 862 }
81e72a3e 863 elseif (preg_match('|Steganos Internet Anonym([0-9a-zA-Z\. +]*)|', $this->uastring, $regs)) {
864 $this->brand = 'Steganos Internet Anonym';
865 $this->version = $regs[1];
866 $this->bot = false;
867 }
b50f91ef 868 elseif (preg_match('|Steganos Internet Anonym([0-9a-zA-Z\. +]*)|', $this->uastring, $regs)) {
869 $this->brand = 'Steganos Internet Anonym';
870 $this->version = $regs[1];
871 $this->bot = false;
872 }
873 elseif (preg_match('|BorderManager ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
874 $this->brand = 'BorderManager';
875 $this->version = $regs[1];
876 $this->bot = false;
877 }
878 elseif (preg_match('|WebWasher ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
879 $this->brand = 'WebWasher';
880 $this->version = $regs[1];
881 $this->bot = false;
882 }
883 elseif (preg_match('|SaferSurf|', $this->uastring, $regs)) {
884 $this->brand = 'SaferSurf';
885 $this->version = null;
886 $this->bot = false;
887 }
bf78d3ed 888 elseif (preg_match('|Avant Browser[^/]|', $this->uastring)) {
889 $this->brand = 'Avant Browser';
890 $this->version = null;
81e72a3e 891 $this->bot = false;
a8464009 892 }
c18a4476 893 elseif (preg_match('|Browser[^/]+(http://www.avantbrowser.com)|', $this->uastring)) {
894 $this->brand = 'Avant Browser';
895 $this->version = null;
896 $this->bot = false;
897 }
6e783db6 898 elseif (preg_match('|Maxthon|', $this->uastring)) {
899 $this->brand = 'Maxthon';
900 $this->version = null;
81e72a3e 901 $this->bot = false;
6e783db6 902 }
903 elseif (preg_match('|MyIE2|', $this->uastring)) {
904 $this->brand = 'MyIE2';
905 $this->version = null;
81e72a3e 906 $this->bot = false;
6e783db6 907 }
bf78d3ed 908 elseif (preg_match('|Crazy Browser ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
909 $this->brand = 'Crazy Browser';
910 $this->version = $regs[1];
81e72a3e 911 $this->bot = false;
912 }
913 elseif (preg_match('|AvantGo ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
914 $this->brand = 'AvantGo';
915 $this->version = $regs[1];
916 $this->bot = false;
a8464009 917 }
bf78d3ed 918 elseif (preg_match('|MSN ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
919 $this->brand = 'MSN';
920 $this->version = $regs[1];
81e72a3e 921 $this->bot = false;
a8464009 922 }
c18a4476 923 elseif (preg_match('|America Online Browser [0-9a-zA-Z\.+]+; rev([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
924 $this->brand = 'AOL Browser';
925 $this->version = $regs[1];
926 $this->bot = false;
927 }
bf78d3ed 928 elseif (preg_match('|MS FrontPage ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
929 $this->brand = 'Microsoft FrontPage';
930 $this->version = $regs[1];
81e72a3e 931 $this->bot = false;
a8464009 932 }
c18a4476 933 elseif (preg_match('|Microsoft Internet Explorer/4.0b1|', $this->uastring, $regs)) {
934 $this->brand = 'Microsoft Internet Explorer';
935 $this->version = '1.0';
936 $this->bot = false;
937 }
ee2c4e9b
RK
938 elseif (preg_match('|MSIE 7\.0.+Trident/4.0|', $this->uastring, $regs)) {
939 $this->brand = 'Microsoft Internet Explorer';
940 $this->version = "8.0";
941 $this->bot = false;
942 }
943 elseif (preg_match('|MSIE 7\.0.+Trident/5.0|', $this->uastring, $regs)) {
944 $this->brand = 'Microsoft Internet Explorer';
945 $this->version = "9.0";
946 $this->bot = false;
947 }
d6672899
RK
948 elseif (preg_match('|MSIE 7\.0.+Trident/6.0|', $this->uastring, $regs)) {
949 $this->brand = 'Microsoft Internet Explorer';
950 $this->version = "10.0";
951 $this->bot = false;
952 }
63119c16
RK
953 elseif (preg_match('|Trident\/[0-9a-zA-Z\.+]+; ([^\)]+; )?rv:([0-9\.+]+)|', $this->uastring, $regs)) {
954 $this->brand = 'Microsoft Internet Explorer';
955 $this->version = $regs[2];
956 $this->bot = false;
957 }
bf78d3ed 958 elseif (preg_match('|MSIE ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
959 $this->brand = 'Microsoft Internet Explorer';
31733e08 960 $this->version = $regs[1];
81e72a3e 961 $this->bot = false;
31733e08 962 }
c18a4476 963 elseif (preg_match('|MSPIE ([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
964 $this->brand = 'Microsoft Pocket Internet Explorer';
965 $this->version = $regs[1];
966 $this->bot = false;
31fe75cc 967 $this->mobile = true;
c18a4476 968 }
b50f91ef 969 elseif (preg_match('|Mozilla/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs) &&
970 (strpos($this->uastring, 'compatible') === false) && (strpos($this->uastring, 'Gecko/') === false) &&
971 (intval($regs[1]) < 5)) {
bf78d3ed 972 $this->brand = 'Netscape';
1defa974 973 $this->version = $regs[1];
bf78d3ed 974 if (intval($this->version) == 4) { $this->brand .= ' Communicator'; }
81e72a3e 975 $this->bot = false;
976 }
b50f91ef 977 elseif (preg_match('|Mozilla/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
978 $this->brand = (strpos($this->uastring, 'compatible') !== false)?'Mozilla-compatible (unknown)':'Mozilla (unknown)';
81e72a3e 979 $this->version = null;
980 $this->bot = false;
1defa974 981 }
a8464009 982
e78a7538
RK
983 $botArray = [
984 'Scooter', 'Spinne', 'Vagabondo', 'Firefly', 'Scrubby', 'NG', 'Pompos', 'Szukacz', 'Schmozilla', '42_HAL',
985 'NetResearchServer', 'LinkWalker', 'Zeus', 'W3C_Validator', 'ZyBorg', 'Ask Jeeves', 'ia_archiver',
986 'PingALink Monitoring Services', 'IlTrovatore-Setaccio', 'Nutch', 'Mercator', 'search.ch',
987 'appie', 'larbin', 'NutchCVS', 'Webchat', 'Mediapartners-Google', 'sitecheck.internetseer.com',
988 'FavOrg', 'findlinks', 'DataCha0s', 'ichiro', 'Francis', 'CoralWebPrx', 'DoCoMo', 'Ocelli', 'Sogou Video',
989 'Yandex', 'Yeti', 'Austronaut-URL-Checker'
990 ];
a8464009 991
992 if (in_array($this->brand, $botArray)) {
993 $this->bot = true;
994 }
31fe75cc
RK
995
996 if (($this->brand == 'Microsoft Pocket Internet Explorer') ||
997 (strpos($this->brand, 'BlackBerry') !== false)) {
998 $this->mobile = true;
999 }
31733e08 1000 }
1001
e78a7538
RK
1002 public function getBrand() {
1003 return $this->brand;
1004 }
1005
1006 public function getVersion() {
1007 return $this->version;
1008 }
4210e7b0 1009
3077a4f6 1010 public function getAcceptLanguages() {
4210e7b0 1011 if (!isset($this->uadata['accept-languages'])) {
1012 $headers = getAllHeaders();
5ae00086 1013 $accLcomp = explode(',', ($headers['Accept-Language'] ?? ''));
e78a7538 1014 $accLang = [];
4210e7b0 1015 foreach ($accLcomp as $lcomp) {
1016 if (strlen($lcomp)) {
1017 $ldef = explode(';', $lcomp);
5ae00086
RK
1018 if (count($ldef) > 1 && strpos($ldef[1], 'q=') === 0) {
1019 $accLang[$ldef[0]] = substr($ldef[1], 2);
1020 }
1021 else {
1022 $accLang[$ldef[0]] = 1;
1023 }
4210e7b0 1024 }
1025 }
1026 $this->uadata['accept-languages'] = $accLang;
1027 }
e78a7538 1028 return $this->uadata['accept-languages'];
4210e7b0 1029 }
1030
e78a7538
RK
1031 public function getUAString() {
1032 return $this->uastring;
1033 }
23585ba2 1034
3077a4f6 1035 public function getEngine() {
b50f91ef 1036 // return gecko|khtml|trident|tasman|nscp|presto|gzilla|gtkhtml|links|icestorm|netfront|unknown
bf78d3ed 1037 if (!isset($this->uadata['engine'])) {
ac9220c2 1038 $this->uadata['engine'] = 'unknown';
bf78d3ed 1039 $this->uadata['geckodate'] = null;
1c090da4 1040 if (!$this->bot) {
31fe75cc 1041 if (preg_match('|Gecko/([0-9\.]+)|', $this->uastring, $regs) && (strpos($this->brand, 'Opera') === false)) {
1c090da4 1042 $this->uadata['engine'] = 'gecko';
ff8d4ab2 1043 // If it looks like a version number, i.e. shorter than 4 chars or has a . in it, it's no date.
5cb2b864
RK
1044 if ((strlen($regs[1]) > 4) && (strpos($regs[1], '.') === false)) {
1045 $this->uadata['geckodate'] = $regs[1];
1046 }
1047 else {
1048 $this->uadata['geckodate'] = null;
1049 $this->uadata['eng_version'] = $regs[1];
1050 }
bf78d3ed 1051 }
3cd2b543 1052 elseif (preg_match('|Edge/([0-9\.]+)|', $this->uastring, $regs)) {
cbdcb617 1053 $this->uadata['engine'] = 'edgehtml';
3cd2b543
RK
1054 $this->uadata['eng_version'] = $regs[1];
1055 }
1c090da4
RK
1056 elseif ((strpos($this->brand, 'Internet Explorer') !== false) || (strpos($this->brand, 'FrontPage') !== false)) {
1057 if ((strpos(strtolower($this->uastring), 'mac') !== false) && (intval($this->getVersion()) >= 5)) {
1058 $this->uadata['engine'] = 'tasman';
1059 }
1060 else {
1061 $this->uadata['engine'] = 'trident';
1062 }
bf78d3ed 1063 }
ff8d4ab2 1064 elseif (preg_match('|WebKit/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
1c6b27e7 1065 $this->uadata['engine'] = 'webkit';
ff8d4ab2 1066 $this->uadata['eng_version'] = $regs[1];
1c6b27e7
RK
1067 }
1068 elseif ((strpos($this->brand, 'Konqueror') !== false) || (strpos($this->brand, 'OmniWeb') !== false)) {
1c090da4
RK
1069 $this->uadata['engine'] = 'khtml';
1070 }
1071 elseif (strpos($this->brand, 'Netscape') !== false) {
1072 // non-Gecko Netscape browsers
1073 if (intval($this->version) <= 4) {
1074 $this->uadata['engine'] = 'nscp';
1075 }
1076 elseif (strpos($this->uastring, 'MSIE') !== false) {
1077 $this->uadata['engine'] = 'trident';
1078 }
81e72a3e 1079 }
1c090da4
RK
1080 elseif (strpos($this->brand, 'Opera') !== false) {
1081 $this->uadata['engine'] = 'presto';
1082 }
ff8d4ab2
RK
1083 elseif ((strpos($this->brand, 'iTunes') !== false) || (strpos($this->brand, 'nook browser') !== false)) {
1084 $this->uadata['engine'] = 'webkit';
1085 }
1c090da4
RK
1086 elseif (strpos($this->brand, 'Dillo') !== false) {
1087 $this->uadata['engine'] = 'gzilla';
1088 }
1089 elseif ((strpos($this->brand, 'ELinks') !== false) || (strpos($this->brand, 'Links') !== false)) {
1090 $this->uadata['engine'] = 'links';
1091 }
1092 elseif ((strpos($this->brand, 'Lynx') !== false)) {
1093 $this->uadata['engine'] = 'lynx';
1094 }
1095 elseif ((strpos($this->brand, 'ICEbrowser') !== false) || (strpos($this->brand, 'ICE Browser') !== false)) {
1096 $this->uadata['engine'] = 'icestorm';
1097 }
ff8d4ab2
RK
1098 elseif (preg_match('|NetFront/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) {
1099 $this->uadata['engine'] = 'netfront';
1100 $this->uadata['eng_version'] = $regs[1];
1101 }
1c090da4
RK
1102 elseif ((strpos($this->brand, 'PlayStation') !== false) || (strpos($this->brand, 'NetFront') !== false)) {
1103 $this->uadata['engine'] = 'netfront';
1104 }
1105 elseif ((strpos($this->brand, 'Avant') !== false) || (strpos($this->brand, 'Crazy Browser') !== false) ||
1106 (strpos($this->brand, 'AOL') !== false) || (strpos($this->brand, 'MSN') !== false) ||
1107 (strpos($this->brand, 'MyIE2') !== false) || (strpos($this->brand, 'Maxthon') !== false)) {
81e72a3e 1108 $this->uadata['engine'] = 'trident';
1109 }
1c090da4
RK
1110 elseif (strpos($this->brand, 'Galeon') !== false) {
1111 $this->uadata['engine'] = 'gecko';
1112 }
1113 elseif (strpos($this->brand, 'WebPro') !== false) {
1114 $this->uadata['engine'] = 'nscp';
1115 }
c18a4476 1116 }
31733e08 1117 }
e78a7538 1118 return $this->uadata['engine'];
31733e08 1119 }
1120
e78a7538
RK
1121 public function hasEngine($rnd_engine) {
1122 return ($this->getEngine() == $rnd_engine);
1123 }
bf78d3ed 1124
3077a4f6 1125 public function getEngineVersion() {
bf78d3ed 1126 if (!isset($this->uadata['eng_version'])) {
1127 $this->uadata['eng_version'] = null;
1128 // getOS() should get the date for us
1129 $this->getOS();
31733e08 1130 }
e78a7538 1131 return $this->uadata['eng_version'];
31733e08 1132 }
1133
3077a4f6 1134 public function getOS() {
bf78d3ed 1135 if (!isset($this->uadata['os'])) {
1136 $this->uadata['os'] = null;
1c090da4
RK
1137 if (!$this->bot) {
1138 if ($this->hasEngine('gecko')) {
9c17eb15
RK
1139 if (preg_match('|Mozilla/5.0 \(([^;]+); [^;]+; ([^;]+); ([^;]+); ([^;]+); rv:([^\);]+)(; [^\)]+)?\)|', $this->uastring, $regs)) {
1140 $this->uadata['os'] = $regs[2].' ('.$regs[3].')';
1141 $this->uadata['lang'] = (strpos($regs[4],'chrome://')===false)?$regs[4]:null;
1142 $this->uadata['eng_version'] = $regs[5];
1143 }
1144 elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]+; ([^;]+); ([^;]+); rv:([^\);]+)(; [^\)]+)?\)|', $this->uastring, $regs)) {
1c090da4
RK
1145 $this->uadata['os'] = $regs[2];
1146 $this->uadata['lang'] = (strpos($regs[3],'chrome://')===false)?$regs[3]:null;
1147 $this->uadata['eng_version'] = $regs[4];
1148 }
5cfa45a4 1149 elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]; ([^;]+); rv:([^\);]+)(; [^\)]+)?\)|', $this->uastring, $regs)) {
1c090da4
RK
1150 $this->uadata['os'] = $regs[2];
1151 $this->uadata['lang'] = null;
1152 $this->uadata['eng_version'] = $regs[3];
1153 }
1c6b27e7
RK
1154 elseif (preg_match('|Mozilla/5.0 \(([^;]+); ([^;]+); x64; rv:([^\);]+)(; [^\)]+)?\)|', $this->uastring, $regs)) {
1155 $this->uadata['os'] = $regs[1].' ('.$regs[2].')';
1156 $this->uadata['lang'] = null;
1157 $this->uadata['eng_version'] = $regs[3];
1158 }
5cfa45a4
RK
1159 elseif (preg_match('|Mozilla/5.0 \(([^;]+); ([^;]+); ([^;]+); rv:([^\);]+)(; [^\)]+)?\)|', $this->uastring, $regs)) {
1160 $this->uadata['os'] = $regs[2];
1161 $this->uadata['lang'] = (strpos($regs[3],'chrome://')===false)?$regs[3]:null;
1162 $this->uadata['eng_version'] = $regs[4];
1163 }
1164 elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]; ([^;]+); ([^;]+); m([^\);]+)\)|', $this->uastring, $regs)) {
1c090da4
RK
1165 $this->uadata['os'] = $regs[2];
1166 $this->uadata['lang'] = $regs[3];
1167 $this->uadata['eng_version'] = 'M'.$regs[4];
1168 }
5cfa45a4 1169 elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]; ([^;]+); m([^\);]+)\)|', $this->uastring, $regs)) {
1c090da4
RK
1170 $this->uadata['os'] = $regs[1];
1171 $this->uadata['lang'] = $regs[2];
1172 $this->uadata['eng_version'] = 'M'.$regs[3];
1173 }
5cfa45a4 1174 elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]; ([^;]+); ([^\);]+)\)|', $this->uastring, $regs)) {
1c090da4
RK
1175 $this->uadata['os'] = $regs[2];
1176 $this->uadata['lang'] = $regs[3];
1177 $this->uadata['eng_version'] = null;
1178 }
ff8d4ab2 1179 elseif (preg_match('#Mozilla/5.0 \(([^;]+); (WOW64|Mobile|Tablet); rv:([^\);]+)\)#', $this->uastring, $regs)) {
1c6b27e7
RK
1180 $this->uadata['os'] = $regs[1].' ('.$regs[2].')';
1181 $this->uadata['lang'] = null;
1182 $this->uadata['eng_version'] = $regs[3];
31fe75cc 1183 $this->mobile = ($regs[2] == 'Mobile');
1c6b27e7 1184 }
52e23932 1185 elseif (preg_match('#Mozilla/5.0 \((Mobile|Tablet); [^;]+; rv:([^\);]+)\)#', $this->uastring, $regs)) {
d09178b6 1186 $this->uadata['os'] = 'Firefox OS ('.$regs[1].')';
73adc61b 1187 $this->uadata['lang'] = null;
52e23932
RK
1188 $this->uadata['eng_version'] = $regs[2];
1189 $this->mobile = ($regs[1] == 'Mobile');
73adc61b 1190 }
1486b1d9
RK
1191 elseif (preg_match('#Mozilla/5.0 \(([^;]+); Viera; rv:([^\);]+)\)#', $this->uastring, $regs)) {
1192 $this->uadata['os'] = 'Firefox OS (TV, '.$regs[1].')';
1193 $this->uadata['lang'] = null;
1194 $this->uadata['eng_version'] = $regs[2];
1195 }
1c090da4 1196 elseif (preg_match('|Mozilla/5.0 \(([^;]+); ([^;]+); rv:([^\);]+)\)|', $this->uastring, $regs)) {
1c6b27e7
RK
1197 if ((strpos($regs[2], 'Linux') !== false) && ($regs[1] != 'X11')) {
1198 $this->uadata['os'] = $regs[1].' ('.$regs[2].')';
1199 }
1200 else {
1201 $this->uadata['os'] = $regs[2];
1202 }
1c090da4
RK
1203 $this->uadata['lang'] = null;
1204 $this->uadata['eng_version'] = $regs[3];
1205 }
1206 elseif (preg_match('|Mozilla/5.0 \(([^;]+); [^;]+; ([^\);]+)\)|', $this->uastring, $regs)) {
1207 $this->uadata['os'] = $regs[2];
1208 $this->uadata['lang'] = null;
1209 $this->uadata['eng_version'] = null;
1210 }
52e23932 1211 elseif (preg_match('#Mozilla/5.0 \((Mobile|Tablet); rv:([^\);]+)\)#', $this->uastring, $regs)) {
d09178b6 1212 $this->uadata['os'] = 'Firefox OS ('.$regs[1].')';
7f0cf175 1213 $this->uadata['lang'] = null;
52e23932
RK
1214 $this->uadata['eng_version'] = $regs[2];
1215 $this->mobile = ($regs[1] == 'Mobile');
7f0cf175 1216 }
ee2c4e9b
RK
1217 elseif (preg_match('|Mozilla/5.0 \(([^;]+); rv:([^\);]+)\)|', $this->uastring, $regs)) {
1218 $this->uadata['os'] = $regs[1];
1219 $this->uadata['lang'] = null;
1220 $this->uadata['eng_version'] = $regs[2];
1221 }
1c090da4
RK
1222 elseif (preg_match('|Mozilla/5.0 Galeon/[^\(]+ \(([^;]+); ([^;]+);[^\)]+\)|', $this->uastring, $regs)) {
1223 $this->uadata['os'] = $regs[2];
1224 $this->uadata['lang'] = null;
1225 $this->uadata['eng_version'] = null;
1226 }
1227 elseif (preg_match('|Debian/|', $this->uastring, $regs)) {
1228 $this->uadata['os'] = 'Debian Linux';
1229 $this->uadata['lang'] = null;
1230 $this->uadata['eng_version'] = null;
1231 }
fb10d8f6
RK
1232 if (($this->brand == 'Firefox') && (intval($this->version) >= 110)) {
1233 $this->uadata['eng_version'] = $this->version;
1234 }
bf78d3ed 1235 }
645a7eb6 1236 elseif ($this->hasEngine('edgehtml')) {
3cd2b543
RK
1237 if (preg_match('#Mozilla/5.0 \(([^;]+); (WOW64|Win64); ([^\);]+)\)#', $this->uastring, $regs)) {
1238 $this->uadata['os'] = $regs[1].' ('.$regs[2].')';
1239 }
d87e7412
RK
1240 elseif (preg_match('#Mozilla/5.0 \(([^;]+Phone[^;]+); [^\)]+\)#i', $this->uastring, $regs)) {
1241 $this->uadata['os'] = $regs[1];
1242 }
3cd2b543 1243 }
1c090da4 1244 elseif ($this->hasEngine('trident') || $this->hasEngine('tasman')) {
63119c16
RK
1245 if (preg_match('/Mozilla\/[^\(]+ \((IE [^;]+[^\)]*; )?((?:Mac|Win)[^;]+); ?(Win64|WOW64); ?Trident\/([^;\)]+);/i', $this->uastring, $regs)) {
1246 $this->uadata['eng_version'] = $regs[4];
1247 $this->uadata['os'] = $regs[2].' ('.$regs[3].')';
1248 $this->uadata['lang'] = null;
1249 }
1250 elseif (preg_match('/Mozilla\/[^\(]+ \((IE [^;]+[^\)]*; )?((?:Mac|Win)[^;]+); ?Trident\/([^;\)]+);/i', $this->uastring, $regs)) {
1251 $this->uadata['eng_version'] = $regs[3];
1252 $this->uadata['os'] = $regs[2];
1253 $this->uadata['lang'] = null;
1254 }
1255 elseif (preg_match('/Mozilla\/[^\(]+ \(compatible *; MSIE [^;]+[^\)]*; ?((?:Mac|Win)[^;]+); ?(Win64|WOW64)[^\)]*Trident\/([^;\)]+)[^\)]*\)/i', $this->uastring, $regs)) {
ee2c4e9b
RK
1256 $this->uadata['eng_version'] = $regs[3];
1257 $this->uadata['os'] = $regs[1].' ('.$regs[2].')';
1258 $this->uadata['lang'] = null;
1259 }
1260 elseif (preg_match('/Mozilla\/[^\(]+ \(compatible *; MSIE [^;]+[^\)]*; ?((?:Mac|Win)[^;]+); ?[^\)]*Trident\/([^;\)]+)[^\)]*\)/i', $this->uastring, $regs)) {
1261 $this->uadata['eng_version'] = $regs[2];
1262 $this->uadata['os'] = $regs[1];
1263 $this->uadata['lang'] = null;
1264 }
1265 elseif (preg_match('/Mozilla\/[^\(]+ \(compatible *; MSP?IE ([^;]+)[^\)]*; ?((?:Mac|Win)[^;]+); ?(Win64|WOW64)[^\)]*\)/i', $this->uastring, $regs)) {
1266 $this->uadata['eng_version'] = (strpos($this->uastring,'MSPIE')!==false)?null:"ie".$regs[1];
9c17eb15
RK
1267 $this->uadata['os'] = $regs[2].' ('.$regs[3].')';
1268 $this->uadata['lang'] = null;
31fe75cc 1269 $this->mobile = (strpos($this->uastring,'MSPIE') !== false);
9c17eb15
RK
1270 }
1271 elseif (preg_match('/Mozilla\/[^\(]+ \(compatible *; MSP?IE ([^;]+)[^\)]*; ?((?:Mac|Win)[^;]+)[^\)]*\)/i', $this->uastring, $regs)) {
ee2c4e9b 1272 $this->uadata['eng_version'] = (strpos($this->uastring,'MSPIE')!==false)?null:"ie".$regs[1];
1c090da4
RK
1273 $this->uadata['os'] = $regs[2];
1274 $this->uadata['lang'] = null;
31fe75cc 1275 $this->mobile = (strpos($this->uastring,'MSPIE') !== false);
1c090da4
RK
1276 }
1277 elseif (preg_match('/Mozilla\/[^\(]+ \(compatible *; MSIE ([^;]+)[^\)]*\)/i', $this->uastring, $regs)) {
ee2c4e9b 1278 $this->uadata['eng_version'] = "ie".$regs[1];
1c090da4
RK
1279 $this->uadata['os'] = null;
1280 $this->uadata['lang'] = null;
1281 }
1282 elseif (preg_match('/Microsoft Internet Explorer\/[^\s]+ \(((?:Mac|Win)[^;\)]+)\)/i', $this->uastring, $regs)) {
ee2c4e9b 1283 $this->uadata['eng_version'] = "ie".$this->getVersion();
1c090da4
RK
1284 $this->uadata['os'] = $regs[1];
1285 $this->uadata['lang'] = null;
1286 }
1287 elseif (preg_match('/Microsoft Pocket Internet Explorer\/[^\s]+/i', $this->uastring, $regs)) {
1288 $this->uadata['eng_version'] = null;
1289 $this->uadata['os'] = 'Windows CE';
1290 $this->uadata['lang'] = null;
1291 }
81e72a3e 1292 }
1c090da4
RK
1293 elseif ($this->hasEngine('khtml')) {
1294 if (preg_match('/Mozilla\/[^\(]+ \(compatible; Konqueror\/([^;]+); ([^;]+); ([^;]+); ([^;]+); ([^\);]+)\)(?: KHTML\/([0-9a-zA-Z\.+]+))?/i', $this->uastring, $regs)) {
1295 $this->uadata['eng_version'] = strlen($regs[6])?$regs[6]:$regs[1];
1296 $this->uadata['os'] = $regs[2];
1297 $this->uadata['lang'] = $regs[5];
1298 }
1299 elseif (preg_match('/Mozilla\/[^\(]+ \(compatible; Konqueror\/([^;]+); ([^\);]+)[^\)]*\)(?: KHTML\/([0-9a-zA-Z\.+]+))?/i', $this->uastring, $regs)) {
1300 $this->uadata['eng_version'] = strlen($regs[3])?$regs[3]:$regs[1];
1301 $this->uadata['os'] = $regs[2];
1302 $this->uadata['lang'] = null;
1303 }
1c6b27e7
RK
1304 elseif (preg_match('/Mozilla\/[^\(]+ \(compatible; [^;]+; ([^\);]+)\)/i', $this->uastring, $regs)) {
1305 $this->uadata['os'] = $regs[1];
1306 $this->uadata['lang'] = null;
1307 $this->uadata['eng_version'] = null;
1308 }
1309 }
1310 elseif ($this->hasEngine('webkit')) {
ff8d4ab2 1311 if (preg_match('|Mozilla/5.0 \(([^;]+); U; ([^\);]+); ([^\);]+); ([^\);]+)\)|', $this->uastring, $regs)) {
1c6b27e7
RK
1312 $this->uadata['os'] = $regs[2];
1313 $this->uadata['lang'] = $regs[3];
1c6b27e7 1314 }
ff8d4ab2 1315 elseif (preg_match('|Mozilla/5.0 \(([^;]+); U; ([^\);]+); ([^\);]+)\)|', $this->uastring, $regs)) {
1c090da4
RK
1316 if (strpos($regs[3], '/') !== false) {
1317 $this->uadata['os'] = $regs[1];
1318 $this->uadata['lang'] = null;
1c6b27e7 1319 }
1c090da4
RK
1320 else {
1321 $this->uadata['os'] = $regs[2];
1322 $this->uadata['lang'] = $regs[3];
1323 }
1c090da4 1324 }
ff8d4ab2
RK
1325 elseif (preg_match('|Mozilla/5.0 \(([^;]+); Linux; ([^;]+); U; ([^\);]+)\)|', $this->uastring, $regs)) {
1326 $this->uadata['os'] = $regs[2];
1327 $this->uadata['lang'] = $regs[3];
1328 }
1329 elseif (preg_match('|Mozilla/5.0 \(([^;]+); U; ([^\);]+)\)|', $this->uastring, $regs)) {
1c090da4
RK
1330 $this->uadata['os'] = $regs[1];
1331 $this->uadata['lang'] = $regs[2];
1c090da4 1332 }
fa6eb053
RK
1333 elseif (preg_match('|Mozilla/5.0 \(Linux; ([^;]+); ([^\);]+)\)|', $this->uastring, $regs)) {
1334 // (Chrome for) Android - $regs[2] is device
1335 $this->uadata['os'] = $regs[1];
1336 $this->uadata['lang'] = null;
1337 }
ff8d4ab2
RK
1338 elseif (preg_match('|Mozilla/5.0 \(([^\);]+); ([^\);]+)\)|', $this->uastring, $regs)) {
1339 if (($regs[1] == 'X11') || ($regs[1] == 'Macintosh') || ($regs[1] == 'iPhone')) {
1c6b27e7
RK
1340 $this->uadata['os'] = $regs[2];
1341 }
1342 else {
1343 $this->uadata['os'] = $regs[1];
1344 if ($regs[2] == 'NokiaN9') {
1345 $this->uadata['os'] .= ' Harmattan';
1346 }
1347 }
1348 $this->uadata['lang'] = null;
1c6b27e7 1349 }
ff8d4ab2 1350 elseif (preg_match('|Mozilla/5.0 \(([^\);]+)\)|', $this->uastring, $regs)) {
1c090da4
RK
1351 $this->uadata['os'] = $regs[1];
1352 $this->uadata['lang'] = null;
1c090da4 1353 }
ff8d4ab2 1354 elseif (preg_match('|Midori/[^\(]+ \((?:X11; )?([^;]+); U; ([^\)]+)\)|i', $this->uastring, $regs)) {
1c090da4
RK
1355 $this->uadata['os'] = $regs[1];
1356 $this->uadata['lang'] = $regs[2];
ff8d4ab2
RK
1357 }
1358 if ($this->brand == 'Silk') {
1359 // For some reason, Amazon spoofs us and tells us it's on MacOS X!
1360 $this->uadata['os'] = 'Android';
1c090da4 1361 }
31fe75cc
RK
1362 if (preg_match('| Mobile |', $this->uastring)) {
1363 $this->mobile = true;
1364 }
6e783db6 1365 }
1c090da4
RK
1366 elseif ($this->hasEngine('presto')) {
1367 // Opera < 8
1368 if (preg_match('/Opera\/[^\(]+ \((?:X11; )?([^;]+)[^\)]+\) +\[([a-z_-]+)\]/i', $this->uastring, $regs)) {
1369 $this->uadata['eng_version'] = $this->getVersion();
1370 $this->uadata['os'] = $regs[1];
1371 $this->uadata['lang'] = $regs[2];
1372 }
1373 elseif (preg_match('/Mozilla\/[^\(]+ \(compatible; MSIE [^;]+; (?:X11; )?([^;\)]+)[^\)]*\) Opera [^ ]+\s+\[([a-z_-]+)\]/i', $this->uastring, $regs)) {
1374 $this->uadata['eng_version'] = $this->getVersion();
1375 $this->uadata['os'] = $regs[1];
1376 $this->uadata['lang'] = $regs[2];
1377 }
1378 elseif (preg_match('/Mozilla\/[^\(]+ \((?:X11; )?([^;]+);.+\) Opera [^ ]+\s+\[([a-z_-]+)\]/i', $this->uastring, $regs)) {
1379 $this->uadata['eng_version'] = $this->getVersion();
1380 $this->uadata['os'] = $regs[1];
1381 $this->uadata['lang'] = $regs[2];
1382 }
1383 // Opera mini
1384 elseif (preg_match('/Opera\/([^\(]+) \((?:X11; )?([^;]+); Opera Mini; ([a-z_-]+); /i', $this->uastring, $regs)) {
1385 $this->uadata['eng_version'] = null;
1386 $this->uadata['os'] = $regs[2];
1387 $this->uadata['lang'] = $regs[3];
1388 }
1389 elseif (preg_match('/Opera\/([^\(]+) \((?:X11; )?([^;]+); Opera Mini\/[^;]+; ([a-z_-]+); /i', $this->uastring, $regs)) {
1390 $this->uadata['eng_version'] = $regs[1];
1391 $this->uadata['os'] = $regs[2];
1392 $this->uadata['lang'] = $regs[3];
1393 }
1394 // Opera >= 8
1395 elseif (preg_match('/Opera\/[^\(]+ \((?:X11; )?([^;]+); [^\)]+; ([a-z_-]+)\)/i', $this->uastring, $regs)) {
1396 $this->uadata['eng_version'] = $this->getVersion();
1397 $this->uadata['os'] = $regs[1];
1398 $this->uadata['lang'] = $regs[2];
1399 }
1400 elseif (preg_match('/Mozilla\/[^\(]+ \(compatible; MSIE [^;]+; (?:X11; )?([^;]+); ([a-z_-]+)\) Opera [^ ]+/i', $this->uastring, $regs)) {
1401 $this->uadata['eng_version'] = $this->getVersion();
1402 $this->uadata['os'] = $regs[1];
1403 $this->uadata['lang'] = $regs[2];
1404 }
1405 elseif (preg_match('/Mozilla\/[^\(]+ \((?:X11; )?([^;]+);.+; ([a-z_-]+)\) Opera [^ ]+/i', $this->uastring, $regs)) {
1406 $this->uadata['eng_version'] = $this->getVersion();
1407 $this->uadata['os'] = $regs[1];
1408 $this->uadata['lang'] = $regs[2];
1409 }
1410 // Opera 9 Firefox-spoofing
1411 elseif (preg_match('/Mozilla\/[^\(]+ \((?:X11; )?([^;]+);.+; ([a-z_-]+); rv:([^\);]+)\) Gecko\/\d+ Firefox\/[0-9a-zA-Z\.+]+ Opera [^ ]+/i', $this->uastring, $regs)) {
1412 $this->uadata['eng_version'] = $this->getVersion();
1413 $this->uadata['os'] = $regs[1];
1414 $this->uadata['lang'] = $regs[2];
1415 }
31fe75cc
RK
1416 if (preg_match('| Mobi|', $this->uastring)) {
1417 $this->mobile = true;
1418 }
bf78d3ed 1419 }
1c090da4
RK
1420 elseif ($this->hasEngine('nscp')) {
1421 if (preg_match('/Mozilla\/([0-9a-zA-Z\.+]+) (?:\[([a-z_-]+)\][^\(]+)?\(X11; [^;]+; ([^\)]+)\)/i', $this->uastring, $regs)) {
1422 $this->uadata['eng_version'] = $regs[1];
1423 $this->uadata['os'] = $regs[3];
1424 $this->uadata['lang'] = $regs[2];
1425 }
1426 elseif (preg_match('/Mozilla\/([0-9a-zA-Z\.+]+) (?:\[([a-z_-]+)\][^\(]+)?\(([^;]+);[^\)]+\)/i', $this->uastring, $regs)) {
1427 $this->uadata['eng_version'] = $regs[1];
1428 $this->uadata['os'] = $regs[3];
1429 $this->uadata['lang'] = $regs[2];
1430 }
1431 elseif (preg_match('/Mozilla\/([0-9a-zA-Z\.+]+)[^\(]+\(([^;]+);[^\)]+\)/i', $this->uastring, $regs)) {
1432 $this->uadata['eng_version'] = $regs[1];
1433 $this->uadata['os'] = $regs[2];
1434 $this->uadata['lang'] = null;
1435 }
bf78d3ed 1436 }
1c090da4 1437 elseif ($this->hasEngine('gzilla')) {
c18a4476 1438 $this->uadata['eng_version'] = $this->getVersion();
1c090da4 1439 $this->uadata['os'] = null;
bf78d3ed 1440 $this->uadata['lang'] = null;
6e783db6 1441 }
1c090da4
RK
1442 elseif ($this->hasEngine('links')) {
1443 if (preg_match('/E?Links[^\(]+\([^;]+; ([^;]+)[^\)]+\)/i', $this->uastring, $regs)) {
1444 $this->uadata['eng_version'] = null;
1445 $this->uadata['os'] = $regs[1];
1446 $this->uadata['lang'] = null;
1447 }
bf78d3ed 1448 }
1c090da4 1449 elseif ($this->hasEngine('lynx')) {
6e783db6 1450 $this->uadata['eng_version'] = $this->getVersion();
1c090da4 1451 $this->uadata['os'] = null;
c18a4476 1452 $this->uadata['lang'] = null;
1453 }
1c090da4
RK
1454 elseif ($this->hasEngine('icestorm')) {
1455 if (preg_match('/ICE Browser\/v?([0-9a-zA-Z\._+]+) \(Java [^;]+; ([^\)]+)\)/i', $this->uastring, $regs)) {
1456 $this->uadata['eng_version'] = str_replace('_', '.', $regs[1]);
1457 $this->uadata['os'] = $regs[2];
1458 $this->uadata['lang'] = null;
1459 }
1460 elseif (preg_match('/Mozilla\/[^\(]+ \((?:X11; )?([^;]+);.+; ([a-z_-]+)\).* ICEbrowser\/([0-9a-zA-Z\._+]+)/i', $this->uastring, $regs)) {
1461 $this->uadata['eng_version'] = $regs[3];
1462 $this->uadata['os'] = $regs[1];
1463 $this->uadata['lang'] = $regs[2];
1464 }
bf78d3ed 1465 }
1c090da4
RK
1466 else {
1467 $this->uadata['eng_version'] = null;
c18a4476 1468 $this->uadata['lang'] = null;
1c090da4
RK
1469 if (preg_match('/AmigaOS/i', $this->uastring, $regs)) {
1470 $this->uadata['os'] = 'AmigaOS';
1471 }
1472 if (preg_match('/Commodore 64/i', $this->uastring, $regs)) {
1473 $this->uadata['os'] = 'Commodore 64';
1474 }
1475 elseif (preg_match('/curl\/[^\(]+\(([^\);]+)/i', $this->uastring, $regs)) {
1476 $this->uadata['os'] = $regs[1];
1477 }
1478 elseif (preg_match('/NCSA[_ ]Mosaic\/[^\(]+\((?:.*;)?([^\);]+)/i', $this->uastring, $regs)) {
1479 $this->uadata['os'] = trim($regs[1]);
1480 }
1481 elseif (preg_match('/iCab.*(Mac[^\);]+).*?\)/i', $this->uastring, $regs)) {
1482 $this->uadata['os'] = trim($regs[1]);
1483 }
1484 elseif (preg_match('/SymbianOS\/([^ ]+)/i', $this->uastring, $regs)) {
1485 $this->uadata['os'] = 'SymbianOS '.$regs[1];
1486 }
c18a4476 1487 }
1c090da4
RK
1488 if ($this->uadata['os'] == 'Win 9x 4.90') { $this->uadata['os'] = 'Windows ME'; }
1489 elseif ($this->uadata['os'] == 'WinNT4.0') { $this->uadata['os'] = 'Windows NT 4.0'; }
1490 elseif ($this->uadata['os'] == 'Windows NT 5.0') { $this->uadata['os'] = 'Windows 2000'; }
1491 elseif ($this->uadata['os'] == 'Windows NT 5.1') { $this->uadata['os'] = 'Windows XP'; }
9c17eb15
RK
1492 elseif ($this->uadata['os'] == 'Windows NT 5.1 (Win64)') { $this->uadata['os'] = 'Windows XP (64bit)'; }
1493 elseif ($this->uadata['os'] == 'Windows NT 5.1 (WOW64)') { $this->uadata['os'] = 'Windows XP (64bit)'; }
1c090da4
RK
1494 elseif ($this->uadata['os'] == 'Windows NT 5.2') { $this->uadata['os'] = 'Windows 2003'; }
1495 elseif ($this->uadata['os'] == 'Windows NT 5.2 x64') { $this->uadata['os'] = 'Windows 2003 (64bit)'; }
9c17eb15
RK
1496 elseif ($this->uadata['os'] == 'Windows NT 5.2 (Win64)') { $this->uadata['os'] = 'Windows 2003 (64bit)'; }
1497 elseif ($this->uadata['os'] == 'Windows NT 5.2 (WOW64)') { $this->uadata['os'] = 'Windows 2003 (64bit)'; }
1c090da4 1498 elseif ($this->uadata['os'] == 'Windows NT 6.0') { $this->uadata['os'] = 'Windows Vista'; }
9c17eb15
RK
1499 elseif ($this->uadata['os'] == 'Windows NT 6.0 (Win64)') { $this->uadata['os'] = 'Windows Vista (64bit)'; }
1500 elseif ($this->uadata['os'] == 'Windows NT 6.0 (WOW64)') { $this->uadata['os'] = 'Windows Vista (64bit)'; }
1c090da4 1501 elseif ($this->uadata['os'] == 'Windows NT 6.1') { $this->uadata['os'] = 'Windows 7'; }
9c17eb15
RK
1502 elseif ($this->uadata['os'] == 'Windows NT 6.1 (Win64)') { $this->uadata['os'] = 'Windows 7 (64bit)'; }
1503 elseif ($this->uadata['os'] == 'Windows NT 6.1 (WOW64)') { $this->uadata['os'] = 'Windows 7 (64bit)'; }
d6672899
RK
1504 elseif ($this->uadata['os'] == 'Windows NT 6.2') { $this->uadata['os'] = 'Windows 8'; }
1505 elseif ($this->uadata['os'] == 'Windows NT 6.2 (Win64)') { $this->uadata['os'] = 'Windows 8 (64bit)'; }
1506 elseif ($this->uadata['os'] == 'Windows NT 6.2 (WOW64)') { $this->uadata['os'] = 'Windows 8 (64bit)'; }
63119c16
RK
1507 elseif ($this->uadata['os'] == 'Windows NT 6.3') { $this->uadata['os'] = 'Windows 8.1'; }
1508 elseif ($this->uadata['os'] == 'Windows NT 6.3 (Win64)') { $this->uadata['os'] = 'Windows 8.1 (64bit)'; }
1509 elseif ($this->uadata['os'] == 'Windows NT 6.3 (WOW64)') { $this->uadata['os'] = 'Windows 8.1 (64bit)'; }
a74f2d9d
RK
1510 elseif ($this->uadata['os'] == 'Windows NT 6.4') { $this->uadata['os'] = 'Windows 10'; }
1511 elseif ($this->uadata['os'] == 'Windows NT 6.4 (Win64)') { $this->uadata['os'] = 'Windows 10 (64bit)'; }
1512 elseif ($this->uadata['os'] == 'Windows NT 6.4 (WOW64)') { $this->uadata['os'] = 'Windows 10 (64bit)'; }
4d4532c4
RK
1513 elseif ($this->uadata['os'] == 'Windows NT 10.0') { $this->uadata['os'] = 'Windows 10'; }
1514 elseif ($this->uadata['os'] == 'Windows NT 10.0 (Win64)') { $this->uadata['os'] = 'Windows 10 (64bit)'; }
1515 elseif ($this->uadata['os'] == 'Windows NT 10.0 (WOW64)') { $this->uadata['os'] = 'Windows 10 (64bit)'; }
1c090da4
RK
1516 elseif ($this->uadata['os'] == 'Win95') { $this->uadata['os'] = 'Windows 95'; }
1517 elseif ($this->uadata['os'] == 'Win98') { $this->uadata['os'] = 'Windows 98'; }
1518 elseif ($this->uadata['os'] == 'WinNT') { $this->uadata['os'] = 'Windows NT'; }
1519 elseif ($this->uadata['os'] == 'Win32') { $this->uadata['os'] = 'Windows (32bit)'; }
1520 elseif ($this->uadata['os'] == 'Win64') { $this->uadata['os'] = 'Windows (64bit)'; }
1c6b27e7
RK
1521 elseif (preg_match('/iPhone OS ([\d_]+)/i', $this->uadata['os'], $regs)) { $this->uadata['os'] = 'iOS '.str_replace('_', '.', $regs[1]); }
1522 elseif (preg_match('/Mac ?OS ?X/i', $this->uadata['os'])) { $this->uadata['os'] = 'MacOS X'; }
1523 elseif (preg_match('/Mac_P(ower|)PC/i', $this->uadata['os'])) { $this->uadata['os'] = 'MacOS'; }
e78a7538
RK
1524 elseif (strpos($this->uadata['os'] ?? '', 'darwin') !== false) { $this->uadata['os'] = 'MacOS X'; }
1525 elseif (strpos($this->uadata['os'] ?? '', 'Darwin') !== false) { $this->uadata['os'] = 'MacOS X'; }
1526 elseif (strpos($this->uadata['os'] ?? '', 'apple') !== false) { $this->uadata['os'] = 'MacOS'; }
1527 elseif (strpos($this->uadata['os'] ?? '', 'Macintosh') !== false) { $this->uadata['os'] = 'MacOS'; }
ff8d4ab2 1528 elseif (preg_match('/(?:web|hpw)OS\/([0-9a-zA-Z\._+]+)/i', $this->uadata['os'], $regs)) { $this->uadata['os'] = 'webOS '.$regs[1]; }
1c6b27e7 1529 elseif (preg_match('/Android \(Linux (.+)\)/i', $this->uadata['os'], $regs)) { $this->uadata['os'] = 'Android '.$regs[1]; }
e78a7538 1530 elseif (strpos($this->uadata['os'] ?? '', 'linux') !== false) { $this->uadata['os'] = 'Linux'; }
1c090da4 1531 elseif (preg_match('/SymbianOS[\/ ]([0-9a-zA-Z\._+]+)/i', $this->uastring, $regs)) { $this->uadata['os'] = 'SymbianOS '.$regs[1]; }
1c6b27e7 1532 elseif (preg_match('/Symbian ?OS/i', $this->uadata['os'])) { $this->uadata['os'] = 'SymbianOS'; }
bf78d3ed 1533
e78a7538
RK
1534 if (strpos($this->uadata['os'] ?? '', 'Win') !== false) { $this->uadata['platform'] = 'Windows'; }
1535 elseif (strpos($this->uadata['os'] ?? '', 'Mac') !== false) { $this->uadata['platform'] = 'Macintosh'; }
1536 elseif (strpos($this->uadata['os'] ?? '', 'iOS') !== false) { $this->uadata['platform'] = 'Macintosh'; }
1537 elseif (strpos($this->uadata['os'] ?? '', 'Linux') !== false) { $this->uadata['platform'] = 'Linux'; }
1538 elseif (strpos($this->uadata['os'] ?? '', 'MeeGo') !== false) { $this->uadata['platform'] = 'Linux'; }
1539 elseif (strpos($this->uadata['os'] ?? '', 'webOS') !== false) { $this->uadata['platform'] = 'Linux'; }
1540 elseif (strpos($this->uadata['os'] ?? '', 'Android') !== false) { $this->uadata['platform'] = 'Android'; }
1541 elseif (strpos($this->uadata['os'] ?? '', 'Firefox OS') !== false) { $this->uadata['platform'] = 'Firefox OS'; }
1542 elseif (strpos($this->uadata['os'] ?? '', 'Solaris') !== false) { $this->uadata['platform'] = 'Solaris'; }
1543 elseif (strpos($this->uadata['os'] ?? '', 'SunOS') !== false) { $this->uadata['platform'] = 'Solaris'; }
1544 elseif (strpos($this->uadata['os'] ?? '', 'BeOS') !== false) { $this->uadata['platform'] = 'BeOS'; }
1545 elseif (strpos($this->uadata['os'] ?? '', 'BePC') !== false) { $this->uadata['platform'] = 'BeOS'; }
1546 elseif (strpos($this->uadata['os'] ?? '', 'FreeBSD') !== false) { $this->uadata['platform'] = 'FreeBSD'; }
1547 elseif (strpos($this->uadata['os'] ?? '', 'OpenBSD') !== false) { $this->uadata['platform'] = 'OpenBSD'; }
1548 elseif (strpos($this->uadata['os'] ?? '', 'NetBSD') !== false) { $this->uadata['platform'] = 'NetBSD'; }
1549 elseif (strpos($this->uadata['os'] ?? '', 'AIX') !== false) { $this->uadata['platform'] = 'AIX'; }
1550 elseif (strpos($this->uadata['os'] ?? '', 'IRIX') !== false) { $this->uadata['platform'] = 'IRIX'; }
1551 elseif (strpos($this->uadata['os'] ?? '', 'HP-UX') !== false) { $this->uadata['platform'] = 'HP-UX'; }
1552 elseif (strpos($this->uadata['os'] ?? '', 'AmigaOS') !== false) { $this->uadata['platform'] = 'Amiga'; }
1553 elseif (strpos($this->uadata['os'] ?? '', 'webOS') !== false) { $this->uadata['platform'] = 'webOS'; }
1554 elseif (strpos($this->uadata['os'] ?? '', 'Commodore 64') !== false) { $this->uadata['platform'] = 'C64'; }
1555 elseif (strpos($this->uadata['os'] ?? '', 'OpenVMS') !== false) { $this->uadata['platform'] = 'OpenVMS'; }
1556 elseif (strpos($this->uadata['os'] ?? '', 'Warp') !== false) { $this->uadata['platform'] = 'OS/2'; }
1557 elseif (strpos($this->uadata['os'] ?? '', 'OS/2') !== false) { $this->uadata['platform'] = 'OS/2'; }
1558 elseif (strpos($this->uadata['os'] ?? '', 'SymbianOS') !== false) { $this->uadata['platform'] = 'SymbianOS'; }
1559 elseif (strpos($this->uadata['os'] ?? '', 'BlackBerry') !== false) { $this->uadata['platform'] = 'BlackBerry'; }
1560 elseif (strpos($this->uadata['os'] ?? '', 'Gameboy') !== false) { $this->uadata['platform'] = 'Nintendo'; }
1561 elseif (strpos($this->uadata['os'] ?? '', 'Wii') !== false) { $this->uadata['platform'] = 'Nintendo'; }
1562 elseif (strpos($this->uadata['os'] ?? '', 'Nintendo') !== false) { $this->uadata['platform'] = 'Nintendo'; }
1563 elseif (strpos($this->uadata['os'] ?? '', 'J2ME') !== false) { $this->uadata['platform'] = 'Java'; }
1564 elseif (strpos($this->uadata['os'] ?? '', 'CYGWIN') !== false) { $this->uadata['platform'] = 'Windows'; }
1565 elseif (strpos($this->uadata['os'] ?? '', 'mingw') !== false) { $this->uadata['platform'] = 'Windows'; }
1c090da4 1566 else { $this->uadata['platform'] = $this->uadata['os']; }
bf78d3ed 1567
e78a7538
RK
1568 if (strpos($this->uadata['os'] ?? '', 'Windows Phone OS') !== false) { $this->mobile = true; }
1569 elseif (strpos($this->uadata['os'] ?? '', 'Gameboy') !== false) { $this->mobile = true; }
31fe75cc 1570
5ae00086 1571 $this->uadata['lang'] = str_replace('_', '-', ($this->uadata['lang'] ?? ''));
1c090da4 1572 }
31733e08 1573 }
e78a7538 1574 return $this->uadata['os'];
31733e08 1575 }
1576
3077a4f6 1577 public function getPlatform() {
bf78d3ed 1578 if (!isset($this->uadata['platform'])) {
1579 $this->uadata['platform'] = null;
1580 // getOS() should get the date for us
1581 $this->getOS();
31733e08 1582 }
e78a7538 1583 return $this->uadata['platform'];
31733e08 1584 }
1585
3077a4f6 1586 public function getLanguage() {
bf78d3ed 1587 if (!isset($this->uadata['lang'])) {
1588 $this->uadata['lang'] = null;
1589 // getOS() should get the date for us
1590 $this->getOS();
31733e08 1591 }
e78a7538 1592 return $this->uadata['lang'];
31733e08 1593 }
1defa974 1594
3077a4f6 1595 public function getGeckoDate() {
bf78d3ed 1596 if (!isset($this->uadata['geckodate'])) {
1597 $this->uadata['geckodate'] = null;
1598 // getEngine() should get the date for us
1599 $this->getEngine();
1defa974 1600 }
e78a7538 1601 return $this->uadata['geckodate'];
1defa974 1602 }
bf78d3ed 1603
a3e499ad
RK
1604 public function getGeckoTime() {
1605 if (!isset($this->uadata['geckotime'])) {
1606 $this->uadata['geckotime'] = null;
1607 if (!is_null($this->getGeckoDate())) {
1608 $use_time = (strlen($this->getGeckoDate()) > 8);
1609 $gd_str = substr($this->getGeckoDate(),0,4).'-'.substr($this->getGeckoDate(),4,2).'-'.substr($this->getGeckoDate(),6,2);
1610 if ($use_time) {
1611 $gd_str .= substr($this->getGeckoDate(),8,2).':00';
1612 $old_tz = date_default_timezone_get();
1613 date_default_timezone_set("America/Los_Angeles");
1614 }
1615 $this->uadata['geckotime'] = strtotime($gd_str);
1616 if ($use_time) { date_default_timezone_set($old_tz); }
1617 }
1618 }
e78a7538 1619 return $this->uadata['geckotime'];
a3e499ad
RK
1620 }
1621
e78a7538
RK
1622 public function isBot() {
1623 return $this->bot;
1624 }
3077a4f6 1625
31fe75cc
RK
1626 public function isMobile() {
1627 if (!isset($this->uadata['os'])) {
1628 // getOS() makes sure that also the mobile tag is set correctly
1629 $this->getOS();
1630 }
1631 return $this->mobile;
1632 }
1633
3077a4f6 1634 public function isns() {
1635 trigger_error(__CLASS__.'::'.__FUNCTION__.' is a deprecated function', E_USER_NOTICE);
1636 return (strpos($this->brand, 'Netscape') !== false);
1637 }
1638 public function isns4() {
1639 trigger_error(__CLASS__.'::'.__FUNCTION__.' is a deprecated function', E_USER_NOTICE);
1640 return ((strpos($this->brand, 'Netscape') !== false) && (intval($this->version) == 4));
1641 }
1642 public function isie() {
1643 trigger_error(__CLASS__.'::'.__FUNCTION__.' is a deprecated function', E_USER_NOTICE);
1644 return $this->hasEngine('trident');
1645 }
1646 public function geckodate() {
1647 trigger_error(__CLASS__.'::'.__FUNCTION__.' is a deprecated function', E_USER_NOTICE);
1648 return (!is_null($this->getGeckoDate())?$this->getGeckoDate():0);
1649 }
1650 public function geckobased() {
1651 trigger_error(__CLASS__.'::'.__FUNCTION__.' is a deprecated function', E_USER_NOTICE);
1652 return $this->hasEngine('gecko');
1653 }
1654 public function khtmlbased() {
1655 trigger_error(__CLASS__.'::'.__FUNCTION__.' is a deprecated function', E_USER_NOTICE);
1656 return $this->hasEngine('khtml');
1657 }
31733e08 1658}
23585ba2 1659?>