1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-21 21:21:54 +02:00

Issue #499 - Log stats inconsistencies. Corrected raw logs of page visits.

This commit is contained in:
Cameron 2015-09-24 10:47:32 -07:00
parent d3d4b349df
commit cf093cc34e
2 changed files with 55 additions and 45 deletions

View File

@ -2,14 +2,13 @@
/*
* e107 website system
*
* Copyright 2001-2010 e107 Inc (e107.org)
* Copyright 2001-2015 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Site access logging
*
* $URL$
* $Id$
*
*/
if (!defined('e107_INIT')) { exit; }
@ -37,36 +36,7 @@ if (vartrue($pref['statActivate']))
}
}
/*
$logJS = "
function rstr2b64(input)
{
var b64pad = \"=\"; // base-64 pad character. \"=\" for strict RFC compliance
var tab = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";
var output = \"\";
var len = input.length;
for(var i = 0; i < len; i += 3)
{
var triplet = (input.charCodeAt(i) << 16)
| (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
| (i + 2 < len ? input.charCodeAt(i+2) : 0);
for(var j = 0; j < 4; j++)
{
if(i * 8 + j * 6 > input.length * 8) output += b64pad;
else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
}
}
return output;
}
var ref=\"\"+escape(top.document.referrer);
var colord = window.screen.colorDepth;
var res = window.screen.width + \"x\" + window.screen.height;
var logString = 'referer=' + ref + '&colour=' + colord + '&eself=' + eself + '&res=' + res + '".$err_flag."';
logString = rstr2b64(logString);
document.write('<link rel=\"stylesheet\" type=\"text/css\" href=\"".e_PLUGIN_ABS."log/log.php?lv='+logString + '\">' );
";
*/
if(USER_AREA)
{
$logJS = "
@ -98,9 +68,11 @@ document.write('<link rel=\"stylesheet\" type=\"text/css\" href=\"".e_PLUGIN_ABS
var ref =\"\"+escape(top.document.referrer);
var eeself = escape(window.location.href);
var colord = window.screen.colorDepth;
var res = window.screen.width + \"x\" + window.screen.height;
var logString = 'referer=' + ref + '&colour=' + colord + '&eself=' + eself + '&res=' + res + '".$err_flag."';
var logString = 'referer=' + ref + '&colour=' + colord + '&eself=' + eeself + '&res=' + res + '".$err_flag."';
logString = rstr2b64(logString);
var url = '".SITEURLBASE.e_PLUGIN_ABS."log/log.php';

View File

@ -1,13 +1,13 @@
<?php
/*
* e107 website system
*
* Copyright 2001-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Site access logging - 'receiver'
* e107 website system
*
* Copyright 2001-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Site access logging - 'receiver'
*/
/* File to log page accesses - called with
@ -67,14 +67,52 @@ define('log_INIT', TRUE);
$pageUnique = array('page' => 1, 'content' => array('content'));
//$logVals = urldecode(base64_decode($_SERVER['QUERY_STRING']));
$logVals = urldecode(base64_decode($_GET['lv']));
//$logVals = urldecode(base64_decode($_SERVER['QUERY_STRING']));
//$logVals = urldecode(base64_decode($_GET['lv']));
// --------------- Reworked for v2.x ------------------------
$logVals = base64_decode($_GET['lv']);
$logVals .= "&ip=".USERIP;
$logVals .= "&iphost=". @gethostbyaddr(USERIP);
$logVals .= "&lan=".e_LAN;
$logVals .= "&agent=".$_SERVER['HTTP_USER_AGENT'];
parse_str($logVals, $vals);
$vals['referer'] = urldecode($vals['referer']);
$vals['eself'] = urldecode($vals['eself']);
if(empty($_SESSION['log_userLoggedPages']) || !in_array($vals['eself'],$_SESSION['log_userLoggedPages']))
{
$_SESSION['log_userLoggedPages'][] = $vals['eself'];
$logVals .= "&unique=1";
}
else
{
$logVals .= "&unique=0";
}
$logVals = str_replace('%3A',':',$logVals); // make the URLs a bit cleaner, while keeping any urlqueries encoded.
$lg = e107::getAdminLog();
$lg->addDebug(print_r($logVals, true));
$lg->toFile('SiteStats','Statistics Log', true);
parse_str($logVals, $vals);
e107::getEvent()->trigger('user_log_stats',$vals);
// ------------------------------------ ---------------------
// We MUST have a timezone set in PHP >= 5.3. This should work for PHP >= 5.1:
// @todo may be able to remove this check once minimum PHP version finalised