-
Notifications
You must be signed in to change notification settings - Fork 1
/
client.php.inc
executable file
·7190 lines (6396 loc) · 237 KB
/
client.php.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/*
* CaMykS Engine
* Developed by : camyks.net
* Author : CaMykS Team <camyks.contact@gmail.com>
* CaMykS Version : 1.0
* Object Version : 1.0.1
* Object Type : Engine / Tool Library
* Creation Date : Jun 2007
* Last Modif Date : Mar 2018
*
* client user methods
*/
/*
* get client IP address
* @return string
* @access public
*/
function client_getIp() {
if (isset($_SERVER['HTTP_PC_REMOTE_ADDR']))
return $_SERVER['HTTP_PC_REMOTE_ADDR'];
return $_SERVER['REMOTE_ADDR'];
}
/*
* get client user agent
* @return string
* @access public
*/
function client_getUserAgent() {
if (isset($_SERVER['HTTP_USER_AGENT']))
return $_SERVER['HTTP_USER_AGENT'];
return '';
}
/*
* check if page is loaded is HTTPS(SSL)
* @return boolean result
* @access public
*/
function client_isHTTPS() {
return (!empty($_SERVER['HTTPS']));
}
/*
* get client referer site
* @return string
* @access public
*/
function client_getRefererSite() {
return (isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:'');
}
/*
* check if server is also client
* @return boolean result
* @access public
*/
function client_isServerClient() {
return ($_SERVER['SERVER_ADDR'] == client_getIp());
}
/*
* check if server is marked as Do Not Track
* @return boolean result
* @access public
*/
function client_getDoNotTrack() {
return (isset($_SERVER['HTTP_DNT']) and $_SERVER['HTTP_DNT'] == 1);
}
/*
* return client informations
* @param mixte $ua
* @return array
* @access public
*/
function client_getUAInfos($ua=false) {
$req = true;
/* get user agent */
if ($ua===false) $ua = client_getUserAgent();
/* init result value */
$infos = array();
/*** check fake visitors */
if ( ($c = client_getFakeInfosFromUserAgent($ua)) !== false)
return $c;
/*** check hacks */
if ( ($c = client_getHackInfosFromUserAgent($ua)) !== false)
return $c;
/*** check tool */
if ( ($c = client_getToolInfosFromUserAgent($ua)) !== false)
return $c;
/*** check bot */
if ( ($c = client_getBotInfosFromUserAgent($ua)) !== false)
return $c;
/*** check generic bot/tool */
if ( ($c = client_getGenericInfosFromUserAgent($ua)) !== false)
return $c;
/*** check plateform ***/
/* load max versions to check and default fake value */
$maxVersions = _client_getUAPropertiesMaxVersions();
$fake = array('platform_type'=>'fake');
/* check Playstation 4 / Vita */
if (preg_match('/\(PlayStation ([^ ]*) ([0-9\.]*)\)/i', $ua, $matches))
return _client_mergeUAInfos($req, array('platform_company'=>'Sony',
'platform_model'=>'Playstation '.$matches[1],
'platform_type'=>'computer',
'platform_format'=>'desktop',
'system_title'=>'Playstation '.$matches[1],
'system_version'=>$matches[2],
'browser_title'=>'PS '.$matches[1].' Browser',
'browser_version'=>'--'));
/* check Playstation 3 */
if (preg_match('/\(PLAYSTATION 3; ([0-9\.]*)\)$/', $ua, $matches))
return _client_mergeUAInfos($req, array('platform_company'=>'Sony',
'platform_model'=>'Playstation 3',
'platform_type'=>'computer',
'platform_format'=>'desktop',
'system_title'=>'Playstation 3',
'system_version'=>$matches[1],
'browser_title'=>'PS3 Browser',
'browser_version'=>'--'));
/* check Playstation Portable */
if (preg_match('/PSP \(PlayStation Portable\); ([0-9\.]*)\)?$/', $ua, $matches))
return _client_mergeUAInfos($req, array('platform_company'=>'Sony',
'platform_model'=>'Playstation Portable',
'platform_type'=>'computer',
'platform_format'=>'handheld',
'system_title'=>'Playstation Portable',
'system_version'=>$matches[1],
'browser_title'=>'PSP Browser',
'browser_version'=>'--'));
/* check Black Berry */
if (preg_match('/BlackBerry([^\/;]{1,})\/([0-9\.]*)/', $ua, $matches))
return _client_mergeUAInfos($req, array('platform_company'=>'BlackBerry',
'platform_model'=>$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld',
'system_title'=>'BlackBerry OS',
'system_version'=>$matches[2],
'browser_title'=>'BB Browser',
'browser_version'=>'--'));
if (preg_match('/BlackBerry ([^;]{1,});?.*Version\/([0-9\.]*) /', $ua, $matches))
return _client_mergeUAInfos($req, array('platform_company'=>'BlackBerry',
'platform_model'=>$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld',
'system_title'=>'BlackBerry OS',
'system_version'=>$matches[2],
'browser_title'=>'BB Browser',
'browser_version'=>'--'));
if (preg_match('/BB([^\/;]{1,});/', $ua, $matches))
return _client_mergeUAInfos($req, array('platform_company'=>'BlackBerry',
'platform_model'=>$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld',
'system_title'=>'BlackBerry OS',
'system_version'=>$matches[1],
'browser_title'=>'BB Browser',
'browser_version'=>'--'));
/* check Nokia - before iPhone */
elseif (preg_match('/RX-51 N900/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Nokia',
'platform_model'=>'N900',
'platform_type'=>'handheld',
'platform_format'=>'handheld',
'system_title'=>'Maemo',
'system_version'=>5,
));
elseif (preg_match('/Nokia(?: |_|\-|\/|)([^ _\-\/]+)/', $ua, $matches)) {
$rep = array(
'X2DS' => array('platform_model' => 'X2 (Dual Sim)', ),
);
$infos = array_merge($infos, array(
'platform_company'=>'Nokia',
'platform_model'=>$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$matches[1]])?$rep[$matches[1]]:array());
}
elseif (preg_match('/Lumia ([a-zA-Z0-9]*)/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Nokia',
'platform_model'=>'Lumia '.$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
/* check iphone / ipod / ipad */
elseif (preg_match('/(iPod|iPhone|iPad);?.*; CPU ([A-Za-z\ ]*)? ([0-9_]*)?.*(Version)\/([0-9\.]*)/', $ua, $matches)) {
/* check version */
$version = str_replace('_', '.', $matches[3]);
if (version_compare($version, $maxVersions['system']['iOS']) > 0)
return $fake;
$infos = array_merge($infos, array('platform_company'=>'Apple',
'platform_model'=>$matches[1],
'platform_type'=>$matches[1]=='iPad'? 'tablet': 'handheld',
'platform_format'=>$matches[1]=='iPad'? 'tablet': 'handheld',
'system_title'=> 'iOS', //$matches[2],
'system_version'=>$version,
'browser_title'=>'Safari Mobile',
'browser_version'=>$matches[5],
));
} elseif (preg_match('/(iPod|iPhone|iPad);?.*; CPU ([A-Za-z\ ]*)? ([0-9_]*)/', $ua, $matches)) {
/* check version */
$version = str_replace('_', '.', $matches[3]);
if (version_compare($version, $maxVersions['system']['iOS']) > 0)
return $fake;
$infos = array_merge($infos, array('platform_company'=>'Apple',
'platform_model'=>$matches[1],
'platform_type'=>$matches[1]=='iPad'? 'tablet': 'handheld',
'platform_format'=>$matches[1]=='iPad'? 'tablet': 'handheld',
'system_title'=>'iOS', //$matches[2],
'system_version'=>$version,
));
} elseif (preg_match('/(iPod|iPhone|iPad)/', $ua, $matches))
$infos = array_merge($infos, array('platform_company'=>'Apple',
'platform_model'=>$matches[1],
'platform_type'=>$matches[1]=='iPad'? 'tablet': 'handheld',
'platform_format'=>$matches[1]=='iPad'? 'tablet': 'handheld',
'system_title'=>'iOS',
));
/* check Google */
elseif (preg_match('/(Nexus( [^ \/;]+)?|Pixel) Build/', $ua, $matches))
$infos = array_merge($infos, array('platform_company'=>'Google',
'platform_model'=>$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
/* check HTC */
elseif (preg_match('/HTC;([A-Za-z0-9 ]*)/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'HTC',
'platform_model'=>$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
elseif (preg_match('/HTC[ |_]([^\/\-]*)( Build|\-)/', $ua, $matches)) {
$rep = array(
'M8Sx' => array('platform_model' => 'One', ),
'IncredibleS' => array('platform_model' => 'Incredible S'),
'D820u' => array('platform_model' => 'Desire 820 Dual SIM'),
);
$model = preg_replace('/_/', ' ', $matches[1]);
$infos = array_merge($infos, array(
'platform_company'=>'HTC',
'platform_model'=>$model,
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$matches[1]])?$rep[$matches[1]]:array());
}
/* check LG */
elseif (preg_match('/^LG(?:E|)(?: |_|\-|\/)([^ _\-\/]+)/', $ua, $matches))
$infos = array_merge($infos, array('platform_company'=>'LG',
'platform_model'=>$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
elseif (preg_match('/LG-([A-Z][0-9]{3}[A-Z]?)/', $ua, $matches)) {
$rep = array(
'D160' => array('platform_model' => 'L40',),
'D290' => array('platform_model' => 'L Fino',),
'D315' => array('platform_model' => 'F70',),
'D320' => array('platform_model' => 'L70',),
'D405' => array('platform_model' => 'L90',),
'D505' => array('platform_model' => 'Optimus F6',),
'D620' => array('platform_model' => 'G2 Mini',),
'D722' => array('platform_model' => 'G3 S',),
'D802' => array('platform_model' => 'Nexus 5',),
'D821' => array('platform_model' => 'G2',),
'D855' => array('platform_model' => 'G3',),
'D855' => array('platform_model' => 'G Flex',),
'E410' => array('platform_model' => 'Optimus L1 II',),
'E430' => array('platform_model' => 'Optimus L3 II',),
'E440' => array('platform_model' => 'Optimus L4 II',),
'E460' => array('platform_model' => 'Optimus L5 II',),
'E610' => array('platform_model' => 'Optimus L5',),
'E960' => array('platform_model' => 'Nexus 4',),
'H815' => array('platform_model' => 'G4',),
'H870D' => array('platform_model' => 'G6',),
'L160L' => array('platform_model' => 'Optimus LTE2',),
'M700' => array('platform_model' => 'Q6 Alpha',),
'M160' => array('platform_model' => 'K4 (2017)',),
'P715' => array('platform_model' => 'Optimus L7 II',),
'P875' => array('platform_model' => 'Optimus F5',),
);
$infos = array_merge($infos, array(
'platform_company'=>'LG',
'platform_model'=>$matches[1],
'platform_type'=>'handheld'),
isset($rep[$matches[1]])?$rep[$matches[1]]:array());
} elseif (preg_match('/LG([A-Z]{1,2}[0-9]*)/', $ua, $matches)) {
$rep = array(
'LS996'=>array('platform_model' => 'G Flex 2', ),
);
$infos = array_merge($infos, array(
'platform_company'=>'LG',
'platform_model'=>$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$matches[1]])?$rep[$matches[1]]:array());
}
/* check Motorola */
elseif (preg_match('/mot(?:-|orola |o|\-moto)([^ \/;]+)/i', $ua, $matches))
$infos = array_merge($infos, array('platform_company'=>'Motorola',
'platform_model'=>$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
elseif (preg_match('/ (Droid|MB200|RAZR HD|Moto G)/', $ua, $matches))
$infos = array_merge($infos, array('platform_company'=>'Motorola',
'platform_model'=>$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
elseif (preg_match('/XT([0-9]{3,})/', $ua, $matches)) {
$rep = array('XT720' =>array('platform_model' => 'Milestone XT720', ),
'XT1022'=>array('platform_model' => 'Moto E', ),
'XT1032'=>array('platform_model' => 'Moto G', ),
'XT1039'=>array('platform_model' => 'Moto 4G', ),
'XT1072'=>array('platform_model' => 'Moto G 4G (2nd Gen)', ),
'XT1092'=>array('platform_model' => 'Moto X (2nd Gen)', ),
);
$infos = array_merge($infos, array('platform_company'=>'Motorola',
'platform_model'=>$matches[0],
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$matches[0]])?$rep[$matches[0]]:array());
}
/* check palm */
elseif (preg_match('/(Pre|Pixi)\/[0-9\.]*$/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Palm',
'platform_model'=>$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
/* check samsung devices */
elseif (preg_match('/(GT|SM|SGH|SHV)-([A-Z0-9]{4,})/', $ua, $matches)) {
$rep = array(
/* check samsung tablets */
'GT-P1000' => array('platform_model' => 'Galaxy Tab', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'GT-P3100' => array('platform_model' => 'Galaxy Tab 2', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'GT-P3110' => array('platform_model' => 'Galaxy Tab 2', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'GT-P5100' => array('platform_model' => 'Galaxy Tab 2', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'GT-P5110' => array('platform_model' => 'Galaxy Tab 2', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'GT-P5200' => array('platform_model' => 'Galaxy Tab 3', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'GT-P5210' => array('platform_model' => 'Galaxy Tab 3', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'GT-P7300' => array('platform_model' => 'Galaxy Tab 8.9', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-T110' => array('platform_model' => 'Galaxy Tab 3 Lite', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-T113' => array('platform_model' => 'Galaxy Tab 3 Lite (2015)', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-T310' => array('platform_model' => 'Galaxy Tab 3', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-T116NU' => array('platform_model' => 'Galaxy Tab 3 V', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-T320' => array('platform_model' => 'Galaxy Tab Pro', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-T230' => array('platform_model' => 'Galaxy Tab 4', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-T530' => array('platform_model' => 'Galaxy Tab 4', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-T531' => array('platform_model' => 'Galaxy Tab 4 (3G)', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-T533' => array('platform_model' => 'Galaxy Tab 4', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-T535' => array('platform_model' => 'Galaxy Tab 4 (4G)', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-T550' => array('platform_model' => 'Galaxy Tab A', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-P550' => array('platform_model' => 'Galaxy Tab A', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-T560' => array('platform_model' => 'Galaxy Tab E', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-T800' => array('platform_model' => 'Galaxy Tab S', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-T715' => array('platform_model' => 'Galaxy Tab S2', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-T810' => array('platform_model' => 'Galaxy Tab S2', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'SM-T813' => array('platform_model' => 'Galaxy Tab S2', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
/* check samsung phones */
'GT-S3800W' => array('platform_model' => 'REX 70', ),
'GT-I9000' => array('platform_model' => 'Galaxy S', ),
'GT-S7562' => array('platform_model' => 'Galaxy S Duo', ),
'GT-I9100' => array('platform_model' => 'Galaxy S2', ),
'GT-I9195' => array('platform_model' => 'Galaxy S4 Mini', ),
'GT-I9295' => array('platform_model' => 'Galaxy S4 Active', ),
'GT-I9300' => array('platform_model' => 'Galaxy S3', ),
'GT-I9305' => array('platform_model' => 'Galaxy S3 (4G)', ),
'GT-I9301I' => array('platform_model' => 'Galaxy S3 Neo', ),
'GT-I8190' => array('platform_model' => 'Galaxy S3 Mini', ),
'GT-I9500' => array('platform_model' => 'Galaxy S4', ),
'GT-I9505' => array('platform_model' => 'Galaxy S4', ),
'GT-I9506' => array('platform_model' => 'Galaxy S4', ),
'GT-I9195I' => array('platform_model' => 'Galaxy S4 Mini', ),
'GT-I9192' => array('platform_model' => 'Galaxy S4 Mini Duos', ),
'SM-G900A' => array('platform_model' => 'Galaxy S5', ),
'SM-G900F' => array('platform_model' => 'Galaxy S5', ),
'SM-G903F' => array('platform_model' => 'Galaxy S5', ),
'SM-G901F' => array('platform_model' => 'Galaxy S5+', ),
'SM-G800F' => array('platform_model' => 'Galaxy S5 Mini', ),
'SM-G920F' => array('platform_model' => 'Galaxy S6'),
'SM-G920I' => array('platform_model' => 'Galaxy S6'),
'SM-G920P' => array('platform_model' => 'Galaxy S6'),
'SM-G925T' => array('platform_model' => 'Galaxy S6 Edge'),
'SM-G925F' => array('platform_model' => 'Galaxy S6 Edge'),
'SM-G928C' => array('platform_model' => 'Galaxy S6 Edge+'),
'SM-G928F' => array('platform_model' => 'Galaxy S6 Edge+'),
'SM-G930' => array('platform_model' => 'Galaxy S7'),
'SM-G930F' => array('platform_model' => 'Galaxy S7'),
'SM-G930V' => array('platform_model' => 'Galaxy S7'),
'SM-G935' => array('platform_model' => 'Galaxy S7 Edge'),
'SM-G935F' => array('platform_model' => 'Galaxy S7 Edge'),
'SM-T580' => array('platform_model' => 'Galaxy S8'),
'SM-G950' => array('platform_model' => 'Galaxy S8'),
'SM-G950F' => array('platform_model' => 'Galaxy S8'),
'SM-G955F' => array('platform_model' => 'Galaxy S8+'),
'SM-G892A' => array('platform_model' => 'Galaxy S8 Active'),
'SM-G313HZ' => array('platform_model' => 'Galaxy V', ),
'SM-A300F' => array('platform_model' => 'Galaxy A3', ),
'SM-A300FU' => array('platform_model' => 'Galaxy A3', ),
'SM-A310F' => array('platform_model' => 'Galaxy A3', ),
'SM-A300M' => array('platform_model' => 'Galaxy A3', ),
'SM-A320L' => array('platform_model' => 'Galaxy A3 (2017)', ),
'SM-A320FL' => array('platform_model' => 'Galaxy A3 (2017)', ),
'SM-A500FU' => array('platform_model' => 'Galaxy A5', ),
'SM-A510' => array('platform_model' => 'Galaxy A5 (2016)', ),
'SM-A510F' => array('platform_model' => 'Galaxy A5 (2016)', ),
'SM-A5100' => array('platform_model' => 'Galaxy A5 (2016)', ),
'SM-A520F' => array('platform_model' => 'Galaxy A5 (2017)', ),
'SM-A700L' => array('platform_model' => 'Galaxy A7', ),
'SM-E500F' => array('platform_model' => 'Galaxy E5 (2015)', ),
'SM-E500H' => array('platform_model' => 'Galaxy E5 (2015)', ),
'SM-E500HQ' => array('platform_model' => 'Galaxy E5 (2015)', ),
'SM-E500M' => array('platform_model' => 'Galaxy E5 (2015)', ),
'SM-E700H' => array('platform_model' => 'Galaxy E7', ),
'SM-J100H' => array('platform_model' => 'Galaxy J1', ),
'SM-J110H' => array('platform_model' => 'Galaxy J1 (2015)', ),
'SM-J120FN' => array('platform_model' => 'Galaxy J1 (2016)', ),
'SM-J200F' => array('platform_model' => 'Galaxy J2', ),
'SM-J310' => array('platform_model' => 'Galaxy J3 (2016)', ),
'SM-J320FN' => array('platform_model' => 'Galaxy J3', ),
'SM-J320F' => array('platform_model' => 'Galaxy J3 (2016)', ),
'SM-J330G' => array('platform_model' => 'Galaxy J3 Pro (2017)', ),
'SM-J500' => array('platform_model' => 'Galaxy J5', ),
'SM-J500F' => array('platform_model' => 'Galaxy J5 (2015)', ),
'SM-J500FN' => array('platform_model' => 'Galaxy J5 (2015)', ),
'SM-J500G' => array('platform_model' => 'Galaxy J5 (2015)', ),
'SM-J500Y' => array('platform_model' => 'Galaxy J5 (2015)', ),
'SM-J500M' => array('platform_model' => 'Galaxy J5 (2015)', ),
'SM-J500H' => array('platform_model' => 'Galaxy J5 (2015)', ),
'SM-J5007' => array('platform_model' => 'Galaxy J5 (2015)', ),
'SM-J500M' => array('platform_model' => 'Galaxy J5 (2016)', ),
'SM-J510F' => array('platform_model' => 'Galaxy J5 (2016)', ),
'SM-J510FN' => array('platform_model' => 'Galaxy J5 (2016)', ),
'SM-J510G' => array('platform_model' => 'Galaxy J5 (2016)', ),
'SM-J510M' => array('platform_model' => 'Galaxy J5 (2016)', ),
'SM-J510Y' => array('platform_model' => 'Galaxy J5 (2016)', ),
'SM-G610F' => array('platform_model' => 'Galaxy J7 (2016)', ),
'SM-J710F' => array('platform_model' => 'Galaxy J7 (2016)', ),
'SM-J710MN' => array('platform_model' => 'Galaxy J7 (2016)', ),
'SM-J710GN' => array('platform_model' => 'Galaxy J7 Duos (2016)', ),
'SM-G610M' => array('platform_model' => 'Galaxy J7 Prime (2016)', ),
'SM-J730F' => array('platform_model' => 'Galaxy J7 (2017)', ),
'GT-S5360' => array('platform_model' => 'Galaxy Y', ),
'GT-S6102' => array('platform_model' => 'Galaxy Y Duos', ),
'GT-S7582' => array('platform_model' => 'Galaxy S Duos', ),
'GT-I8750' => array('platform_model' => 'Ativ S', ),
'GT-S5830' => array('platform_model' => 'Galaxy Ace', ),
'GT-S5839' => array('platform_model' => 'Galaxy Ace Plus', ),
'GT-S5839I' => array('platform_model' => 'Galaxy Ace Plus', ),
'SM-G357FZ' => array('platform_model' => 'Galaxy Ace 4', ),
'SM-G850F' => array('platform_model' => 'Galaxy Alpha', ),
'SM-G850W' => array('platform_model' => 'Galaxy Alpha', ),
'GT-S6812' => array('platform_model' => 'Galaxy Fame Duos'),
'SM-G355HN' => array('platform_model' => 'Galaxy Core 2'),
'SM-G360F' => array('platform_model' => 'Galaxy Core Prime', ),
'SM-G361F' => array('platform_model' => 'Galaxy Core Prime', ),
'SM-G386F' => array('platform_model' => 'Galaxy Core 4G'),
'SM-G530H' => array('platform_model' => 'Galaxy Grand Prime', ),
'SM-G530T' => array('platform_model' => 'Galaxy Grand Prime', ),
'SM-G531F' => array('platform_model' => 'Galaxy Grand Prime', ),
'SM-G530FZ' => array('platform_model' => 'Galaxy Grand Prime', ),
'SM-G532F' => array('platform_model' => 'Galaxy Grand Prime Plus', ),
'GT-I9082L' => array('platform_model' => 'Galaxy Grand', ),
'GT-I9060I' => array('platform_model' => 'Galaxy Grand Plus', ),
'GT-I9082' => array('platform_model' => 'Galaxy Grand Duos', ),
'SM-G550FY' => array('platform_model' => 'Galaxy On5', ),
'GT-N5110' => array('platform_model' => 'Galaxy Note', ),
'GT-N7000' => array('platform_model' => 'Galaxy Note (3G)', ),
'GT-N7003' => array('platform_model' => 'Galaxy Note (4G)', ),
'GT-N7005' => array('platform_model' => 'Galaxy Note (4G)', ),
'GT-N8000' => array('platform_model' => 'Galaxy Note 10.1 (3G)', ),
'GT-N8010' => array('platform_model' => 'Galaxy Note 10.1', ),
'GT-N7100' => array('platform_model' => 'Galaxy Note II (3G)', ),
'GT-N7105' => array('platform_model' => 'Galaxy Note II', ),
'SHV-E250S' => array('platform_model' => 'Galaxy Note II', ),
'SM-N900W8' => array('platform_model' => 'Galaxy Note 3', ),
'GT-N9005' => array('platform_model' => 'Galaxy Note 3', ),
'SM-N900P' => array('platform_model' => 'Galaxy Note 3', ),
'SM-N900A' => array('platform_model' => 'Galaxy Note 3', ),
'SM-N900' => array('platform_model' => 'Galaxy Note 3 (3G)', ),
'SM-N9002' => array('platform_model' => 'Galaxy Note 3 (Dual-SIM)', ),
'SM-N9005' => array('platform_model' => 'Galaxy Note 3 (4G)', ),
'SM-N7505' => array('platform_model' => 'Galaxy Note 3 Neo', ),
'SM-N910A' => array('platform_model' => 'Galaxy Note 4', ),
'SM-N910F' => array('platform_model' => 'Galaxy Note 4', ),
'SM-N920V' => array('platform_model' => 'Galaxy Note 5', ),
'SM-N930T' => array('platform_model' => 'Galaxy Note 7', ),
'SM-N950' => array('platform_model' => 'Galaxy Note 8', ),
'SM-N950F' => array('platform_model' => 'Galaxy Note 8', ),
'SM-B313E' => array('platform_model' => 'Galaxy Metro 313 (2014)', ),
'SM-G350E' => array('platform_model' => 'Galaxy Star 2 Plus', ),
'SM-G130E' => array('platform_model' => 'Galaxy Star 2 Plus', ),
'SGH-I527' => array('platform_model' => 'Galaxy Mega', ),
'GT-S7392' => array('platform_model' => 'Galaxy Trend', ),
'GT-S7560' => array('platform_model' => 'Galaxy Trend', ),
'GT-S7580' => array('platform_model' => 'Galaxy Trend+ (2013)', ),
'SM-G318H' => array('platform_model' => 'Galaxy Trend 2 lite (2015)', ),
'GT-S5660' => array('platform_model' => 'Galaxy Gio', ),
'GT-S5660M' => array('platform_model' => 'Galaxy Gio', ),
'GT-S8500' => array('platform_model' => 'Galaxy Wave', ),
'GT-I8552' => array('platform_model' => 'Galaxy Win Duos', ),
'SM-G388F' => array('platform_model' => 'Galaxy Xcover 3', ),
'SM-G130H' => array('platform_model' => 'Galaxy Young 2', ),
'SM-G130HN' => array('platform_model' => 'Galaxy Young 2', ),
);
$infos = array_merge($infos, array(
'platform_company'=>'Samsung',
'platform_model'=>$matches[0],
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$matches[0]])?$rep[$matches[0]]:array());
} elseif (preg_match('/SAMSUNG\-(?:SGH\-|)([^\/]+)/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Samsung',
'platform_model'=>$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
elseif (preg_match('/(Galaxy)/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Samsung',
'platform_model'=>$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
elseif (preg_match('/(klte)/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Samsung',
'platform_model'=>'Galaxy S5',
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
/* check Samsung PC */
elseif (preg_match('/MASMJS|SMJB/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Samsung (PC)'));
/* check OnePlus - to be inserted before Sony */
elseif (preg_match('/ ONE (E[0-9]+)/', $ua, $matches)) {
$rep = array(
'E1003'=>array('platform_model' => 'X'),
);
$model = trim($matches[1]);
$infos = array_merge($infos, array(
'platform_company'=>'OnePlus',
'platform_model'=>$model,
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
elseif (preg_match('/ ONEPLUS (A[0-9]+)/', $ua, $matches)) {
$rep = array(
'A3003' => array('platform_model' => '3T'),
'A3010' => array('platform_model' => '3T'),
'A5000' => array('platform_model' => '5'),
);
$model = trim($matches[1]);
$infos = array_merge($infos, array(
'platform_company'=>'OnePlus',
'platform_model'=>$model,
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
/* check SonyEricsson */
elseif (preg_match('/SonyEricsson([^ \/]+)/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'SonyEricsson',
'platform_model'=>$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
/* check Sony mobiles and tablets */
elseif (preg_match('/ (C|D|E|F|G)([0-9]{4}) /', $ua, $matches)) {
$rep = array(
'C1505'=>array('platform_model' => 'Xperia E'),
'C2105'=>array('platform_model' => 'Xperia L'),
'C5303'=>array('platform_model' => 'Xperia SP'),
'C6603'=>array('platform_model' => 'Xperia Z'),
'D6503'=>array('platform_model' => 'Xperia Z2'),
'D2005'=>array('platform_model' => 'Xperia E1'),
'D2203'=>array('platform_model' => 'Xperia E3 (2014)'),
'D2303'=>array('platform_model' => 'Xperia M2'),
'D2305'=>array('platform_model' => 'Xperia M2'),
'D2306'=>array('platform_model' => 'Xperia M2'),
'D5303'=>array('platform_model' => 'Xperia T2 Ultra'),
'D5503'=>array('platform_model' => 'Xperia Z1 Compact'),
'D5803'=>array('platform_model' => 'Xperia Z3 Compact'),
'D6603'=>array('platform_model' => 'Xperia Z3'),
'E6653'=>array('platform_model' => 'Xperia Z5'),
'E5823'=>array('platform_model' => 'Xperia Z5 Compact'),
'F3111'=>array('platform_model' => 'Xperia XA'),
'F5121'=>array('platform_model' => 'Xperia X'),
'F8331'=>array('platform_model' => 'Xperia XZ'),
'G8141'=>array('platform_model' => 'Xperia XZ Premium'),
);
$model = trim($matches[0]);
$infos = array_merge($infos, array(
'platform_company'=>'Sony',
'platform_model'=>$model,
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
elseif (preg_match('/SOV33/', $ua, $matches)) {
$rep = array(
'SOV33'=>array('platform_model' => 'Xperia X Performance'),
);
$model = trim($matches[0]);
$infos = array_merge($infos, array(
'platform_company'=>'Sony',
'platform_model'=>$model,
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
/* check Sony PCs */
elseif (preg_match('/MASE|MASEJS|MASP|MASPJS|MASA|MASAJS/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Sony (PC)'));
/* check Huawei */
elseif (preg_match('/Build\/(HONOR|HUAWEI)([A-Z0-9\-]{7,})/i', $ua, $matches)) {
$rep = array(
'ALE-L21' => array('platform_model' => 'P8 Lite'),
'GRA-L09' => array('platform_model' => 'P8'),
'EVA-L09' => array('platform_model' => 'P9'),
'VNS-L31' => array('platform_model' => 'P9 Lite'),
'VIE-L29' => array('platform_model' => 'P9 Plus'),
'VTR-L29' => array('platform_model' => 'P10'),
'NXT-L09' => array('platform_model' => 'Mate 8'),
'NXT-L29' => array('platform_model' => 'Mate 8'),
'MHA-L09' => array('platform_model' => 'Mate 8'),
'CRR-L09' => array('platform_model' => 'Mate S'),
'KIW-L21' => array('platform_model' => 'Honor 5X'),
'BLN-L21' => array('platform_model' => 'Honor 6X'),
'PLK-L01' => array('platform_model' => 'Honor 7'),
'FRD-L09' => array('platform_model' => 'Honor 8'),
'FRD-L19' => array('platform_model' => 'Honor 8'),
'Y635-L01' => array('platform_model' => 'Y635'),
'Y520-U22' => array('platform_model' => 'Ascend'),
'Y600-U151' => array('platform_model' => 'Ascend'),
'CUN-L21' => array('platform_model' => 'Y5'),
'LYO-L01' => array('platform_model' => 'Y6 II Compact'),
'NMO-L31' => array('platform_model' => 'GT3'),
'CAN-L11' => array('platform_model' => 'Nova'),
);
$model = trim($matches[2]);
$infos = array_merge($infos, array(
'platform_company'=>'Huawei',
'platform_model'=>$model,
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
elseif (preg_match('/SCL\-L01/', $ua, $matches)) {
$rep = array(
'SCL-L01' => array('platform_model' => 'Y6'),
);
$model = trim($matches[0]);
$infos = array_merge($infos, array(
'platform_company'=>'Huawei',
'platform_model'=>$model,
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
/* check Spice Mobility */
elseif (preg_match('/Spice ([A-Z0-9\-]{5,})/i', $ua, $matches)) {
$rep = array(
'Mi-349' => array('platform_model' => 'Smart Flo Edge'),
);
$model = trim($matches[1]);
$infos = array_merge($infos, array(
'platform_company'=>'Spice Mobility',
'platform_model'=>$model,
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
/* check Archos */
elseif (preg_match('/AC([A-Z0-9\-]{3,})/', $ua, $matches)) {
$rep = array(
'45BHE'=>array('platform_model' => 'Helium 45b'),
'50BHE'=>array('platform_model' => 'Helium 50b'),
);
$model = trim($matches[1]);
$infos = array_merge($infos, array(
'platform_company'=>'Archos',
'platform_model'=>$model,
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
elseif (preg_match('/A40Ti/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Archos',
'platform_model'=>'A40Ti'));
/* check Lenovo */
elseif (preg_match('/Lenovo[ |_]([A-Z0-9\-]{3,})/i', $ua, $matches)) {
$rep = array(
'P70-A' => array('platform_model' => 'P70'),
'B8000-F' => array('platform_model' => 'Yoga', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'A2010-a' => array('platform_model' => 'A2010', ),
'K53a48' => array('platform_model' => 'K6 Note', ),
);
$model = trim($matches[1]);
$infos = array_merge($infos, array(
'platform_company'=>'Lenovo',
'platform_model'=>$model,
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
elseif (preg_match('/IdeaTab ([A-Z0-9\-]{3,})/', $ua, $matches)) {
$rep = array(
'A2107A-H' => array('platform_model' => 'IdeaTab A2107A-H', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
);
$model = trim($matches[1]);
$infos = array_merge($infos, array(
'platform_company'=>'Lenovo',
'platform_model'=>$model,
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
/* check Lenovo PCs */
elseif (preg_match('/MALC|MALCJS|MALN|MALNJS|LCJB|LEN2/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Lenovo (PC)'));
/* check Asus mobiles and tablets */
elseif (preg_match('/(K|ME)([0-9]{2})([A-Z0-9]{1,2}) /', $ua, $matches)) {
$rep = array(
'K007' => array('platform_model' => 'MeMO Pad 7', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'K01E' => array('platform_model' => 'MeMO Pad', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
'ME173X' => array('platform_model' => 'MeMO Pad HD 7', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
);
$model = trim($matches[0]);
$infos = array_merge($infos, array(
'platform_company'=>'Asus',
'platform_model'=>$model,
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
elseif (preg_match('/ASUS_([A-Z0-9]+) /', $ua, $matches)) {
$rep = array(
'Z00ED' => array('platform_model' => 'Zenfon 2'),
'Z00ED' => array('platform_model' => 'Zenfon 2'),
'Z00LD' => array('platform_model' => 'Zenfon 2 Laser'),
);
$model = trim($matches[1]);
$infos = array_merge($infos, array(
'platform_company'=>'Asus',
'platform_model'=>$model,
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
/* check Asus PCs */
elseif (preg_match('/MAAU|ASJB|ASU2JS|ASU2|NP0[6789]/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Asus (PC)'));
/* check Micromax */
elseif (preg_match('/Micromax( |_)([^ \/\)]+)/', $ua, $matches)) {
$rep = array(
'A62' => array('platform_model' => 'Bolt A62'),
'Q335' => array('platform_model' => 'Bolt Q335'),
'Q350' => array('platform_model' => 'Canvas Spark Q350'),
'Q380' => array('platform_model' => 'Canvas Spark Q380'),
);
$infos = array_merge($infos, array(
'platform_company'=>'Micromax',
'platform_model'=>$matches[2],
'platform_type'=>'handheld',
'platform_format'=>'handheld',),
isset($rep[$matches[2]])?$rep[$matches[2]]:array());
}
/* check ITel */
elseif (preg_match('/itel it([^ \/;]+( Plus)?)/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'ITel',
'platform_model'=>$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
/* check Nintendo */
elseif (preg_match('/Nintendo ([^ \/;\)]+)/', $ua, $matches)) {
$infos = array_merge($infos, array('platform_company'=>'Nintendo',
'platform_model'=>$matches[1],
'platform_type'=>preg_match('/DS/', $matches[1])?'handheld':'computer',
'platform_format'=>preg_match('/DS/', $matches[1])?'handheld':'desktop'));
}
/* check Xbox / XBox One */
elseif (preg_match('/Xbox(; Xbox [a-zA-Z0-9]*)?/i', $ua, $matches))
$infos = array_merge($infos, array('platform_company'=>'Microsoft',
'platform_model'=>isset($matches[1])?substr($matches[1], 2):'Xbox 360',
'platform_type'=>'computer',
'platform_format'=>'desktop',));
/* check Amazon Kindle */
elseif (preg_match('/Kindle([0-9\.]*)/', $ua, $matches))
$infos = array_merge($infos, array('platform_company'=>'Amazon',
'platform_model'=>'Kindle',
'platform_type'=>'tablet',
'platform_format'=>'tablet',
'browser_title'=>'Kindle browser',
'browser_version'=>$matches[1]));
/* check Macintosh */
elseif (preg_match('/(?:Intel |PPC |)Mac OS X( Mach-O| [0-9\._]*|)/i', $ua, $matches)) {
/* check version */
$version = ($matches[1]!=' Mach-O')?substr(str_replace('_','.',$matches[1]), 1):'';
if (version_compare($version, $maxVersions['system']['Mac OS X']) > 0)
return $fake;
/* build info */
$infos = array_merge($infos, array(
'platform_company'=>'Apple',
'platform_model'=>'Macintosh',
'platform_type'=>'computer',
'platform_format'=>'desktop',
'system_title'=> version_compare ($version, '10.12') >= 0 ? 'macOS' : 'Mac OS X',
'system_version'=> $version));
}
/* check Classic Macintosh */
elseif (preg_match('/Mac_PowerPC|Macintosh/i', $ua, $matches)) {
/* build info */
$infos = array_merge($infos, array(
'platform_company'=>'Apple',
'platform_model'=>'Macintosh',
'platform_type'=>'computer',
'platform_format'=>'desktop',
'system_title'=> 'Mac OS Classic',
'system_version'=> ''));
}
/* check Wiko */
elseif (preg_match('/(DARKSIDE|LENNY|RIDGE 4G|U FEEL LITE|FEVER|JERRY|TOMMY|RAINBOW|SUNSET|PULP 4G)([0-9]*)?/i', $ua, $matches)) {
$rep = array();
$infos = array_merge($infos, array(
'platform_company'=>'Wiko',
'platform_model'=>ucwords(strtolower($matches[1])).(isset($matches[2])?' '.$matches[2]:''),
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$matches[1]])?$rep[$matches[1]]:array()
);
}
/* check SpreadTrum */
elseif (preg_match('/SpreadTrum/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'SpreadTrum',
'platform_model'=>'',
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
/* check Maximus MAX908 */
elseif (preg_match('/MAX908/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Maximus',
'platform_model'=>'MAX908',
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
/* check Alcatel */
elseif (preg_match('/ ([0-9]{4}[A-Z]) Build/', $ua, $matches)) {
$rep = array(
'4015D' => array('platform_model' => 'One Touch Idol 3',),
'5050X' => array('platform_model' => 'One Touch Pop S3',),
'5070D' => array('platform_model' => 'One Touch Pop Star 4G',),
'6045Y' => array('platform_model' => 'One Touch Pop C1',),
);
$model = trim($matches[1]);
$infos = array_merge($infos, array(
'platform_company'=>'Alcatel',
'platform_model'=>$model,
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
elseif (preg_match('/Orange KLIF/', $ua, $matches)) {
$infos = array_merge($infos, array(
'platform_company'=>'Alcatel',
'platform_model' =>'Orange KLIF',
'system_title' =>'Firefox OS',
'platform_type'=>'handheld',
'platform_format'=>'handheld'));
}
/* check Lava Iris models */
elseif (preg_match('/Iris([A-Z0-9]+)/i', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Lava',
'platform_model'=>'Iris '.$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
/* check Tecno mobiles */
elseif (preg_match('/Tecno ?([^;| ]*) Build/i', $ua, $matches)) {
$rep = array(
'K7' => array('platform_model' => 'Spark (K7)'),
);
$model = trim($matches[1]);
$infos = array_merge($infos, array(
'platform_company'=>'Tecno',
'platform_model'=>isset($matches[1])?$matches[1]:'',
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
/* check Yezz Andy models */
elseif (preg_match('/Andy[_ ]([A-Z0-9]{2,})/i', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Yezz',
'platform_model'=>'Andy '.$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
/* check accent mobiles */
elseif (preg_match('/Accent ?([^;| ]*)/i', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Accent',
'platform_model'=>isset($matches[1])?ucwords(strtolower($matches[1])):'',
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
/* check Memup SlidePad 704CE */
elseif (preg_match('/SP704CE/i', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Memup',
'platform_model'=>'SP704CE',
'platform_type'=>'handheld',
'platform_format'=>'tablet',));
/* check Wing mobiles */
elseif (preg_match('/Wing_([A-Za-z0-9]{2,})/i', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Wing',
'platform_model'=>isset($matches[1])?ucwords(strtolower($matches[1])):'',
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
/* check Leagoo mobiles */
elseif (preg_match('/ Elite 2 Build/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Leagoo',
'platform_model'=>'Elite 2',
'platform_type'=>'handheld',
'platform_format'=>'handheld',));
/* check Wortmann TERRA PAD 1003 mobiles */
elseif (preg_match('/TERRA PAD 1003/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company'=>'Wortmann',
'platform_model'=>'Terra Pad 1003',