1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 06:38:00 +02:00

Bugtracker #3663 - treat error pages separately from normal ones in stats

This commit is contained in:
e107steved
2007-08-14 19:27:22 +00:00
parent e2ce05fbbc
commit 2806e27c6b
5 changed files with 235 additions and 90 deletions

View File

@@ -6,9 +6,9 @@
| Released under the terms and conditions of the GNU General Public License (http://gnu.org). | Released under the terms and conditions of the GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/e_meta.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/log/e_meta.php,v $
| $Revision: 1.2 $ | $Revision: 1.3 $
| $Date: 2007-07-11 13:51:14 $ | $Date: 2007-08-14 19:27:22 $
| $Author: sweetas $ | $Author: e107steved $
+-----------------------------------------------------------------------------------------------+ +-----------------------------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
@@ -22,9 +22,16 @@ if (isset($pref['statActivate']) && $pref['statActivate'])
else else
{ {
require_once(e_PLUGIN."log/consolidate.php"); require_once(e_PLUGIN."log/consolidate.php");
$err_flag = '';
if (defined("ERR_PAGE_ACTIVE"))
{ // We've got an error - set a flag to log it
$err_flag = "&err_direct=".ERR_PAGE_ACTIVE;
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'];
}
echo "<script type='text/javascript'>\n"; echo "<script type='text/javascript'>\n";
echo "<!--\n"; echo "<!--\n";
echo "document.write( '<link rel=\"stylesheet\" type=\"text/css\" href=\"".e_PLUGIN_ABS."log/log.php?referer=' + ref + '&color=' + colord + '&eself=' + eself + '&res=' + res + '\">' );\n"; echo "document.write( '<link rel=\"stylesheet\" type=\"text/css\" href=\"".e_PLUGIN_ABS."log/log.php?referer=' + ref + '&color=' + colord + '&eself=' + eself + '&res=' + res + '{$err_flag}\">' );\n";
echo "// -->\n"; echo "// -->\n";
echo "</script>\n\n"; echo "</script>\n\n";
} }

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/languages/English.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/log/languages/English.php,v $
| $Revision: 1.2 $ | $Revision: 1.3 $
| $Date: 2007-05-31 19:38:10 $ | $Date: 2007-08-14 19:27:22 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -62,4 +62,13 @@ define("ADSTAT_L40", "days");
define("ADSTAT_L41", "Error"); define("ADSTAT_L41", "Error");
define("ADSTAT_L42", "No monthly stats yet."); define("ADSTAT_L42", "No monthly stats yet.");
define("ADSTAT_L43", "Today's page errors");
define("ADSTAT_L44", "All-time page errors");
define("ADSTAT_L45", "Stats deleted for: ");
define("ADSTAT_L46", "Note: any stats for today will not be deleted");
define("ADSTAT_L47", "No stats found for: ");
define("ADSTAT_L48", "");
define("ADSTAT_L49", "");
define("ADSTAT_L50", "");
?> ?>

View File

@@ -13,8 +13,8 @@
| File locking, modified getip() 18.01.07 | File locking, modified getip() 18.01.07
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/log.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/log/log.php,v $
| $Revision: 1.2 $ | $Revision: 1.3 $
| $Date: 2007-02-10 15:54:47 $ | $Date: 2007-08-14 19:27:22 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -25,12 +25,27 @@
// color= colord // color= colord
// eself= eself // eself= eself
// res= res // res= res
// err_direct - optional error flag
// err_referer - referrer if came via error page
define("log_INIT", TRUE); define("log_INIT", TRUE);
$colour = strip_tags((isset($_REQUEST['color']) ? $_REQUEST['color'] : '')); $colour = strip_tags((isset($_REQUEST['color']) ? $_REQUEST['color'] : ''));
$res = strip_tags((isset($_REQUEST['res']) ? $_REQUEST['res'] : '')); $res = strip_tags((isset($_REQUEST['res']) ? $_REQUEST['res'] : ''));
$self = strip_tags((isset($_REQUEST['eself']) ? $_REQUEST['eself'] : '')); $self = strip_tags((isset($_REQUEST['eself']) ? $_REQUEST['eself'] : ''));
$ref = addslashes(strip_tags((isset($_REQUEST['referer']) ? $_REQUEST['referer'] : ''))); $ref = addslashes(strip_tags((isset($_REQUEST['referer']) ? $_REQUEST['referer'] : '')));
$date = date("z.Y", time()); $date = date("z.Y", time());
$logPfile = "logs/logp_".$date.".php";
if ($err_code = strip_tags((isset($_REQUEST['err_direct']) ? $_REQUEST['err_direct'] : '')))
{
$ref = addslashes(strip_tags(isset($_REQUEST['err_referer']) ? $_REQUEST['err_referer'] : ''));
$log_string = $err_code.",".$self.",".$ref;
// Uncomment the next two lines to create a separate CSV format log of invalid accesses - error code, entered URL, referrer
// $logname = "logs/errpages.csv";
// $logfp = fopen($logname, 'a+'); fwrite($logfp, $log_string."\n\r"); fclose($logfp);
$err_code .= ':';
}
if(strstr($ref, "admin")) if(strstr($ref, "admin"))
{ {
@@ -60,11 +75,12 @@ $pageName = substr($match[1], (strrpos($match[1], "/")+1));
$PN = $pageName; $PN = $pageName;
$pageName = preg_replace("/".$tagRemove."/si", "", $pageName); $pageName = preg_replace("/".$tagRemove."/si", "", $pageName);
if($pageName == "") $pageName = "index"; if($pageName == "") $pageName = "index";
$pageName = $err_code.$pageName; // Add the error code at the beginning, so its treated uniquely
if(preg_match("/".$pageDisallow."/i", $pageName)) return; if(preg_match("/".$pageDisallow."/i", $pageName)) return;
$logPfile = "logs/logp_".$date.".php";
$p_handle = fopen($logPfile, 'r+'); $p_handle = fopen($logPfile, 'r+');
if($p_handle && flock( $p_handle, LOCK_EX ) ) if($p_handle && flock( $p_handle, LOCK_EX ) )
{ {

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/stats.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/log/stats.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2007-05-31 19:38:10 $ | $Date: 2007-08-14 19:27:22 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -48,18 +48,17 @@ if (!$pref['statActivate']) {
exit; exit;
} }
if(strstr(e_QUERY, ".")) {
list($action, $order) = explode(".", e_QUERY);
} else {
$action = e_QUERY;
$order = FALSE;
}
$action = intval($action); $qs = explode('.', e_QUERY, 3);
$action = varset($qs[0],1);
$sec_action = varset($qs[1],FALSE);
$order = varset($qs[2],0);
$toremove = $order; $toremove = $order;
$order = intval($order); $order = intval($order);
if($stat -> error) { if($stat -> error)
{
$ns->tablerender(ADSTAT_L6, $stat -> error); $ns->tablerender(ADSTAT_L6, $stat -> error);
require_once(FOOTERF); require_once(FOOTERF);
exit; exit;
@@ -381,6 +380,7 @@ $country["zm"] = "Zambia";
$country["zr"] = "Zaire"; $country["zr"] = "Zaire";
$country["zw"] = "Zimbabwe"; $country["zw"] = "Zimbabwe";
/* stats displayed will depend on the query string. For example, ?1.2.4 will render today's stats, all time stats and browser stats */ /* stats displayed will depend on the query string. For example, ?1.2.4 will render today's stats, all time stats and browser stats */
/* /*
1: today's stats 1: today's stats
@@ -393,90 +393,134 @@ $country["zw"] = "Zimbabwe";
8: search engine strings 8: search engine strings
*/ */
switch($action) { $text = '';
if ((ADMIN == TRUE) && ($sec_action == "rem"))
{
$toremove = rawurldecode($toremove);
if ($stat -> remove_entry($toremove))
{
$text .= "<div style='text-align: center; font-weight: bold'>".ADSTAT_L45.$toremove."<br />".ADSTAT_L46."</div>";
}
else
{
$text .= "<div style='text-align: center; font-weight: bold'>".ADSTAT_L47.$toremove."</div>";
}
}
$action = intval($action);
switch($action)
{
case 1: case 1:
$text = $stat -> renderTodaysVisits(); $text .= $stat -> renderTodaysVisits(FALSE);
break; break;
case 2: case 2:
$text = $stat -> renderAlltimeVisits(); $text .= $stat -> renderAlltimeVisits(FALSE);
break;
case 12:
if (ADMIN == TRUE)
$text .= $stat -> renderTodaysVisits(TRUE);
break;
case 13:
if (ADMIN == TRUE)
$text .= $stat -> renderAlltimeVisits(TRUE);
break; break;
case 3: case 3:
if($pref['statBrowser']) { if($pref['statBrowser']) {
$text = $stat -> renderBrowsers(); $text .= $stat -> renderBrowsers();
} else { } else {
$text = ADSTAT_L7; $text .= ADSTAT_L7;
} }
break; break;
case 4: case 4:
if($pref['statOs']) { if($pref['statOs']) {
$text = $stat -> renderOses(); $text .= $stat -> renderOses();
} else { } else {
$text = ADSTAT_L7; $text .= ADSTAT_L7;
} }
break; break;
case 5: case 5:
if($pref['statDomain']) { if($pref['statDomain']) {
$text = $stat -> renderDomains(); $text .= $stat -> renderDomains();
} else { } else {
$text = ADSTAT_L7; $text .= ADSTAT_L7;
} }
break; break;
case 6: case 6:
if($pref['statScreen']) { if($pref['statScreen']) {
$text = $stat -> renderScreens(); $text .= $stat -> renderScreens();
} else { } else {
$text = ADSTAT_L7; $text .= ADSTAT_L7;
} }
break; break;
case 7: case 7:
if($pref['statRefer']) { if($pref['statRefer']) {
$text = $stat -> renderRefers(); $text .= $stat -> renderRefers();
} else { } else {
$text = ADSTAT_L7; $text .= ADSTAT_L7;
} }
break; break;
case 8: case 8:
if($pref['statQuery']) { if($pref['statQuery']) {
$text = $stat -> renderQueries(); $text .= $stat -> renderQueries();
} else { } else {
$text = ADSTAT_L7; $text .= ADSTAT_L7;
} }
break; break;
case 9: case 9:
if($pref['statRecent']) { if($pref['statRecent']) {
$text = $stat -> recentVisitors(); $text .= $stat -> recentVisitors();
} else { } else {
$text = ADSTAT_L7; $text .= ADSTAT_L7;
} }
break; break;
case 10: case 10:
$text = $stat -> renderDaily(); $text .= $stat -> renderDaily();
break; break;
case 11: case 11:
$text = $stat -> renderMonthly(); $text .= $stat -> renderMonthly();
break;
case "rem":
$stat -> remove_entry($toremove);
break; break;
default :
$text .= $stat -> renderTodaysVisits(FALSE);
} }
/* render links */
/* render links
1 - Todays visits
2 - All-time
3 - Browser stats
4 - OS Stats
5 - Domain Stats
6 - Screen resolution
7 - Referral stats
8 - Search strings
9 - Recent visitors
10 - Daily Stats
11 - Monthly stats
12 - Today's error page visits
13 - All-time error page visits
*/
$path = e_PLUGIN."log/stats.php"; $path = e_PLUGIN."log/stats.php";
$links = " $links = "
<div style='text-align: center;'>". <div style='text-align: center;'>".
(e_QUERY != 1 ? "<a href='$path?1'>".ADSTAT_L8."</a>" : "<b>".ADSTAT_L8."</b>")." | ". ($action != 1 ? "<a href='{$path}?1'>".ADSTAT_L8."</a>" : "<b>".ADSTAT_L8."</b>")." | ".
(e_QUERY != 2 ? "<a href='$path?2'>".ADSTAT_L9."</a>" : "<b>".ADSTAT_L9."</b>")." | ". ($action != 2 ? "<a href='{$path}?2'>".ADSTAT_L9."</a>" : "<b>".ADSTAT_L9."</b>")." | ".
(e_QUERY != 10 ? "<a href='$path?10'>".ADSTAT_L10."</a>" : "<b>".ADSTAT_L10."</b>")." | ". ($action != 10 ? "<a href='{$path}?10'>".ADSTAT_L10."</a>" : "<b>".ADSTAT_L10."</b>")." | ".
(e_QUERY != 11 ? "<a href='$path?11'>".ADSTAT_L11."</a>" : "<b>".ADSTAT_L11."</b>")." | ". ($action != 11 ? "<a href='{$path}?11'>".ADSTAT_L11."</a>" : "<b>".ADSTAT_L11."</b>")." | ".
(e_QUERY != 3 && $pref['statBrowser'] ? "<a href='$path?3'>".ADSTAT_L12."</a> | " : ($pref['statBrowser'] ? "<b>".ADSTAT_L12."</b> | " : "")). ($action != 3 && $pref['statBrowser'] ? "<a href='{$path}?3'>".ADSTAT_L12."</a> | " : ($pref['statBrowser'] ? "<b>".ADSTAT_L12."</b> | " : "")).
(e_QUERY != 4 && $pref['statOs'] ? "<a href='$path?4'>".ADSTAT_L13."</a> | " : ($pref['statOs'] ? "<b>".ADSTAT_L13."</b> | " : "")). ($action != 4 && $pref['statOs'] ? "<a href='{$path}?4'>".ADSTAT_L13."</a> | " : ($pref['statOs'] ? "<b>".ADSTAT_L13."</b> | " : "")).
(e_QUERY != 5 && $pref['statDomain'] ? "<a href='$path?5'>".ADSTAT_L14."</a> | " : ($pref['statDomain'] ? "<b>".ADSTAT_L14."</b> | " : "")). ($action != 5 && $pref['statDomain'] ? "<a href='{$path}?5'>".ADSTAT_L14."</a> | " : ($pref['statDomain'] ? "<b>".ADSTAT_L14."</b> | " : "")).
(e_QUERY != 6 && $pref['statScreen'] ? "<a href='$path?6'>".ADSTAT_L15."</a> | " : ($pref['statScreen'] ? "<b>".ADSTAT_L15."</b> | " : "")). ($action != 6 && $pref['statScreen'] ? "<a href='{$path}?6'>".ADSTAT_L15."</a> | " : ($pref['statScreen'] ? "<b>".ADSTAT_L15."</b> | " : "")).
(e_QUERY != 7 && $pref['statRefer'] ? "<a href='$path?7'>".ADSTAT_L16."</a> | " : ($pref['statRefer'] ? "<b>".ADSTAT_L16."</b> | " : "")). ($action != 7 && $pref['statRefer'] ? "<a href='{$path}?7'>".ADSTAT_L16."</a> | " : ($pref['statRefer'] ? "<b>".ADSTAT_L16."</b> | " : "")).
(e_QUERY != 8 && $pref['statQuery'] ? "<a href='$path?8'>".ADSTAT_L17."</a> | " : ($pref['statQuery'] ? "<b>".ADSTAT_L17."</b> | " : "")). ($action != 8 && $pref['statQuery'] ? "<a href='{$path}?8'>".ADSTAT_L17."</a> | " : ($pref['statQuery'] ? "<b>".ADSTAT_L17."</b> | " : "")).
(e_QUERY != 9 && $pref['statRecent'] ? "<a href='$path?9'>".ADSTAT_L18."</a>" : ($pref['statRecent'] ? "<b>".ADSTAT_L18."</b>" : "")). ($action != 9 && $pref['statRecent'] ? "<a href='{$path}?9'>".ADSTAT_L18."</a> | " : ($pref['statRecent'] ? "<b>".ADSTAT_L18."</b> | " : ""));
"</div><br /><br />"; if (ADMIN == TRUE)
$links .=
($action != 12 ? "<a href='{$path}?12'>".ADSTAT_L43."</a>" : "<b>".ADSTAT_L43."</b>")." | ".
($action != 13 ? "<a href='{$path}?13'>".ADSTAT_L44."</a>" : "<b>".ADSTAT_L44."</b>");
$links .= "</div><br /><br />";
@@ -501,7 +545,8 @@ class siteStats {
var $filesiteTotal; var $filesiteTotal;
var $filesiteUnique; var $filesiteUnique;
function siteStats() { function siteStats()
{
/* constructor */ /* constructor */
global $sql; global $sql;
@@ -560,7 +605,8 @@ class siteStats {
/* end constructor */ /* end constructor */
} }
function arraySort($array, $column, $order = SORT_DESC){ function arraySort($array, $column, $order = SORT_DESC)
{
/* sorts multi-dimentional array based on which field is passed */ /* sorts multi-dimentional array based on which field is passed */
$i=0; $i=0;
foreach($array as $info) { foreach($array as $info) {
@@ -574,74 +620,131 @@ class siteStats {
/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
function renderTodaysVisits() { function renderTodaysVisits($do_errors = FALSE)
{
/* renders information for today only */ /* renders information for today only */
$totalArray = $this -> arraySort($this -> fileInfo, "ttl");
foreach($totalArray as $key => $info) { $do_errors = $do_errors && ADMIN && getperms("P");
// Now run through and keep either the non-error pages, or the error pages, according to $do_errors
$totalArray = array();
$totalv = 0;
$totalu = 0;
foreach ($this -> fileInfo as $k => $v)
{
$found = (strpos($k,'error/') === 0);
if ($do_errors XOR !$found)
{
$totalArray[$k] = $v;
$total += $v['ttlv'];
}
}
$totalArray = $this -> arraySort($totalArray, "ttl");
foreach($totalArray as $key => $info)
{
$totalv += $info['ttl']; $totalv += $info['ttl'];
$totalu += $info['unq']; $totalu += $info['unq'];
} }
$text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'>".ADSTAT_L19."</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L20."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n"; $text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'>".ADSTAT_L19."</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L20."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
foreach($totalArray as $key => $info) { foreach($totalArray as $key => $info)
if($info['ttl']){ {
if($info['ttl'])
{
$percentage = round(($info['ttl']/$totalv) * 100, 2); $percentage = round(($info['ttl']/$totalv) * 100, 2);
$text .= "<tr>\n<td class='forumheader3' style='width: 20%;'><img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> <a href='".$info['url']."'>".$key."</a> $text .= "<tr>\n<td class='forumheader3' style='width: 20%;'><img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> <a href='".$info['url']."'>".$key."</a>
</td>\n<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info['ttl']." [".$info['unq']."]")."</td>\n<td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td>\n</tr>\n"; </td>\n<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info['ttl']." [".$info['unq']."]")."</td>\n<td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td>\n</tr>\n";
} }
} }
$text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21." [".ADSTAT_L22."]</td><td class='forumheader' style='text-align: center;'>$totalv [$totalu]</td><td class='forumheader'></td></tr></table>"; $text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21." [".ADSTAT_L22."]</td><td class='forumheader' style='text-align: center;'>{$totalv} [{$totalu}]</td><td class='forumheader'></td></tr></table>";
return $text; return $text;
} }
/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
function renderAlltimeVisits() { function renderAlltimeVisits($do_errors = FALSE)
{
/* renders information for alltime, total and unique */ /* renders information for alltime, total and unique */
global $sql; global $sql, $action;
$sql -> db_Select("logstats", "*", "log_id='pageTotal' "); $sql -> db_Select("logstats", "*", "log_id='pageTotal' ");
$row = $sql -> db_Fetch(); $row = $sql -> db_Fetch();
$pageTotal = unserialize($row['log_data']); $pageTotal = unserialize($row['log_data']);
$total = 0;
foreach($this -> fileInfo as $url => $tmpcon) { $can_delete = ADMIN && getperms("P");
$do_errors = $do_errors && $can_delete;
foreach($this -> fileInfo as $url => $tmpcon)
{
$pageTotal[$url]['url'] = $tmpcon['url']; $pageTotal[$url]['url'] = $tmpcon['url'];
$pageTotal[$url]['ttlv'] += $tmpcon['ttl']; $pageTotal[$url]['ttlv'] += $tmpcon['ttl'];
$pageTotal[$url]['unqv'] += $tmpcon['unq']; $pageTotal[$url]['unqv'] += $tmpcon['unq'];
} }
$totalArray = $this -> arraySort($pageTotal, "ttlv"); // Now run through and keep either the non-error pages, or the error pages, according to $do_errors
$totalArray = array();
foreach($totalArray as $key => $info) { foreach ($pageTotal as $k => $v)
$total += $info['ttlv']; {
$found = (strpos($k,'error/') === 0);
if ($do_errors XOR !$found)
{
$totalArray[$k] = $v;
$total += $v['ttlv'];
}
} }
$text .= "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'>".ADSTAT_L19."</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L23."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
foreach($totalArray as $key => $info) { $totalArray = $this -> arraySort($totalArray, "ttlv");
if($info['ttlv']){
$text .= "<table class='fborder' style='width: 100%;'>\n
<colgroup>
<col style='width: 20%;' />
<col style='width: 60%;' />
<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' text-align: center;'>%</td>\n</tr>\n";
foreach($totalArray as $key => $info)
{
if($info['ttlv'])
{
$percentage = round(($info['ttlv']/$total) * 100, 2); $percentage = round(($info['ttlv']/$total) * 100, 2);
$text .= "<tr> $text .= "<tr>
<td class='forumheader3' style='width: 20%;'> <td class='forumheader3' >
".(ADMIN && getperms("P") ? "<a href='".e_SELF."?rem.".$key."'><img src='".e_PLUGIN."log/images/remove.png' alt='".ADSTAT_L39."' title='".ADSTAT_L39."' style='vertical-align: middle; border: 0;' /></a> " : "")." ".($can_delete ? "<a href='".e_SELF."?{$action}.rem.".rawurlencode($key)."'><img src='".e_PLUGIN."log/images/remove.png' alt='".ADSTAT_L39."' title='".ADSTAT_L39."' style='vertical-align: middle; border: 0;' /></a> " : "")."
<img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> <a href='".$info['url']."'>".$key."</a> <img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> <a href='".$info['url']."'>".$key."</a>
"; ";
$text .= "</td> $text .= "</td>
<td class='forumheader3' style='width: 70%;'>".$this->bar($percentage, $info['ttlv'])."</td> <td class='forumheader3' >".$this->bar($percentage, $info['ttlv'])."</td>
<td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td> <td class='forumheader3' style='text-align: center;'>".$percentage."%</td>
</tr>\n"; </tr>\n";
} }
} }
$text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21."</td><td class='forumheader' style='text-align: center;'>$total</td><td class='forumheader'></td></tr>\n</table>"; $text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21."</td><td class='forumheader' style='text-align: center;'>$total</td><td class='forumheader'></td></tr>\n</table>";
$uniqueArray = $this -> arraySort($this -> dbPageInfo, "unqv");
foreach($uniqueArray as $key => $info) { $uniqueArray = array();
$totalv += $info['unqv']; $totalv = 0;
foreach ($this -> dbPageInfo as $k => $v)
{
$found = (strpos($k,'error/') === 0);
if ($do_errors XOR !$found)
{
$uniqueArray[$k] = $v;
$totalv += $v['unqv'];
}
} }
$uniqueArray = $this -> arraySort($uniqueArray, "unqv");
$text .= "<br /><table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'>Page</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L24."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n"; $text .= "<br /><table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'>Page</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L24."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
foreach($uniqueArray as $key => $info) { foreach($uniqueArray as $key => $info)
if($info['ttlv']){ {
$percentage = round(($info['unqv']/$total) * 100, 2); if($info['ttlv'])
{
$percentage = round(($info['unqv']/$totalv) * 100, 2);
$text .= "<tr> $text .= "<tr>
<td class='forumheader3' style='width: 20%;'><img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> <a href='".$info['url']."'>".$key."</a></td> <td class='forumheader3' style='width: 20%;'><img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> <a href='".$info['url']."'>".$key."</a></td>
<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info['unqv'])."</td> <td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info['unqv'])."</td>
@@ -1195,15 +1298,20 @@ class siteStats {
<td style='width:10%; text-align:center' class='forumheader3'>".$val; <td style='width:10%; text-align:center' class='forumheader3'>".$val;
} }
function remove_entry($toremove) { function remove_entry($toremove)
global $sql; { // Note - only removes info from the database - not from the current page file
$sql -> db_Select("logstats", "*", "log_id='pageTotal'"); global $sql;
if ($sql -> db_Select("logstats", "*", "log_id='pageTotal'"))
{
$row = $sql -> db_Fetch(); $row = $sql -> db_Fetch();
$dbPageInfo = unserialize($row[2]); $dbPageInfo = unserialize($row[2]);
unset($dbPageInfo[$toremove]); unset($dbPageInfo[$toremove]);
$dbPageDone = serialize($dbPageInfo); $dbPageDone = serialize($dbPageInfo);
$sql -> db_Update("logstats", "log_data='$dbPageDone' WHERE log_id='pageTotal' "); $sql -> db_Update("logstats", "log_data='{$dbPageDone}' WHERE log_id='pageTotal' ");
$this -> renderAlltimeVisits(); // $this -> renderAlltimeVisits();
return TRUE;
}
return FALSE;
} }
} }

View File

@@ -11,12 +11,16 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/error.php,v $ | $Source: /cvs_backup/e107_0.8/error.php,v $
| $Revision: 1.4 $ | $Revision: 1.5 $
| $Date: 2007-06-13 19:43:01 $ | $Date: 2007-08-14 19:27:22 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
define("ERR_PAGE_ACTIVE",'error');
require_once("class2.php"); require_once("class2.php");
if(!e_QUERY || (e_QUERY != 401 && e_QUERY != 403 && e_QUERY != 404 && e_QUERY != 500)) if(!e_QUERY || (e_QUERY != 401 && e_QUERY != 403 && e_QUERY != 404 && e_QUERY != 500))
{ {
if (E107_DEBUG_LEVEL) if (E107_DEBUG_LEVEL)
@@ -62,6 +66,7 @@ switch(e_QUERY) {
$text .= "<a href='{$base_path}search.php'>".LAN_ERROR_22."</a></p>"; $text .= "<a href='{$base_path}search.php'>".LAN_ERROR_22."</a></p>";
break; break;
case 500: case 500:
header("HTTP/1.1 500 Internal Server Error"); header("HTTP/1.1 500 Internal Server Error");
$text = "<div class='installe'><img src='".e_IMAGE_ABS."packs/".$imode."/generic/warning.png' alt='Error Icon'> ".LAN_ERROR_10."</div><br /><div class='installh'>".LAN_ERROR_11."</div><br /><div class='smalltext'>".LAN_ERROR_12."</div> $text = "<div class='installe'><img src='".e_IMAGE_ABS."packs/".$imode."/generic/warning.png' alt='Error Icon'> ".LAN_ERROR_10."</div><br /><div class='installh'>".LAN_ERROR_11."</div><br /><div class='smalltext'>".LAN_ERROR_12."</div>