1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-14 01:19:44 +01:00

Stats logging - support plugin.xml, add admin logging. Enhance supporting functions

This commit is contained in:
e107steved 2008-08-13 20:47:10 +00:00
parent 913db4e760
commit bf29a3eec9
6 changed files with 80 additions and 126 deletions

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_files/def_e107_prefs.php,v $
| $Revision: 1.12 $
| $Date: 2008-07-25 19:26:32 $
| $Revision: 1.13 $
| $Date: 2008-08-13 20:46:59 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -160,6 +160,8 @@ City, State, Country
'ban_max_online_access' => '100,200',
'ban_retrigger' => '0',
'multilanguage' => '0',
'user_tracking' => 'cookie',
'cookie_name' => 'e107cookie',
'passwordEncoding' => 0, // Legacy encoding

View File

@ -4,8 +4,8 @@
| e107 website system - Converter for plugin.php to plugin.xml
|
| $Source: /cvs_backup/e107_0.8/e107_files/utilities/pluginxmlgen.php,v $
| $Revision: 1.4 $
| $Date: 2008-08-12 19:37:56 $
| $Revision: 1.5 $
| $Date: 2008-08-13 20:46:59 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -203,20 +203,26 @@ function makeXML($pluginDir, $extras=array())
// Management section
$fileText .= TAB_CHAR."<management>\n";
$temp = '';
foreach ($extras as $k => $v)
{
if (in_array($k,array('install','uninstall', 'upgrade')))
{
$fileText .= TAB_CHAR.TAB_CHAR.'<'.$k;
$temp1 = '';
foreach (array('when','type','file','class','function') as $t)
{
if (isset($v[$t])) $fileText .= ' '.$t.'="'.$v[$t].'"';
if (isset($v[$t])) $temp1 .= ' '.$t.'="'.$v[$t].'"';
}
if ($temp1)
{
$temp .= TAB_CHAR.TAB_CHAR.'<'.$k.$temp1.' />'."\n";
}
$fileText .= ' />'."\n";
}
}
$fileText .= TAB_CHAR."</management>\n";
if ($temp)
{ // Only add management section if something to add
$fileText .= TAB_CHAR."<management>\n".$temp.TAB_CHAR."</management>\n";
}
$fileText .= "</e107Plugin>";
@ -278,7 +284,7 @@ if (isset($_POST['do_conversion']))
foreach ($v as $r => $s)
{
$el_name = $k.'_'.$r;
if (isset($_POST[$el_name]))
if (varset($_POST[$el_name]))
{
switch ($r)
{
@ -303,6 +309,10 @@ if (isset($_POST['do_conversion']))
}
}
}
if (!isset($extras[$k]['file']) || (!isset($extras[$k]['function'])) || (isset($extras[$k]['type']) && ($extras[$k]['type'] == 'classFunction') && !isset($extras[$k]['class'])))
{
unset($extras[$k]); // Incomplete definition
}
}

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
| $Revision: 1.43 $
| $Date: 2008-08-12 20:26:43 $
| $Revision: 1.44 $
| $Date: 2008-08-13 20:46:59 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -980,7 +980,7 @@ class e107plugin
$pref['logLanguageFile'][$plug['plugin_path']] = $plug_vars['logLanguageFile']['@attributes']['filename'];
break;
case 'uninstall' :
unset($pref['logLanguageFile'][$plug['plugin_path']]);
if (isset($pref['logLanguageFile'][$plug['plugin_path']])) unset($pref['logLanguageFile'][$plug['plugin_path']]);
break;
}
}

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/admin_config.php,v $
| $Revision: 1.4 $
| $Date: 2008-04-25 19:17:59 $
| $Revision: 1.5 $
| $Date: 2008-08-13 20:47:09 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
@ -173,6 +173,7 @@ if(isset($_POST['remSelP']))
//---------------------------------------------
if(IsSet($_POST['wipeSubmit']))
{
$logStr = '';
foreach($_POST['wipe'] as $key => $wipe)
{
switch($key)
@ -201,7 +202,10 @@ if(IsSet($_POST['wipeSubmit']))
$sql -> db_Update("logstats", "log_data='' WHERE log_id='statQuery' ");
break;
}
$logStr .= '[!br!]'.$key;
}
$admin_log->log_event('STAT_01',ADSTAT_L81.$logStr,'');
$message = ADSTAT_L25;
}
@ -214,19 +218,32 @@ if(!is_writable(LOGPATH."logs"))
if (isset($_POST['updatesettings']))
{
$pref['statActivate'] = $_POST['statActivate'];
$pref['statCountAdmin'] = $_POST['statCountAdmin'];
$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']);
$statList = array( // Type = 0 for direct text, 1 for integer
'statActivate' => 0,
'statCountAdmin' => 0,
'statUserclass' => 0,
'statBrowser' => 1,
'statOs' => 1,
'statScreen' => 1,
'statDomain' => 1,
'statRefer' => 1,
'statQuery' => 1,
'statRecent' => 1,
'statDisplayNumber' => 0,
'statPrevMonth' => 1
);
$logStr = '';
foreach ($statList as $k => $type)
{
switch ($type)
{
case 0 : $pref[$k] = $_POST[$k]; break;
case 1 : $pref[$k] = intval($_POST[$k]); break;
}
$logStr .= "[!br!]{$k} => ".$pref[$k];
}
save_prefs();
$admin_log->log_event('STAT_02',ADSTAT_L82.$logStr,'');
$message = ADSTAT_L17;
}
@ -535,14 +552,17 @@ switch ($action)
if (isset($_POST['actually_delete']))
{
$delete_list = get_for_delete($keep_year,$keep_month);
$logStr = '';
// $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 />";
$logStr .= "[!br!]{$k} => ".$v;
}
$text .= "</td></tr>";
$admin_log->log_event('STAT_04',ADSTAT_L83.$logStr,'');
}
$text .= "<tr><td class='forumheader3'>".ADSTAT_L70."</td>";
$text .= "<td class='forumheader3'><select class='tbox' name='delete_month'>\n";
@ -768,7 +788,7 @@ function rempage()
//---------------------------------------------
function rempagego()
{
global $sql;
global $sql, $admin_log;
$sql -> db_Select("logstats", "*", "log_id='pageTotal' ");
$row = $sql -> db_Fetch();
@ -787,10 +807,11 @@ function rempagego()
}
$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}' ");
}
$admin_log->log_event('STAT_03',ADSTAT_L80."[!br!]".implode("[!br!]",$_POST['remcb']),'');
$varStart = chr(36);
$quote = chr(34);

