mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
Plugin: Logstats - prevent broken array scenario. Allow e_footer.php to echo to browser when required.
This commit is contained in:
@@ -278,9 +278,9 @@ if (isset($footer_js) && is_array($footer_js))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load e_footer.php files.
|
// Load e_footer.php files.
|
||||||
if (is_array($pref['e_footer_list']))
|
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)
|
foreach($pref['e_footer_list'] as $val)
|
||||||
{
|
{
|
||||||
@@ -290,11 +290,12 @@ if (is_array($pref['e_footer_list']))
|
|||||||
{
|
{
|
||||||
|
|
||||||
$ret = ($e107_debug || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
$ret = ($e107_debug || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$e_footer_ouput = ob_get_contents(); // Don't use.
|
// $e_footer_ouput = ob_get_contents(); // Don't use.
|
||||||
ob_end_clean();
|
// ob_end_clean();
|
||||||
unset($ret);
|
unset($ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -203,6 +203,9 @@ class logConsolidate
|
|||||||
|
|
||||||
$pageName = $err_code.$pageName; // Add the error code at the beginning, so its treated uniquely
|
$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;
|
return $pageName;
|
||||||
}
|
}
|
||||||
@@ -220,12 +223,14 @@ class logConsolidate
|
|||||||
|
|
||||||
if(!is_readable($path))
|
if(!is_readable($path))
|
||||||
{
|
{
|
||||||
|
echo "File Not Found: ".$path;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$handle = fopen($path, "r");
|
$handle = fopen($path, "r");
|
||||||
|
|
||||||
$pageTotal = array();
|
$pageTotal = array();
|
||||||
|
$line = 0;
|
||||||
|
|
||||||
if ($handle)
|
if ($handle)
|
||||||
{
|
{
|
||||||
@@ -233,15 +238,28 @@ class logConsolidate
|
|||||||
{
|
{
|
||||||
if($vars = $this->splitRawBackupLine($buffer))
|
if($vars = $this->splitRawBackupLine($buffer))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(substr($vars['eself'],0,7) == 'file://')
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$key = $this->getPageKey($vars['eself']);
|
$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]['url'] = $vars['eself'];
|
||||||
$pageTotal[$key]['ttl'] += 1;
|
$pageTotal[$key]['ttl'] += 1;
|
||||||
|
|
||||||
if(!isset($pageTotal[$key]['unq']))
|
// echo "\n<br />line: ".$line." ------- ".$key;
|
||||||
{
|
|
||||||
$pageTotal[$key]['unq'] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($vars['unique']))
|
if(isset($vars['unique']))
|
||||||
{
|
{
|
||||||
@@ -255,6 +273,8 @@ class logConsolidate
|
|||||||
$pageTotal[$key]['unq'] += 1;
|
$pageTotal[$key]['unq'] += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$line++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!feof($handle))
|
if (!feof($handle))
|
||||||
@@ -289,7 +309,7 @@ class logConsolidate
|
|||||||
|
|
||||||
if($sql->select('logstats','log_id',"log_id='".$datestamp."' "))
|
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))
|
if($this->collatePageInfo($pageTotal, $datestamp))
|
||||||
@@ -329,7 +349,7 @@ class logConsolidate
|
|||||||
{
|
{
|
||||||
$sql = e107::getDb();
|
$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);
|
$data = $sql->retrieve($qry,true);
|
||||||
|
|
||||||
$pageTotal = array();
|
$pageTotal = array();
|
||||||
|
Reference in New Issue
Block a user