diff --git a/ChangeLog b/ChangeLog
index 4ce6eb4..ed4e1d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
---------------------------------------------------------------------------
Version 2.5.17 (beta), 2008-11-03
+- Added logstream statistic and maintenance option which are accessable
+ in the sources admin panel. You can view overall stats of database
+ logstreams, and cleanup data based on the date field.
+- Added option to use a custom phpLogCon logo in the header.
+ The logo url can be configured in the admin panel
+---------------------------------------------------------------------------
+Version 2.5.17 (beta), 2008-11-03
- Fixed default database template, updates for DB Version 6 and 7 were
missing.
- Added expandable submenu for help into the top menu. Also fixed some
diff --git a/src/admin/index.php b/src/admin/index.php
index 8ccaa9d..0949be7 100644
--- a/src/admin/index.php
+++ b/src/admin/index.php
@@ -153,6 +153,7 @@ if ( isset($_POST['op']) )
if ( isset ($_POST['InjectHtmlHeader']) ) { $content['InjectHtmlHeader'] = $_POST['InjectHtmlHeader']; }
if ( isset ($_POST['InjectBodyHeader']) ) { $content['InjectBodyHeader'] = $_POST['InjectBodyHeader']; }
if ( isset ($_POST['InjectBodyFooter']) ) { $content['InjectBodyFooter'] = $_POST['InjectBodyFooter']; }
+ if ( isset ($_POST['PhplogconLogoUrl']) ) { $content['PhplogconLogoUrl'] = $_POST['PhplogconLogoUrl']; }
// Save configuration variables now
SaveGeneralSettingsIntoDB();
diff --git a/src/admin/sources.php b/src/admin/sources.php
index a31853f..56d5d90 100644
--- a/src/admin/sources.php
+++ b/src/admin/sources.php
@@ -238,7 +238,7 @@ if ( isset($_GET['op']) )
//PreInit these values
$content['SOURCEID'] = DB_RemoveBadChars($_GET['id']);
- // Get UserInfo
+ // Get SourceInfo
$result = DB_Query("SELECT Name FROM " . DB_SOURCES . " WHERE ID = " . $content['SOURCEID'] );
$myrow = DB_GetSingleRow($result, true);
if ( !isset($myrow['Name']) )
@@ -274,6 +274,208 @@ if ( isset($_GET['op']) )
$content['ERROR_MSG'] = $content['LN_SOURCES_ERROR_INVALIDORNOTFOUNDID'];
}
}
+ else if ($_GET['op'] == "cleardata")
+ {
+ if ( isset($_GET['id']) )
+ {
+ //PreInit these values
+ $content['SOURCEID'] = DB_RemoveBadChars($_GET['id']);
+ }
+
+ // Check If source is available
+ if ( !isset($content['Sources'][ $content['SOURCEID'] ]) )
+ {
+ $content['ISERROR'] = true;
+ $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_IDNOTFOUND'], $content['SOURCEID'] );
+ }
+ else
+ {
+ // Include LogStream facility
+ include($gl_root_path . 'classes/logstream.class.php');
+
+ // --- Init the source
+ $tmpSource = $content['Sources'][ $content['SOURCEID'] ];
+
+ // Copy some default properties
+ $content['DisplayName'] = $tmpSource['Name'];
+ $content['SourceType'] = $tmpSource['SourceType'];
+ CreateSourceTypesList($content['SourceType']);
+ $content['SourceTypeName'] = $content['SOURCETYPES'][ $content['SourceType'] ]['DisplayName'];
+
+ // Fix Filename manually for FILE LOGSTREAM!
+ if ( $content['SourceType'] == SOURCE_DB || $content['SourceType'] == SOURCE_PDO )
+ {
+ // Create LogStream Object
+ $stream = $tmpSource['ObjRef']->LogStreamFactory($tmpSource['ObjRef']);
+ $res = $stream->Verify();
+ if ( $res != SUCCESS )
+ {
+ $content['ISERROR'] = true;
+ $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_WITHINSOURCE'], $tmpSource['Name'], GetErrorMessage($res) );
+ if ( isset($extraErrorDescription) )
+ $content['ERROR_MSG'] .= "
" . GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
+ }
+ else
+ {
+ // Display Stats
+ $content['ISCLEARDATA'] = true;
+
+ // Gather Database Stats
+ $content['ROWCOUNT'] = $stream->GetLogStreamTotalRowCount();
+ if ( isset($content['ROWCOUNT']) )
+ {
+ // Check for suboperations
+ if ( isset($_POST['subop']) )
+ {
+ if ( $_POST['subop'] == "all" )
+ {
+ $timestamp = 0;
+ }
+ else if ( $_POST['subop'] == "since" && isset($_POST['olderthan']) )
+ {
+ // Take current time and subtract Seconds
+ $nSecondsSubtract = $_POST['olderthan'];
+ $timestamp = time() - $nSecondsSubtract;
+ }
+ else if ( $_POST['subop'] == "date" && isset($_POST['olderdate_year']) && isset($_POST['olderdate_month']) && isset($_POST['olderdate_day']) )
+ {
+ // Generate Timestamp
+ $timestamp = mktime( 0, 0, 0, intval($_POST['olderdate_month']), intval($_POST['olderdate_day']), intval($_POST['olderdate_year']) );
+ }
+ // Continue with delete only inif wherequery is set!
+ if ( isset($timestamp) )
+ {
+ // --- Ask for deletion first!
+ if ( (!isset($_GET['verify']) || $_GET['verify'] != "yes") )
+ {
+ // This will print an additional secure check which the user needs to confirm and exit the script execution.
+ PrintSecureUserCheck( GetAndReplaceLangStr( $content['LN_SOURCES_WARNDELETEDATA'], $content['DisplayName'] ), $content['LN_DELETEYES'], $content['LN_DELETENO'] );
+ }
+ // ---
+
+ // Now perform the data cleanup!
+ $content['affectedrows'] = $stream->CleanupLogdataByDate($timestamp);
+
+ if ( !isset($content['affectedrows']) )
+ {
+ $content['ISERROR'] = true;
+ $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_DELDATA'], $content['SOURCEID'] );
+ }
+ else
+ {
+ // Do the final redirect
+ RedirectResult( GetAndReplaceLangStr( $content['LN_SOURCES_HASBEENDELDATA'], $content['DisplayName'], $content['affectedrows'] ) , "sources.php" );
+ }
+ }
+ else
+ {
+ $content['ISERROR'] = true;
+ $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_INVALIDCLEANUP'], $content['DisplayName'] );
+ }
+ }
+ else
+ {
+ // Allow Deleting by Date
+ $content['DELETE_ALLOWDETAIL'] = true;
+
+ // Create Lists
+ CreateOlderThanList( 3600 );
+ CreateOlderDateFields();
+ }
+
+ }
+ else
+ $content['ROWCOUNT'] = "Unknown";
+ }
+ }
+ else
+ {
+ $content['ISERROR'] = true;
+ $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_NOCLEARSUPPORT'], $content['SOURCEID'] );
+ }
+ }
+ }
+ else if ($_GET['op'] == "dbstats")
+ {
+ if ( isset($_GET['id']) )
+ {
+ //PreInit these values
+ $content['SOURCEID'] = DB_RemoveBadChars($_GET['id']);
+ }
+
+ // Check If source is available
+ if ( !isset($content['Sources'][ $content['SOURCEID'] ]) )
+ {
+ $content['ISERROR'] = true;
+ $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_IDNOTFOUND'], $content['SOURCEID'] );
+ }
+ else
+ {
+ // Include LogStream facility
+ include($gl_root_path . 'classes/logstream.class.php');
+
+ // --- Init the source
+ $tmpSource = $content['Sources'][ $content['SOURCEID'] ];
+
+ // Copy some default properties
+ $content['DisplayName'] = $tmpSource['Name'];
+ $content['Description'] = $tmpSource['Description'];
+ $content['SourceType'] = $tmpSource['SourceType'];
+ CreateSourceTypesList($content['SourceType']);
+ $content['SourceTypeName'] = $content['SOURCETYPES'][ $content['SourceType'] ]['DisplayName'];
+
+ // Fix Filename manually for FILE LOGSTREAM!
+ if ( $content['SourceType'] == SOURCE_DISK )
+ {
+ $tmpSource['DiskFile'] = CheckAndPrependRootPath(DB_StripSlahes($tmpSource['DiskFile']));
+ $tmpSource['ObjRef']->FileName = $tmpSource['DiskFile'];
+ }
+
+ // Create LogStream Object
+ $stream = $tmpSource['ObjRef']->LogStreamFactory($tmpSource['ObjRef']);
+ $res = $stream->Verify();
+ if ( $res != SUCCESS )
+ {
+ $content['ISERROR'] = true;
+ $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_WITHINSOURCE'], $tmpSource['Name'], GetErrorMessage($res) );
+ if ( isset($extraErrorDescription) )
+ $content['ERROR_MSG'] .= "
" . GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
+ }
+ else
+ {
+ // Gather Database Stats
+ $content['STATS'] = $stream->GetLogStreamStats();
+ if ( isset($content['STATS']) )
+ {
+ // Display Stats
+ $content['ISSTATS'] = true;
+
+ foreach( $content['STATS'] as &$myStats )
+ {
+ $i = 0;
+ foreach( $myStats['STATSDATA'] as &$myStatsData )
+ {
+ // --- Set CSS Class
+ if ( $i % 2 == 0 )
+ $myStatsData['cssclass'] = "line1";
+ else
+ $myStatsData['cssclass'] = "line2";
+ $i++;
+ // ---
+ }
+ }
+
+ }
+ else
+ {
+ $content['ISERROR'] = true;
+ $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_NOSTATSDATA'], $content['SOURCEID'] );
+ }
+// print_r ( $content['STATS'] );
+ }
+ // ---
+ }
+ }
}
if ( isset($_POST['op']) )
@@ -364,8 +566,8 @@ if ( isset($_POST['op']) )
else
{
// Get plain filename for testing!
- $content['SourceDiskFileTesting'] = DB_StripSlahes($content['SourceDiskFile']);
-
+ $content['SourceDiskFileTesting'] = CheckAndPrependRootPath(DB_StripSlahes($content['SourceDiskFile']));
+ /*
// Take as it is if rootpath!
if (
( ($pos = strpos($content['SourceDiskFileTesting'], "/")) !== FALSE && $pos == 0) ||
@@ -379,13 +581,7 @@ if ( isset($_POST['op']) )
}
else // prepend basepath!
$content['SourceDiskFileTesting'] = $gl_root_path . $content['SourceDiskFileTesting'];
-/*
- if ( !is_file($content['SourceDiskFileTesting']) )
- {
- $content['ISERROR'] = true;
- $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_NOTAVALIDFILE'], $szFileName );
- }
-*/
+ */
}
}
// DB Params
@@ -663,11 +859,17 @@ if ( !isset($_POST['op']) && !isset($_GET['op']) )
{
$mySource['SourcesTypeImage'] = $content["MENU_SOURCE_DB"];
$mySource['SourcesTypeText'] = $content["LN_SOURCES_DB"];
+
+ // Enabled Database Maintenance functions
+ $mySource['IsDatabaseSource'] = true;
}
else if ( $mySource['SourceType'] == SOURCE_PDO )
{
$mySource['SourcesTypeImage'] = $content["MENU_SOURCE_PDO"];
$mySource['SourcesTypeText'] = $content["LN_SOURCES_PDO"];
+
+ // Enabled Database Maintenance functions
+ $mySource['IsDatabaseSource'] = true;
}
// ---
@@ -690,6 +892,65 @@ function ReadMsgParserList()
{
global $gl_root_path, $content;
}
+
+/*
+* Helper function to create a OlderThan Listbox
+*/
+function CreateOlderThanList( $nDefaultSeconds )
+{
+ global $content;
+
+ $content['OLDERTHAN'][] = array( 'OlderThanDisplayName' => "1 minute", 'OlderThanSeconds' => 60 );
+ $content['OLDERTHAN'][] = array( 'OlderThanDisplayName' => "5 minutes", 'OlderThanSeconds' => 300 );
+ $content['OLDERTHAN'][] = array( 'OlderThanDisplayName' => "15 minutes", 'OlderThanSeconds' => 900 );
+ $content['OLDERTHAN'][] = array( 'OlderThanDisplayName' => "30 minutes", 'OlderThanSeconds' => 1800 );
+ $content['OLDERTHAN'][] = array( 'OlderThanDisplayName' => "1 hour", 'OlderThanSeconds' => 3600 );
+ $content['OLDERTHAN'][] = array( 'OlderThanDisplayName' => "12 hours", 'OlderThanSeconds' => 43200 );
+ $content['OLDERTHAN'][] = array( 'OlderThanDisplayName' => "1 day", 'OlderThanSeconds' => 86400 );
+ $content['OLDERTHAN'][] = array( 'OlderThanDisplayName' => "7 days", 'OlderThanSeconds' => 604800 );
+ $content['OLDERTHAN'][] = array( 'OlderThanDisplayName' => "31 days", 'OlderThanSeconds' => 2678400 );
+
+ foreach ( $content['OLDERTHAN'] as &$myTime )
+ {
+ if ( $nDefaultSeconds == $myTime['OlderThanSeconds'] )
+ $myTime['selected'] = "selected";
+ else
+ $myTime['selected'] = "";
+ }
+}
+
+/*
+* Helper function to create a OlderThan Listbox
+*/
+function CreateOlderDateFields()
+{
+ global $content;
+
+ $currentTime = time();
+ $currentDay = date("d", $currentTime);
+ $currentMonth = date("m", $currentTime);
+ $currentYear = date("Y", $currentTime);
+
+ // Init Year, month and day array!
+ for ( $i = $currentYear-5; $i <= $currentYear+5; $i++ )
+ {
+ $content['olderdate_years'][$i]['value'] = $i;
+ if ( $i == $currentYear ) { $content['olderdate_years'][$i]['selected'] = "selected"; } else { $content['olderdate_years'][$i]['selected'] = ""; }
+ }
+ for ( $i = 1; $i <= 12; $i++ )
+ {
+ $content['olderdate_months'][$i]['value'] = $i;
+ if ( $i == $currentMonth ) { $content['olderdate_months'][$i]['selected'] = "selected"; } else { $content['olderdate_months'][$i]['selected'] = ""; }
+ }
+ for ( $i = 1; $i <= 31; $i++ )
+ {
+ $content['olderdate_days'][$i]['value'] = $i;
+ if ( $i == $currentDay ) { $content['olderdate_days'][$i]['selected'] = "selected"; } else { $content['olderdate_days'][$i]['selected'] = ""; }
+ }
+
+
+}
+
// --- END Custom Code
// --- BEGIN CREATE TITLE
diff --git a/src/classes/logstream.class.php b/src/classes/logstream.class.php
index e08773e..a643977 100644
--- a/src/classes/logstream.class.php
+++ b/src/classes/logstream.class.php
@@ -212,6 +212,25 @@ abstract class LogStream {
*/
public abstract function IsPropertySortable($myProperty);
+
+ /**
+ * This returns an Array of useful statsdata for this logstream source
+ */
+ public abstract function GetLogStreamStats();
+
+
+ /**
+ * This returns just the count of records of the main data source
+ */
+ public abstract function GetLogStreamTotalRowCount();
+
+
+ /**
+ * Helper function to cleanup all logdata which is older then the nDateTimeStamp!
+ */
+ public abstract function CleanupLogdataByDate( $nDateTimeStamp );
+
+
/*
* Helper functino to trigger initialisation of MsgParsers
*/
diff --git a/src/classes/logstreamdb.class.php b/src/classes/logstreamdb.class.php
index 2c9bfe7..c32cc90 100644
--- a/src/classes/logstreamdb.class.php
+++ b/src/classes/logstreamdb.class.php
@@ -538,6 +538,142 @@ class LogStreamDB extends LogStream {
return false;
}
+ /**
+ * Implementation of GetLogStreamStats
+ *
+ * Returns an Array og logstream statsdata
+ * Count of Data Items
+ * Total Filesize
+ */
+ public function GetLogStreamStats()
+ {
+ global $querycount, $dbmapping;
+ $szTableType = $this->_logStreamConfigObj->DBTableType;
+
+ // Perform if Connection is true!
+ if ( $this->_dbhandle != null )
+ {
+ // Obtain Stats data for this table!
+ $szSql = "SHOW TABLE STATUS FROM " . $this->_logStreamConfigObj->DBName;
+ $myQuery = mysql_query($szSql, $this->_dbhandle);
+ if ($myQuery)
+ {
+ // Loop through results
+ while ($myRow = mysql_fetch_array($myQuery, MYSQL_ASSOC))
+ {
+ // Set tablename!
+ $tableName = $myRow['Name'];
+ $myStats = null;
+ $myStats[] = array( 'StatsDisplayName' => 'Table name', 'StatsValue' => $tableName );
+
+ // copy usefull statsdata
+ if ( isset($myRow['Engine']) )
+ $myStats[] = array( 'StatsDisplayName' => 'Table engine', 'StatsValue' => $myRow['Engine'] );
+ if ( isset($myRow['Rows']) )
+ $myStats[] = array( 'StatsDisplayName' => 'Rowcount', 'StatsValue' => $myRow['Rows'] );
+
+ if ( isset($myRow['Data_length']) )
+ $myStats[] = array( 'StatsDisplayName' => 'Table filesize (bytes)', 'StatsValue' => $myRow['Data_length'] );
+ if ( isset($myRow['Collation']) )
+ $myStats[] = array( 'StatsDisplayName' => 'Collation', 'StatsValue' => $myRow['Collation'] );
+ if ( isset($myRow['Comment']) )
+ $myStats[] = array( 'StatsDisplayName' => 'Comment', 'StatsValue' => $myRow['Comment'] );
+
+ $stats[]['STATSDATA'] = $myStats;
+ }
+
+ // Free query now
+ mysql_free_result ($myQuery);
+
+ // Increment for the Footer Stats
+ $querycount++;
+ }
+
+ // return results!
+ return $stats;
+ }
+ else
+ return null;
+ }
+
+
+ /**
+ * Implementation of GetLogStreamTotalRowCount
+ *
+ * Returns the total amount of rows in the main datatable
+ */
+ public function GetLogStreamTotalRowCount()
+ {
+ global $querycount, $dbmapping;
+ $szTableType = $this->_logStreamConfigObj->DBTableType;
+
+ // Set default rowcount
+ $rowcount = null;
+
+ // Perform if Connection is true!
+ if ( $this->_dbhandle != null )
+ {
+ // SHOW TABLE STATUS FROM
+ $szSql = "SELECT count(" . $dbmapping[$szTableType][SYSLOG_UID] . ") as Counter FROM " . $this->_logStreamConfigObj->DBTableName;
+ $myQuery = mysql_query($szSql, $this->_dbhandle);
+ if ($myQuery)
+ {
+ // Obtain RowCount!
+ $myRow = mysql_fetch_row($myQuery);
+ $rowcount = $myRow[0];
+
+ // Free query now
+ mysql_free_result ($myQuery);
+
+ // Increment for the Footer Stats
+ $querycount++;
+ }
+ }
+
+ //return result
+ return $rowcount;
+ }
+
+
+ /**
+ * Implementation of the CleanupLogdataByDate function! Returns affected rows!
+ */
+ public function CleanupLogdataByDate( $nDateTimeStamp )
+ {
+ global $querycount, $dbmapping;
+ $szTableType = $this->_logStreamConfigObj->DBTableType;
+
+ // Set default rowcount
+ $rowcount = null;
+
+
+ // Perform if Connection is true!
+ if ( $this->_dbhandle != null )
+ {
+ // Create WHERE attachment
+ if ( $nDateTimeStamp > 0 )
+ $szWhere = " WHERE UNIX_TIMESTAMP(" . $dbmapping[$szTableType][SYSLOG_DATE] . ") < " . $nDateTimeStamp;
+ else
+ $szWhere = "";
+
+ // DELETE DATA NOW!
+ $szSql = "DELETE FROM " . $this->_logStreamConfigObj->DBTableName . $szWhere;
+ $myQuery = mysql_query($szSql, $this->_dbhandle);
+ if ($myQuery)
+ {
+ // Get affected rows and return!
+ $rowcount = mysql_affected_rows();
+
+ // Free query now
+ mysql_free_result ($myQuery);
+ }
+ }
+
+ //return affected rows
+ return $rowcount;
+ }
+
+
/**
* Implementation of GetCountSortedByField
*
diff --git a/src/classes/logstreamdisk.class.php b/src/classes/logstreamdisk.class.php
index 148c1aa..1791256 100644
--- a/src/classes/logstreamdisk.class.php
+++ b/src/classes/logstreamdisk.class.php
@@ -598,6 +598,52 @@ class LogStreamDisk extends LogStream {
return false;
}
+ /**
+ * Implementation of GetLogStreamStats
+ *
+ * Returns an Array og logstream statsdata
+ * Count of Data Items
+ * Total Filesize
+ */
+ public function GetLogStreamStats()
+ {
+ // Get some file data!
+
+/*
+ // return results!
+ return $stats;
+ }
+ else
+*/
+ // NOT IMPLEMENTED YET!
+ return null;
+ }
+
+
+ /**
+ * Implementation of GetLogStreamTotalRowCount
+ *
+ * not implemented yet!
+ */
+ public function GetLogStreamTotalRowCount()
+ {
+ //not implemented
+ return null;
+ }
+
+
+ /**
+ * Implementation of the CleanupLogdataByDate
+ *
+ * not implemented yet!
+ */
+ public function CleanupLogdataByDate( $nDateTimeStamp )
+ {
+ //not implemented
+ return null;
+ }
+
+
/**
* Implementation of GetCountSortedByField
*
diff --git a/src/classes/logstreampdo.class.php b/src/classes/logstreampdo.class.php
index 9760317..8c54411 100644
--- a/src/classes/logstreampdo.class.php
+++ b/src/classes/logstreampdo.class.php
@@ -534,6 +534,129 @@ class LogStreamPDO extends LogStream {
return false;
}
+ /**
+ * Implementation of GetLogStreamStats
+ *
+ * Returns an Array og logstream statsdata
+ * Count of Data Items
+ * Total Filesize
+ */
+ public function GetLogStreamStats()
+ {
+ global $querycount, $dbmapping;
+ $szTableType = $this->_logStreamConfigObj->DBTableType;
+
+ // Perform if Connection is true!
+ if ( $this->_dbhandle != null )
+ {
+ $tableName = $this->_logStreamConfigObj->DBTableName;
+
+ // SHOW TABLE STATUS FROM
+ $stats = NULL;
+ $szSql = "SELECT count(" . $dbmapping[$szTableType][SYSLOG_UID] . ") as Counter FROM " . $this->_logStreamConfigObj->DBTableName;
+ $myQuery = $this->_dbhandle->query($szSql);
+ if ( $myQuery )
+ {
+ // Set tablename!
+ $tableName = $this->_logStreamConfigObj->DBTableName;
+ $myStats[] = array( 'StatsDisplayName' => 'TableName', 'StatsValue' => $tableName );
+
+ // obtain first and only row
+ $myRow = $myQuery->fetchColumn();
+ $myStats[] = array( 'StatsDisplayName' => 'Rows', 'StatsValue' => $myRow );
+ $stats[]['STATSDATA'] = $myStats;
+
+ // Free query now
+ $myQuery->closeCursor();
+
+ // Increment for the Footer Stats
+ $querycount++;
+ }
+
+ // return results!
+ return $stats;
+ }
+ else
+ return null;
+ }
+
+
+ /**
+ * Implementation of GetLogStreamTotalRowCount
+ *
+ * Returns the total amount of rows in the main datatable
+ */
+ public function GetLogStreamTotalRowCount()
+ {
+ global $querycount, $dbmapping;
+ $szTableType = $this->_logStreamConfigObj->DBTableType;
+
+ // Set default rowcount
+ $rowcount = null;
+
+ // Perform if Connection is true!
+ if ( $this->_dbhandle != null )
+ {
+ // Get Total Rowcount
+ $szSql = "SELECT count(" . $dbmapping[$szTableType][SYSLOG_UID] . ") as Counter FROM " . $this->_logStreamConfigObj->DBTableName;
+ $myQuery = $this->_dbhandle->query($szSql);
+ if ( $myQuery )
+ {
+ // Obtain RowCount!
+ $myRow = $myQuery->fetchColumn();
+ $rowcount = $myRow;
+
+ // Free query now
+ $myQuery->closeCursor();
+
+ // Increment for the Footer Stats
+ $querycount++;
+ }
+ }
+
+ //return result
+ return $rowcount;
+ }
+
+
+ /**
+ * Implementation of the CleanupLogdataByDate function! Returns affected rows!
+ */
+ public function CleanupLogdataByDate( $nDateTimeStamp )
+ {
+ global $querycount, $dbmapping;
+ $szTableType = $this->_logStreamConfigObj->DBTableType;
+
+ // Set default rowcount
+ $rowcount = null;
+
+ // Perform if Connection is true!
+ if ( $this->_dbhandle != null )
+ {
+ // Create WHERE attachment
+ if ( $nDateTimeStamp > 0 )
+ $szWhere = " WHERE " . $dbmapping[$szTableType][SYSLOG_DATE] . " < '" . date('Y-m-d H:i:s', $nDateTimeStamp) . "'";
+ else
+ $szWhere = "";
+
+ // DELETE DATA NOW!
+ $szSql = "DELETE FROM " . $this->_logStreamConfigObj->DBTableName . $szWhere;
+ $myQuery = $this->_dbhandle->query($szSql);
+ if ( $myQuery )
+ {
+ // Get affected rows and return!
+ $rowcount = $myQuery->rowCount();
+
+ // Free query now
+ $myQuery->closeCursor();
+ }
+ }
+
+ //return affected rows
+ return $rowcount;
+ }
+
+
/**
* Implementation of GetCountSortedByField
*
diff --git a/src/include/config.sample.php b/src/include/config.sample.php
index c2a9dd3..64cb0aa 100644
--- a/src/include/config.sample.php
+++ b/src/include/config.sample.php
@@ -83,6 +83,7 @@ $CFG['EnableIPAddressResolve'] = 1; // If enabled, IP Addresses inline message
$CFG['SuppressDuplicatedMessages'] = 0; // If enabled, duplicated messages will be suppressed in the main display.
$CFG['TreatNotFoundFiltersAsTrue'] = 0; // If you filter / search for messages, and the fields you are filtering for is not found, the filter result is treaten as TRUE!
$CFG['PopupMenuTimeout'] = 3000; // This variable defines the default timeout value for popup menus in milliseconds. (those menus which popup when you click on the value of a field.
+$CFG['PhplogconLogoUrl'] = ""; // Put an Url to a custom toplogo you want to use.
// ---
// --- Custom HTML Code
diff --git a/src/include/functions_common.php b/src/include/functions_common.php
index 15c9b2a..b62bb62 100644
--- a/src/include/functions_common.php
+++ b/src/include/functions_common.php
@@ -72,6 +72,7 @@ $content['BASEPATH'] = $gl_root_path;
$content['SHOW_DONATEBUTTON'] = true; // Default = true!
// PreInit overall user variables
+$content['EXTRA_PHPLOGCON_LOGO'] = $content['BASEPATH'] . "images/main/Header-Logo.png";
$content['EXTRA_METATAGS'] = "";
$content['EXTRA_JAVASCRIPT'] = "";
$content['EXTRA_STYLESHEET'] = "";
@@ -627,6 +628,8 @@ function InitFrontEndVariables()
$content['MENU_INFORMATION'] = $content['BASEPATH'] . "images/icons/information2.png";
$content['MENU_PARSER_DELETE'] = $content['BASEPATH'] . "images/icons/gear_delete.png";
$content['MENU_PARSER_INIT'] = $content['BASEPATH'] . "images/icons/gear_new.png";
+ $content['MENU_RECYCLE'] = $content['BASEPATH'] . "images/icons/recycle.png";
+ $content['MENU_TRASH'] = $content['BASEPATH'] . "images/icons/garbage_empty.png";
$content['MENU_PAGER_BEGIN'] = $content['BASEPATH'] . "images/icons/media_beginning.png";
$content['MENU_PAGER_PREVIOUS'] = $content['BASEPATH'] . "images/icons/media_rewind.png";
@@ -812,6 +815,13 @@ function InitConfigurationValues()
$content['InjectBodyFooter'] = ""; // Init Option
// ---
+ // --- Handle Optional Logo URL!
+ if ( strlen(GetConfigSetting("PhplogconLogoUrl", false)) > 0 )
+ $content['EXTRA_PHPLOGCON_LOGO'] = $CFG['PhplogconLogoUrl'];
+ else
+ $content['PhplogconLogoUrl'] = ""; // Init Option
+ // ---
+
// Init main langauge file now!
IncludeLanguageFile( $gl_root_path . '/lang/' . $LANG . '/main.php' );
@@ -1385,6 +1395,7 @@ function SaveGeneralSettingsIntoDB($bForceStripSlahes = false)
WriteConfigValue( "InjectHtmlHeader", true, null, null,$bForceStripSlahes );
WriteConfigValue( "InjectBodyHeader", true, null, null,$bForceStripSlahes );
WriteConfigValue( "InjectBodyFooter", true, null, null ,$bForceStripSlahes );
+ WriteConfigValue( "PhplogconLogoUrl", true, null, null ,$bForceStripSlahes );
}
function SaveUserGeneralSettingsIntoDB()
@@ -1513,6 +1524,36 @@ function list_files($directory, $failOnError = true)
}
}
+
+/*
+* Helper function to prepend the current global root path if necessary!
+*/
+function CheckAndPrependRootPath( $szFileName)
+{
+ global $gl_root_path;
+
+ // Get plain filename for testing!
+ $szNewFileName = $szFileName;
+
+ // Take as it is if rootpath!
+ if (
+ ( ($pos = strpos($szFileName, "/")) !== FALSE && $pos == 0) ||
+ ( ($pos = strpos($szFileName, "\\\\")) !== FALSE && $pos == 0) ||
+ ( ($pos = strpos($szFileName, ":\\")) !== FALSE ) ||
+ ( ($pos = strpos($szFileName, ":/")) !== FALSE )
+ )
+ {
+ // Nothing really todo
+ true;
+ }
+ else // prepend basepath!
+ $szNewFileName = $gl_root_path . $szFileName;
+
+ // return result
+ return $szNewFileName;
+}
+
+
/*
* Helper function to flush html output to avoid redirects if errors happen!
*/
diff --git a/src/js/common.js b/src/js/common.js
index d9a03fa..455c762 100644
--- a/src/js/common.js
+++ b/src/js/common.js
@@ -362,10 +362,35 @@ function HoverPopup( myObjRef, myPopupTitle, HoverContent, OptionalImage )
obj.innerHTML = HoverContent;
}
+function HoverPopupHelp( myEvent, parentObj, myPopupTitle, HoverContent )
+{
+ // Change CSS Class
+ var objPopup = document.getElementById('popupdetails');
+ objPopup.className='popupdetails_popup with_border';
+
+ // Set title
+ var obj = document.getElementById("popuptitle");
+ obj.innerHTML = myPopupTitle;
+
+ // Set Content
+ obj = document.getElementById("popupcontent");
+ obj.innerHTML = HoverContent;
+
+// var PopupContentWidth = 0;
+/// var middle = PopupContentWidth / 2;
+ var middle = -5;
+
+ if (myPopupHovering == false && parentObj != null)
+ {
+ // Different mouse position capturing in IE!
+ objPopup.style.top = (event.y+document.body.scrollTop + 24) + 'px';
+ objPopup.style.left = (myEvent.clientX - middle) + 'px';
+ }
+}
function HoverPopupMenuHelp( myEvent, parentObj, myPopupTitle, HoverContent )
{
- if (szBrowserApp !== "IEXPLORER")
+ if (szBrowserApp !== "IEXPLORER" )
{
// Don't need helper here!
return;
diff --git a/src/lang/de/admin.php b/src/lang/de/admin.php
index e153c17..16f4956 100644
--- a/src/lang/de/admin.php
+++ b/src/lang/de/admin.php
@@ -51,7 +51,9 @@ $content['LN_GEN_GLOBAL'] = "Global";
$content['LN_GEN_USERONLY_LONG'] = "For me only
(Only available to your user)";
$content['LN_GEN_GROUPONLY_LONG'] = "For this group
(Only available to the selected group)";
$content['LN_GEN_GROUPONLYNAME'] = "Group '%1'";
-
+$content['LN_ADMIN_POPUPHELP'] = "Details on this function";
+$content['LN_ADMIN_DBSTATS'] = "Show database statistics.";
+$content['LN_ADMIN_CLEARDATA'] = "If you need to remove old data records, use this function.";
// General Options
$content['LN_ADMIN_GLOBFRONTEND'] = "Global frontend options";
@@ -91,6 +93,10 @@ $content['LN_ADMIN_GLOBALONLY'] = "Global Options Only";
$content['LN_GEN_DEBUGTOSYSLOG'] = "Send Debug to local syslog server";
$content['LN_GEN_POPUPMENUTIMEOUT'] = "Popupmenu Timeout in milli seconds";
$content['LN_ADMIN_SCRIPTTIMEOUT'] = "PHP Script Timeout in seconds";
+$content['LN_GEN_INJECTHTMLHEADER'] = "Inject this html code into the <head> area.";
+$content['LN_GEN_INJECTBODYHEADER'] = "Inject this html code at the beginning of the <body> area.";
+$content['LN_GEN_INJECTBODYFOOTER'] = "Inject this html code at the end <body> area.";
+$content['LN_ADMIN_PHPLOGCON_LOGOURL'] = "Optional phpLogCon Logo URL. Leave empty to use the default one.";
// User Center
$content['LN_USER_CENTER'] = "User Options";
@@ -224,6 +230,21 @@ $content['LN_SOURCES_ERROR_DELSOURCE'] = "Deleting of the Source with id '%1' fa
$content['LN_SOURCES_ERROR_HASBEENDEL'] = "The Source '%1' has been successfully deleted!";
$content['LN_SOURCES_DESCRIPTION'] = "Source Description (Optional)";
$content['LN_SOURCES_ERROR_INVALIDVALUE'] = "Invalid value for the paramater '%1'.";
+$content['LN_SOURCES_STATSNAME'] = "Name";
+$content['LN_SOURCES_STATSVALUE'] = "Value";
+$content['LN_SOURCES_DETAILS'] = "Details for this logstream source";
+$content['LN_SOURCES_STATSDETAILS'] = "Statistic details for this logstream source";
+$content['LN_SOURCES_ERROR_NOSTATSDATA'] = "Could not find or obtain any stats related information for this logstream source.";
+$content['LN_SOURCES_ERROR_NOCLEARSUPPORT'] = "This logstream source does not support deleting data.";
+$content['LN_SOURCES_ROWCOUNT'] = "Total Rowcount";
+$content['LN_SOURCES_CLEAR_HELPTEXT'] = "Attention! Be carefull with deleting data, any action performed here can not be undone!";
+$content['LN_SOURCES_CLEARSINCE'] = "Clear all data older than ... ";
+$content['LN_SOURCES_CLEARDATE'] = "Clear all data which is older than ... ";
+$content['LN_SOURCES_CLEARDATA_SEND'] = "Clear selected data range";
+$content['LN_SOURCES_ERROR_INVALIDCLEANUP'] = "Invalid Data Cleanup type";
+$content['LN_SOURCES_WARNDELETEDATA'] = "Are you sure that you want to clear logdata in the '%1' source? This cannot be undone!";
+$content['LN_SOURCES_ERROR_DELDATA'] = "Could not delete data in the '%1' source";
+$content['LN_SOURCES_HASBEENDELDATA'] = "Successfully deleted data from the '%1' source, '%2' rows were affected. ";
// Database Upgrade
$content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update";
diff --git a/src/lang/en/admin.php b/src/lang/en/admin.php
index da98e03..70699d4 100644
--- a/src/lang/en/admin.php
+++ b/src/lang/en/admin.php
@@ -51,6 +51,9 @@ $content['LN_GEN_GLOBAL'] = "Global";
$content['LN_GEN_USERONLY_LONG'] = "For me only
(Only available to your user)";
$content['LN_GEN_GROUPONLY_LONG'] = "For this group
(Only available to the selected group)";
$content['LN_GEN_GROUPONLYNAME'] = "Group '%1'";
+$content['LN_ADMIN_POPUPHELP'] = "Details on this function";
+$content['LN_ADMIN_DBSTATS'] = "Show database statistics.";
+$content['LN_ADMIN_CLEARDATA'] = "If you need to remove old data records, use this function.";
// General Options
$content['LN_ADMIN_GLOBFRONTEND'] = "Global frontend options";
@@ -95,6 +98,7 @@ $content['LN_ADMIN_SCRIPTTIMEOUT'] = "PHP Script Timeout in seconds";
$content['LN_GEN_INJECTHTMLHEADER'] = "Inject this html code into the <head> area.";
$content['LN_GEN_INJECTBODYHEADER'] = "Inject this html code at the beginning of the <body> area.";
$content['LN_GEN_INJECTBODYFOOTER'] = "Inject this html code at the end <body> area.";
+$content['LN_ADMIN_PHPLOGCON_LOGOURL'] = "Optional phpLogCon Logo URL. Leave empty to use the default one.";
// User Center
$content['LN_USER_CENTER'] = "User Options";
@@ -228,6 +232,24 @@ $content['LN_SOURCES_ERROR_DELSOURCE'] = "Deleting of the Source with id '%1' fa
$content['LN_SOURCES_ERROR_HASBEENDEL'] = "The Source '%1' has been successfully deleted!";
$content['LN_SOURCES_DESCRIPTION'] = "Source Description (Optional)";
$content['LN_SOURCES_ERROR_INVALIDVALUE'] = "Invalid value for the paramater '%1'.";
+$content['LN_SOURCES_STATSNAME'] = "Name";
+$content['LN_SOURCES_STATSVALUE'] = "Value";
+$content['LN_SOURCES_DETAILS'] = "Details for this logstream source";
+$content['LN_SOURCES_STATSDETAILS'] = "Statistic details for this logstream source";
+$content['LN_SOURCES_ERROR_NOSTATSDATA'] = "Could not find or obtain any stats related information for this logstream source.";
+$content['LN_SOURCES_ERROR_NOCLEARSUPPORT'] = "This logstream source does not support deleting data.";
+$content['LN_SOURCES_ROWCOUNT'] = "Total Rowcount";
+$content['LN_SOURCES_CLEARDATA'] = "The following database maintenance Options are available";
+$content['LN_SOURCES_CLEAROPTIONS'] = "Select how you want to clear data.";
+$content['LN_SOURCES_CLEARALL'] = "Clear (Delete) all data.";
+$content['LN_SOURCES_CLEAR_HELPTEXT'] = "Attention! Be carefull with deleting data, any action performed here can not be undone!";
+$content['LN_SOURCES_CLEARSINCE'] = "Clear all data older than ... ";
+$content['LN_SOURCES_CLEARDATE'] = "Clear all data which is older than ... ";
+$content['LN_SOURCES_CLEARDATA_SEND'] = "Clear selected data range";
+$content['LN_SOURCES_ERROR_INVALIDCLEANUP'] = "Invalid Data Cleanup type";
+$content['LN_SOURCES_WARNDELETEDATA'] = "Are you sure that you want to clear logdata in the '%1' source? This cannot be undone!";
+$content['LN_SOURCES_ERROR_DELDATA'] = "Could not delete data in the '%1' source";
+$content['LN_SOURCES_HASBEENDELDATA'] = "Successfully deleted data from the '%1' source, '%2' rows were affected. ";
// Database Upgrade
$content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update";
diff --git a/src/lang/pt_BR/admin.php b/src/lang/pt_BR/admin.php
index e153c17..16f4956 100644
--- a/src/lang/pt_BR/admin.php
+++ b/src/lang/pt_BR/admin.php
@@ -51,7 +51,9 @@ $content['LN_GEN_GLOBAL'] = "Global";
$content['LN_GEN_USERONLY_LONG'] = "For me only
(Only available to your user)";
$content['LN_GEN_GROUPONLY_LONG'] = "For this group
(Only available to the selected group)";
$content['LN_GEN_GROUPONLYNAME'] = "Group '%1'";
-
+$content['LN_ADMIN_POPUPHELP'] = "Details on this function";
+$content['LN_ADMIN_DBSTATS'] = "Show database statistics.";
+$content['LN_ADMIN_CLEARDATA'] = "If you need to remove old data records, use this function.";
// General Options
$content['LN_ADMIN_GLOBFRONTEND'] = "Global frontend options";
@@ -91,6 +93,10 @@ $content['LN_ADMIN_GLOBALONLY'] = "Global Options Only";
$content['LN_GEN_DEBUGTOSYSLOG'] = "Send Debug to local syslog server";
$content['LN_GEN_POPUPMENUTIMEOUT'] = "Popupmenu Timeout in milli seconds";
$content['LN_ADMIN_SCRIPTTIMEOUT'] = "PHP Script Timeout in seconds";
+$content['LN_GEN_INJECTHTMLHEADER'] = "Inject this html code into the <head> area.";
+$content['LN_GEN_INJECTBODYHEADER'] = "Inject this html code at the beginning of the <body> area.";
+$content['LN_GEN_INJECTBODYFOOTER'] = "Inject this html code at the end <body> area.";
+$content['LN_ADMIN_PHPLOGCON_LOGOURL'] = "Optional phpLogCon Logo URL. Leave empty to use the default one.";
// User Center
$content['LN_USER_CENTER'] = "User Options";
@@ -224,6 +230,21 @@ $content['LN_SOURCES_ERROR_DELSOURCE'] = "Deleting of the Source with id '%1' fa
$content['LN_SOURCES_ERROR_HASBEENDEL'] = "The Source '%1' has been successfully deleted!";
$content['LN_SOURCES_DESCRIPTION'] = "Source Description (Optional)";
$content['LN_SOURCES_ERROR_INVALIDVALUE'] = "Invalid value for the paramater '%1'.";
+$content['LN_SOURCES_STATSNAME'] = "Name";
+$content['LN_SOURCES_STATSVALUE'] = "Value";
+$content['LN_SOURCES_DETAILS'] = "Details for this logstream source";
+$content['LN_SOURCES_STATSDETAILS'] = "Statistic details for this logstream source";
+$content['LN_SOURCES_ERROR_NOSTATSDATA'] = "Could not find or obtain any stats related information for this logstream source.";
+$content['LN_SOURCES_ERROR_NOCLEARSUPPORT'] = "This logstream source does not support deleting data.";
+$content['LN_SOURCES_ROWCOUNT'] = "Total Rowcount";
+$content['LN_SOURCES_CLEAR_HELPTEXT'] = "Attention! Be carefull with deleting data, any action performed here can not be undone!";
+$content['LN_SOURCES_CLEARSINCE'] = "Clear all data older than ... ";
+$content['LN_SOURCES_CLEARDATE'] = "Clear all data which is older than ... ";
+$content['LN_SOURCES_CLEARDATA_SEND'] = "Clear selected data range";
+$content['LN_SOURCES_ERROR_INVALIDCLEANUP'] = "Invalid Data Cleanup type";
+$content['LN_SOURCES_WARNDELETEDATA'] = "Are you sure that you want to clear logdata in the '%1' source? This cannot be undone!";
+$content['LN_SOURCES_ERROR_DELDATA'] = "Could not delete data in the '%1' source";
+$content['LN_SOURCES_HASBEENDELDATA'] = "Successfully deleted data from the '%1' source, '%2' rows were affected. ";
// Database Upgrade
$content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update";
diff --git a/src/templates/admin/admin_index.html b/src/templates/admin/admin_index.html
index 1c16c45..822991f 100644
--- a/src/templates/admin/admin_index.html
+++ b/src/templates/admin/admin_index.html
@@ -238,18 +238,22 @@
{LN_ADMIN_GLOBALONLY}
-
+
|
-
-
+
+ |
+
+
+
|
-
+
|
+
|
diff --git a/src/templates/admin/admin_sources.html b/src/templates/admin/admin_sources.html
index 2e19195..4640410 100644
--- a/src/templates/admin/admin_sources.html
+++ b/src/templates/admin/admin_sources.html
@@ -58,8 +58,8 @@
-
-
+
+
@@ -85,14 +85,154 @@
+
+
+
+
+
+
+ |
- {LN_SOURCES_ADD} |
+ {LN_SOURCES_ADD} |
+
+
+
+
+
+
+
+ {SOURCEID} |
+
+
+
+ {DisplayName} |
+
+
+
+ {SourceTypeName} |
+
+
+
+ {ROWCOUNT} |
+
+
+
+
+
+
+
+ {LN_GEN_ERRORRETURNPREV}
+
+
+
+
+
+
+
+
+
+ {SOURCEID} |
+
+
+
+ {DisplayName} |
+
+
+
+ {SourceTypeName} |
+
+
+
+ {Description} |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {StatsDisplayName} |
+ {StatsValue} |
+
+
+
+
+
+
+ {LN_GEN_ERRORRETURNPREV}
+
+
+