mirror of
https://github.com/e107inc/e107.git
synced 2025-07-25 17:01:43 +02:00
Allow include of inline CSS in header, update stats logging
This commit is contained in:
@@ -11,23 +11,23 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/admin_config.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:27 $
|
||||
| $Author: mcfly_e107 $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2007-11-01 20:28:20 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
|
||||
To do:
|
||||
1. Admin log for changes
|
||||
*/
|
||||
|
||||
|
||||
require_once("../../class2.php");
|
||||
if (!getperms("P")) {
|
||||
if (!getperms("P"))
|
||||
{
|
||||
header("location:../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['updateStats']))
|
||||
{
|
||||
header("location: ".e_PLUGIN."log/admin_updateroutine.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(e_ADMIN."auth.php");
|
||||
require_once(e_HANDLER."userclass_class.php");
|
||||
|
||||
@@ -35,17 +35,122 @@ define("LOGPATH", e_PLUGIN."log/");
|
||||
|
||||
include_lan(LOGPATH."languages/admin/".e_LANGUAGE.".php");
|
||||
|
||||
if (e_QUERY)
|
||||
{
|
||||
$sl_qs = explode(".", e_QUERY);
|
||||
}
|
||||
$action = varset($sl_qs[0],'config');
|
||||
$params = varset($sl_qs[1],'');
|
||||
|
||||
|
||||
// List of the non-page-based info which is gathered - historically only 'all-time' stats, now we support monthly as well
|
||||
$stats_list = array('statBrowser'=>ADSTAT_L6,'statOs'=>ADSTAT_L7,'statScreen'=>ADSTAT_L8,'statDomain'=>ADSTAT_L9,'statReferer'=>ADSTAT_L10,'statQuery'=>ADSTAT_L11);
|
||||
|
||||
$separator_list = array(1 => ADSTAT_L57, 2 => ADSTAT_L58);
|
||||
$separator_char = array(1 => ',', 2 => '|');
|
||||
$quote_list = array(1 => ADSTAT_L50, 2 => ADSTAT_L55, 3 => ADSTAT_L56);
|
||||
$quote_char = array(1 => '', 2 => "'", 3 => '"');
|
||||
|
||||
|
||||
//---------------------------------------------
|
||||
// Export data file
|
||||
//---------------------------------------------
|
||||
$export_filter = ''; // can be 'LIKE', 'REGEX', or simple equality
|
||||
$export_type = $tp->toDB(varset($_POST['export_type'],'page')); // Page data or one of the other bits of info
|
||||
$export_date = intval(varset($_POST['export_date'],1));
|
||||
$export2_date = intval(varset($_POST['export2_date'],3));
|
||||
$export_year = intval(varset($_POST['export_year'],date('Y')));
|
||||
$export_month = intval(varset($_POST['export_month'],date('m')));
|
||||
$export_day = intval(varset($_POST['export_day'],date('j')));
|
||||
$export_char = varset($_POST['export_char'], 1);
|
||||
$export_quote = varset($_POST['export_quote'], 1);
|
||||
$export_stripurl = varset($_POST['export_stripurl'], 0);
|
||||
|
||||
if (isset($_POST['create_export']) && (($action == 'export') || ($action == 'datasets')))
|
||||
{
|
||||
$first_date = 0;
|
||||
$last_date = 0;
|
||||
$date_error = FALSE;
|
||||
if ($export_type == 'page')
|
||||
{
|
||||
switch ($export_date)
|
||||
{
|
||||
case '1' : // Single day
|
||||
$first_date = gmmktime(0,0,0,$export_month,$export_day,$export_year);
|
||||
$last_date = $first_date+86399;
|
||||
$export_filter = " `log_id`='".date("Y-m-j",$first_date)."'";
|
||||
break;
|
||||
case '2' : // Daily for a month
|
||||
$first_date = gmmktime(0,0,0,$export_month,1,$export_year);
|
||||
$last_date = gmmktime(0,0,0,$export_month+1,1,$export_year) - 1;
|
||||
$export_filter = " LEFT(`log_id`,8)='".gmstrftime("%Y-%m-",$first_date)."'";
|
||||
break;
|
||||
case '3' : // Monthly for a Year
|
||||
$first_date = gmmktime(0,0,0,1,1,$export_year);
|
||||
$last_date = gmmktime(0,0,0,1,1,$export_year+1) - 1;
|
||||
$export_filter = " LENGTH(`log_id`)=7 AND LEFT(`log_id`,5)='".gmstrftime("%Y-",$first_date)."'";
|
||||
break;
|
||||
case '4' : // Accumulated
|
||||
case '5' :
|
||||
$export_filter = "`log_id`='pageTotal'";
|
||||
$date_error = 'ignore';
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Calculate strings for non-page sources
|
||||
$prefix_len = 0;
|
||||
$export_date = $export2_date;
|
||||
if (isset($stats_list[$export_type]))
|
||||
{
|
||||
$prefix_len = strlen($export_type) + 1;
|
||||
switch ($export2_date)
|
||||
{
|
||||
case '3' : // Monthly for a Year
|
||||
if ($prefix_len > 0)
|
||||
{
|
||||
$first_date = gmmktime(0,0,0,1,1,$export_year);
|
||||
$last_date = gmmktime(0,0,0,1,1,$export_year+1) - 1;
|
||||
$export_filter = " LENGTH(`log_id`)='".($prefix_len + 7)."' AND LEFT(`log_id`,".($prefix_len + 5).")='".$export_type.":".gmstrftime("%Y-",$first_date)."'";
|
||||
}
|
||||
break;
|
||||
case '4' : // Accumulated
|
||||
$export_filter = " `log_id`='".$export_type."'";
|
||||
$date_error = 'ignore';
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = ADSTAT_L54;
|
||||
}
|
||||
}
|
||||
if (($date_error != 'ignore') && (($first_date == 0) || ($last_date == 0) || $date_error))
|
||||
{
|
||||
$message = ADSTAT_L47;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------
|
||||
// Remove page entries
|
||||
//---------------------------------------------
|
||||
if(isset($_POST['openRemPageD']))
|
||||
{
|
||||
rempage();
|
||||
$action = 'rempage';
|
||||
}
|
||||
|
||||
if(isset($_POST['remSelP']))
|
||||
{
|
||||
rempagego();
|
||||
$action = 'rempage';
|
||||
rempagego(); // Do the deletions - then redisplay the list of pages
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------
|
||||
// Wipe accumulated stats
|
||||
//---------------------------------------------
|
||||
if(IsSet($_POST['wipeSubmit']))
|
||||
{
|
||||
foreach($_POST['wipe'] as $key => $wipe)
|
||||
@@ -82,92 +187,110 @@ if(IsSet($_POST['wipeSubmit']))
|
||||
|
||||
|
||||
|
||||
if(!is_writable(LOGPATH."logs")) {
|
||||
$message = "<b>You must set the permissions of the e107_plugins/log/logs folder to 777 (chmod 777)</b>";
|
||||
if(!is_writable(LOGPATH."logs"))
|
||||
{
|
||||
$message = "<b>".ADSTAT_L38."</b>";
|
||||
}
|
||||
|
||||
if (isset($_POST['updatesettings'])) {
|
||||
$pref['statActivate'] = $_POST['statActivate'];
|
||||
if (isset($_POST['updatesettings']))
|
||||
{
|
||||
$pref['statActivate'] = $_POST['statActivate'];
|
||||
$pref['statCountAdmin'] = $_POST['statCountAdmin'];
|
||||
$pref['statUserclass'] = $_POST['statUserclass'];
|
||||
$pref['statBrowser'] = $_POST['statBrowser'];
|
||||
$pref['statOs'] = $_POST['statOs'];
|
||||
$pref['statScreen'] = $_POST['statScreen'];
|
||||
$pref['statDomain'] = $_POST['statDomain'];
|
||||
$pref['statRefer'] = $_POST['statRefer'];
|
||||
$pref['statQuery'] = $_POST['statQuery'];
|
||||
$pref['statRecent'] = $_POST['statRecent'];
|
||||
$pref['statUserclass'] = $_POST['statUserclass'];
|
||||
$pref['statBrowser'] = intval($_POST['statBrowser']);
|
||||
$pref['statOs'] = intval($_POST['statOs']);
|
||||
$pref['statScreen'] = intval($_POST['statScreen']);
|
||||
$pref['statDomain'] = intval($_POST['statDomain']);
|
||||
$pref['statRefer'] = intval($_POST['statRefer']);
|
||||
$pref['statQuery'] = intval($_POST['statQuery']);
|
||||
$pref['statRecent'] = intval($_POST['statRecent']);
|
||||
$pref['statDisplayNumber'] = $_POST['statDisplayNumber'];
|
||||
$pref['statPrevMonth'] = intval($_POST['statPrevMonth']);
|
||||
save_prefs();
|
||||
$message = ADSTAT_L17;
|
||||
}
|
||||
|
||||
|
||||
if (isset($message)) {
|
||||
$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
|
||||
if (isset($message))
|
||||
{
|
||||
$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
|
||||
}
|
||||
|
||||
$text = "<div style='text-align:center'>
|
||||
|
||||
function gen_select($prompt,$name,$value)
|
||||
{
|
||||
$ret = "<div style='padding-bottom: 4px'>".$prompt." "."<select name='{$name}' class='tbox'>\n
|
||||
<option value='0' ".($value == 0 ? " selected='selected'" : "").">".ADSTAT_L50."</option>\n
|
||||
<option value='1' ".($value == 1 ? " selected='selected'" : "").">".ADSTAT_L49."</option>\n
|
||||
<option value='2' ".($value == 2 ? " selected='selected'" : "").">".ADSTAT_L48."</option>\n
|
||||
</select>\n</div>";
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
function data_type_select($name,$value)
|
||||
{
|
||||
global $stats_list;
|
||||
$ret = "<select name='{$name}' class='tbox' onchange=\"settypebox(this.value);\">\n
|
||||
<option value='page' ".($value == 'page' ? " selected='selected'" : "").">".ADSTAT_L52."</option>\n";
|
||||
foreach ($stats_list as $k=>$v)
|
||||
{
|
||||
$ret .= "<option value='{$k}' ".($value == $k ? " selected='selected'" : "").">{$v}</option>\n";
|
||||
}
|
||||
$ret .= "</select>\n";
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
case 'config' :
|
||||
$text = "<div style='text-align:center'>
|
||||
<form method='post' action='".e_SELF."'>
|
||||
<table style='".ADMIN_WIDTH."' class='fborder'>
|
||||
<colgroup>
|
||||
<col style='width:50%' />
|
||||
<col style='width:50%' />
|
||||
</colgroup>
|
||||
|
||||
<tr>
|
||||
<td style='width:50%' class='forumheader3'>".ADSTAT_L4."</td>
|
||||
<td style='width:50%; text-align: right;' class='forumheader3'>
|
||||
<td class='forumheader3'>".ADSTAT_L4."</td>
|
||||
<td style='text-align: right;' class='forumheader3'>
|
||||
<input type='radio' name='statActivate' value='1'".($pref['statActivate'] ? " checked='checked'" : "")." /> ".ADSTAT_ON."
|
||||
<input type='radio' name='statActivate' value='0'".(!$pref['statActivate'] ? " checked='checked'" : "")." /> ".ADSTAT_OFF."
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style='width:50%' class='forumheader3'>".ADSTAT_L18."</td>
|
||||
<td style='width:50%; text-align: right;' class='forumheader3'>".r_userclass("statUserclass", $pref['statUserclass'],'off','public, member, admin, classes')."</td>
|
||||
<td class='forumheader3'>".ADSTAT_L18."</td>
|
||||
<td style='text-align: right;' class='forumheader3'>".r_userclass("statUserclass", $pref['statUserclass'],'off','public, member, admin, classes')."</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style='width:50%' class='forumheader3'>".ADSTAT_L20."</td>
|
||||
<td style='width:50%; text-align: right;' class='forumheader3'>
|
||||
<td class='forumheader3'>".ADSTAT_L20."</td>
|
||||
<td style='text-align: right;' class='forumheader3'>
|
||||
<input type='radio' name='statCountAdmin' value='1'".($pref['statCountAdmin'] ? " checked='checked'" : "")." /> ".ADSTAT_ON."
|
||||
<input type='radio' name='statCountAdmin' value='0'".(!$pref['statCountAdmin'] ? " checked='checked'" : "")." /> ".ADSTAT_OFF."
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style='width:50%' class='forumheader3'>".ADSTAT_L21."</td>
|
||||
<td style='width:50%; text-align: right;' class='forumheader3'>
|
||||
<td class='forumheader3'>".ADSTAT_L21."</td>
|
||||
<td style='text-align: right;' class='forumheader3'>
|
||||
<input class='tbox' type='text' name='statDisplayNumber' size='8' value='".$pref['statDisplayNumber']."' maxlength='3' />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td style='width:50%' class='forumheader3'>".ADSTAT_L5."</td>
|
||||
<td style='width:50%; text-align: right;' class='forumheader3'>
|
||||
".ADSTAT_L6."
|
||||
<input type='radio' name='statBrowser' value='1'".($pref['statBrowser'] ? " checked='checked'" : "")." /> ".ADSTAT_ON."
|
||||
<input type='radio' name='statBrowser' value='0'".(!$pref['statBrowser'] ? " checked='checked'" : "")." /> ".ADSTAT_OFF."<br />
|
||||
|
||||
".ADSTAT_L7."
|
||||
<input type='radio' name='statOs' value='1'".($pref['statOs'] ? " checked='checked'" : "")." /> ".ADSTAT_ON."
|
||||
<input type='radio' name='statOs' value='0'".(!$pref['statOs'] ? " checked='checked'" : "")." /> ".ADSTAT_OFF."<br />
|
||||
|
||||
".ADSTAT_L8."
|
||||
<input type='radio' name='statScreen' value='1'".($pref['statScreen'] ? " checked='checked'" : "")." /> ".ADSTAT_ON."
|
||||
<input type='radio' name='statScreen' value='0'".(!$pref['statScreen'] ? " checked='checked'" : "")." /> ".ADSTAT_OFF."<br />
|
||||
|
||||
".ADSTAT_L9."
|
||||
<input type='radio' name='statDomain' value='1'".($pref['statDomain'] ? " checked='checked'" : "")." /> ".ADSTAT_ON."
|
||||
<input type='radio' name='statDomain' value='0'".(!$pref['statDomain'] ? " checked='checked'" : "")." /> ".ADSTAT_OFF."<br />
|
||||
|
||||
".ADSTAT_L10."
|
||||
<input type='radio' name='statRefer' value='1'".($pref['statRefer'] ? " checked='checked'" : "")." /> ".ADSTAT_ON."
|
||||
<input type='radio' name='statRefer' value='0'".(!$pref['statRefer'] ? " checked='checked'" : "")." /> ".ADSTAT_OFF."<br />
|
||||
|
||||
".ADSTAT_L11."
|
||||
<input type='radio' name='statQuery' value='1'".($pref['statQuery'] ? " checked='checked'" : "")." /> ".ADSTAT_ON."
|
||||
<input type='radio' name='statQuery' value='0'".(!$pref['statQuery'] ? " checked='checked'" : "")." /> ".ADSTAT_OFF."<br />
|
||||
|
||||
".ADSTAT_L19."
|
||||
<td class='forumheader3'>".ADSTAT_L5."</td>
|
||||
<td style='text-align: right' class='forumheader3'>
|
||||
".gen_select(ADSTAT_L6, 'statBrowser',$pref['statBrowser'])
|
||||
.gen_select(ADSTAT_L7, 'statOs',$pref['statOs'])
|
||||
.gen_select(ADSTAT_L8, 'statScreen',$pref['statScreen'])
|
||||
.gen_select(ADSTAT_L9, 'statDomain',$pref['statDomain'])
|
||||
.gen_select(ADSTAT_L10, 'statRefer',$pref['statRefer'])
|
||||
.gen_select(ADSTAT_L11, 'statQuery',$pref['statQuery'])
|
||||
.ADSTAT_L19."
|
||||
<input type='radio' name='statRecent' value='1'".($pref['statRecent'] ? " checked='checked'" : "")." /> ".ADSTAT_ON."
|
||||
<input type='radio' name='statRecent' value='0'".(!$pref['statRecent'] ? " checked='checked'" : "")." /> ".ADSTAT_OFF."<br />
|
||||
|
||||
@@ -175,8 +298,14 @@ $text = "<div style='text-align:center'>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style='width:50%' class='forumheader3'>".ADSTAT_L12."<br /><span class='smalltext'>".ADSTAT_L13."</span></td>
|
||||
<td style='width:50%; text-align: right;' class='forumheader3'>
|
||||
<td class='forumheader3'>".ADSTAT_L78."<br /><span class='smalltext'>".ADSTAT_L79."</span></td>
|
||||
<td style='text-align: right;' class='forumheader3'>
|
||||
<input type='checkbox' name='statPrevMonth' value='1'".(varset($pref['statPrevMonth'],0) ? " checked='checked'" : "")." />
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3'>".ADSTAT_L12."<br /><span class='smalltext'>".ADSTAT_L13."</span></td>
|
||||
<td style='text-align: right;' class='forumheader3'>
|
||||
".ADSTAT_L14."<input type='checkbox' name='wipe[statWipePage]' value='1' /><br />
|
||||
".ADSTAT_L6."<input type='checkbox' name='wipe[statWipeBrowser]' value='1' /><br />
|
||||
".ADSTAT_L7." <input type='checkbox' name='wipe[statWipeOs]' value='1' /><br />
|
||||
@@ -189,17 +318,13 @@ $text = "<div style='text-align:center'>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style='width:50%' class='forumheader3'>".ADSTAT_L26."<br /><span class='smalltext'>".ADSTAT_L27."</span></td>
|
||||
<td style='width:50%; text-align: right;' class='forumheader3'><input class='button' type='submit' name='openRemPageD' value='".ADSTAT_L28."' />
|
||||
<td class='forumheader3'>".ADSTAT_L26."<br /><span class='smalltext'>".ADSTAT_L27."</span></td>
|
||||
<td style='text-align: right;' class='forumheader3'><input class='button' type='submit' name='openRemPageD' value='".ADSTAT_L28."' />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
";
|
||||
|
||||
$text .= "
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td colspan='2' style='text-align:center' class='forumheader'>
|
||||
<input class='button' type='submit' name='updatesettings' value='".ADSTAT_L15."' />
|
||||
@@ -209,12 +334,356 @@ $text = "<div style='text-align:center'>
|
||||
</form>
|
||||
</div>";
|
||||
|
||||
$ns->tablerender(ADSTAT_L16, $text);
|
||||
$ns->tablerender(ADSTAT_L16, $text);
|
||||
break; // case config
|
||||
|
||||
case 'rempage' : // Remove pages
|
||||
rempage();
|
||||
break;
|
||||
|
||||
|
||||
case 'export' : // Export file
|
||||
case 'datasets' :
|
||||
//===========================================================
|
||||
// EXPORT DATA
|
||||
//===========================================================
|
||||
$text = "<div style='text-align:center'>";
|
||||
if ($action == 'export')
|
||||
{
|
||||
$text .= "<form method='post' action='".e_PLUGIN."log/stats_csv.php?export'>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= "<form method='post' action='".e_SELF."?datasets'>";
|
||||
}
|
||||
$text .= "<table style='".ADMIN_WIDTH."' class='fborder'>
|
||||
<colgroup>
|
||||
<col style='width:50%' />
|
||||
<col style='width:50%' />
|
||||
</colgroup>
|
||||
";
|
||||
|
||||
if ($action == 'export')
|
||||
{
|
||||
$text .= "<tr><td class='forumheader3' colspan = '2'>".ADSTAT_L67."</td></tr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= "<tr><td class='forumheader3' colspan = '2'>".ADSTAT_L68."</td></tr>";
|
||||
}
|
||||
|
||||
// Type of output data - page data, browser stats....
|
||||
$text .= "<tr><td class='forumheader3'>".ADSTAT_L51."</td><td class='forumheader3'>\n".data_type_select('export_type',$export_type);
|
||||
|
||||
// Period selection type for page data
|
||||
$text .= "<tr><td class='forumheader3'>".ADSTAT_L41."</td><td class='forumheader3'>\n
|
||||
<select class='tbox' name='export_date' id='export_date' onchange=\"setdatebox(this.value);\" ".($export_type=='page' ? "" : "style='display:none'" ).">\n
|
||||
<option value='1'".($export_date==1 ? " selected='selected'" : "").">".ADSTAT_L42."</option>\n
|
||||
<option value='2'".($export_date==2 ? " selected='selected'" : "").">".ADSTAT_L43."</option>\n
|
||||
<option value='3'".($export_date==3 ? " selected='selected'" : "").">".ADSTAT_L44."</option>\n
|
||||
<option value='4'".($export_date==4 ? " selected='selected'" : "").">".ADSTAT_L45."</option>\n
|
||||
<option value='5'".($export_date==5 ? " selected='selected'" : "").">".ADSTAT_L62."</option>\n
|
||||
</select>";
|
||||
|
||||
// Period selection type for non-page data
|
||||
$text .= "
|
||||
<select class='tbox' name='export2_date' id='export2_date' onchange=\"setdatebox(this.value);\" ".($export_type=='page' ? "style='display:none'" : "").">\n
|
||||
<option value='3'".($export2_date==3 ? " selected='selected'" : "").">".ADSTAT_L44."</option>\n
|
||||
<option value='4'".($export2_date==4 ? " selected='selected'" : "").">".ADSTAT_L45."</option>\n
|
||||
</select>";
|
||||
|
||||
$text .= "</td></tr>";
|
||||
|
||||
|
||||
|
||||
$text .= "<tr><td class='forumheader3'>".ADSTAT_L46."</td><td class='forumheader3'>\n";
|
||||
|
||||
|
||||
// Now put the various dropdowns - their visibility is controlled by the export_type dropdown
|
||||
|
||||
$text .= "<select class='tbox' name='export_day' id='export_day'>\n";
|
||||
for ($i = 1; $i < 32; $i++)
|
||||
{
|
||||
$selected = $export_day == $i ? " selected='selected'" : "";
|
||||
$text .= "<option value='{$i}'{$selected}>{$i}</option>\n";
|
||||
};
|
||||
$text .= "</select>\n ";
|
||||
|
||||
|
||||
$text .= "<select class='tbox' name='export_month' id='export_month'>\n";
|
||||
for ($i = 1; $i < 13; $i++)
|
||||
{
|
||||
$selected = $export_month == $i ? " selected='selected'" : "";
|
||||
$text .= "<option value='{$i}'{$selected}>".nl_langinfo(constant('MON_'.$i))."</option>\n";
|
||||
};
|
||||
$text .= "</select>\n ";
|
||||
|
||||
$this_year = date("Y");
|
||||
$text .= "<select class='tbox' name='export_year' id='export_year'>\n";
|
||||
for ($i = $this_year; $i > $this_year - 6; $i--)
|
||||
{
|
||||
$selected = $export_year == $i ? " selected='selected'" : "";
|
||||
$text .= "<option value='{$i}'{$selected}>{$i}</option>\n";
|
||||
};
|
||||
$text .= "</select>\n ";
|
||||
|
||||
$text .= "<span id='export_cumulative' style='display: none'>".ADSTAT_L53."</span>\n";
|
||||
|
||||
$text .= "</td></tr>";
|
||||
|
||||
|
||||
if ($action == 'export')
|
||||
{
|
||||
// Separators, quotes
|
||||
$text .= "<tr><td class='forumheader3'>".ADSTAT_L59."</td><td class='forumheader3'>\n
|
||||
<select class='tbox' name='export_char'>";
|
||||
foreach ($separator_list as $k=>$v)
|
||||
{
|
||||
$selected = $export_char == $k ? " selected='selected'" : "";
|
||||
$text .= "<option value='{$k}'{$selected}>{$v}</option>\n";
|
||||
}
|
||||
$text .= "</select>\n <select class='tbox' name='export_quote'>\n";
|
||||
foreach ($quote_list as $k=>$v)
|
||||
{
|
||||
$selected = $export_quote == $k ? " selected='selected'" : "";
|
||||
$text .= "<option value='{$k}'{$selected}>{$v}</option>\n";
|
||||
}
|
||||
$text .= "</select>\n</td></tr>";
|
||||
|
||||
$text .= "<tr>
|
||||
<td class='forumheader3'>".ADSTAT_L60."<br /><span class='smalltext'>".ADSTAT_L61."</span></td>
|
||||
<td class='forumheader3'>
|
||||
<input type='checkbox' name='export_stripurl' value='1' ".($export_stripurl == 1 ? " checked='checked'" : "")."/>
|
||||
</td>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
|
||||
if ($export_filter)
|
||||
{
|
||||
if (getperms('0')) $text .= "<tr><td class='forumheader3'>".ADSTAT_L65."</td><td class='forumheader3'>".$export_filter."</td></tr>";
|
||||
$sql -> db_Select("logstats", "log_id", "{$export_filter} ");
|
||||
$text .= "<tr><td class='forumheader3'>".ADSTAT_L64."</td><td class='forumheader3'>";
|
||||
while($row = $sql -> db_Fetch())
|
||||
{
|
||||
$text .= $row['log_id']."<br />";
|
||||
}
|
||||
$text .= "</td></tr>";
|
||||
}
|
||||
|
||||
$text .= "
|
||||
<tr>
|
||||
<td colspan='2' style='text-align:center' class='forumheader'>
|
||||
<input class='button' type='submit' name='create_export' value='".($action == 'export' ? ADSTAT_L37 : ADSTAT_L66)."' />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>";
|
||||
|
||||
// Set up the date display boxes
|
||||
$text .= "<script type=\"text/javascript\"> settypebox('{$export_type}');</script>";
|
||||
|
||||
$ns->tablerender(ADSTAT_L40, $text);
|
||||
break; // case 'export'
|
||||
|
||||
case 'history' :
|
||||
//===========================================================
|
||||
// DELETE HISTORY
|
||||
//===========================================================
|
||||
$text = "<div style='text-align:center'>
|
||||
<form method='post' action='".e_SELF."?history'>
|
||||
<table style='".ADMIN_WIDTH."' class='fborder'>
|
||||
<colgroup>
|
||||
<col style='width:50%' />
|
||||
<col style='width:50%' />
|
||||
</colgroup>";
|
||||
$keep_month = varset($_POST['delete_month'],0);
|
||||
$keep_year = varset($_POST['delete_year'],0);
|
||||
if (isset($_POST['delete_history']))
|
||||
{
|
||||
$text .= "<tr><td class='forumheader3'>".ADSTAT_L72."</td><td class='forumheader3'>".nl_langinfo(constant('MON_'.$keep_month))." ".$keep_year."</td></tr>
|
||||
<tr><td colspan='2' style='text-align:center' class='forumheader'>
|
||||
<input type='hidden' name='delete_month' value='{$keep_month}' />
|
||||
<input type='hidden' name='delete_year' value='{$keep_year}' />
|
||||
<input class='button' type='submit' name='actually_delete' value='".ADSTAT_L73."' /><br />".ADSTAT_L74."
|
||||
</td></tr>";
|
||||
$text .= "<tr><td class='forumheader3'>".ADSTAT_L75."</td><td class='forumheader3'>".implode("<br />",get_for_delete($keep_year,$keep_month))."</td></tr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($_POST['actually_delete']))
|
||||
{
|
||||
$delete_list = get_for_delete($keep_year,$keep_month);
|
||||
// $text .= "<tr><td class='forumheader3' colspan='2'>Data notionally deleted {$keep_month}-{$keep_year}</td></tr>";
|
||||
$text .= "<tr><td class='forumheader3'>".ADSTAT_L77."</td><td class='forumheader3'>";
|
||||
foreach ($delete_list as $k => $v)
|
||||
{
|
||||
$sql->db_Delete('logstats',"log_id='{$k}'");
|
||||
$text .= $v."<br />";
|
||||
}
|
||||
$text .= "</td></tr>";
|
||||
}
|
||||
$text .= "<tr><td class='forumheader3'>".ADSTAT_L70."</td>";
|
||||
$text .= "<td class='forumheader3'><select class='tbox' name='delete_month'>\n";
|
||||
$match_month = date("n");
|
||||
for ($i = 1; $i < 13; $i++)
|
||||
{
|
||||
$selected = $match_month == $i ? " selected='selected'" : "";
|
||||
$text .= "<option value='{$i}'{$selected}>".nl_langinfo(constant('MON_'.$i))."</option>\n";
|
||||
};
|
||||
$text .= "</select>\n ";
|
||||
|
||||
$this_year = date("Y");
|
||||
$text .= "<select class='tbox' name='delete_year' id='export_year'>\n";
|
||||
for ($i = $this_year; $i > $this_year - 6; $i--)
|
||||
{
|
||||
$selected = ($this_year - 2) == $i ? " selected='selected'" : "";
|
||||
$text .= "<option value='{$i}'{$selected}>{$i}</option>\n";
|
||||
};
|
||||
$text .= "</select>\n</td></tr><tr>
|
||||
<td colspan='2' style='text-align:center' class='forumheader'>
|
||||
<input class='button' type='submit' name='delete_history' value='".ADSTAT_L71."' />
|
||||
</td></tr>
|
||||
<td colspan='2' style='text-align:center' class='forumheader3'><em>".ADSTAT_L76."</em>
|
||||
</td></tr>";
|
||||
}
|
||||
$text .= "</table></form></div>";
|
||||
$ns->tablerender(ADSTAT_L69, $text);
|
||||
break; // case 'history'
|
||||
|
||||
}
|
||||
|
||||
|
||||
require_once(e_ADMIN."footer.php");
|
||||
|
||||
|
||||
function headerjs()
|
||||
{
|
||||
$script_js = "<script type=\"text/javascript\">
|
||||
//<![CDATA[
|
||||
var names = new Array();
|
||||
names[0] = 'export_day';
|
||||
names[1] = 'export_month';
|
||||
names[2] = 'export_year';
|
||||
names[3] = 'export_cumulative';
|
||||
|
||||
var dispinfo = new Array();
|
||||
dispinfo[1] = new Array(); // Single day
|
||||
dispinfo[1][0] = '';
|
||||
dispinfo[1][1] = '';
|
||||
dispinfo[1][2] = '';
|
||||
dispinfo[1][3] = 'none';
|
||||
|
||||
dispinfo[2] = new Array(); // Month
|
||||
dispinfo[2][0] = 'none';
|
||||
dispinfo[2][1] = '';
|
||||
dispinfo[2][2] = '';
|
||||
dispinfo[2][3] = 'none';
|
||||
|
||||
dispinfo[3] = new Array(); // Year
|
||||
dispinfo[3][0] = 'none';
|
||||
dispinfo[3][1] = 'none';
|
||||
dispinfo[3][2] = '';
|
||||
dispinfo[3][3] = 'none';
|
||||
|
||||
dispinfo[4] = new Array(); // Specials
|
||||
dispinfo[4][0] = 'none';
|
||||
dispinfo[4][1] = 'none';
|
||||
dispinfo[4][2] = 'none';
|
||||
dispinfo[4][3] = '';
|
||||
|
||||
|
||||
function setdatebox(disptype)
|
||||
{
|
||||
var target;
|
||||
var j;
|
||||
|
||||
if (disptype > 4) disptype = 4;
|
||||
|
||||
for (j = 0; j < names.length; j++)
|
||||
{
|
||||
target = document.getElementById(names[j]).style;
|
||||
target.display = dispinfo[disptype][j];
|
||||
}
|
||||
}
|
||||
|
||||
function settypebox(pagetype)
|
||||
{
|
||||
var newdateformat = 1;
|
||||
var target1 = document.getElementById('export_date');
|
||||
var target2 = document.getElementById('export2_date');
|
||||
if (pagetype == 'page')
|
||||
{
|
||||
target1.style.display = '';
|
||||
target2.style.display = 'none';
|
||||
newdateformat = target1.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
target1.style.display = 'none';
|
||||
target2.style.display = '';
|
||||
newdateformat = target2.value;
|
||||
}
|
||||
setdatebox(newdateformat);
|
||||
}
|
||||
|
||||
//]]>
|
||||
</script>\n";
|
||||
return $script_js;
|
||||
}
|
||||
|
||||
function get_for_delete($keep_year,$keep_month = 1, $filter='*')
|
||||
{
|
||||
global $sql, $stats_list;
|
||||
$ret = array();
|
||||
// Its tedious, but the filter criteria are sufficiently tricky that its probably best to read all records and decide what can go
|
||||
if ($sql->db_Select('logstats','log_id'))
|
||||
{
|
||||
while ($row = $sql->db_Fetch())
|
||||
{
|
||||
$can_go = FALSE;
|
||||
$check = FALSE;
|
||||
$data_type = 'unknown';
|
||||
$date_info = $row['log_id'];
|
||||
if (($temp = strpos($date_info,':')) !== FALSE)
|
||||
{ // its monthly browser stats and similar
|
||||
// echo "Checking {$date_info}, posn = {$temp} ";
|
||||
$data_type = substr($date_info,0,$temp);
|
||||
$date_info = substr($date_info,$temp+1);
|
||||
$check = TRUE;
|
||||
// echo "Date string: {$date_info}, data type: {$data_type}<br />";
|
||||
if (isset($stats_list[$data_type])) $data_type = $stats_list[$data_type];
|
||||
}
|
||||
list($poss_year,$poss_month,$poss_day) = explode('-',$date_info.'--',3);
|
||||
if (!$check)
|
||||
{
|
||||
if (is_numeric($poss_year))
|
||||
{
|
||||
$check = TRUE;
|
||||
if ($poss_day > 0) $data_type = 'daily'; else $data_type = 'monthly';
|
||||
}
|
||||
}
|
||||
if ($check)
|
||||
{
|
||||
if ($keep_year == $poss_year)
|
||||
{
|
||||
if (($poss_month > 0) && ($poss_month < $keep_month)) $can_go = TRUE;
|
||||
}
|
||||
elseif ($keep_year > $poss_year) $can_go = TRUE;
|
||||
}
|
||||
if ($can_go)
|
||||
{
|
||||
$ret[$row['log_id']] = $row['log_id']." - ".$data_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
//---------------------------------------------
|
||||
// Remove page entries - prompt/list
|
||||
//---------------------------------------------
|
||||
function rempage()
|
||||
{
|
||||
global $sql, $ns;
|
||||
@@ -250,9 +719,9 @@ function rempage()
|
||||
{
|
||||
$text .= "
|
||||
<tr>
|
||||
<td style='width:30%' class='forumheader3'>$key</td>
|
||||
<td style='width:30%' class='forumheader3'>{$key}</td>
|
||||
<td style='width:50%' class='forumheader3'>".$page['url']."</td>
|
||||
<td style='width:30%; text-align: center;' class='forumheader3'><input type='checkbox' name='remcb[]' value='$key' /></td>
|
||||
<td style='width:30%; text-align: center;' class='forumheader3'><input type='checkbox' name='remcb[]' value='{$key}' /></td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
@@ -273,6 +742,9 @@ function rempage()
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------
|
||||
// Remove page entries - action
|
||||
//---------------------------------------------
|
||||
function rempagego()
|
||||
{
|
||||
global $sql;
|
||||
@@ -326,11 +798,41 @@ function rempagego()
|
||||
|
||||
$data .= "\n);\n\n?". chr(62);
|
||||
|
||||
if ($handle = fopen($logfile, 'w')) {
|
||||
fwrite($handle, $data);
|
||||
if ($handle = fopen($logfile, 'w'))
|
||||
{
|
||||
fwrite($handle, $data);
|
||||
}
|
||||
fclose($handle);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function admin_config_adminmenu()
|
||||
{
|
||||
if (e_QUERY)
|
||||
{
|
||||
$tmp = explode(".", e_QUERY);
|
||||
$action = $tmp[0];
|
||||
}
|
||||
if (!isset($action) || ($action == "")) $action = "config";
|
||||
|
||||
$var['config']['text'] = ADSTAT_L35;
|
||||
$var['config']['link'] = 'admin_config.php';
|
||||
|
||||
$var['export']['text'] = ADSTAT_L36;
|
||||
$var['export']['link'] ='admin_config.php?export';
|
||||
|
||||
// $var['datasets']['text'] = ADSTAT_L63;
|
||||
// $var['datasets']['link'] ='admin_config.php?datasets';
|
||||
|
||||
$var['rempage']['text'] = ADSTAT_L26;
|
||||
$var['rempage']['link'] ='admin_config.php?rempage';
|
||||
|
||||
$var['history']['text'] = ADSTAT_L69;
|
||||
$var['history']['link'] ='admin_config.php?history';
|
||||
|
||||
show_admin_menu(ADSTAT_L39, $action, $var);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
@@ -11,18 +11,19 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/consolidate.php,v $
|
||||
| $Revision: 1.9 $
|
||||
| $Date: 2007-02-10 15:54:47 $
|
||||
| $Revision: 1.10 $
|
||||
| $Date: 2007-11-01 20:28:21 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
/* first thing to do is check if the log file is out of date ... */
|
||||
|
||||
$pathtologs = e_PLUGIN."log/logs/";
|
||||
$date = date("z.Y", time());
|
||||
$yesterday = date("z.Y",(time() - 86400)); // This makes sure year wraps round OK
|
||||
$date2 = date("Y-m-j", (time() -86400)); // Yesterday's date for the database summary
|
||||
$date3 = date("Y-m"); // Current month's date for monthly summary
|
||||
$date3 = date("Y-m", (time() -86400)); // Current month's date for monthly summary (we're working with yesterday's data)
|
||||
|
||||
$pfileprev = "logp_".$yesterday.".php"; // Yesterday's log file
|
||||
$pfile = "logp_".$date.".php"; // Today's log file
|
||||
@@ -38,7 +39,7 @@ 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("blank");
|
||||
createLog($pathtologs);
|
||||
return FALSE;
|
||||
}
|
||||
// ... if we've got files
|
||||
@@ -47,19 +48,47 @@ else if(!file_exists($pathtologs.$pfileprev))
|
||||
|
||||
|
||||
|
||||
// List of the non-page-based info which is gathered - historically only 'all-time' stats, now we support monthly as well
|
||||
$stats_list = array('statBrowser','statOs','statScreen','statDomain','statReferer','statQuery');
|
||||
|
||||
$qry = "`log_id` IN ('statTotal','statUnique'";
|
||||
foreach ($stats_list as $s)
|
||||
{
|
||||
$qry .= ",'{$s}'"; // Always read the all-time stats
|
||||
if ($pref[$s] == 2) $qry .= ",'{$s}:{$date3}'"; // Look for monthlys as well as cumulative
|
||||
}
|
||||
$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'")) {
|
||||
$infoArray = array();
|
||||
//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))
|
||||
{ // That's read in all the stats we need to modify
|
||||
while($row = $sql -> db_Fetch())
|
||||
{
|
||||
$$row[1] = unserialize($row[2]); // $row[1] is the stats type - save in a variable
|
||||
if($row[1] == "statUnique") $statUnique = $row[2];
|
||||
if($row[1] == "statTotal") $statTotal = $row[2];
|
||||
if($row['log_id'] == "statUnique")
|
||||
{
|
||||
$statUnique = $row['log_data'];
|
||||
}
|
||||
elseif ($row['log_id'] == "statTotal")
|
||||
{
|
||||
$statTotal = $row['log_data'];
|
||||
}
|
||||
elseif (($pos = strpos($row['log_id'],':')) === FALSE)
|
||||
{ // Its all-time stats
|
||||
$$row['log_id'] = unserialize($row['log_data']); // $row['log_id'] is the stats type - save in a variable
|
||||
}
|
||||
else
|
||||
{ // Its monthly stats
|
||||
$row['log_id'] = 'mon_'.substr($row['log_id'],0,$pos); // Create a generic variable for each monthly stats
|
||||
$$row['log_id'] = unserialize($row['log_data']); // $row['log_id'] is the stats type - save in a variable
|
||||
}
|
||||
}
|
||||
}else{
|
||||
/* this must be the first time a consolidation has happened - this will only ever happen once ... */
|
||||
}
|
||||
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', ''");
|
||||
@@ -76,36 +105,58 @@ if($sql -> db_Select("logstats", "*", "log_id='statBrowser' OR log_id='statOs' O
|
||||
$statQuery =array();
|
||||
}
|
||||
|
||||
require_once($pathtologs.$pfileprev);
|
||||
require_once($pathtologs.$ifileprev);
|
||||
|
||||
foreach($browserInfo as $name => $amount) {
|
||||
foreach ($stats_list as $s)
|
||||
{
|
||||
$varname = 'mon_'.$s;
|
||||
if (!isset($$varname)) $$varname = array(); // Create monthly arrays if they don't exist
|
||||
}
|
||||
|
||||
|
||||
require_once($pathtologs.$pfileprev); // Yesterday's page accesses - $pageInfo array
|
||||
require_once($pathtologs.$ifileprev); // Yesterdays browser accesses etc
|
||||
|
||||
foreach($browserInfo as $name => $amount)
|
||||
{
|
||||
$statBrowser[$name] += $amount;
|
||||
$mon_statBrowser[$name] += $amount;
|
||||
}
|
||||
|
||||
foreach($osInfo as $name => $amount) {
|
||||
foreach($osInfo as $name => $amount)
|
||||
{
|
||||
$statOs[$name] += $amount;
|
||||
$mon_statOs[$name] += $amount;
|
||||
}
|
||||
|
||||
foreach($screenInfo as $name => $amount) {
|
||||
foreach($screenInfo as $name => $amount)
|
||||
{
|
||||
$statScreen[$name] += $amount;
|
||||
$mon_statScreen[$name] += $amount;
|
||||
}
|
||||
|
||||
|
||||
foreach($domainInfo as $name => $amount) {
|
||||
if(!is_numeric($name)) {
|
||||
foreach($domainInfo as $name => $amount)
|
||||
{
|
||||
if(!is_numeric($name))
|
||||
{
|
||||
$statDomain[$name] += $amount;
|
||||
$mon_statDomain[$name] += $amount;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($refInfo as $name => $info) {
|
||||
foreach($refInfo as $name => $info)
|
||||
{
|
||||
$statReferer[$name]['url'] = $info['url'];
|
||||
$statReferer[$name]['ttl'] += $info['ttl'];
|
||||
$mon_statReferer[$name]['url'] = $info['url'];
|
||||
$mon_statReferer[$name]['ttl'] += $info['ttl'];
|
||||
}
|
||||
|
||||
|
||||
foreach($searchInfo as $name => $amount) {
|
||||
foreach($searchInfo as $name => $amount)
|
||||
{
|
||||
$statQuery[$name] += $amount;
|
||||
$mon_statQuery[$name] += $amount;
|
||||
}
|
||||
|
||||
$browser = serialize($statBrowser);
|
||||
@@ -118,18 +169,37 @@ $squery = serialize($statQuery);
|
||||
$statTotal += $siteTotal;
|
||||
$statUnique += $siteUnique;
|
||||
|
||||
$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'");
|
||||
// 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'");
|
||||
|
||||
|
||||
/* get monthly info from db */
|
||||
if($sql -> db_Select("logstats", "*", "log_id='$date3' ")) {
|
||||
// Now save the relevant monthly results - only where enabled
|
||||
foreach ($stats_list as $s)
|
||||
{
|
||||
if (isset($pref[$s]) && ($pref[$s] > 1))
|
||||
{ // Value 2 requires saving of monthly stats
|
||||
$srcvar = 'mon_'.$s;
|
||||
$destvar = 'smon_'.$s;
|
||||
$$destvar = serialize($$srcvar);
|
||||
if (!$sql -> db_Update("logstats", "log_data='".$$destvar."' WHERE log_id='".$s.":".$date3."'"))
|
||||
{
|
||||
$sql -> db_Insert("logstats", "0, '".$s.":".$date3."', '".$$destvar."'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* get page access monthly info from db */
|
||||
if($sql -> db_Select("logstats", "*", "log_id='{$date3}' "))
|
||||
{
|
||||
$tmp = $sql -> db_Fetch();
|
||||
$monthlyInfo = unserialize($tmp['log_data']);
|
||||
unset($tmp);
|
||||
@@ -146,10 +216,13 @@ foreach($pageInfo as $key => $info)
|
||||
|
||||
$monthlyinfo = serialize($monthlyInfo);
|
||||
|
||||
if($MonthlyExistsFlag) {
|
||||
$sql -> db_Update("logstats", "log_data='$monthlyinfo' WHERE log_id='$date3'");
|
||||
} else {
|
||||
$sql->db_Insert("logstats", "0, '$date3', '$monthlyinfo'");
|
||||
if($MonthlyExistsFlag)
|
||||
{
|
||||
$sql -> db_Update("logstats", "log_data='{$monthlyinfo}' WHERE log_id='{$date3}'");
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql->db_Insert("logstats", "0, '{$date3}', '{$monthlyinfo}'");
|
||||
}
|
||||
|
||||
|
||||
@@ -174,9 +247,9 @@ foreach($pageInfo as $key => $info)
|
||||
|
||||
$pagetotal = serialize($pageTotal);
|
||||
|
||||
if(!$sql -> db_Update("logstats", "log_data='$pagetotal' WHERE log_id='pageTotal' "))
|
||||
if(!$sql -> db_Update("logstats", "log_data='{$pagetotal}' WHERE log_id='pageTotal' "))
|
||||
{
|
||||
$sql -> db_Insert("logstats", "0, 'pageTotal', '$pagetotal' ");
|
||||
$sql -> db_Insert("logstats", "0, 'pageTotal', '{$pagetotal}' ");
|
||||
}
|
||||
|
||||
|
||||
@@ -215,16 +288,17 @@ if(!unlink($pathtologs.$ifileprev))
|
||||
}
|
||||
|
||||
/* and finally, we need to create new logfiles for today ... */
|
||||
createLog();
|
||||
createLog($pathtologs);
|
||||
/* done! */
|
||||
|
||||
|
||||
function createLog($mode="default")
|
||||
function createLog($pathtologs)
|
||||
{
|
||||
global $pathtologs, $statTotal, $statUnique, $pfile, $ifile;
|
||||
global $statTotal, $statUnique, $pfile, $ifile;
|
||||
if(!is_writable($pathtologs))
|
||||
{
|
||||
echo "Log directory is not writable - please CHMOD ".e_PLUGIN."log/logs to 777";
|
||||
echo '<br />Path to logs: '.$pathtologs;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/languages/English.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2007-08-14 19:27:22 $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2007-11-01 20:28:22 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -43,7 +43,7 @@ define("ADSTAT_L21", "Total");
|
||||
define("ADSTAT_L22", "Unique");
|
||||
define("ADSTAT_L23", "Total Visits");
|
||||
define("ADSTAT_L24", "Total Unique Visits");
|
||||
define("ADSTAT_L25", "No statistics yet.");
|
||||
define("ADSTAT_L25", "No statistics available.");
|
||||
define("ADSTAT_L26", "Browser");
|
||||
define("ADSTAT_L27", "Operating System");
|
||||
define("ADSTAT_L28", "Countries / Domains");
|
||||
@@ -67,8 +67,18 @@ 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", "");
|
||||
define("ADSTAT_L48", "sort by total");
|
||||
define("ADSTAT_L49", "sort alphabetically");
|
||||
define("ADSTAT_L50", "All-time stats");
|
||||
define("ADSTAT_L51", "Current month stats");
|
||||
define("ADSTAT_L52", "Previous month stats");
|
||||
define("ADSTAT_L53", "");
|
||||
define("ADSTAT_L54", "");
|
||||
define("ADSTAT_L55", "");
|
||||
define("ADSTAT_L56", "");
|
||||
define("ADSTAT_L57", "");
|
||||
define("ADSTAT_L58", "");
|
||||
define("ADSTAT_L59", "");
|
||||
define("ADSTAT_L60", "");
|
||||
|
||||
?>
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/languages/admin/English.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2007-05-30 20:49:13 $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2007-11-01 20:28:22 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -31,7 +31,7 @@ define("ADSTAT_L9", "Countries/domains visited from");
|
||||
define("ADSTAT_L10", "Referrers");
|
||||
define("ADSTAT_L11", "Search queries");
|
||||
define("ADSTAT_L12", "Reset stats");
|
||||
define("ADSTAT_L13", "this will erase stats - careful!");
|
||||
define("ADSTAT_L13", "this will erase the all-time stats - careful!<br />There is a separate menu option to delete selected historical data");
|
||||
define("ADSTAT_L14", "Page counts");
|
||||
define("ADSTAT_L15", "Update Statistic Settings");
|
||||
define("ADSTAT_L16", "Site Statistic Settings");
|
||||
@@ -53,6 +53,52 @@ define("ADSTAT_L31", "Remove selected pages");
|
||||
define("ADSTAT_L32", "Page Tidy");
|
||||
define("ADSTAT_L33", "Configure Statistics Logging");
|
||||
define("ADSTAT_L34", "Site Stats");
|
||||
define ('ADSTAT_L35', 'Options');
|
||||
define ('ADSTAT_L36', 'Data Export');
|
||||
define ('ADSTAT_L37', 'Create export file');
|
||||
define ('ADSTAT_L38', "You must set the permissions of the e107_plugins/log/logs folder to 777 (chmod 777)");
|
||||
define ('ADSTAT_L39', 'Stats Logging Functions');
|
||||
define ('ADSTAT_L40', 'Export log data');
|
||||
define ('ADSTAT_L41', 'Date selection');
|
||||
define ('ADSTAT_L42', 'Single Day');
|
||||
define ('ADSTAT_L43', 'Daily for a month');
|
||||
define ('ADSTAT_L44', 'Monthly for a year');
|
||||
define ('ADSTAT_L45', 'All-time');
|
||||
define ('ADSTAT_L46', 'Date:');
|
||||
define ('ADSTAT_L47', 'Invalid date chosen');
|
||||
define ('ADSTAT_L48', 'Monthly and All-time');
|
||||
define ('ADSTAT_L49', 'All-time Only');
|
||||
define ('ADSTAT_L50', 'None');
|
||||
define ('ADSTAT_L51', 'Output Data');
|
||||
define ('ADSTAT_L52', 'Page Data');
|
||||
define ('ADSTAT_L53', 'No selection possible');
|
||||
define ('ADSTAT_L54', 'Invalid type selection');
|
||||
define ('ADSTAT_L55', 'Single quote');
|
||||
define ('ADSTAT_L56', 'Double quote');
|
||||
define ('ADSTAT_L57', 'Comma');
|
||||
define ('ADSTAT_L58', 'Pipe (|)');
|
||||
define ('ADSTAT_L59', 'CSV separator, quotes');
|
||||
define ('ADSTAT_L60', 'Strip site address from URLs');
|
||||
define ('ADSTAT_L61', '(if checked, just gives page reference)');
|
||||
define ('ADSTAT_L62', 'All-time (detailed)');
|
||||
define ('ADSTAT_L63', 'Available Datasets');
|
||||
define ('ADSTAT_L64', 'Database records found:');
|
||||
define ('ADSTAT_L65', 'DB filter string:');
|
||||
define ('ADSTAT_L66', 'Show Datasets');
|
||||
define ('ADSTAT_L67', 'Generate a CSV (Comma Separated Variable) file of historical statistics which meets the specified criteria');
|
||||
define ('ADSTAT_L68', 'Show the statistics database entries which actually exist and meet the selection criteria');
|
||||
define ('ADSTAT_L69', 'Delete historical data');
|
||||
define ('ADSTAT_L70', 'Delete data older than:');
|
||||
define ('ADSTAT_L71', 'Delete Data');
|
||||
define ('ADSTAT_L72', 'Confirm deletion of data older than first day of:');
|
||||
define ('ADSTAT_L73', 'Confirm');
|
||||
define ('ADSTAT_L74', '(List of data entries which will be deleted below)');
|
||||
define ('ADSTAT_L75', 'Records for deletion');
|
||||
define ('ADSTAT_L76', 'Caution! Once deleted, the data cannot be recovered. Backup or export your database first');
|
||||
define ('ADSTAT_L77', 'Records deleted:');
|
||||
define ('ADSTAT_L78', 'Show previous month as well as current month for non-page access stats');
|
||||
define ('ADSTAT_L79', '(Only used if monthly stats collected)');
|
||||
define ('ADSTAT_L80', '');
|
||||
|
||||
|
||||
?>
|
@@ -10,11 +10,9 @@
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| File locking, modified getip() 18.01.07
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/log.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2007-08-14 19:27:22 $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2007-11-01 20:28:21 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -25,27 +23,12 @@
|
||||
// color= colord
|
||||
// eself= eself
|
||||
// res= res
|
||||
// err_direct - optional error flag
|
||||
// err_referer - referrer if came via error page
|
||||
define("log_INIT", TRUE);
|
||||
|
||||
|
||||
$colour = strip_tags((isset($_REQUEST['color']) ? $_REQUEST['color'] : ''));
|
||||
$res = strip_tags((isset($_REQUEST['res']) ? $_REQUEST['res'] : ''));
|
||||
$self = strip_tags((isset($_REQUEST['eself']) ? $_REQUEST['eself'] : ''));
|
||||
$ref = addslashes(strip_tags((isset($_REQUEST['referer']) ? $_REQUEST['referer'] : '')));
|
||||
$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"))
|
||||
{
|
||||
@@ -75,29 +58,24 @@ $pageName = substr($match[1], (strrpos($match[1], "/")+1));
|
||||
$PN = $pageName;
|
||||
$pageName = preg_replace("/".$tagRemove."/si", "", $pageName);
|
||||
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;
|
||||
|
||||
|
||||
$p_handle = fopen($logPfile, 'r+');
|
||||
if($p_handle && flock( $p_handle, LOCK_EX ) )
|
||||
$logPfile = "logs/logp_".$date.".php";
|
||||
$handle = fopen($logPfile, 'r+');
|
||||
if($handle && flock( $handle, LOCK_EX ) )
|
||||
{
|
||||
$log_file_contents = '';
|
||||
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 />";
|
||||
$log_file_contents = get_file_contents($handle);
|
||||
$log_file_contents = str_replace(array('<'.'?php','?>'),'',$log_file_contents);
|
||||
if (eval($log_file_contents) === FALSE) echo "error in log file contents<br />";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Couldn't log data<br /><br /><br /><br />";
|
||||
echo "Couldn't log data<br />";
|
||||
exit;
|
||||
}
|
||||
|
||||
//require_once($logPfile);
|
||||
|
||||
$flag = FALSE;
|
||||
if(array_key_exists($pageName, $pageInfo))
|
||||
@@ -139,12 +117,13 @@ $data = "<?php
|
||||
|
||||
?>";
|
||||
|
||||
if ($p_handle)
|
||||
if ($handle)
|
||||
{
|
||||
ftruncate( $p_handle, 0 );
|
||||
fseek( $p_handle, 0 );
|
||||
fwrite($p_handle, $data);
|
||||
fclose($p_handle);
|
||||
ftruncate( $handle, 0 );
|
||||
// fwrite( $handle, $part_one );
|
||||
// sleep( 10 ); // for test purpose, assume the whole writing process takes 10 seconds
|
||||
fwrite($handle, $data);
|
||||
fclose($handle);
|
||||
}
|
||||
|
||||
|
||||
@@ -154,15 +133,16 @@ function getip($mode=TRUE)
|
||||
if (getenv('HTTP_X_FORWARDED_FOR'))
|
||||
{
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
if (preg_match("#^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})#", getenv('HTTP_X_FORWARDED_FOR'), $ip3))
|
||||
// Shouldn't this be: "#((?:\d{1,3}\.){3}\d{1,3})#" or "#(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})#"
|
||||
if (preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", getenv('HTTP_X_FORWARDED_FOR'), $ip3))
|
||||
{
|
||||
$ip2 = array('#^0\..*#',
|
||||
$ip2 = array('#^0\..*#',
|
||||
'#^127\..*#', // Local loopbacks
|
||||
'#^192\.168\..*#', // RFC1918 - Private Network
|
||||
'#^172\.(?:1[6789]|2\d|3[01])\..*#', // RFC1918 - Private network
|
||||
'#^10\..*#', // RFC1918 - Private Network
|
||||
'#^192\.168\..*#', // Private Network
|
||||
'#^172\.(?:1[6789]|2\d|3[01])\..*#', // Private network
|
||||
'#^10\..*#', // Private Network
|
||||
'#^169\.254\..*#', // RFC3330 - Link-local, auto-DHCP
|
||||
'#^2(?:2[456789]|[345][0-9])\..*#' // Single check for Class D and Class E
|
||||
'#^2[45][0-9]\..*#' // Single check for Class D and Class E
|
||||
);
|
||||
$ip = preg_replace($ip2, $ip, $ip3[1]);
|
||||
}
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/plugin.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2007-05-30 20:49:13 $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2007-11-01 20:28:21 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -24,7 +24,7 @@ if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
// Plugin info -------------------------------------------------------------------------------------------------------
|
||||
$eplug_name = ADSTAT_L3;
|
||||
$eplug_version = "2.0";
|
||||
$eplug_version = "2.1";
|
||||
$eplug_author = "jalist";
|
||||
$eplug_url = "http://e107.org";
|
||||
$eplug_email = "jalist@e107.org";
|
||||
@@ -52,14 +52,14 @@ $eplug_prefTable = "menu_pref";
|
||||
$eplug_prefs = array(
|
||||
"statActivate" => 0,
|
||||
"statUserclass" => "",
|
||||
"statClass" => 0,
|
||||
"statBrowser" => 1,
|
||||
"statOs" => 1,
|
||||
"statScreen" => 1,
|
||||
"statDomain" => 1,
|
||||
"statRefer" => 1,
|
||||
"statQuery" => 1,
|
||||
"statRecent" => 1
|
||||
"statRecent" => 1,
|
||||
"statPrevMonth" => 0
|
||||
);
|
||||
|
||||
// List of table names -----------------------------------------------------------------------------------------------
|
||||
@@ -84,6 +84,9 @@ $eplug_link_url = e_PLUGIN."log/stats.php?1";
|
||||
|
||||
// Text to display after plugin successfully installed ------------------------------------------------------------------
|
||||
$eplug_done = ADSTAT_L2;
|
||||
|
||||
|
||||
$upgrade_add_prefs = array("statPrevMonth" => 0);
|
||||
$upgrade_remove_prefs = array("statClass");
|
||||
|
||||
|
||||
?>
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/stats.php,v $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2007-08-14 19:27:22 $
|
||||
| $Revision: 1.5 $
|
||||
| $Date: 2007-11-01 20:28:21 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -21,7 +21,6 @@ require_once("../../class2.php");
|
||||
@include_once(e_PLUGIN."log/languages/".e_LANGUAGE.".php");
|
||||
@include_once(e_PLUGIN."log/languages/English.php");
|
||||
|
||||
$stat = new siteStats();
|
||||
|
||||
function core_head() {
|
||||
$bar = (file_exists(THEME."images/bar.png") ? THEME."images/bar.png" : e_IMAGE."generic/bar.png");
|
||||
@@ -52,11 +51,13 @@ if (!$pref['statActivate']) {
|
||||
$qs = explode('.', e_QUERY, 3);
|
||||
$action = varset($qs[0],1);
|
||||
$sec_action = varset($qs[1],FALSE);
|
||||
$order = varset($qs[2],0);
|
||||
$order = varset($qs[1],0); // Sort order
|
||||
|
||||
$toremove = $order;
|
||||
$toremove = varset($qs[2],'');
|
||||
$order = intval($order);
|
||||
|
||||
$stat = new siteStats();
|
||||
|
||||
if($stat -> error)
|
||||
{
|
||||
$ns->tablerender(ADSTAT_L6, $stat -> error);
|
||||
@@ -393,6 +394,19 @@ $country["zw"] = "Zimbabwe";
|
||||
8: search engine strings
|
||||
*/
|
||||
|
||||
function display_pars($rec_pars, $disp_pars = '*')
|
||||
{
|
||||
global $pref;
|
||||
switch ($rec_pars)
|
||||
{
|
||||
case 1 : return array(1);
|
||||
case 2 : if (varset($pref['statPrevMonth'],0)) return array(2,3,1); else return array(2,1);
|
||||
case 3 : return array(2,3,1);
|
||||
default : return array();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$text = '';
|
||||
if ((ADMIN == TRUE) && ($sec_action == "rem"))
|
||||
{
|
||||
@@ -425,61 +439,83 @@ switch($action)
|
||||
if (ADMIN == TRUE)
|
||||
$text .= $stat -> renderAlltimeVisits(TRUE);
|
||||
break;
|
||||
case 3:
|
||||
if($pref['statBrowser']) {
|
||||
$text .= $stat -> renderBrowsers();
|
||||
} else {
|
||||
case 3 :
|
||||
case 14 :
|
||||
if($pref['statBrowser'])
|
||||
{
|
||||
$text .= $stat -> renderBrowsers(display_pars($pref['statBrowser']), $action==3);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= ADSTAT_L7;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if($pref['statOs']) {
|
||||
$text .= $stat -> renderOses();
|
||||
} else {
|
||||
if($pref['statOs'])
|
||||
{
|
||||
$text .= $stat -> renderOses(display_pars($pref['statOs']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= ADSTAT_L7;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if($pref['statDomain']) {
|
||||
$text .= $stat -> renderDomains();
|
||||
} else {
|
||||
if($pref['statDomain'])
|
||||
{
|
||||
$text .= $stat -> renderDomains(display_pars($pref['statDomain']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= ADSTAT_L7;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if($pref['statScreen']) {
|
||||
$text .= $stat -> renderScreens();
|
||||
} else {
|
||||
if($pref['statScreen'])
|
||||
{
|
||||
$text .= $stat -> renderScreens(display_pars($pref['statScreen']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= ADSTAT_L7;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if($pref['statRefer']) {
|
||||
$text .= $stat -> renderRefers();
|
||||
} else {
|
||||
if ($pref['statRefer'])
|
||||
{
|
||||
$text .= $stat -> renderRefers(display_pars($pref['statRefer']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= ADSTAT_L7;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
if($pref['statQuery']) {
|
||||
$text .= $stat -> renderQueries();
|
||||
} else {
|
||||
if ($pref['statQuery'])
|
||||
{
|
||||
$text .= $stat -> renderQueries(display_pars($pref['statQuery']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= ADSTAT_L7;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if($pref['statRecent']) {
|
||||
if ($pref['statRecent'])
|
||||
{
|
||||
$text .= $stat -> recentVisitors();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= ADSTAT_L7;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
$text .= $stat -> renderDaily();
|
||||
break;
|
||||
$text .= $stat -> renderDaily();
|
||||
break;
|
||||
case 11:
|
||||
$text .= $stat -> renderMonthly();
|
||||
break;
|
||||
$text .= $stat -> renderMonthly();
|
||||
break;
|
||||
default :
|
||||
$text .= $stat -> renderTodaysVisits(FALSE);
|
||||
}
|
||||
@@ -500,6 +536,7 @@ switch($action)
|
||||
11 - Monthly stats
|
||||
12 - Today's error page visits
|
||||
13 - All-time error page visits
|
||||
14 - Consolidated browser view (not listed as a menu option)
|
||||
*/
|
||||
|
||||
$path = e_PLUGIN."log/stats.php";
|
||||
@@ -527,7 +564,40 @@ $links .= "</div><br /><br />";
|
||||
$ns->tablerender(ADSTAT_L6, $links.$text);
|
||||
require_once(FOOTERF);
|
||||
|
||||
class siteStats {
|
||||
|
||||
function make_bits($prefix, $act)
|
||||
{
|
||||
$ret = array();
|
||||
$now = getdate();
|
||||
$ret['hdg_extra'] = '';
|
||||
switch ($act)
|
||||
{
|
||||
case 1 :
|
||||
$ret['query'] = "log_id='{$prefix}'";
|
||||
break;
|
||||
case 2 :
|
||||
$ret['query'] = "log_id='{$prefix}:".date("Y-m")."'";
|
||||
$ret['hdg_extra'] = " (".$now['mon']."-".$now['year'].")";
|
||||
break;
|
||||
case 3 :
|
||||
$now['mon']--;
|
||||
if ($now['mon']==0)
|
||||
{
|
||||
$now['mon'] = 12;
|
||||
$now['year']--;
|
||||
}
|
||||
$ret['query'] = "log_id='{$prefix}:".sprintf("%04d-%02d",$now['year'],$now['mon'])."'";
|
||||
$ret['hdg_extra'] = " (".$now['mon']."-".$now['year'].")";
|
||||
break;
|
||||
default: $ret = "Invalid selection: {$act}<br />";
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
class siteStats
|
||||
{
|
||||
var $browser_headings = array(1 => ADSTAT_L50, 2 => ADSTAT_L51, 3 => ADSTAT_L52);
|
||||
|
||||
var $dbPageInfo;
|
||||
var $fileInfo;
|
||||
@@ -706,11 +776,12 @@ class siteStats {
|
||||
<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";
|
||||
<td class='fcaption' colspan='2'>".ADSTAT_L23."</td>\n<td class='fcaption' style='text-align: center;'>%</td>\n</tr>\n";
|
||||
foreach($totalArray as $key => $info)
|
||||
{
|
||||
if($info['ttlv'])
|
||||
{
|
||||
if (!$info['url'] && (($key == 'index') || (strpos($key,':index') !== FALSE))) $info['url'] = e_BASE.'index.php'; // Avoids empty link
|
||||
$percentage = round(($info['ttlv']/$total) * 100, 2);
|
||||
$text .= "<tr>
|
||||
<td class='forumheader3' >
|
||||
@@ -723,7 +794,7 @@ class siteStats {
|
||||
</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 = array();
|
||||
@@ -744,6 +815,7 @@ class siteStats {
|
||||
{
|
||||
if($info['ttlv'])
|
||||
{
|
||||
if (!$info['url'] && (($key == 'index') || (strpos($key,':index') !== FALSE))) $info['url'] = e_BASE.'index.php'; // Avoids empty link
|
||||
$percentage = round(($info['unqv']/$totalv) * 100, 2);
|
||||
$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>
|
||||
@@ -758,88 +830,177 @@ class siteStats {
|
||||
|
||||
/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
function renderBrowsers() {
|
||||
global $sql, $browser_map;
|
||||
// List browsers. $selection is an array of the info required - '2' = current month's stats, '1' = all-time stats (default)
|
||||
// If $show_version is FALSE, browsers are consolidated across versions - e.g. 1 line for Firefox
|
||||
function renderBrowsers($selection, $show_version=TRUE)
|
||||
{
|
||||
global $sql, $browser_map;
|
||||
if (!$selection) $selection = array(1);
|
||||
if (!is_array($selection)) $selection = array(1);
|
||||
$text = '';
|
||||
|
||||
if($entries = $sql -> db_Select("logstats", "*", "log_id='statBrowser'")) {
|
||||
echo "Show browsers; expanded = ".($show_version ? 'TRUE' : 'FALSE')."<br />";
|
||||
foreach ($selection as $act)
|
||||
{
|
||||
unset($statBrowser);
|
||||
$statBrowser = array();
|
||||
|
||||
$pars = make_bits('statBrowser',$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']))
|
||||
{
|
||||
$row = $sql -> db_Fetch();
|
||||
$statBrowser = unserialize($row['log_data']);
|
||||
}
|
||||
|
||||
/* temp consolidate today's data ... */
|
||||
foreach($this -> fileBrowserInfo as $name => $count) {
|
||||
if (($act == 1) || ($act == 2))
|
||||
{
|
||||
foreach($this -> fileBrowserInfo as $name => $count)
|
||||
{
|
||||
$statBrowser[$name] += $count;
|
||||
}
|
||||
}
|
||||
|
||||
if ($show_version == FALSE)
|
||||
{
|
||||
$temp_array = array();
|
||||
foreach ($statBrowser as $b_full=>$v)
|
||||
{
|
||||
$b_type = '';
|
||||
foreach ($browser_map as $name => $file)
|
||||
{
|
||||
if(stristr($b_full, $name) === 0)
|
||||
{ // Match here
|
||||
$b_type = $name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$b_type) $b_type = $b_full; // Default is an unsupported browser - use the whole name
|
||||
|
||||
if (array_key_exists($temp_array,$b_type))
|
||||
{
|
||||
$temp_array[$b_type] += $v;
|
||||
}
|
||||
else
|
||||
{
|
||||
$temp_array[$b_type] = $v; // New browser found
|
||||
}
|
||||
}
|
||||
$statBrowser = $temp_array;
|
||||
unset($temp_array);
|
||||
}
|
||||
|
||||
if(!is_array($statBrowser)) {
|
||||
return "<div style='text-align: center;'>".ADSTAT_L25."</div>";
|
||||
}
|
||||
|
||||
if(is_array($statBrowser)) {
|
||||
if($this -> order) {
|
||||
if ($this -> order)
|
||||
{
|
||||
ksort($statBrowser);
|
||||
reset ($statBrowser);
|
||||
$browserArray = $statBrowser;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$browserArray = $this -> arraySort($statBrowser, 0);
|
||||
}
|
||||
$total = array_sum($browserArray);
|
||||
$text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'><a title='".($this -> order ? "sort by total" : "sort alphabetically")."'href='".e_SELF."?3".($this -> order ? "" : ".1" )."'>".ADSTAT_L26."</a></td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
|
||||
|
||||
foreach($browserArray as $key => $info) {
|
||||
$total = array_sum($browserArray);
|
||||
|
||||
$text .= "<table class='fborder' style='width: 100%;'>\n
|
||||
<tr><td class='fcaption' colspan='4' style='text-align:center'>".$this->browser_headings[$act].$pars['hdg_extra']."</td></tr>\n
|
||||
<tr><td class='fcaption' style='width: 20%;'>
|
||||
<a title='".($this -> order ? ADSTAT_L48 : ADSTAT_L49)."' href='".e_SELF."?3".($this -> order ? "" : ".1" )."'>".ADSTAT_L26."</a>
|
||||
</td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L21."</td>\n
|
||||
<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
|
||||
|
||||
if (count($browserArray))
|
||||
{
|
||||
foreach($browserArray as $key => $info)
|
||||
{
|
||||
$image = "";
|
||||
foreach ($browser_map as $name => $file) {
|
||||
if(strstr($key, $name)) {
|
||||
foreach ($browser_map as $name => $file)
|
||||
{
|
||||
if(strstr($key, $name))
|
||||
{
|
||||
$image = "{$file}.png";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($image == "") {
|
||||
if($image == "")
|
||||
{
|
||||
$image = "unknown.png";
|
||||
}
|
||||
$percentage = round(($info/$total) * 100, 2);
|
||||
$text .= "<tr>
|
||||
<td class='forumheader3' style='width: 20%;'>".($image ? "<img src='".e_PLUGIN."log/images/$image' alt='' style='vertical-align: middle;' /> " : "").$key."</td>".
|
||||
<td class='forumheader3' style='width: 20%;'>".($image ? "<img src='".e_PLUGIN."log/images/{$image}' alt='' style='vertical-align: middle;' /> " : "").$key."</td>".
|
||||
($entries == 1 ? "<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info)."</td>" : "<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info)."</td>")."
|
||||
<td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td>
|
||||
</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";
|
||||
}
|
||||
$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>";
|
||||
}
|
||||
return $text;
|
||||
else
|
||||
{
|
||||
$text .= "<tr><td class='fcaption' colspan='4' style='text-align:center'>".ADSTAT_L25."</td></tr>\n";
|
||||
}
|
||||
$text .= "</table><br />";
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
function renderOses() {
|
||||
global $sql;
|
||||
function renderOses($selection)
|
||||
{
|
||||
global $sql;
|
||||
if (!$selection) $selection = array(1);
|
||||
if (!is_array($selection)) $selection = array(1);
|
||||
$text = '';
|
||||
|
||||
if($entries = $sql -> db_Select("logstats", "*", "log_id='statOs'")) {
|
||||
$statOs = array();
|
||||
foreach ($selection as $act)
|
||||
{
|
||||
$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']))
|
||||
{
|
||||
$row = $sql -> db_Fetch();
|
||||
$statOs = unserialize($row['log_data']);
|
||||
}
|
||||
|
||||
/* temp consolidate today's data ... */
|
||||
foreach($this -> fileOsInfo as $name => $count) {
|
||||
if (($act == 1) || ($act == 2))
|
||||
{
|
||||
foreach($this -> fileOsInfo as $name => $count)
|
||||
{
|
||||
$statOs[$name] += $count;
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_array($statOs)) {
|
||||
return "<div style='text-align: center;'>".ADSTAT_L25.".</div>";
|
||||
}
|
||||
|
||||
if($this -> order) {
|
||||
if($this -> order)
|
||||
{
|
||||
ksort($statOs);
|
||||
reset ($statOs);
|
||||
$osArray = $statOs;
|
||||
} else {
|
||||
$osArray = $this -> arraySort($statOs, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$osArray = $this -> arraySort($statOs, 0);
|
||||
}
|
||||
|
||||
$total = array_sum($osArray);
|
||||
$text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'><a title='".($this -> order ? "sort by total" : "sort alphabetically")."'href='".e_SELF."?4".($this -> order ? "" : ".1" )."'>".ADSTAT_L27."</a></td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
|
||||
foreach($osArray as $key => $info) {
|
||||
|
||||
$text .= "<table class='fborder' style='width: 100%;'>\n
|
||||
<tr><td class='fcaption' colspan='4' style='text-align:center'>".$this->browser_headings[$act].$pars['hdg_extra']."</td></tr>\n
|
||||
<tr>\n<td class='fcaption' style='width: 20%;'>
|
||||
<a title='".($this -> order ? "sort by total" : "sort alphabetically")."' href='".e_SELF."?4".($this -> order ? "" : ".1" )."'>".ADSTAT_L27."</a></td>\n
|
||||
<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
|
||||
|
||||
if (count($osArray))
|
||||
{
|
||||
foreach($osArray as $key => $info)
|
||||
{
|
||||
$image = "";
|
||||
if(strstr($key, "Windows")) { $image = "windows.png"; }
|
||||
if(strstr($key, "Mac")) { $image = "mac.png"; }
|
||||
@@ -858,42 +1019,73 @@ class siteStats {
|
||||
($entries == 1 ? "<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info)."</td>" : "<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info)."</td>")."
|
||||
<td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td>
|
||||
</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";
|
||||
}
|
||||
$text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21."</td><td class='forumheader' style='text-align: center;'>$total</td><td class='forumheader'></tr></tr>\n</table>";
|
||||
return $text;
|
||||
else
|
||||
{
|
||||
$text .= "<tr><td class='fcaption' colspan='4' style='text-align:center'>".ADSTAT_L25."</td></tr>\n";
|
||||
}
|
||||
$text .= "</table><br />";
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
function renderDomains() {
|
||||
function renderDomains($selection)
|
||||
{
|
||||
global $sql;
|
||||
|
||||
if($sql -> db_Select("logstats", "*", "log_id='statDomain'")) {
|
||||
if (!$selection) $selection = array(1);
|
||||
if (!is_array($selection)) $selection = array(1);
|
||||
$text = '';
|
||||
|
||||
$statDom = array();
|
||||
foreach ($selection as $act)
|
||||
{
|
||||
$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", "*", $pars['query']))
|
||||
{
|
||||
$row = $sql -> db_Fetch();
|
||||
$statDom = unserialize($row['log_data']);
|
||||
}
|
||||
|
||||
/* temp consolidate today's data ... */
|
||||
foreach($this -> fileDomainInfo as $name => $count) {
|
||||
if (($act == 1) || ($act == 2))
|
||||
{
|
||||
foreach($this -> fileDomainInfo as $name => $count)
|
||||
{
|
||||
$statDom[$name] += $count;
|
||||
}
|
||||
}
|
||||
|
||||
if(!count($statDom)) {
|
||||
return "<div style='text-align: center;'>".ADSTAT_L25.".</div>";
|
||||
}
|
||||
|
||||
if($this -> order) {
|
||||
if($this -> order)
|
||||
{
|
||||
ksort($statDom);
|
||||
reset ($statDom);
|
||||
$domArray = $statDom;
|
||||
} else {
|
||||
$domArray = $this -> arraySort($statDom, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$domArray = $this -> arraySort($statDom, 0);
|
||||
}
|
||||
|
||||
$total = array_sum($domArray);
|
||||
$text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'><a title='".($this -> order ? "sort by total" : "sort alphabetically")."'href='".e_SELF."?5".($this -> order ? "" : ".1" )."'>".ADSTAT_L28."</a></td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
|
||||
foreach($domArray as $key => $info) {
|
||||
if($key = $this -> getcountry($key)) {
|
||||
$text .= "<table class='fborder' style='width: 100%;'>\n
|
||||
<tr><td class='fcaption' colspan='4' style='text-align:center'>".$this->browser_headings[$act].$pars['hdg_extra']."</td></tr>\n
|
||||
<tr>\n<td class='fcaption' style='width: 20%;'>
|
||||
<a title='".($this -> order ? "sort by total" : "sort alphabetically")."' href='".e_SELF."?5".($this -> order ? "" : ".1" )."'>".ADSTAT_L28."</a></td>\n
|
||||
<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
|
||||
|
||||
if (count($domArray))
|
||||
{
|
||||
foreach($domArray as $key => $info)
|
||||
{
|
||||
if($key = $this -> getcountry($key))
|
||||
{
|
||||
$percentage = round(($info/$total) * 100, 2);
|
||||
$text .= "<tr>
|
||||
<td class='forumheader3' style='width: 20%;'>".$key."</td>
|
||||
@@ -901,31 +1093,52 @@ class siteStats {
|
||||
<td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td>
|
||||
</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";
|
||||
}
|
||||
$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>";
|
||||
else
|
||||
{
|
||||
$text .= "<tr><td class='fcaption' colspan='4' style='text-align:center'>".ADSTAT_L25."</td></tr>\n";
|
||||
}
|
||||
$text .= "</table><br />";
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
function renderScreens() {
|
||||
function renderScreens($selection)
|
||||
{
|
||||
global $sql;
|
||||
|
||||
if($entries = $sql -> db_Select("logstats", "*", "log_id='statScreen'")) {
|
||||
if (!$selection) $selection = array(1);
|
||||
if (!is_array($selection)) $selection = array(1);
|
||||
$text = '';
|
||||
|
||||
$statScreen = array();
|
||||
foreach ($selection as $act)
|
||||
{
|
||||
$pars = make_bits('statScreen',$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']))
|
||||
{
|
||||
$row = $sql -> db_Fetch();
|
||||
$statScreen = unserialize($row['log_data']);
|
||||
}
|
||||
|
||||
/* temp consolidate today's data ... */
|
||||
foreach($this -> fileScreenInfo as $name => $count) {
|
||||
if (($act == 1) || ($act == 2))
|
||||
{
|
||||
foreach($this -> fileScreenInfo as $name => $count)
|
||||
{
|
||||
$statScreen[$name] += $count;
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_array($statScreen)) {
|
||||
return "<div style='text-align: center;'>".ADSTAT_L25."</div>";
|
||||
}
|
||||
|
||||
if($this -> order) {
|
||||
if($this -> order)
|
||||
{
|
||||
$nsarray = array();
|
||||
foreach($statScreen as $key => $info) {
|
||||
if(preg_match("/(\d+)x/", $key, $match)) {
|
||||
@@ -939,14 +1152,23 @@ class siteStats {
|
||||
$screenArray[$key] = $info['info'];
|
||||
}
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$screenArray = $this -> arraySort($statScreen, 0);
|
||||
}
|
||||
|
||||
$total = array_sum($screenArray);
|
||||
$text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 20%;'><a title='".($this -> order ? "sort by total" : "sort alphabetically")."'href='".e_SELF."?6".($this -> order ? "" : ".1" )."'>".ADSTAT_L29."</a></td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
|
||||
foreach($screenArray as $key => $info) {
|
||||
if(strstr($key, "@") && !strstr($key, "undefined") && preg_match("/(\d+)x(\d+)@(\d+)/", $key)) {
|
||||
$text .= "<table class='fborder' style='width: 100%;'>\n
|
||||
<tr><td class='fcaption' colspan='4' style='text-align:center'>".$this->browser_headings[$act].$pars['hdg_extra']."</td></tr>\n
|
||||
<tr>\n<td class='fcaption' style='width: 20%;'><a title='".($this -> order ? "sort by total" : "sort alphabetically")."' href='".e_SELF."?6".($this -> order ? "" : ".1" )."'>".ADSTAT_L29."</a></td>\n<td class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
|
||||
|
||||
if (count($screenArray))
|
||||
{
|
||||
foreach($screenArray as $key => $info)
|
||||
{
|
||||
if(strstr($key, "@") && !strstr($key, "undefined") && preg_match("/(\d+)x(\d+)@(\d+)/", $key))
|
||||
{
|
||||
$percentage = round(($info/$total) * 100, 2);
|
||||
$text .= "<tr>
|
||||
<td class='forumheader3' style='width: 20%;'><img src='".e_PLUGIN."log/images/screen.png' alt='' style='vertical-align: middle;' /> ".$key."</td>".
|
||||
@@ -954,45 +1176,68 @@ class siteStats {
|
||||
<td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td>
|
||||
</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";
|
||||
}
|
||||
$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>";
|
||||
return $text;
|
||||
else
|
||||
{
|
||||
$text .= "<tr><td class='fcaption' colspan='4' style='text-align:center'>".ADSTAT_L25."</td></tr>\n";
|
||||
}
|
||||
$text .= "</table><br />";
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
function renderRefers() {
|
||||
function renderRefers($selection)
|
||||
{
|
||||
global $sql, $pref;
|
||||
|
||||
if($sql -> db_Select("logstats", "*", "log_id='statReferer'")) {
|
||||
if (!$selection) $selection = array(1);
|
||||
if (!is_array($selection)) $selection = array(1);
|
||||
$text = '';
|
||||
|
||||
$statRefer = array();
|
||||
foreach ($selection as $act)
|
||||
{
|
||||
$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", "*", $pars['query']))
|
||||
{
|
||||
$row = $sql -> db_Fetch();
|
||||
$statRefer = unserialize($row['log_data']);
|
||||
}
|
||||
|
||||
/* temp consolidate today's data ... */
|
||||
foreach($this -> fileReferInfo as $name => $count) {
|
||||
if (($act == 1) || ($act == 2))
|
||||
{
|
||||
foreach($this -> fileReferInfo as $name => $count)
|
||||
{
|
||||
$statRefer[$name]['url'] = $count['url'];
|
||||
$statRefer[$name]['ttl'] += $count['ttl'];
|
||||
}
|
||||
|
||||
//echo "<pre>"; print_r($statRefer); echo "</pre>"; exit;
|
||||
|
||||
if(!is_array($statRefer) || !count($statRefer)) {
|
||||
return "<div style='text-align: center;'>".ADSTAT_L25.".</div>";
|
||||
}
|
||||
}
|
||||
|
||||
$statArray = $this -> arraySort($statRefer, 'ttl');
|
||||
|
||||
$total = 0;
|
||||
foreach($statArray as $key => $info) {
|
||||
foreach ($statArray as $key => $info)
|
||||
{
|
||||
$total += $info['ttl'];
|
||||
}
|
||||
|
||||
$text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 40%;'><a title='".($this -> order ? "show cropped url" : "show full url")."'href='".e_SELF."?7".($this -> order ? "" : ".1" )."'>".ADSTAT_L30."</a></td>\n<td class='fcaption' style='width: 50%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
|
||||
$text .= "<table class='fborder' style='width: 100%;'>\n
|
||||
<tr><td class='fcaption' colspan='4' style='text-align:center'>".$this->browser_headings[$act].$pars['hdg_extra']."</td></tr>\n
|
||||
<tr>\n<td class='fcaption' style='width: 40%;'><a title='".($this -> order ? "show cropped url" : "show full url")."' href='".e_SELF."?7".($this -> order ? "" : ".1" )."'>".ADSTAT_L30."</a></td>\n<td class='fcaption' style='width: 50%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
|
||||
$count = 0;
|
||||
foreach($statArray as $key => $info) {
|
||||
if (count($statArray))
|
||||
{
|
||||
foreach($statArray as $key => $info)
|
||||
{
|
||||
$percentage = round(($info['ttl']/$total) * 100, 2);
|
||||
if (!$this -> order && strlen($key) > 50) {
|
||||
if (!$this -> order && strlen($key) > 50)
|
||||
{
|
||||
$key = substr($key, 0, 50)." ...";
|
||||
}
|
||||
$text .= "<tr>
|
||||
@@ -1001,38 +1246,64 @@ class siteStats {
|
||||
<td class='forumheader3' style='text-align: center;'>".$percentage."%</td>
|
||||
</tr>\n";
|
||||
$count++;
|
||||
if($count == $pref['statDisplayNumber']) {
|
||||
break;
|
||||
if($count == $pref['statDisplayNumber'])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
$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";
|
||||
}
|
||||
$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>";
|
||||
return $text;
|
||||
else
|
||||
{
|
||||
$text .= "<tr><td class='fcaption' colspan='4' style='text-align:center'>".ADSTAT_L25."</td></tr>\n";
|
||||
}
|
||||
$text .= "</table><br />";
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
function renderQueries() {
|
||||
function renderQueries($selection)
|
||||
{
|
||||
global $sql;
|
||||
|
||||
if($sql -> db_Select("logstats", "*", "log_id='statQuery'")) {
|
||||
if (!$selection) $selection = array(1);
|
||||
if (!is_array($selection)) $selection = array(1);
|
||||
$text = '';
|
||||
|
||||
$statQuery = array();
|
||||
foreach ($selection as $act)
|
||||
{
|
||||
$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']))
|
||||
{
|
||||
$row = $sql -> db_Fetch();
|
||||
$statQuery = unserialize($row['log_data']);
|
||||
}
|
||||
|
||||
/* temp consolidate today's data ... */
|
||||
foreach($this -> fileQueryInfo as $name => $count) {
|
||||
if (($act == 1) || ($act == 2))
|
||||
{
|
||||
foreach ($this -> fileQueryInfo as $name => $count)
|
||||
{
|
||||
$statQuery[$name] += $count;
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_array($statQuery) || !count($statQuery)) {
|
||||
return "<div style='text-align: center;'>".ADSTAT_L25."</div>";
|
||||
}
|
||||
|
||||
$queryArray = $this -> arraySort($statQuery, 0);
|
||||
$total = array_sum($queryArray);
|
||||
$text = "<table class='fborder' style='width: 100%;'>\n<tr>\n<td class='fcaption' style='width: 60%;'>".ADSTAT_L31."</td>\n<td class='fcaption' style='width: 30%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
|
||||
$text .= "<table class='fborder' style='width: 100%;'>\n
|
||||
<tr><td class='fcaption' colspan='4' style='text-align:center'>".$this->browser_headings[$act].$pars['hdg_extra']."</td></tr>\n
|
||||
<tr>\n<td class='fcaption' style='width: 60%;'>".ADSTAT_L31."</td>\n<td class='fcaption' style='width: 30%;' colspan='2'>".ADSTAT_L21."</td>\n<td class='fcaption' style='width: 10%; text-align: center;'>%</td>\n</tr>\n";
|
||||
$count = 1;
|
||||
foreach($queryArray as $key => $info) {
|
||||
if (count($queryArray))
|
||||
{
|
||||
foreach ($queryArray as $key => $info)
|
||||
{
|
||||
$percentage = round(($info/$total) * 100, 2);
|
||||
$key = str_replace("%20", " ", $key);
|
||||
$text .= "<tr>
|
||||
@@ -1041,17 +1312,26 @@ class siteStats {
|
||||
<td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td>
|
||||
</tr>\n";
|
||||
$count ++;
|
||||
if($count == $pref['statDisplayNumber']) {
|
||||
if($count == $pref['statDisplayNumber'])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
$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";
|
||||
}
|
||||
$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>";
|
||||
return $text;
|
||||
else
|
||||
{
|
||||
$text .= "<tr><td class='fcaption' colspan='4' style='text-align:center'>".ADSTAT_L25."</td></tr>\n";
|
||||
}
|
||||
$text .= "</table><br />";
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
function recentVisitors() {
|
||||
function recentVisitors()
|
||||
{
|
||||
if(!is_array($this -> fileRecent) || !count($this -> fileRecent)) {
|
||||
return "<div style='text-align: center;'>".ADSTAT_L25.".</div>";
|
||||
}
|
||||
|
@@ -6,8 +6,8 @@
|
||||
| Released under the terms and conditions of the GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_themes/templates/header_default.php,v $
|
||||
| $Revision: 1.14 $
|
||||
| $Date: 2007-09-27 20:58:11 $
|
||||
| $Revision: 1.15 $
|
||||
| $Date: 2007-11-01 20:28:29 $
|
||||
| $Author: e107steved $
|
||||
+-----------------------------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -141,14 +141,14 @@ if (function_exists('headerjs')){echo headerjs(); }
|
||||
if (isset($eplug_css) && $eplug_css) {
|
||||
if(is_array($eplug_css))
|
||||
{
|
||||
foreach($eplug_css as $kcss)
|
||||
{
|
||||
echo "<link rel='stylesheet' href='{$kcss}' type='text/css' />\n";
|
||||
}
|
||||
foreach($eplug_css as $kcss)
|
||||
{ // Allow inline style definition - but only if $eplug_css is an array (maybe require an array later)
|
||||
if ('<style' == substr($kcss,0,6)) echo $kcss; else echo "<link rel='stylesheet' href='{$kcss}' type='text/css' />\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<link rel='stylesheet' href='{$eplug_css}' type='text/css' />\n";
|
||||
echo "<link rel='stylesheet' href='{$eplug_css}' type='text/css' />\n";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -194,11 +194,9 @@ if(defined("PREVIEWTHEME")) {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// DEPRECATED!!! This is used in log/stats.php to generate some css. We'll clean this up in a future release.
|
||||
//
|
||||
// Deprecated function finally removed
|
||||
//if(function_exists('core_head')){ echo core_head(); }
|
||||
|
||||
if(function_exists('core_head')){ echo core_head(); }
|
||||
|
||||
//
|
||||
// F: Send Meta Tags and Icon links
|
||||
|
Reference in New Issue
Block a user