mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 14:46:56 +02:00
Site-Statistics plugin fixes, cleanup etc.
This commit is contained in:
@@ -664,7 +664,19 @@ class e_admin_log
|
||||
|
||||
$date = ($append == true) ? date('Y-m-d') : date('Y-m-d_H-i-s').'_'.crc32($text);
|
||||
|
||||
$fileName = e_LOG.$date."_".$this->logFile.".log";
|
||||
$dir = e_LOG;
|
||||
|
||||
if(e_CURRENT_PLUGIN) // If it's a plugin, create a subfolder.
|
||||
{
|
||||
$dir = e_LOG.e_CURRENT_PLUGIN."/";
|
||||
|
||||
if(!is_dir($dir))
|
||||
{
|
||||
mkdir($dir,0755);
|
||||
}
|
||||
}
|
||||
|
||||
$fileName = $dir.$date."_".$this->logFile.".log";
|
||||
|
||||
if($append == true)
|
||||
{
|
||||
@@ -685,6 +697,10 @@ class e_admin_log
|
||||
$this->_allMessages = array();
|
||||
return $this->logFile;
|
||||
}
|
||||
elseif(getperms('0') && E107_DEBUG_LEVEL > 0)
|
||||
{
|
||||
echo "Could Save to Log File: ".$fileName;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@@ -2588,7 +2588,7 @@ class e107
|
||||
if(isset($GLOBALS['_E107']['minimal']) || e_AJAX_REQUEST || deftrue('e_MINIMAL'))
|
||||
{
|
||||
$_e107vars = array('forceuserupdate', 'online', 'theme', 'menus', 'prunetmp');
|
||||
|
||||
$GLOBALS['_E107']['minimal'] = true;
|
||||
// lame but quick - allow online when ajax request only, additonal checks are made in e_online class
|
||||
if(e_AJAX_REQUEST && !isset($GLOBALS['_E107']['online']) && !isset($GLOBALS['_E107']['minimal'])) unset($_e107vars[1]);
|
||||
|
||||
|
@@ -31,20 +31,19 @@ $pfile = "logp_".$date.".php"; // Today's log file
|
||||
$ifileprev = "logi_".$yesterday.".php";
|
||||
$ifile = "logi_".$date.".php";
|
||||
|
||||
if(file_exists($pathtologs.$pfile))
|
||||
if(file_exists($pathtologs.$pfile)) /* log file is up to date, no consolidation required */
|
||||
{
|
||||
/* log file is up to date, no consolidation required */
|
||||
return;
|
||||
}
|
||||
else if(!file_exists($pathtologs.$pfileprev))
|
||||
{ // See if any older log files
|
||||
if (($retvalue = check_for_old_files($pathtologs)) === FALSE)
|
||||
{ /* no logfile found at all - create - this will only ever happen once ... */
|
||||
else if(!file_exists($pathtologs.$pfileprev)) // See if any older log files
|
||||
{
|
||||
if (($retvalue = check_for_old_files($pathtologs)) === FALSE) /* no logfile found at all - create - this will only ever happen once ... */
|
||||
{
|
||||
createLog($pathtologs);
|
||||
return FALSE;
|
||||
}
|
||||
// ... if we've got files
|
||||
list($pfileprev,$ifileprev,$date2,$tstamp) = explode('|',$retvalue);
|
||||
|
||||
list($pfileprev,$ifileprev,$date2,$tstamp) = explode('|',$retvalue); // ... if we've got files
|
||||
}
|
||||
|
||||
|
||||
@@ -63,10 +62,10 @@ $qry .= ")";
|
||||
/* log file is out of date - consolidation required */
|
||||
|
||||
/* get existing stats ... */
|
||||
//if($sql -> db_Select("logstats", "*", "log_id='statBrowser' OR log_id='statOs' OR log_id='statScreen' OR log_id='statDomain' OR log_id='statTotal' OR log_id='statUnique' OR log_id='statReferer' OR log_id='statQuery'"))
|
||||
if($sql -> db_Select("logstats", "*", $qry))
|
||||
//if($sql->select("logstats", "*", "log_id='statBrowser' OR log_id='statOs' OR log_id='statScreen' OR log_id='statDomain' OR log_id='statTotal' OR log_id='statUnique' OR log_id='statReferer' OR log_id='statQuery'"))
|
||||
if($sql->select("logstats", "*", $qry))
|
||||
{ // That's read in all the stats we need to modify
|
||||
while($row = $sql -> db_Fetch())
|
||||
while($row = $sql->fetch())
|
||||
{
|
||||
if($row['log_id'] == "statUnique")
|
||||
{
|
||||
@@ -90,14 +89,15 @@ if($sql -> db_Select("logstats", "*", $qry))
|
||||
else
|
||||
{
|
||||
// this must be the first time a consolidation has happened - this will only ever happen once ...
|
||||
$sql -> db_Insert("logstats", "0, 'statBrowser', ''");
|
||||
$sql -> db_Insert("logstats", "0, 'statOs', ''");
|
||||
$sql -> db_Insert("logstats", "0, 'statScreen', ''");
|
||||
$sql -> db_Insert("logstats", "0, 'statDomain', ''");
|
||||
$sql -> db_Insert("logstats", "0, 'statReferer', ''");
|
||||
$sql -> db_Insert("logstats", "0, 'statQuery', ''");
|
||||
$sql -> db_Insert("logstats", "0, 'statTotal', '0'");
|
||||
$sql -> db_Insert("logstats", "0, 'statUnique', '0'");
|
||||
$sql->insert("logstats", "0, 'statBrowser', ''");
|
||||
$sql->insert("logstats", "0, 'statOs', ''");
|
||||
$sql->insert("logstats", "0, 'statScreen', ''");
|
||||
$sql->insert("logstats", "0, 'statDomain', ''");
|
||||
$sql->insert("logstats", "0, 'statReferer', ''");
|
||||
$sql->insert("logstats", "0, 'statQuery', ''");
|
||||
$sql->insert("logstats", "0, 'statTotal', '0'");
|
||||
$sql->insert("logstats", "0, 'statUnique', '0'");
|
||||
|
||||
$statBrowser =array();
|
||||
$statOs =array();
|
||||
$statScreen =array();
|
||||
@@ -171,14 +171,14 @@ $statTotal += $siteTotal;
|
||||
$statUnique += $siteUnique;
|
||||
|
||||
// Save cumulative results - always keep track of these, even if the $pref doesn't display them
|
||||
$sql -> db_Update("logstats", "log_data='{$browser}' WHERE log_id='statBrowser'");
|
||||
$sql -> db_Update("logstats", "log_data='{$os}' WHERE log_id='statOs'");
|
||||
$sql -> db_Update("logstats", "log_data='{$screen}' WHERE log_id='statScreen'");
|
||||
$sql -> db_Update("logstats", "log_data='{$domain}' WHERE log_id='statDomain'");
|
||||
$sql -> db_Update("logstats", "log_data='{$refer}' WHERE log_id='statReferer'");
|
||||
$sql -> db_Update("logstats", "log_data='{$squery}' WHERE log_id='statQuery'");
|
||||
$sql -> db_Update("logstats", "log_data='".intval($statTotal)."' WHERE log_id='statTotal'");
|
||||
$sql -> db_Update("logstats", "log_data='".intval($statUnique)."' WHERE log_id='statUnique'");
|
||||
$sql->update("logstats", "log_data='{$browser}' WHERE log_id='statBrowser'");
|
||||
$sql->update("logstats", "log_data='{$os}' WHERE log_id='statOs'");
|
||||
$sql->update("logstats", "log_data='{$screen}' WHERE log_id='statScreen'");
|
||||
$sql->update("logstats", "log_data='{$domain}' WHERE log_id='statDomain'");
|
||||
$sql->update("logstats", "log_data='{$refer}' WHERE log_id='statReferer'");
|
||||
$sql->update("logstats", "log_data='{$squery}' WHERE log_id='statQuery'");
|
||||
$sql->update("logstats", "log_data='".intval($statTotal)."' WHERE log_id='statTotal'");
|
||||
$sql->update("logstats", "log_data='".intval($statUnique)."' WHERE log_id='statUnique'");
|
||||
|
||||
|
||||
// Now save the relevant monthly results - only where enabled
|
||||
@@ -189,9 +189,10 @@ foreach ($stats_list as $s)
|
||||
$srcvar = 'mon_'.$s;
|
||||
$destvar = 'smon_'.$s;
|
||||
$$destvar = serialize($$srcvar);
|
||||
if (!$sql -> db_Update("logstats", "log_data='".$$destvar."' WHERE log_id='".$s.":".$date3."'"))
|
||||
|
||||
if (!$sql->update("logstats", "log_data='".$$destvar."' WHERE log_id='".$s.":".$date3."'"))
|
||||
{
|
||||
$sql -> db_Insert("logstats", "0, '".$s.":".$date3."', '".$$destvar."'");
|
||||
$sql->insert("logstats", "0, '".$s.":".$date3."', '".$$destvar."'");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -199,9 +200,9 @@ foreach ($stats_list as $s)
|
||||
|
||||
|
||||
/* get page access monthly info from db */
|
||||
if($sql -> db_Select("logstats", "*", "log_id='{$date3}' "))
|
||||
if($sql->select("logstats", "*", "log_id='{$date3}' "))
|
||||
{
|
||||
$tmp = $sql -> db_Fetch();
|
||||
$tmp = $sql->fetch();
|
||||
$monthlyInfo = unserialize($tmp['log_data']);
|
||||
unset($tmp);
|
||||
$MonthlyExistsFlag = TRUE;
|
||||
@@ -219,18 +220,18 @@ $monthlyinfo = serialize($monthlyInfo);
|
||||
|
||||
if($MonthlyExistsFlag)
|
||||
{
|
||||
$sql -> db_Update("logstats", "log_data='{$monthlyinfo}' WHERE log_id='{$date3}'");
|
||||
$sql->update("logstats", "log_data='{$monthlyinfo}' WHERE log_id='{$date3}'");
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql->db_Insert("logstats", "0, '{$date3}', '{$monthlyinfo}'");
|
||||
$sql->insert("logstats", "0, '{$date3}', '{$monthlyinfo}'");
|
||||
}
|
||||
|
||||
|
||||
/* collate page total information */
|
||||
if($sql -> db_Select("logstats", "*", "log_id='pageTotal' "))
|
||||
if($sql->select("logstats", "*", "log_id='pageTotal' "))
|
||||
{
|
||||
$tmp = $sql -> db_Fetch();
|
||||
$tmp = $sql->fetch();
|
||||
$pageTotal = unserialize($tmp['log_data']);
|
||||
unset($tmp);
|
||||
}
|
||||
@@ -248,9 +249,9 @@ foreach($pageInfo as $key => $info)
|
||||
|
||||
$pagetotal = serialize($pageTotal);
|
||||
|
||||
if(!$sql -> db_Update("logstats", "log_data='{$pagetotal}' WHERE log_id='pageTotal' "))
|
||||
if(!$sql->update("logstats", "log_data='{$pagetotal}' WHERE log_id='pageTotal' "))
|
||||
{
|
||||
$sql -> db_Insert("logstats", "0, 'pageTotal', '{$pagetotal}' ");
|
||||
$sql->insert("logstats", "0, 'pageTotal', '{$pagetotal}' ");
|
||||
}
|
||||
|
||||
|
||||
@@ -267,7 +268,7 @@ foreach($pageInfo as $key => $value)
|
||||
}
|
||||
|
||||
$data = $dailytotal.chr(1).$uniquetotal.chr(1) . $data;
|
||||
$sql -> db_Insert("logstats", "0, '$date2', '".$tp -> toDB($data, true)."'");
|
||||
$sql->insert("logstats", "0, '$date2', '".$tp -> toDB($data, true)."'");
|
||||
|
||||
|
||||
/* ok, we're finished with the log file now, we can empty it ... */
|
||||
|
@@ -17,11 +17,12 @@ if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
if (vartrue($pref['statActivate']))
|
||||
{
|
||||
if(!$pref['statCountAdmin'] && ADMIN)
|
||||
|
||||
if(!$pref['statCountAdmin'] && ADMIN) // don't count admin visits
|
||||
{
|
||||
/* don't count admin visits */
|
||||
return;
|
||||
}
|
||||
|
||||
// Page to log here
|
||||
|
||||
if(USER_AREA)
|
||||
@@ -34,6 +35,7 @@ if (vartrue($pref['statActivate']))
|
||||
if (is_numeric(e_QUERY)) $err_flag .= '/'.substr(e_QUERY,0,10); // This should pick up the error code - and limit numeric length to upset the malicious
|
||||
$err_flag .= "&err_referer=".$_SERVER['HTTP_REFERER'];
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
$logJS = "
|
||||
@@ -107,8 +109,11 @@ $(function() {
|
||||
type: 'get',
|
||||
url: url,
|
||||
data: {'lv' :logString},
|
||||
success: function() {
|
||||
//alert(logString);
|
||||
success: function(e) {
|
||||
if(e)
|
||||
{
|
||||
alert(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -118,8 +123,7 @@ $(function() {
|
||||
|
||||
if(USER_AREA)
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$e107->getJs()->headerInline($logJS, 5);
|
||||
e107::js('footer-inline', $logJS, 'jquery');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2,15 +2,12 @@
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright 2001-2010 e107 Inc (e107.org)
|
||||
* 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'
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
|
||||
*/
|
||||
|
||||
/* File to log page accesses - called with
|
||||
@@ -26,13 +23,22 @@
|
||||
// Normally the file is 'silent' - if any errors occur, any error message appears in the page header.
|
||||
*/
|
||||
//error_reporting(0);
|
||||
error_reporting(E_ALL);
|
||||
// error_reporting(E_ALL);
|
||||
define('e_MINIMAL',true);
|
||||
require_once("../../class2.php"); // More secure to include it.
|
||||
header('Cache-Control: no-cache, must-revalidate'); // See if this discourages browser caching
|
||||
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
|
||||
|
||||
if (!vartrue($pref['statActivate']))
|
||||
{
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up path to log files.
|
||||
* The log file directory contains a flag file which defines whether logging is enabled.
|
||||
*/
|
||||
/*
|
||||
function setLogPath()
|
||||
{
|
||||
$siteRoot = realpath(dirname(__FILE__).'./../../').'/';
|
||||
@@ -47,10 +53,10 @@ function setLogPath()
|
||||
define('e_LOG', $logDir);
|
||||
return $logEnable;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
if (!setLogPath()) exit(); // Could be logging disabled, missing files, all sorts of things. Just do nothing.
|
||||
|
||||
// if (!setLogPath()) exit(); // Could be logging disabled, missing files, all sorts of things. Just do nothing.
|
||||
//print_r(base64_decode($_GET['lv']));
|
||||
define('log_INIT', TRUE);
|
||||
|
||||
|
||||
@@ -64,8 +70,9 @@ $pageUnique = array('page' => 1, 'content' => array('content'));
|
||||
//$logVals = urldecode(base64_decode($_SERVER['QUERY_STRING']));
|
||||
$logVals = urldecode(base64_decode($_GET['lv']));
|
||||
|
||||
|
||||
//file_put_contents(e_LOG."test.log",print_r($logVals,true)); // , FILE_APPEND | LOCK_EX
|
||||
$lg = e107::getAdminLog();
|
||||
$lg->addDebug(print_r($logVals, true));
|
||||
$lg->toFile('SiteStats','Statistics Log', true);
|
||||
|
||||
parse_str($logVals, $vals);
|
||||
|
||||
@@ -73,15 +80,11 @@ parse_str($logVals, $vals);
|
||||
// @todo may be able to remove this check once minimum PHP version finalised
|
||||
if (function_exists('date_default_timezone_get'))
|
||||
{
|
||||
// Just set a default - it should default to UTC if no timezone set
|
||||
date_default_timezone_set(@date_default_timezone_get());
|
||||
date_default_timezone_set(@date_default_timezone_get()); // Just set a default - it should default to UTC if no timezone set
|
||||
}
|
||||
|
||||
|
||||
|
||||
header('Cache-Control: no-cache, must-revalidate'); // See if this discourages browser caching
|
||||
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
|
||||
|
||||
//$logfp = fopen(e_LOG.'rcvstring.txt', 'a+'); fwrite($logfp, $logVals."\n"); fclose($logfp);
|
||||
//$logfp = fopen(e_LOG.'rcvstring.txt', 'a+'); fwrite($logfp, print_r($vals, TRUE)."\n"); fclose($logfp);
|
||||
|
||||
@@ -90,7 +93,6 @@ $res = strip_tags((isset($vals['res']) ? $vals['res'] : ''));
|
||||
$self = strip_tags((isset($vals['eself']) ? $vals['eself'] : ''));
|
||||
$ref = addslashes(strip_tags((isset($vals['referer']) ? $vals['referer'] : '')));
|
||||
$logQry = isset($vals['qry']) && $vals['qry'];
|
||||
|
||||
$date = date('z.Y', time());
|
||||
$logPfile = e_LOG.'logp_'.$date.'.php';
|
||||
|
||||
@@ -171,16 +173,19 @@ $p_handle = fopen($logPfile, 'r+');
|
||||
if($p_handle && flock( $p_handle, LOCK_EX ) )
|
||||
{
|
||||
$log_file_contents = '';
|
||||
while (!feof($p_handle))
|
||||
{ // Assemble a string of data
|
||||
while (!feof($p_handle)) // Assemble a string of data
|
||||
{
|
||||
$log_file_contents.= fgets($p_handle,1000);
|
||||
}
|
||||
$log_file_contents = str_replace(array('<'.'?php','?'.'>'),'',$log_file_contents);
|
||||
if (eval($log_file_contents) === FALSE) echo "error in log file contents<br /><br /><br /><br />";
|
||||
if (eval($log_file_contents) === FALSE && getperms('0'))
|
||||
{
|
||||
echo "Error in log file contents: ".$logPfile;
|
||||
}
|
||||
}
|
||||
else
|
||||
elseif(getperms('0'))
|
||||
{
|
||||
echo "Couldn't log data<br /><br /><br /><br />";
|
||||
echo "Couldn't log data to: ".$logPfile; // returned to js popup.
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -236,6 +241,7 @@ if ($p_handle)
|
||||
|
||||
|
||||
// Get current IP address - return as a hex-encoded string
|
||||
/*
|
||||
function getip()
|
||||
{
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
@@ -293,6 +299,6 @@ function getip()
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
?>
|
@@ -713,7 +713,7 @@ class siteStats
|
||||
$this -> fileRecent = vartrue($visitInfo);
|
||||
|
||||
/* get main stat info from database */
|
||||
if($sql -> db_Select('logstats', 'log_data', "log_id='pageTotal'"))
|
||||
if($sql->select('logstats', 'log_data', "log_id='pageTotal'"))
|
||||
{
|
||||
$row = $sql -> db_Fetch();
|
||||
$this -> dbPageInfo = unserialize($row['log_data']);
|
||||
@@ -881,7 +881,7 @@ class siteStats
|
||||
$sql = e107::getDB();
|
||||
|
||||
$text = '';
|
||||
$sql -> db_Select("logstats", "*", "log_id='pageTotal' ");
|
||||
$sql->select("logstats", "*", "log_id='pageTotal' ");
|
||||
$row = $sql -> db_Fetch();
|
||||
$pageTotal = unserialize($row['log_data']);
|
||||
$total = 0;
|
||||
@@ -917,8 +917,12 @@ class siteStats
|
||||
<col style='width: 10%;' />
|
||||
<col style='width: 10%;' />
|
||||
</colgroup>
|
||||
<tr>\n<td class='fcaption' >".ADSTAT_L19."</td>\n
|
||||
<td class='fcaption' colspan='2'>".ADSTAT_L23."</td>\n<td class='fcaption' style='text-align: center;'>%</td>\n</tr>\n";
|
||||
<tr>
|
||||
<th class='fcaption' >".ADSTAT_L19."</th>\n
|
||||
<th class='fcaption' colspan='2'>".ADSTAT_L23."</th>
|
||||
<th class='fcaption' style='text-align: center;'>%</th>
|
||||
</tr>\n";
|
||||
|
||||
foreach($totalArray as $key => $info)
|
||||
{
|
||||
if($info['ttlv'])
|
||||
@@ -1134,7 +1138,7 @@ class siteStats
|
||||
$pars = make_bits('statOs',$act); // Get the query, plus maybe date for heading
|
||||
if (!is_array($pars)) return $pars; // Return error if necessary
|
||||
|
||||
if ($entries = $sql -> db_Select("logstats", "*", $pars['query']))
|
||||
if ($entries = $sql->select("logstats", "*", $pars['query']))
|
||||
{
|
||||
$row = $sql -> db_Fetch();
|
||||
$statOs = unserialize($row['log_data']);
|
||||
@@ -1267,7 +1271,7 @@ class siteStats
|
||||
$pars = make_bits('statDomain',$act); // Get the query, plus maybe date for heading
|
||||
if (!is_array($pars)) return $pars; // Return error if necessary
|
||||
|
||||
if ($entries = $sql -> db_Select('logstats', 'log_data', $pars['query']))
|
||||
if ($entries = $sql->select('logstats', 'log_data', $pars['query']))
|
||||
{
|
||||
$row = $sql -> db_Fetch();
|
||||
$statDom = unserialize($row['log_data']);
|
||||
@@ -1456,7 +1460,7 @@ class siteStats
|
||||
$pars = make_bits('statReferer',$act); // Get the query, plus maybe date for heading
|
||||
if (!is_array($pars)) return $pars; // Return error if necessary
|
||||
|
||||
if ($entries = $sql -> db_Select('logstats', 'log_data', $pars['query']))
|
||||
if ($entries = $sql->select('logstats', 'log_data', $pars['query']))
|
||||
{
|
||||
$row = $sql -> db_Fetch();
|
||||
$statRefer = unserialize($row['log_data']);
|
||||
@@ -1550,7 +1554,7 @@ class siteStats
|
||||
$pars = make_bits('statQuery',$act); // Get the query, plus maybe date for heading
|
||||
if (!is_array($pars)) return $pars; // Return error if necessary
|
||||
|
||||
if ($entries = $sql -> db_Select("logstats", "*", $pars['query']))
|
||||
if ($entries = $sql->select("logstats", "*", $pars['query']))
|
||||
{
|
||||
$row = $sql -> db_Fetch();
|
||||
$statQuery = unserialize($row['log_data']);
|
||||
@@ -1631,8 +1635,8 @@ class siteStats
|
||||
$text = "
|
||||
<table class='table table-striped fborder' style='width: 100%;'>
|
||||
<tr>
|
||||
<td class='fcaption' style='width: 30%;'>".ADSTAT_L18."</td>
|
||||
<td class='fcaption' style='width: 70%;'>Information</td>
|
||||
<th class='fcaption' style='width: 30%;'>".ADSTAT_L18."</th>
|
||||
<th class='fcaption' style='width: 70%;'>Information</th>
|
||||
</tr>\n";
|
||||
|
||||
foreach($recentArray as $key => $info)
|
||||
@@ -1683,7 +1687,7 @@ class siteStats
|
||||
DESC LIMIT 0,14
|
||||
";
|
||||
|
||||
if($amount = $sql -> db_Select_gen($qry))
|
||||
if($amount = $sql->gen($qry))
|
||||
{
|
||||
$array = $sql -> db_getList();
|
||||
|
||||
@@ -1847,7 +1851,7 @@ class siteStats
|
||||
$sql = e107::getDB();
|
||||
|
||||
// Month format entries have log_id = yyyy-mm
|
||||
if(!$entries = $sql -> db_Select("logstats", "*", "log_id REGEXP('^[[:digit:]]+\-[[:digit:]]+$') ORDER BY CONCAT(LEFT(log_id,4), RIGHT(log_id,2)) DESC"))
|
||||
if(!$entries = $sql->select("logstats", "*", "log_id REGEXP('^[[:digit:]]+\-[[:digit:]]+$') ORDER BY CONCAT(LEFT(log_id,4), RIGHT(log_id,2)) DESC"))
|
||||
{
|
||||
return ADSTAT_L42;
|
||||
}
|
||||
@@ -1858,6 +1862,7 @@ class siteStats
|
||||
$monthTotal = array(); // Array of totals, one per month, with 'totalv', 'uniquev' sub-indices
|
||||
$mtotal = 0;
|
||||
$utotal = 0;
|
||||
|
||||
foreach($array as $info)
|
||||
{
|
||||
$date = $info['log_id'];
|
||||
@@ -1891,8 +1896,8 @@ class siteStats
|
||||
<th class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L34."</th>
|
||||
</tr>\n";
|
||||
|
||||
foreach($monthTotal as $date => $total) {
|
||||
|
||||
foreach($monthTotal as $date => $total)
|
||||
{
|
||||
list($year, $month) = explode("-", $date);
|
||||
$date = strftime ("%B %Y", mktime (0,0,0,$month,1,$year));
|
||||
$barWidth = round(($total['totalv']/$mtotal) * 100, 2);
|
||||
@@ -1910,7 +1915,8 @@ class siteStats
|
||||
<th class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L34."</th>
|
||||
</tr>\n";
|
||||
|
||||
foreach($monthTotal as $date => $total) {
|
||||
foreach($monthTotal as $date => $total)
|
||||
{
|
||||
$barWidth = round(($total['uniquev']/$utotal) * 100, 2);
|
||||
list($year, $month) = explode("-", $date);
|
||||
$date = strftime ("%B %Y", mktime (0,0,0,$month,1,$year));
|
||||
@@ -1997,7 +2003,7 @@ class siteStats
|
||||
function remove_entry($toremove)
|
||||
{ // Note - only removes info from the database - not from the current page file
|
||||
$sql = e107::getDB();
|
||||
if ($sql -> db_Select("logstats", "*", "log_id='pageTotal'"))
|
||||
if ($sql->select("logstats", "*", "log_id='pageTotal'"))
|
||||
{
|
||||
$row = $sql -> db_Fetch();
|
||||
$dbPageInfo = unserialize($row[2]);
|
||||
|
Reference in New Issue
Block a user