|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Classes en rapport avec les visiteurs |
|
4
|
|
|
* @author Minimix |
|
5
|
|
|
* @author Hédoux Julien <[email protected]> |
|
6
|
|
|
* @author Vermeulen Maxime <[email protected]> |
|
7
|
|
|
* @version 1.0 |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace BFW; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Permet de gérer tout ce qui concerne le visiteur |
|
14
|
|
|
* @package bfw |
|
15
|
|
|
*/ |
|
16
|
|
|
class Visiteur implements \BFWInterface\IVisiteur |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* @var $_kernel L'instance du Kernel |
|
20
|
|
|
*/ |
|
21
|
|
|
protected $_kernel; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @var $idSession Id de la session correspondante |
|
25
|
|
|
*/ |
|
26
|
|
|
protected $idSession = null; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @var $ip Son ip |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $ip = ''; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @var $host L'hostname du visiteur |
|
35
|
|
|
*/ |
|
36
|
|
|
protected $host = ''; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @var $proxy S'il passe par un proxy |
|
40
|
|
|
*/ |
|
41
|
|
|
protected $proxy = ''; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var $proxyIp L'ip du proxy |
|
45
|
|
|
*/ |
|
46
|
|
|
protected $proxyIp = ''; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var $proxyHost L'hostname du proxy |
|
50
|
|
|
*/ |
|
51
|
|
|
protected $proxyHost = ''; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @var $os Son système d'exploitation |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $os = ''; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @var $nav Son navigateur |
|
60
|
|
|
*/ |
|
61
|
|
|
protected $nav = ''; |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @var $langue La langue de l'utilisateur |
|
65
|
|
|
*/ |
|
66
|
|
|
protected $langue = ''; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @var $langueInitiale Les initiale de la langue |
|
70
|
|
|
*/ |
|
71
|
|
|
protected $langueInitiale = ''; |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @var $proviens L'url d'où il vient |
|
75
|
|
|
*/ |
|
76
|
|
|
protected $proviens = ''; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @var $url Son url actuelle |
|
80
|
|
|
*/ |
|
81
|
|
|
protected $url = ''; |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @var $bot S'il s'agit d'un robot |
|
85
|
|
|
*/ |
|
86
|
|
|
protected $bot = ''; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Accesseur vers l'attribut $idSession |
|
90
|
|
|
*/ |
|
91
|
|
|
public function getIdSession() |
|
92
|
|
|
{ |
|
93
|
1 |
|
return $this->idSession; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* Accesseur vers l'attribut $ip |
|
98
|
|
|
*/ |
|
99
|
|
|
public function getIp() |
|
100
|
|
|
{ |
|
101
|
1 |
|
return $this->ip; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* Accesseur vers l'attribut $host |
|
106
|
|
|
*/ |
|
107
|
|
|
public function getHost() |
|
108
|
|
|
{ |
|
109
|
1 |
|
return $this->host; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* Accesseur vers l'attribut $proxy |
|
114
|
|
|
*/ |
|
115
|
|
|
public function getProxy() |
|
116
|
|
|
{ |
|
117
|
1 |
|
return $this->proxy; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* Accesseur vers l'attribut $proxyIp |
|
122
|
|
|
*/ |
|
123
|
|
|
public function getProxyIp() |
|
124
|
|
|
{ |
|
125
|
1 |
|
return $this->proxyIp; |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* Accesseur vers l'attribut $proxyHost |
|
130
|
|
|
*/ |
|
131
|
|
|
public function getProxyHost() |
|
132
|
|
|
{ |
|
133
|
1 |
|
return $this->proxyHost; |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* Accesseur vers l'attribut $os |
|
138
|
|
|
*/ |
|
139
|
|
|
public function getOs() |
|
140
|
|
|
{ |
|
141
|
1 |
|
return $this->os; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* Accesseur vers l'attribut $nav |
|
146
|
|
|
*/ |
|
147
|
|
|
public function getNav() |
|
148
|
|
|
{ |
|
149
|
1 |
|
return $this->nav; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* Accesseur vers l'attribut $langue |
|
154
|
|
|
*/ |
|
155
|
|
|
public function getLangue() |
|
156
|
|
|
{ |
|
157
|
1 |
|
return $this->langue; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* Accesseur vers l'attribut $langueInitiale |
|
162
|
|
|
*/ |
|
163
|
|
|
public function getLangueInitiale() |
|
164
|
|
|
{ |
|
165
|
1 |
|
return $this->langueInitiale; |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* Accesseur vers l'attribut $proviens |
|
170
|
|
|
*/ |
|
171
|
|
|
public function getProviens() |
|
172
|
|
|
{ |
|
173
|
1 |
|
return $this->proviens; |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
/** |
|
177
|
|
|
* Accesseur vers l'attribut $url |
|
178
|
|
|
*/ |
|
179
|
|
|
public function getUrl() |
|
180
|
|
|
{ |
|
181
|
1 |
|
return $this->url; |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* Accesseur vers l'attribut $bot |
|
186
|
|
|
*/ |
|
187
|
|
|
public function getBot() |
|
188
|
|
|
{ |
|
189
|
1 |
|
return $this->bot; |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
/** |
|
193
|
|
|
* Constructeur |
|
194
|
|
|
* Récupère les infos et instancie la session |
|
195
|
|
|
*/ |
|
196
|
|
|
public function __construct() |
|
197
|
|
|
{ |
|
198
|
1 |
|
$this->_kernel = getKernel(); |
|
199
|
|
|
|
|
200
|
1 |
|
$this->recup_infos(); |
|
201
|
1 |
|
if(isset($_SESSION['idSess'])) |
|
202
|
1 |
|
{ |
|
203
|
1 |
|
$this->idSession = $_SESSION['idSess']; |
|
204
|
1 |
|
} |
|
205
|
1 |
|
} |
|
206
|
|
|
|
|
207
|
|
|
/** |
|
208
|
|
|
* Récupère les différentes infos sur le visiteur |
|
209
|
|
|
*/ |
|
210
|
|
|
protected function recup_infos() |
|
211
|
|
|
{ |
|
212
|
1 |
|
$this->proxyDetect(); |
|
213
|
1 |
|
$this->proxyIpDetect(); |
|
214
|
1 |
|
$this->proxyHostDetect(); |
|
215
|
1 |
|
$this->realIpDetect(); |
|
216
|
1 |
|
$this->realHostDetect(); |
|
217
|
|
|
//$this->port_detect(); |
|
218
|
1 |
|
$this->systemDetect(); |
|
219
|
1 |
|
$this->browserDetect(); |
|
220
|
|
|
|
|
221
|
1 |
|
$this->langueInitiale = $this->languageDetect(); |
|
222
|
1 |
|
$this->langue = $this->languageConvert($this->langueInitiale); |
|
223
|
|
|
|
|
224
|
1 |
|
$this->refererDetect(); |
|
225
|
1 |
|
$this->uriDetect(); |
|
226
|
1 |
|
} |
|
227
|
|
|
|
|
228
|
|
|
/******************************************************************** |
|
229
|
|
|
* Code créé par Minimix * |
|
230
|
|
|
* Donné par Hédoux Julien (sg71master) pour Gatewars.eu * |
|
231
|
|
|
* Adapté en POO et mit à jour pour la langue par Vermeulen Maxime * |
|
232
|
|
|
********************************************************************/ |
|
233
|
|
|
|
|
234
|
|
|
/** |
|
235
|
|
|
* Trouve l'ip réelle si un proxy est detecté |
|
236
|
|
|
* |
|
237
|
|
|
* @return string|null L'ip réel de l'user |
|
238
|
|
|
*/ |
|
239
|
|
|
protected function proxyDetect() |
|
240
|
|
|
{ |
|
241
|
|
|
$array = array( |
|
242
|
1 |
|
'HTTP_X_FORWARDED_FOR', |
|
243
|
1 |
|
'HTTP_X_FORWARDED', |
|
244
|
1 |
|
'HTTP_FORWARDED_FOR', |
|
245
|
1 |
|
'HTTP_FORWARDED', |
|
246
|
1 |
|
'HTTP_VIA', |
|
247
|
1 |
|
'HTTP_X_COMING_FROM', |
|
248
|
1 |
|
'HTTP_COMING_FROM', |
|
249
|
|
|
'HTTP_CLIENT_IP' |
|
250
|
1 |
|
); |
|
251
|
|
|
|
|
252
|
1 |
|
foreach($array as $key) |
|
253
|
|
|
{ |
|
254
|
1 |
|
if(isset($_SERVER[$key]) && !empty($_SERVER[$key])) |
|
255
|
1 |
|
{ |
|
256
|
|
|
$this->proxy = $_SERVER[$key]; |
|
257
|
|
|
return $this->proxy; |
|
258
|
|
|
} |
|
259
|
1 |
|
} |
|
260
|
|
|
|
|
261
|
1 |
|
$this->proxy = null; |
|
262
|
1 |
|
return $this->proxy; |
|
263
|
|
|
} |
|
264
|
|
|
|
|
265
|
|
|
/** |
|
266
|
|
|
* Rempli l'attribut $this->proxyIp avec l'ip du proxy, false sinon |
|
267
|
|
|
*/ |
|
268
|
|
|
protected function proxyIpDetect() |
|
269
|
|
|
{ |
|
270
|
1 |
|
$this->proxyIp = ''; |
|
271
|
|
|
|
|
272
|
1 |
|
if($this->proxy != NULL) |
|
273
|
1 |
|
{ |
|
274
|
|
|
$this->proxyIp = $_SERVER['REMOTE_ADDR']; |
|
275
|
|
|
} |
|
276
|
1 |
|
} |
|
277
|
|
|
|
|
278
|
|
|
/** |
|
279
|
|
|
* Rempli l'attribut $this->proxyHost avec l'host du proxy, false sinon |
|
280
|
|
|
*/ |
|
281
|
|
|
protected function proxyHostDetect() |
|
282
|
|
|
{ |
|
283
|
|
|
//Commenté car gethostbyaddr a des tendences aux lags. |
|
284
|
|
|
/* |
|
285
|
|
|
if($this->proxy != NULL) {$this->proxyHost = @gethostbyaddr($_SERVER['REMOTE_ADDR']);} |
|
286
|
|
|
else {$this->proxyHost = FALSE;} |
|
287
|
|
|
*/ |
|
288
|
1 |
|
$this->proxyHost = ''; |
|
289
|
1 |
|
} |
|
290
|
|
|
|
|
291
|
|
|
/** |
|
292
|
|
|
* Rempli l'attribut $this->ip avec l'ip du client (ip réel si derrière un proxy) |
|
293
|
|
|
*/ |
|
294
|
|
|
protected function realIpDetect() |
|
295
|
|
|
{ |
|
296
|
1 |
|
$this->ip = 'Unknown'; |
|
297
|
|
|
|
|
298
|
1 |
|
if($this->proxy != NULL) |
|
299
|
1 |
|
{ |
|
300
|
|
|
$this->ip = $this->proxy; |
|
301
|
|
|
} |
|
302
|
1 |
|
elseif(isset($_SERVER['REMOTE_ADDR'])) |
|
303
|
|
|
{ |
|
304
|
1 |
|
$this->ip = $_SERVER['REMOTE_ADDR']; |
|
305
|
1 |
|
} |
|
306
|
1 |
|
} |
|
307
|
|
|
|
|
308
|
|
|
/** |
|
309
|
|
|
* Rempli l'attribut $this->host avec l'host du client (l'host réel si derrière un proxy) |
|
310
|
|
|
*/ |
|
311
|
|
|
protected function realHostDetect() |
|
312
|
|
|
{ |
|
313
|
|
|
//Commenté car gethostbyaddr a des tendences aux lags. |
|
314
|
|
|
/* |
|
315
|
|
|
if($this->proxy != NULL) {$this->host = @gethostbyaddr($this->proxy);} |
|
316
|
|
|
else {$this->host = @gethostbyaddr($_SERVER['REMOTE_ADDR']);} |
|
317
|
|
|
*/ |
|
318
|
1 |
|
$this->host = ''; |
|
319
|
1 |
|
} |
|
320
|
|
|
|
|
321
|
|
|
/** |
|
322
|
|
|
* Détecte l'os de l'user et le met dans l'attribut $this->OS |
|
323
|
|
|
*/ |
|
324
|
|
|
protected function systemDetect() |
|
325
|
|
|
{ |
|
326
|
|
|
$array = array |
|
327
|
|
|
( |
|
328
|
1 |
|
'(win|windows) ?(9x ?4\.90|Me)' => 'Windows ME', |
|
329
|
1 |
|
'(win|windows) ?(95)' => 'Windows 95', |
|
330
|
1 |
|
'(win|windows) ?(98)' => 'Windows 98', |
|
331
|
1 |
|
'(win|windows) ?(2000)' => 'Windows 2000', |
|
332
|
1 |
|
'(Windows NT 5.0)' => 'Windows NT', |
|
333
|
1 |
|
'(Windows NT 5.1)' => 'Windows XP', |
|
334
|
1 |
|
'(win|windows) ?XP' => 'Windows XP', |
|
335
|
1 |
|
'(win|windows) ?XP ?(LSD)' => 'Windows LSD', |
|
336
|
1 |
|
'(Windows NT 6.0)' => 'Windows Vista', |
|
337
|
1 |
|
'(Windows NT 6.1)' => 'Windows 7', |
|
338
|
1 |
|
'(Windows NT 6.2)' => 'Windows 8', |
|
339
|
1 |
|
'(win|windows)' => 'Windows', |
|
340
|
1 |
|
'(Android 1.5)' => 'Android 1.5', |
|
341
|
1 |
|
'(Android 2.0)' => 'Android 2.0', |
|
342
|
1 |
|
'(Android 3.0)' => 'Android 3.0', |
|
343
|
1 |
|
'(Android 4.0)' => 'Android 4.0', |
|
344
|
1 |
|
'(Android)' => 'Android', |
|
345
|
1 |
|
'(linux)' => 'Linux', |
|
346
|
1 |
|
'(J2ME/MIDP)' => 'Mobile', |
|
347
|
1 |
|
'SunOs' => 'SunOs', |
|
348
|
1 |
|
'Wii' => 'Wii', |
|
349
|
1 |
|
'(freebsd)' => 'FreeBSD', |
|
350
|
1 |
|
'(openbsd)' => 'OpenBS', |
|
351
|
1 |
|
'(netbsd)' => 'NetBSD', |
|
352
|
1 |
|
'(AIX)' => 'AIX', |
|
353
|
1 |
|
'(QNX)' => 'QNX', |
|
354
|
1 |
|
'(HP-UX)' => 'HP-UX', |
|
355
|
1 |
|
'(IRIX)' => 'IRIX', |
|
356
|
1 |
|
'(unix|x11)' => 'UNIX', |
|
357
|
1 |
|
'(Macintosh|PPC)' => 'Macintosh', |
|
358
|
1 |
|
'(mac|ppc)' => 'Macintosh', |
|
359
|
1 |
|
'beos' => 'BeOS', |
|
360
|
|
|
'os/2' => 'OS/2' |
|
361
|
1 |
|
); |
|
362
|
|
|
|
|
363
|
1 |
|
foreach($array as $reg => $system) |
|
364
|
|
|
{ |
|
365
|
|
|
//Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20 |
|
366
|
1 |
|
if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match('#'.$reg.'#i', $_SERVER['HTTP_USER_AGENT'])) |
|
367
|
1 |
|
{ |
|
368
|
1 |
|
$this->os = $system; |
|
369
|
1 |
|
return; |
|
370
|
|
|
} |
|
371
|
1 |
|
} |
|
372
|
|
|
|
|
373
|
1 |
|
$this->os = 'Inconnu'; |
|
374
|
1 |
|
} |
|
375
|
|
|
|
|
376
|
|
|
/** |
|
377
|
|
|
* Détecte le navigateur de l'user et le met dans l'attribut $this->nav |
|
378
|
|
|
*/ |
|
379
|
|
|
protected function browserDetect() |
|
380
|
|
|
{ |
|
381
|
|
|
$array=array |
|
382
|
|
|
( |
|
383
|
1 |
|
'(MSIE)' => 'Internet Explorer', |
|
384
|
1 |
|
'(Chrome)' => 'Chrome', |
|
385
|
1 |
|
'(Opera)' => 'Opera', |
|
386
|
1 |
|
'(Netscape)' => 'Netscape', |
|
387
|
1 |
|
'(AOL)' => 'AOL', |
|
388
|
1 |
|
'(Konqueror)' => 'Konqueror', |
|
389
|
1 |
|
'(Lynx)' => 'Lynx', |
|
390
|
1 |
|
'(Amaya)' => 'Amaya', |
|
391
|
1 |
|
'(AvantGo)' => 'AvantGo', |
|
392
|
1 |
|
'(Bluefish)' => 'Bluefish', |
|
393
|
1 |
|
'(ICEBrowser)' => 'ICEBrowser', |
|
394
|
1 |
|
'(Safari)' => 'Safari', |
|
395
|
1 |
|
'(Kanari)' => 'Kanari', |
|
396
|
1 |
|
'(ICEBrowser)' => 'ICEBrowser', |
|
397
|
1 |
|
'(bot|google|slurp|scooter|spider|infoseek|arachnoidea|altavista)' => 'Search engine', |
|
398
|
1 |
|
'tv' => 'Web TV', |
|
399
|
1 |
|
'(Firefox)' => 'Mozilla Firefox', |
|
400
|
|
|
'(Mozilla)' => 'Mozilla' |
|
401
|
1 |
|
); |
|
402
|
|
|
|
|
403
|
1 |
|
if(isset($_SERVER['HTTP_USER_AGENT'])) |
|
404
|
1 |
|
{ |
|
405
|
1 |
|
foreach($array as $reg => $browser) |
|
406
|
|
|
{ |
|
407
|
1 |
|
$match = array(); |
|
408
|
1 |
|
if(preg_match('#'.$reg.'#i', $_SERVER['HTTP_USER_AGENT'], $match)) |
|
409
|
1 |
|
{ |
|
410
|
1 |
|
$this->nav = $browser; |
|
411
|
1 |
|
if($browser == 'Search engine') |
|
412
|
1 |
|
{ |
|
413
|
1 |
|
$this->bot = $match[1]; |
|
414
|
1 |
|
} |
|
415
|
|
|
|
|
416
|
1 |
|
return; |
|
417
|
|
|
} |
|
418
|
1 |
|
} |
|
419
|
1 |
|
} |
|
420
|
|
|
|
|
421
|
1 |
|
$this->nav = 'Inconnu'; |
|
422
|
1 |
|
} |
|
423
|
|
|
|
|
424
|
|
|
/** |
|
425
|
|
|
* Détecte la langue préféré de l'user via l'UserAgent |
|
426
|
|
|
* |
|
427
|
|
|
* @return string La langue préféré de l'user au format xx-yy (exemple : fr-fr ou en-us) |
|
428
|
|
|
*/ |
|
429
|
|
|
protected function languageDetect() |
|
430
|
|
|
{ |
|
431
|
|
|
/* |
|
432
|
|
|
$_SERVER['HTTP_ACCEPT_LANGUAGE'] -> fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4 |
|
433
|
|
|
D'abord fr-FR (préférence 1/1) |
|
434
|
|
|
Puis dans l'ordre, fr (préférence 0.8 / 1) |
|
435
|
|
|
Puis en-US (préférence 0.6/1) |
|
436
|
|
|
Puis en (préférence 0.4/1) |
|
437
|
|
|
*/ |
|
438
|
|
|
|
|
439
|
1 |
|
$lang = 'Unknown'; |
|
440
|
1 |
|
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) |
|
441
|
1 |
|
{ |
|
442
|
1 |
|
$language = $_SERVER['HTTP_ACCEPT_LANGUAGE']; |
|
443
|
1 |
|
$ex = explode(',', $language); |
|
444
|
|
|
|
|
445
|
1 |
|
$ex2 = explode(';', $ex[0]); |
|
446
|
1 |
|
$lang = strtolower($ex2[0]); |
|
447
|
|
|
|
|
448
|
1 |
|
if(strpos($lang, '-') !== false) |
|
449
|
1 |
|
{ |
|
450
|
1 |
|
$ex3 = explode('-', $lang); |
|
451
|
1 |
|
$lang = $ex3[0]; |
|
452
|
1 |
|
} |
|
453
|
1 |
|
} |
|
454
|
|
|
|
|
455
|
1 |
|
return $lang; |
|
456
|
|
|
} |
|
457
|
|
|
|
|
458
|
|
|
/** |
|
459
|
|
|
* Retourne la langue choisie pour l'user au format humain |
|
460
|
|
|
* |
|
461
|
|
|
* @param string $lang Les initiale de la langue choisie |
|
462
|
|
|
* |
|
463
|
|
|
* @return string La langue choisie. "Inconnue" si elle n'a pas été trouvée. |
|
464
|
|
|
*/ |
|
465
|
|
|
protected function languageConvert($lang='') |
|
466
|
|
|
{ |
|
467
|
|
|
$array = array( |
|
468
|
1 |
|
'AF' => 'Afrikaans', |
|
469
|
1 |
|
'SQ' => 'Albanais', |
|
470
|
1 |
|
'DE' => 'Allemand', |
|
471
|
1 |
|
'EN' => 'Anglais', |
|
472
|
1 |
|
'AR' => 'Arabe', |
|
473
|
1 |
|
'AN' => 'Aragonais', |
|
474
|
1 |
|
'HY' => 'Arménien', |
|
475
|
1 |
|
'AS' => 'Assamais', |
|
476
|
1 |
|
'AST' => 'Asturien', |
|
477
|
1 |
|
'AZ' => 'Azéri', |
|
478
|
1 |
|
'EU' => 'Basque', |
|
479
|
1 |
|
'BN' => 'Bengali', |
|
480
|
1 |
|
'BE' => 'Biélorusse', |
|
481
|
1 |
|
'BS' => 'Bosniaque', |
|
482
|
1 |
|
'PTBR' => 'Brézil', |
|
483
|
1 |
|
'BR' => 'Brézil', |
|
484
|
1 |
|
'BG' => 'Bulgare', |
|
485
|
1 |
|
'KM' => 'Cambodgien', |
|
486
|
1 |
|
'CA' => 'Catalan', |
|
487
|
1 |
|
'CH' => 'Chamaroo', |
|
488
|
1 |
|
'ZH' => 'Chinois', |
|
489
|
1 |
|
'KO' => 'Coréen', |
|
490
|
1 |
|
'CO' => 'Corse', |
|
491
|
1 |
|
'HR' => 'Croate', |
|
492
|
1 |
|
'DA' => 'Danois', |
|
493
|
1 |
|
'ES' => 'Espagnol', |
|
494
|
1 |
|
'EO' => 'Espéranto', |
|
495
|
1 |
|
'ET' => 'Estonien', |
|
496
|
1 |
|
'FJ' => 'Fidjien', |
|
497
|
1 |
|
'FR' => 'Français', |
|
498
|
1 |
|
'HT' => 'Haïtien', |
|
499
|
1 |
|
'HE' => 'Hébreu', |
|
500
|
1 |
|
'HU' => 'Hongrois', |
|
501
|
1 |
|
'HI' => 'Hindi', |
|
502
|
1 |
|
'ID' => 'Indonésien', |
|
503
|
1 |
|
'GA' => 'Irlandais', |
|
504
|
1 |
|
'IS' => 'Islandais', |
|
505
|
1 |
|
'IT' => 'Italien', |
|
506
|
1 |
|
'JA' => 'Japonais', |
|
507
|
1 |
|
'LA' => 'Latin', |
|
508
|
1 |
|
'LT' => 'Lituanien', |
|
509
|
1 |
|
'MK' => 'Macédoine', |
|
510
|
1 |
|
'MS' => 'Malais', |
|
511
|
1 |
|
'MO' => 'Moldave', |
|
512
|
1 |
|
'NL' => 'Néerlandais', |
|
513
|
1 |
|
'NE' => 'Népalais', |
|
514
|
1 |
|
'NO' => 'Norvégiens', |
|
515
|
1 |
|
'PA' => 'Penjabi', |
|
516
|
1 |
|
'FA' => 'Persan', |
|
517
|
1 |
|
'PL' => 'Polonais', |
|
518
|
1 |
|
'PT' => 'Portuguais', |
|
519
|
1 |
|
'RO' => 'Roumain', |
|
520
|
1 |
|
'RU' => 'Russe', |
|
521
|
1 |
|
'SRCYR'=> 'Serbe', |
|
522
|
1 |
|
'SR' => 'Serbe', |
|
523
|
1 |
|
'SK' => 'Slovaque', |
|
524
|
1 |
|
'SL' => 'Slovène', |
|
525
|
1 |
|
'SV' => 'Suédois', |
|
526
|
1 |
|
'CS' => 'Tchèque', |
|
527
|
1 |
|
'CE' => 'Tchétchène', |
|
528
|
1 |
|
'TH' => 'Thaï', |
|
529
|
1 |
|
'TR' => 'Turque', |
|
530
|
1 |
|
'UK' => 'Ukrainien', |
|
531
|
1 |
|
'VI' => 'Vietnamien', |
|
532
|
1 |
|
'YI' => 'Yiddish', |
|
533
|
1 |
|
); |
|
534
|
|
|
|
|
535
|
1 |
|
$lang = strtoupper($lang); |
|
536
|
1 |
|
if(array_key_exists($lang, $array)) |
|
537
|
1 |
|
{ |
|
538
|
1 |
|
return $array[$lang]; |
|
539
|
|
|
} |
|
540
|
|
|
|
|
541
|
1 |
|
return 'Inconnue'; |
|
542
|
|
|
} |
|
543
|
|
|
|
|
544
|
|
|
/** |
|
545
|
|
|
* Indique dans l'attribut $this->proviens l'url d'où viens l'user. "Inconnu" si elle n'a pas été trouvée. |
|
546
|
|
|
*/ |
|
547
|
|
|
protected function refererDetect() |
|
548
|
|
|
{ |
|
549
|
1 |
|
$this->proviens = 'Inconnu'; |
|
550
|
1 |
|
if(!empty($_SERVER['HTTP_REFERER'])) |
|
551
|
1 |
|
{ |
|
552
|
1 |
|
$this->proviens = $_SERVER['HTTP_REFERER']; |
|
553
|
1 |
|
} |
|
554
|
1 |
|
} |
|
555
|
|
|
|
|
556
|
|
|
/** |
|
557
|
|
|
* Indique dans l'attribut $this->url l'url sur laquel se trouve l'user. "Inconnu" si on trouve pas. |
|
558
|
|
|
*/ |
|
559
|
|
|
protected function uriDetect() |
|
560
|
|
|
{ |
|
561
|
1 |
|
$this->url = 'Inconnu'; |
|
562
|
1 |
|
if(!empty($_SERVER['REQUEST_URI'])) |
|
563
|
1 |
|
{ |
|
564
|
1 |
|
$this->url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
|
565
|
1 |
|
} |
|
566
|
1 |
|
} |
|
567
|
|
|
} |
|
568
|
|
|
|