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 c7b7ba4..b1539ec 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,107 @@ 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
+ {
+
+
+
+ }
+ }
+ 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']) )
+ {
+ $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 +465,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 +480,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
diff --git a/src/classes/logstream.class.php b/src/classes/logstream.class.php
index e08773e..4a0c704 100644
--- a/src/classes/logstream.class.php
+++ b/src/classes/logstream.class.php
@@ -212,6 +212,13 @@ abstract class LogStream {
*/
public abstract function IsPropertySortable($myProperty);
+
+ /**
+ * This returns an Array of useful statsdata for this logstream source
+ */
+ public abstract function GetLogStreamStats();
+
+
/*
* Helper functino to trigger initialisation of MsgParsers
*/
diff --git a/src/classes/logstreamdb.class.php b/src/classes/logstreamdb.class.php
index 2c9bfe7..f2faea1 100644
--- a/src/classes/logstreamdb.class.php
+++ b/src/classes/logstreamdb.class.php
@@ -538,6 +538,65 @@ 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 GetCountSortedByField
*
diff --git a/src/classes/logstreamdisk.class.php b/src/classes/logstreamdisk.class.php
index 148c1aa..897321b 100644
--- a/src/classes/logstreamdisk.class.php
+++ b/src/classes/logstreamdisk.class.php
@@ -598,6 +598,28 @@ 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 GetCountSortedByField
*
diff --git a/src/classes/logstreampdo.class.php b/src/classes/logstreampdo.class.php
index 9760317..132bb1d 100644
--- a/src/classes/logstreampdo.class.php
+++ b/src/classes/logstreampdo.class.php
@@ -534,6 +534,55 @@ 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 GetCountSortedByField
*
diff --git a/src/include/functions_common.php b/src/include/functions_common.php
index 3937368..a6dabc9 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'] = "";
@@ -814,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' );
@@ -1387,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()
@@ -1515,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/lang/de/admin.php b/src/lang/de/admin.php
index 774d006..c1bb8a6 100644
--- a/src/lang/de/admin.php
+++ b/src/lang/de/admin.php
@@ -93,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";
@@ -226,6 +230,11 @@ $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.";
// Database Upgrade
$content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update";
diff --git a/src/lang/en/admin.php b/src/lang/en/admin.php
index dbd0039..1eabfd0 100644
--- a/src/lang/en/admin.php
+++ b/src/lang/en/admin.php
@@ -98,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";
@@ -231,6 +232,12 @@ $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.";
+
// 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 774d006..c1bb8a6 100644
--- a/src/lang/pt_BR/admin.php
+++ b/src/lang/pt_BR/admin.php
@@ -93,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";
@@ -226,6 +230,11 @@ $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.";
// 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 cae9485..e7a80b7 100644
--- a/src/templates/admin/admin_sources.html
+++ b/src/templates/admin/admin_sources.html
@@ -100,6 +100,57 @@
+
+
+
+
+
+
+
+
+ {SOURCEID} |
+
+
+
+ {DisplayName} |
+
+
+
+ {SourceTypeName} |
+
+
+
+ {Description} |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {StatsDisplayName} |
+ {StatsValue} |
+
+
+
+
+
+
+ {LN_GEN_ERRORRETURNPREV}
+
+
+