1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Plugin: Logstats - prevent broken array scenario. Allow e_footer.php to echo to browser when required.

This commit is contained in:
Cameron 2015-10-06 11:01:23 -07:00
parent 89516d43a1
commit 24939cec54
2 changed files with 33 additions and 12 deletions

View File

@ -277,11 +277,11 @@ if (isset($footer_js) && is_array($footer_js))
}
}
// Load e_footer.php files.
if (is_array($pref['e_footer_list']))
// Load e_footer.php files.
if (!empty($pref['e_footer_list']) && is_array($pref['e_footer_list']))
{
ob_start();
//ob_start(); // sometimes raw HTML needs to be added at the bottom of every page. eg. <noscript> etc. so allow 'echo' in e_footer files. (but not e_header)
foreach($pref['e_footer_list'] as $val)
{
$fname = e_PLUGIN.$val."/e_footer.php"; // Do not place inside a function - BC $pref required. .
@ -290,11 +290,12 @@ if (is_array($pref['e_footer_list']))
{
$ret = ($e107_debug || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
}
}
$e_footer_ouput = ob_get_contents(); // Don't use.
ob_end_clean();
// $e_footer_ouput = ob_get_contents(); // Don't use.
// ob_end_clean();
unset($ret);
}

View File

@ -203,6 +203,9 @@ class logConsolidate
$pageName = $err_code.$pageName; // Add the error code at the beginning, so its treated uniquely
// filter out any non-utf8 characters which could halt processing.
$pageName = urldecode($pageName);
$pageName = iconv('UTF-8', 'ASCII//IGNORE', $pageName);
return $pageName;
}
@ -220,12 +223,14 @@ class logConsolidate
if(!is_readable($path))
{
echo "File Not Found: ".$path;
return false;
}
$handle = fopen($path, "r");
$pageTotal = array();
$line = 0;
if ($handle)
{
@ -233,15 +238,28 @@ class logConsolidate
{
if($vars = $this->splitRawBackupLine($buffer))
{
if(substr($vars['eself'],0,7) == 'file://')
{
continue;
}
$key = $this->getPageKey($vars['eself']);
if(empty($key))
{
continue;
}
if(!isset($pageTotal[$key]))
{
$pageTotal[$key] = array('url'=>'', 'ttl'=>0, 'unq'=>0);
}
$pageTotal[$key]['url'] = $vars['eself'];
$pageTotal[$key]['ttl'] += 1;
if(!isset($pageTotal[$key]['unq']))
{
$pageTotal[$key]['unq'] = 0;
}
// echo "\n<br />line: ".$line." ------- ".$key;
if(isset($vars['unique']))
{
@ -255,6 +273,8 @@ class logConsolidate
$pageTotal[$key]['unq'] += 1;
}
}
$line++;
}
if (!feof($handle))
@ -289,7 +309,7 @@ class logConsolidate
if($sql->select('logstats','log_id',"log_id='".$datestamp."' "))
{
$sql->update('logstats', "log_id='".$datestamp."-bak' WHERE log_id='".$datestamp."' ");
$sql->update('logstats', "log_id='bak-".$datestamp."' WHERE log_id='".$datestamp."' ");
}
if($this->collatePageInfo($pageTotal, $datestamp))
@ -329,7 +349,7 @@ class logConsolidate
{
$sql = e107::getDb();
$qry = "SELECT * FROM `#logstats` WHERE `log_id` REGEXP '^[0-9]' AND `log_data` LIKE '%http%'";
$qry = "SELECT * FROM `#logstats` WHERE `log_id` REGEXP '^[0-9]' AND LENGTH(log_id) > 7 AND `log_data` LIKE '%http%'";
$data = $sql->retrieve($qry,true);
$pageTotal = array();