Rev 1034 Rev 1036
Line 334... Line 334...
334   334  
335   335  
336 //============================================= 336 //=============================================
337 // Skript pro sbírání statistiky návštěvnosti stránek 337 // Skript pro sbírání statistiky návštěvnosti stránek
338 // 338 //
339 // http://www.phpmyvisites.net/ 339 // http://www.phpmyvisites.net/
340 // License GNU/GPL (http://www.gnu.org/copyleft/gpl.html) 340 // License GNU/GPL (http://www.gnu.org/copyleft/gpl.html)
341 function pmv_log(pmv_site, pmv_url, pmv_pname, pmv_vars) -  
342 { -  
343 function plugMoz(pmv_pl) { 341 function pmv_plugMoz(pmv_pl) {
344 if (pmv_tm.indexOf(pmv_pl) != -1 && (navigator.mimeTypes[pmv_pl].enabledPlugin != null)) 342 if (pmv_tm.indexOf(pmv_pl) != -1 && (navigator.mimeTypes[pmv_pl].enabledPlugin != null))
345 return '1'; 343 return '1';
346 return '0'; 344 return '0';
347 } 345 }
348 function plugIE(pmv_plug){ 346 function pmv_plugIE(pmv_plug){
349 pmv_find = false; 347 pmv_find = false;
350 document.write('<SCR' + 'IPT LANGUAGE=VBScript>\n on error resume next \n pmv_find = IsObject(CreateObject("' + pmv_plug + '"))</SCR' + 'IPT>\n'); 348 document.write('<SCR' + 'IPT LANGUAGE=VBScript>\n on error resume next \n pmv_find = IsObject(CreateObject("' + pmv_plug + '")) </SCR' + 'IPT>\n');
351 if (pmv_find) return '1'; 349 if (pmv_find) return '1';
352 return '0'; 350 return '0';
353 } 351 }
354 var pmv_jav='0'; if(navigator.javaEnabled()) pmv_jav='1'; 352 var pmv_jav='0'; if(navigator.javaEnabled()) pmv_jav='1';
355 var pmv_agent = navigator.userAgent.toLowerCase(); 353 var pmv_agent = navigator.userAgent.toLowerCase();
356 var pmv_moz = (navigator.appName.indexOf("Netscape") != -1); 354 var pmv_moz = (navigator.appName.indexOf("Netscape") != -1);
357 var pmv_ie= (pmv_agent.indexOf("msie") != -1); 355 var pmv_ie= (pmv_agent.indexOf("msie") != -1);
358 var pmv_win = ((pmv_agent.indexOf("win") != -1) || (pmv_agent.indexOf("32bit") != -1)); 356 var pmv_win = ((pmv_agent.indexOf("win") != -1) || (pmv_agent.indexOf("32bit") != -1));
-   357 // Determine if cookie enabled
-   358 var pmv_cookie=(navigator.cookieEnabled)? '1' : '0';
-   359  
-   360 //if not IE4+ nor NS6+
-   361 if ((typeof (navigator.cookieEnabled) =="undefined") && (pmv_cookie == '0')) {
-   362 document.cookie="pmv_testcookie"
-   363 pmv_cookie=(document.cookie.indexOf("pmv_testcookie")!=-1)? '1' : '0';
-   364 }
-   365  
-   366 var pmv_dir = '0';
-   367 var pmv_fla = '0';
-   368 var pmv_pdf = '0';
-   369 var pmv_qt = '0';
-   370 var pmv_rea = '0';
-   371 var pmv_wma = '0';
359   372  
360 if (!pmv_win || pmv_moz){ 373 if (!pmv_win || pmv_moz){
361 pmv_tm = ''; 374 var pmv_tm = '';
362 for (var i=0; i < navigator.mimeTypes.length; i++) 375 for (var i=0; i < navigator.mimeTypes.length; i++)
363 pmv_tm += navigator.mimeTypes[i].type.toLowerCase(); 376 pmv_tm += navigator.mimeTypes[i].type.toLowerCase();
364 var pmv_dir = plugMoz("application/x-director"); 377 pmv_dir = pmv_plugMoz("application/x-director");
365 var pmv_fla = plugMoz("application/x-shockwave-flash"); 378 pmv_fla = pmv_plugMoz("application/x-shockwave-flash");
366 var pmv_pdf = plugMoz("application/pdf"); 379 pmv_pdf = pmv_plugMoz("application/pdf");
367 var pmv_qt = plugMoz("video/quicktime"); 380 pmv_qt = pmv_plugMoz("video/quicktime");
368 var pmv_rea = plugMoz("audio/x-pn-realaudio-plugin"); 381 pmv_rea = pmv_plugMoz("audio/x-pn-realaudio-plugin");
369 var pmv_wma = plugMoz("application/x-mplayer2"); 382 pmv_wma = pmv_plugMoz("application/x-mplayer2");
370 } else if (pmv_win && pmv_ie){ 383 } else if (pmv_win && pmv_ie){
371 var pmv_dir = plugIE("SWCtl.SWCtl.1"); 384 pmv_dir = pmv_plugIE("SWCtl.SWCtl.1");
372 var pmv_fla = plugIE("ShockwaveFlash.ShockwaveFlash.1"); 385 pmv_fla = pmv_plugIE("ShockwaveFlash.ShockwaveFlash.1");
373 var pmv_pdf = '0'; -  
374 if (plugIE("PDF.PdfCtrl.1") == '1' || plugIE('PDF.PdfCtrl.5') == '1' || plugIE('PDF.PdfCtrl.6') == '1') 386 if (pmv_plugIE("PDF.PdfCtrl.1") == '1' || pmv_plugIE('PDF.PdfCtrl.5') == '1' || pmv_plugIE('PDF.PdfCtrl.6') == '1')
375 pmv_pdf = '1'; 387 pmv_pdf = '1';
376 var pmv_qt = plugIE("QuickTimeCheckObject.QuickTimeCheck.1"); 388 pmv_qt = pmv_plugIE("Quicktime.Quicktime"); // Old : "QuickTimeCheckObject.QuickTimeCheck.1"
377 var pmv_rea = plugIE("rmocx.RealPlayer G2 Control.1"); 389 pmv_rea = pmv_plugIE("rmocx.RealPlayer G2 Control.1");
378 var pmv_wma = plugIE("MediaPlayer.MediaPlayer.1"); 390 pmv_wma = pmv_plugIE("wmplayer.ocx"); // Old : "MediaPlayer.MediaPlayer.1"
-   391  
379 } 392 }
380   393
-   394 var pmv_do = document;
381 var getvars=''; 395 var pmv_rtu = '';
-   396 try {pmv_rtu = top.pmv_do.referrer;} catch(e) {
382 for (var i in pmv_vars){ 397 if (parent) {
383 if (!Array.prototype[i]){ 398 if (parent.pmv_getReferer) {
384 getvars = getvars + '&a_vars['+ escape(i) + ']' + "=" + escape(pmv_vars[i]); 399 try {pmv_rtu = parent.pmv_getReferer;} catch(E3) {pmv_rtu = '';}
385 } 400 }
-   401 else {
-   402 try {pmv_rtu = parent.document.referrer;} catch(E) {
-   403 try {pmv_rtu = document.referrer;} catch(E2) {pmv_rtu = '';}
-   404 }
386 } 405 }
387 pmv_do = document; pmv_da = new Date(); 406 parent.pmv_getReferer = document.location.href;
-   407 }
-   408 else {
388 try {rtu = top.pmv_do.referrer;} catch(e) { 409 try {pmv_rtu = document.referrer;} catch(E3) {pmv_rtu = '';}
-   410 }
-   411 }
-   412 // Get the url to call phpmyvisites
-   413 function pmv_getUrlStat(pmv_urlPmv, pmv_site, pmv_urlDoc, pmv_pname, pmv_typeClick, pmv_vars)
-   414 {
-   415 var pmv_getvars='';
-   416 if (pmv_vars) {
-   417 for (var i in pmv_vars){
-   418 if (!Array.prototype[i]){
389 try {rtu = pmv_do.referrer;} catch(E) {rtu = '';} 419 pmv_getvars = pmv_getvars + '&a_vars['+ escape(i) + ']' + "=" + escape(pmv_vars[i]);
-   420 }
-   421 }
390 } 422 }
391   423
-   424 var pmv_da = new Date();
392 src = pmv_url; 425 var pmv_src = pmv_urlPmv;
393 src += '?url='+escape(pmv_do.location)+'&pagename='+escape(pmv_pname)+getvars; 426 pmv_src += '?url='+escape(pmv_urlDoc)+'&pagename='+escape(pmv_pname)+pmv_getvars;
394 src += '&id='+pmv_site+'&res='+screen.width+'x'+screen.height+'&col='+screen.colorDepth; 427 pmv_src += '&id='+pmv_site+'&res='+screen.width+'x'+screen.height+'&col='+screen.colorDepth;
395 src += '&h='+pmv_da.getHours()+'&m='+pmv_da.getMinutes()+'&s='+pmv_da.getSeconds(); 428 pmv_src += '&h='+pmv_da.getHours()+'&m='+pmv_da.getMinutes()+'&s='+pmv_da.getSeconds();
396 src += '&flash='+pmv_fla+'&director='+pmv_dir+'&quicktime='+pmv_qt+'&realplayer='+pmv_rea; 429 pmv_src += '&flash='+pmv_fla+'&director='+pmv_dir+'&quicktime='+pmv_qt+'&realplayer='+pmv_rea;
397 src += '&pdf='+pmv_pdf+'&windowsmedia='+pmv_wma+'&java='+pmv_jav+'&ref='+escape(rtu); 430 pmv_src += '&pdf='+pmv_pdf+'&windowsmedia='+pmv_wma+'&java='+pmv_jav+'&cookie='+pmv_cookie;
-   431 if ((pmv_typeClick) && (pmv_typeClick != "")) pmv_src += '&type='+escape(pmv_typeClick);
-   432 pmv_src += '&ref='+escape(pmv_rtu);
-   433
-   434 return pmv_src;
-   435 }
-   436 // log action : pmv_typeClick = empty like a page, FILE ans in the futur RSS, PODCAST
-   437 function pmv_click (pmv_urlPmv, pmv_site, pmv_urlDoc, pmv_pname, pmv_typeClick, pmv_vars)
-   438 {
-   439 var pmv_src = pmv_getUrlStat(pmv_urlPmv, pmv_site, pmv_urlDoc, pmv_pname, pmv_typeClick, pmv_vars);
-   440 var pmv_img = new Image();
-   441 pmv_img.src = pmv_src;
-   442 }
-   443 // Log current page
-   444 function pmv_log(pmv_urlPmv, pmv_site, pmv_pname, pmv_vars)
-   445 {
-   446 var pmv_urlCur = pmv_do.location.href;
-   447 var pmv_pos = pmv_urlCur.indexOf("//");
-   448 if (pmv_pos > 0) {
-   449 pmv_urlCur = pmv_urlCur.substr(pmv_pos);
-   450 }
-   451 var pmv_src = pmv_getUrlStat(pmv_urlPmv, pmv_site, pmv_urlCur, pmv_pname, "", pmv_vars);
398   452  
399 // Do již načteného dokumentu se nesmí zapisovat (vznikla by nová stránka) 453 // Do již načteného dokumentu se nesmí zapisovat (vznikla by nová stránka)
400 //pmv_do.writeln('<img src="'+src+'" alt="phpMyVisites" style="border:0" />'); 454 //pmv_do.writeln('<img src="'+pmv_src+'" alt="phpMyVisites" style="border:0" />');
401 // Místo toho přednačteme obrázek 455 // Místo toho přednačteme obrázek
-   456  
402 var dummy_picture=new Image(); 457 var dummy_picture=new Image();
403 dummy_picture.src=src; 458 dummy_picture.src=pmv_src;
404 } 459 }
405   460  
406   461  
407 function doLoad() 462 function doLoad()
408 // Tato funkce se spustí při načtení celé stránky. 463 // Tato funkce se spustí při načtení celé stránky.
Line 417... Line 472...
417 var pagename=''; 472 var pagename='';
418 var phpmyvisitesSite = 1; 473 var phpmyvisitesSite = 1;
419 var phpmyvisitesURL = "http://www.mlab.cz/phpmyvisites/phpmyvisites.php"; 474 var phpmyvisitesURL = "http://www.mlab.cz/phpmyvisites/phpmyvisites.php";
420 //if (location.hostname != "") // jen při přístupu na server 475 //if (location.hostname != "") // jen při přístupu na server
421 //{ 476 //{
422 pmv_log(phpmyvisitesSite, phpmyvisitesURL, pagename, a_vars); 477 pmv_log(phpmyvisitesURL, phpmyvisitesSite, pagename, a_vars);
423 //} 478 //}
424 } 479 }
425   480  
426   481  
427 // Zaregistruj výkonný skript po načtení celé stránky 482 // Zaregistruj výkonný skript po načtení celé stránky