View File

@ -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.5 $
| $Date: 2008-02-16 14:57:37 $
| $Revision: 1.6 $
| $Date: 2008-08-13 20:47:10 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -56,7 +56,7 @@ 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_L38', "You must set the e107_plugins/log/logs folder to be writable");
define ('ADSTAT_L39', 'Stats Logging Functions');
define ('ADSTAT_L40', 'Export log data');
define ('ADSTAT_L41', 'Date selection');
@ -98,7 +98,20 @@ define ('ADSTAT_L76', 'Caution! Once deleted, the data cannot be recovered. Back
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', '');
define ('ADSTAT_L80', 'The following pages were deleted:');
define ('ADSTAT_L81', 'Statistics cleared:');
define ('ADSTAT_L82', 'Following values now set:');
define ('ADSTAT_L83', 'Following log ID entries removed:');
define ('ADSTAT_L84', '');
define ('ADSTAT_L85', '');
// Messages for log entries
define('LAN_AL_STAT_01', 'Stats - reset');
define('LAN_AL_STAT_02', 'Stats - settings changed');
define('LAN_AL_STAT_03', 'Stats - pages removed');
define('LAN_AL_STAT_04', 'Stats - historic data removed');
define('LAN_AL_STAT_05', '');
define('LAN_AL_STAT_06', '');
define('LAN_AL_STAT_07', '');
?>

View File

@ -1,92 +0,0 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| ©Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.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/plugin.php,v $
| $Revision: 1.4 $
| $Date: 2007-11-01 20:28:21 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
@include_once(e_PLUGIN."log/languages/admin/".e_LANGUAGE.".php");
@include_once(e_PLUGIN."log/languages/admin/English.php");
// Plugin info -------------------------------------------------------------------------------------------------------
$eplug_name = ADSTAT_L3;
$eplug_version = "2.1";
$eplug_author = "jalist";
$eplug_url = "http://e107.org";
$eplug_email = "jalist@e107.org";
$eplug_description = ADSTAT_L1;
$eplug_compatible = "e107v0.7";
$eplug_readme = "";
// leave blank if no readme file
// Name of the plugin's folder -------------------------------------------------------------------------------------
$eplug_folder = "log";
// Name of menu item for plugin ----------------------------------------------------------------------------------
$eplug_menu_name = "";
// Name of the admin configuration file --------------------------------------------------------------------------
$eplug_conffile = "admin_config.php";
// Icon image and caption text ------------------------------------------------------------------------------------
$eplug_icon = $eplug_folder."/images/stats_32.png";
$eplug_icon_small = $eplug_folder."/images/stats_16.png";
$eplug_caption = ADSTAT_L33;
// List of preferences -----------------------------------------------------------------------------------------------
$eplug_prefTable = "menu_pref";
$eplug_prefs = array(
"statActivate" => 0,
"statUserclass" => "",
"statBrowser" => 1,
"statOs" => 1,
"statScreen" => 1,
"statDomain" => 1,
"statRefer" => 1,
"statQuery" => 1,
"statRecent" => 1,
"statPrevMonth" => 0
);
// List of table names -----------------------------------------------------------------------------------------------
$eplug_table_names = array("logstats");
// List of sql requests to create tables -----------------------------------------------------------------------------
$eplug_tables = array(
"CREATE TABLE ".MPREFIX."logstats (
log_uniqueid int(11) NOT NULL auto_increment,
log_id varchar(50) NOT NULL default '',
log_data longtext NOT NULL,
PRIMARY KEY (log_uniqueid),
UNIQUE KEY log_id (log_id)
) TYPE=MyISAM ");
// Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
$eplug_link = TRUE;
$eplug_link_name = ADSTAT_L34;
$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");
?>