From 7a15a177372cb13b5d50933b5797c3f288155493 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 25 Apr 2008 17:43:51 +0200 Subject: [PATCH 01/79] Added backlink to ListView in detailpage and added Records per Page selector The records per page selector makes it possible to change the pagesize on the fly. By default, the pagesize from the config.php will be used. --- src/include/functions_common.php | 49 +++++++++++++++++++++++++------- src/index.php | 4 +-- src/lang/de/main.php | 1 + src/lang/en/main.php | 1 + src/templates/details.html | 3 +- src/templates/index.html | 19 ++++++++++++- src/userchange.php | 11 +++++-- 7 files changed, 71 insertions(+), 17 deletions(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 9df8945..11a2332 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -183,6 +183,9 @@ function InitPhpLogCon() // Init Predefined Searches List CreatePredefinedSearches(); + // Init predefined paging sizes + CreatePagesizesList(); + // --- Enable PHP Debug Mode InitPhpDebugMode(); // --- @@ -241,6 +244,23 @@ function CreateDBTypesList( $selectedDBType ) } +function CreatePagesizesList() +{ + global $CFG, $content; + + $content['pagesizes'][0] = array( "ID" => 0, "Selected" => "", "DisplayName" => "Preconfigured (" . $CFG['ViewEntriesPerPage'] . ")", "Value" => $CFG['ViewEntriesPerPage'] ); + $content['pagesizes'][1] = array( "ID" => 1, "Selected" => "", "DisplayName" => " 25 records per page", "Value" => 25 ); + $content['pagesizes'][2] = array( "ID" => 2, "Selected" => "", "DisplayName" => " 50 records per page", "Value" => 50 ); + $content['pagesizes'][3] = array( "ID" => 3, "Selected" => "", "DisplayName" => " 75 records per page", "Value" => 75 ); + $content['pagesizes'][4] = array( "ID" => 4, "Selected" => "", "DisplayName" => " 100 records per page", "Value" => 100 ); + + // Set default selected pagesize + $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Selected"] = "selected"; + + // The content variable will now contain the user selected oaging size + $content["ViewEntriesPerPage"] = $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Value"]; +} + function CreatePredefinedSearches() { global $CFG, $content; @@ -316,17 +336,17 @@ function InitFrontEndVariables() { global $content; - $content['MENU_FOLDER_OPEN'] = "image=" . $content['BASEPATH'] . "images/icons/folder_closed.png"; - $content['MENU_FOLDER_CLOSED'] = "overimage=" . $content['BASEPATH'] . "images/icons/folder.png"; - $content['MENU_HOMEPAGE'] = "image=" . $content['BASEPATH'] . "images/icons/home.png"; - $content['MENU_LINK'] = "image=" . $content['BASEPATH'] . "images/icons/link.png"; - $content['MENU_PREFERENCES'] = "image=" . $content['BASEPATH'] . "images/icons/preferences.png"; - $content['MENU_ADMINENTRY'] = "image=" . $content['BASEPATH'] . "images/icons/star_blue.png"; - $content['MENU_ADMINLOGOFF'] = "image=" . $content['BASEPATH'] . "images/icons/exit.png"; - $content['MENU_ADMINUSERS'] = "image=" . $content['BASEPATH'] . "images/icons/businessmen.png"; - $content['MENU_SEARCH'] = "image=" . $content['BASEPATH'] . "images/icons/view.png"; - $content['MENU_SELECTION_DISABLED'] = "image=" . $content['BASEPATH'] . "images/icons/selection.png"; - $content['MENU_SELECTION_ENABLED'] = "image=" . $content['BASEPATH'] . "images/icons/selection_delete.png"; + $content['MENU_FOLDER_OPEN'] = $content['BASEPATH'] . "images/icons/folder_closed.png"; + $content['MENU_FOLDER_CLOSED'] = $content['BASEPATH'] . "images/icons/folder.png"; + $content['MENU_HOMEPAGE'] = $content['BASEPATH'] . "images/icons/home.png"; + $content['MENU_LINK'] = $content['BASEPATH'] . "images/icons/link.png"; + $content['MENU_PREFERENCES'] = $content['BASEPATH'] . "images/icons/preferences.png"; + $content['MENU_ADMINENTRY'] = $content['BASEPATH'] . "images/icons/star_blue.png"; + $content['MENU_ADMINLOGOFF'] = $content['BASEPATH'] . "images/icons/exit.png"; + $content['MENU_ADMINUSERS'] = $content['BASEPATH'] . "images/icons/businessmen.png"; + $content['MENU_SEARCH'] = $content['BASEPATH'] . "images/icons/view.png"; + $content['MENU_SELECTION_DISABLED'] = $content['BASEPATH'] . "images/icons/selection.png"; + $content['MENU_SELECTION_ENABLED'] = $content['BASEPATH'] . "images/icons/selection_delete.png"; $content['MENU_PAGER_BEGIN'] = $content['BASEPATH'] . "images/icons/media_beginning.png"; $content['MENU_PAGER_PREVIOUS'] = $content['BASEPATH'] . "images/icons/media_rewind.png"; @@ -412,6 +432,13 @@ function InitConfigurationValues() } } + // Paging Size handling! + if ( !isset($_SESSION['PAGESIZE_ID']) ) + { + // Default is 0! + $_SESSION['PAGESIZE_ID'] = 0; + } + // Theme Handling if ( !isset($content['web_theme']) ) { $content['web_theme'] = $CFG['ViewDefaultTheme'] /*"default"*/; } if ( isset($_SESSION['CUSTOM_THEME']) && VerifyTheme($_SESSION['CUSTOM_THEME']) ) diff --git a/src/index.php b/src/index.php index 24e08a9..11199ba 100644 --- a/src/index.php +++ b/src/index.php @@ -396,11 +396,11 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // Increment Counter $counter++; - } while ($counter < $CFG['ViewEntriesPerPage'] && ($ret = $stream->ReadNext($uID, $logArray)) == SUCCESS); + } while ($counter < $content['ViewEntriesPerPage'] && ($ret = $stream->ReadNext($uID, $logArray)) == SUCCESS); //print_r ( $content['syslogmessages'] ); - if ( $content['main_recordcount'] == -1 || $content['main_recordcount'] > $CFG['ViewEntriesPerPage'] ) + if ( $content['main_recordcount'] == -1 || $content['main_recordcount'] > $content['ViewEntriesPerPage'] ) { // Enable Pager in any case here! $content['main_pagerenabled'] = true; diff --git a/src/lang/de/main.php b/src/lang/de/main.php index 055cbf6..ce728b7 100644 --- a/src/lang/de/main.php +++ b/src/lang/de/main.php @@ -118,5 +118,6 @@ $content['LN_CFG_FIRSTSYSLOGSOURCE'] = "Erste Syslog Quelle"; // Details page $content['LN_DETAILS_FORSYSLOGMSG'] = "Details for the syslog messages with id"; $content['LN_DETAILS_DETAILSFORMSG'] = "Details for message id"; +$content['LN_DETAIL_BACKTOLIST'] = "Back to Listview"; ?> diff --git a/src/lang/en/main.php b/src/lang/en/main.php index eeca194..99d76e4 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -118,5 +118,6 @@ $content['LN_CFG_FIRSTSYSLOGSOURCE'] = "First Syslog Source"; // Details page $content['LN_DETAILS_FORSYSLOGMSG'] = "Details for the syslog messages with id"; $content['LN_DETAILS_DETAILSFORMSG'] = "Details for message id"; +$content['LN_DETAIL_BACKTOLIST'] = "Back to Listview"; ?> \ No newline at end of file diff --git a/src/templates/details.html b/src/templates/details.html index e3d1b65..3df4db9 100644 --- a/src/templates/details.html +++ b/src/templates/details.html @@ -7,7 +7,8 @@ - - + From 424bfed63b9e7d3ac2560b16789636fef2f904cc Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 30 Apr 2008 17:05:41 +0200 Subject: [PATCH 11/79] Changed Msgtype Eventreporter into WinEventLog --- src/include/constants_filters.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/constants_filters.php b/src/include/constants_filters.php index 18fabb0..5447e78 100644 --- a/src/include/constants_filters.php +++ b/src/include/constants_filters.php @@ -107,7 +107,7 @@ $content['filter_severity_list'][] = array( "ID" => SYSLOG_DEBUG, "DisplayName" // Init MessageType LIST //$content['filter_messagetype_list'][] = array( "ID" => IUT_Unknown, "DisplayName" => "Unknown", "selected" => "" ); $content['filter_messagetype_list'][] = array( "ID" => IUT_Syslog, "DisplayName" => "Syslog", "selected" => "" ); -$content['filter_messagetype_list'][] = array( "ID" => IUT_NT_EventReport, "DisplayName" => "EventReporter", "selected" => "" ); +$content['filter_messagetype_list'][] = array( "ID" => IUT_NT_EventReport, "DisplayName" => "WinEventLog", "selected" => "" ); $content['filter_messagetype_list'][] = array( "ID" => IUT_File_Monitor, "DisplayName" => "File Monitor", "selected" => "" ); ?> \ No newline at end of file From 99b9857cf6a708ce14de703ed193c41cfffb9b32 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 30 Apr 2008 17:44:45 +0200 Subject: [PATCH 12/79] Made DB Row Counting configurable for better performance. If you have a large database, it is recommended to turn DB Row Counting off as it will have impact on the performance of phplogcon. However if you have a smaller database below 500000 records), it is a very nice feature. --- src/classes/logstreamconfigdb.class.php | 1 + src/classes/logstreamdb.class.php | 32 ++++++++++++++----------- src/include/functions_config.php | 1 + src/install.php | 21 +++++++++++++++- src/lang/en/main.php | 1 + src/templates/install.html | 6 +++++ 6 files changed, 47 insertions(+), 15 deletions(-) diff --git a/src/classes/logstreamconfigdb.class.php b/src/classes/logstreamconfigdb.class.php index d59d197..672758f 100644 --- a/src/classes/logstreamconfigdb.class.php +++ b/src/classes/logstreamconfigdb.class.php @@ -47,6 +47,7 @@ class LogStreamConfigDB extends LogStreamConfig { public $DBType = DB_MYSQL; // Default = MYSQL! public $DBTableType = 'winsyslog'; // Default = WINSYSLOG DB Layout! public $DBTableName = 'systemevents'; // Default Tabelname from WINSYSLOG + public $DBEnableRowCounting = true; // Default RowCounting is enabled! // Runtime configuration variables public $RecordsPerQuery = 100; // This will determine how to limit sql statements diff --git a/src/classes/logstreamdb.class.php b/src/classes/logstreamdb.class.php index b274aae..93c073f 100644 --- a/src/classes/logstreamdb.class.php +++ b/src/classes/logstreamdb.class.php @@ -112,12 +112,6 @@ class LogStreamDB extends LogStream { // Create SQL Where Clause first! $this->CreateSQLWhereClause(); - // Obtain count of records -// $this->_totalRecordCount = $this->GetRowCountFromTable(); -// -// if ( $this->_totalRecordCount <= 0 ) -// return ERROR_NOMORERECORDS; - // Success, this means we init the Pagenumber to ONE! $this->_currentPageNumber = 1; @@ -275,7 +269,13 @@ class LogStreamDB extends LogStream { $bFound = false; $tmpuID = $uID; $ret = ERROR_NOMORERECORDS; // Set Default error code! - $totalpages = intval($this->_totalRecordCount / $this->_logStreamConfigObj->_pageCount); + + // Set totalpages number if available + if ( $this->_totalRecordCount != -1 ) + $totalpages = intval($this->_totalRecordCount / $this->_logStreamConfigObj->_pageCount); + else + $totalpages = 1; + while( $bFound == false && $this->ReadNextIDsFromDB() == SUCCESS ) { foreach ( $this->bufferedRecords as $myRecord ) @@ -602,8 +602,8 @@ class LogStreamDB extends LogStream { // Free Query ressources mysql_free_result ($myquery); - // Obtain count of records if needed! - if ( $this->_totalRecordCount == -1 ) + // Only obtain count if enabled and not done before + if ( $this->_logStreamConfigObj->DBEnableRowCounting && $this->_totalRecordCount == -1 ) { $this->_totalRecordCount = $this->GetRowCountFromTable(); @@ -650,8 +650,8 @@ class LogStreamDB extends LogStream { // Free Query ressources mysql_free_result ($myquery); - // Obtain count of records if needed! - if ( $this->_totalRecordCount == -1 ) + // Only obtain count if enabled and not done before + if ( $this->_logStreamConfigObj->DBEnableRowCounting && $this->_totalRecordCount == -1 ) { $this->_totalRecordCount = $this->GetRowCountFromTable(); @@ -677,8 +677,13 @@ class LogStreamDB extends LogStream { $szTableType = $this->_logStreamConfigObj->DBTableType; $szSortColumn = $this->_logStreamConfigObj->SortColumn; - // Create SQL String - $sqlString = "SELECT SQL_CALC_FOUND_ROWS " . $dbmapping[$szTableType][SYSLOG_UID]; + // Create Basic SQL String + if ( $this->_logStreamConfigObj->DBEnableRowCounting ) // with SQL_CALC_FOUND_ROWS + $sqlString = "SELECT SQL_CALC_FOUND_ROWS " . $dbmapping[$szTableType][SYSLOG_UID]; + else // without row calc + $sqlString = "SELECT " . $dbmapping[$szTableType][SYSLOG_UID]; + + // Append fields if needed if ( $includeFields && $this->_arrProperties != null ) { // Loop through all requested fields @@ -776,7 +781,6 @@ class LogStreamDB extends LogStream { */ private function GetRowCountFromTable() { - global $querycount; if ( $myquery = mysql_query("Select FOUND_ROWS();", $this->_dbhandle) ) { // Get first and only row! diff --git a/src/include/functions_config.php b/src/include/functions_config.php index 639aed9..bb81085 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -98,6 +98,7 @@ if ( isset($mysource['DBPort']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBPort = $mysource['DBPort']; } if ( isset($mysource['DBUser']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBUser = $mysource['DBUser']; } if ( isset($mysource['DBPassword']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBPassword = $mysource['DBPassword']; } + if ( isset($mysource['DBEnableRowCounting']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBEnableRowCounting = $mysource['DBEnableRowCounting']; } } else { diff --git a/src/install.php b/src/install.php index fd58d56..46d4258 100644 --- a/src/install.php +++ b/src/install.php @@ -476,6 +476,17 @@ else if ( $content['INSTALL_STEP'] == 7 ) if ( isset($_SESSION['SourceDBTableName']) ) { $content['SourceDBTableName'] = $_SESSION['SourceDBTableName']; } else { $content['SourceDBTableName'] = "systemevents"; } if ( isset($_SESSION['SourceDBUser']) ) { $content['SourceDBUser'] = $_SESSION['SourceDBUser']; } else { $content['SourceDBUser'] = "user"; } if ( isset($_SESSION['SourceDBPassword']) ) { $content['SourceDBPassword'] = $_SESSION['SourceDBPassword']; } else { $content['SourceDBPassword'] = ""; } + if ( isset($_SESSION['SourceDBEnableRowCounting']) ) { $content['SourceDBEnableRowCounting'] = $_SESSION['SourceDBEnableRowCounting']; } else { $content['SourceDBEnableRowCounting'] = "false"; } + if ( $content['SourceDBEnableRowCounting'] == "true" ) + { + $content['SourceDBEnableRowCounting_true'] = "checked"; + $content['SourceDBEnableRowCounting_false'] = ""; + } + else + { + $content['SourceDBEnableRowCounting_true'] = ""; + $content['SourceDBEnableRowCounting_false'] = "checked"; + } // Check for Error Msg if ( isset($_GET['errormsg']) ) @@ -550,7 +561,14 @@ else if ( $content['INSTALL_STEP'] == 8 ) $_SESSION['SourceDBPassword'] = DB_RemoveBadChars($_POST['SourceDBPassword']); else $_SESSION['SourceDBPassword'] = ""; - + + if ( isset($_POST['SourceDBEnableRowCounting']) ) + { + $_SESSION['SourceDBEnableRowCounting'] = DB_RemoveBadChars($_POST['SourceDBEnableRowCounting']); + if ( $_SESSION['SourceDBEnableRowCounting'] != "true" ) + $_SESSION['SourceDBEnableRowCounting'] = "false"; + } + // TODO: Check database connectivity! } @@ -592,6 +610,7 @@ else if ( $content['INSTALL_STEP'] == 8 ) "\$CFG['Sources']['Source1']['DBUser'] = '" . $_SESSION['SourceDBUser'] . "';\r\n" . "\$CFG['Sources']['Source1']['DBPassword'] = '" . $_SESSION['SourceDBPassword'] . "';\r\n" . "\$CFG['Sources']['Source1']['DBTableName'] = '" . $_SESSION['SourceDBTableName'] . "';\r\n" . + "\$CFG['Sources']['Source1']['DBEnableRowCounting'] = " . $_SESSION['SourceDBEnableRowCounting'] . ";\r\n" . ""; } $patterns[] = "/\/\/ --- \%Insert Source Here\%/"; diff --git a/src/lang/en/main.php b/src/lang/en/main.php index 2979ce3..84c25b4 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -123,6 +123,7 @@ $content['LN_CFG_DBSTORAGEENGINE'] = "Database Storage Engine"; $content['LN_CFG_DBTABLENAME'] = "Database Tablename"; $content['LN_CFG_NAMEOFTHESOURCE'] = "Name of the Source"; $content['LN_CFG_FIRSTSYSLOGSOURCE'] = "First Syslog Source"; +$content['LN_CFG_DBROWCOUNTING'] = "Enable Row Counting"; // Details page $content['LN_DETAILS_FORSYSLOGMSG'] = "Details for the syslog messages with id"; diff --git a/src/templates/install.html b/src/templates/install.html index e07614d..f3bd217 100644 --- a/src/templates/install.html +++ b/src/templates/install.html @@ -331,6 +331,12 @@ + + + +
+ + {LN_DETAIL_BACKTOLIST} {LN_GEN_PAGE} {main_currentpagenumber} diff --git a/src/templates/index.html b/src/templates/index.html index 2636778..d1e8c77 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -101,7 +101,24 @@ {LN_GEN_PAGERSIZE}:{ViewEntriesPerPage} + +
+ + + + + +
+ +
+
+ +
Pager:   diff --git a/src/userchange.php b/src/userchange.php index 4a4a36e..6e8ad39 100644 --- a/src/userchange.php +++ b/src/userchange.php @@ -50,17 +50,24 @@ else if ( isset($_GET['op']) ) { - if ( $_GET['op'] == "changestyle" ) + if ( $_GET['op'] == "changestyle" && isset($_GET['stylename']) ) { if ( VerifyTheme($_GET['stylename']) ) $_SESSION['CUSTOM_THEME'] = $_GET['stylename']; } - if ( $_GET['op'] == "changelang" ) + if ( $_GET['op'] == "changelang" && isset($_GET['langcode']) ) { if ( VerifyLanguage($_GET['langcode']) ) $_SESSION['CUSTOM_LANG'] = $_GET['langcode']; } + + if ( $_GET['op'] == "changepagesize" && isset($_GET['pagesizeid']) ) + { + if ( intval($_GET['pagesizeid']) >= 0 && intval($_GET['pagesizeid']) < 5 ) + $_SESSION['PAGESIZE_ID'] = intval($_GET['pagesizeid']); + } + } // Final redirect From 1731d487279b8c1c82a117d73535fed9482c9f80 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 25 Apr 2008 18:52:33 +0200 Subject: [PATCH 02/79] [cosmetic] format of ChangeLog --- ChangeLog | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 47f1f9c..69546ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,7 +9,6 @@ Version 2.1.1 (devel), 2008-04-25 button is available now in the install script. This removes the duplicated ones from before. - added full german translation (thanks to Tom Bergfeld for providing it) - - +--------------------------------------------------------------------------- Version 2.1.0 (devel), 2008-04-24 - initial release of the rewritten phpLogCon v2 From a5f0fb0ac9bb91ff00ec9a7c9963bd7178590728 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 28 Apr 2008 11:52:17 +0200 Subject: [PATCH 03/79] Added two more record per page sizes, 250 records and 500 records. --- src/include/functions_common.php | 12 +++++++----- src/lang/en/main.php | 3 +++ src/userchange.php | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 11a2332..f8fe7ab 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -248,11 +248,13 @@ function CreatePagesizesList() { global $CFG, $content; - $content['pagesizes'][0] = array( "ID" => 0, "Selected" => "", "DisplayName" => "Preconfigured (" . $CFG['ViewEntriesPerPage'] . ")", "Value" => $CFG['ViewEntriesPerPage'] ); - $content['pagesizes'][1] = array( "ID" => 1, "Selected" => "", "DisplayName" => " 25 records per page", "Value" => 25 ); - $content['pagesizes'][2] = array( "ID" => 2, "Selected" => "", "DisplayName" => " 50 records per page", "Value" => 50 ); - $content['pagesizes'][3] = array( "ID" => 3, "Selected" => "", "DisplayName" => " 75 records per page", "Value" => 75 ); - $content['pagesizes'][4] = array( "ID" => 4, "Selected" => "", "DisplayName" => " 100 records per page", "Value" => 100 ); + $content['pagesizes'][0] = array( "ID" => 0, "Selected" => "", "DisplayName" => $content['LN_GEN_PRECONFIGURED'] . " (" . $CFG['ViewEntriesPerPage'] . ")", "Value" => $CFG['ViewEntriesPerPage'] ); + $content['pagesizes'][1] = array( "ID" => 1, "Selected" => "", "DisplayName" => " 25 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 25 ); + $content['pagesizes'][2] = array( "ID" => 2, "Selected" => "", "DisplayName" => " 50 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 50 ); + $content['pagesizes'][3] = array( "ID" => 3, "Selected" => "", "DisplayName" => " 75 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 75 ); + $content['pagesizes'][4] = array( "ID" => 4, "Selected" => "", "DisplayName" => " 100 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 100 ); + $content['pagesizes'][5] = array( "ID" => 5, "Selected" => "", "DisplayName" => " 250 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 250 ); + $content['pagesizes'][6] = array( "ID" => 6, "Selected" => "", "DisplayName" => " 500 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 500 ); // Set default selected pagesize $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Selected"] = "selected"; diff --git a/src/lang/en/main.php b/src/lang/en/main.php index 99d76e4..f95217b 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -43,6 +43,9 @@ $content['LN_GEN_PAGE'] = "Page"; $content['LN_GEN_PREDEFINEDSEARCHES'] = "Predefined Searches"; $content['LN_GEN_SOURCE_DISK'] = "Diskfile"; $content['LN_GEN_SOURCE_DB'] = "Database"; +$content['LN_GEN_RECORDSPERPAGE'] = "records per page"; +$content['LN_GEN_PRECONFIGURED'] = "Preconfigured"; + // Main Index Site $content['LN_ERROR_INSTALLFILEREMINDER'] = "Warning! You still have NOT removed the 'install.php' from your phpLogCon main directory!"; diff --git a/src/userchange.php b/src/userchange.php index 6e8ad39..be99fa6 100644 --- a/src/userchange.php +++ b/src/userchange.php @@ -64,7 +64,7 @@ if ( isset($_GET['op']) ) if ( $_GET['op'] == "changepagesize" && isset($_GET['pagesizeid']) ) { - if ( intval($_GET['pagesizeid']) >= 0 && intval($_GET['pagesizeid']) < 5 ) + if ( intval($_GET['pagesizeid']) >= 0 && intval($_GET['pagesizeid']) < 7 ) $_SESSION['PAGESIZE_ID'] = intval($_GET['pagesizeid']); } From 148f4ce4265ef9026a1580a6a41c28fd305fba49 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 28 Apr 2008 16:21:09 +0200 Subject: [PATCH 04/79] Working on new filter functions when you search for events ... --- src/include/constants_logstream.php | 6 +++--- src/index.php | 6 ++++++ src/samplelogs/syslog | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/include/constants_logstream.php b/src/include/constants_logstream.php index d720bc5..9287183 100644 --- a/src/include/constants_logstream.php +++ b/src/include/constants_logstream.php @@ -89,13 +89,13 @@ $fields[SYSLOG_HOST]['FieldCaptionID'] = 'LN_FIELDS_HOST'; $fields[SYSLOG_HOST]['FieldType'] = FILTER_TYPE_STRING; $fields[SYSLOG_HOST]['Sortable'] = true; $fields[SYSLOG_HOST]['DefaultWidth'] = "80"; -$fields[SYSLOG_HOST]['FieldAlign'] = "center"; +$fields[SYSLOG_HOST]['FieldAlign'] = "left"; $fields[SYSLOG_MESSAGETYPE]['FieldID'] = SYSLOG_MESSAGETYPE; $fields[SYSLOG_MESSAGETYPE]['FieldCaptionID'] = 'LN_FIELDS_MESSAGETYPE'; $fields[SYSLOG_MESSAGETYPE]['FieldType'] = FILTER_TYPE_NUMBER; $fields[SYSLOG_MESSAGETYPE]['Sortable'] = true; $fields[SYSLOG_MESSAGETYPE]['DefaultWidth'] = "90"; -$fields[SYSLOG_MESSAGETYPE]['FieldAlign'] = "center"; +$fields[SYSLOG_MESSAGETYPE]['FieldAlign'] = "left"; // Syslog specific $fields[SYSLOG_FACILITY]['FieldID'] = SYSLOG_FACILITY; @@ -115,7 +115,7 @@ $fields[SYSLOG_SYSLOGTAG]['FieldCaptionID'] = 'LN_FIELDS_SYSLOGTAG'; $fields[SYSLOG_SYSLOGTAG]['FieldType'] = FILTER_TYPE_STRING; $fields[SYSLOG_SYSLOGTAG]['Sortable'] = true; $fields[SYSLOG_SYSLOGTAG]['DefaultWidth'] = "85"; -$fields[SYSLOG_SYSLOGTAG]['FieldAlign'] = "center"; +$fields[SYSLOG_SYSLOGTAG]['FieldAlign'] = "left"; $fields[SYSLOG_PROCESSID]['FieldID'] = SYSLOG_PROCESSID; $fields[SYSLOG_PROCESSID]['FieldCaptionID'] = 'LN_FIELDS_PROCESSID'; $fields[SYSLOG_PROCESSID]['FieldType'] = FILTER_TYPE_NUMBER; diff --git a/src/index.php b/src/index.php index 11199ba..29cb6db 100644 --- a/src/index.php +++ b/src/index.php @@ -388,6 +388,12 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c $content['syslogmessages'][$counter]['values'][$mycolkey]['messagesdetails'][$myIndex]['detailfieldvalue'] = $myfield['fieldvalue']; } } + + if ( strlen($content['searchstr']) > 0 ) + { + // Prepend button + $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = "" . $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue']; + } } } } diff --git a/src/samplelogs/syslog b/src/samplelogs/syslog index 6fca8a9..9f099c3 100644 --- a/src/samplelogs/syslog +++ b/src/samplelogs/syslog @@ -1,3 +1,19 @@ +2008-04-27T04:02:27-04:00 cmpsvr kernel: imklog 3.14.2, log source = /proc/kmsg started. +2008-04-27T04:02:27-04:00 cmpsvr kernel: Inspecting /boot/System.map-2.6.9-55.0.2.EL +2008-04-27T04:02:28-04:00 cmpsvr kernel: Loaded 24080 symbols from /boot/System.map-2.6.9-55.0.2.EL. +2008-04-27T04:02:28-04:00 cmpsvr kernel: Symbols match kernel version 2.6.9. +2008-04-27T04:02:42-04:00 cmpsvr kernel: Loaded 9698 symbols from 28 modules. +2008-04-27T04:02:42.992883-04:00 cmpsvr rsyslogd: [origin software="rsyslogd" swVersion="3.14.2" x-pid="1554" x-info="http://www.rsyslog.com"] restart +2008-04-27T04:04:13-04:00 uzdomfw pf: 1055. 619145 rule 268/0(match): block in on ng0: (tos 0x0, ttl 50, id 35580, offset 0, flags [none], proto: UDP (17), length: 485) 202.97.238.230.40659 > 76.10.159.40.1026: UDP, length 457 +2008-04-27T04:04:13-04:00 uzdomfw pf: 001346 rule 268/0(match): block in on ng0: (tos 0x0, ttl 50, id 10488, offset 0, flags [none], proto: UDP (17), length: 485) 202.97.238.230.40659 > 76.10.159.40.1027: UDP, length 457 +2008-04-27T04:04:24-04:00 uzdomfw pf: 10. 532742 rule 268/0(match): block in on ng0: (tos 0x0, ttl 50, id 9191, offset 0, flags [none], proto: UDP (17), length: 485) 202.97.238.230.40735 > 76.10.159.40.1026: UDP, length 457 +2008-04-27T04:04:24-04:00 uzdomfw pf: 001096 rule 268/0(match): block in on ng0: (tos 0x0, ttl 50, id 23751, offset 0, flags [none], proto: UDP (17), length: 485) 202.97.238.230.40735 > 76.10.159.40.1027: UDP, length 457 +2008-04-27T04:04:50.780189-04:00 cmpsvr ntpdate[9441]: adjust time server 192.168.0.55 offset 0.148018 sec +2008-04-27T04:05:51-04:00 uzdomfw pf: 87. 171897 rule 268/0(match): block in on ng0: (tos 0x0, ttl 109, id 61513, offset 0, flags [none], proto: TCP (6), length: 48) 76.10.62.133.2548 > 76.10.159.40.1433: S, cksum 0xd9ad (correct), 762117069:762117069(0) win 64240 +2008-04-27T04:16:23-04:00 uzdomfw pf: 631. 992233 rule 268/0(match): block in on ng0: (tos 0x0, ttl 49, id 51694, offset 0, flags [none], proto: UDP (17), length: 486) 221.208.208.97.46577 > 76.10.159.40.1026: UDP, length 458 +2008-04-27T04:16:23-04:00 uzdomfw pf: 049128 rule 268/0(match): block in on ng0: (tos 0x0, ttl 49, id 9090, offset 0, flags [none], proto: UDP (17), length: 486) 221.208.208.97.46577 > 76.10.159.40.1026: UDP, length 458 +2008-04-27T04:16:23-04:00 uzdomfw pf: 001210 rule 268/0(match): block in on ng0: (tos 0x0, ttl 49, id 52628, offset 0, flags [none], proto: UDP (17), length: 486) 221.208.208.97.46577 > 76.10.159.40.1027: UDP, length 458 +2008-04-27T04:18:21-04:00 uzdomfw pf: 117. 412299 rule 268/0(match): block in on ng0: (tos 0x0, ttl 112, id 30035, offset 0, flags [none], proto: TCP (6), length: 48) 76.8.177.186.3645 > 76.10.159.40.1433: S, cksum 0x74bd (correct), 4216527706:4216527706(0) win 64240 Mar 10 14:45:39 debandre syslogd 1.4.1#18: restart. Mar 10 14:45:44 debandre anacron[3226]: Job `cron.daily' terminated (mailing output) Mar 10 14:45:45 debandre anacron[3226]: Normal exit (1 job run) From 270f6da023810ef88514b8a96c3c5098ea57a427 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 28 Apr 2008 16:42:12 +0200 Subject: [PATCH 05/79] removed tracking for syslog sample file in this branch as well. --- src/samplelogs/syslog | 255 ------------------------------------------ 1 file changed, 255 deletions(-) delete mode 100644 src/samplelogs/syslog diff --git a/src/samplelogs/syslog b/src/samplelogs/syslog deleted file mode 100644 index 9f099c3..0000000 --- a/src/samplelogs/syslog +++ /dev/null @@ -1,255 +0,0 @@ -2008-04-27T04:02:27-04:00 cmpsvr kernel: imklog 3.14.2, log source = /proc/kmsg started. -2008-04-27T04:02:27-04:00 cmpsvr kernel: Inspecting /boot/System.map-2.6.9-55.0.2.EL -2008-04-27T04:02:28-04:00 cmpsvr kernel: Loaded 24080 symbols from /boot/System.map-2.6.9-55.0.2.EL. -2008-04-27T04:02:28-04:00 cmpsvr kernel: Symbols match kernel version 2.6.9. -2008-04-27T04:02:42-04:00 cmpsvr kernel: Loaded 9698 symbols from 28 modules. -2008-04-27T04:02:42.992883-04:00 cmpsvr rsyslogd: [origin software="rsyslogd" swVersion="3.14.2" x-pid="1554" x-info="http://www.rsyslog.com"] restart -2008-04-27T04:04:13-04:00 uzdomfw pf: 1055. 619145 rule 268/0(match): block in on ng0: (tos 0x0, ttl 50, id 35580, offset 0, flags [none], proto: UDP (17), length: 485) 202.97.238.230.40659 > 76.10.159.40.1026: UDP, length 457 -2008-04-27T04:04:13-04:00 uzdomfw pf: 001346 rule 268/0(match): block in on ng0: (tos 0x0, ttl 50, id 10488, offset 0, flags [none], proto: UDP (17), length: 485) 202.97.238.230.40659 > 76.10.159.40.1027: UDP, length 457 -2008-04-27T04:04:24-04:00 uzdomfw pf: 10. 532742 rule 268/0(match): block in on ng0: (tos 0x0, ttl 50, id 9191, offset 0, flags [none], proto: UDP (17), length: 485) 202.97.238.230.40735 > 76.10.159.40.1026: UDP, length 457 -2008-04-27T04:04:24-04:00 uzdomfw pf: 001096 rule 268/0(match): block in on ng0: (tos 0x0, ttl 50, id 23751, offset 0, flags [none], proto: UDP (17), length: 485) 202.97.238.230.40735 > 76.10.159.40.1027: UDP, length 457 -2008-04-27T04:04:50.780189-04:00 cmpsvr ntpdate[9441]: adjust time server 192.168.0.55 offset 0.148018 sec -2008-04-27T04:05:51-04:00 uzdomfw pf: 87. 171897 rule 268/0(match): block in on ng0: (tos 0x0, ttl 109, id 61513, offset 0, flags [none], proto: TCP (6), length: 48) 76.10.62.133.2548 > 76.10.159.40.1433: S, cksum 0xd9ad (correct), 762117069:762117069(0) win 64240 -2008-04-27T04:16:23-04:00 uzdomfw pf: 631. 992233 rule 268/0(match): block in on ng0: (tos 0x0, ttl 49, id 51694, offset 0, flags [none], proto: UDP (17), length: 486) 221.208.208.97.46577 > 76.10.159.40.1026: UDP, length 458 -2008-04-27T04:16:23-04:00 uzdomfw pf: 049128 rule 268/0(match): block in on ng0: (tos 0x0, ttl 49, id 9090, offset 0, flags [none], proto: UDP (17), length: 486) 221.208.208.97.46577 > 76.10.159.40.1026: UDP, length 458 -2008-04-27T04:16:23-04:00 uzdomfw pf: 001210 rule 268/0(match): block in on ng0: (tos 0x0, ttl 49, id 52628, offset 0, flags [none], proto: UDP (17), length: 486) 221.208.208.97.46577 > 76.10.159.40.1027: UDP, length 458 -2008-04-27T04:18:21-04:00 uzdomfw pf: 117. 412299 rule 268/0(match): block in on ng0: (tos 0x0, ttl 112, id 30035, offset 0, flags [none], proto: TCP (6), length: 48) 76.8.177.186.3645 > 76.10.159.40.1433: S, cksum 0x74bd (correct), 4216527706:4216527706(0) win 64240 -Mar 10 14:45:39 debandre syslogd 1.4.1#18: restart. -Mar 10 14:45:44 debandre anacron[3226]: Job `cron.daily' terminated (mailing output) -Mar 10 14:45:45 debandre anacron[3226]: Normal exit (1 job run) -Mar 10 14:48:03 debandre /USR/SBIN/CRON[5436]: (gforge) CMD ([ -x /usr/lib/gforge/bin/massmail.php ] && /usr/lib/gforge/bin/massmail.php -d include_path=/etc/gforge:/usr/share/gforge/:/usr/share/gforge/www/include > /dev/null 2>&1) -Mar 10 14:48:03 debandre /USR/SBIN/CRON[5437]: (al) CMD (/usr/bin/logger test) -Mar 10 14:48:03 debandre logger: test -Mar 10 14:50:01 debandre /USR/SBIN/CRON[5459]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 14:50:01 debandre /USR/SBIN/CRON[5465]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 14:50:01 debandre /USR/SBIN/CRON[5461]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 14:50:01 debandre /USR/SBIN/CRON[5463]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 14:50:01 debandre /USR/SBIN/CRON[5473]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 14:55:01 debandre /USR/SBIN/CRON[5531]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 14:55:01 debandre /USR/SBIN/CRON[5532]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 14:55:01 debandre /USR/SBIN/CRON[5533]: (gnats) CMD (test -x /usr/lib/gnats/queue-pr && /usr/lib/gnats/queue-pr --run ; exit 0) -Mar 10 14:55:01 debandre /USR/SBIN/CRON[5535]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 14:55:01 debandre /USR/SBIN/CRON[5541]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 14:55:02 debandre /USR/SBIN/CRON[5544]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 15:00:01 debandre /USR/SBIN/CRON[5601]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 15:00:01 debandre /USR/SBIN/CRON[5603]: (root) CMD ([ -x /usr/lib/gforge/bin/update-user-group-cvs.sh ] && /usr/lib/gforge/bin/update-user-group-cvs.sh > /dev/null 2>&1) -Mar 10 15:00:01 debandre /USR/SBIN/CRON[5612]: (root) CMD ([ -f /var/lib/gforge/bind/dns.head ] && [ -x /usr/lib/gforge/bin/dns_conf.pl ] && /usr/lib/gforge/bin/dns_conf.pl && /usr/sbin/invoke-rc.d --quiet bind9 reload ) -Mar 10 15:00:01 debandre /USR/SBIN/CRON[5607]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 15:00:01 debandre /USR/SBIN/CRON[5609]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 15:00:01 debandre /USR/SBIN/CRON[5616]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 15:00:01 debandre /USR/SBIN/CRON[5620]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 15:00:01 debandre /USR/SBIN/CRON[5621]: (al) CMD (/usr/bin/logger test) -Mar 10 15:00:01 debandre logger: test -Mar 10 15:02:01 debandre /USR/SBIN/CRON[5659]: (root) CMD (if [ -x /usr/sbin/pg_maintenance ]; then /usr/sbin/pg_maintenance --analyze >/dev/null; fi) -Mar 10 15:05:01 debandre /USR/SBIN/CRON[5691]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 15:05:01 debandre /USR/SBIN/CRON[5698]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 15:05:01 debandre /USR/SBIN/CRON[5693]: (gnats) CMD (test -x /usr/lib/gnats/queue-pr && /usr/lib/gnats/queue-pr --run ; exit 0) -Mar 10 15:05:01 debandre /USR/SBIN/CRON[5695]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 15:05:01 debandre /USR/SBIN/CRON[5703]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 15:05:01 debandre /USR/SBIN/CRON[5704]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 15:05:59 debandre init: Trying to re-exec init -Mar 10 15:09:05 debandre /USR/SBIN/CRON[8007]: (root) CMD ( [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -r -0 rm) -Mar 10 15:09:05 debandre /USR/SBIN/CRON[8008]: (root) CMD ( [ -d /var/lib/php4 ] && find /var/lib/php4/ -type f -cmin +$(/usr/lib/php4/maxlifetime) -print0 | xargs -r -0 rm) -Mar 10 15:10:03 debandre /USR/SBIN/CRON[8496]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 15:10:03 debandre /USR/SBIN/CRON[8490]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 15:10:03 debandre /USR/SBIN/CRON[8492]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 15:10:03 debandre /USR/SBIN/CRON[8494]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 15:10:03 debandre /USR/SBIN/CRON[8504]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 15:11:29 debandre gconfd (root-9213): starting (version 2.16.1), pid 9213 user 'root' -Mar 10 15:11:29 debandre gconfd (root-9213): Resolved address "xml:readonly:/etc/gconf/gconf.xml.mandatory" to a read-only configuration source at position 0 -Mar 10 15:11:29 debandre gconfd (root-9213): Resolved address "xml:readwrite:/root/.gconf" to a writable configuration source at position 1 -Mar 10 15:11:29 debandre gconfd (root-9213): Resolved address "xml:readonly:/etc/gconf/gconf.xml.defaults" to a read-only configuration source at position 2 -Mar 10 15:11:29 debandre gconfd (root-9213): Resolved address "xml:readonly:/var/lib/gconf/debian.defaults" to a read-only configuration source at position 3 -Mar 10 15:11:29 debandre gconfd (root-9213): Resolved address "xml:readonly:/var/lib/gconf/defaults" to a read-only configuration source at position 4 -Mar 10 15:11:59 debandre gconfd (root-9213): GConf server is not in use, shutting down. -Mar 10 15:11:59 debandre gconfd (root-9213): Exiting -Mar 10 15:12:02 debandre /USR/SBIN/CRON[10877]: (al) CMD (/usr/bin/logger test) -Mar 10 15:12:02 debandre logger: test -Mar 10 15:12:36 debandre named[2412]: shutting down: flushing changes -Mar 10 15:12:37 debandre named[2412]: stopping command channel on 127.0.0.1#953 -Mar 10 15:12:37 debandre named[2412]: stopping command channel on ::1#953 -Mar 10 15:12:37 debandre named[2412]: no longer listening on ::#53 -Mar 10 15:12:37 debandre named[2412]: no longer listening on 127.0.0.1#53 -Mar 10 15:12:37 debandre named[2412]: no longer listening on 172.16.0.125#53 -Mar 10 15:12:37 debandre named[2412]: exiting -Mar 10 15:12:39 debandre named[13300]: starting BIND 9.3.4 -u bind -Mar 10 15:12:39 debandre named[13300]: found 1 CPU, using 1 worker thread -Mar 10 15:12:39 debandre named[13300]: loading configuration from '/etc/bind/named.conf' -Mar 10 15:12:39 debandre named[13300]: listening on IPv6 interfaces, port 53 -Mar 10 15:12:39 debandre named[13300]: listening on IPv4 interface lo, 127.0.0.1#53 -Mar 10 15:12:39 debandre named[13300]: listening on IPv4 interface eth0, 172.16.0.125#53 -Mar 10 15:12:39 debandre named[13300]: command channel listening on 127.0.0.1#953 -Mar 10 15:12:39 debandre named[13300]: command channel listening on ::1#953 -Mar 10 15:12:39 debandre named[13300]: zone 0.in-addr.arpa/IN: loaded serial 1 -Mar 10 15:12:39 debandre named[13300]: zone 127.in-addr.arpa/IN: loaded serial 1 -Mar 10 15:12:39 debandre named[13300]: zone 255.in-addr.arpa/IN: loaded serial 1 -Mar 10 15:12:39 debandre named[13300]: zone debandre.intern.adiscon.com/IN: loaded serial 2008031001 -Mar 10 15:12:39 debandre named[13300]: zone localhost/IN: loaded serial 1 -Mar 10 15:12:39 debandre named[13300]: running -Mar 10 15:15:01 debandre /USR/SBIN/CRON[13922]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 15:15:02 debandre /USR/SBIN/CRON[13925]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 15:15:02 debandre /USR/SBIN/CRON[13933]: (gnats) CMD (test -x /usr/lib/gnats/queue-pr && /usr/lib/gnats/queue-pr --run ; exit 0) -Mar 10 15:15:02 debandre /USR/SBIN/CRON[13927]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 15:15:02 debandre /USR/SBIN/CRON[13929]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 15:15:02 debandre /USR/SBIN/CRON[13931]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 15:17:01 debandre /USR/SBIN/CRON[13968]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly) -Mar 10 15:20:01 debandre /USR/SBIN/CRON[14023]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 15:20:01 debandre /USR/SBIN/CRON[14018]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 15:20:01 debandre /USR/SBIN/CRON[14024]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 15:20:01 debandre /USR/SBIN/CRON[14020]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 15:20:01 debandre /USR/SBIN/CRON[14022]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 15:23:39 debandre mysqld_safe[14277]: PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! -Mar 10 15:23:39 debandre mysqld_safe[14277]: To do so, start the server, then issue the following commands: -Mar 10 15:23:39 debandre mysqld_safe[14277]: /usr/bin/mysqladmin -u root password 'new-password' -Mar 10 15:23:39 debandre mysqld_safe[14277]: /usr/bin/mysqladmin -u root -h debandre password 'new-password' -Mar 10 15:23:39 debandre mysqld_safe[14277]: See the manual for more instructions. -Mar 10 15:23:39 debandre mysqld_safe[14277]: -Mar 10 15:23:39 debandre mysqld_safe[14277]: Please report any problems with the /usr/bin/mysqlbug script! -Mar 10 15:23:39 debandre mysqld_safe[14277]: -Mar 10 15:23:39 debandre mysqld_safe[14277]: The latest information about MySQL is available on the web at -Mar 10 15:23:39 debandre mysqld_safe[14277]: http://www.mysql.com -Mar 10 15:23:39 debandre mysqld_safe[14277]: Support MySQL by buying support/licenses at http://shop.mysql.com -Mar 10 15:23:42 debandre mysqld_safe[14417]: started -Mar 10 15:23:42 debandre mysqld[14422]: InnoDB: The first specified data file ./ibdata1 did not exist: -Mar 10 15:23:42 debandre mysqld[14422]: InnoDB: a new database to be created! -Mar 10 15:23:42 debandre mysqld[14422]: 080310 15:23:42 InnoDB: Setting file ./ibdata1 size to 10 MB -Mar 10 15:23:42 debandre mysqld[14422]: InnoDB: Database physically writes the file full: wait... -Mar 10 15:23:42 debandre mysqld[14422]: 080310 15:23:42 InnoDB: Log file ./ib_logfile0 did not exist: new to be created -Mar 10 15:23:42 debandre mysqld[14422]: InnoDB: Setting log file ./ib_logfile0 size to 5 MB -Mar 10 15:23:42 debandre mysqld[14422]: InnoDB: Database physically writes the file full: wait... -Mar 10 15:23:43 debandre mysqld[14422]: 080310 15:23:43 InnoDB: Log file ./ib_logfile1 did not exist: new to be created -Mar 10 15:23:43 debandre mysqld[14422]: InnoDB: Setting log file ./ib_logfile1 size to 5 MB -Mar 10 15:23:43 debandre mysqld[14422]: InnoDB: Database physically writes the file full: wait... -Mar 10 15:23:43 debandre mysqld[14422]: InnoDB: Doublewrite buffer not found: creating new -Mar 10 15:23:43 debandre mysqld[14422]: InnoDB: Doublewrite buffer created -Mar 10 15:23:43 debandre mysqld[14422]: InnoDB: Creating foreign key constraint system tables -Mar 10 15:23:43 debandre mysqld[14422]: InnoDB: Foreign key constraint system tables created -Mar 10 15:23:43 debandre mysqld[14422]: 080310 15:23:43 InnoDB: Started; log sequence number 0 0 -Mar 10 15:23:43 debandre mysqld[14422]: 080310 15:23:43 [Note] /usr/sbin/mysqld: ready for connections. -Mar 10 15:23:43 debandre mysqld[14422]: Version: '5.0.32-Debian_7etch5-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 Debian etch distribution -Mar 10 15:23:44 debandre /etc/mysql/debian-start[14465]: Upgrading MySQL tables if necessary. -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.columns_priv OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.db OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.func OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.help_category OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.help_keyword OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.help_relation OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.help_topic OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.host OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.proc OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.procs_priv OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.tables_priv OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.time_zone OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.time_zone_leap_second OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.time_zone_name OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.time_zone_transition OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.time_zone_transition_type OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14468]: mysql.user OK -Mar 10 15:23:47 debandre /etc/mysql/debian-start[14488]: Checking for crashed MySQL tables. -Mar 10 15:24:02 debandre /USR/SBIN/CRON[14909]: (al) CMD (/usr/bin/logger test) -Mar 10 15:24:02 debandre logger: test -Mar 10 15:25:01 debandre /USR/SBIN/CRON[14920]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 15:25:01 debandre /USR/SBIN/CRON[14924]: (root) CMD ([ -d /var/cache/gforge ] && find /var/cache/gforge/ -type f -and -cmin +60 -exec /bin/rm -f "{}" \; > /dev/null 2>&1) -Mar 10 15:25:01 debandre /USR/SBIN/CRON[14925]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 15:25:01 debandre /USR/SBIN/CRON[14927]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 15:25:01 debandre /USR/SBIN/CRON[14929]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 15:25:01 debandre /USR/SBIN/CRON[14931]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 15:25:01 debandre /USR/SBIN/CRON[14936]: (gnats) CMD (test -x /usr/lib/gnats/queue-pr && /usr/lib/gnats/queue-pr --run ; exit 0) -Mar 10 15:30:01 debandre /USR/SBIN/CRON[14991]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 15:30:01 debandre /USR/SBIN/CRON[14993]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 15:30:01 debandre /USR/SBIN/CRON[14999]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 15:30:01 debandre /USR/SBIN/CRON[14998]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 15:30:01 debandre /USR/SBIN/CRON[15002]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 15:35:01 debandre /USR/SBIN/CRON[15188]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 15:35:01 debandre /USR/SBIN/CRON[15190]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 15:35:01 debandre /USR/SBIN/CRON[15196]: (gnats) CMD (test -x /usr/lib/gnats/queue-pr && /usr/lib/gnats/queue-pr --run ; exit 0) -Mar 10 15:35:01 debandre /USR/SBIN/CRON[15199]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 15:35:01 debandre /USR/SBIN/CRON[15198]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 15:35:01 debandre /USR/SBIN/CRON[15202]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 15:36:01 debandre /USR/SBIN/CRON[15251]: (al) CMD (/usr/bin/logger test) -Mar 10 15:36:01 debandre logger: test -Mar 10 15:39:01 debandre /USR/SBIN/CRON[15418]: (root) CMD ( [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -r -0 rm) -Mar 10 15:39:01 debandre /USR/SBIN/CRON[15420]: (root) CMD ( [ -d /var/lib/php4 ] && find /var/lib/php4/ -type f -cmin +$(/usr/lib/php4/maxlifetime) -print0 | xargs -r -0 rm) -Mar 10 15:40:01 debandre /USR/SBIN/CRON[15456]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 15:40:01 debandre /USR/SBIN/CRON[15458]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 15:40:02 debandre /USR/SBIN/CRON[15459]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 15:40:02 debandre /USR/SBIN/CRON[15461]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 15:40:02 debandre /USR/SBIN/CRON[15464]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 15:45:01 debandre /USR/SBIN/CRON[15528]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 15:45:01 debandre /USR/SBIN/CRON[15530]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 15:45:01 debandre /USR/SBIN/CRON[15535]: (gnats) CMD (test -x /usr/lib/gnats/queue-pr && /usr/lib/gnats/queue-pr --run ; exit 0) -Mar 10 15:45:01 debandre /USR/SBIN/CRON[15536]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 15:45:01 debandre /USR/SBIN/CRON[15538]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 15:45:01 debandre /USR/SBIN/CRON[15542]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 15:48:01 debandre /USR/SBIN/CRON[15586]: (gforge) CMD ([ -x /usr/lib/gforge/bin/massmail.php ] && /usr/lib/gforge/bin/massmail.php -d include_path=/etc/gforge:/usr/share/gforge/:/usr/share/gforge/www/include > /dev/null 2>&1) -Mar 10 15:48:01 debandre /USR/SBIN/CRON[15588]: (al) CMD (/usr/bin/logger test) -Mar 10 15:48:01 debandre logger: test -Mar 10 15:50:01 debandre /USR/SBIN/CRON[15610]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 15:50:01 debandre /USR/SBIN/CRON[15613]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 15:50:01 debandre /USR/SBIN/CRON[15614]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 15:50:01 debandre /USR/SBIN/CRON[15616]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 15:50:01 debandre /USR/SBIN/CRON[15620]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 15:55:01 debandre /USR/SBIN/CRON[15680]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 15:55:01 debandre /USR/SBIN/CRON[15682]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 15:55:01 debandre /USR/SBIN/CRON[15686]: (gnats) CMD (test -x /usr/lib/gnats/queue-pr && /usr/lib/gnats/queue-pr --run ; exit 0) -Mar 10 15:55:01 debandre /USR/SBIN/CRON[15687]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 15:55:01 debandre /USR/SBIN/CRON[15689]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 15:55:01 debandre /USR/SBIN/CRON[15694]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 16:00:01 debandre /USR/SBIN/CRON[15759]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 16:00:01 debandre /USR/SBIN/CRON[15760]: (root) CMD ([ -x /usr/lib/gforge/bin/update-user-group-cvs.sh ] && /usr/lib/gforge/bin/update-user-group-cvs.sh > /dev/null 2>&1) -Mar 10 16:00:01 debandre /USR/SBIN/CRON[15761]: (root) CMD ([ -f /var/lib/gforge/bind/dns.head ] && [ -x /usr/lib/gforge/bin/dns_conf.pl ] && /usr/lib/gforge/bin/dns_conf.pl && /usr/sbin/invoke-rc.d --quiet bind9 reload ) -Mar 10 16:00:01 debandre /USR/SBIN/CRON[15769]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 16:00:01 debandre /USR/SBIN/CRON[15765]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 16:00:01 debandre /USR/SBIN/CRON[15767]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 16:00:01 debandre /USR/SBIN/CRON[15773]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 16:00:02 debandre /USR/SBIN/CRON[15774]: (al) CMD (/usr/bin/logger test) -Mar 10 16:00:02 debandre logger: test -Mar 10 16:05:01 debandre /USR/SBIN/CRON[15844]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 16:05:01 debandre /USR/SBIN/CRON[15845]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 16:05:01 debandre /USR/SBIN/CRON[15847]: (gnats) CMD (test -x /usr/lib/gnats/queue-pr && /usr/lib/gnats/queue-pr --run ; exit 0) -Mar 10 16:05:01 debandre /USR/SBIN/CRON[15848]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 16:05:01 debandre /USR/SBIN/CRON[15850]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 16:05:01 debandre /USR/SBIN/CRON[15854]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 16:09:01 debandre /USR/SBIN/CRON[15909]: (root) CMD ( [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -r -0 rm) -Mar 10 16:09:01 debandre /USR/SBIN/CRON[15910]: (root) CMD ( [ -d /var/lib/php4 ] && find /var/lib/php4/ -type f -cmin +$(/usr/lib/php4/maxlifetime) -print0 | xargs -r -0 rm) -Mar 10 16:10:01 debandre /USR/SBIN/CRON[15944]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 16:10:01 debandre /USR/SBIN/CRON[15945]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 16:10:01 debandre /USR/SBIN/CRON[15948]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 16:10:01 debandre /USR/SBIN/CRON[15947]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 16:10:01 debandre /USR/SBIN/CRON[15952]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 16:12:01 debandre /USR/SBIN/CRON[15984]: (al) CMD (/usr/bin/logger test) -Mar 10 16:12:01 debandre logger: test -Mar 10 16:15:01 debandre /USR/SBIN/CRON[16017]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 16:15:01 debandre /USR/SBIN/CRON[16018]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 16:15:01 debandre /USR/SBIN/CRON[16019]: (gnats) CMD (test -x /usr/lib/gnats/queue-pr && /usr/lib/gnats/queue-pr --run ; exit 0) -Mar 10 16:15:01 debandre /USR/SBIN/CRON[16020]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 16:15:01 debandre /USR/SBIN/CRON[16022]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 16:15:01 debandre /USR/SBIN/CRON[16027]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 16:17:01 debandre /USR/SBIN/CRON[16059]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly) -Mar 10 16:20:01 debandre /USR/SBIN/CRON[16093]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 16:20:01 debandre /USR/SBIN/CRON[16095]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 16:20:01 debandre /USR/SBIN/CRON[16094]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 16:20:01 debandre /USR/SBIN/CRON[16097]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 16:20:01 debandre /USR/SBIN/CRON[16102]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 16:24:01 debandre /USR/SBIN/CRON[16150]: (al) CMD (/usr/bin/logger test) -Mar 10 16:24:01 debandre logger: test -Mar 10 16:25:01 debandre /USR/SBIN/CRON[16165]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 16:25:01 debandre /USR/SBIN/CRON[16166]: (root) CMD ([ -d /var/cache/gforge ] && find /var/cache/gforge/ -type f -and -cmin +60 -exec /bin/rm -f "{}" \; > /dev/null 2>&1) -Mar 10 16:25:01 debandre /USR/SBIN/CRON[16173]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 16:25:01 debandre /USR/SBIN/CRON[16167]: (gnats) CMD (test -x /usr/lib/gnats/queue-pr && /usr/lib/gnats/queue-pr --run ; exit 0) -Mar 10 16:25:01 debandre /USR/SBIN/CRON[16169]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 16:25:01 debandre /USR/SBIN/CRON[16171]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 16:25:02 debandre /USR/SBIN/CRON[16177]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 16:30:01 debandre /USR/SBIN/CRON[16241]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 16:30:01 debandre /USR/SBIN/CRON[16240]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 16:30:01 debandre /USR/SBIN/CRON[16243]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 16:30:01 debandre /USR/SBIN/CRON[16244]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 16:30:01 debandre /USR/SBIN/CRON[16249]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 16:35:01 debandre /USR/SBIN/CRON[16306]: (mailping) CMD (if [ -x /usr/bin/mailping-cron ]; then /usr/bin/mailping-cron; fi) -Mar 10 16:35:01 debandre /USR/SBIN/CRON[16308]: (svn-autoreleasedeb) CMD (sh /etc/default/svn-autoreleasedeb && /usr/bin/svn-autoreleasedeb 2>&1 >> /var/log/svn-autoreleasedeb/run.log) -Mar 10 16:35:01 debandre /USR/SBIN/CRON[16314]: (gnats) CMD (test -x /usr/lib/gnats/queue-pr && /usr/lib/gnats/queue-pr --run ; exit 0) -Mar 10 16:35:01 debandre /USR/SBIN/CRON[16317]: (cvs-autoreleasedeb) CMD (sh /etc/default/cvs-autoreleasedeb && /usr/bin/cvs-autoreleasedeb 2>&1 >> /var/log/cvs-autoreleasedeb/run.log) -Mar 10 16:35:01 debandre /USR/SBIN/CRON[16316]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugins/apt ]; then /etc/munin/plugins/apt update 7200 12 >/dev/null; fi) -Mar 10 16:35:01 debandre /USR/SBIN/CRON[16320]: (debarchiver) CMD (test -x /usr/bin/debarchiver && /usr/bin/debarchiver -so | logger -t debarchiver -p daemon.info) -Mar 10 16:36:01 debandre /USR/SBIN/CRON[16343]: (al) CMD (/usr/bin/logger test) -Mar 10 16:36:01 debandre logger: test From f2bd44ed112c3190fcac63ce116f8bd667dbb594 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 28 Apr 2008 17:41:25 +0200 Subject: [PATCH 06/79] Added inline search buttons into the main view. Going to discuss these new buttons tomorrow with rainer. I kind of like them, but I also have additional ideas. --- src/include/functions_common.php | 2 ++ src/index.php | 44 ++++++++++++++++++++++++++++++-- src/lang/de/main.php | 3 +++ src/lang/en/main.php | 4 +++ src/templates/index.html | 15 +++++++++-- 5 files changed, 64 insertions(+), 4 deletions(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index d464fa8..ce68455 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -342,6 +342,8 @@ function InitFrontEndVariables() $content['MENU_FOLDER_CLOSED'] = $content['BASEPATH'] . "images/icons/folder.png"; $content['MENU_HOMEPAGE'] = $content['BASEPATH'] . "images/icons/home.png"; $content['MENU_LINK'] = $content['BASEPATH'] . "images/icons/link.png"; + $content['MENU_LINK_VIEW'] = $content['BASEPATH'] . "images/icons/link_view.png"; + $content['MENU_VIEW'] = $content['BASEPATH'] . "images/icons/view.png"; $content['MENU_PREFERENCES'] = $content['BASEPATH'] . "images/icons/preferences.png"; $content['MENU_ADMINENTRY'] = $content['BASEPATH'] . "images/icons/star_blue.png"; $content['MENU_ADMINLOGOFF'] = $content['BASEPATH'] . "images/icons/exit.png"; diff --git a/src/index.php b/src/index.php index 29cb6db..404dfa0 100644 --- a/src/index.php +++ b/src/index.php @@ -189,6 +189,11 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c $content['fields'][$mycolkey]['FieldType'] = $fields[$mycolkey]['FieldType']; $content['fields'][$mycolkey]['FieldSortable'] = $stream->IsPropertySortable($mycolkey); // $fields[$mycolkey]['Sortable']; $content['fields'][$mycolkey]['DefaultWidth'] = $fields[$mycolkey]['DefaultWidth']; + + if ( $mycolkey == SYSLOG_MESSAGE ) + $content['fields'][$mycolkey]['colspan'] = ' colspan="2" '; + else + $content['fields'][$mycolkey]['colspan'] = ''; } // --- @@ -391,10 +396,45 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c if ( strlen($content['searchstr']) > 0 ) { - // Prepend button - $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = "" . $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue']; + // Enable buttons + $content['syslogmessages'][$counter]['buttons_enabled'] = true; + + // Prepend Msg centered button + $content['syslogmessages'][$counter]['buttons'][]['htmlcode'] = ''; } } + else if ( $mycolkey == SYSLOG_SYSLOGTAG ) + { + // Append Syslogtag Search Button + $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = '' . '' . $logArray[$mycolkey]; + } + else if ( $mycolkey == SYSLOG_HOST ) + { + // Append Syslogtag Search Button + $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = '' . '' . $logArray[$mycolkey]; +/* TODO ... +$content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = ' + +' . $logArray[$mycolkey]; +*/ + } + } } } diff --git a/src/lang/de/main.php b/src/lang/de/main.php index ce728b7..cd4211a 100644 --- a/src/lang/de/main.php +++ b/src/lang/de/main.php @@ -56,6 +56,9 @@ $content['LN_SEARCH_ADVANCED'] = "Erweiterte Suche"; $content['LN_SEARCH'] = "Suche"; $content['LN_SEARCH_RESET'] = "Suche zurücksetzen"; $content['LN_SEARCH_PERFORMADVANCED'] = "Erweiterte Suche starten"; +$content['LN_VIEW_MESSAGECENTERED'] = "View syslog message centered in logstream"; +$content['LN_VIEW_RELATEDMSG'] = "View related syslog messages"; +$content['LN_VIEW_FILTERFOR'] = "Filter message for "; $content['LN_HIGHLIGHT'] = "Hightlight >>"; $content['LN_HIGHLIGHT_OFF'] = "Hightlight <<"; diff --git a/src/lang/en/main.php b/src/lang/en/main.php index f95217b..03057e7 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -59,6 +59,10 @@ $content['LN_SEARCH_ADVANCED'] = "Advanced Search"; $content['LN_SEARCH'] = "Search"; $content['LN_SEARCH_RESET'] = "Reset search"; $content['LN_SEARCH_PERFORMADVANCED'] = "Perform Advanced Search"; +$content['LN_VIEW_MESSAGECENTERED'] = "View syslog message centered in logstream"; +$content['LN_VIEW_RELATEDMSG'] = "View related syslog messages"; +$content['LN_VIEW_FILTERFOR'] = "Filter message for "; + $content['LN_HIGHLIGHT'] = "Hightlight >>"; $content['LN_HIGHLIGHT_OFF'] = "Hightlight <<"; diff --git a/src/templates/index.html b/src/templates/index.html index d1e8c77..91b9ecb 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -177,7 +177,7 @@ - + @@ -196,8 +196,8 @@ - + @@ -209,6 +209,7 @@ + {fieldvalue} @@ -225,6 +226,16 @@ + + + + + + From 8dd71e818f0f4c7c6c596abcc20ae511263c97d1 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Tue, 29 Apr 2008 14:51:26 +0200 Subject: [PATCH 07/79] Added new kind of popup menu for use within the grid. The popup menu uses javascript and is shown on click. It seems to be the best option so far for later development. This state is kind of in the middle as I need to take care of a bug in the beta branch. --- src/css/defaults.css | 2 +- src/css/menu.css | 19 +++-- src/images/icons/bullet_ball_glass_blue.png | Bin 0 -> 661 bytes src/images/icons/bullet_ball_glass_green.png | Bin 0 -> 673 bytes src/images/icons/bullet_ball_glass_grey.png | Bin 0 -> 643 bytes src/images/icons/bullet_ball_glass_red.png | Bin 0 -> 649 bytes src/images/icons/bullet_ball_glass_yellow.png | Bin 0 -> 666 bytes src/include/constants_logstream.php | 2 +- src/include/functions_common.php | 7 +- src/index.php | 19 +++-- src/js/common.js | 79 +++++++++++++++++- src/lang/en/main.php | 1 + src/templates/index.html | 55 +++++++++--- src/themes/dark/main.css | 4 +- src/themes/default/main.css | 4 +- 15 files changed, 160 insertions(+), 32 deletions(-) create mode 100644 src/images/icons/bullet_ball_glass_blue.png create mode 100644 src/images/icons/bullet_ball_glass_green.png create mode 100644 src/images/icons/bullet_ball_glass_grey.png create mode 100644 src/images/icons/bullet_ball_glass_red.png create mode 100644 src/images/icons/bullet_ball_glass_yellow.png diff --git a/src/css/defaults.css b/src/css/defaults.css index 2ccf210..523489f 100644 --- a/src/css/defaults.css +++ b/src/css/defaults.css @@ -24,7 +24,7 @@ .SelectSavedFilter { - margin-top: 3px; + margin-top: 2px; border: 1px solid; border-color: #233B51 #124A7C #124A7C #233B51; } diff --git a/src/css/menu.css b/src/css/menu.css index f42df92..076c0ba 100644 --- a/src/css/menu.css +++ b/src/css/menu.css @@ -14,11 +14,11 @@ border-width: 1px; border-style: solid; margin: 0; - padding: 2px 3px; + padding: 1px 1px; } #menu h2 { - font: bold 11px/16px; + font: bold; text-align: center; } @@ -33,22 +33,27 @@ } #menu li { - z-index:10; /* make the list elements a containing block for the nested lists */ position: relative; } #menu ul ul { + z-index:10; + position: absolute; - top: 16px; - left: 0px; /* to position them to the right of their containing block */ + top: 12px; + left: 4px; /* to position them to the right of their containing block */ width: 300; /* width is based on the containing block */ } div#menu ul ul, div#menu ul li:hover ul ul -{display: none;} +{ + display: none; +} div#menu ul li:hover ul, div#menu ul ul li:hover ul -{display: block;} \ No newline at end of file +{ + display: block; +} \ No newline at end of file diff --git a/src/images/icons/bullet_ball_glass_blue.png b/src/images/icons/bullet_ball_glass_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..143f23ca2f8bb934e7d224d946c6d2479fcdcae9 GIT binary patch literal 661 zcmV;G0&4wWdKcYATcu_Piu4_GB7YRATTgGFf%$dIUp-AF)%Qy!D_((000McNliru z)&&<0F)4wnxk&&3010qNS#tmY3h)2`3h)6!tTdPa000DMK}|sb0I`n?{9y$E00Heu zL_t(|+O<&id}1JAZqrG^hx7(%rO)f-6_#^ zS6;oTU}o|yS!S)sk-#`l&RbK%v9facybetdz!Dk^U7%I5#0R_c8uqj6__pxXcT%~M zawuSy9z>LVrKmMv)l~7Ns3JwA%>eRT3kyd<|Ii&Wdx)lkFzrylaT7Ti#B?TzsG-6L zRMWFtme|}=;dnpCq5GSIssC2T5r%0Ah{AxgfxNXMh#idtW%LWN9eyhC}fvH zZLNbHVIUR)BEf2ca%K7@%eCodZShlm(T;MES$*p6WMsPmbW)_J1?Y|d7dgMs%xZ3b zmv}Yynapj!5_JMk240p@$?@go4cRDM#Loa%Xts%UoL}6Kg%@Mbu|A(8bA|YETq9NQ zm$-iq9XE!zC3n%YM{EzVyz#E;KFHSj<00000NkvXXu0mjfxAhp} literal 0 HcmV?d00001 diff --git a/src/images/icons/bullet_ball_glass_green.png b/src/images/icons/bullet_ball_glass_green.png new file mode 100644 index 0000000000000000000000000000000000000000..9e8a4b49115d3feef37e38c16be77bc04a9289e7 GIT binary patch literal 673 zcmV;S0$%-zP)WdKcYATcu_Piu4_GB7YRATTgGFfuwaGaxH4F)%PE99K2~000McNliru z)&&<0F)4wnxk&&3010qNS#tmY3h)2`3h)6!tTdPa000DMK}|sb0I`n?{9y$E00H?) zL_t(|+O?C8arlb*qA|3d!Z|D7(_hSb5&n5kXPW)AXtFN<# zxDnk6M3hgoa-h6vZHD(2Z(gf~w)SNAJ(&glLG}V%cyXf8+=&)WkDp_?%q*-!D!>G6&4wapq>8dW&pp0TFSWm> znRH8Hy#QXleOpmSnL>UIQH9GZs1r@$LQyy*&0%Bn+GR35Ntiu9r6+`f=XJG%wXldC zX%r?`=?Dp}*h95bgRF7LlPpK3GsGvNxi3J_iP?l? z7zPsAp@0s3OY7f6?P2Q+nO4$C?4N@7EGqkRf%!eC<#SV$($v^E98HJodw8_`N~}KE zejG0G#Q7z$nzU{3BK@xK5^i7)SFGdO3~43rW4nZ>C}IV>q+ceMh^^jT7`%x|PmU0$ zQjVtk+eDH0kjl}pw;-o;9_j0LQgf1lmkeg;TNt7fIEeKNaNW8?>e9ok00000NkvXX Hu0mjfm?I~W literal 0 HcmV?d00001 diff --git a/src/images/icons/bullet_ball_glass_grey.png b/src/images/icons/bullet_ball_glass_grey.png new file mode 100644 index 0000000000000000000000000000000000000000..5ae8681ca762a39718c590db802b6723526a6019 GIT binary patch literal 643 zcmV-}0(||6P)WdKHUATlx_N_A`?GB7YTATc*OGc`IfHXti7F)%Rco(Z)8000McNliru z)&&<0F)4wnxk&&3010qNS#tmY3h)2`3h)6!tTdPa000DMK}|sb0I`n?{9y$E00G-c zL_t(|+ND#=PQp+Sowl?`{XrV36C550dM#D``dS~v;>6w{(0oGj9Kh9=fLVR;;OAKsmi27s_MFE3kZX(s?f+oh`3L`v=yk!Y5npP!6@uCQVB!L(R zfPnDfp7>_A4UKyJ;rry41l@i=dsnU6B$4;~K|qM)i^;@ybA4@}ou4Zh+H)rHbqcjw ztsM#mnNG90yB&*BI7Se79=e?l6mvQIv{*b*6h+0*OT;5-&-aT&)X1@D^bnhs@=H>j zl%%O@{khdrG);R&^9pg{sIY&!iKM9^M9k@S*zxxfw+@I3^S8G^J9GB0beq)t{?k=n d`!TJ(J^=$7uj{Pt1QP%N002ovPDHLkV1h-Y4MYF{ literal 0 HcmV?d00001 diff --git a/src/images/icons/bullet_ball_glass_red.png b/src/images/icons/bullet_ball_glass_red.png new file mode 100644 index 0000000000000000000000000000000000000000..9c6e7a19035d43e9cab3292c2948a573bc58910e GIT binary patch literal 649 zcmV;40(Sk0P)WdKcYATcu_Piu4_GB7YRATTgGFfuwdHXti7F)%QH;c$&dO`;4Gl zBT&qu)`emY^Xn&qP6ZvZjVnPk)xW`qd1xe2c6ifJE};rpEM4bF zh~siHCM*e+Ulg=7hKdcNA~skZiz5ZPut)9~8iIJD>m!!^!oW5K8%GR&c*KYW- jtAe}hzp#tVn5R8yDSW`00000NkvXXu0mjf?(GsB literal 0 HcmV?d00001 diff --git a/src/images/icons/bullet_ball_glass_yellow.png b/src/images/icons/bullet_ball_glass_yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..ae0ef19069552df0aabf5065168535526e26b3e7 GIT binary patch literal 666 zcmV;L0%iS)P)WdKcYATcu_Piu4_GB7YRATTgGFf%$bG9W83F)%Q0sW-d;000McNliru z)&&<0F)4wnxk&&3010qNS#tmY3h)2`3h)6!tTdPa000DMK}|sb0I`n?{9y$E00Htz zL_t(|+O<_$AUK#4g}^*TtUNmydx7CT#;SwcSSB#B^me%h%H?$9m6VXp-6Trlu=E`Z@29-sSEbRnQ$g_uVwtGa z?m?jMUO(>MOkwD1d!iFUi21BN|6&4jpR%A9d?Yf&*Jz;D^Dmqc^YA~;FBJ`%5|l|mB>(^b07*qoM6N<$f)AS@ A2><{9 literal 0 HcmV?d00001 diff --git a/src/include/constants_logstream.php b/src/include/constants_logstream.php index 9287183..6c14185 100644 --- a/src/include/constants_logstream.php +++ b/src/include/constants_logstream.php @@ -95,7 +95,7 @@ $fields[SYSLOG_MESSAGETYPE]['FieldCaptionID'] = 'LN_FIELDS_MESSAGETYPE'; $fields[SYSLOG_MESSAGETYPE]['FieldType'] = FILTER_TYPE_NUMBER; $fields[SYSLOG_MESSAGETYPE]['Sortable'] = true; $fields[SYSLOG_MESSAGETYPE]['DefaultWidth'] = "90"; -$fields[SYSLOG_MESSAGETYPE]['FieldAlign'] = "left"; +$fields[SYSLOG_MESSAGETYPE]['FieldAlign'] = "center"; // Syslog specific $fields[SYSLOG_FACILITY]['FieldID'] = SYSLOG_FACILITY; diff --git a/src/include/functions_common.php b/src/include/functions_common.php index f13d6f8..e49c35a 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -360,11 +360,16 @@ function InitFrontEndVariables() $content['MENU_NAV_RIGHT'] = $content['BASEPATH'] . "images/icons/navigate_right.png"; $content['MENU_NAV_CLOSE'] = $content['BASEPATH'] . "images/icons/navigate_close.png"; $content['MENU_NAV_OPEN'] = $content['BASEPATH'] . "images/icons/navigate_open.png"; - $content['MENU_PAGER_BEGIN_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_beginning.png"; $content['MENU_PAGER_PREVIOUS_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_rewind.png"; $content['MENU_PAGER_NEXT_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_fast_forward.png"; $content['MENU_PAGER_END_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_end.png"; + + $content['MENU_BULLET_BLUE'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_blue.png"; + $content['MENU_BULLET_GREEN'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_green.png"; + $content['MENU_BULLET_RED'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_red.png"; + $content['MENU_BULLET_YELLOW'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_yellow.png"; + $content['MENU_BULLET_GREY'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_grey.png"; } // Lang Helper for Strings with ONE variable diff --git a/src/index.php b/src/index.php index 404dfa0..01fd4c7 100644 --- a/src/index.php +++ b/src/index.php @@ -267,6 +267,8 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c if ( isset($logArray[$mycolkey]) ) { // Set defaults + $content['syslogmessages'][$counter]['values'][$mycolkey]['FieldColumn'] = $mycolkey; + $content['syslogmessages'][$counter]['values'][$mycolkey]['uid'] = $uID; $content['syslogmessages'][$counter]['values'][$mycolkey]['FieldAlign'] = $fields[$mycolkey]['FieldAlign']; $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldcssclass'] = $content['syslogmessages'][$counter]['cssclass']; $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldbgcolor'] = ""; @@ -408,15 +410,22 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c { // Append Syslogtag Search Button $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = '' . '' . $logArray[$mycolkey]; + '&search=Search" target="_top">' . $logArray[$mycolkey]. ''; +// ' } else if ( $mycolkey == SYSLOG_HOST ) { + $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => '?filter=source%3A' . $logArray[$mycolkey] . '&search=Search', + 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'" + ); + // Append Syslogtag Search Button - $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = '' . '' . $logArray[$mycolkey]; +// $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = '' . '' . $logArray[$mycolkey]; + /* TODO ... $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = ' - - - - - diff --git a/src/themes/default/main.css b/src/themes/default/main.css index f6020ec..daeab01 100644 --- a/src/themes/default/main.css +++ b/src/themes/default/main.css @@ -123,6 +123,7 @@ font /* Cells for listening */ .line0 { + height: 16px; font-size: 8pt; color: #000000; background-color: #DDDDDD; @@ -134,6 +135,7 @@ font .line1 { + height: 16px; font-size: 8pt; color: #000000; background-color: #EEEEEE; @@ -145,6 +147,7 @@ font .line2 { + height: 16px; font-size: 8pt; color: #000000; background-color: #F5F5F5; @@ -188,12 +191,12 @@ font } */ -.lineColouredWhite +.lineColouredWhite, .lineColouredWhite:hover, A.lineColouredWhite { font-size: 8pt; color: #FFFFFF; } -.lineColouredBlack +.lineColouredBlack, .lineColouredBlack:hover, A.lineColouredBlack { font-size: 8pt; color: #000000; From 2e6c50e8c982d53d8faf269dc04dcbfc11c38949 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 30 Apr 2008 13:19:07 +0200 Subject: [PATCH 09/79] Optimiced db driver, performs much faster on larger database now if you run a search. We are using the SQL_CALC_FOUND_ROWS and FOUND_ROWS() mysql feature which is available since MYSQL 4.x. So this also means we require at least MYSQL 4.x for phplogcon to run on. --- src/classes/logstreamdb.class.php | 50 +++++++++++++++++++++++++------ src/index.php | 24 ++++++++++----- 2 files changed, 58 insertions(+), 16 deletions(-) diff --git a/src/classes/logstreamdb.class.php b/src/classes/logstreamdb.class.php index 24a7d3a..b274aae 100644 --- a/src/classes/logstreamdb.class.php +++ b/src/classes/logstreamdb.class.php @@ -113,10 +113,10 @@ class LogStreamDB extends LogStream { $this->CreateSQLWhereClause(); // Obtain count of records - $this->_totalRecordCount = $this->GetRowCountFromTable(); - - if ( $this->_totalRecordCount <= 0 ) - return ERROR_NOMORERECORDS; +// $this->_totalRecordCount = $this->GetRowCountFromTable(); +// +// if ( $this->_totalRecordCount <= 0 ) +// return ERROR_NOMORERECORDS; // Success, this means we init the Pagenumber to ONE! $this->_currentPageNumber = 1; @@ -602,6 +602,15 @@ class LogStreamDB extends LogStream { // Free Query ressources mysql_free_result ($myquery); + // Obtain count of records if needed! + if ( $this->_totalRecordCount == -1 ) + { + $this->_totalRecordCount = $this->GetRowCountFromTable(); + + if ( $this->_totalRecordCount <= 0 ) + return ERROR_NOMORERECORDS; + } + // Increment for the Footer Stats $querycount++; @@ -641,6 +650,15 @@ class LogStreamDB extends LogStream { // Free Query ressources mysql_free_result ($myquery); + // Obtain count of records if needed! + if ( $this->_totalRecordCount == -1 ) + { + $this->_totalRecordCount = $this->GetRowCountFromTable(); + + if ( $this->_totalRecordCount <= 0 ) + return ERROR_NOMORERECORDS; + } + // Increment for the Footer Stats $querycount++; @@ -660,7 +678,7 @@ class LogStreamDB extends LogStream { $szSortColumn = $this->_logStreamConfigObj->SortColumn; // Create SQL String - $sqlString = "SELECT " . $dbmapping[$szTableType][SYSLOG_UID]; + $sqlString = "SELECT SQL_CALC_FOUND_ROWS " . $dbmapping[$szTableType][SYSLOG_UID]; if ( $includeFields && $this->_arrProperties != null ) { // Loop through all requested fields @@ -758,9 +776,25 @@ class LogStreamDB extends LogStream { */ private function GetRowCountFromTable() { + global $querycount; + if ( $myquery = mysql_query("Select FOUND_ROWS();", $this->_dbhandle) ) + { + // Get first and only row! + $myRow = mysql_fetch_array($myquery); + + // copy row count + $numRows = $myRow[0]; + } + else + $numRows = -1; + + // return result! + return $numRows; + + /* OLD slow code! global $dbmapping,$querycount; $szTableType = $this->_logStreamConfigObj->DBTableType; - + // Create Statement and perform query! $szSql = "SELECT count(" . $dbmapping[$szTableType][SYSLOG_UID] . ") FROM " . $this->_logStreamConfigObj->DBTableName . $this->_SQLwhereClause; if ($myQuery = mysql_query($szSql, $this->_dbhandle)) @@ -777,9 +811,7 @@ class LogStreamDB extends LogStream { } else $numRows = -1; - - // return result! - return $numRows; + */ } diff --git a/src/index.php b/src/index.php index 5858b30..7a8270b 100644 --- a/src/index.php +++ b/src/index.php @@ -191,7 +191,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c $content['fields'][$mycolkey]['DefaultWidth'] = $fields[$mycolkey]['DefaultWidth']; if ( $mycolkey == SYSLOG_MESSAGE ) - $content['fields'][$mycolkey]['colspan'] = ' colspan="2" '; + $content['fields'][$mycolkey]['colspan'] = ''; //' colspan="2" '; else $content['fields'][$mycolkey]['colspan'] = ''; } @@ -217,14 +217,24 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c else $ret = $stream->ReadNext($uID, $logArray); - // --- If Forward direction is used, we need to SKIP one entry! - if ( $ret == SUCCESS && $content['read_direction'] == EnumReadDirection::Forward ) + // --- Check if Read was successfull! + if ( $ret == SUCCESS ) { - // Ok the current ID is our NEXT ID in this reading direction, so we save it! - $content['uid_next'] = $uID; + // If Forward direction is used, we need to SKIP one entry! + if ( $content['read_direction'] == EnumReadDirection::Forward ) + { + // Ok the current ID is our NEXT ID in this reading direction, so we save it! + $content['uid_next'] = $uID; - // Skip this entry and move to the next - $stream->ReadNext($uID, $logArray); + // Skip this entry and move to the next + $stream->ReadNext($uID, $logArray); + } + } + else + { + // This will disable to Main SyslogView and show an error message + $content['syslogmessagesenabled'] = "false"; + $content['detailederror'] = "No syslog messages found."; } // --- From 180a0c3dd0fa9ff85f806821ae59e317f9098c68 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 30 Apr 2008 17:00:26 +0200 Subject: [PATCH 10/79] Added filter for messagetype field into logstream and search form this filter is usefull if you have multiple sources writing into the same database table. --- src/classes/logstream.class.php | 45 +++++++++++++++++++++++++++++++ src/include/constants_filters.php | 3 ++- src/include/functions_filters.php | 25 ++++++++++++----- src/index.php | 8 ++++++ src/lang/de/main.php | 1 + src/lang/en/main.php | 1 + src/search.php | 17 ++++++++++-- src/templates/index.html | 2 +- src/templates/search.html | 14 ++++++++-- 9 files changed, 104 insertions(+), 12 deletions(-) diff --git a/src/classes/logstream.class.php b/src/classes/logstream.class.php index 789fd77..bb1ea34 100644 --- a/src/classes/logstream.class.php +++ b/src/classes/logstream.class.php @@ -313,6 +313,33 @@ abstract class LogStream { } // --- break; + case "messagetype": + $tmpKeyName = SYSLOG_MESSAGETYPE; + $tmpFilterType = FILTER_TYPE_NUMBER; + // --- Extra Check to convert string representations into numbers! + if ( isset($tmpValues) ) + { + foreach( $tmpValues as $mykey => $szValue ) + { + if ( !is_numeric($szValue) ) + { + $tmpMsgTypeCode = $this->ConvertMessageTypeString($szValue); + if ( $tmpMsgTypeCode != -1 ) + $tmpValues[$mykey] = $tmpMsgTypeCode; + } + } + } + else + { + if ( !is_numeric($tmpArray[FILTER_TMP_VALUE]) ) + { + $tmpMsgTypeCode = $this->ConvertMessageTypeString($tmpArray[FILTER_TMP_VALUE]); + if ( $tmpMsgTypeCode != -1 ) + $tmpArray[FILTER_TMP_VALUE] = $tmpMsgTypeCode; + } + } + // --- + break; case "syslogtag": $tmpKeyName = SYSLOG_SYSLOGTAG; $tmpFilterType = FILTER_TYPE_STRING; @@ -470,6 +497,24 @@ abstract class LogStream { return -1; } + /* + * Helper function to convert a messagetype string into a messagetype number + */ + private function ConvertMessageTypeString($szValue) + { + global $content; + + foreach ( $content['filter_messagetype_list'] as $mymsgtype ) + { + if ( stripos( $mymsgtype['DisplayName'], $szValue) !== false ) + return $mymsgtype['ID']; + } + + // reached here means we failed to convert the facility! + return -1; + } + + } ?> diff --git a/src/include/constants_filters.php b/src/include/constants_filters.php index 4bea7c8..18fabb0 100644 --- a/src/include/constants_filters.php +++ b/src/include/constants_filters.php @@ -105,8 +105,9 @@ $content['filter_severity_list'][] = array( "ID" => SYSLOG_DEBUG, "DisplayName" // --- // Init MessageType LIST -$content['filter_messagetype_list'][] = array( "ID" => IUT_Unknown, "DisplayName" => "Unknown", "selected" => "" ); +//$content['filter_messagetype_list'][] = array( "ID" => IUT_Unknown, "DisplayName" => "Unknown", "selected" => "" ); $content['filter_messagetype_list'][] = array( "ID" => IUT_Syslog, "DisplayName" => "Syslog", "selected" => "" ); $content['filter_messagetype_list'][] = array( "ID" => IUT_NT_EventReport, "DisplayName" => "EventReporter", "selected" => "" ); +$content['filter_messagetype_list'][] = array( "ID" => IUT_File_Monitor, "DisplayName" => "File Monitor", "selected" => "" ); ?> \ No newline at end of file diff --git a/src/include/functions_filters.php b/src/include/functions_filters.php index ba439ec..867a284 100644 --- a/src/include/functions_filters.php +++ b/src/include/functions_filters.php @@ -150,27 +150,25 @@ function InitFilterHelpers() if ( $filters['filter_lastx_default'] == DATE_LASTX_31DAYS ) { $content['filter_daterange_last_x_list'][4]['selected'] = "selected"; } else { $content['filter_daterange_last_x_list'][4]['selected'] = ""; } // --- - // Init Default Syslog Facility from SESSION! + // --- Init Default Syslog Facility from SESSION! if ( isset($_SESSION['filter_facility']) ) $filters['filter_facility'] = intval($_SESSION['filter_facility']); else - $filters['filter_facility'] = array ( SYSLOG_KERN, SYSLOG_USER, SYSLOG_MAIL, SYSLOG_DAEMON, SYSLOG_AUTH, SYSLOG_SYSLOG, SYSLOG_LPR, SYSLOG_NEWS, SYSLOG_UUCP, SYSLOG_CRON, SYSLOG_LOCAL0, SYSLOG_LOCAL1, SYSLOG_LOCAL2, SYSLOG_LOCAL3, SYSLOG_LOCAL4, SYSLOG_LOCAL5, SYSLOG_LOCAL6, SYSLOG_LOCAL7 ); -// $filters['filter_facility'] = SYSLOG_LOCAL0; + $filters['filter_facility'] = array ( SYSLOG_KERN, SYSLOG_USER, SYSLOG_MAIL, SYSLOG_DAEMON, SYSLOG_AUTH, SYSLOG_SYSLOG, SYSLOG_LPR, SYSLOG_NEWS, SYSLOG_UUCP, SYSLOG_CRON, SYSLOG_SECURITY, SYSLOG_FTP, SYSLOG_NTP, SYSLOG_LOGAUDIT, SYSLOG_LOGALERT, SYSLOG_CLOCK, SYSLOG_LOCAL0, SYSLOG_LOCAL1, SYSLOG_LOCAL2, SYSLOG_LOCAL3, SYSLOG_LOCAL4, SYSLOG_LOCAL5, SYSLOG_LOCAL6, SYSLOG_LOCAL7 ); $iCount = count($content['filter_facility_list']); for ( $i = 0; $i < $iCount; $i++ ) { -// echo $content['filter_facility_list'][$i]["ID"] . "-" . $filters['filter_facility'] . "
"; if ( in_array($content['filter_facility_list'][$i]["ID"], $filters['filter_facility']) ) $content['filter_facility_list'][$i]["selected"] = "selected"; } + // --- - // Init Default Syslog Severity from SESSION! + // --- Init Default Syslog Severity from SESSION! if ( isset($_SESSION['filter_severity']) ) $filters['filter_severity'] = intval($_SESSION['filter_severity']); else $filters['filter_severity'] = array ( SYSLOG_EMERG, SYSLOG_ALERT, SYSLOG_CRIT, SYSLOG_ERR, SYSLOG_WARNING, SYSLOG_NOTICE, SYSLOG_INFO, SYSLOG_DEBUG ); -// $filters['filter_severity'] = SYSLOG_NOTICE; $iCount = count($content['filter_severity_list']); for ( $i = 0; $i < $iCount; $i++ ) @@ -178,6 +176,21 @@ function InitFilterHelpers() if ( in_array( $content['filter_severity_list'][$i]["ID"], $filters['filter_severity']) ) $content['filter_severity_list'][$i]["selected"] = "selected"; } + // --- + + // --- Init Default Message Type from SESSION! + if ( isset($_SESSION['filter_messagetype']) ) + $filters['filter_messagetype'] = intval($_SESSION['filter_messagetype']); + else + $filters['filter_messagetype'] = array ( IUT_Syslog, IUT_NT_EventReport, IUT_File_Monitor ); + + $iCount = count($content['filter_messagetype_list']); + for ( $i = 0; $i < $iCount; $i++ ) + { + if ( in_array( $content['filter_messagetype_list'][$i]["ID"], $filters['filter_messagetype']) ) + $content['filter_messagetype_list'][$i]["selected"] = "selected"; + } + // --- } diff --git a/src/index.php b/src/index.php index 7a8270b..ee60133 100644 --- a/src/index.php +++ b/src/index.php @@ -361,6 +361,14 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // Use default colour! $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $msgtype_colors[IUT_Unknown] . '" '; } + + // Set OnClick Menu for SYSLOG_MESSAGETYPE + $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => '?filter=messagetype%3A' . $logArray[$mycolkey] . '&search=Search', + 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . GetMessageTypeDisplayName( $logArray[$mycolkey] ). "'", + 'IconSource' => $content['MENU_BULLET_BLUE'] + ); } } diff --git a/src/lang/de/main.php b/src/lang/de/main.php index c194a09..b135411 100644 --- a/src/lang/de/main.php +++ b/src/lang/de/main.php @@ -90,6 +90,7 @@ $content['LN_FILTER_OTHERS'] = "Andere Filter"; $content['LN_FILTER_MESSAGE'] = "Syslog Meldungen"; $content['LN_FILTER_SYSLOGTAG'] = "Syslogtag"; $content['LN_FILTER_SOURCE'] = "Quelle (Hostname)"; + $content['LN_FILTER_MESSAGETYPE'] = "Message Type"; // Field Captions $content['LN_FIELDS_DATE'] = "Datum"; diff --git a/src/lang/en/main.php b/src/lang/en/main.php index 666ba39..2979ce3 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -92,6 +92,7 @@ $content['LN_FILTER_OTHERS'] = "Other Filters"; $content['LN_FILTER_MESSAGE'] = "Syslog Message"; $content['LN_FILTER_SYSLOGTAG'] = "Syslogtag"; $content['LN_FILTER_SOURCE'] = "Source (Hostname)"; +$content['LN_FILTER_MESSAGETYPE'] = "Message Type"; // Field Captions $content['LN_FIELDS_DATE'] = "Date"; diff --git a/src/search.php b/src/search.php index 7781006..b031264 100644 --- a/src/search.php +++ b/src/search.php @@ -117,7 +117,7 @@ if ( (isset($_POST['search']) || isset($_GET['search'])) ) } } - if ( isset($_GET['filter_facility']) && count($_GET['filter_facility']) < 18 ) // If we have more than 18 elements, this means all facilities are enabled + if ( isset($_GET['filter_facility']) && count($_GET['filter_facility']) < count($content['filter_facility_list']) ) // If we have more elements as in the filter list array, this means all are enabled { $tmpStr = ""; foreach ($_GET['filter_facility'] as $tmpfacility) @@ -129,7 +129,7 @@ if ( (isset($_POST['search']) || isset($_GET['search'])) ) $content['searchstr'] .= "facility:" . $tmpStr . " "; } - if ( isset($_GET['filter_severity']) && count($_GET['filter_severity']) < 7 ) // If we have more than 7 elements, this means all facilities are enabled) + if ( isset($_GET['filter_severity']) && count($_GET['filter_severity']) < count($content['filter_severity_list']) ) // If we have more elements as in the filter list array, this means all are enabled { $tmpStr = ""; foreach ($_GET['filter_severity'] as $tmpfacility) @@ -141,6 +141,19 @@ if ( (isset($_POST['search']) || isset($_GET['search'])) ) $content['searchstr'] .= "severity:" . $tmpStr . " "; } + if ( isset($_GET['filter_messagetype']) && count($_GET['filter_messagetype']) < count($content['filter_messagetype_list']) ) // If we have more elements as in the filter list array, this means all are enabled + { + $tmpStr = ""; + foreach ($_GET['filter_messagetype'] as $tmpmsgtype) + { + if ( strlen($tmpStr) > 0 ) + $tmpStr .= ","; + $tmpStr .= $tmpmsgtype; + } + $content['searchstr'] .= "messagetype:" . $tmpStr . " "; + } + + // Spaces need to be converted! if ( isset($_GET['filter_syslogtag']) && strlen($_GET['filter_syslogtag']) > 0 ) { diff --git a/src/templates/index.html b/src/templates/index.html index acafffd..b973f81 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -227,7 +227,7 @@ - + {fieldvalue} diff --git a/src/templates/search.html b/src/templates/search.html index 55f04fb..3b9df58 100644 --- a/src/templates/search.html +++ b/src/templates/search.html @@ -116,7 +116,7 @@
- - + + + +
+ + {htmlcode} + +
- - - - - {fieldvalue} - - - - + + + + + + + + + + + + {fieldvalue} + + + + + + + + + + diff --git a/src/themes/dark/main.css b/src/themes/dark/main.css index 3a54fe5..a663adf 100644 --- a/src/themes/dark/main.css +++ b/src/themes/dark/main.css @@ -243,12 +243,12 @@ font /* Cell Columns */ .cellmenu1 { - height: 15px; +/* height: 15px; */ border:1px solid; border-color: #353A3F #050A0F #050A0F #353A3F; text-indent:5px; - font: 10px Verdana, Arial, Helvetica, sans-serif; + font: bold 10px Verdana, Arial, Helvetica, sans-serif; color: #FFFCE5; background-color: #103B65; } diff --git a/src/themes/default/main.css b/src/themes/default/main.css index f3bf131..f6020ec 100644 --- a/src/themes/default/main.css +++ b/src/themes/default/main.css @@ -272,12 +272,12 @@ font /* Cell Columns */ .cellmenu1 { - height: 16px; +/* height: 16px; */ border:1px ridge; border-color: #79AABE #09506C #09506C #79AABE; text-indent:5px; - font: 10px Verdana, Arial, Helvetica, sans-serif; + font: bold 10px Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; background-color: #6C8E9C; } From 1388efe36d491540a41d05bc275af1563437ed8b Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Tue, 29 Apr 2008 17:44:52 +0200 Subject: [PATCH 08/79] Finalized new inline button menus, the inline search also works for severity and facility now. --- src/css/menu.css | 2 +- src/include/functions_common.php | 1 + src/index.php | 73 +++++++++++++++-------------- src/lang/de/main.php | 5 +- src/lang/en/main.php | 2 +- src/templates/index.html | 79 +++++++++++++++----------------- src/themes/default/main.css | 7 ++- 7 files changed, 89 insertions(+), 80 deletions(-) diff --git a/src/css/menu.css b/src/css/menu.css index 076c0ba..f6c2f3f 100644 --- a/src/css/menu.css +++ b/src/css/menu.css @@ -43,7 +43,7 @@ position: absolute; top: 12px; left: 4px; /* to position them to the right of their containing block */ - width: 300; /* width is based on the containing block */ + width: 350; /* width is based on the containing block */ } div#menu ul ul, diff --git a/src/include/functions_common.php b/src/include/functions_common.php index e49c35a..bc27351 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -351,6 +351,7 @@ function InitFrontEndVariables() $content['MENU_SEARCH'] = $content['BASEPATH'] . "images/icons/view.png"; $content['MENU_SELECTION_DISABLED'] = $content['BASEPATH'] . "images/icons/selection.png"; $content['MENU_SELECTION_ENABLED'] = $content['BASEPATH'] . "images/icons/selection_delete.png"; + $content['MENU_TEXT_FIND'] = $content['BASEPATH'] . "images/icons/text_find.png"; $content['MENU_PAGER_BEGIN'] = $content['BASEPATH'] . "images/icons/media_beginning.png"; $content['MENU_PAGER_PREVIOUS'] = $content['BASEPATH'] . "images/icons/media_rewind.png"; diff --git a/src/index.php b/src/index.php index 01fd4c7..5858b30 100644 --- a/src/index.php +++ b/src/index.php @@ -272,6 +272,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c $content['syslogmessages'][$counter]['values'][$mycolkey]['FieldAlign'] = $fields[$mycolkey]['FieldAlign']; $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldcssclass'] = $content['syslogmessages'][$counter]['cssclass']; $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldbgcolor'] = ""; + $content['syslogmessages'][$counter]['values'][$mycolkey]['isnowrap'] = "nowrap"; $content['syslogmessages'][$counter]['values'][$mycolkey]['hasdetails'] = "false"; // Set default link @@ -302,6 +303,14 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // Use default colour! $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $facility_colors[SYSLOG_LOCAL0] . '" '; } + + // Set OnClick Menu for SYSLOG_FACILITY + $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => '?filter=facility%3A' . $logArray[$mycolkey] . '&search=Search', + 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . GetFacilityDisplayName( $logArray[$mycolkey] ). "'", + 'IconSource' => $content['MENU_BULLET_BLUE'] + ); } else if ( $mycolkey == SYSLOG_SEVERITY ) { @@ -318,6 +327,14 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // Use default colour! $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $severity_colors[SYSLOG_INFO] . '" '; } + + // Set OnClick Menu for SYSLOG_FACILITY + $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => '?filter=severity%3A' . $logArray[$mycolkey] . '&search=Search', + 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . GetSeverityDisplayName( $logArray[$mycolkey] ). "'", + 'IconSource' => $content['MENU_BULLET_BLUE'] + ); } else if ( $mycolkey == SYSLOG_MESSAGETYPE ) { @@ -345,13 +362,16 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // Special Handling for the Syslog Message! if ( $mycolkey == SYSLOG_MESSAGE ) { + // No NOWRAP for Syslog Message! + $content['syslogmessages'][$counter]['values'][$mycolkey]['isnowrap'] = ""; + // Set truncasted message for display if ( isset($logArray[SYSLOG_MESSAGE]) ) { $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = GetStringWithHTMLCodes(strlen($logArray[SYSLOG_MESSAGE]) > $CFG['ViewMessageCharacterLimit'] ? substr($logArray[SYSLOG_MESSAGE], 0, $CFG['ViewMessageCharacterLimit'] ) . " ..." : $logArray[SYSLOG_MESSAGE]); // Enable LINK property! for this field - $content['syslogmessages'][$counter]['values'][$mycolkey]['haslink'] = true; + $content['syslogmessages'][$counter]['values'][$mycolkey]['ismessagefield'] = true; $content['syslogmessages'][$counter]['values'][$mycolkey]['detaillink'] = "details.php?uid=" . $uID; } else @@ -398,50 +418,35 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c if ( strlen($content['searchstr']) > 0 ) { - // Enable buttons - $content['syslogmessages'][$counter]['buttons_enabled'] = true; - - // Prepend Msg centered button - $content['syslogmessages'][$counter]['buttons'][]['htmlcode'] = ''; + // Set OnClick Menu for SYSLOG_MESSAGE + $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; + $content['syslogmessages'][$counter]['values'][$mycolkey]['hasdropdownbutton'] = true; + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => '?uid=' . $uID, + 'DisplayName' => $content['LN_VIEW_MESSAGECENTERED'], + 'IconSource' => $content['MENU_BULLET_GREEN'] + ); } } else if ( $mycolkey == SYSLOG_SYSLOGTAG ) { - // Append Syslogtag Search Button - $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = '' . $logArray[$mycolkey]. ''; -// ' + // Set OnClick Menu for SYSLOG_SYSLOGTAG + $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => '?filter=syslogtag%3A' . $logArray[$mycolkey] . '&search=Search', + 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'", + 'IconSource' => $content['MENU_BULLET_BLUE'] + ); } else if ( $mycolkey == SYSLOG_HOST ) { + // Set OnClick Menu for SYSLOG_HOST $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( 'ButtonUrl' => '?filter=source%3A' . $logArray[$mycolkey] . '&search=Search', - 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'" + 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'", + 'IconSource' => $content['MENU_BULLET_BLUE'] ); - - // Append Syslogtag Search Button -// $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = '' . '' . $logArray[$mycolkey]; - -/* TODO ... -$content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = ' - -' . $logArray[$mycolkey]; -*/ } } diff --git a/src/lang/de/main.php b/src/lang/de/main.php index cd4211a..c194a09 100644 --- a/src/lang/de/main.php +++ b/src/lang/de/main.php @@ -43,6 +43,9 @@ $content['LN_GEN_PAGE'] = "Seite"; $content['LN_GEN_PREDEFINEDSEARCHES'] = "Vordefinierte Suchkriterien"; $content['LN_GEN_SOURCE_DISK'] = "Datei"; $content['LN_GEN_SOURCE_DB'] = "Datenbank"; + $content['LN_GEN_RECORDSPERPAGE'] = "records per page"; + $content['LN_GEN_PRECONFIGURED'] = "Preconfigured"; + $content['LN_GEN_AVAILABLESEARCHES'] = "Available searches"; // Index Site $content['LN_ERROR_INSTALLFILEREMINDER'] = "Warnung! Du hast das Installationsscript 'install.php' noch nicht aus dem phpLogCon Hauptordner entfernt!"; @@ -56,7 +59,7 @@ $content['LN_SEARCH_ADVANCED'] = "Erweiterte Suche"; $content['LN_SEARCH'] = "Suche"; $content['LN_SEARCH_RESET'] = "Suche zurücksetzen"; $content['LN_SEARCH_PERFORMADVANCED'] = "Erweiterte Suche starten"; -$content['LN_VIEW_MESSAGECENTERED'] = "View syslog message centered in logstream"; +$content['LN_VIEW_MESSAGECENTERED'] = "Back to unfiltered view with this message at top"; $content['LN_VIEW_RELATEDMSG'] = "View related syslog messages"; $content['LN_VIEW_FILTERFOR'] = "Filter message for "; diff --git a/src/lang/en/main.php b/src/lang/en/main.php index f9bd7a6..666ba39 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -60,7 +60,7 @@ $content['LN_SEARCH_ADVANCED'] = "Advanced Search"; $content['LN_SEARCH'] = "Search"; $content['LN_SEARCH_RESET'] = "Reset search"; $content['LN_SEARCH_PERFORMADVANCED'] = "Perform Advanced Search"; -$content['LN_VIEW_MESSAGECENTERED'] = "View syslog message centered in logstream"; +$content['LN_VIEW_MESSAGECENTERED'] = "Back to unfiltered view with this message at top"; $content['LN_VIEW_RELATEDMSG'] = "View related syslog messages"; $content['LN_VIEW_FILTERFOR'] = "Filter message for "; diff --git a/src/templates/index.html b/src/templates/index.html index 186dd28..acafffd 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -198,75 +198,72 @@ - - + + + + - - - - + - + + + + {fieldvalue} - + + - + + {fieldvalue} + + + + + + + {fieldvalue} - + - + + + + {fieldvalue} + + + + + + + + + +
{popupcaption}
{detailfieldtitle}{detailfieldvalue}
- - - - -
- {fieldvalue} - - - - - - - - - -
{popupcaption}
{detailfieldtitle}{detailfieldvalue}
-
-
- + +
- - {htmlcode} - -
{LN_FILTER_FACILITY} + {LN_FILTER_SEVERITY} +
{LN_FILTER_MESSAGETYPE} + +
{LN_CFG_DBPASSWORD}
{LN_CFG_DBROWCOUNTING} + Yes No +
From 4bbe8170e349d9a2a3ad2d6921afb60ce69fcaa3 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 30 Apr 2008 18:01:43 +0200 Subject: [PATCH 13/79] Incremented build and appended changelog --- ChangeLog | 15 +++++++++++++-- src/include/functions_common.php | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf19b3d..173ed43 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,20 @@ --------------------------------------------------------------------------- -Version 2.1.4 (devel), 2008-04-30 +Version 2.3.0 (devel), 2008-04-30 +- Added "Back to Listview" butotn in the detailview. +- Added filter for message type. +- Added inline button menus into the listview. Most values can be clicked now, + which opens a menu with additional useful links. +- Added Pagesite Selectetion into listview, so you can change the amount of + records you want to see on one page at any time you want. +- greatly improved database performance, runs much better now, but still a + things to optimice. + + +Version 2.1.4 (devel), 2008-04-29 - Added missing facility 10 to 15 from RFC3164 into phhlogcon -Version 2.1.3 (devel), 2008-04-29 +Version 2.1.3 (devel), 2008-04-28 - Fixed a bug in the installer, the table type was not written into the configuration. diff --git a/src/include/functions_common.php b/src/include/functions_common.php index bc27351..b1fd6ce 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -71,7 +71,7 @@ $LANG_EN = "en"; // Used for fallback $LANG = "en"; // Default language // Default Template vars -$content['BUILDNUMBER'] = "2.1.2"; +$content['BUILDNUMBER'] = "2.3.0"; $content['TITLE'] = "PhpLogCon - Release " . $content['BUILDNUMBER']; // Title of the Page $content['BASEPATH'] = $gl_root_path; $content['EXTRA_METATAGS'] = ""; From 147349e8da0dcd773912fa8bd9c78a73282ec3dd Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 30 Apr 2008 18:12:13 +0200 Subject: [PATCH 14/79] fixed some nits in ChangeLog --- ChangeLog | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 173ed43..8c5213a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,33 +1,33 @@ --------------------------------------------------------------------------- Version 2.3.0 (devel), 2008-04-30 -- Added "Back to Listview" butotn in the detailview. -- Added filter for message type. +- Added "Back to Listview" button in the detailview. +- Added filter for message type - Added inline button menus into the listview. Most values can be clicked now, which opens a menu with additional useful links. -- Added Pagesite Selectetion into listview, so you can change the amount of +- Added Pagesite Selection into listview, so you can change the amount of records you want to see on one page at any time you want. -- greatly improved database performance, runs much better now, but still a - things to optimice. - - +- greatly improved database performance, runs much better now, but there + is still room for further optimization +--------------------------------------------------------------------------- Version 2.1.4 (devel), 2008-04-29 - Added missing facility 10 to 15 from RFC3164 into phhlogcon - - +--------------------------------------------------------------------------- Version 2.1.3 (devel), 2008-04-28 -- Fixed a bug in the installer, the table type was not written into the configuration. - - +- Fixed a bug in the installer, the table type was not written into the + configuration. Version 2.1.2 (devel), 2008-04-28 -- Removed syslog sample logfile from samplelogs, fixed minor issue in the installer -- Fixed bug in logstreamlineparsersyslog.class which failed to parse some rsyslog loglines. +--------------------------------------------------------------------------- +- Removed syslog sample logfile from samplelogs, fixed minor issue in the + installer +- Fixed bug in logstreamlineparsersyslog.class which failed to parse + some rsyslog loglines. - Special characters like german "umlaute" are now proberly replaced - Added link to help page, pointing to rsyslog wiki -- Changed database layout from winsyslog to monitorware. Added more debug handling - - +- Changed database layout from winsyslog to monitorware. + Added more debug handling +--------------------------------------------------------------------------- Version 2.1.1 (devel), 2008-04-25 -- added detailpage into phpLogCon. The detail page shows all possible +- added detail page into phpLogCon. The detail page shows all possible details of a syslog message. It also possible to page in the detail view. - fixed minor notices bugs in the functions_db.php, which is really used From 1656117827872adf38fa48f3208c6f80e9934aad Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 2 May 2008 12:20:55 +0200 Subject: [PATCH 15/79] The page title is now created with Source, and other useful informations. It is also possible to configure a custom title string with the configuration, which will be prepended into each phpLogcon page. --- src/details.php | 19 ++++++++++++++++--- src/include/config.sample.php | 1 + src/include/functions_common.php | 27 +++++++++++++++++++++++++-- src/index.php | 16 ++++++++++------ src/search.php | 15 +++++++-------- 5 files changed, 59 insertions(+), 19 deletions(-) diff --git a/src/details.php b/src/details.php index 71261bb..15df847 100644 --- a/src/details.php +++ b/src/details.php @@ -96,9 +96,6 @@ $content['searchstr'] = ""; $content['highlightstr'] = ""; $content['EXPAND_HIGHLIGHT'] = "false"; -// Set Page title -$content['TITLE'] = "phpLogCon :: Details"; - // --- BEGIN Custom Code if ( isset($content['Sources'][$currentSourceID]) ) // && $content['uid_current'] != UID_UNKNOWN ) // && $content['Sources'][$currentSourceID]['SourceType'] == SOURCE_DISK ) { @@ -351,6 +348,22 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['uid_current' } // --- +// --- BEGIN CREATE TITLE +$content['TITLE'] = InitPageTitle(); + +if ( $content['messageenabled'] == "true" ) +{ + // Append custom title part! + $content['TITLE'] .= " :: Details for '" . $content['uid_current'] . "'"; +} +else +{ + // APpend to title Page title + $content['TITLE'] .= " :: Unknown uid"; +} +// --- END CREATE TITLE + + // --- Parsen and Output InitTemplateParser(); $page -> parser($content, "details.html"); diff --git a/src/include/config.sample.php b/src/include/config.sample.php index 801540f..cba82a5 100644 --- a/src/include/config.sample.php +++ b/src/include/config.sample.php @@ -54,6 +54,7 @@ $CFG["MiscShowPageRenderStats"] = 1; // If enabled, you will see Pagerender Set // --- // --- Default Frontend Options +$CFG['PrependTitle'] = ""; // If set, this text will be prepended withint the title tag $CFG['ViewUseTodayYesterday'] = 1; // If enabled, the date from today and yesterday is displayed as "today" and "yesterday" $CFG['ViewMessageCharacterLimit'] = 80; // Default character limit for the message gets trunscated. $CFG['ViewEntriesPerPage'] = 50; // Default number of syslog entries shown per page diff --git a/src/include/functions_common.php b/src/include/functions_common.php index b1fd6ce..18f8565 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -71,8 +71,8 @@ $LANG_EN = "en"; // Used for fallback $LANG = "en"; // Default language // Default Template vars -$content['BUILDNUMBER'] = "2.3.0"; -$content['TITLE'] = "PhpLogCon - Release " . $content['BUILDNUMBER']; // Title of the Page +$content['BUILDNUMBER'] = "2.3.1"; +$content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title $content['BASEPATH'] = $gl_root_path; $content['EXTRA_METATAGS'] = ""; $content['EXTRA_JAVASCRIPT'] = ""; @@ -554,6 +554,29 @@ function DieWithFriendlyErrorMsg( $szerrmsg ) exit; } +/* +* Helper function to initialize the page title! +*/ +function InitPageTitle() +{ + global $content, $CFG, $currentSourceID; + + if ( isset($CFG['PrependTitle']) && strlen($CFG['PrependTitle']) > 0 ) + $szReturn = $CFG['PrependTitle'] . " :: "; + else + $szReturn = ""; + + // Append phpLogCon + $szReturn .= "phpLogCon"; + + if ( isset($currentSourceID) && isset($content['Sources'][$currentSourceID]['Name']) ) + $szReturn .= " :: Source '" . $content['Sources'][$currentSourceID]['Name'] . "'"; + + // return result + return $szReturn; +} + + function GetStringWithHTMLCodes($myStr) { // Replace all special characters with valid html representations diff --git a/src/index.php b/src/index.php index ee60133..af94a11 100644 --- a/src/index.php +++ b/src/index.php @@ -86,12 +86,6 @@ $content['searchstr'] = ""; $content['highlightstr'] = ""; $content['EXPAND_HIGHLIGHT'] = "false"; - -//if ( isset($content['myserver']) ) -// $content['TITLE'] = "phpLogCon :: Home :: Server '" . $content['myserver']['Name'] . "'"; // Title of the Page -//else - $content['TITLE'] = "phpLogCon :: Home"; - // --- BEGIN Define Helper functions function HighLightString($highlightArray, $strmsg) { @@ -171,6 +165,16 @@ if ( (isset($_POST['search']) || isset($_GET['search'])) || (isset($_POST['filte } // --- +// --- BEGIN CREATE TITLE +$content['TITLE'] = InitPageTitle(); + +// Append custom title part! +if ( isset($content['searchstr']) && strlen($content['searchstr']) > 0 ) + $content['TITLE'] .= " :: Results for the search '" . $content['searchstr'] . "'"; // Append search +else + $content['TITLE'] .= " :: All Syslogmessages"; +// --- END CREATE TITLE + // --- BEGIN Custom Code if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$currentSourceID]['SourceType'] == SOURCE_DISK ) { diff --git a/src/search.php b/src/search.php index b031264..802b7aa 100644 --- a/src/search.php +++ b/src/search.php @@ -60,14 +60,7 @@ $content['searchstr'] = ""; // --- -//if ( isset($content['myserver']) ) -// $content['TITLE'] = "phpLogCon :: Home :: Server '" . $content['myserver']['Name'] . "'"; // Title of the Page -//else - $content['TITLE'] = "phpLogCon :: Search"; -// --- - // --- BEGIN Custom Code - if ( (isset($_POST['search']) || isset($_GET['search'])) ) { // Copy search over @@ -180,9 +173,15 @@ if ( (isset($_POST['search']) || isset($_GET['search'])) ) // Redirect to the index page now! RedirectPage( "index.php?filter=" . urlencode( trim($content['searchstr']) ) . "&search=Search"); } - // --- +// --- BEGIN CREATE TITLE +$content['TITLE'] = InitPageTitle(); + +// Append custom title part! +$content['TITLE'] .= " :: Search"; +// --- END CREATE TITLE + // --- Parsen and Output InitTemplateParser(); $page -> parser($content, "search.html"); From eeb144cbe0afe41b365fb4e5f16f0066356438fe Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 2 May 2008 14:29:04 +0200 Subject: [PATCH 16/79] Added support for gzip compression, of course configurable. Gzip compression will reduce bandwith usage, so the default setting is on. --- src/include/config.sample.php | 2 ++ src/include/functions_common.php | 12 +++++++++++- src/templates/include_footer.html | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/include/config.sample.php b/src/include/config.sample.php index cba82a5..ff24e0b 100644 --- a/src/include/config.sample.php +++ b/src/include/config.sample.php @@ -51,6 +51,8 @@ $CFG['UserDBPass'] = ""; $CFG['MiscShowDebugMsg'] = 0; // if enabled, you will get additional output on certain places $CFG['MiscShowDebugGridCounter'] = 0; // Only for debugging purposes, will add a counter column into the grid! $CFG["MiscShowPageRenderStats"] = 1; // If enabled, you will see Pagerender Settings +$CFG['MiscEnableGzipCompression'] = 1; // If enabled, phplogcon will use gzip compression for output, we recommend + // to have this option enabled, it will highly reduce bandwith usage. // --- // --- Default Frontend Options diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 18f8565..c9c87ab 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -313,9 +313,19 @@ function CheckAndSetRunMode() function InitRuntimeInformations() { - global $content; + global $content, $CFG; // TODO| maybe not needed! + + // Enable GZIP Compression if enabled! + if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && (isset($CFG['MiscEnableGzipCompression']) && $CFG['MiscEnableGzipCompression'] == 1) ) + { + // This starts gzip compression! + ob_start("ob_gzhandler"); + $content['GzipCompressionEnmabled'] = "yes"; + } + else + $content['GzipCompressionEnmabled'] = "no"; } function CreateDebugModes() diff --git a/src/templates/include_footer.html b/src/templates/include_footer.html index 33e8d41..2d21a4f 100644 --- a/src/templates/include_footer.html +++ b/src/templates/include_footer.html @@ -16,7 +16,8 @@ Page rendered in {PAGERENDERTIME} seconds -  | Total DB Queries {TOTALQUERIES} +  | DB queries: {TOTALQUERIES} +  | GZIP enabled: {GzipCompressionEnmabled} From 4b9e8c2994cb6245635c59d7a0e2a271cf1c0688 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 2 May 2008 15:37:57 +0200 Subject: [PATCH 17/79] Implemented auto reload function into main list view Auto reload can be enabled in the configuration, but by default it is disabled. However you can set auto reload anytime in your session within phplogcon. The refresh is done using a META REFRESH. --- src/include/config.sample.php | 1 + src/include/functions_common.php | 56 ++++++++++++++++++++++++++++---- src/index.php | 7 +++- src/lang/de/main.php | 6 ++++ src/lang/en/main.php | 7 +++- src/templates/index.html | 19 +++++++++++ src/userchange.php | 8 ++++- 7 files changed, 94 insertions(+), 10 deletions(-) diff --git a/src/include/config.sample.php b/src/include/config.sample.php index ff24e0b..34c32ae 100644 --- a/src/include/config.sample.php +++ b/src/include/config.sample.php @@ -64,6 +64,7 @@ $CFG['ViewEnableDetailPopups'] = 1; // If enabled, you will see additional Det $CFG['ViewDefaultTheme'] = "default"; // This sets the default theme the user is going to see when he opens phplogcon the first time. // Currently only "default" and "dark" are available. $CFG['ViewDefaultLanguage'] = "en"; // Sets the default display language +$CFG['ViewEnableAutoReloadSeconds'] = 0; // If "ViewEnableAutoReloadSeconds" is set to anything higher the 0 (which means disabled), this means auto reload is enabled by default. $CFG['SearchCustomButtonCaption'] = "I'd like to feel sad"; // Default caption for the custom fast search button $CFG['SearchCustomButtonSearch'] = "error"; // Default search string for the custom search button diff --git a/src/include/functions_common.php b/src/include/functions_common.php index c9c87ab..dcacce6 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -186,6 +186,9 @@ function InitPhpLogCon() // Init predefined paging sizes CreatePagesizesList(); + // Init predefined reload times + CreateReloadTimesList(); + // --- Enable PHP Debug Mode InitPhpDebugMode(); // --- @@ -248,13 +251,14 @@ function CreatePagesizesList() { global $CFG, $content; - $content['pagesizes'][0] = array( "ID" => 0, "Selected" => "", "DisplayName" => $content['LN_GEN_PRECONFIGURED'] . " (" . $CFG['ViewEntriesPerPage'] . ")", "Value" => $CFG['ViewEntriesPerPage'] ); - $content['pagesizes'][1] = array( "ID" => 1, "Selected" => "", "DisplayName" => " 25 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 25 ); - $content['pagesizes'][2] = array( "ID" => 2, "Selected" => "", "DisplayName" => " 50 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 50 ); - $content['pagesizes'][3] = array( "ID" => 3, "Selected" => "", "DisplayName" => " 75 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 75 ); - $content['pagesizes'][4] = array( "ID" => 4, "Selected" => "", "DisplayName" => " 100 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 100 ); - $content['pagesizes'][5] = array( "ID" => 5, "Selected" => "", "DisplayName" => " 250 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 250 ); - $content['pagesizes'][6] = array( "ID" => 6, "Selected" => "", "DisplayName" => " 500 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 500 ); + $iCounter = 0; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_GEN_PRECONFIGURED'] . " (" . $CFG['ViewEntriesPerPage'] . ")", "Value" => $CFG['ViewEntriesPerPage'] ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 25 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 25 ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 50 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 50 ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 75 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 75 ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 100 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 100 ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 250 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 250 ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 500 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 500 ); $iCounter++; // Set default selected pagesize $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Selected"] = "selected"; @@ -263,6 +267,35 @@ function CreatePagesizesList() $content["ViewEntriesPerPage"] = $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Value"]; } +function CreateReloadTimesList() +{ + global $CFG, $content; + +// $CFG['ViewEnableAutoReloadSeconds'] + $iCounter = 0; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_DISABLED'], "Value" => 0 ); $iCounter++; + if ( isset($CFG['ViewEnableAutoReloadSeconds']) && $CFG['ViewEnableAutoReloadSeconds'] > 0 ) + { + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_PRECONFIGURED'] . " (" . $CFG['ViewEnableAutoReloadSeconds'] . " " . $content['LN_AUTORELOAD_SECONDS'] . ") ", "Value" => $CFG['ViewEnableAutoReloadSeconds'] ); $iCounter++; + } + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 5 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 5 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 10 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 10 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 15 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 15 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 30 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 30 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 60 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 60 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 5 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 300 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 10 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 600 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 15 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 900 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 30 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 1800 ); $iCounter++; + + // Set default selected autoreloadid + $content['reloadtimes'][ $_SESSION['AUTORELOAD_ID'] ]["Selected"] = "selected"; + + // The content variable will now contain the user selected oaging size + $content["ViewEnableAutoReloadSeconds"] = $content['reloadtimes'][ $_SESSION['AUTORELOAD_ID'] ]["Value"]; + +} + function CreatePredefinedSearches() { global $CFG, $content; @@ -459,6 +492,15 @@ function InitConfigurationValues() $_SESSION['PAGESIZE_ID'] = 0; } + // Auto reload handling! + if ( !isset($_SESSION['AUTORELOAD_ID']) ) + { + if ( isset($CFG['ViewEnableAutoReloadSeconds']) && $CFG['ViewEnableAutoReloadSeconds'] > 0 ) + $_SESSION['AUTORELOAD_ID'] = 1; // Autoreload ID will be the first item! + else // Default is 0, which means auto reload disabled + $_SESSION['AUTORELOAD_ID'] = 0; + } + // Theme Handling if ( !isset($content['web_theme']) ) { $content['web_theme'] = $CFG['ViewDefaultTheme'] /*"default"*/; } if ( isset($_SESSION['CUSTOM_THEME']) && VerifyTheme($_SESSION['CUSTOM_THEME']) ) diff --git a/src/index.php b/src/index.php index af94a11..3dcbbfe 100644 --- a/src/index.php +++ b/src/index.php @@ -57,6 +57,12 @@ $content['EXTRA_STYLESHEET'] = ' 0 ) + $content['EXTRA_METATAGS'] = '' . "\r\n"; +// --- + + // --- CONTENT Vars if ( isset($_GET['uid']) ) $content['uid_current'] = intval($_GET['uid']); @@ -563,7 +569,6 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // print_r( $content['syslogmessages'] ); } - // This will enable to Main SyslogView $content['syslogmessagesenabled'] = "true"; } diff --git a/src/lang/de/main.php b/src/lang/de/main.php index b135411..fd3398c 100644 --- a/src/lang/de/main.php +++ b/src/lang/de/main.php @@ -67,6 +67,12 @@ $content['LN_HIGHLIGHT'] = "Hightlight >>"; $content['LN_HIGHLIGHT_OFF'] = "Hightlight <<"; $content['LN_HIGHLIGHT_WORDS'] = "Hightlight-Wörter durch ein Komma voneinander trennen"; +$content['LN_AUTORELOAD'] = "Set auto reload"; +$content['LN_AUTORELOAD_DISABLED'] = "Auto reload disabled"; +$content['LN_AUTORELOAD_PRECONFIGURED'] = "Preconfigured auto reload "; +$content['LN_AUTORELOAD_SECONDS'] = "seconds"; +$content['LN_AUTORELOAD_MINUTES'] = "minutes"; + $content['LN_ERROR_NORECORDS'] = "Es wurden keine syslog-Einträge gefunden."; // Filter Options diff --git a/src/lang/en/main.php b/src/lang/en/main.php index 84c25b4..38c9252 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -64,11 +64,16 @@ $content['LN_VIEW_MESSAGECENTERED'] = "Back to unfiltered view with this message $content['LN_VIEW_RELATEDMSG'] = "View related syslog messages"; $content['LN_VIEW_FILTERFOR'] = "Filter message for "; - $content['LN_HIGHLIGHT'] = "Hightlight >>"; $content['LN_HIGHLIGHT_OFF'] = "Hightlight <<"; $content['LN_HIGHLIGHT_WORDS'] = "Hightlight words comma separated"; +$content['LN_AUTORELOAD'] = "Set auto reload"; +$content['LN_AUTORELOAD_DISABLED'] = "Auto reload disabled"; +$content['LN_AUTORELOAD_PRECONFIGURED'] = "Preconfigured auto reload "; +$content['LN_AUTORELOAD_SECONDS'] = "seconds"; +$content['LN_AUTORELOAD_MINUTES'] = "minutes"; + $content['LN_ERROR_NORECORDS'] = "No syslog records found."; // Filter Options diff --git a/src/templates/index.html b/src/templates/index.html index b973f81..4c0e463 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -97,6 +97,25 @@ + {LN_AUTORELOAD}: + +
+ + + + + +
+ + +
+
+ + {LN_GEN_RECORDCOUNT}: {main_recordcount} diff --git a/src/userchange.php b/src/userchange.php index be99fa6..8583a44 100644 --- a/src/userchange.php +++ b/src/userchange.php @@ -64,9 +64,15 @@ if ( isset($_GET['op']) ) if ( $_GET['op'] == "changepagesize" && isset($_GET['pagesizeid']) ) { - if ( intval($_GET['pagesizeid']) >= 0 && intval($_GET['pagesizeid']) < 7 ) + if ( intval($_GET['pagesizeid']) >= 0 && intval($_GET['pagesizeid']) < count($content['pagesizes']) ) $_SESSION['PAGESIZE_ID'] = intval($_GET['pagesizeid']); } + + if ( $_GET['op'] == "autoreload" && isset($_GET['autoreloadtime']) ) + { + if ( intval($_GET['autoreloadtime']) >= 0 && intval($_GET['autoreloadtime']) < count($content['reloadtimes']) ) + $_SESSION['AUTORELOAD_ID'] = intval($_GET['autoreloadtime']); + } } From 761ee2f92c374b8c7ddfe8a62e9fe97608eca80d Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 2 May 2008 17:10:28 +0200 Subject: [PATCH 18/79] Added new configuration variable to set the default SourceID If the default source id differs from the current used one, the sourceid variable will be appened into the search form, as well as into all needed links within phplogcon. This makes it easier to copy and send links around. --- src/include/functions_config.php | 8 ++++-- src/include/functions_frontendhelpers.php | 32 +++++++++++++++++++---- src/install.php | 3 ++- src/search.php | 8 +++++- src/templates/details.html | 2 +- src/templates/index.html | 13 +++++---- src/templates/search.html | 3 +++ 7 files changed, 54 insertions(+), 15 deletions(-) diff --git a/src/include/functions_config.php b/src/include/functions_config.php index bb81085..cf83742 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -132,8 +132,12 @@ $currentSourceID = $_SESSION['currentSourceID']; else { - // No Source stored in session, then to so now! - $_SESSION['currentSourceID'] = $currentSourceID; + if ( isset($CFG['DefaultSourceID']) && isset($content['Sources'][ $CFG['DefaultSourceID'] ]) ) + // Set Source to preconfigured sourceID! + $_SESSION['currentSourceID'] = $CFG['DefaultSourceID']; + else + // No Source stored in session, then to so now! + $_SESSION['currentSourceID'] = $currentSourceID; } } diff --git a/src/include/functions_frontendhelpers.php b/src/include/functions_frontendhelpers.php index e790e96..9520aab 100644 --- a/src/include/functions_frontendhelpers.php +++ b/src/include/functions_frontendhelpers.php @@ -67,13 +67,36 @@ function InstallFileReminder() function CreateCurrentUrl() { - global $content; + global $content, $CFG; $content['CURRENTURL'] = $_SERVER['PHP_SELF']; // . "?" . $_SERVER['QUERY_STRING'] // Init additional_url helper variable $content['additional_url'] = ""; $content['additional_url_uidonly'] = ""; $content['additional_url_sortingonly'] = ""; + $content['additional_url_sourceonly'] = ""; + + // Hidden Vars Counter + $hvCounter = 0; + + // Append SourceID into everything! + if ( (isset($CFG['DefaultSourceID']) && isset($content['Sources'][ $CFG['DefaultSourceID'] ])) && isset($_SESSION['currentSourceID']) ) + { + + // If the DefaultSourceID differes from the SourceID in our Session, we will append the sourceid within all URL's! + if ( $CFG['DefaultSourceID'] != $_SESSION['currentSourceID'] ) + { + $content['additional_url'] .= "&sourceid=" . $_SESSION['currentSourceID']; + $content['additional_url_uidonly'] = "&sourceid=" . $_SESSION['currentSourceID']; + $content['additional_url_sortingonly'] = "&sourceid=" . $_SESSION['currentSourceID']; + $content['additional_url_sourceonly'] = "&sourceid=" . $_SESSION['currentSourceID']; + + // For forms! + $content['HIDDENVARS_SOURCE'][$hvCounter]['varname'] = "sourceid"; + $content['HIDDENVARS_SOURCE'][$hvCounter]['varvalue'] = $_SESSION['currentSourceID']; + $hvCounter++; + } + } // Now the query string: if ( isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0 ) @@ -82,7 +105,6 @@ function CreateCurrentUrl() $content['CURRENTURL'] .= "?"; $queries = explode ("&", $_SERVER['QUERY_STRING']); - $counter = 0; for ( $i = 0; $i < count($queries); $i++ ) { // Some properties need to be filtered out. @@ -92,8 +114,8 @@ function CreateCurrentUrl() if ( isset($tmpvars[1]) ) // Only if value param is set! { // For forms! - $content['HIDDENVARS'][$counter]['varname'] = $tmpvars[0]; - $content['HIDDENVARS'][$counter]['varvalue'] = $tmpvars[1]; + $content['HIDDENVARS'][$hvCounter]['varname'] = $tmpvars[0]; + $content['HIDDENVARS'][$hvCounter]['varvalue'] = $tmpvars[1]; if ( strlen($tmpvars[1]) > 0 ) { @@ -114,7 +136,7 @@ function CreateCurrentUrl() $content['additional_url'] .= "&" . $tmpvars[0] . "=" . $tmpvars[1]; } - $counter++; + $hvCounter++; } } } diff --git a/src/install.php b/src/install.php index 46d4258..e38af00 100644 --- a/src/install.php +++ b/src/install.php @@ -592,7 +592,8 @@ else if ( $content['INSTALL_STEP'] == 8 ) } //Add the first source! - $firstsource = "\$CFG['Sources']['Source1']['ID'] = 'Source1';\r\n" . + $firstsource = "\$CFG['DefaultSourceID'] = 'Source1';\r\n\r\n" . + "\$CFG['Sources']['Source1']['ID'] = 'Source1';\r\n" . "\$CFG['Sources']['Source1']['Name'] = '" . $_SESSION['SourceName'] . "';\r\n" . "\$CFG['Sources']['Source1']['SourceType'] = " . $_SESSION['SourceType'] . ";\r\n"; if ( $_SESSION['SourceType'] == SOURCE_DISK ) diff --git a/src/search.php b/src/search.php index 802b7aa..37584ba 100644 --- a/src/search.php +++ b/src/search.php @@ -169,9 +169,15 @@ if ( (isset($_POST['search']) || isset($_GET['search'])) ) if ( isset($_GET['filter_message']) && strlen($_GET['filter_message']) > 0 ) $content['searchstr'] .= $_GET['filter_message']; } + + // Append sourceid if needed + if ( isset($_GET['sourceid']) && isset($content['Sources'][ $_GET['sourceid'] ]) ) + $sourceidstr = "&sourceid=" . $_GET['sourceid']; + else + $sourceidstr = ""; // Redirect to the index page now! - RedirectPage( "index.php?filter=" . urlencode( trim($content['searchstr']) ) . "&search=Search"); + RedirectPage( "index.php?filter=" . urlencode( trim($content['searchstr']) ) . "&search=Search" . $sourceidstr); } // --- diff --git a/src/templates/details.html b/src/templates/details.html index 3df4db9..573c77a 100644 --- a/src/templates/details.html +++ b/src/templates/details.html @@ -8,7 +8,7 @@
- {LN_DETAIL_BACKTOLIST} + {LN_DETAIL_BACKTOLIST} {LN_GEN_PAGE} {main_currentpagenumber} diff --git a/src/templates/index.html b/src/templates/index.html index 4c0e463..1e0aaea 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -2,6 +2,9 @@ + + + + From a63763d523dfc694cd4a67c62ab96dd24d5cf5e1 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 5 May 2008 16:23:17 +0200 Subject: [PATCH 20/79] Adding field mapping definitions for Windows Eventlog. --- src/include/constants_logstream.php | 363 +++++++++++++++------------- src/lang/de/main.php | 5 + src/lang/en/main.php | 5 + 3 files changed, 207 insertions(+), 166 deletions(-) diff --git a/src/include/constants_logstream.php b/src/include/constants_logstream.php index 3b1f667..55dfd24 100644 --- a/src/include/constants_logstream.php +++ b/src/include/constants_logstream.php @@ -1,167 +1,198 @@ - www.phplogcon.org <- * - * ----------------------------------------------------------------- * - * Some constants * - * * - * -> Stuff which has to be static and predefined * - * * - * All directives are explained within this file * - * - * Copyright (C) 2008 Adiscon GmbH. - * - * This file is part of phpLogCon. - * - * PhpLogCon is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpLogCon is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with phpLogCon. If not, see . - * - * A copy of the GPL can be found in the file "COPYING" in this - * distribution. - ********************************************************************* -*/ - -// --- Avoid directly accessing this file! -if ( !defined('IN_PHPLOGCON') ) -{ - die('Hacking attempt'); - exit; -} -// --- - -// --- Define properties names of all know fields -define('SYSLOG_UID', 'uID'); -define('SYSLOG_DATE', 'timereported'); -define('SYSLOG_HOST', 'FROMHOST'); -define('SYSLOG_MESSAGETYPE', 'IUT'); -define('SYSLOG_MESSAGE', 'msg'); - -// Syslog specific -define('SYSLOG_FACILITY', 'syslogfacility'); -define('SYSLOG_SEVERITY', 'syslogseverity'); -define('SYSLOG_SYSLOGTAG', 'syslogtag'); -define('SYSLOG_PROCESSID', 'procid'); - -// EventLog specific -define('SYSLOG_EVENT_ID', 'id'); -define('SYSLOG_EVENT_LOGTYPE', 'NTEventLogType'); -define('SYSLOG_EVENT_SOURCE', 'sourceproc'); -define('SYSLOG_EVENT_CATEGORY', 'category'); -define('SYSLOG_EVENT_USER', 'user'); -// --- - -// Defines which kind of field types we have -define('FILTER_TYPE_STRING', 0); -define('FILTER_TYPE_NUMBER', 1); -define('FILTER_TYPE_DATE', 2); -define('FILTER_TYPE_UNKNOWN', 99); - -// Define possible database types -define('DB_MYSQL', 0); -define('DB_MSSQL', 1); -define('DB_ODBC', 2); - -// --- Predefine fields array! -$fields[SYSLOG_UID]['FieldID'] = SYSLOG_UID; -$fields[SYSLOG_UID]['FieldCaptionID'] = 'LN_FIELDS_UID'; -$fields[SYSLOG_UID]['FieldType'] = FILTER_TYPE_NUMBER; -$fields[SYSLOG_UID]['Sortable'] = false; -$fields[SYSLOG_UID]['DefaultWidth'] = "50"; -$fields[SYSLOG_UID]['FieldAlign'] = "center"; -$fields[SYSLOG_DATE]['FieldID'] = SYSLOG_DATE; -$fields[SYSLOG_DATE]['FieldCaptionID'] = 'LN_FIELDS_DATE'; -$fields[SYSLOG_DATE]['FieldType'] = FILTER_TYPE_DATE; -$fields[SYSLOG_DATE]['Sortable'] = true; -$fields[SYSLOG_DATE]['DefaultWidth'] = "115"; -$fields[SYSLOG_DATE]['FieldAlign'] = "center"; -$fields[SYSLOG_HOST]['FieldID'] = SYSLOG_HOST; -$fields[SYSLOG_HOST]['FieldCaptionID'] = 'LN_FIELDS_HOST'; -$fields[SYSLOG_HOST]['FieldType'] = FILTER_TYPE_STRING; -$fields[SYSLOG_HOST]['Sortable'] = true; -$fields[SYSLOG_HOST]['DefaultWidth'] = "80"; -$fields[SYSLOG_HOST]['FieldAlign'] = "left"; -$fields[SYSLOG_MESSAGETYPE]['FieldID'] = SYSLOG_MESSAGETYPE; -$fields[SYSLOG_MESSAGETYPE]['FieldCaptionID'] = 'LN_FIELDS_MESSAGETYPE'; -$fields[SYSLOG_MESSAGETYPE]['FieldType'] = FILTER_TYPE_NUMBER; -$fields[SYSLOG_MESSAGETYPE]['Sortable'] = true; -$fields[SYSLOG_MESSAGETYPE]['DefaultWidth'] = "90"; -$fields[SYSLOG_MESSAGETYPE]['FieldAlign'] = "center"; - -// Syslog specific -$fields[SYSLOG_FACILITY]['FieldID'] = SYSLOG_FACILITY; -$fields[SYSLOG_FACILITY]['FieldCaptionID'] = 'LN_FIELDS_FACILITY'; -$fields[SYSLOG_FACILITY]['FieldType'] = FILTER_TYPE_NUMBER; -$fields[SYSLOG_FACILITY]['Sortable'] = true; -$fields[SYSLOG_FACILITY]['DefaultWidth'] = "50"; -$fields[SYSLOG_FACILITY]['FieldAlign'] = "center"; -$fields[SYSLOG_SEVERITY]['FieldID'] = SYSLOG_SEVERITY; -$fields[SYSLOG_SEVERITY]['FieldCaptionID'] = 'LN_FIELDS_SEVERITY'; -$fields[SYSLOG_SEVERITY]['FieldType'] = FILTER_TYPE_NUMBER; -$fields[SYSLOG_SEVERITY]['Sortable'] = true; -$fields[SYSLOG_SEVERITY]['DefaultWidth'] = "50"; -$fields[SYSLOG_SEVERITY]['FieldAlign'] = "center"; -$fields[SYSLOG_SYSLOGTAG]['FieldID'] = SYSLOG_SYSLOGTAG; -$fields[SYSLOG_SYSLOGTAG]['FieldCaptionID'] = 'LN_FIELDS_SYSLOGTAG'; -$fields[SYSLOG_SYSLOGTAG]['FieldType'] = FILTER_TYPE_STRING; -$fields[SYSLOG_SYSLOGTAG]['Sortable'] = true; -$fields[SYSLOG_SYSLOGTAG]['DefaultWidth'] = "85"; -$fields[SYSLOG_SYSLOGTAG]['FieldAlign'] = "left"; -$fields[SYSLOG_PROCESSID]['FieldID'] = SYSLOG_PROCESSID; -$fields[SYSLOG_PROCESSID]['FieldCaptionID'] = 'LN_FIELDS_PROCESSID'; -$fields[SYSLOG_PROCESSID]['FieldType'] = FILTER_TYPE_NUMBER; -$fields[SYSLOG_PROCESSID]['Sortable'] = true; -$fields[SYSLOG_PROCESSID]['DefaultWidth'] = "65"; -$fields[SYSLOG_PROCESSID]['FieldAlign'] = "center"; - -// TODO! EventLog specific - -// Message is the last element, this order is important for the Detail page for now! -$fields[SYSLOG_MESSAGE]['FieldID'] = SYSLOG_MESSAGE; -$fields[SYSLOG_MESSAGE]['FieldCaptionID'] = 'LN_FIELDS_MESSAGE'; -$fields[SYSLOG_MESSAGE]['FieldType'] = FILTER_TYPE_STRING; -$fields[SYSLOG_MESSAGE]['Sortable'] = false; -$fields[SYSLOG_MESSAGE]['DefaultWidth'] = "100%"; -$fields[SYSLOG_MESSAGE]['FieldAlign'] = "left"; - -// --- - -// --- Define default Database field mappings! -$dbmapping['monitorware'][SYSLOG_UID] = "ID"; -$dbmapping['monitorware'][SYSLOG_DATE] = "DeviceReportedTime"; -$dbmapping['monitorware'][SYSLOG_HOST] = "FromHost"; -$dbmapping['monitorware'][SYSLOG_MESSAGETYPE] = "InfoUnitID"; -$dbmapping['monitorware'][SYSLOG_MESSAGE] = "Message"; -$dbmapping['monitorware'][SYSLOG_FACILITY] = "Facility"; -$dbmapping['monitorware'][SYSLOG_SEVERITY] = "Priority"; -$dbmapping['monitorware'][SYSLOG_SYSLOGTAG] = "SysLogTag"; -$dbmapping['monitorware'][SYSLOG_EVENT_ID] = "EventID"; -$dbmapping['monitorware'][SYSLOG_EVENT_LOGTYPE] = "EventLogType"; -$dbmapping['monitorware'][SYSLOG_EVENT_SOURCE] = "EventSource"; -$dbmapping['monitorware'][SYSLOG_EVENT_CATEGORY] = "EventCategory"; -$dbmapping['monitorware'][SYSLOG_EVENT_USER] = "EventUser"; - -$dbmapping['syslogng'][SYSLOG_UID] = "seq"; -$dbmapping['syslogng'][SYSLOG_DATE] = "datetime"; -$dbmapping['syslogng'][SYSLOG_HOST] = "host"; -$dbmapping['syslogng'][SYSLOG_MESSAGE] = "msg"; -//TODO $dbmapping['syslogng'][SYSLOG_FACILITY] = "Facility"; -//TODO $dbmapping['syslogng'][SYSLOG_SEVERITY] = "Priority" -$dbmapping['syslogng'][SYSLOG_SYSLOGTAG] = "tag"; -// --- - -// EventTime Constants -define('EVTIME_TIMESTAMP', '0'); -define('EVTIME_TIMEZONE', '1'); -define('EVTIME_MICROSECONDS', '2'); - + www.phplogcon.org <- * + * ----------------------------------------------------------------- * + * Some constants * + * * + * -> Stuff which has to be static and predefined * + * * + * All directives are explained within this file * + * + * Copyright (C) 2008 Adiscon GmbH. + * + * This file is part of phpLogCon. + * + * PhpLogCon is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PhpLogCon is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with phpLogCon. If not, see . + * + * A copy of the GPL can be found in the file "COPYING" in this + * distribution. + ********************************************************************* +*/ + +// --- Avoid directly accessing this file! +if ( !defined('IN_PHPLOGCON') ) +{ + die('Hacking attempt'); + exit; +} +// --- + +// --- Define properties names of all know fields +define('SYSLOG_UID', 'uID'); +define('SYSLOG_DATE', 'timereported'); +define('SYSLOG_HOST', 'FROMHOST'); +define('SYSLOG_MESSAGETYPE', 'IUT'); +define('SYSLOG_MESSAGE', 'msg'); + +// Syslog specific +define('SYSLOG_FACILITY', 'syslogfacility'); +define('SYSLOG_SEVERITY', 'syslogseverity'); +define('SYSLOG_SYSLOGTAG', 'syslogtag'); +define('SYSLOG_PROCESSID', 'procid'); + +// EventLog specific +define('SYSLOG_EVENT_ID', 'id'); +define('SYSLOG_EVENT_LOGTYPE', 'NTEventLogType'); +define('SYSLOG_EVENT_SOURCE', 'sourceproc'); +define('SYSLOG_EVENT_CATEGORY', 'category'); +define('SYSLOG_EVENT_USER', 'user'); +// --- + +// Defines which kind of field types we have +define('FILTER_TYPE_STRING', 0); +define('FILTER_TYPE_NUMBER', 1); +define('FILTER_TYPE_DATE', 2); +define('FILTER_TYPE_UNKNOWN', 99); + +// Define possible database types +define('DB_MYSQL', 0); +define('DB_MSSQL', 1); +define('DB_ODBC', 2); + +// --- Predefine fields array! +$fields[SYSLOG_UID]['FieldID'] = SYSLOG_UID; +$fields[SYSLOG_UID]['FieldCaptionID'] = 'LN_FIELDS_UID'; +$fields[SYSLOG_UID]['FieldType'] = FILTER_TYPE_NUMBER; +$fields[SYSLOG_UID]['Sortable'] = false; +$fields[SYSLOG_UID]['DefaultWidth'] = "50"; +$fields[SYSLOG_UID]['FieldAlign'] = "center"; +$fields[SYSLOG_DATE]['FieldID'] = SYSLOG_DATE; +$fields[SYSLOG_DATE]['FieldCaptionID'] = 'LN_FIELDS_DATE'; +$fields[SYSLOG_DATE]['FieldType'] = FILTER_TYPE_DATE; +$fields[SYSLOG_DATE]['Sortable'] = true; +$fields[SYSLOG_DATE]['DefaultWidth'] = "115"; +$fields[SYSLOG_DATE]['FieldAlign'] = "center"; +$fields[SYSLOG_HOST]['FieldID'] = SYSLOG_HOST; +$fields[SYSLOG_HOST]['FieldCaptionID'] = 'LN_FIELDS_HOST'; +$fields[SYSLOG_HOST]['FieldType'] = FILTER_TYPE_STRING; +$fields[SYSLOG_HOST]['Sortable'] = true; +$fields[SYSLOG_HOST]['DefaultWidth'] = "80"; +$fields[SYSLOG_HOST]['FieldAlign'] = "left"; +$fields[SYSLOG_MESSAGETYPE]['FieldID'] = SYSLOG_MESSAGETYPE; +$fields[SYSLOG_MESSAGETYPE]['FieldCaptionID'] = 'LN_FIELDS_MESSAGETYPE'; +$fields[SYSLOG_MESSAGETYPE]['FieldType'] = FILTER_TYPE_NUMBER; +$fields[SYSLOG_MESSAGETYPE]['Sortable'] = true; +$fields[SYSLOG_MESSAGETYPE]['DefaultWidth'] = "90"; +$fields[SYSLOG_MESSAGETYPE]['FieldAlign'] = "center"; + +// Syslog specific +$fields[SYSLOG_FACILITY]['FieldID'] = SYSLOG_FACILITY; +$fields[SYSLOG_FACILITY]['FieldCaptionID'] = 'LN_FIELDS_FACILITY'; +$fields[SYSLOG_FACILITY]['FieldType'] = FILTER_TYPE_NUMBER; +$fields[SYSLOG_FACILITY]['Sortable'] = true; +$fields[SYSLOG_FACILITY]['DefaultWidth'] = "50"; +$fields[SYSLOG_FACILITY]['FieldAlign'] = "center"; +$fields[SYSLOG_SEVERITY]['FieldID'] = SYSLOG_SEVERITY; +$fields[SYSLOG_SEVERITY]['FieldCaptionID'] = 'LN_FIELDS_SEVERITY'; +$fields[SYSLOG_SEVERITY]['FieldType'] = FILTER_TYPE_NUMBER; +$fields[SYSLOG_SEVERITY]['Sortable'] = true; +$fields[SYSLOG_SEVERITY]['DefaultWidth'] = "50"; +$fields[SYSLOG_SEVERITY]['FieldAlign'] = "center"; +$fields[SYSLOG_SYSLOGTAG]['FieldID'] = SYSLOG_SYSLOGTAG; +$fields[SYSLOG_SYSLOGTAG]['FieldCaptionID'] = 'LN_FIELDS_SYSLOGTAG'; +$fields[SYSLOG_SYSLOGTAG]['FieldType'] = FILTER_TYPE_STRING; +$fields[SYSLOG_SYSLOGTAG]['Sortable'] = true; +$fields[SYSLOG_SYSLOGTAG]['DefaultWidth'] = "85"; +$fields[SYSLOG_SYSLOGTAG]['FieldAlign'] = "left"; +$fields[SYSLOG_PROCESSID]['FieldID'] = SYSLOG_PROCESSID; +$fields[SYSLOG_PROCESSID]['FieldCaptionID'] = 'LN_FIELDS_PROCESSID'; +$fields[SYSLOG_PROCESSID]['FieldType'] = FILTER_TYPE_NUMBER; +$fields[SYSLOG_PROCESSID]['Sortable'] = true; +$fields[SYSLOG_PROCESSID]['DefaultWidth'] = "65"; +$fields[SYSLOG_PROCESSID]['FieldAlign'] = "center"; + +// TODO! EventLog specific +$fields[SYSLOG_EVENT_ID]['FieldID'] = SYSLOG_EVENT_ID; +$fields[SYSLOG_EVENT_ID]['FieldCaptionID'] = 'LN_FIELDS_EVENTID'; +$fields[SYSLOG_EVENT_ID]['FieldType'] = FILTER_TYPE_NUMBER; +$fields[SYSLOG_EVENT_ID]['Sortable'] = true; +$fields[SYSLOG_EVENT_ID]['DefaultWidth'] = "65"; +$fields[SYSLOG_EVENT_ID]['FieldAlign'] = "center"; +$fields[SYSLOG_EVENT_LOGTYPE]['FieldID'] = SYSLOG_EVENT_LOGTYPE; +$fields[SYSLOG_EVENT_LOGTYPE]['FieldCaptionID'] = 'LN_FIELDS_EVENTLOGTYPE'; +$fields[SYSLOG_EVENT_LOGTYPE]['FieldType'] = FILTER_TYPE_STRING; +$fields[SYSLOG_EVENT_LOGTYPE]['Sortable'] = true; +$fields[SYSLOG_EVENT_LOGTYPE]['DefaultWidth'] = "100"; +$fields[SYSLOG_EVENT_LOGTYPE]['FieldAlign'] = "left"; +$fields[SYSLOG_EVENT_SOURCE]['FieldID'] = SYSLOG_EVENT_SOURCE; +$fields[SYSLOG_EVENT_SOURCE]['FieldCaptionID'] = 'LN_FIELDS_EVENTSOURCE'; +$fields[SYSLOG_EVENT_SOURCE]['FieldType'] = FILTER_TYPE_STRING; +$fields[SYSLOG_EVENT_SOURCE]['Sortable'] = true; +$fields[SYSLOG_EVENT_SOURCE]['DefaultWidth'] = "100"; +$fields[SYSLOG_EVENT_SOURCE]['FieldAlign'] = "left"; +$fields[SYSLOG_EVENT_CATEGORY]['FieldID'] = SYSLOG_EVENT_CATEGORY; +$fields[SYSLOG_EVENT_CATEGORY]['FieldCaptionID'] = 'LN_FIELDS_EVENTCATEGORY'; +$fields[SYSLOG_EVENT_CATEGORY]['FieldType'] = FILTER_TYPE_NUMBER; +$fields[SYSLOG_EVENT_CATEGORY]['Sortable'] = true; +$fields[SYSLOG_EVENT_CATEGORY]['DefaultWidth'] = "50"; +$fields[SYSLOG_EVENT_CATEGORY]['FieldAlign'] = "center"; +$fields[SYSLOG_EVENT_USER]['FieldID'] = SYSLOG_EVENT_USER; +$fields[SYSLOG_EVENT_USER]['FieldCaptionID'] = 'LN_FIELDS_EVENTUSER'; +$fields[SYSLOG_EVENT_USER]['FieldType'] = FILTER_TYPE_STRING; +$fields[SYSLOG_EVENT_USER]['Sortable'] = true; +$fields[SYSLOG_EVENT_USER]['DefaultWidth'] = "85"; +$fields[SYSLOG_EVENT_USER]['FieldAlign'] = "left"; + +// Message is the last element, this order is important for the Detail page for now! +$fields[SYSLOG_MESSAGE]['FieldID'] = SYSLOG_MESSAGE; +$fields[SYSLOG_MESSAGE]['FieldCaptionID'] = 'LN_FIELDS_MESSAGE'; +$fields[SYSLOG_MESSAGE]['FieldType'] = FILTER_TYPE_STRING; +$fields[SYSLOG_MESSAGE]['Sortable'] = false; +$fields[SYSLOG_MESSAGE]['DefaultWidth'] = "100%"; +$fields[SYSLOG_MESSAGE]['FieldAlign'] = "left"; + +// --- + +// --- Define default Database field mappings! +$dbmapping['monitorware'][SYSLOG_UID] = "ID"; +$dbmapping['monitorware'][SYSLOG_DATE] = "DeviceReportedTime"; +$dbmapping['monitorware'][SYSLOG_HOST] = "FromHost"; +$dbmapping['monitorware'][SYSLOG_MESSAGETYPE] = "InfoUnitID"; +$dbmapping['monitorware'][SYSLOG_MESSAGE] = "Message"; +$dbmapping['monitorware'][SYSLOG_FACILITY] = "Facility"; +$dbmapping['monitorware'][SYSLOG_SEVERITY] = "Priority"; +$dbmapping['monitorware'][SYSLOG_SYSLOGTAG] = "SysLogTag"; +$dbmapping['monitorware'][SYSLOG_EVENT_ID] = "EventID"; +$dbmapping['monitorware'][SYSLOG_EVENT_LOGTYPE] = "EventLogType"; +$dbmapping['monitorware'][SYSLOG_EVENT_SOURCE] = "EventSource"; +$dbmapping['monitorware'][SYSLOG_EVENT_CATEGORY] = "EventCategory"; +$dbmapping['monitorware'][SYSLOG_EVENT_USER] = "EventUser"; + + +$dbmapping['syslogng'][SYSLOG_UID] = "seq"; +$dbmapping['syslogng'][SYSLOG_DATE] = "datetime"; +$dbmapping['syslogng'][SYSLOG_HOST] = "host"; +$dbmapping['syslogng'][SYSLOG_MESSAGE] = "msg"; +//TODO $dbmapping['syslogng'][SYSLOG_FACILITY] = "Facility"; +//TODO $dbmapping['syslogng'][SYSLOG_SEVERITY] = "Priority" +$dbmapping['syslogng'][SYSLOG_SYSLOGTAG] = "tag"; +// --- + +// EventTime Constants +define('EVTIME_TIMESTAMP', '0'); +define('EVTIME_TIMEZONE', '1'); +define('EVTIME_MICROSECONDS', '2'); + ?> \ No newline at end of file diff --git a/src/lang/de/main.php b/src/lang/de/main.php index 2a2f44b..9412fca 100644 --- a/src/lang/de/main.php +++ b/src/lang/de/main.php @@ -108,6 +108,11 @@ $content['LN_FIELDS_PROCESSID'] = "Prozess ID"; $content['LN_FIELDS_MESSAGETYPE'] = "Meldungstyp"; $content['LN_FIELDS_UID'] = "uID"; $content['LN_FIELDS_MESSAGE'] = "Meldung"; + $content['LN_FIELDS_EVENTID'] = "Event ID"; + $content['LN_FIELDS_EVENTLOGTYPE'] = "Eventlogtype"; + $content['LN_FIELDS_EVENTSOURCE'] = "Event Source"; + $content['LN_FIELDS_EVENTCATEGORY'] = "Event Category"; + $content['LN_FIELDS_EVENTUSER'] = "Event User"; // Install Page $content['LN_CFG_DBSERVER'] = "Datenbank Host"; diff --git a/src/lang/en/main.php b/src/lang/en/main.php index 38c9252..8d7b77e 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -109,6 +109,11 @@ $content['LN_FIELDS_PROCESSID'] = "ProcessID"; $content['LN_FIELDS_MESSAGETYPE'] = "Messagetype"; $content['LN_FIELDS_UID'] = "uID"; $content['LN_FIELDS_MESSAGE'] = "Message"; +$content['LN_FIELDS_EVENTID'] = "Event ID"; +$content['LN_FIELDS_EVENTLOGTYPE'] = "Eventlogtype"; +$content['LN_FIELDS_EVENTSOURCE'] = "Event Source"; +$content['LN_FIELDS_EVENTCATEGORY'] = "Event Category"; +$content['LN_FIELDS_EVENTUSER'] = "Event User"; // Install Page $content['LN_CFG_DBSERVER'] = "Database Host"; From 6b3dccaf18dd45c3e6165612cdb558e3bf3e1058 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 5 May 2008 16:26:09 +0200 Subject: [PATCH 21/79] Simplified columns configuration definition in config.sample.php --- src/include/config.sample.php | 9 +- src/include/constants_filters.php | 224 +++++++++++++++--------------- 2 files changed, 114 insertions(+), 119 deletions(-) diff --git a/src/include/config.sample.php b/src/include/config.sample.php index 72f0c50..34483d6 100644 --- a/src/include/config.sample.php +++ b/src/include/config.sample.php @@ -72,13 +72,8 @@ $CFG['SearchCustomButtonSearch'] = "error"; // Default search string for the // --- Define which fields you want to see //$CFG['ShowMessage'] = true; // If enabled, the Message column will be appended to the columns list. -$CFG['Columns'][] = SYSLOG_DATE; -$CFG['Columns'][] = SYSLOG_FACILITY; -$CFG['Columns'][] = SYSLOG_SEVERITY; -$CFG['Columns'][] = SYSLOG_HOST; -$CFG['Columns'][] = SYSLOG_SYSLOGTAG; -$CFG['Columns'][] = SYSLOG_MESSAGETYPE; -$CFG['Columns'][] = SYSLOG_MESSAGE; +//Eventlog based fields: $CFG['Columns'] = array ( SYSLOG_DATE, SYSLOG_HOST, SYSLOG_EVENT_LOGTYPE, SYSLOG_EVENT_SOURCE, /*SYSLOG_EVENT_CATEGORY, */SYSLOG_EVENT_ID, SYSLOG_MESSAGE ); +$CFG['Columns'] = array ( SYSLOG_DATE, SYSLOG_FACILITY, SYSLOG_SEVERITY, SYSLOG_HOST, SYSLOG_SYSLOGTAG, SYSLOG_MESSAGETYPE, SYSLOG_MESSAGE ); // --- // --- Predefined Searches! diff --git a/src/include/constants_filters.php b/src/include/constants_filters.php index 5447e78..c2348a1 100644 --- a/src/include/constants_filters.php +++ b/src/include/constants_filters.php @@ -1,113 +1,113 @@ - www.phplogcon.org <- * - * ----------------------------------------------------------------- * - * Some constants * - * * - * -> Stuff which has to be static and predefined * - * * - * All directives are explained within this file * - * - * Copyright (C) 2008 Adiscon GmbH. - * - * This file is part of phpLogCon. - * - * PhpLogCon is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpLogCon is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with phpLogCon. If not, see . - * - * A copy of the GPL can be found in the file "COPYING" in this - * distribution. - ********************************************************************* -*/ - -// --- Avoid directly accessing this file! -if ( !defined('IN_PHPLOGCON') ) -{ - die('Hacking attempt'); - exit; -} -// --- - -// --- Some custom defines -define('DATEMODE_ALL', 1); -define('DATEMODE_RANGE', 2); -define('DATEMODE_LASTX', 3); - -define('DATEMODE_RANGE_FROM', 4); -define('DATEMODE_RANGE_TO', 5); - -define('DATE_LASTX_HOUR', 1); -define('DATE_LASTX_12HOURS', 2); -define('DATE_LASTX_24HOURS', 3); -define('DATE_LASTX_7DAYS', 4); -define('DATE_LASTX_31DAYS', 5); -// --- - - -// Helper constants needed for parsing filters -define('FILTER_TMP_KEY', 0); -define('FILTER_TMP_VALUE', 1); -define('FILTER_DATEMODE', 'datemode'); -define('FILTER_TYPE', 'filtertype'); -define('FILTER_DATEMODENAME', 'datemodename'); -define('FILTER_VALUE', 'value'); -define('FILTER_MODE', 'filtermode'); -define('FILTER_MODE_INCLUDE', 0); -define('FILTER_MODE_EXCLUDE', 1); - -// --- Init Facility LIST -$content['filter_facility_list'][] = array( "ID" => SYSLOG_KERN, "DisplayName" => "KERN", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_USER, "DisplayName" => "USER", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_MAIL, "DisplayName" => "MAIL", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_DAEMON, "DisplayName" => "DAEMON", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_AUTH, "DisplayName" => "AUTH", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_SYSLOG, "DisplayName" => "SYSLOG", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_LPR, "DisplayName" => "LPR", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_NEWS, "DisplayName" => "NEWS", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_UUCP, "DisplayName" => "UUCP", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_CRON, "DisplayName" => "CRON", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_SECURITY, "DisplayName" => "SECURITY", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_FTP, "DisplayName" => "FTP", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_NTP, "DisplayName" => "NTP", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOGAUDIT, "DisplayName" => "LOGAUDIT", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOGALERT, "DisplayName" => "LOGALERT", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_CLOCK, "DisplayName" => "CLOCK", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL0, "DisplayName" => "LOCAL0", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL1, "DisplayName" => "LOCAL1", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL2, "DisplayName" => "LOCAL2", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL3, "DisplayName" => "LOCAL3", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL4, "DisplayName" => "LOCAL4", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL5, "DisplayName" => "LOCAL5", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL6, "DisplayName" => "LOCAL6", "selected" => "" ); -$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL7, "DisplayName" => "LOCAL7", "selected" => "" ); -// --- - -// Init Severity LIST -$content['filter_severity_list'][] = array( "ID" => SYSLOG_EMERG, "DisplayName" => "EMERG", "selected" => "" ); -$content['filter_severity_list'][] = array( "ID" => SYSLOG_ALERT, "DisplayName" => "ALERT", "selected" => "" ); -$content['filter_severity_list'][] = array( "ID" => SYSLOG_CRIT, "DisplayName" => "CRIT", "selected" => "" ); -$content['filter_severity_list'][] = array( "ID" => SYSLOG_ERR, "DisplayName" => "ERR", "selected" => "" ); -$content['filter_severity_list'][] = array( "ID" => SYSLOG_WARNING, "DisplayName" => "WARNING", "selected" => "" ); -$content['filter_severity_list'][] = array( "ID" => SYSLOG_NOTICE, "DisplayName" => "NOTICE", "selected" => "" ); -$content['filter_severity_list'][] = array( "ID" => SYSLOG_INFO, "DisplayName" => "INFO", "selected" => "" ); -$content['filter_severity_list'][] = array( "ID" => SYSLOG_DEBUG, "DisplayName" => "DEBUG", "selected" => "" ); -// --- - -// Init MessageType LIST -//$content['filter_messagetype_list'][] = array( "ID" => IUT_Unknown, "DisplayName" => "Unknown", "selected" => "" ); -$content['filter_messagetype_list'][] = array( "ID" => IUT_Syslog, "DisplayName" => "Syslog", "selected" => "" ); -$content['filter_messagetype_list'][] = array( "ID" => IUT_NT_EventReport, "DisplayName" => "WinEventLog", "selected" => "" ); -$content['filter_messagetype_list'][] = array( "ID" => IUT_File_Monitor, "DisplayName" => "File Monitor", "selected" => "" ); - + www.phplogcon.org <- * + * ----------------------------------------------------------------- * + * Some constants * + * * + * -> Stuff which has to be static and predefined * + * * + * All directives are explained within this file * + * + * Copyright (C) 2008 Adiscon GmbH. + * + * This file is part of phpLogCon. + * + * PhpLogCon is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PhpLogCon is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with phpLogCon. If not, see . + * + * A copy of the GPL can be found in the file "COPYING" in this + * distribution. + ********************************************************************* +*/ + +// --- Avoid directly accessing this file! +if ( !defined('IN_PHPLOGCON') ) +{ + die('Hacking attempt'); + exit; +} +// --- + +// --- Some custom defines +define('DATEMODE_ALL', 1); +define('DATEMODE_RANGE', 2); +define('DATEMODE_LASTX', 3); + +define('DATEMODE_RANGE_FROM', 4); +define('DATEMODE_RANGE_TO', 5); + +define('DATE_LASTX_HOUR', 1); +define('DATE_LASTX_12HOURS', 2); +define('DATE_LASTX_24HOURS', 3); +define('DATE_LASTX_7DAYS', 4); +define('DATE_LASTX_31DAYS', 5); +// --- + + +// Helper constants needed for parsing filters +define('FILTER_TMP_KEY', 0); +define('FILTER_TMP_VALUE', 1); +define('FILTER_DATEMODE', 'datemode'); +define('FILTER_TYPE', 'filtertype'); +define('FILTER_DATEMODENAME', 'datemodename'); +define('FILTER_VALUE', 'value'); +define('FILTER_MODE', 'filtermode'); +define('FILTER_MODE_INCLUDE', 0); +define('FILTER_MODE_EXCLUDE', 1); + +// --- Init Facility LIST +$content['filter_facility_list'][] = array( "ID" => SYSLOG_KERN, "DisplayName" => "KERN", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_USER, "DisplayName" => "USER", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_MAIL, "DisplayName" => "MAIL", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_DAEMON, "DisplayName" => "DAEMON", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_AUTH, "DisplayName" => "AUTH", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_SYSLOG, "DisplayName" => "SYSLOG", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_LPR, "DisplayName" => "LPR", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_NEWS, "DisplayName" => "NEWS", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_UUCP, "DisplayName" => "UUCP", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_CRON, "DisplayName" => "CRON", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_SECURITY, "DisplayName" => "SECURITY", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_FTP, "DisplayName" => "FTP", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_NTP, "DisplayName" => "NTP", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOGAUDIT, "DisplayName" => "LOGAUDIT", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOGALERT, "DisplayName" => "LOGALERT", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_CLOCK, "DisplayName" => "CLOCK", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL0, "DisplayName" => "LOCAL0", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL1, "DisplayName" => "LOCAL1", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL2, "DisplayName" => "LOCAL2", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL3, "DisplayName" => "LOCAL3", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL4, "DisplayName" => "LOCAL4", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL5, "DisplayName" => "LOCAL5", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL6, "DisplayName" => "LOCAL6", "selected" => "" ); +$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL7, "DisplayName" => "LOCAL7", "selected" => "" ); +// --- + +// Init Severity LIST +$content['filter_severity_list'][] = array( "ID" => SYSLOG_EMERG, "DisplayName" => "EMERG", "selected" => "" ); +$content['filter_severity_list'][] = array( "ID" => SYSLOG_ALERT, "DisplayName" => "ALERT", "selected" => "" ); +$content['filter_severity_list'][] = array( "ID" => SYSLOG_CRIT, "DisplayName" => "CRIT", "selected" => "" ); +$content['filter_severity_list'][] = array( "ID" => SYSLOG_ERR, "DisplayName" => "ERR", "selected" => "" ); +$content['filter_severity_list'][] = array( "ID" => SYSLOG_WARNING, "DisplayName" => "WARNING", "selected" => "" ); +$content['filter_severity_list'][] = array( "ID" => SYSLOG_NOTICE, "DisplayName" => "NOTICE", "selected" => "" ); +$content['filter_severity_list'][] = array( "ID" => SYSLOG_INFO, "DisplayName" => "INFO", "selected" => "" ); +$content['filter_severity_list'][] = array( "ID" => SYSLOG_DEBUG, "DisplayName" => "DEBUG", "selected" => "" ); +// --- + +// Init MessageType LIST +//$content['filter_messagetype_list'][] = array( "ID" => IUT_Unknown, "DisplayName" => "Unknown", "selected" => "" ); +$content['filter_messagetype_list'][] = array( "ID" => IUT_Syslog, "DisplayName" => "Syslog", "selected" => "" ); +$content['filter_messagetype_list'][] = array( "ID" => IUT_NT_EventReport, "DisplayName" => "WinEventLog", "selected" => "" ); +$content['filter_messagetype_list'][] = array( "ID" => IUT_File_Monitor, "DisplayName" => "File Monitor", "selected" => "" ); + ?> \ No newline at end of file From 3c2e2ee27e94de3ae1f88a5c218ff94e638df7e0 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 5 May 2008 17:07:08 +0200 Subject: [PATCH 22/79] Added filtering support for the new Eventlog fields --- src/classes/logstream.class.php | 29 +++++++++++++++++++++++++++ src/index.php | 35 +++++++++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/src/classes/logstream.class.php b/src/classes/logstream.class.php index bb1ea34..04cbe2c 100644 --- a/src/classes/logstream.class.php +++ b/src/classes/logstream.class.php @@ -340,6 +340,35 @@ abstract class LogStream { } // --- break; + /* BEGIN Eventlog based fields */ + case "eventid": + $tmpKeyName = SYSLOG_EVENT_ID; + $tmpFilterType = FILTER_TYPE_NUMBER; + // --- Extra numeric Check + if ( isset($tmpValues) ) + { + foreach( $tmpValues as $mykey => $szValue ) + { + if ( is_numeric($szValue) ) + $tmpValues[$mykey] = $szValue; + } + } + else + { + if ( !is_numeric($tmpArray[FILTER_TMP_VALUE]) ) + $tmpArray[FILTER_TMP_VALUE] = ""; + } + // --- + break; + case "eventlogtype": + $tmpKeyName = SYSLOG_EVENT_LOGTYPE; + $tmpFilterType = FILTER_TYPE_STRING; + break; + case "eventlogsource": + $tmpKeyName = SYSLOG_EVENT_SOURCE; + $tmpFilterType = FILTER_TYPE_STRING; + break; + /* END Eventlog based fields */ case "syslogtag": $tmpKeyName = SYSLOG_SYSLOGTAG; $tmpFilterType = FILTER_TYPE_STRING; diff --git a/src/index.php b/src/index.php index 21398b5..f3fd775 100644 --- a/src/index.php +++ b/src/index.php @@ -386,8 +386,19 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . GetMessageTypeDisplayName( $logArray[$mycolkey] ). "'", 'IconSource' => $content['MENU_BULLET_BLUE'] ); - } + /* Eventlog based fields */ + else if ( $mycolkey == SYSLOG_EVENT_ID ) + { + // Set OnClick Menu for SYSLOG_EVENT_ID + $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => '?filter=eventid%3A' . $logArray[$mycolkey] . '&search=Search', + 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'", + 'IconSource' => $content['MENU_BULLET_BLUE'] + ); + } + } else if ( $content['fields'][$mycolkey]['FieldType'] == FILTER_TYPE_STRING ) { @@ -483,7 +494,27 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); } - + /* Eventlog based fields */ + else if ( $mycolkey == SYSLOG_EVENT_LOGTYPE ) + { + // Set OnClick Menu for SYSLOG_EVENT_LOGTYPE + $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => '?filter=eventlogtype%3A' . $logArray[$mycolkey] . '&search=Search', + 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'", + 'IconSource' => $content['MENU_BULLET_BLUE'] + ); + } + else if ( $mycolkey == SYSLOG_EVENT_SOURCE ) + { + // Set OnClick Menu for SYSLOG_EVENT_SOURCE + $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => '?filter=eventlogsource%3A' . $logArray[$mycolkey] . '&search=Search', + 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'", + 'IconSource' => $content['MENU_BULLET_BLUE'] + ); + } } } } From 48a5aaee7f78a4f34264ce60bc1a11f69b3f6682 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Tue, 6 May 2008 16:23:07 +0200 Subject: [PATCH 23/79] Added new menu links for Event fields to search in our upcoming global repository. Also fixed minor css issues with the menu.css --- src/css/menu.css | 17 +- src/images/icons/earth_network.png | Bin 0 -> 872 bytes src/include/functions_common.php | 2 + src/index.php | 32 +- src/lang/de/main.php | 7 +- src/lang/en/main.php | 3 +- src/templates/index.html | 13 +- src/themes/dark/main.css | 782 ++++++++++++++--------------- src/themes/default/main.css | 36 +- 9 files changed, 444 insertions(+), 448 deletions(-) create mode 100644 src/images/icons/earth_network.png diff --git a/src/css/menu.css b/src/css/menu.css index 1061fc1..277a3ad 100644 --- a/src/css/menu.css +++ b/src/css/menu.css @@ -12,25 +12,22 @@ /* style, color and size links and headings to suit */ #menu a, #menu h2 { display: block; - border-width: 1px; - border-style: solid; - margin: 0; - padding: 1px 1px; + margin: 2px; + padding: 1px 1px; } #menu h2 { + font-size: 12px; font: bold; text-align: center; } #menu a { text-decoration: none; - border-color: #44617D #203040 #203040 #44617D; } #menu a:hover { text-decoration: none; - border-color: #44617D #203040 #203040 #44617D; } #menu li { @@ -38,9 +35,17 @@ position: relative; } +#menu ul li ul li { + border-width: 1px; + border-style: solid; + border-color: #44617D #203040 #203040 #44617D; +} + #menu ul ul { z-index:10; +/* border-color: #44617D #203040 #203040 #44617D; */ + position: absolute; top: 12px; left: 4px; /* to position them to the right of their containing block */ diff --git a/src/images/icons/earth_network.png b/src/images/icons/earth_network.png new file mode 100644 index 0000000000000000000000000000000000000000..24484aecefcd79d0c482ba008f102b4724792f94 GIT binary patch literal 872 zcmV-u1DE`XP)WdKcSATc)}L3L*!GB7YTATcpIG&MRgF(4~2F)%Pb%&Rv5000McNliru z)&&<0F*|Y-$N>NV010qNS#tmY3h)2`3h)6!tTdPa000DMK}|sb0I`n?{9y$E00O{C zL_t(|+GUeVOcPNQhR)k?V$e-Y>p@;}cmUflTkb@=Fu&-T(-7_7V4_|UL+ zU^lD^I*SL)z4Z+ZhJfq+Qrbj1VKBKO+;Rl2jF(A6#HJsC+M;?8;uqj=ViQC9z1R*F1^`pC6N>VApvW1Jr78$h`=tDGvuN_8+5UZDNgz{`YzYEY!PkJ2Z)6+cA?G-XS!Kng zJAJiQ?skcxr&UNsw0}JN%j=7?Zs};9#r*}uf%tPTRA%UqYNTsyZ0v>AYL)eR{VQBQ zM!M5`I`xOM6Q1V>BasL-I{JE;<4C32RioiRl2ZP`!JE%bCX-N8Q!|dQ-caZ!K{JBV(AP70?lo0efM-a za#oflK@=q*7(oc3Sk^}`E`Iu`)oO#WSZoU=AC%mylW0_Y(*N0%zA)-$QyS '?filter=facility%3A' . $logArray[$mycolkey] . '&search=Search', + 'ButtonUrl' => '?filter=facility%3A' . $logArray[$mycolkey] . '&search=Search' . $content['additional_url_sourceonly'], 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . GetFacilityDisplayName( $logArray[$mycolkey] ). "'", 'IconSource' => $content['MENU_BULLET_BLUE'] ); @@ -358,7 +358,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // Set OnClick Menu for SYSLOG_FACILITY $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => '?filter=severity%3A' . $logArray[$mycolkey] . '&search=Search', + 'ButtonUrl' => '?filter=severity%3A' . $logArray[$mycolkey] . '&search=Search' . $content['additional_url_sourceonly'], 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . GetSeverityDisplayName( $logArray[$mycolkey] ). "'", 'IconSource' => $content['MENU_BULLET_BLUE'] ); @@ -382,7 +382,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // Set OnClick Menu for SYSLOG_MESSAGETYPE $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => '?filter=messagetype%3A' . $logArray[$mycolkey] . '&search=Search', + 'ButtonUrl' => '?filter=messagetype%3A' . $logArray[$mycolkey] . '&search=Search' . $content['additional_url_sourceonly'], 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . GetMessageTypeDisplayName( $logArray[$mycolkey] ). "'", 'IconSource' => $content['MENU_BULLET_BLUE'] ); @@ -393,10 +393,15 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // Set OnClick Menu for SYSLOG_EVENT_ID $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => '?filter=eventid%3A' . $logArray[$mycolkey] . '&search=Search', + 'ButtonUrl' => '?filter=eventid%3A' . $logArray[$mycolkey] . '&search=Search' . $content['additional_url_sourceonly'], 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_BULLET_BLUE'] ); + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => 'http://global.phplogcon.org/?' . $logArray[$mycolkey] . '+' . str_replace(" ", "+", $content['LN_FIELDS_EVENTID']), + 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTID'] . " '" . $logArray[$mycolkey] . "'", + 'IconSource' => $content['MENU_NETWORK'] + ); } } @@ -479,7 +484,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // Set OnClick Menu for SYSLOG_SYSLOGTAG $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => '?filter=syslogtag%3A' . $logArray[$mycolkey] . '&search=Search', + 'ButtonUrl' => '?filter=syslogtag%3A' . $logArray[$mycolkey] . '&search=Search' . $content['additional_url_sourceonly'], 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_BULLET_BLUE'] ); @@ -489,7 +494,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // Set OnClick Menu for SYSLOG_HOST $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => '?filter=source%3A' . $logArray[$mycolkey] . '&search=Search', + 'ButtonUrl' => '?filter=source%3A' . $logArray[$mycolkey] . '&search=Search' . $content['additional_url_sourceonly'], 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_BULLET_BLUE'] ); @@ -500,20 +505,31 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // Set OnClick Menu for SYSLOG_EVENT_LOGTYPE $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => '?filter=eventlogtype%3A' . $logArray[$mycolkey] . '&search=Search', + 'ButtonUrl' => '?filter=eventlogtype%3A' . $logArray[$mycolkey] . '&search=Search' . $content['additional_url_sourceonly'], 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_BULLET_BLUE'] ); + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => 'http://global.phplogcon.org/?' . $logArray[$mycolkey] . '+' . str_replace(" ", "+", $content['LN_FIELDS_EVENTLOGTYPE']), + 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . "'" . $logArray[$mycolkey] . "'", + 'IconSource' => $content['MENU_NETWORK'] + ); + } else if ( $mycolkey == SYSLOG_EVENT_SOURCE ) { // Set OnClick Menu for SYSLOG_EVENT_SOURCE $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => '?filter=eventlogsource%3A' . $logArray[$mycolkey] . '&search=Search', + 'ButtonUrl' => '?filter=eventlogsource%3A' . $logArray[$mycolkey] . '&search=Search' . $content['additional_url_sourceonly'], 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_BULLET_BLUE'] ); + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => 'http://global.phplogcon.org/?' . $logArray[$mycolkey] . '+' . str_replace(" ", "+", $content['LN_FIELDS_EVENTSOURCE']), + 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . "'" . $logArray[$mycolkey] . "'", + 'IconSource' => $content['MENU_NETWORK'] + ); } } } diff --git a/src/lang/de/main.php b/src/lang/de/main.php index 9412fca..27cca9a 100644 --- a/src/lang/de/main.php +++ b/src/lang/de/main.php @@ -59,9 +59,10 @@ $content['LN_SEARCH_ADVANCED'] = "Erweiterte Suche"; $content['LN_SEARCH'] = "Suche"; $content['LN_SEARCH_RESET'] = "Suche zurücksetzen"; $content['LN_SEARCH_PERFORMADVANCED'] = "Erweiterte Suche starten"; -$content['LN_VIEW_MESSAGECENTERED'] = "Back to unfiltered view with this message at top"; -$content['LN_VIEW_RELATEDMSG'] = "View related syslog messages"; -$content['LN_VIEW_FILTERFOR'] = "Filter message for "; + $content['LN_VIEW_MESSAGECENTERED'] = "Back to unfiltered view with this message at top"; + $content['LN_VIEW_RELATEDMSG'] = "View related syslog messages"; + $content['LN_VIEW_FILTERFOR'] = "Filter message for "; + $content['LN_VIEW_SEARCHFOR'] = "Search online for "; $content['LN_HIGHLIGHT'] = "Hightlight >>"; $content['LN_HIGHLIGHT_OFF'] = "Hightlight <<"; diff --git a/src/lang/en/main.php b/src/lang/en/main.php index 8d7b77e..7f03319 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -63,6 +63,7 @@ $content['LN_SEARCH_PERFORMADVANCED'] = "Perform Advanced Search"; $content['LN_VIEW_MESSAGECENTERED'] = "Back to unfiltered view with this message at top"; $content['LN_VIEW_RELATEDMSG'] = "View related syslog messages"; $content['LN_VIEW_FILTERFOR'] = "Filter message for "; +$content['LN_VIEW_SEARCHFOR'] = "Search online for "; $content['LN_HIGHLIGHT'] = "Hightlight >>"; $content['LN_HIGHLIGHT_OFF'] = "Hightlight <<"; @@ -110,7 +111,7 @@ $content['LN_FIELDS_MESSAGETYPE'] = "Messagetype"; $content['LN_FIELDS_UID'] = "uID"; $content['LN_FIELDS_MESSAGE'] = "Message"; $content['LN_FIELDS_EVENTID'] = "Event ID"; -$content['LN_FIELDS_EVENTLOGTYPE'] = "Eventlogtype"; +$content['LN_FIELDS_EVENTLOGTYPE'] = "Eventlog Type"; $content['LN_FIELDS_EVENTSOURCE'] = "Event Source"; $content['LN_FIELDS_EVENTCATEGORY'] = "Event Category"; $content['LN_FIELDS_EVENTUSER'] = "Event User"; diff --git a/src/templates/index.html b/src/templates/index.html index 0327393..573f244 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -15,7 +15,8 @@
+ + + +
 {LN_SEARCH_FILTER} @@ -15,7 +18,7 @@
  • {LN_GEN_PREDEFINEDSEARCHES}

  • - {DisplayName} + {DisplayName}
  • @@ -28,7 +31,7 @@
    - +
    @@ -232,7 +235,7 @@
  • - {DisplayName} + {DisplayName}
  • @@ -258,7 +261,7 @@ - + {fieldvalue} @@ -266,7 +269,7 @@ - {fieldvalue} + {fieldvalue} diff --git a/src/templates/search.html b/src/templates/search.html index 3b9df58..3a83aca 100644 --- a/src/templates/search.html +++ b/src/templates/search.html @@ -11,6 +11,9 @@
    + + +
    {popupcaption}
    +
    From 5732adef0f5ad59003da9312a707d4ca3676b87c Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 2 May 2008 17:33:21 +0200 Subject: [PATCH 19/79] Appended changes into changelog, and made a few bugfixes to the new features --- ChangeLog | 16 ++++++++++++++-- src/include/functions_common.php | 6 +++--- src/include/functions_frontendhelpers.php | 7 ++++++- src/index.php | 19 +++++++++++++------ src/templates/index.html | 2 ++ 5 files changed, 38 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c5213a..4d627f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,21 @@ --------------------------------------------------------------------------- +Version 2.3.1 (devel), 2008-05-02 +- The page title is now created with Source, and other useful informations. + It is also possible to configure a custom title string with the + configuration, which will be prepended into each phpLogcon page. +- Added support for gzip compression (configurable), this will reduce + bandwidth and page load time. +- Added Auto reload function into main list view, can be enabled by default + in the configuration as well. Done using a META REFRESH. +- Added new configuration variable to set the default SourceID. The source + parameter will be appened to all necessary links and forms within + phplogcon, if the session sources differs from the default one. +--------------------------------------------------------------------------- Version 2.3.0 (devel), 2008-04-30 - Added "Back to Listview" button in the detailview. - Added filter for message type -- Added inline button menus into the listview. Most values can be clicked now, - which opens a menu with additional useful links. +- Added inline button menus into the listview. Most values can be clicked + now, which opens a menu with additional useful links. - Added Pagesite Selection into listview, so you can change the amount of records you want to see on one page at any time you want. - greatly improved database performance, runs much better now, but there diff --git a/src/include/functions_common.php b/src/include/functions_common.php index dcacce6..a13679b 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -618,12 +618,12 @@ function InitPageTitle() else $szReturn = ""; + if ( isset($currentSourceID) && isset($content['Sources'][$currentSourceID]['Name']) ) + $szReturn .= "Source '" . $content['Sources'][$currentSourceID]['Name'] . "' :: "; + // Append phpLogCon $szReturn .= "phpLogCon"; - if ( isset($currentSourceID) && isset($content['Sources'][$currentSourceID]['Name']) ) - $szReturn .= " :: Source '" . $content['Sources'][$currentSourceID]['Name'] . "'"; - // return result return $szReturn; } diff --git a/src/include/functions_frontendhelpers.php b/src/include/functions_frontendhelpers.php index 9520aab..749a892 100644 --- a/src/include/functions_frontendhelpers.php +++ b/src/include/functions_frontendhelpers.php @@ -86,7 +86,7 @@ function CreateCurrentUrl() // If the DefaultSourceID differes from the SourceID in our Session, we will append the sourceid within all URL's! if ( $CFG['DefaultSourceID'] != $_SESSION['currentSourceID'] ) { - $content['additional_url'] .= "&sourceid=" . $_SESSION['currentSourceID']; +// $content['additional_url'] .= "&sourceid=" . $_SESSION['currentSourceID']; $content['additional_url_uidonly'] = "&sourceid=" . $_SESSION['currentSourceID']; $content['additional_url_sortingonly'] = "&sourceid=" . $_SESSION['currentSourceID']; $content['additional_url_sourceonly'] = "&sourceid=" . $_SESSION['currentSourceID']; @@ -132,6 +132,11 @@ function CreateCurrentUrl() if ( strlen($content['additional_url_sortingonly']) <= 0 ) $content['additional_url_sortingonly'] .= "&" . $tmpvars[0] . "=" . $tmpvars[1]; } + else if ( $tmpvars[0] == "sourceid" ) + { + // Skip this entry + continue; + } else $content['additional_url'] .= "&" . $tmpvars[0] . "=" . $tmpvars[1]; } diff --git a/src/index.php b/src/index.php index 3dcbbfe..7e8da2f 100644 --- a/src/index.php +++ b/src/index.php @@ -57,18 +57,25 @@ $content['EXTRA_STYLESHEET'] = ' 0 ) - $content['EXTRA_METATAGS'] = '' . "\r\n"; -// --- - - // --- CONTENT Vars if ( isset($_GET['uid']) ) $content['uid_current'] = intval($_GET['uid']); else $content['uid_current'] = UID_UNKNOWN; +// --- Set Autoreload as meta refresh +if ( $content['uid_current'] == UID_UNKNOWN ) +{ + $content['ViewEnableAutoReloadSeconds_visible'] = true; + if ( $content['ViewEnableAutoReloadSeconds'] > 0 ) + $content['EXTRA_METATAGS'] = '' . "\r\n"; +} +else + $content['ViewEnableAutoReloadSeconds_visible'] = false; + +// --- + + // Init Pager variables // $content['uid_previous'] = UID_UNKNOWN; $content['uid_next'] = UID_UNKNOWN; diff --git a/src/templates/index.html b/src/templates/index.html index 1e0aaea..8a664a3 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -100,6 +100,7 @@ {LN_AUTORELOAD}: @@ -118,6 +119,7 @@
    {LN_GEN_RECORDCOUNT}: + @@ -232,13 +233,11 @@
    • diff --git a/src/themes/dark/main.css b/src/themes/dark/main.css index e638701..13d5a78 100644 --- a/src/themes/dark/main.css +++ b/src/themes/dark/main.css @@ -1,392 +1,392 @@ -/* Generell Tag Classes */ -BODY -{ - FONT-FAMILY: ARIAL; - FONT-SIZE: 8pt; - BACKGROUND: #000000; - COLOR: #F3F3F1; - - scrollbar-face-color: #475059; - scrollbar-highlight-color: #b8c2cc; - scrollbar-shadow-color: #b8c2cc; - scrollbar-3dlight-color: #000000; - scrollbar-arrow-color: #f2f5ff; - scrollbar-track-color: #262d34; - scrollbar-darkshadow-color: #000000; -} - -TD { font-family: Arial, Helvetica, sans-serif; font-size: 8pt; color: #F3F3F1 } - -/* Default Link Classes */ -a:link,a:active,a:visited,a.postlink -{ - font-family: Verdana, Arial, Helvetica, sans-serif; - font-weight:bold; - background-color: transparent; - color:#FFD323; - text-decoration:none; -} -a:hover -{ - font-family: Verdana, Arial, Helvetica, sans-serif; - font-weight:bold; - color:#EF9A00; -} - -img -{ - border: 0px; -} - -/* Title Classes */ -.title -{ - font: bold 11px Verdana, Arial, Helvetica, sans-serif; - BACKGROUND-COLOR: #1C1014; - COLOR: #E5F377; - border: 1px solid; - border-color: #58363E #2C1B1F #2C1B1F #58363E; - height: 20px; - text-align:center; - vertical-align:middle; -} -A.title, A.title:active, A.title:visited -{ - font: bold 11px Verdana, Arial, Helvetica, sans-serif; - COLOR: #dd6900; - TEXT-DECORATION: none; -} -A.title:hover -{ - font: bold 11px Verdana, Arial, Helvetica, sans-serif; - COLOR: #FF0A0C; - TEXT-DECORATION: none; -} - -/* Default Font Classes */ -font -{ - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 8pt; -} - -/* Table / Border Classes */ -.table_with_border -{ - background-color:#141618; - border:1px solid; - border-color: #290604 #0E0706 #000000 #290604; -} - -.table_with_border_second -{ - background-color:#19232D; - border:1px solid; - border-color: #050A0F #050A0F #050A0F #050A0F; -} - -.with_border -{ - text-indent:3px; - background-color:#1C2021; - border:1px #050A0F solid; -} - -.with_border_alternate -{ - text-indent:3px; - background-color:#1C2021; - border:1px #07233F ridge; -} - -.mainheader -{ - border:1px solid; - background-color:#1C2021; - border-color: #006699 #07233F #000000 #006699; -} - -.mainfooter -{ - height: 20px; - background-color:#1C2021; - border-top: #050A0F 1px solid; - border-bottom: #050A0F 1px solid; -} - -.imageborder -{ - border:1px solid; - border-color: #050A0F #353A3F #353A3F #050A0F; -} - -/* Cells for listening */ -.line0 -{ - font-size: 8pt; - color: #B9B597; - background-color: #0E161F; -} -.line0:hover -{ - background-color:#3D4751; -} - -.line1 -{ - font-size: 8pt; - color: #B9B597; - background-color: #152331; -} -.line1:hover -{ - background-color:#3D4751; -} - -.line2 -{ - font-size: 8pt; - color: #B9B597; - background-color: #1D3043; -} -.line2:hover -{ - background-color:#3D4751; -} - -.tableBackground -{ - font-size: 8pt; - color: #B9B597; - background-color: #1D3043; -} - -.lineColouredWhite -{ - font-size: 8pt; - color: #FFFFFF; -} -.lineColouredBlack -{ - font-size: 8pt; - color: #000000; -} - -/* TOP Menu Classes */ -.topmenu1 -{ - height: 20px; - border:1px ridge; - border-color: #D79993 #290604 #290604 #D79993; - - font: 10px Verdana, Arial, Helvetica, sans-serif; - color: #FFFFFF; - background-color: #38110E; -} -.topmenu1:hover -{ - color: #FFFF99; - background-color: #492D2B; - text-decoration: none; -} -.topmenu1_link, A.topmenu1_link -{ - color: #FFDD22; -} -.topmenu1_link:hover, A.topmenu1_link:hover -{ - color: #FFFF99; - text-decoration: none; -} -.topmenuend -{ - height: 16px; - font: 10px Verdana, Arial, Helvetica, sans-serif; - color: #FFFFFF; - background-color: #290604; -} -.topmenu2 -{ - height: 16px; - border:1px ridge; - border-color: #D79993 #290604 #290604 #D79993; - - font: 10px Verdana, Arial, Helvetica, sans-serif; - color: #FFFFFF; - background-color: #38110E; -} -.topmenu2:hover -{ - color: #FFFF99; - background-color: #492D2B; - text-decoration: none; -} -.topmenu2_link, A.topmenu2_link -{ - color: #FFDD22; -} -.topmenu2_link:hover, A.topmenu2_link:hover -{ - color: #FFFF99; - text-decoration: none; -} -.topmenu2end -{ - height: 16px; - border:1px inset; - border-color: #D79993 #290604 #D79993 #D79993; - font: 10px Verdana, Arial, Helvetica, sans-serif; - color: #FFFFFF; - background-color: #290604; -} - -/* Cell Columns */ -.cellmenu1 -{ -/* height: 15px; */ - border:1px solid; - border-color: #353A3F #050A0F #050A0F #353A3F; - - text-indent:5px; - font: bold 10px Verdana, Arial, Helvetica, sans-serif; - color: #FFFCE5; - background-color: #103B65; -} -.cellmenu1:hover -{ - color: #FFFF33; - text-decoration: none; -} -A.cellmenu1_link -{ - color: #FFFF33; - text-decoration: underline; -} -A.cellmenu1_link:hover -{ - color: #FF5500; - text-decoration: none; -} - -.cellmenu2 -{ - height: 16px; - border:1px ridge; - border-color: #7777AA #12161A #12161A #7777AA; - - text-indent:5px; - font: 10px Verdana, Arial, Helvetica, sans-serif; - color: #FFFCE5; - background-color: #053841; -} -.cellmenu2:hover -{ - color: #FFFF33; - text-decoration: none; -} - -/* Usefull Text Classes */ -.ErrorMsg -{ - font: bold 12px Verdana, Arial, Helvetica, sans-serif; - COLOR: #FF2222; - border-top: 1px solid; - border-bottom: 1px solid; - border-color: #58363E; -} -.PriorityEmergency -{ - color: #FFFFFF; - background-color: #ff4444; - border-top: black 1px solid; - border-bottom: black 1px solid; - border-right: gray 1px solid; -} -.PriorityAlert -{ - color: #FFFFFF; - background-color: #dd00dd; - border-top: black 1px solid; - border-bottom: black 1px solid; - border-right: gray 1px solid; -} -.PriorityCrit -{ - color: #FFFFFF; - background-color: #dd9900; - border-top: black 1px solid; - border-bottom: black 1px solid; - border-right: gray 1px solid; -} -.PriorityError -{ - color: #FFFFFF; - background-color: #CC0000; - border-top: black 1px solid; - border-bottom: black 1px solid; - border-right: gray 1px solid; -} -.PriorityWarning -{ - color: #FFFFFF; - background-color: #FFAA00; - border-top: black 1px solid; - border-bottom: black 1px solid; - border-right: gray 1px solid; -} -.PriorityNotice -{ - color: #FFFFFF; - background-color: #66CC33; - border-top: black 1px solid; - border-bottom: black 1px solid; - border-right: gray 1px solid; -} -.PriorityInfo -{ - color: #000000; - background-color: #ABF1FF; - border-top: black 1px solid; - border-bottom: black 1px solid; - border-right: gray 1px solid; -} -.PriorityDebug -{ - color: #FFFFFF; - background-color: #3333ff; - border-top: black 1px solid; - border-bottom: black 1px solid; - border-right: gray 1px solid; -} - -/* Form elements */ -select, input, button, textarea -{ - background-color: #0B253C; - color:#FFFFFF; - font:bold 10px Verdana,Arial,Helvetica,sans-serif; - border: 1px solid; - border-color: #233B51 #124A7C #124A7C #233B51; -} - -.SearchFormControl -{ - height: 20px; - margin: 2px; - background-color: #0B253C; - color:#FFFFFF; - font:bold 10px Verdana,Arial,Helvetica,sans-serif; - border: 1px solid; - border-color: #233B51 #124A7C #124A7C #233B51; -} - -.SearchFormTextbox -{ - height: 20px; - margin: 2px; - background-color: #0B253C; - color:#FFFFFF; - font:10px Verdana,Arial,Helvetica,sans-serif; - border: 1px solid; - border-color: #233B51 #124A7C #124A7C #233B51; +/* Generell Tag Classes */ +BODY +{ + FONT-FAMILY: ARIAL; + FONT-SIZE: 8pt; + BACKGROUND: #000000; + COLOR: #F3F3F1; + + scrollbar-face-color: #475059; + scrollbar-highlight-color: #b8c2cc; + scrollbar-shadow-color: #b8c2cc; + scrollbar-3dlight-color: #000000; + scrollbar-arrow-color: #f2f5ff; + scrollbar-track-color: #262d34; + scrollbar-darkshadow-color: #000000; +} + +TD { font-family: Arial, Helvetica, sans-serif; font-size: 8pt; color: #F3F3F1 } + +/* Default Link Classes */ +a:link,a:active,a:visited,a.postlink +{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight:bold; + background-color: transparent; + color:#FFD323; + text-decoration:none; +} +a:hover +{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight:bold; + color:#EF9A00; +} + +img +{ + border: 0px; +} + +/* Title Classes */ +.title +{ + font: bold 11px Verdana, Arial, Helvetica, sans-serif; + BACKGROUND-COLOR: #1C1014; + COLOR: #E5F377; + border: 1px solid; + border-color: #58363E #2C1B1F #2C1B1F #58363E; + height: 20px; + text-align:center; + vertical-align:middle; +} +A.title, A.title:active, A.title:visited +{ + font: bold 11px Verdana, Arial, Helvetica, sans-serif; + COLOR: #dd6900; + TEXT-DECORATION: none; +} +A.title:hover +{ + font: bold 11px Verdana, Arial, Helvetica, sans-serif; + COLOR: #FF0A0C; + TEXT-DECORATION: none; +} + +/* Default Font Classes */ +font +{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 8pt; +} + +/* Table / Border Classes */ +.table_with_border +{ + background-color:#141618; + border:1px solid; + border-color: #290604 #0E0706 #000000 #290604; +} + +.table_with_border_second +{ + background-color:#19232D; + border:1px solid; + border-color: #050A0F #050A0F #050A0F #050A0F; +} + +.with_border +{ + text-indent:3px; + background-color:#1C2021; + border:1px #050A0F solid; +} + +.with_border_alternate +{ + text-indent:3px; + background-color:#1C2021; + border:1px #07233F ridge; +} + +.mainheader +{ + border:1px solid; + background-color:#1C2021; + border-color: #006699 #07233F #000000 #006699; +} + +.mainfooter +{ + height: 20px; + background-color:#1C2021; + border-top: #050A0F 1px solid; + border-bottom: #050A0F 1px solid; +} + +.imageborder +{ + border:1px solid; + border-color: #050A0F #353A3F #353A3F #050A0F; +} + +/* Cells for listening */ +.line0 +{ + font-size: 8pt; + color: #B9B597; + background-color: #0E161F; +} +.line0:hover +{ + background-color:#3D4751; +} + +.line1 +{ + font-size: 8pt; + color: #B9B597; + background-color: #152331; +} +.line1:hover +{ + background-color:#3D4751; +} + +.line2 +{ + font-size: 8pt; + color: #B9B597; + background-color: #1D3043; +} +.line2:hover +{ + background-color:#3D4751; +} + +.tableBackground +{ + font-size: 8pt; + color: #B9B597; + background-color: #1D3043; +} + +.lineColouredWhite +{ + font-size: 8pt; + color: #FFFFFF; +} +.lineColouredBlack +{ + font-size: 8pt; + color: #000000; +} + +/* TOP Menu Classes */ +.topmenu1 +{ + height: 20px; + border:1px ridge; + border-color: #D79993 #290604 #290604 #D79993; + + font: 10px Verdana, Arial, Helvetica, sans-serif; + color: #FFFFFF; + background-color: #38110E; +} +.topmenu1:hover +{ + color: #FFFF99; + background-color: #492D2B; + text-decoration: none; +} +.topmenu1_link, A.topmenu1_link +{ + color: #FFDD22; +} +.topmenu1_link:hover, A.topmenu1_link:hover +{ + color: #FFFF99; + text-decoration: none; +} +.topmenuend +{ + height: 16px; + font: 10px Verdana, Arial, Helvetica, sans-serif; + color: #FFFFFF; + background-color: #290604; +} +.topmenu2 +{ + height: 16px; + border:1px ridge; + border-color: #D79993 #290604 #290604 #D79993; + + font: 10px Verdana, Arial, Helvetica, sans-serif; + color: #FFFFFF; + background-color: #38110E; +} +.topmenu2:hover +{ + color: #FFFF99; + background-color: #492D2B; + text-decoration: none; +} +.topmenu2_link, A.topmenu2_link +{ + color: #FFDD22; +} +.topmenu2_link:hover, A.topmenu2_link:hover +{ + color: #FFFF99; + text-decoration: none; +} +.topmenu2end +{ + height: 16px; + border:1px inset; + border-color: #D79993 #290604 #D79993 #D79993; + font: 10px Verdana, Arial, Helvetica, sans-serif; + color: #FFFFFF; + background-color: #290604; +} + +/* Cell Columns */ +.cellmenu1 +{ +/* height: 15px; */ + border:1px solid; + border-color: #353A3F #050A0F #050A0F #353A3F; + + text-indent:5px; + font: bold 10px Verdana, Arial, Helvetica, sans-serif; + color: #FFFCE5; + background-color: #103B65; +} +.cellmenu1:hover +{ + color: #FFFF33; + text-decoration: none; +} +A.cellmenu1_link +{ + color: #FFFF33; + text-decoration: underline; +} +A.cellmenu1_link:hover +{ + color: #FF5500; + text-decoration: none; +} + +.cellmenu2 +{ + height: 16px; + border:1px ridge; + border-color: #7777AA #12161A #12161A #7777AA; + + text-indent:5px; + font: 10px Verdana, Arial, Helvetica, sans-serif; + color: #FFFCE5; + background-color: #053841; +} +.cellmenu2:hover +{ + color: #FFFF33; + text-decoration: none; +} + +/* Usefull Text Classes */ +.ErrorMsg +{ + font: bold 12px Verdana, Arial, Helvetica, sans-serif; + COLOR: #FF2222; + border-top: 1px solid; + border-bottom: 1px solid; + border-color: #58363E; +} +.PriorityEmergency +{ + color: #FFFFFF; + background-color: #ff4444; + border-top: black 1px solid; + border-bottom: black 1px solid; + border-right: gray 1px solid; +} +.PriorityAlert +{ + color: #FFFFFF; + background-color: #dd00dd; + border-top: black 1px solid; + border-bottom: black 1px solid; + border-right: gray 1px solid; +} +.PriorityCrit +{ + color: #FFFFFF; + background-color: #dd9900; + border-top: black 1px solid; + border-bottom: black 1px solid; + border-right: gray 1px solid; +} +.PriorityError +{ + color: #FFFFFF; + background-color: #CC0000; + border-top: black 1px solid; + border-bottom: black 1px solid; + border-right: gray 1px solid; +} +.PriorityWarning +{ + color: #FFFFFF; + background-color: #FFAA00; + border-top: black 1px solid; + border-bottom: black 1px solid; + border-right: gray 1px solid; +} +.PriorityNotice +{ + color: #FFFFFF; + background-color: #66CC33; + border-top: black 1px solid; + border-bottom: black 1px solid; + border-right: gray 1px solid; +} +.PriorityInfo +{ + color: #000000; + background-color: #ABF1FF; + border-top: black 1px solid; + border-bottom: black 1px solid; + border-right: gray 1px solid; +} +.PriorityDebug +{ + color: #FFFFFF; + background-color: #3333ff; + border-top: black 1px solid; + border-bottom: black 1px solid; + border-right: gray 1px solid; +} + +/* Form elements */ +select, input, button, textarea +{ + background-color: #0B253C; + color:#FFFFFF; + font:bold 10px Verdana,Arial,Helvetica,sans-serif; + border: 1px solid; + border-color: #233B51 #124A7C #124A7C #233B51; +} + +.SearchFormControl +{ + height: 20px; + margin: 2px; + background-color: #0B253C; + color:#FFFFFF; + font:bold 10px Verdana,Arial,Helvetica,sans-serif; + border: 1px solid; + border-color: #233B51 #124A7C #124A7C #233B51; +} + +.SearchFormTextbox +{ + height: 20px; + margin: 2px; + background-color: #0B253C; + color:#FFFFFF; + font:10px Verdana,Arial,Helvetica,sans-serif; + border: 1px solid; + border-color: #233B51 #124A7C #124A7C #233B51; } diff --git a/src/themes/default/main.css b/src/themes/default/main.css index 0ee0403..37ac62e 100644 --- a/src/themes/default/main.css +++ b/src/themes/default/main.css @@ -123,7 +123,7 @@ font /* Cells for listening */ .line0 { - height: 16px; +/* height: 16px;*/ font-size: 8pt; color: #000000; background-color: #DDDDDD; @@ -135,7 +135,7 @@ font .line1 { - height: 16px; +/* height: 16px;*/ font-size: 8pt; color: #000000; background-color: #EEEEEE; @@ -147,7 +147,7 @@ font .line2 { - height: 16px; +/* height: 16px;*/ font-size: 8pt; color: #000000; background-color: #F5F5F5; @@ -163,34 +163,6 @@ font background-color: #F5F5F5; } -/* -.line_alt0 -{ - font-size: 8pt; - color: #000000; - background-color: #AAAAAA; - background-image: url("images/dither.png"); -} -.line_alt0:hover -{ - background-color:#F9F9F9; - background-image: url("images/dither.png"); -} - -.line_alt1 -{ - font-size: 8pt; - color: #000000; - background-color: #DDDDDD; - background-image: url("images/dither.png"); -} -.line_alt1:hover -{ - background-color:#F9F9F9; - background-image: url("images/dither.png"); -} -*/ - .lineColouredWhite, .lineColouredWhite:hover, A.lineColouredWhite { font-size: 8pt; @@ -302,7 +274,7 @@ A.cellmenu1_link:hover .cellmenu2 { - height: 15px; +/* height: 15px; */ border:1px inset; border-color: #79AABE #09506C #09506C #79AABE; From 56b252757e7acb8574070a66783632105f6caa8b Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Tue, 6 May 2008 18:14:38 +0200 Subject: [PATCH 24/79] Added new link to menu, added donate button (finally) --- src/templates/include_header.html | 15 ++++++++++++++- src/templates/include_menu.html | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/templates/include_header.html b/src/templates/include_header.html index 502048a..e764cf7 100644 --- a/src/templates/include_header.html +++ b/src/templates/include_header.html @@ -14,7 +14,18 @@ - + + + + - -
      - -
      -

      {LN_ERROR_NORECORDS} - Error Details:

      - {detailederror} -
      -
      -
      -
      - + + +
      + + Satisfied with phpLogCon?
      +
      + + + +
      Donate and help keep the project alive! +
      @@ -97,3 +108,5 @@



      {LN_ERROR_INSTALLFILEREMINDER}

      + + diff --git a/src/templates/include_menu.html b/src/templates/include_menu.html index cbecfe8..982d387 100644 --- a/src/templates/include_menu.html +++ b/src/templates/include_menu.html @@ -1,5 +1,6 @@
      + From 8c2947e22cbb2eae21b2784df8bcdefc18faffef Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 19 May 2008 11:12:11 +0200 Subject: [PATCH 25/79] Added correct Paypal Button --- src/templates/include_header.html | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/templates/include_header.html b/src/templates/include_header.html index e764cf7..6899990 100644 --- a/src/templates/include_header.html +++ b/src/templates/include_header.html @@ -16,12 +16,8 @@ From 3ed6e69ea8168e3f5b7fdbccdb6654cbedf18534 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 19 May 2008 13:10:38 +0200 Subject: [PATCH 26/79] Configured Columns which are not defined will be automatically hidden now --- src/index.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/index.php b/src/index.php index 21398b5..9c4ce60 100644 --- a/src/index.php +++ b/src/index.php @@ -201,16 +201,19 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // --- Init the fields we need foreach($content['Columns'] as $mycolkey) { - $content['fields'][$mycolkey]['FieldID'] = $mycolkey; - $content['fields'][$mycolkey]['FieldCaption'] = $content[ $fields[$mycolkey]['FieldCaptionID'] ]; - $content['fields'][$mycolkey]['FieldType'] = $fields[$mycolkey]['FieldType']; - $content['fields'][$mycolkey]['FieldSortable'] = $stream->IsPropertySortable($mycolkey); // $fields[$mycolkey]['Sortable']; - $content['fields'][$mycolkey]['DefaultWidth'] = $fields[$mycolkey]['DefaultWidth']; + if ( isset($fields[$mycolkey]) ) + { + $content['fields'][$mycolkey]['FieldID'] = $mycolkey; + $content['fields'][$mycolkey]['FieldCaption'] = $content[ $fields[$mycolkey]['FieldCaptionID'] ]; + $content['fields'][$mycolkey]['FieldType'] = $fields[$mycolkey]['FieldType']; + $content['fields'][$mycolkey]['FieldSortable'] = $stream->IsPropertySortable($mycolkey); // $fields[$mycolkey]['Sortable']; + $content['fields'][$mycolkey]['DefaultWidth'] = $fields[$mycolkey]['DefaultWidth']; - if ( $mycolkey == SYSLOG_MESSAGE ) - $content['fields'][$mycolkey]['colspan'] = ''; //' colspan="2" '; - else - $content['fields'][$mycolkey]['colspan'] = ''; + if ( $mycolkey == SYSLOG_MESSAGE ) + $content['fields'][$mycolkey]['colspan'] = ''; //' colspan="2" '; + else + $content['fields'][$mycolkey]['colspan'] = ''; + } } // --- @@ -291,7 +294,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // --- Now we populate the values array! foreach($content['Columns'] as $mycolkey) { - if ( isset($logArray[$mycolkey]) ) + if ( isset($fields[$mycolkey]) && isset($logArray[$mycolkey]) ) { // Set defaults $content['syslogmessages'][$counter]['values'][$mycolkey]['FieldColumn'] = $mycolkey; From f7d5d7fe4eee726457d76c7ed3e179e5e69bcd11 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 19 May 2008 13:22:46 +0200 Subject: [PATCH 27/79] Added pager to the bottom of the index page as well (bugtracker id 76) --- src/templates/index.html | 240 +++++++++++++++++++++++---------------- 1 file changed, 141 insertions(+), 99 deletions(-) diff --git a/src/templates/index.html b/src/templates/index.html index 0327393..e8834ab 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -86,11 +86,11 @@ -
      Knownledge Base Search Show Events Satisfied with phpLogCon?
      - - - - - Donate and help keep the project alive! +
      + Donate and help keep the project alive!
      - + +
      Recent syslog messagesRecent syslog messages
      @@ -188,127 +188,169 @@ -
      + + - + - -
      + + Debug
      - - - - + + + + - - - - + + + + + - - - - - + - - - - + - - + + -
      Debug + + + + {FieldCaption} + + + +
      - - - - {FieldCaption} - - - -
      {ZAEHLER}
      {ZAEHLER} - - - - - + + + + + - + + + + - + - + - - - {fieldvalue} - - - - - {fieldvalue} - - - - - - - {fieldvalue} + + + {fieldvalue} - + - - + + {fieldvalue} + - {fieldvalue} - - - - - - - - - -
      {popupcaption}
      {detailfieldtitle}{detailfieldvalue}
      -
      + + + +
      + {fieldvalue} - -
      - + {fieldvalue} + + + + + + + + + +
      {popupcaption}
      {detailfieldtitle}{detailfieldvalue}
      +
      +
      + +
      + + + + + + + + + + + + + + + + + + +
       Pager:   + + + + + + + + + + + + + + {mypagenumber}  + + + + + + + + + + + + +
      + + + + +
      + +
      +

      {LN_ERROR_NORECORDS} - Error Details:

      + {detailederror} +
      +
      +
      +
      + \ No newline at end of file From ffeeaa66939952867cffe5d0dca3f7c82e4d50c2 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Tue, 20 May 2008 10:44:41 +0200 Subject: [PATCH 28/79] Changed Search Online links --- src/include/functions_common.php | 6 +++--- src/index.php | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index a5d2b83..95ba5a1 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -96,9 +96,6 @@ function InitBasicPhpLogCon() // Check RunMode first! CheckAndSetRunMode(); - // Get and Set RunTime Informations - InitRuntimeInformations(); - // Set the default line sep SetLineBreakVar(); @@ -185,6 +182,9 @@ function InitPhpLogCon() // Will init the config file! InitPhpLogConConfigFile(); + // Moved here, because we do not need if GZIP needs to be enabled before the config is loaded! + InitRuntimeInformations(); + // Establish DB Connection if ( $CFG['UserDBEnabled'] ) DB_Connect(); diff --git a/src/index.php b/src/index.php index 8c006d6..0de0f4b 100644 --- a/src/index.php +++ b/src/index.php @@ -401,7 +401,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://global.phplogcon.org/?' . $logArray[$mycolkey] . '+' . str_replace(" ", "+", $content['LN_FIELDS_EVENTID']), + 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . str_replace(" ", "+", $content['LN_FIELDS_EVENTID']) . '+' . $logArray[$mycolkey], 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTID'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); @@ -513,11 +513,10 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://global.phplogcon.org/?' . $logArray[$mycolkey] . '+' . str_replace(" ", "+", $content['LN_FIELDS_EVENTLOGTYPE']), - 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . "'" . $logArray[$mycolkey] . "'", + 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . str_replace(" ", "+", $content['LN_FIELDS_EVENTLOGTYPE']) . '+' . $logArray[$mycolkey], + 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTLOGTYPE'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); - } else if ( $mycolkey == SYSLOG_EVENT_SOURCE ) { @@ -529,8 +528,8 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://global.phplogcon.org/?' . $logArray[$mycolkey] . '+' . str_replace(" ", "+", $content['LN_FIELDS_EVENTSOURCE']), - 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . "'" . $logArray[$mycolkey] . "'", + 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . str_replace(" ", "+", $content['LN_FIELDS_EVENTSOURCE']) . '+' . $logArray[$mycolkey], + 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTSOURCE'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); } From f794cb4d89807f74cf754ae4223f3ffed097b3eb Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Tue, 20 May 2008 11:36:58 +0200 Subject: [PATCH 29/79] Fixed minor visual issue with the context menus --- src/css/defaults.css | 5 +++++ src/templates/include_menu.html | 1 - src/templates/index.html | 9 ++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/css/defaults.css b/src/css/defaults.css index 523489f..28f3ec5 100644 --- a/src/css/defaults.css +++ b/src/css/defaults.css @@ -54,3 +54,8 @@ top:15px; left:15px; } + +.gridline +{ + height: 16px; +} diff --git a/src/templates/include_menu.html b/src/templates/include_menu.html index c681c77..cc7f009 100644 --- a/src/templates/include_menu.html +++ b/src/templates/include_menu.html @@ -1,6 +1,5 @@ - diff --git a/src/templates/index.html b/src/templates/index.html index 27a3cfc..38f9a02 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -215,7 +215,7 @@ - + @@ -228,12 +228,11 @@
      • From 28b37f372404a1c81636e84f44ab55a20ffa5e23 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Tue, 20 May 2008 11:43:48 +0200 Subject: [PATCH 30/79] Fixed style sheet issue in dark theme --- src/themes/dark/main.css | 4 ++-- src/themes/default/main.css | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/themes/dark/main.css b/src/themes/dark/main.css index 13d5a78..6e48e43 100644 --- a/src/themes/dark/main.css +++ b/src/themes/dark/main.css @@ -161,12 +161,12 @@ font background-color: #1D3043; } -.lineColouredWhite +.lineColouredWhite, .lineColouredWhite:hover, a.lineColouredWhite { font-size: 8pt; color: #FFFFFF; } -.lineColouredBlack +.lineColouredBlack, .lineColouredBlack:hover, a.lineColouredBlack { font-size: 8pt; color: #000000; diff --git a/src/themes/default/main.css b/src/themes/default/main.css index 37ac62e..745543e 100644 --- a/src/themes/default/main.css +++ b/src/themes/default/main.css @@ -163,12 +163,12 @@ font background-color: #F5F5F5; } -.lineColouredWhite, .lineColouredWhite:hover, A.lineColouredWhite +.lineColouredWhite, .lineColouredWhite:hover, a.lineColouredWhite { font-size: 8pt; color: #FFFFFF; } -.lineColouredBlack, .lineColouredBlack:hover, A.lineColouredBlack +.lineColouredBlack, .lineColouredBlack:hover, a.lineColouredBlack { font-size: 8pt; color: #000000; From 3624d3e651c4259ea7834ae73fa6c4fa74cd29ff Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Tue, 20 May 2008 11:58:32 +0200 Subject: [PATCH 31/79] Added online search links for syslog specific fields as well --- src/index.php | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/index.php b/src/index.php index 0de0f4b..7d4520c 100644 --- a/src/index.php +++ b/src/index.php @@ -113,6 +113,10 @@ function HighLightString($highlightArray, $strmsg) return $strmsg; } +function PrepareStringForSearch($myString) +{ + return str_replace(" ", "+", $myString); +} // --- // --- Read and process filters from search dialog! @@ -341,6 +345,11 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . GetFacilityDisplayName( $logArray[$mycolkey] ). "'", 'IconSource' => $content['MENU_BULLET_BLUE'] ); + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . PrepareStringForSearch($content['LN_FIELDS_FACILITY']) . '+' . GetFacilityDisplayName($logArray[$mycolkey]), + 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_FACILITY'] . " '" . GetFacilityDisplayName($logArray[$mycolkey]) . "'", + 'IconSource' => $content['MENU_NETWORK'] + ); } else if ( $mycolkey == SYSLOG_SEVERITY ) { @@ -358,13 +367,19 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldbgcolor'] = 'bgcolor="' . $severity_colors[SYSLOG_INFO] . '" '; } - // Set OnClick Menu for SYSLOG_FACILITY + // Set OnClick Menu for SYSLOG_SEVERITY $content['syslogmessages'][$counter]['values'][$mycolkey]['hasbuttons'] = true; $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( 'ButtonUrl' => '?filter=severity%3A' . $logArray[$mycolkey] . '&search=Search' . $content['additional_url_sourceonly'], 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . GetSeverityDisplayName( $logArray[$mycolkey] ). "'", 'IconSource' => $content['MENU_BULLET_BLUE'] ); + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . PrepareStringForSearch($content['LN_FIELDS_SEVERITY']) . '+' . GetSeverityDisplayName($logArray[$mycolkey]), + 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_SEVERITY'] . " '" . GetSeverityDisplayName($logArray[$mycolkey]) . "'", + 'IconSource' => $content['MENU_NETWORK'] + ); + } else if ( $mycolkey == SYSLOG_MESSAGETYPE ) { @@ -401,12 +416,11 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . str_replace(" ", "+", $content['LN_FIELDS_EVENTID']) . '+' . $logArray[$mycolkey], + 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . PrepareStringForSearch($content['LN_FIELDS_EVENTID']) . '+' . $logArray[$mycolkey], 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTID'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); } - } else if ( $content['fields'][$mycolkey]['FieldType'] == FILTER_TYPE_STRING ) { @@ -491,6 +505,11 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_BULLET_BLUE'] ); + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . PrepareStringForSearch($content['LN_FIELDS_SYSLOGTAG']) . '+' . $logArray[$mycolkey], + 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_SYSLOGTAG'] . " '" . $logArray[$mycolkey] . "'", + 'IconSource' => $content['MENU_NETWORK'] + ); } else if ( $mycolkey == SYSLOG_HOST ) { @@ -513,7 +532,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . str_replace(" ", "+", $content['LN_FIELDS_EVENTLOGTYPE']) . '+' . $logArray[$mycolkey], + 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . PrepareStringForSearch($content['LN_FIELDS_EVENTLOGTYPE']) . '+' . $logArray[$mycolkey], 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTLOGTYPE'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); @@ -528,7 +547,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . str_replace(" ", "+", $content['LN_FIELDS_EVENTSOURCE']) . '+' . $logArray[$mycolkey], + 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . PrepareStringForSearch($content['LN_FIELDS_EVENTSOURCE']) . '+' . $logArray[$mycolkey], 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTSOURCE'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); From 7d4010b45d4aafce3d17dcd1405273f91746827a Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Tue, 20 May 2008 15:04:55 +0200 Subject: [PATCH 32/79] Implemented custom google search button into sub-menus --- src/include/functions_common.php | 2 ++ src/index.php | 31 ++++++++++++++++++++++++++++++- src/lang/de/main.php | 1 + src/lang/en/main.php | 1 + 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 95ba5a1..7d863e3 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -434,6 +434,8 @@ function InitFrontEndVariables() $content['MENU_BULLET_RED'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_red.png"; $content['MENU_BULLET_YELLOW'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_yellow.png"; $content['MENU_BULLET_GREY'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_grey.png"; + + $content['MENU_ICON_GOOGLE'] = $content['BASEPATH'] . "images/icons/googleicon.png"; } // Lang Helper for Strings with ONE variable diff --git a/src/index.php b/src/index.php index 7d4520c..6b6ef3d 100644 --- a/src/index.php +++ b/src/index.php @@ -350,6 +350,11 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_FACILITY'] . " '" . GetFacilityDisplayName($logArray[$mycolkey]) . "'", 'IconSource' => $content['MENU_NETWORK'] ); + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => 'http://kb.monitorware.com/googlesearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_FACILITY']) . '+' . GetFacilityDisplayName($logArray[$mycolkey]), + 'DisplayName' => $content['LN_VIEW_SEARCHFORGOOGLE'] . " " . $content['LN_FIELDS_FACILITY'] . " '" . GetFacilityDisplayName($logArray[$mycolkey]) . "'", + 'IconSource' => $content['MENU_ICON_GOOGLE'] + ); } else if ( $mycolkey == SYSLOG_SEVERITY ) { @@ -379,7 +384,11 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_SEVERITY'] . " '" . GetSeverityDisplayName($logArray[$mycolkey]) . "'", 'IconSource' => $content['MENU_NETWORK'] ); - + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => 'http://kb.monitorware.com/googlesearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_SEVERITY']) . '+' . GetSeverityDisplayName($logArray[$mycolkey]), + 'DisplayName' => $content['LN_VIEW_SEARCHFORGOOGLE'] . " " . $content['LN_FIELDS_SEVERITY'] . " '" . GetSeverityDisplayName($logArray[$mycolkey]) . "'", + 'IconSource' => $content['MENU_ICON_GOOGLE'] + ); } else if ( $mycolkey == SYSLOG_MESSAGETYPE ) { @@ -420,6 +429,11 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTID'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => 'http://kb.monitorware.com/googlesearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_EVENTID']) . '+' . $logArray[$mycolkey], + 'DisplayName' => $content['LN_VIEW_SEARCHFORGOOGLE'] . " " . $content['LN_FIELDS_EVENTID'] . " '" . $logArray[$mycolkey] . "'", + 'IconSource' => $content['MENU_ICON_GOOGLE'] + ); } } else if ( $content['fields'][$mycolkey]['FieldType'] == FILTER_TYPE_STRING ) @@ -510,6 +524,11 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_SYSLOGTAG'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => 'http://kb.monitorware.com/googlesearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_SYSLOGTAG']) . '+' . $logArray[$mycolkey], + 'DisplayName' => $content['LN_VIEW_SEARCHFORGOOGLE'] . " " . $content['LN_FIELDS_SYSLOGTAG'] . " '" . $logArray[$mycolkey] . "'", + 'IconSource' => $content['MENU_ICON_GOOGLE'] + ); } else if ( $mycolkey == SYSLOG_HOST ) { @@ -536,6 +555,11 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTLOGTYPE'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => 'http://kb.monitorware.com/googlesearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_EVENTLOGTYPE']) . '+' . $logArray[$mycolkey], + 'DisplayName' => $content['LN_VIEW_SEARCHFORGOOGLE'] . " " . $content['LN_FIELDS_EVENTLOGTYPE'] . " '" . $logArray[$mycolkey] . "'", + 'IconSource' => $content['MENU_ICON_GOOGLE'] + ); } else if ( $mycolkey == SYSLOG_EVENT_SOURCE ) { @@ -551,6 +575,11 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTSOURCE'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); + $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( + 'ButtonUrl' => 'http://kb.monitorware.com/googlesearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_EVENTSOURCE']) . '+' . $logArray[$mycolkey], + 'DisplayName' => $content['LN_VIEW_SEARCHFORGOOGLE'] . " " . $content['LN_FIELDS_EVENTSOURCE'] . " '" . $logArray[$mycolkey] . "'", + 'IconSource' => $content['MENU_ICON_GOOGLE'] + ); } } } diff --git a/src/lang/de/main.php b/src/lang/de/main.php index 7c57676..6ac4cbc 100644 --- a/src/lang/de/main.php +++ b/src/lang/de/main.php @@ -63,6 +63,7 @@ $content['LN_SEARCH_PERFORMADVANCED'] = "Erweiterte Suche starten"; $content['LN_VIEW_RELATEDMSG'] = "View related syslog messages"; $content['LN_VIEW_FILTERFOR'] = "Filter message for "; $content['LN_VIEW_SEARCHFOR'] = "Search online for "; + $content['LN_VIEW_SEARCHFORGOOGLE'] = "Search Google for "; $content['LN_HIGHLIGHT'] = "Hightlight >>"; $content['LN_HIGHLIGHT_OFF'] = "Hightlight <<"; diff --git a/src/lang/en/main.php b/src/lang/en/main.php index 7f03319..52ba085 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -64,6 +64,7 @@ $content['LN_VIEW_MESSAGECENTERED'] = "Back to unfiltered view with this message $content['LN_VIEW_RELATEDMSG'] = "View related syslog messages"; $content['LN_VIEW_FILTERFOR'] = "Filter message for "; $content['LN_VIEW_SEARCHFOR'] = "Search online for "; + $content['LN_VIEW_SEARCHFORGOOGLE'] = "Search Google for "; $content['LN_HIGHLIGHT'] = "Hightlight >>"; $content['LN_HIGHLIGHT_OFF'] = "Hightlight <<"; From 0dd62df2c00e944ef49cc5a87f3875aa87800537 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Tue, 20 May 2008 16:23:08 +0200 Subject: [PATCH 33/79] Merged Search buttons into one --- src/index.php | 40 +++++--------------------------------- src/templates/details.html | 12 ++++++------ 2 files changed, 11 insertions(+), 41 deletions(-) diff --git a/src/index.php b/src/index.php index 6b6ef3d..a9952b4 100644 --- a/src/index.php +++ b/src/index.php @@ -346,15 +346,10 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . PrepareStringForSearch($content['LN_FIELDS_FACILITY']) . '+' . GetFacilityDisplayName($logArray[$mycolkey]), + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_FACILITY']) . '+' . GetFacilityDisplayName($logArray[$mycolkey]), 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_FACILITY'] . " '" . GetFacilityDisplayName($logArray[$mycolkey]) . "'", 'IconSource' => $content['MENU_NETWORK'] ); - $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/googlesearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_FACILITY']) . '+' . GetFacilityDisplayName($logArray[$mycolkey]), - 'DisplayName' => $content['LN_VIEW_SEARCHFORGOOGLE'] . " " . $content['LN_FIELDS_FACILITY'] . " '" . GetFacilityDisplayName($logArray[$mycolkey]) . "'", - 'IconSource' => $content['MENU_ICON_GOOGLE'] - ); } else if ( $mycolkey == SYSLOG_SEVERITY ) { @@ -380,15 +375,10 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . PrepareStringForSearch($content['LN_FIELDS_SEVERITY']) . '+' . GetSeverityDisplayName($logArray[$mycolkey]), + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_SEVERITY']) . '+' . GetSeverityDisplayName($logArray[$mycolkey]), 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_SEVERITY'] . " '" . GetSeverityDisplayName($logArray[$mycolkey]) . "'", 'IconSource' => $content['MENU_NETWORK'] ); - $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/googlesearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_SEVERITY']) . '+' . GetSeverityDisplayName($logArray[$mycolkey]), - 'DisplayName' => $content['LN_VIEW_SEARCHFORGOOGLE'] . " " . $content['LN_FIELDS_SEVERITY'] . " '" . GetSeverityDisplayName($logArray[$mycolkey]) . "'", - 'IconSource' => $content['MENU_ICON_GOOGLE'] - ); } else if ( $mycolkey == SYSLOG_MESSAGETYPE ) { @@ -429,11 +419,6 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTID'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); - $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/googlesearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_EVENTID']) . '+' . $logArray[$mycolkey], - 'DisplayName' => $content['LN_VIEW_SEARCHFORGOOGLE'] . " " . $content['LN_FIELDS_EVENTID'] . " '" . $logArray[$mycolkey] . "'", - 'IconSource' => $content['MENU_ICON_GOOGLE'] - ); } } else if ( $content['fields'][$mycolkey]['FieldType'] == FILTER_TYPE_STRING ) @@ -520,15 +505,10 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . PrepareStringForSearch($content['LN_FIELDS_SYSLOGTAG']) . '+' . $logArray[$mycolkey], + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_SYSLOGTAG']) . '+' . $logArray[$mycolkey], 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_SYSLOGTAG'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); - $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/googlesearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_SYSLOGTAG']) . '+' . $logArray[$mycolkey], - 'DisplayName' => $content['LN_VIEW_SEARCHFORGOOGLE'] . " " . $content['LN_FIELDS_SYSLOGTAG'] . " '" . $logArray[$mycolkey] . "'", - 'IconSource' => $content['MENU_ICON_GOOGLE'] - ); } else if ( $mycolkey == SYSLOG_HOST ) { @@ -551,15 +531,10 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . PrepareStringForSearch($content['LN_FIELDS_EVENTLOGTYPE']) . '+' . $logArray[$mycolkey], + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_EVENTLOGTYPE']) . '+' . $logArray[$mycolkey], 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTLOGTYPE'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); - $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/googlesearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_EVENTLOGTYPE']) . '+' . $logArray[$mycolkey], - 'DisplayName' => $content['LN_VIEW_SEARCHFORGOOGLE'] . " " . $content['LN_FIELDS_EVENTLOGTYPE'] . " '" . $logArray[$mycolkey] . "'", - 'IconSource' => $content['MENU_ICON_GOOGLE'] - ); } else if ( $mycolkey == SYSLOG_EVENT_SOURCE ) { @@ -571,15 +546,10 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . PrepareStringForSearch($content['LN_FIELDS_EVENTSOURCE']) . '+' . $logArray[$mycolkey], + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_EVENTSOURCE']) . '+' . $logArray[$mycolkey], 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTSOURCE'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); - $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/googlesearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_EVENTSOURCE']) . '+' . $logArray[$mycolkey], - 'DisplayName' => $content['LN_VIEW_SEARCHFORGOOGLE'] . " " . $content['LN_FIELDS_EVENTSOURCE'] . " '" . $logArray[$mycolkey] . "'", - 'IconSource' => $content['MENU_ICON_GOOGLE'] - ); } } } diff --git a/src/templates/details.html b/src/templates/details.html index 525f4d5..04bbf0b 100644 --- a/src/templates/details.html +++ b/src/templates/details.html @@ -7,8 +7,8 @@
      Knownledge Base Search Show Events
      {ZAEHLER}{ZAEHLER}
      - + + + +
      - {LN_DETAIL_BACKTOLIST} + + {LN_DETAIL_BACKTOLIST} {LN_DETAIL_BACKTOLIST} {LN_GEN_PAGE} {main_currentpagenumber} @@ -22,7 +22,7 @@ Pager:   - + {LN_GEN_FIRSTPAGE} @@ -31,7 +31,7 @@ - + {LN_GEN_PREVIOUSPAGE} @@ -44,7 +44,7 @@ - + {LN_GEN_NEXTPAGE} @@ -53,7 +53,7 @@ - + {LN_GEN_LASTPAGE} From 4619f95ab789d0876af0f965f52e9da6e58cafb4 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Tue, 20 May 2008 16:43:04 +0200 Subject: [PATCH 34/79] Added changelog entry --- ChangeLog | 11 +++++++++++ src/include/functions_common.php | 2 +- src/index.php | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 462c416..6aae488 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,15 @@ --------------------------------------------------------------------------- +Version 2.3.2 (devel), 2008-05-20 +- Implemented Online Search button into the field submenus. The search + uses our new repository at kb.monitorware.com. +- Added pager to the bottom of the index page as well (bugtracker id 76) +- Added filtering support for the new Eventlog fields +- Adding field mapping definitions for Windows Eventlog which are: + SYSLOG_EVENT_LOGTYPE, SYSLOG_EVENT_SOURCE, SYSLOG_EVENT_CATEGORY, + SYSLOG_EVENT_ID and SYSLOG_EVENT_USER +- Simplified columns configuration definition in config.sample.php +- Fixed minor css issues. +--------------------------------------------------------------------------- Version 2.1.6 (beta), 2008-05-19 - Fixed filter bug, if you want to filter with ":", you can do this by using "\:" now. diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 7d863e3..3e5ee92 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -73,7 +73,7 @@ $LANG_EN = "en"; // Used for fallback $LANG = "en"; // Default language // Default Template vars -$content['BUILDNUMBER'] = "2.3.1"; +$content['BUILDNUMBER'] = "2.3.2"; $content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title $content['BASEPATH'] = $gl_root_path; $content['EXTRA_METATAGS'] = ""; diff --git a/src/index.php b/src/index.php index a9952b4..db450e9 100644 --- a/src/index.php +++ b/src/index.php @@ -415,7 +415,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/search.php?keywords=' . PrepareStringForSearch($content['LN_FIELDS_EVENTID']) . '+' . $logArray[$mycolkey], + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_EVENTID']) . '+' . $logArray[$mycolkey], 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTID'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); From cb1dcacc9b4788c237e63f32b2ded721753318cc Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 21 May 2008 17:53:59 +0200 Subject: [PATCH 35/79] Initial Added the new DB Driver (Logstream) which uses PHP PDO. PDO is the latest generic database intergave for PHP5 are recommended for best performance. It is now possible to use other database engines with this new logstream class like mssql, postgres sql, odbc, oracle, or even ibm db2. Also changed the logic how the Last Pager Button works, the performance is much better now. --- src/classes/logstreamconfigpdo.class.php | 135 ++++ src/classes/logstreamdb.class.php | 34 +- src/classes/logstreamdisk.class.php | 4 +- src/classes/logstreampdo.class.php | 803 +++++++++++++++++++++++ src/include/constants_errors.php | 2 + src/include/constants_general.php | 1 + src/include/constants_logstream.php | 5 + src/include/functions_config.php | 18 + src/index.php | 32 +- src/templates/index.html | 4 +- 10 files changed, 1010 insertions(+), 28 deletions(-) create mode 100644 src/classes/logstreamconfigpdo.class.php create mode 100644 src/classes/logstreampdo.class.php diff --git a/src/classes/logstreamconfigpdo.class.php b/src/classes/logstreamconfigpdo.class.php new file mode 100644 index 0000000..13d7125 --- /dev/null +++ b/src/classes/logstreamconfigpdo.class.php @@ -0,0 +1,135 @@ + www.phplogcon.org <- * + * ----------------------------------------------------------------- * + * StreamConfig has the capability to create a specific LogStream * + * object depending on a configured LogStream*Config object. * + * * + * All directives are explained within this file * + * + * Copyright (C) 2008 Adiscon GmbH. + * + * This file is part of phpLogCon. + * + * PhpLogCon is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PhpLogCon is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with phpLogCon. If not, see . + * + * A copy of the GPL can be found in the file "COPYING" in this + * distribution. + ********************************************************************* +*/ + +// --- Avoid directly accessing this file! +if ( !defined('IN_PHPLOGCON') ) +{ + die('Hacking attempt'); + exit; +} +// --- + +class LogStreamConfigPDO extends LogStreamConfig { + public $DBServer = 'localhost'; + public $DBPort = 0; + public $DBName = ''; + public $DBUser = ''; + public $DBPassword = ''; + public $DBType = DB_MYSQL; // Default = MYSQL! + public $DBTableType = 'winsyslog'; // Default = WINSYSLOG DB Layout! + public $DBTableName = 'systemevents'; // Default Tabelname from WINSYSLOG + public $DBEnableRowCounting = true; // Default RowCounting is enabled! + + // Runtime configuration variables + public $RecordsPerQuery = 100; // This will determine how to limit sql statements + public $IDsPerQuery = 5000; // When we query ID's, we read a lot more the datarecords at once! + public $SortColumn = SYSLOG_UID; // Default sorting column + + public function LogStreamFactory($o) + { + // An instance is created, then include the logstreamdisk class as well! + global $gl_root_path; + require_once($gl_root_path . 'classes/logstreampdo.class.php'); + + // return LogStreamDisk instance + return new LogStreamPDO($o); + } + + public function GetPDODatabaseType() + { + switch ($this->DBType) + { + case DB_MYSQL: + return "mysql"; + case DB_MSSQL: + return "odbc"; + case DB_ODBC: + return "odbc"; + case DB_PGSQL: + return "pgsql"; + case DB_OCI: + return "oci"; + case DB_DB2: + return "ibm"; + case DB_FIREBIRD: + return "firebird"; + case DB_INFORMIX: + return "informix"; + case DB_SQLITE: + return "sqlite"; + default: + return ""; + } + } + + public function CreateConnectDSN() + { + switch ($this->DBType) + { + case DB_MYSQL: + $myDsn = 'mysql:host=' . $this->DBServer /*. ',' . $this->DBPort*/ . ';dbname=' . $this->DBName; + break; + case DB_MSSQL: + $myDsn = 'odbc:Driver={SQL Server}; Server=' . $this->DBServer . '; Uid=' . $this->DBUser . '; Pwd=' . $this->DBPassword . '; Database=' . $this->DBName . ';'; + break; + case DB_ODBC: + $myDsn = 'odbc:dsn=' . $this->DBServer. ';uid=' . $this->DBUser . ';pwd=' . $this->DBPassword . ';Database=' . $this->DBName; + break; + case DB_PGSQL: + $myDsn = 'pgsql:host=' . $this->DBServer . ' dbname=' . $this->DBName . ' user=' . $this->DBUser . ' password=' . $this->DBPassword; // port=5432 + break; + case DB_OCI: + $myDsn = 'oci:dbname=' . $this->DBServer . '/' . $this->DBName; + break; + case DB_DB2: + $myDsn = 'ibm:DRIVER={IBM DB2 ODBC DRIVER};DATABASE=' . $this->DBName . '; HOSTNAME=' . $this->DBServer . '; PROTOCOL=TCPIP; UID=' . $this->DBUser . '; PWD=' . $this->DBPassword; // PORT=port ; + break; + case DB_FIREBIRD: + $myDsn = 'firebird:User=' . $this->DBUser . ';Password=' . $this->DBPassword . ';Database=' . $this->DBName . ';DataSource=' . $this->DBServer; //;Port=3050'; + break; + case DB_INFORMIX: + $myDsn = 'informix:host=' . $this->DBServer . '; database=' . $this->DBName . '; server=' . $this->DBServer . '; protocol=onsoctcp; EnableScrollableCursors=1'; + break; + case DB_SQLITE: + $myDsn = 'sqlite:' . $this->DBName; // DBName is the full Path to the sqlite db file + break; + default: + $myDsn = ''; + } + + // return my DSN now! + return $myDsn; + } + + +} +?> diff --git a/src/classes/logstreamdb.class.php b/src/classes/logstreamdb.class.php index 93c073f..1a5748b 100644 --- a/src/classes/logstreamdb.class.php +++ b/src/classes/logstreamdb.class.php @@ -61,16 +61,6 @@ class LogStreamDB extends LogStream { private $_SQLwhereClause = ""; -/* private $_currentOffset = -1; - private $_currentStartPos = -1; - private $_fp = null; - private $_bEOS = false; - - const _BUFFER_length = 8192; - private $_buffer = false; - private $_buffer_length = 0; - private $_p_buffer = -1; -*/ // Constructor public function LogStreamDB($streamConfigObj) { $this->_logStreamConfigObj = $streamConfigObj; @@ -351,8 +341,27 @@ class LogStreamDB extends LogStream { */ public function GetLastPageUID() { - global $querycount; + global $querycount, $dbmapping; + $szTableType = $this->_logStreamConfigObj->DBTableType; + $szSql = "SELECT MIN(" . $dbmapping[$szTableType][SYSLOG_UID] . ") FROM " . $this->_logStreamConfigObj->DBTableName . $this->_SQLwhereClause; + $myQuery = mysql_query($szSql, $this->_dbhandle); + if ($myQuery) + { + // obtain first and only row + $myRow = mysql_fetch_row($myQuery); + $this->_lastPageUID = $myRow[0]; + + // Free query now + mysql_free_result ($myQuery); + + // Increment for the Footer Stats + $querycount++; + } +//echo $szSql . "
      " . $this->_lastPageUID; +//exit; + +/* OLD CODE // Obtain last UID of renough records are available! if ( $this->_totalRecordCount > $this->_logStreamConfigObj->_pageCount ) { @@ -378,6 +387,7 @@ class LogStreamDB extends LogStream { // Increment for the Footer Stats $querycount++; } +*/ // finally return result! return $this->_lastPageUID; @@ -561,8 +571,6 @@ class LogStreamDB extends LogStream { //echo $this->_SQLwhereClause; //$dbmapping[$szTableType][SYSLOG_UID] - - //$this->_SQLwhereClause; } else // No filters means nothing to do! return SUCCESS; diff --git a/src/classes/logstreamdisk.class.php b/src/classes/logstreamdisk.class.php index 6984949..99c0ab9 100644 --- a/src/classes/logstreamdisk.class.php +++ b/src/classes/logstreamdisk.class.php @@ -499,6 +499,8 @@ class LogStreamDisk extends LogStream { // Now we move for one page, we do not need to process the syslog messages! $ret = $this->ReadNext($myuid, $tmpArray, false); + +/* OLD CODE if ( $ret == SUCCESS ) { do @@ -507,7 +509,7 @@ class LogStreamDisk extends LogStream { $counter++; } while ( $counter < $this->_logStreamConfigObj->_pageCount && ($ret = $this->ReadNext($myuid, $tmpArray, false)) == SUCCESS ); } - +*/ // Save the current UID as LastPage UID! $this->_lastPageUID = $myuid; diff --git a/src/classes/logstreampdo.class.php b/src/classes/logstreampdo.class.php new file mode 100644 index 0000000..5f94b8a --- /dev/null +++ b/src/classes/logstreampdo.class.php @@ -0,0 +1,803 @@ + www.phplogcon.org <- + * ----------------------------------------------------------------- + * LogStreamPDO provides access to the data through PDO Interface + * + * \version 2.0.0 Init Version + * + * All directives are explained within this file + * + * Copyright (C) 2008 Adiscon GmbH. + * + * This file is part of phpLogCon. + * + * PhpLogCon is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PhpLogCon is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with phpLogCon. If not, see . + * + * A copy of the GPL can be found in the file "COPYING" in this + * distribution. + ********************************************************************* +*/ + +// --- Avoid directly accessing this file! +if ( !defined('IN_PHPLOGCON') ) +{ + die('Hacking attempt'); + exit; +} +// --- + +// --- Required Includes! +require_once($gl_root_path . 'include/constants_errors.php'); +// --- + +class LogStreamPDO extends LogStream { + private $_dbhandle = null; + + // Helper to store the database records + private $bufferedRecords = null; + private $_currentRecordStart = 0; + private $_currentRecordNum = 0; + private $_totalRecordCount = -1; + private $_previousPageUID = -1; + private $_lastPageUID = -1; + private $_currentPageNumber = -1; + + private $_SQLwhereClause = ""; + + // Constructor + public function LogStreamPDO($streamConfigObj) { + $this->_logStreamConfigObj = $streamConfigObj; + + // Verify if Extension is enabled + if ( extension_loaded('pdo') == 0 ) + DieWithFriendlyErrorMsg("Error, PDO Extensions are not enabled or installed! This Source can not operate."); + + /* + if ( $this->_logStreamConfigObj->DBType == DB_MYSQL ) + { + // Probe if a function exists! + if ( !function_exists("mysql_connect") ) + DieWithFriendlyErrorMsg("Error, MYSQL Extensions are not enabled! Function 'mysql_connect' does not exist."); + } + */ + } + + /** + * Open and verifies the database conncetion + * + * @param arrProperties array in: Properties wish list. + * @return integer Error stat + */ + public function Open($arrProperties) + { + global $dbmapping; + + // Create DSN String + $myDBDriver = $this->_logStreamConfigObj->GetPDODatabaseType(); + $myDsn = $this->_logStreamConfigObj->CreateConnectDSN(); + if ( strlen($myDsn) > 0 ) + { + // Check if configured driver is actually loaded! + //print_r(PDO::getAvailableDrivers()); + if ( !in_array($myDBDriver, PDO::getAvailableDrivers()) ) + { + $this->PrintDebugError('PDO Database Driver not loaded: ' . $myDBDriver . "
      Please check your php configuration extensions"); + return ERROR_DB_INVALIDDBDRIVER; + } + + try + { + // Try to connect to the database + $this->_dbhandle = new PDO( $myDsn, $this->_logStreamConfigObj->DBUser, $this->_logStreamConfigObj->DBPassword); + +//$handle->setAttribute(PDO::ATTR_TIMEOUT, 3); + } + catch (PDOException $e) + { + $this->PrintDebugError('PDO Database Connection failed: ' . $e->getMessage() . "
      DSN: " . $myDsn); + return ERROR_DB_CONNECTFAILED; + } + } + else + { + // Invalid DB Driver! + return ERROR_DB_INVALIDDBDRIVER; + } + + // Copy the Property Array + $this->_arrProperties = $arrProperties; + + // Check if DB Mapping exists + if ( !isset($dbmapping[ $this->_logStreamConfigObj->DBTableType ]) ) + return ERROR_DB_INVALIDDBMAPPING; + + // Create SQL Where Clause first! + $this->CreateSQLWhereClause(); + +// Success, this means we init the Pagenumber to ONE! +//$this->_currentPageNumber = 1; + + // reached this point means success! + return SUCCESS; + } + + /** + * Close the database connection. + * + * @return integer Error state + */ + public function Close() + { + if ( $this->_dbhandle != null ) + unset($this->_dbhandle); + return SUCCESS; + } + + /** + * Read the data from a specific uID which means in this + * case beginning with from the Database ID + * + * @param uID integer in/out: unique id of the data row + * @param arrProperitesOut array out: array filled with properties + * @return integer Error state + * @see ReadNext() + */ + public function Read($uID, &$arrProperitesOut) + { + // Seek the first uID! + if ( $this->Sseek($uID, EnumSeek::UID, 0) == SUCCESS) + { + // Read the next record! + $ret = $this->ReadNext($uID, $arrProperitesOut); + } + else + $ret = ERROR_NOMORERECORDS; + + // return result! + return $ret; + } + + /** + * Read the next line from the file depending on the current + * read direction. + * + * Hint: If the current stream becomes unavailable an error + * stated is retuned. A typical case is if a log rotation + * changed the original data source. + * + * @param uID integer out: uID is the offset of data row + * @param arrProperitesOut array out: properties + * @return integer Error state + * @see ReadNext + */ + public function ReadNext(&$uID, &$arrProperitesOut, $bParseMessage = true) + { + // Helpers needed for DB Mapping + global $dbmapping, $fields; + $szTableType = $this->_logStreamConfigObj->DBTableType; + + // define $ret + $ret = SUCCESS; + + // No buffer? then read from DB! + if ( $this->bufferedRecords == null ) + $ret = $this->ReadNextRecordsFromDB($uID); + else + { + if ( !isset($this->bufferedRecords[$this->_currentRecordNum] ) ) + { + // We need to load new records, so clear the old ones first! + $this->ResetBufferedRecords(); + + // Set new Record start, will be used in the SQL Statement! + $this->_currentRecordStart = $this->_currentRecordNum; // + 1; + + // Now read new ones + $ret = $this->ReadNextRecordsFromDB($uID); +echo "mowl2"; + + if ( !isset($this->bufferedRecords[$this->_currentRecordNum] ) ) + $ret = ERROR_NOMORERECORDS; + } + } + + if ( $ret == SUCCESS ) + { + // Init and set variables + foreach ( $this->_arrProperties as $property ) + { + // Check if mapping exists + if ( isset($dbmapping[$szTableType][$property]) ) + { + // Copy property if available! + $dbfieldname = $dbmapping[$szTableType][$property]; + if ( isset($this->bufferedRecords[$this->_currentRecordNum][$dbfieldname]) ) + { + if ( isset($fields[$property]['FieldType']) && $fields[$property]['FieldType'] == FILTER_TYPE_DATE ) // Handle as date! + $arrProperitesOut[$property] = GetEventTime( $this->bufferedRecords[$this->_currentRecordNum][$dbfieldname] ); + else + $arrProperitesOut[$property] = $this->bufferedRecords[$this->_currentRecordNum][$dbfieldname]; + } + else + $arrProperitesOut[$property] = ''; + } + else + $arrProperitesOut[$property] = ''; + } + + // Set uID to the PropertiesOut! //DEBUG -> $this->_currentRecordNum; + $uID = $arrProperitesOut[SYSLOG_UID] = $this->bufferedRecords[$this->_currentRecordNum][$dbmapping[$szTableType][SYSLOG_UID]]; + + // Increment $_currentRecordNum + $this->_currentRecordNum++; + } + + // reached here means return result! + return $ret; + } + + /** + * Implementation of Seek + */ + public function Sseek(&$uID, $mode, $numrecs) + { + // predefine return value + $ret = SUCCESS; + + switch ($mode) + { + case EnumSeek::UID: +// if ( $uID == UID_UNKNOWN ) // set uID to first ID! + { + // No buffer? then read from DB! + if ( $this->bufferedRecords == null ) + $ret = $this->ReadNextRecordsFromDB($uID); + + if ( $ret == SUCCESS ) + { + $this->_currentRecordNum = 0; + $uID = $this->bufferedRecords[ $this->_currentRecordNum ]; + } + } +/* else + { + // Obtain fieldname for uID + global $dbmapping; + $uidfieldname = $dbmapping[$this->_logStreamConfigObj->DBTableType][SYSLOG_UID]; + + // Clear if necessary! + if ( $this->bufferedRecords == null ) + $this->ResetBufferedRecords(); + + // Loop through all records for now, maybe optimized later! + $bFound = false; + $tmpuID = $uID; + $ret = ERROR_NOMORERECORDS; // Set Default error code! + + // Set totalpages number if available + if ( $this->_totalRecordCount != -1 ) + $totalpages = intval($this->_totalRecordCount / $this->_logStreamConfigObj->_pageCount); + else + $totalpages = 1; + + while( $bFound == false && $this->ReadNextIDsFromDB() == SUCCESS ) + { + foreach ( $this->bufferedRecords as $myRecord ) + { + if ( $myRecord[$uidfieldname] == $uID ) + { + $bFound = true; + $ret = SUCCESS; + break; // Break foreach loop! + } + else + { + $tmpuID = $myRecord[$uidfieldname]; + // Only Increment $_currentRecordNum + $this->_currentRecordNum++; + } + + // Increment our Pagenumber if needed! + if ( $this->_currentRecordNum % $this->_logStreamConfigObj->_pageCount == 0 ) + $this->_currentPageNumber++; + } + + if ( $this->_currentPageNumber > 1 && $this->_readDirection == EnumReadDirection::Forward) + $this->_currentPageNumber = $totalpages - $this->_currentPageNumber + 1; + + //--- Extra check to set the correct $_previousPageUID! + if ( $this->_currentRecordNum > $this->_logStreamConfigObj->_pageCount && isset($this->bufferedRecords[$this->_currentRecordNum - 50][$uidfieldname]) ) + { + $this->_previousPageUID = $this->bufferedRecords[$this->_currentRecordNum - $this->_logStreamConfigObj->_pageCount - 1][$uidfieldname]; + } + // TODO! Handle the case where previous ID is not set in the bufferedrecords! + //--- + + // We need to load new records, so clear the old ones first! + $this->ResetBufferedRecords(); + + // Set new Record start, will be used in the SQL Statement! + $this->_currentRecordStart = $this->_currentRecordNum; + } + + // Delete buffered records, then they will be read automatically in ReadNext() + $this->ResetBufferedRecords(); + } +*/ + break; + } + + // Return result! + return $ret; + } + + /** + * GetMessageCount will return the count of Message. + * If this count is not available, the function will + * return the default -1 + */ + public function GetMessageCount() + { + return $this->_totalRecordCount; + } + + /** + * This function returns the first UID for previous PAGE, if availbale! + * Otherwise will return -1! + */ + public function GetPreviousPageUID() + { + return $this->_previousPageUID; + } + + /** + * This function returns the first UID for the last PAGE! + * Will be done by a seperated SQL Statement. + */ + public function GetLastPageUID() + { + global $querycount, $dbmapping; + $szTableType = $this->_logStreamConfigObj->DBTableType; + + $szSql = "SELECT MIN(" . $dbmapping[$szTableType][SYSLOG_UID] . ") FROM " . $this->_logStreamConfigObj->DBTableName . $this->_SQLwhereClause; + $myQuery = $this->_dbhandle->query($szSql); + if ( $myQuery ) + { + $myRow = $myQuery->fetchColumn(); + $this->_lastPageUID = $myRow; // $myRow[0]; + + // Free query now + $myQuery->closeCursor(); + + // Increment for the Footer Stats + $querycount++; + + } +//echo $szSql . "
      " . $this->_lastPageUID; +//exit; + + // finally return result! + return $this->_lastPageUID; + } + + /** + * This function returns the current Page number, if availbale! + * Otherwise will return 0! We also assume that this function is + * only called once DB is open! + */ + public function GetCurrentPageNumber() + { + return $this->_currentPageNumber; + } + + /* + * Implementation of IsPropertySortable + * + * For now, sorting is only possible for the UID Property! + */ + public function IsPropertySortable($myProperty) + { + global $fields; + + // TODO: HARDCODED | FOR NOW only FALSE! + return false; + + if ( isset($fields[$myProperty]) && $myProperty == SYSLOG_UID ) + return true; + else + return false; + } + + /* + * ============= Beginn of private functions ============= + */ + + /* + * This function expects the filters to already being set earlier. + * Otherwise no usual WHERE Clause can be created! + */ + private function CreateSQLWhereClause() + { + if ( $this->_filters != null ) + { + global $dbmapping; + $szTableType = $this->_logStreamConfigObj->DBTableType; + + // Reset WhereClause + $this->_SQLwhereClause = ""; + + // Loop through all available properties + foreach( $this->_arrProperties as $propertyname ) + { + // If the property exists in the filter array, we have something to filter for ^^! + if ( array_key_exists($propertyname, $this->_filters) ) + { + // Process all filters + foreach( $this->_filters[$propertyname] as $myfilter ) + { + switch( $myfilter[FILTER_TYPE] ) + { + case FILTER_TYPE_STRING: + // Check if user wants to include or exclude! + if ( $myfilter[FILTER_MODE] == FILTER_MODE_INCLUDE) + $addnod = ""; + else + $addnod = " NOT"; + + // If Syslog message, we have AND handling, otherwise OR! + if ( $propertyname == SYSLOG_MESSAGE ) + $addor = " AND "; + else + $addor = " OR "; + + // Not create LIKE Filters + if ( isset($tmpfilters[$propertyname]) ) + $tmpfilters[$propertyname][FILTER_VALUE] .= $addor . $dbmapping[$szTableType][$propertyname] . $addnod . " LIKE '%" . $myfilter[FILTER_VALUE] . "%'"; + else + { + $tmpfilters[$propertyname][FILTER_TYPE] = FILTER_TYPE_STRING; + $tmpfilters[$propertyname][FILTER_VALUE] = $dbmapping[$szTableType][$propertyname] . $addnod . " LIKE '%" . $myfilter[FILTER_VALUE] . "%'"; + } + break; + case FILTER_TYPE_NUMBER: + if ( isset($tmpfilters[$propertyname]) ) + $tmpfilters[$propertyname][FILTER_VALUE] .= ", " . $myfilter[FILTER_VALUE]; + else + { + $tmpfilters[$propertyname][FILTER_TYPE] = FILTER_TYPE_NUMBER; + $tmpfilters[$propertyname][FILTER_VALUE] = $dbmapping[$szTableType][$propertyname] . " IN (" . $myfilter[FILTER_VALUE]; + } + break; + case FILTER_TYPE_DATE: + if ( isset($tmpfilters[$propertyname]) ) + $tmpfilters[$propertyname][FILTER_VALUE] .= " AND "; + else + { + $tmpfilters[$propertyname][FILTER_VALUE] = ""; + $tmpfilters[$propertyname][FILTER_TYPE] = FILTER_TYPE_DATE; + } + + if ( $myfilter[FILTER_DATEMODE] == DATEMODE_LASTX ) + { + // Get current timestamp + $nNowTimeStamp = time(); + + if ( $myfilter[FILTER_VALUE] == DATE_LASTX_HOUR ) + $nNowTimeStamp -= 60 * 60; // One Hour! + else if ( $myfilter[FILTER_VALUE] == DATE_LASTX_12HOURS ) + $nNowTimeStamp -= 60 * 60 * 12; // 12 Hours! + else if ( $myfilter[FILTER_VALUE] == DATE_LASTX_24HOURS ) + $nNowTimeStamp -= 60 * 60 * 24; // 24 Hours! + else if ( $myfilter[FILTER_VALUE] == DATE_LASTX_7DAYS ) + $nNowTimeStamp -= 60 * 60 * 24 * 7; // 7 days + else if ( $myfilter[FILTER_VALUE] == DATE_LASTX_31DAYS ) + $nNowTimeStamp -= 60 * 60 * 24 * 31; // 31 days + else + { + // Set filter to unknown and Abort in this case! + $tmpfilters[$propertyname][FILTER_TYPE] = FILTER_TYPE_UNKNOWN; + break; + } + + // Append filter + $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType][$propertyname] . " > '" . date("Y-m-d H:i:s", $nNowTimeStamp) . "'"; + } + else if ( $myfilter[FILTER_DATEMODE] == DATEMODE_RANGE_FROM ) + { + // Obtain Event struct for the time! + $myeventtime = GetEventTime($myfilter[FILTER_VALUE]); + $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType][$propertyname] . " > '" . date("Y-m-d H:i:s", $myeventtime[EVTIME_TIMESTAMP]) . "'"; + } + else if ( $myfilter[FILTER_DATEMODE] == DATEMODE_RANGE_TO ) + { + // Obtain Event struct for the time! + $myeventtime = GetEventTime($myfilter[FILTER_VALUE]); + $tmpfilters[$propertyname][FILTER_VALUE] .= $dbmapping[$szTableType][$propertyname] . " < '" . date("Y-m-d H:i:s", $myeventtime[EVTIME_TIMESTAMP]) . "'"; + } + + break; + default: + // Nothing to do! + break; + } + } + } + } + + // Check and combine all filters now! + if ( isset($tmpfilters) ) + { + // Append filters + foreach( $tmpfilters as $tmpfilter ) + { + // Init WHERE or Append AND + if ( strlen($this->_SQLwhereClause) > 0 ) + $this->_SQLwhereClause .= " AND "; + else + $this->_SQLwhereClause = " WHERE "; + + switch( $tmpfilter[FILTER_TYPE] ) + { + case FILTER_TYPE_STRING: + $this->_SQLwhereClause .= "( " . $tmpfilter[FILTER_VALUE] . ") "; + break; + case FILTER_TYPE_NUMBER: + $this->_SQLwhereClause .= $tmpfilter[FILTER_VALUE] . ") "; + break; + case FILTER_TYPE_DATE: + $this->_SQLwhereClause .= $tmpfilter[FILTER_VALUE]; + break; + default: + // Should not happen, wrong filters! + // We add a dummy into the where clause, just as a place holder + $this->_SQLwhereClause .= " 1=1 "; + break; + } + } + } + +//echo $this->_SQLwhereClause; + //$dbmapping[$szTableType][SYSLOG_UID] + } + else // No filters means nothing to do! + return SUCCESS; + } + + + /* + * This helper function will read the next records into the buffer. + */ + private function ReadNextRecordsFromDB($uID) + { + global $querycount; + + // Get SQL Statement + $szSql = $this->CreateSQLStatement($uID); + + // Append LIMIT clause +//$szSql .= " LIMIT " . $this->_currentRecordStart . ", " . $this->_logStreamConfigObj->RecordsPerQuery; + + // Perform Database Query + $myquery = $this->_dbhandle->query($szSql); + if ( !$myquery ) + { + $this->PrintDebugError("Invalid SQL: ".$szSql); + return ERROR_DB_QUERYFAILED; + } + + // Copy rows into the buffer! + $iBegin = $this->_currentRecordNum; + +// $result = $myquery->setFetchMode(PDO::FETCH_ASSOC); + + $iCount = 0; + while( $this->_logStreamConfigObj->RecordsPerQuery > $iCount ) + { + //Obtain next record + $myRow = $myquery->fetch(PDO::FETCH_ASSOC); +// if ( $iCount >= $this->_currentRecordStart ) +// { +// print_r( $iCount ); +// exit; + $this->bufferedRecords[$iBegin] = $myRow; + $iBegin++; +// } + + // Increment counter + $iCount++; + } +/* + foreach ($myquery as $myRow) + { + $this->bufferedRecords[$iBegin] = $myRow; + $iBegin++; + } +*/ + + // Free Query ressources +// $myquery->closeCursor(); + $myquery = null; + + + // Only obtain count if enabled and not done before + if ( $this->_logStreamConfigObj->DBEnableRowCounting && $this->_totalRecordCount == -1 ) + { + $this->_totalRecordCount = $this->GetRowCountFromTable(); + + if ( $this->_totalRecordCount <= 0 ) + return ERROR_NOMORERECORDS; + } + + // Increment for the Footer Stats + $querycount++; + + // return success state if reached this point! + return SUCCESS; + } + + /* + * Creates the SQL Statement we are going to use! + */ + private function CreateSQLStatement($uID, $includeFields = true) + { + global $dbmapping; + + // Copy helper variables, this is just for better readability + $szTableType = $this->_logStreamConfigObj->DBTableType; + $szSortColumn = $this->_logStreamConfigObj->SortColumn; + + // Create Basic SQL String +// if ( $this->_logStreamConfigObj->DBEnableRowCounting ) // with SQL_CALC_FOUND_ROWS +// $sqlString = "SELECT SQL_CALC_FOUND_ROWS " . $dbmapping[$szTableType][SYSLOG_UID]; +// else // without row calc + $sqlString = "SELECT " . $dbmapping[$szTableType][SYSLOG_UID]; + + // Append fields if needed + if ( $includeFields && $this->_arrProperties != null ) + { + // Loop through all requested fields + foreach ( $this->_arrProperties as $myproperty ) + { + // SYSLOG_UID already added! + if ( $myproperty != SYSLOG_UID && isset($dbmapping[$szTableType][$myproperty]) ) + { + // Append field! + $sqlString .= ", " . $dbmapping[$szTableType][$myproperty]; + } + } + } + + // Append FROM 'table'! + $sqlString .= " FROM " . $this->_logStreamConfigObj->DBTableName; + + // Append precreated where clause + $sqlString .= $this->_SQLwhereClause; + + // Append UID QUERY! + if ( $uID != -1 ) + { + if ( $this->_readDirection == EnumReadDirection::Forward ) + $myOperator = ">="; + else + $myOperator = "<="; + + if ( strlen($this->_SQLwhereClause) > 0 ) + $sqlString .= " AND " . $dbmapping[$szTableType][SYSLOG_UID] . " $myOperator $uID"; + else + $sqlString .= " WHERE " . $dbmapping[$szTableType][SYSLOG_UID] . " $myOperator $uID"; + } + + // Append ORDER clause + if ( $this->_readDirection == EnumReadDirection::Forward ) + $sqlString .= " ORDER BY " . $dbmapping[$szTableType][$szSortColumn]; + else if ( $this->_readDirection == EnumReadDirection::Backward ) + $sqlString .= " ORDER BY " . $dbmapping[$szTableType][$szSortColumn] . " DESC"; + +//echo $sqlString; +//exit; + + // return SQL result string: + return $sqlString; + } + + /* + * Reset record buffer in this function! + */ + private function ResetBufferedRecords() + { + if ( isset($this->bufferedRecords) ) + { + // Loop through all subrecords first! + foreach ($this->bufferedRecords as $mykey => $myrecord) + unset( $this->bufferedRecords[$mykey] ); + + // Set buffered records to NULL! + $this->bufferedRecords = null; + } + } + + /* + * Helper function to display SQL Errors for now! + */ + private function PrintDebugError($szErrorMsg) + { + global $CFG; + if ( isset($CFG['MiscShowDebugMsg']) && $CFG['MiscShowDebugMsg'] == 1 ) + { + $errdesc = $this->_dbhandle == null ? "" : implode( ";", $this->_dbhandle->errorInfo() ); + $errno = $this->_dbhandle == null ? "" : $this->_dbhandle->errorCode(); + + $errormsg ="
      "; + $errormsg.="

      Error: " . $szErrorMsg . "


      "; + $errormsg.="Errordetails:
      "; + $errormsg.="Detail Error: $errdesc
      "; + $errormsg.="Error Code: $errno
      "; + $errormsg.="Date: ".date("d.m.Y @ H:i"). "
      "; + $errormsg.="
      "; + + //Output! + print( $errormsg ); + } + } + + /* + * Returns the number of possible records by using a select count statement! + */ + private function GetRowCountFromTable() + { +/* + if ( $myquery = mysql_query("Select FOUND_ROWS();", $this->_dbhandle) ) + { + // Get first and only row! + $myRow = mysql_fetch_array($myquery); + + // copy row count + $numRows = $myRow[0]; + } + else + $numRows = -1; +*/ + + /* OLD slow code! */ + global $dbmapping,$querycount; + $szTableType = $this->_logStreamConfigObj->DBTableType; + + // Create Statement and perform query! + $szSql = "SELECT count(" . $dbmapping[$szTableType][SYSLOG_UID] . ") FROM " . $this->_logStreamConfigObj->DBTableName . $this->_SQLwhereClause; + $myQuery = $this->_dbhandle->query($szSql); + if ($myQuery) + { + // obtain first and only row + $myRow = $myQuery->fetchColumn(); + $numRows = $myRow; // $myRow[0]; + + // Increment for the Footer Stats + $querycount++; + + // Free query now + $myQuery->closeCursor(); + } + else + $numRows = -1; + + // return result! + return $numRows; + } + + +} + +?> \ No newline at end of file diff --git a/src/include/constants_errors.php b/src/include/constants_errors.php index 7f63664..6ca7855 100644 --- a/src/include/constants_errors.php +++ b/src/include/constants_errors.php @@ -55,7 +55,9 @@ define('ERROR_DB_CANNOTSELECTDB', 11); define('ERROR_DB_QUERYFAILED', 12); define('ERROR_DB_NOPROPERTIES', 13); define('ERROR_DB_INVALIDDBMAPPING', 14); +define('ERROR_DB_INVALIDDBDRIVER', 16); define('ERROR_FILE_NOT_READABLE', 15); + ?> diff --git a/src/include/constants_general.php b/src/include/constants_general.php index eb545f2..f0c737f 100644 --- a/src/include/constants_general.php +++ b/src/include/constants_general.php @@ -60,6 +60,7 @@ define('STR_DEBUG_ERROR_WTF', "WTF OMFG"); // --- Source Type defines define('SOURCE_DISK', '1'); define('SOURCE_DB', '2'); +define('SOURCE_PDO', '3'); // --- // --- diff --git a/src/include/constants_logstream.php b/src/include/constants_logstream.php index 55dfd24..f4056bd 100644 --- a/src/include/constants_logstream.php +++ b/src/include/constants_logstream.php @@ -70,6 +70,11 @@ define('FILTER_TYPE_UNKNOWN', 99); define('DB_MYSQL', 0); define('DB_MSSQL', 1); define('DB_ODBC', 2); +define('DB_PGSQL', 3); +define('DB_OCI', 4); +define('DB_DB2', 5); +define('DB_FIREBIRD', 6); +define('DB_INFORMIX', 7); // --- Predefine fields array! $fields[SYSLOG_UID]['FieldID'] = SYSLOG_UID; diff --git a/src/include/functions_config.php b/src/include/functions_config.php index d37b7a6..b55a387 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -100,6 +100,24 @@ if ( isset($mysource['DBPassword']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBPassword = $mysource['DBPassword']; } if ( isset($mysource['DBEnableRowCounting']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBEnableRowCounting = $mysource['DBEnableRowCounting']; } } + else if ( $mysource['SourceType'] == SOURCE_PDO ) + { + // Perform necessary include + require_once($gl_root_path . 'classes/logstreamconfigpdo.class.php'); + + $content['Sources'][$iSourceID]['ObjRef'] = new LogStreamConfigPDO(); + $content['Sources'][$iSourceID]['ObjRef']->DBServer = $mysource['DBServer']; + $content['Sources'][$iSourceID]['ObjRef']->DBName = $mysource['DBName']; + $content['Sources'][$iSourceID]['ObjRef']->DBType = $mysource['DBType']; + $content['Sources'][$iSourceID]['ObjRef']->DBTableName = $mysource['DBTableName']; + $content['Sources'][$iSourceID]['ObjRef']->DBTableType = strtolower($mysource['DBTableType']); + + // Optional parameters! + if ( isset($mysource['DBPort']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBPort = $mysource['DBPort']; } + if ( isset($mysource['DBUser']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBUser = $mysource['DBUser']; } + if ( isset($mysource['DBPassword']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBPassword = $mysource['DBPassword']; } + if ( isset($mysource['DBEnableRowCounting']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBEnableRowCounting = $mysource['DBEnableRowCounting']; } + } else { // UNKNOWN, remove config entry! diff --git a/src/index.php b/src/index.php index db450e9..361e05a 100644 --- a/src/index.php +++ b/src/index.php @@ -231,7 +231,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // Set current ID and init Counter $uID = $content['uid_current']; $counter = 0; - + // If uID is known, we need to init READ first - this will also seek for available records first! if ($uID != UID_UNKNOWN) { @@ -244,6 +244,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // --- Check if Read was successfull! if ( $ret == SUCCESS ) { +/* OLD CODE // If Forward direction is used, we need to SKIP one entry! if ( $content['read_direction'] == EnumReadDirection::Forward ) { @@ -253,6 +254,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // Skip this entry and move to the next $stream->ReadNext($uID, $logArray); } +*/ } else { @@ -578,16 +580,8 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c else if ( $content['uid_current'] != UID_UNKNOWN ) $content['main_pager_next_found'] = false; } - else if ( $content['read_direction'] == EnumReadDirection::Forward ) - { - // User clicked back, so there is a next page for sure - $content['main_pager_next_found'] = true; - - // As we went back, we need to change the currend uid to the latest read one - $content['uid_current'] = $uID; - } // --- - + // --- Handle uid_previous page button if ( $content['uid_current'] != UID_UNKNOWN ) { @@ -616,13 +610,27 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // --- Handle uid_last page button // Option the last UID from the stream! $content['uid_last'] = $stream->GetLastPageUID(); - + // if we found a last uid, and if it is not the current one (which means we already are on the last page ;)! if ( $content['uid_last'] != -1 && $content['uid_last'] != $content['uid_current']) $content['main_pager_last_found'] = true; else $content['main_pager_last_found'] = false; //echo $content['uid_last']; + + // Handle next button only if Forward is used now! + if ( $content['read_direction'] == EnumReadDirection::Forward ) + { + if ( $content['uid_current'] == $content['uid_last'] ) + // Last page already ! + $content['main_pager_next_found'] = false; + else + // User clicked back, so there is a next page for sure + $content['main_pager_next_found'] = true; + + // As we went back, we need to change the currend uid to the latest read one + $content['uid_current'] = $uID; + } // --- // --- Handle uid_first page button @@ -657,7 +665,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c else if ( $res == ERROR_FILE_NOT_READABLE ) $content['detailederror'] = "Syslog file is not readable, read access may be denied. "; else - $content['detailederror'] = "Unknown or unhandeled error occured."; + $content['detailederror'] = "Unknown or unhandeled error occured (Error Code " . $res . ") "; } diff --git a/src/templates/index.html b/src/templates/index.html index 38f9a02..997543a 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -181,7 +181,7 @@
      - + @@ -328,7 +328,7 @@ - + From b81ba95db4603e7dc1206f50316b84d9f7c900d4 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 23 May 2008 14:50:55 +0200 Subject: [PATCH 36/79] Enhanced Pager performance, and new PDO Database driver. I had to change the other drivers as well for the new pager logic. --- src/classes/logstream.class.php | 6 ++++ src/classes/logstreamdb.class.php | 31 +++++++++++++++++- src/classes/logstreamdisk.class.php | 19 ++++++----- src/classes/logstreampdo.class.php | 31 ++++++++++++++++++ src/details.php | 13 ++++++-- src/include/functions_frontendhelpers.php | 6 +++- src/index.php | 39 ++++++++++++++++------- src/templates/index.html | 8 ++--- 8 files changed, 123 insertions(+), 30 deletions(-) diff --git a/src/classes/logstream.class.php b/src/classes/logstream.class.php index 9e51670..b308764 100644 --- a/src/classes/logstream.class.php +++ b/src/classes/logstream.class.php @@ -175,6 +175,12 @@ abstract class LogStream { public abstract function GetLastPageUID(); + /** + * This function returns the FIRST UID for the FIRST PAGE, if availbale! Otherwise will + * return -1! + */ + public abstract function GetFirstPageUID(); + /** * This function returns the current Page number, if availbale! Otherwise will * return -1! diff --git a/src/classes/logstreamdb.class.php b/src/classes/logstreamdb.class.php index 1a5748b..afd2015 100644 --- a/src/classes/logstreamdb.class.php +++ b/src/classes/logstreamdb.class.php @@ -57,6 +57,7 @@ class LogStreamDB extends LogStream { private $_totalRecordCount = -1; private $_previousPageUID = -1; private $_lastPageUID = -1; + private $_firstPageUID = -1; private $_currentPageNumber = 0; private $_SQLwhereClause = ""; @@ -335,6 +336,34 @@ class LogStreamDB extends LogStream { return $this->_previousPageUID; } + /** + * This function returns the FIRST UID for the FIRST PAGE! + * Will be done by a seperated SQL Statement. + */ + public function GetFirstPageUID() + { + global $querycount, $dbmapping; + $szTableType = $this->_logStreamConfigObj->DBTableType; + + $szSql = "SELECT MAX(" . $dbmapping[$szTableType][SYSLOG_UID] . ") FROM " . $this->_logStreamConfigObj->DBTableName . $this->_SQLwhereClause; + $myQuery = mysql_query($szSql, $this->_dbhandle); + if ($myQuery) + { + // obtain first and only row + $myRow = mysql_fetch_row($myQuery); + $this->_firstPageUID = $myRow[0]; + + // Free query now + mysql_free_result ($myQuery); + + // Increment for the Footer Stats + $querycount++; + } + + // Return result! + return $this->_firstPageUID; + } + /** * This function returns the first UID for the last PAGE! * Will be done by a seperated SQL Statement. @@ -389,7 +418,7 @@ class LogStreamDB extends LogStream { } */ - // finally return result! + // Return result! return $this->_lastPageUID; } diff --git a/src/classes/logstreamdisk.class.php b/src/classes/logstreamdisk.class.php index 99c0ab9..36d8d4f 100644 --- a/src/classes/logstreamdisk.class.php +++ b/src/classes/logstreamdisk.class.php @@ -466,6 +466,15 @@ class LogStreamDisk extends LogStream { return $this->_previousPageUID; } + /** + * This function returns the FIRST UID for the FIRST PAGE! + * NOT IMPLEMENTED RIGHT NOW! + */ + public function GetFirstPageUID() + { + return -1; + } + /** * This function returns the first UID for the last PAGE! * This is not possible in this logstream, so it always returns -1! @@ -500,16 +509,6 @@ class LogStreamDisk extends LogStream { // Now we move for one page, we do not need to process the syslog messages! $ret = $this->ReadNext($myuid, $tmpArray, false); -/* OLD CODE - if ( $ret == SUCCESS ) - { - do - { - // Increment Counter - $counter++; - } while ( $counter < $this->_logStreamConfigObj->_pageCount && ($ret = $this->ReadNext($myuid, $tmpArray, false)) == SUCCESS ); - } -*/ // Save the current UID as LastPage UID! $this->_lastPageUID = $myuid; diff --git a/src/classes/logstreampdo.class.php b/src/classes/logstreampdo.class.php index 5f94b8a..f512739 100644 --- a/src/classes/logstreampdo.class.php +++ b/src/classes/logstreampdo.class.php @@ -53,6 +53,7 @@ class LogStreamPDO extends LogStream { private $_totalRecordCount = -1; private $_previousPageUID = -1; private $_lastPageUID = -1; + private $_firstPageUID = -1; private $_currentPageNumber = -1; private $_SQLwhereClause = ""; @@ -363,6 +364,36 @@ echo "mowl2"; return $this->_previousPageUID; } + /** + * This function returns the FIRST UID for the FIRST PAGE! + * Will be done by a seperated SQL Statement. + */ + public function GetFirstPageUID() + { + global $querycount, $dbmapping; + $szTableType = $this->_logStreamConfigObj->DBTableType; + + $szSql = "SELECT MAX(" . $dbmapping[$szTableType][SYSLOG_UID] . ") FROM " . $this->_logStreamConfigObj->DBTableName . $this->_SQLwhereClause; + $myQuery = $this->_dbhandle->query($szSql); + if ( $myQuery ) + { + $myRow = $myQuery->fetchColumn(); + $this->_firstPageUID = $myRow; // $myRow[0]; + + // Free query now + $myQuery->closeCursor(); + + // Increment for the Footer Stats + $querycount++; + + } +//echo $szSql . "
      " . $this->_firstPageUID; +//exit; + + // finally return result! + return $this->_firstPageUID; + } + /** * This function returns the first UID for the last PAGE! * Will be done by a seperated SQL Statement. diff --git a/src/details.php b/src/details.php index a7be744..8262c33 100644 --- a/src/details.php +++ b/src/details.php @@ -262,7 +262,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['uid_current' { // Enable Pager in any case here! $content['main_pagerenabled'] = true; - +/* // --- Handle uid_first page button if ( $content['uid_fromgetrequest'] == $content['uid_first'] ) $content['main_pager_first_found'] = false; @@ -276,10 +276,19 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['uid_current' $content['main_pager_first_found'] = false; } // --- - +*/ // --- Handle uid_last page button // Option the last UID from the stream! $content['uid_last'] = $stream->GetLastPageUID(); + $content['uid_first'] = $stream->GetFirstPageUID(); + + // --- Handle uid_first page button + if ( $content['uid_current'] == $content['uid_first'] ) + $content['main_pager_first_found'] = false; + else + $content['main_pager_first_found'] = true; + // --- + // if we found a last uid, and if it is not the current one (which means we already are on the last page ;)! if ( $content['uid_last'] != -1 && $content['uid_last'] != $content['uid_current']) diff --git a/src/include/functions_frontendhelpers.php b/src/include/functions_frontendhelpers.php index 65821f9..c34716c 100644 --- a/src/include/functions_frontendhelpers.php +++ b/src/include/functions_frontendhelpers.php @@ -108,7 +108,11 @@ function CreateCurrentUrl() for ( $i = 0; $i < count($queries); $i++ ) { // Some properties need to be filtered out. - if ( strpos($queries[$i], "direction") === false ) + if ( + strpos($queries[$i], "direction") === false + && + strpos($queries[$i], "skipone") === false + ) { $tmpvars = explode ("=", $queries[$i]); if ( isset($tmpvars[1]) ) // Only if value param is set! diff --git a/src/index.php b/src/index.php index 361e05a..eebabf2 100644 --- a/src/index.php +++ b/src/index.php @@ -73,6 +73,17 @@ if ( $content['uid_current'] == UID_UNKNOWN ) else $content['ViewEnableAutoReloadSeconds_visible'] = false; +// Read direction parameter +if ( isset($_GET['direction']) && $_GET['direction'] == "desc" ) + $content['read_direction'] = EnumReadDirection::Forward; +else + $content['read_direction'] = EnumReadDirection::Backward; + +// If direction is DESC, should we SKIP one? +if ( isset($_GET['skipone']) && $_GET['skipone'] == "true" ) + $content['skipone'] = true; +else + $content['skipone'] = false; // --- @@ -87,12 +98,6 @@ $content['main_pager_previous_found'] = false; $content['main_pager_next_found'] = false; $content['main_pager_last_found'] = false; - -if ( isset($_GET['direction']) && $_GET['direction'] == "desc" ) - $content['read_direction'] = EnumReadDirection::Forward; -else - $content['read_direction'] = EnumReadDirection::Backward; - // Init Sorting variables $content['sorting'] = ""; $content['searchstr'] = ""; @@ -244,17 +249,18 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // --- Check if Read was successfull! if ( $ret == SUCCESS ) { -/* OLD CODE // If Forward direction is used, we need to SKIP one entry! if ( $content['read_direction'] == EnumReadDirection::Forward ) { // Ok the current ID is our NEXT ID in this reading direction, so we save it! $content['uid_next'] = $uID; - // Skip this entry and move to the next - $stream->ReadNext($uID, $logArray); + if ( $content['skipone'] ) + { + // Skip this entry and move to the next + $stream->ReadNext($uID, $logArray); + } } -*/ } else { @@ -569,6 +575,9 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // Enable Pager in any case here! $content['main_pagerenabled'] = true; + // temporary store the current last $uID + $lastUid = $uID; + // --- Handle uid_next page button if ( $content['read_direction'] == EnumReadDirection::Backward ) { @@ -610,6 +619,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // --- Handle uid_last page button // Option the last UID from the stream! $content['uid_last'] = $stream->GetLastPageUID(); + $content['uid_first'] = $stream->GetFirstPageUID(); // if we found a last uid, and if it is not the current one (which means we already are on the last page ;)! if ( $content['uid_last'] != -1 && $content['uid_last'] != $content['uid_current']) @@ -629,13 +639,18 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c $content['main_pager_next_found'] = true; // As we went back, we need to change the currend uid to the latest read one - $content['uid_current'] = $uID; + $content['uid_current'] = $lastUid; } // --- // --- Handle uid_first page button - if ( $content['uid_current'] == $content['uid_first'] ) + if ( $content['main_pager_previous_found'] == false || + $content['uid_current'] == UID_UNKNOWN || + $content['uid_current'] == $content['uid_first'] ) + { $content['main_pager_first_found'] = false; + $content['main_pager_previous_found'] = false; // If there is no FIRST, there is no going back! + } else $content['main_pager_first_found'] = true; // --- diff --git a/src/templates/index.html b/src/templates/index.html index 997543a..fc04c06 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -150,7 +150,7 @@
      Pager:   - + @@ -159,7 +159,7 @@ - + @@ -297,7 +297,7 @@ Pager:   - + @@ -306,7 +306,7 @@ - + From 672e83534332eb906068726c5bb5d6df657eab08 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 23 May 2008 16:43:24 +0200 Subject: [PATCH 37/79] Fixed issues with the pager code changes in DB and DISK logstream --- src/classes/logstreamdisk.class.php | 11 ++- src/classes/logstreampdo.class.php | 124 +++++++++++++++++----------- src/index.php | 14 ++-- 3 files changed, 94 insertions(+), 55 deletions(-) diff --git a/src/classes/logstreamdisk.class.php b/src/classes/logstreamdisk.class.php index 36d8d4f..7f4ee03 100644 --- a/src/classes/logstreamdisk.class.php +++ b/src/classes/logstreamdisk.class.php @@ -486,8 +486,8 @@ class LogStreamDisk extends LogStream { // Helper variables $myuid = -1; $counter = 0; + $tmpOldDirection = $this->_readDirection; -// if ( $this->_readDirection == EnumReadDirection::Forward ) if ( $this->_sortOrder == EnumSortingOrder::Ascending ) { // Move to the beginning of END file! @@ -496,7 +496,6 @@ class LogStreamDisk extends LogStream { // Switch reading direction! $this->_readDirection = EnumReadDirection::Backward; } -// else if ( $this->_readDirection == EnumReadDirection::Backward ) else if ( $this->_sortOrder == EnumSortingOrder::Descending ) { // Move to the beginning of the file! @@ -511,6 +510,14 @@ class LogStreamDisk extends LogStream { // Save the current UID as LastPage UID! $this->_lastPageUID = $myuid; + + // --- Restore reading direction and file position! + $this->_readDirection = $tmpOldDirection; + if ( $this->_readDirection == EnumReadDirection::Forward ) + $this->Sseek($myuid, EnumSeek::BOS, 0); + else + $this->Sseek($myuid, EnumSeek::EOS, 0); + // --- // Return result! return $this->_lastPageUID; diff --git a/src/classes/logstreampdo.class.php b/src/classes/logstreampdo.class.php index f512739..5ea4a7e 100644 --- a/src/classes/logstreampdo.class.php +++ b/src/classes/logstreampdo.class.php @@ -57,6 +57,7 @@ class LogStreamPDO extends LogStream { private $_currentPageNumber = -1; private $_SQLwhereClause = ""; + private $_myDBQuery = null; // Constructor public function LogStreamPDO($streamConfigObj) { @@ -128,6 +129,10 @@ class LogStreamPDO extends LogStream { // Create SQL Where Clause first! $this->CreateSQLWhereClause(); + // Only obtain rowcount if enabled and not done before + if ( $this->_logStreamConfigObj->DBEnableRowCounting && $this->_totalRecordCount == -1 ) + $this->_totalRecordCount = $this->GetRowCountFromTable(); + // Success, this means we init the Pagenumber to ONE! //$this->_currentPageNumber = 1; @@ -142,9 +147,12 @@ class LogStreamPDO extends LogStream { */ public function Close() { - if ( $this->_dbhandle != null ) - unset($this->_dbhandle); - return SUCCESS; + // trigger closing database query! + $this->DestroyMainSQLQuery(); + +// TODO CLOSE DB CONN?! + + return true; } /** @@ -208,7 +216,7 @@ class LogStreamPDO extends LogStream { // Now read new ones $ret = $this->ReadNextRecordsFromDB($uID); -echo "mowl2"; +//echo "1mowl " . $this->_currentRecordStart . "=" . $this->_currentRecordNum; if ( !isset($this->bufferedRecords[$this->_currentRecordNum] ) ) $ret = ERROR_NOMORERECORDS; @@ -607,74 +615,95 @@ echo "mowl2"; return SUCCESS; } + /* + * Create the SQL QUery! + */ + private function CreateMainSQLQuery($uID) + { + global $querycount; + + // create query if necessary! + if ( $this->_myDBQuery == null ) + { + // Get SQL Statement + $szSql = $this->CreateSQLStatement($uID); + + // Perform Database Query + $this->_myDBQuery = $this->_dbhandle->query($szSql); + if ( !$this->_myDBQuery ) + { + $this->PrintDebugError("Invalid SQL: ".$szSql); + return ERROR_DB_QUERYFAILED; + } + + // Increment for the Footer Stats + $querycount++; + } + + // return success state if reached this point! + return SUCCESS; + } + + /* + * Destroy the SQL QUery! + */ + private function DestroyMainSQLQuery() + { + // create query if necessary! + if ( $this->_myDBQuery != null ) + { + // Free Query ressources + // $this->_myDBQuery->closeCursor(); + $this->_myDBQuery = null; + } + + // return success state if reached this point! + return SUCCESS; + } /* * This helper function will read the next records into the buffer. */ private function ReadNextRecordsFromDB($uID) { - global $querycount; - - // Get SQL Statement - $szSql = $this->CreateSQLStatement($uID); - - // Append LIMIT clause -//$szSql .= " LIMIT " . $this->_currentRecordStart . ", " . $this->_logStreamConfigObj->RecordsPerQuery; - - // Perform Database Query - $myquery = $this->_dbhandle->query($szSql); - if ( !$myquery ) + // Create query if necessary + if ( $this->_myDBQuery == null ) { - $this->PrintDebugError("Invalid SQL: ".$szSql); - return ERROR_DB_QUERYFAILED; + // return error if there was one! + if ( ($res = $this->CreateMainSQLQuery($uID)) != SUCCESS ) + return $res; } - + // Copy rows into the buffer! $iBegin = $this->_currentRecordNum; -// $result = $myquery->setFetchMode(PDO::FETCH_ASSOC); - $iCount = 0; while( $this->_logStreamConfigObj->RecordsPerQuery > $iCount ) { //Obtain next record - $myRow = $myquery->fetch(PDO::FETCH_ASSOC); -// if ( $iCount >= $this->_currentRecordStart ) -// { -// print_r( $iCount ); -// exit; - $this->bufferedRecords[$iBegin] = $myRow; - $iBegin++; -// } + $myRow = $this->_myDBQuery->fetch(PDO::FETCH_ASSOC); + + // Check if result was successfull! + if ( $myRow === FALSE ) + break; + + $this->bufferedRecords[$iBegin] = $myRow; + $iBegin++; // Increment counter $iCount++; } + /* - foreach ($myquery as $myRow) - { - $this->bufferedRecords[$iBegin] = $myRow; - $iBegin++; - } -*/ - - // Free Query ressources -// $myquery->closeCursor(); - $myquery = null; - - // Only obtain count if enabled and not done before if ( $this->_logStreamConfigObj->DBEnableRowCounting && $this->_totalRecordCount == -1 ) { $this->_totalRecordCount = $this->GetRowCountFromTable(); - if ( $this->_totalRecordCount <= 0 ) - return ERROR_NOMORERECORDS; +// if ( $this->_totalRecordCount <= 0 ) +// return ERROR_NOMORERECORDS; } - - // Increment for the Footer Stats - $querycount++; - +*/ // return success state if reached this point! return SUCCESS; } @@ -822,7 +851,10 @@ echo "mowl2"; $myQuery->closeCursor(); } else + { + $this->PrintDebugError("RowCount query failed: " . $szSql); $numRows = -1; + } // return result! return $numRows; diff --git a/src/index.php b/src/index.php index eebabf2..d0ac432 100644 --- a/src/index.php +++ b/src/index.php @@ -230,9 +230,12 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c if ( $res == SUCCESS ) { // TODO Implement ORDER - $stream->SetReadDirection($content['read_direction']); - + + // Read First and LAST UID's before start reading the stream! + $content['uid_last'] = $stream->GetLastPageUID(); + $content['uid_first'] = $stream->GetFirstPageUID(); + // Set current ID and init Counter $uID = $content['uid_current']; $counter = 0; @@ -245,7 +248,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c } else $ret = $stream->ReadNext($uID, $logArray); - + // --- Check if Read was successfull! if ( $ret == SUCCESS ) { @@ -617,10 +620,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // --- // --- Handle uid_last page button - // Option the last UID from the stream! - $content['uid_last'] = $stream->GetLastPageUID(); - $content['uid_first'] = $stream->GetFirstPageUID(); - +//!!!!!!!! // if we found a last uid, and if it is not the current one (which means we already are on the last page ;)! if ( $content['uid_last'] != -1 && $content['uid_last'] != $content['uid_current']) $content['main_pager_last_found'] = true; From b2fefbaf3fe920bb8d9389e5aa4c3cd69867c86f Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 23 May 2008 17:33:14 +0200 Subject: [PATCH 38/79] Added new PDO Database logstream into install script. This means you can select now between the native MYSQL Server and the PDO database driver. When using the PDO database driver, you choose between different database storage engines. --- src/include/constants_logstream.php | 2 + src/include/functions_common.php | 59 ++++++++++++++++++++++++----- src/install.php | 50 +++++++++++++++--------- src/js/common.js | 24 ++++++++++++ src/lang/de/main.php | 9 +++++ src/lang/en/main.php | 13 ++++++- src/templates/install.html | 55 ++++++++++++++++++++++----- 7 files changed, 175 insertions(+), 37 deletions(-) diff --git a/src/include/constants_logstream.php b/src/include/constants_logstream.php index f4056bd..79eb224 100644 --- a/src/include/constants_logstream.php +++ b/src/include/constants_logstream.php @@ -75,6 +75,8 @@ define('DB_OCI', 4); define('DB_DB2', 5); define('DB_FIREBIRD', 6); define('DB_INFORMIX', 7); +define('DB_SQLITE', 8); + // --- Predefine fields array! $fields[SYSLOG_UID]['FieldID'] = SYSLOG_UID; diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 3e5ee92..6bf22e1 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -236,10 +236,15 @@ function CreateSourceTypesList( $selectedSource ) $content['SOURCETYPES'][SOURCE_DISK]['DisplayName'] = $content['LN_GEN_SOURCE_DISK']; if ( $selectedSource == $content['SOURCETYPES'][SOURCE_DISK]['type'] ) { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = ""; } - // SOURCE_DB + // SOURCE_DB ( MYSQL NATIVE ) $content['SOURCETYPES'][SOURCE_DB]['type'] = SOURCE_DB; $content['SOURCETYPES'][SOURCE_DB]['DisplayName'] = $content['LN_GEN_SOURCE_DB']; - if ( $selectedSource == $content['SOURCETYPES'][SOURCE_DB]['type'] ) { $content['SOURCETYPES'][SOURCE_DB]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = ""; } + if ( $selectedSource == $content['SOURCETYPES'][SOURCE_DB]['type'] ) { $content['SOURCETYPES'][SOURCE_DB]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_DB]['selected'] = ""; } + + // SOURCE_PDO ( PDO DB Wrapper) + $content['SOURCETYPES'][SOURCE_PDO]['type'] = SOURCE_PDO; + $content['SOURCETYPES'][SOURCE_PDO]['DisplayName'] = $content['LN_GEN_SOURCE_PDO']; + if ( $selectedSource == $content['SOURCETYPES'][SOURCE_PDO]['type'] ) { $content['SOURCETYPES'][SOURCE_PDO]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_PDO]['selected'] = ""; } } function CreateDBTypesList( $selectedDBType ) @@ -248,21 +253,57 @@ function CreateDBTypesList( $selectedDBType ) // DB_MYSQL $content['DBTYPES'][DB_MYSQL]['type'] = DB_MYSQL; - $content['DBTYPES'][DB_MYSQL]['DisplayName'] = "Mysql"; + $content['DBTYPES'][DB_MYSQL]['typeastext'] = "DB_MYSQL"; + $content['DBTYPES'][DB_MYSQL]['DisplayName'] = $content['LN_GEN_DB_MYSQL']; if ( $selectedDBType == $content['DBTYPES'][DB_MYSQL]['type'] ) { $content['DBTYPES'][DB_MYSQL]['selected'] = "selected"; } else { $content['DBTYPES'][DB_MYSQL]['selected'] = ""; } -/* LATER ... // DB_MSSQL $content['DBTYPES'][DB_MSSQL]['type'] = DB_MSSQL; - $content['DBTYPES'][DB_MSSQL]['DisplayName'] = "Microsoft SQL Server"; + $content['DBTYPES'][DB_MSSQL]['typeastext'] = "DB_MSSQL"; + $content['DBTYPES'][DB_MSSQL]['DisplayName'] = $content['LN_GEN_DB_MSSQL']; if ( $selectedDBType == $content['DBTYPES'][DB_MSSQL]['type'] ) { $content['DBTYPES'][DB_MSSQL]['selected'] = "selected"; } else { $content['DBTYPES'][DB_MSSQL]['selected'] = ""; } // DB_ODBC - $content['DBTYPES'][DB_ODBC]['type'] = DB_MSSQL; - $content['DBTYPES'][DB_ODBC]['DisplayName'] = "ODBC Database Source"; - if ( $selectedDBType == $content['DBTYPES'][DB_ODBC]['type'] ) { $content['DBTYPES'][DB_ODBC]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_MSSQL]['selected'] = ""; } -*/ + $content['DBTYPES'][DB_ODBC]['type'] = DB_ODBC; + $content['DBTYPES'][DB_ODBC]['typeastext'] = "DB_ODBC"; + $content['DBTYPES'][DB_ODBC]['DisplayName'] = $content['LN_GEN_DB_ODBC']; + if ( $selectedDBType == $content['DBTYPES'][DB_ODBC]['type'] ) { $content['DBTYPES'][DB_ODBC]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_ODBC]['selected'] = ""; } + // DB_PGSQL + $content['DBTYPES'][DB_PGSQL]['type'] = DB_PGSQL; + $content['DBTYPES'][DB_PGSQL]['typeastext'] = "DB_PGSQL"; + $content['DBTYPES'][DB_PGSQL]['DisplayName'] = $content['LN_GEN_DB_PGSQL']; + if ( $selectedDBType == $content['DBTYPES'][DB_PGSQL]['type'] ) { $content['DBTYPES'][DB_PGSQL]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_PGSQL]['selected'] = ""; } + + // DB_OCI + $content['DBTYPES'][DB_OCI]['type'] = DB_OCI; + $content['DBTYPES'][DB_OCI]['typeastext'] = "DB_OCI"; + $content['DBTYPES'][DB_OCI]['DisplayName'] = $content['LN_GEN_DB_OCI']; + if ( $selectedDBType == $content['DBTYPES'][DB_OCI]['type'] ) { $content['DBTYPES'][DB_OCI]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_OCI]['selected'] = ""; } + + // DB_DB2 + $content['DBTYPES'][DB_DB2]['type'] = DB_DB2; + $content['DBTYPES'][DB_DB2]['typeastext'] = "DB_DB2"; + $content['DBTYPES'][DB_DB2]['DisplayName'] = $content['LN_GEN_DB_DB2']; + if ( $selectedDBType == $content['DBTYPES'][DB_DB2]['type'] ) { $content['DBTYPES'][DB_DB2]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_DB2]['selected'] = ""; } + + // DB_FIREBIRD + $content['DBTYPES'][DB_FIREBIRD]['type'] = DB_FIREBIRD; + $content['DBTYPES'][DB_FIREBIRD]['typeastext'] = "DB_FIREBIRD"; + $content['DBTYPES'][DB_FIREBIRD]['DisplayName'] = $content['LN_GEN_DB_FIREBIRD']; + if ( $selectedDBType == $content['DBTYPES'][DB_FIREBIRD]['type'] ) { $content['DBTYPES'][DB_FIREBIRD]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_FIREBIRD]['selected'] = ""; } + + // DB_INFORMIX + $content['DBTYPES'][DB_INFORMIX]['type'] = DB_INFORMIX; + $content['DBTYPES'][DB_INFORMIX]['typeastext'] = "DB_INFORMIX"; + $content['DBTYPES'][DB_INFORMIX]['DisplayName'] = $content['LN_GEN_DB_INFORMIX']; + if ( $selectedDBType == $content['DBTYPES'][DB_INFORMIX]['type'] ) { $content['DBTYPES'][DB_INFORMIX]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_INFORMIX]['selected'] = ""; } + + // DB_SQLITE + $content['DBTYPES'][DB_SQLITE]['type'] = DB_SQLITE; + $content['DBTYPES'][DB_SQLITE]['typeastext'] = "DB_SQLITE"; + $content['DBTYPES'][DB_SQLITE]['DisplayName'] = $content['LN_GEN_DB_SQLITE']; + if ( $selectedDBType == $content['DBTYPES'][DB_SQLITE]['type'] ) { $content['DBTYPES'][DB_SQLITE]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_SQLITE]['selected'] = ""; } } function CreatePagesizesList() diff --git a/src/install.php b/src/install.php index 10f79df..d6b00e5 100644 --- a/src/install.php +++ b/src/install.php @@ -347,7 +347,7 @@ else if ( $content['INSTALL_STEP'] == 5 ) $totaldbdefs = str_replace( "`logcon_", "`" . $_SESSION["UserDBPref"], $totaldbdefs ); // Now split by sql command - $mycommands = split( ";\r\n", $totaldbdefs ); + $mycommands = split( ";\n", $totaldbdefs ); // check for different linefeed if ( count($mycommands) <= 1 ) @@ -527,7 +527,7 @@ else if ( $content['INSTALL_STEP'] == 8 ) if ( !is_file($_SESSION['SourceDiskFile']) ) RevertOneStep( $content['INSTALL_STEP']-1, "Failed to open the syslog file " .$_SESSION['SourceDiskFile'] . "! Check if the file exists and phplogcon has sufficient rights to it
      " ); } - else if ( $_SESSION['SourceType'] == SOURCE_DB) + else if ( $_SESSION['SourceType'] == SOURCE_DB || $_SESSION['SourceType'] == SOURCE_PDO ) { if ( isset($_POST['SourceDBType']) ) $_SESSION['SourceDBType'] = DB_RemoveBadChars($_POST['SourceDBType']); @@ -594,26 +594,42 @@ else if ( $content['INSTALL_STEP'] == 8 ) } //Add the first source! - $firstsource = "\$CFG['DefaultSourceID'] = 'Source1';\r\n\r\n" . - "\$CFG['Sources']['Source1']['ID'] = 'Source1';\r\n" . - "\$CFG['Sources']['Source1']['Name'] = '" . $_SESSION['SourceName'] . "';\r\n" . - "\$CFG['Sources']['Source1']['SourceType'] = " . $_SESSION['SourceType'] . ";\r\n"; + $firstsource = "\$CFG['DefaultSourceID'] = 'Source1';\n\n" . + "\$CFG['Sources']['Source1']['ID'] = 'Source1';\n" . + "\$CFG['Sources']['Source1']['Name'] = '" . $_SESSION['SourceName'] . "';\n"; if ( $_SESSION['SourceType'] == SOURCE_DISK ) { - $firstsource .= "\$CFG['Sources']['Source1']['LogLineType'] = '" . $_SESSION['SourceLogLineType'] . "';\r\n" . - "\$CFG['Sources']['Source1']['DiskFile'] = '" . $_SESSION['SourceDiskFile'] . "';\r\n" . + $firstsource .= "\$CFG['Sources']['Source1']['SourceType'] = SOURCE_DISK;\n" . + "\$CFG['Sources']['Source1']['LogLineType'] = '" . $_SESSION['SourceLogLineType'] . "';\n" . + "\$CFG['Sources']['Source1']['DiskFile'] = '" . $_SESSION['SourceDiskFile'] . "';\n" . ""; } - else if ( $_SESSION['SourceType'] == SOURCE_DB ) + else if ( $_SESSION['SourceType'] == SOURCE_DB ) { - $firstsource .= "\$CFG['Sources']['Source1']['DBTableType'] = '" . $_SESSION['SourceDBTableType'] . "';\r\n" . - "\$CFG['Sources']['Source1']['DBType'] = '" . $_SESSION['SourceDBType'] . "';\r\n" . - "\$CFG['Sources']['Source1']['DBServer'] = '" . $_SESSION['SourceDBServer'] . "';\r\n" . - "\$CFG['Sources']['Source1']['DBName'] = '" . $_SESSION['SourceDBName'] . "';\r\n" . - "\$CFG['Sources']['Source1']['DBUser'] = '" . $_SESSION['SourceDBUser'] . "';\r\n" . - "\$CFG['Sources']['Source1']['DBPassword'] = '" . $_SESSION['SourceDBPassword'] . "';\r\n" . - "\$CFG['Sources']['Source1']['DBTableName'] = '" . $_SESSION['SourceDBTableName'] . "';\r\n" . - "\$CFG['Sources']['Source1']['DBEnableRowCounting'] = " . $_SESSION['SourceDBEnableRowCounting'] . ";\r\n" . + $firstsource .= "\$CFG['Sources']['Source1']['SourceType'] = SOURCE_DB;\n" . + "\$CFG['Sources']['Source1']['DBTableType'] = '" . $_SESSION['SourceDBTableType'] . "';\n" . + "\$CFG['Sources']['Source1']['DBServer'] = '" . $_SESSION['SourceDBServer'] . "';\n" . + "\$CFG['Sources']['Source1']['DBName'] = '" . $_SESSION['SourceDBName'] . "';\n" . + "\$CFG['Sources']['Source1']['DBUser'] = '" . $_SESSION['SourceDBUser'] . "';\n" . + "\$CFG['Sources']['Source1']['DBPassword'] = '" . $_SESSION['SourceDBPassword'] . "';\n" . + "\$CFG['Sources']['Source1']['DBTableName'] = '" . $_SESSION['SourceDBTableName'] . "';\n" . + "\$CFG['Sources']['Source1']['DBEnableRowCounting'] = " . $_SESSION['SourceDBEnableRowCounting'] . ";\n" . + ""; + } + else if ( $_SESSION['SourceType'] == SOURCE_PDO ) + { + // Need to create the LIST first! + CreateDBTypesList($_SESSION['SourceDBType']); + + $firstsource .= "\$CFG['Sources']['Source1']['SourceType'] = SOURCE_PDO;\n" . + "\$CFG['Sources']['Source1']['DBTableType'] = '" . $_SESSION['SourceDBTableType'] . "';\n" . + "\$CFG['Sources']['Source1']['DBType'] = " . $content['DBTYPES'][$_SESSION['SourceDBType']]['typeastext'] . ";\n" . + "\$CFG['Sources']['Source1']['DBServer'] = '" . $_SESSION['SourceDBServer'] . "';\n" . + "\$CFG['Sources']['Source1']['DBName'] = '" . $_SESSION['SourceDBName'] . "';\n" . + "\$CFG['Sources']['Source1']['DBUser'] = '" . $_SESSION['SourceDBUser'] . "';\n" . + "\$CFG['Sources']['Source1']['DBPassword'] = '" . $_SESSION['SourceDBPassword'] . "';\n" . + "\$CFG['Sources']['Source1']['DBTableName'] = '" . $_SESSION['SourceDBTableName'] . "';\n" . + "\$CFG['Sources']['Source1']['DBEnableRowCounting'] = " . $_SESSION['SourceDBEnableRowCounting'] . ";\n" . ""; } $patterns[] = "/\/\/ --- \%Insert Source Here\%/"; diff --git a/src/js/common.js b/src/js/common.js index 46137bf..fef542a 100644 --- a/src/js/common.js +++ b/src/js/common.js @@ -67,6 +67,30 @@ function togglevisibility(ElementNameToggle, ElementNameButton) } } +/* +* Helper function to hide a div area +*/ +function showvisibility(ElementNameToggle, ElementNameButton) +{ + var toggle = document.getElementById(ElementNameToggle); + + // Button is optional + if (ElementNameButton != null) + { + var button = document.getElementById(ElementNameButton); + } + else + var button = null; + + if (button != null) + { + button.className = "topmenu2 ExpansionMinus"; + } + + toggle.style.visibility = "visible"; + toggle.style.display = "inline"; +} + /* * Helper function to hide a div area */ diff --git a/src/lang/de/main.php b/src/lang/de/main.php index 6ac4cbc..d169e0c 100644 --- a/src/lang/de/main.php +++ b/src/lang/de/main.php @@ -46,6 +46,15 @@ $content['LN_GEN_SOURCE_DB'] = "Datenbank"; $content['LN_GEN_RECORDSPERPAGE'] = "records per page"; $content['LN_GEN_PRECONFIGURED'] = "Preconfigured"; $content['LN_GEN_AVAILABLESEARCHES'] = "Available searches"; + $content['LN_GEN_DB_MYSQL'] = "Mysql Server"; + $content['LN_GEN_DB_MSSQL'] = "Microsoft SQL Server"; + $content['LN_GEN_DB_ODBC'] = "ODBC Database Source"; + $content['LN_GEN_DB_PGSQL'] = "PostgreSQL"; + $content['LN_GEN_DB_OCI'] = "Oracle Call Interface"; + $content['LN_GEN_DB_DB2'] = " IBM DB2"; + $content['LN_GEN_DB_FIREBIRD'] = "Firebird/Interbase 6"; + $content['LN_GEN_DB_INFORMIX'] = "IBM Informix Dynamic Server"; + $content['LN_GEN_DB_SQLITE'] = "SQLite 2"; // Index Site $content['LN_ERROR_INSTALLFILEREMINDER'] = "Warnung! Du hast das Installationsscript 'install.php' noch nicht aus dem phpLogCon Hauptordner entfernt!"; diff --git a/src/lang/en/main.php b/src/lang/en/main.php index 52ba085..b84919d 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -42,11 +42,20 @@ $content['LN_GEN_PAGERSIZE'] = "Records per page"; $content['LN_GEN_PAGE'] = "Page"; $content['LN_GEN_PREDEFINEDSEARCHES'] = "Predefined Searches"; $content['LN_GEN_SOURCE_DISK'] = "Diskfile"; -$content['LN_GEN_SOURCE_DB'] = "Database"; +$content['LN_GEN_SOURCE_DB'] = "MYSQL Native"; +$content['LN_GEN_SOURCE_PDO'] = "Database (PDO)"; $content['LN_GEN_RECORDSPERPAGE'] = "records per page"; $content['LN_GEN_PRECONFIGURED'] = "Preconfigured"; $content['LN_GEN_AVAILABLESEARCHES'] = "Available searches"; - +$content['LN_GEN_DB_MYSQL'] = "Mysql Server"; +$content['LN_GEN_DB_MSSQL'] = "Microsoft SQL Server"; +$content['LN_GEN_DB_ODBC'] = "ODBC Database Source"; +$content['LN_GEN_DB_PGSQL'] = "PostgreSQL"; +$content['LN_GEN_DB_OCI'] = "Oracle Call Interface"; +$content['LN_GEN_DB_DB2'] = " IBM DB2"; +$content['LN_GEN_DB_FIREBIRD'] = "Firebird/Interbase 6"; +$content['LN_GEN_DB_INFORMIX'] = "IBM Informix Dynamic Server"; +$content['LN_GEN_DB_SQLITE'] = "SQLite 2"; // Main Index Site $content['LN_ERROR_INSTALLFILEREMINDER'] = "Warning! You still have NOT removed the 'install.php' from your phpLogCon main directory!"; diff --git a/src/templates/install.html b/src/templates/install.html index ccea573..75e40d5 100644 --- a/src/templates/install.html +++ b/src/templates/install.html @@ -8,6 +8,35 @@ + + @@ -265,7 +294,7 @@ - +
      {LN_CFG_SOURCETYPE} - @@ -278,7 +307,7 @@ - + diff --git a/src/themes/default/main.css b/src/themes/default/main.css index 745543e..8614e4a 100644 --- a/src/themes/default/main.css +++ b/src/themes/default/main.css @@ -32,6 +32,25 @@ a:hover font-weight:bold; color:#FF0000; } +/*---*/ + +/* Context Link Classes */ +a.contextlink:link,a.contextlink:active,a.contextlink:visited,a.contextlink +{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight:bold; + background-color: transparent; + color:#3814BB; + text-decoration:underline; +} +a.contextlink:hover +{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight:bold; + color:#3844FF; + text-decoration:none; +} +/*---*/ img { From 53d4e72bbf02247d4e2a0da4c3d7b73d8f456b31 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 2 Jun 2008 13:35:33 +0200 Subject: [PATCH 43/79] Fixed and enhanced new context links. --- src/details.php | 4 ++++ src/include/functions_common.php | 25 ++++++++++++++++++++----- src/index.php | 12 ++++++++---- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/src/details.php b/src/details.php index 8262c33..4e3a4b4 100644 --- a/src/details.php +++ b/src/details.php @@ -248,6 +248,10 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['uid_current' $content['fields'][$mycolkey]['fieldvalue'] = GetStringWithHTMLCodes($logArray[$mycolkey]); else // kindly copy! $content['fields'][$mycolkey]['fieldvalue'] = $logArray[$mycolkey]; + + // --- HOOK here to add context links! + AddContextLinks($content['fields'][$mycolkey]['fieldvalue']); + // --- } // Increment helpcounter diff --git a/src/include/functions_common.php b/src/include/functions_common.php index f35f6c6..ac8a040 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -852,28 +852,43 @@ function GetMonthFromString($szMonth) /* * AddContextLinks */ -function AddContextLinks($sourceTxt) +function AddContextLinks(&$sourceTxt) { + global $szTLDDomains; + + // Create if not set! + if ( !isset($szTLDDomains) ) + CreateTopLevelDomainSearch(); + // Create Search Array $search = array ( + '/\.([\w\d\_]+)\.(' . $szTLDDomains . ')([^a-zA-Z0-9])/x', '|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|', -// '/([\w\d\_\/]+)\.(de|com)/x', ); // Create Replace Array $replace = array ( + '.$1.$2$3', '$1', -// '$1.$2', ); // Replace and return! - $outTxt = preg_replace( $search, $replace, $sourceTxt ); + $sourceTxt = preg_replace( $search, $replace, $sourceTxt ); //echo $outTxt . "
      " ; +//return $outTxt; +} - return $outTxt; +/* +* Helper function to create a top level domain search string ONCE per process! +*/ +function CreateTopLevelDomainSearch() +{ + // Current list taken from http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains! + global $szTLDDomains; + $szTLDDomains = "aero|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel|cTLD|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw"; } // --- BEGIN Usermanagement Function --- diff --git a/src/index.php b/src/index.php index 4c89cb4..3835bd7 100644 --- a/src/index.php +++ b/src/index.php @@ -457,14 +457,14 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = ""; } - // --- HOOK here to add context links! - $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = AddContextLinks($content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue']); - // --- - // If we need to highlight some words ^^! if ( isset($content['highlightwords']) ) $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = HighLightString( $content['highlightwords'], $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] ); + // --- HOOK here to add context links! + AddContextLinks($content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue']); + // --- + if ( isset($CFG['ViewEnableDetailPopups']) && $CFG['ViewEnableDetailPopups'] == 1 ) { $content['syslogmessages'][$counter]['values'][$mycolkey]['popupcaption'] = GetAndReplaceLangStr( $content['LN_GRID_POPUPDETAILS'], $logArray[SYSLOG_UID]); @@ -492,6 +492,10 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c $content['syslogmessages'][$counter]['values'][$mycolkey]['messagesdetails'][$myIndex]['detailfieldvalue'] = HighLightString( $content['highlightwords'],GetStringWithHTMLCodes($logArray[SYSLOG_MESSAGE]) ); else $content['syslogmessages'][$counter]['values'][$mycolkey]['messagesdetails'][$myIndex]['detailfieldvalue'] = GetStringWithHTMLCodes($logArray[SYSLOG_MESSAGE]); + + // --- HOOK here to add context links! + AddContextLinks( $content['syslogmessages'][$counter]['values'][$mycolkey]['messagesdetails'][$myIndex]['detailfieldvalue'] ); + // --- } else // Just set field value $content['syslogmessages'][$counter]['values'][$mycolkey]['messagesdetails'][$myIndex]['detailfieldvalue'] = $myfield['fieldvalue']; From 1c315a38a37bd6c81ba9028e2f8bfdbccbda1e38 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 2 Jun 2008 16:49:28 +0200 Subject: [PATCH 44/79] Adjusted links a little bit --- src/include/functions_common.php | 4 ++-- src/index.php | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index ac8a040..f9f11a5 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -870,8 +870,8 @@ function AddContextLinks(&$sourceTxt) // Create Replace Array $replace = array ( - '.$1.$2$3', - '$1', + '.$1.$2$3', + '$1', ); // Replace and return! diff --git a/src/index.php b/src/index.php index 3835bd7..8b3a6fd 100644 --- a/src/index.php +++ b/src/index.php @@ -357,7 +357,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&oid=' . SYSLOG_FACILITY . '&q=' . GetFacilityDisplayName($logArray[$mycolkey]), + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=' . SYSLOG_FACILITY . '&q=' . GetFacilityDisplayName($logArray[$mycolkey]), 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_FACILITY'] . " '" . GetFacilityDisplayName($logArray[$mycolkey]) . "'", 'IconSource' => $content['MENU_NETWORK'] ); @@ -386,7 +386,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&oid=' . SYSLOG_SEVERITY . '&q=' . GetSeverityDisplayName($logArray[$mycolkey]), + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=' . SYSLOG_SEVERITY . '&q=' . GetSeverityDisplayName($logArray[$mycolkey]), 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_SEVERITY'] . " '" . GetSeverityDisplayName($logArray[$mycolkey]) . "'", 'IconSource' => $content['MENU_NETWORK'] ); @@ -426,7 +426,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&oid=' . SYSLOG_EVENT_ID . '&q=' . $logArray[$mycolkey], + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=' . SYSLOG_EVENT_ID . '&q=' . $logArray[$mycolkey], 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTID'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); @@ -524,7 +524,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&oid=' . SYSLOG_SYSLOGTAG . '&q=' . $logArray[$mycolkey], + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=' . SYSLOG_SYSLOGTAG . '&q=' . $logArray[$mycolkey], 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_SYSLOGTAG'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); @@ -550,7 +550,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&oid=' . SYSLOG_EVENT_LOGTYPE . '&q=' . $logArray[$mycolkey], + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=' . SYSLOG_EVENT_LOGTYPE . '&q=' . $logArray[$mycolkey], 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTLOGTYPE'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); @@ -565,7 +565,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&oid=' . SYSLOG_EVENT_SOURCE . '&q=' . $logArray[$mycolkey], + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=' . SYSLOG_EVENT_SOURCE . '&q=' . $logArray[$mycolkey], 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTSOURCE'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); From 08cdc7fb20372144ed82e93a2f8bb32c11dd2701 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 2 Jun 2008 16:53:26 +0200 Subject: [PATCH 45/79] Added stylesheet defs into dark style --- src/themes/dark/main.css | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/themes/dark/main.css b/src/themes/dark/main.css index 6e48e43..0df4626 100644 --- a/src/themes/dark/main.css +++ b/src/themes/dark/main.css @@ -63,6 +63,24 @@ A.title:hover TEXT-DECORATION: none; } +/* Context Link Classes */ +a.contextlink:link,a.contextlink:active,a.contextlink:visited,a.contextlink +{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight:bold; + background-color: transparent; + color:#FF9900; + text-decoration:underline; +} +a.contextlink:hover +{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight:bold; + color:#FF9900; + text-decoration:none; +} +/*---*/ + /* Default Font Classes */ font { From cf6f9b454e8a45b5f9911cbb3b6433cebfec082b Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 2 Jun 2008 17:08:31 +0200 Subject: [PATCH 46/79] Added changelog entry and incremented Version number --- ChangeLog | 8 ++++++++ src/include/functions_common.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 79cf798..0f32e88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,12 @@ --------------------------------------------------------------------------- +Version 2.3.4 (devel), 2008-06-02 +- Added new feature to automatically link IP and domain names with our + whois search engine. So you can research these informations with one + click. +- Changed Online Search Parameters. For Eventlog related search links, + you will now directly directed to entries in our knowledge base, if + found. +--------------------------------------------------------------------------- Version 2.3.3 (devel), 2008-05-23 - Initial Added the new DB Driver (Logstream) which uses PHP PDO. PDO is the latest generic database interface for PHP5 and recommended diff --git a/src/include/functions_common.php b/src/include/functions_common.php index f9f11a5..4d0ff0c 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -73,7 +73,7 @@ $LANG_EN = "en"; // Used for fallback $LANG = "en"; // Default language // Default Template vars -$content['BUILDNUMBER'] = "2.3.3"; +$content['BUILDNUMBER'] = "2.3.4"; $content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title $content['BASEPATH'] = $gl_root_path; $content['EXTRA_METATAGS'] = ""; From c49fbd56a4c6ba3f4920e10f09783d2b556ffbad Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 6 Jun 2008 15:35:00 +0200 Subject: [PATCH 47/79] Added new feature to resolve IP Addresses into DNS Names and display them. - The DNS Names will be injected in into the message text displayed in brackets like 172.16.0.1 {server.something.xxx}. This feature can be turned of in the configuration file. - Removed some stylesheet bugs in the main display related to the menu. - optimized automatic linking for IP Addresses. --- src/css/menu.css | 1 + src/include/config.sample.php | 2 ++ src/include/functions_common.php | 57 +++++++++++++++++++++++++++++--- src/lang/de/main.php | 1 + src/lang/en/main.php | 1 + src/templates/index.html | 54 +++++++++++++++--------------- src/themes/dark/main.css | 6 ++++ src/themes/default/main.css | 6 ++++ 8 files changed, 96 insertions(+), 32 deletions(-) diff --git a/src/css/menu.css b/src/css/menu.css index 277a3ad..4066524 100644 --- a/src/css/menu.css +++ b/src/css/menu.css @@ -4,6 +4,7 @@ } #menu ul { /* remove bullets and list indents */ + position: absolute; list-style: none; margin: 0; padding: 0; diff --git a/src/include/config.sample.php b/src/include/config.sample.php index 34483d6..56ac775 100644 --- a/src/include/config.sample.php +++ b/src/include/config.sample.php @@ -68,6 +68,8 @@ $CFG['ViewEnableAutoReloadSeconds'] = 0; // If "ViewEnableAutoReloadSeconds" is $CFG['SearchCustomButtonCaption'] = "I'd like to feel sad"; // Default caption for the custom fast search button $CFG['SearchCustomButtonSearch'] = "error"; // Default search string for the custom search button + +$CFG['EnableIPAddressResolve'] = 1; // If enabled, IP Addresses inline messages are automatically resolved and the result is added in brackets {} behind the IP Address // --- // --- Define which fields you want to see diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 4d0ff0c..3c7554f 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -397,10 +397,13 @@ function InitPhpDebugMode() function CheckAndSetRunMode() { - global $RUNMODE; + global $RUNMODE, $MaxExecutionTime; // Set to command line mode if argv is set! if ( !isset($_SERVER["GATEWAY_INTERFACE"]) ) $RUNMODE = RUNMODE_COMMANDLINE; + + // Obtain max_execution_time + $MaxExecutionTime = ini_get("max_execution_time"); } function InitRuntimeInformations() @@ -854,8 +857,15 @@ function GetMonthFromString($szMonth) */ function AddContextLinks(&$sourceTxt) { - global $szTLDDomains; + global $szTLDDomains, $CFG; + // Return if not enabled! + if ( !isset($CFG['EnableIPAddressResolve']) || $CFG['EnableIPAddressResolve'] == 1 ) + { + // Search for IP's and Add Reverse Lookup first! + $sourceTxt = preg_replace( '/\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/e', "'\\1.\\2.\\3.\\4' . ReverseResolveIP('\\1.\\2.\\3.\\4', ' {', '} ')", $sourceTxt ); + } + // Create if not set! if ( !isset($szTLDDomains) ) CreateTopLevelDomainSearch(); @@ -864,14 +874,15 @@ function AddContextLinks(&$sourceTxt) $search = array ( '/\.([\w\d\_]+)\.(' . $szTLDDomains . ')([^a-zA-Z0-9])/x', - '|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|', +// '|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|', + '/\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/x', ); // Create Replace Array $replace = array ( '.$1.$2$3', - '$1', + '$1.$2.$3.$4', ); // Replace and return! @@ -881,6 +892,44 @@ function AddContextLinks(&$sourceTxt) //return $outTxt; } +/* +* Reserve Resolve IP Address! +*/ +function ReverseResolveIP( $szIP, $prepend, $append ) +{ + global $gl_starttime, $MaxExecutionTime; + + // Substract 5 savety seconds! + $scriptruntime = intval(microtime_float() - $gl_starttime); + if ( $scriptruntime > ($MaxExecutionTime-5) ) + { +echo "WTF $scriptruntime - $MaxExecutionTime"; + return ""; + } + + // Abort if these IP's are postet + if ( strpos("0.0.0.0", $szIP) !== false | strpos("127.", $szIP) !== false | strpos("255.255.255.255", $szIP) !== false ) + return ""; + else + { + // Resolve name if needed + if ( !isset($_SESSION['dns_cache'][$szIP]) ) + $_SESSION['dns_cache'][$szIP] = gethostbyaddr($szIP); + + // Abort if IP and RESOLVED name are the same ^^! + if ( $_SESSION['dns_cache'][$szIP] == $szIP ) + return; + + // Create string + $szReturn = $prepend; + $szReturn .= $_SESSION['dns_cache'][$szIP]; + $szReturn .= $append; + + // return result + return $szReturn; + } +} + /* * Helper function to create a top level domain search string ONCE per process! */ diff --git a/src/lang/de/main.php b/src/lang/de/main.php index d169e0c..067abdd 100644 --- a/src/lang/de/main.php +++ b/src/lang/de/main.php @@ -73,6 +73,7 @@ $content['LN_SEARCH_PERFORMADVANCED'] = "Erweiterte Suche starten"; $content['LN_VIEW_FILTERFOR'] = "Filter message for "; $content['LN_VIEW_SEARCHFOR'] = "Search online for "; $content['LN_VIEW_SEARCHFORGOOGLE'] = "Search Google for "; + $content['LN_GEN_MESSAGEDETAILS'] = "Message Details"; $content['LN_HIGHLIGHT'] = "Hightlight >>"; $content['LN_HIGHLIGHT_OFF'] = "Hightlight <<"; diff --git a/src/lang/en/main.php b/src/lang/en/main.php index b84919d..9f61ae1 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -74,6 +74,7 @@ $content['LN_VIEW_RELATEDMSG'] = "View related syslog messages"; $content['LN_VIEW_FILTERFOR'] = "Filter message for "; $content['LN_VIEW_SEARCHFOR'] = "Search online for "; $content['LN_VIEW_SEARCHFORGOOGLE'] = "Search Google for "; + $content['LN_GEN_MESSAGEDETAILS'] = "Message Details"; $content['LN_HIGHLIGHT'] = "Hightlight >>"; $content['LN_HIGHLIGHT_OFF'] = "Hightlight <<"; diff --git a/src/templates/index.html b/src/templates/index.html index a52643f..35c75cd 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -221,52 +221,49 @@
      diff --git a/src/themes/dark/main.css b/src/themes/dark/main.css index 0df4626..2e39f63 100644 --- a/src/themes/dark/main.css +++ b/src/themes/dark/main.css @@ -408,3 +408,9 @@ select, input, button, textarea border: 1px solid; border-color: #233B51 #124A7C #124A7C #233B51; } + +.highlighted +{ + font: bold 8pt Arial,Helvetica,sans-serif; + color: #CC6600 +} diff --git a/src/themes/default/main.css b/src/themes/default/main.css index 8614e4a..d7bbf4b 100644 --- a/src/themes/default/main.css +++ b/src/themes/default/main.css @@ -413,3 +413,9 @@ select, input, button, textarea border: 1px solid; border-color: #233B51 #124A7C #124A7C #233B51; } + +.highlighted +{ + font: bold 8pt Arial,Helvetica,sans-serif; + color: #BB0000 +} From 5e124a852432e51b93f43bb8e7e8b252b08991f5 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 6 Jun 2008 16:46:46 +0200 Subject: [PATCH 48/79] Made some adjustments on the IP resolving, we skip the resolving if the IP is surrounded by brackets The reason for this is, because the IP is prepended with the DNS name in this case most likely. So it wouldn't make sense to resolve the name again. --- src/include/functions_common.php | 2136 +++++++++++++++--------------- 1 file changed, 1067 insertions(+), 1069 deletions(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 3c7554f..777f823 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -1,1070 +1,1068 @@ - www.phplogcon.org <- * - * ----------------------------------------------------------------- * - * Common needed functions * - * * - * -> * - * * - * All directives are explained within this file * - * - * Copyright (C) 2008 Adiscon GmbH. - * - * This file is part of phpLogCon. - * - * PhpLogCon is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpLogCon is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with phpLogCon. If not, see . - * - * A copy of the GPL can be found in the file "COPYING" in this - * distribution. - ********************************************************************* -*/ - -// --- Avoid directly accessing this file! -if ( !defined('IN_PHPLOGCON') ) -{ - die('Hacking attempt'); - exit; -} -// --- - -// --- Basic Includes -include($gl_root_path . 'include/constants_general.php'); -include($gl_root_path . 'include/constants_logstream.php'); - -/* -if ( is_file($gl_root_path . 'config.php') ) - include($gl_root_path . 'config.php'); -else -{ - // Check for installscript! - if ( !defined('IN_PHPLOGCON_INSTALL') ) - CheckForInstallPhp(); -} -*/ - -include($gl_root_path . 'classes/class_template.php'); -include($gl_root_path . 'include/functions_themes.php'); -include($gl_root_path . 'include/functions_db.php'); -include($gl_root_path . 'include/functions_config.php'); -// --- - -// --- Define Basic vars -$RUNMODE = RUNMODE_WEBSERVER; -$DEBUGMODE = DEBUG_INFO; - -// --- Disable ARGV setting @webserver! -ini_set( "register_argc_argv", "Off" ); -// --- - -// Default language -$LANG_EN = "en"; // Used for fallback -$LANG = "en"; // Default language - -// Default Template vars -$content['BUILDNUMBER'] = "2.3.4"; -$content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title -$content['BASEPATH'] = $gl_root_path; -$content['EXTRA_METATAGS'] = ""; -$content['EXTRA_JAVASCRIPT'] = ""; -$content['EXTRA_STYLESHEET'] = ""; -// --- - -// --- Check PHP Version! If lower the 5, phplogcon will not work proberly! -$myPhpVer = phpversion(); -$myPhpVerArray = explode('.', $myPhpVer); -if ( $myPhpVerArray[0] < 5 ) - DieWithErrorMsg( 'Error, the PHP Version on this Server does not meet the installation requirements.
      PHP5 or higher is needed. Current installed Version is: ' . $myPhpVer . ''); -// --- - -function InitBasicPhpLogCon() -{ - // Needed to make global - global $CFG, $gl_root_path, $content; - - // Check RunMode first! - CheckAndSetRunMode(); - - // Set the default line sep - SetLineBreakVar(); - - // Start the PHP Session - StartPHPSession(); -} - -function InitPhpLogConConfigFile($bHandleMissing = true) -{ - // Needed to make global - global $CFG, $gl_root_path, $content; - - if ( file_exists($gl_root_path . 'config.php') && GetFileLength($gl_root_path . 'config.php') > 0 ) - { - // Include the main config - include_once($gl_root_path . 'config.php'); - - // Easier DB Access - define('DB_CONFIG', $CFG['UserDBPref'] . "config"); - - // If DEBUG Mode is enabled, we prepend the UID field into the col list! - if ( $CFG['MiscShowDebugMsg'] == 1 ) - array_unshift($CFG['Columns'], SYSLOG_UID); - - // Now Copy all entries into content variable - foreach ($CFG as $key => $value ) - $content[$key] = $value; - - // For MiscShowPageRenderStats - if ( $CFG['MiscShowPageRenderStats'] == 1 ) - { - $content['ShowPageRenderStats'] = "true"; - InitPageRenderStats(); - } - - // return result - return true; - } - else - { - // if handled ourselfe, we die in CheckForInstallPhp. - if ( $bHandleMissing == true ) - { - // Check for installscript! - CheckForInstallPhp(); - } - else - return false; - } -} - -function CheckForInstallPhp() -{ - // Check for installscript! - if ( file_exists($content['BASEPATH'] . "install.php") ) - $strinstallmsg = '

      ' - . '
      Click here to Install PhpLogCon!

      ' -// . 'See the Installation Guides for more Details!
      ' -// . 'English Installation Guide | ' -// . 'German Installation Guide

      ' -// . 'Also take a look to the Readme for some basics around PhpLogCon!
      ' - . '
      '; - else - $strinstallmsg = ""; - DieWithErrorMsg( 'Error, main configuration file is missing!' . $strinstallmsg ); -} - -function GetFileLength($szFileName) -{ - if ( is_file($szFileName) ) - return filesize($szFileName); - else - return 0; -} - -function InitPhpLogCon() -{ - // Needed to make global - global $CFG, $gl_root_path, $content; - - // Init Basics which do not need a database - InitBasicPhpLogCon(); - - // Will init the config file! - InitPhpLogConConfigFile(); - - // Moved here, because we do not need if GZIP needs to be enabled before the config is loaded! - InitRuntimeInformations(); - - // Establish DB Connection - if ( $CFG['UserDBEnabled'] ) - DB_Connect(); - - // Now load the Page configuration values - InitConfigurationValues(); - - // Now Create Themes List because we haven't the config before! - CreateThemesList(); - - // Create Language List - CreateLanguageList(); - - // Init Predefined Searches List - CreatePredefinedSearches(); - - // Init predefined paging sizes - CreatePagesizesList(); - - // Init predefined reload times - CreateReloadTimesList(); - - // --- Enable PHP Debug Mode - InitPhpDebugMode(); - // --- -} - -function CreateLogLineTypesList( $selectedType ) -{ - global $content; - - // syslog - $content['LOGLINETYPES']["syslog"]['type'] = "syslog"; - $content['LOGLINETYPES']["syslog"]['DisplayName'] = "Syslog / RSyslog"; - if ( $selectedType == $content['LOGLINETYPES']["syslog"]['type'] ) { $content['LOGLINETYPES']["syslog"]['selected'] = "selected"; } else { $content['LOGLINETYPES']["syslog"]['selected'] = ""; } - - // Adiscon Winsyslog - $content['LOGLINETYPES']["winsyslog"]['type'] = "winsyslog"; - $content['LOGLINETYPES']["winsyslog"]['DisplayName'] = "Adiscon WinSyslog"; - if ( $selectedType == $content['LOGLINETYPES']["winsyslog"]['type'] ) { $content['LOGLINETYPES']["winsyslog"]['selected'] = "selected"; } else { $content['LOGLINETYPES']["winsyslog"]['selected'] = ""; } -} - -function CreateSourceTypesList( $selectedSource ) -{ - global $content; - - // SOURCE_DISK - $content['SOURCETYPES'][SOURCE_DISK]['type'] = SOURCE_DISK; - $content['SOURCETYPES'][SOURCE_DISK]['DisplayName'] = $content['LN_GEN_SOURCE_DISK']; - if ( $selectedSource == $content['SOURCETYPES'][SOURCE_DISK]['type'] ) { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = ""; } - - // SOURCE_DB ( MYSQL NATIVE ) - $content['SOURCETYPES'][SOURCE_DB]['type'] = SOURCE_DB; - $content['SOURCETYPES'][SOURCE_DB]['DisplayName'] = $content['LN_GEN_SOURCE_DB']; - if ( $selectedSource == $content['SOURCETYPES'][SOURCE_DB]['type'] ) { $content['SOURCETYPES'][SOURCE_DB]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_DB]['selected'] = ""; } - - // SOURCE_PDO ( PDO DB Wrapper) - $content['SOURCETYPES'][SOURCE_PDO]['type'] = SOURCE_PDO; - $content['SOURCETYPES'][SOURCE_PDO]['DisplayName'] = $content['LN_GEN_SOURCE_PDO']; - if ( $selectedSource == $content['SOURCETYPES'][SOURCE_PDO]['type'] ) { $content['SOURCETYPES'][SOURCE_PDO]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_PDO]['selected'] = ""; } -} - -function CreateDBTypesList( $selectedDBType ) -{ - global $content; - - // DB_MYSQL - $content['DBTYPES'][DB_MYSQL]['type'] = DB_MYSQL; - $content['DBTYPES'][DB_MYSQL]['typeastext'] = "DB_MYSQL"; - $content['DBTYPES'][DB_MYSQL]['DisplayName'] = $content['LN_GEN_DB_MYSQL']; - if ( $selectedDBType == $content['DBTYPES'][DB_MYSQL]['type'] ) { $content['DBTYPES'][DB_MYSQL]['selected'] = "selected"; } else { $content['DBTYPES'][DB_MYSQL]['selected'] = ""; } - - // DB_MSSQL - $content['DBTYPES'][DB_MSSQL]['type'] = DB_MSSQL; - $content['DBTYPES'][DB_MSSQL]['typeastext'] = "DB_MSSQL"; - $content['DBTYPES'][DB_MSSQL]['DisplayName'] = $content['LN_GEN_DB_MSSQL']; - if ( $selectedDBType == $content['DBTYPES'][DB_MSSQL]['type'] ) { $content['DBTYPES'][DB_MSSQL]['selected'] = "selected"; } else { $content['DBTYPES'][DB_MSSQL]['selected'] = ""; } - - // DB_ODBC - $content['DBTYPES'][DB_ODBC]['type'] = DB_ODBC; - $content['DBTYPES'][DB_ODBC]['typeastext'] = "DB_ODBC"; - $content['DBTYPES'][DB_ODBC]['DisplayName'] = $content['LN_GEN_DB_ODBC']; - if ( $selectedDBType == $content['DBTYPES'][DB_ODBC]['type'] ) { $content['DBTYPES'][DB_ODBC]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_ODBC]['selected'] = ""; } - - // DB_PGSQL - $content['DBTYPES'][DB_PGSQL]['type'] = DB_PGSQL; - $content['DBTYPES'][DB_PGSQL]['typeastext'] = "DB_PGSQL"; - $content['DBTYPES'][DB_PGSQL]['DisplayName'] = $content['LN_GEN_DB_PGSQL']; - if ( $selectedDBType == $content['DBTYPES'][DB_PGSQL]['type'] ) { $content['DBTYPES'][DB_PGSQL]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_PGSQL]['selected'] = ""; } - - // DB_OCI - $content['DBTYPES'][DB_OCI]['type'] = DB_OCI; - $content['DBTYPES'][DB_OCI]['typeastext'] = "DB_OCI"; - $content['DBTYPES'][DB_OCI]['DisplayName'] = $content['LN_GEN_DB_OCI']; - if ( $selectedDBType == $content['DBTYPES'][DB_OCI]['type'] ) { $content['DBTYPES'][DB_OCI]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_OCI]['selected'] = ""; } - - // DB_DB2 - $content['DBTYPES'][DB_DB2]['type'] = DB_DB2; - $content['DBTYPES'][DB_DB2]['typeastext'] = "DB_DB2"; - $content['DBTYPES'][DB_DB2]['DisplayName'] = $content['LN_GEN_DB_DB2']; - if ( $selectedDBType == $content['DBTYPES'][DB_DB2]['type'] ) { $content['DBTYPES'][DB_DB2]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_DB2]['selected'] = ""; } - - // DB_FIREBIRD - $content['DBTYPES'][DB_FIREBIRD]['type'] = DB_FIREBIRD; - $content['DBTYPES'][DB_FIREBIRD]['typeastext'] = "DB_FIREBIRD"; - $content['DBTYPES'][DB_FIREBIRD]['DisplayName'] = $content['LN_GEN_DB_FIREBIRD']; - if ( $selectedDBType == $content['DBTYPES'][DB_FIREBIRD]['type'] ) { $content['DBTYPES'][DB_FIREBIRD]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_FIREBIRD]['selected'] = ""; } - - // DB_INFORMIX - $content['DBTYPES'][DB_INFORMIX]['type'] = DB_INFORMIX; - $content['DBTYPES'][DB_INFORMIX]['typeastext'] = "DB_INFORMIX"; - $content['DBTYPES'][DB_INFORMIX]['DisplayName'] = $content['LN_GEN_DB_INFORMIX']; - if ( $selectedDBType == $content['DBTYPES'][DB_INFORMIX]['type'] ) { $content['DBTYPES'][DB_INFORMIX]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_INFORMIX]['selected'] = ""; } - - // DB_SQLITE - $content['DBTYPES'][DB_SQLITE]['type'] = DB_SQLITE; - $content['DBTYPES'][DB_SQLITE]['typeastext'] = "DB_SQLITE"; - $content['DBTYPES'][DB_SQLITE]['DisplayName'] = $content['LN_GEN_DB_SQLITE']; - if ( $selectedDBType == $content['DBTYPES'][DB_SQLITE]['type'] ) { $content['DBTYPES'][DB_SQLITE]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_SQLITE]['selected'] = ""; } -} - -function CreatePagesizesList() -{ - global $CFG, $content; - - $iCounter = 0; - $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_GEN_PRECONFIGURED'] . " (" . $CFG['ViewEntriesPerPage'] . ")", "Value" => $CFG['ViewEntriesPerPage'] ); $iCounter++; - $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 25 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 25 ); $iCounter++; - $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 50 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 50 ); $iCounter++; - $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 75 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 75 ); $iCounter++; - $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 100 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 100 ); $iCounter++; - $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 250 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 250 ); $iCounter++; - $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 500 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 500 ); $iCounter++; - - // Set default selected pagesize - $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Selected"] = "selected"; - - // The content variable will now contain the user selected oaging size - $content["ViewEntriesPerPage"] = $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Value"]; -} - -function CreateReloadTimesList() -{ - global $CFG, $content; - -// $CFG['ViewEnableAutoReloadSeconds'] - $iCounter = 0; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_DISABLED'], "Value" => 0 ); $iCounter++; - if ( isset($CFG['ViewEnableAutoReloadSeconds']) && $CFG['ViewEnableAutoReloadSeconds'] > 0 ) - { - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_PRECONFIGURED'] . " (" . $CFG['ViewEnableAutoReloadSeconds'] . " " . $content['LN_AUTORELOAD_SECONDS'] . ") ", "Value" => $CFG['ViewEnableAutoReloadSeconds'] ); $iCounter++; - } - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 5 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 5 ); $iCounter++; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 10 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 10 ); $iCounter++; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 15 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 15 ); $iCounter++; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 30 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 30 ); $iCounter++; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 60 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 60 ); $iCounter++; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 5 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 300 ); $iCounter++; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 10 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 600 ); $iCounter++; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 15 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 900 ); $iCounter++; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 30 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 1800 ); $iCounter++; - - // Set default selected autoreloadid - $content['reloadtimes'][ $_SESSION['AUTORELOAD_ID'] ]["Selected"] = "selected"; - - // The content variable will now contain the user selected oaging size - $content["ViewEnableAutoReloadSeconds"] = $content['reloadtimes'][ $_SESSION['AUTORELOAD_ID'] ]["Value"]; - -} - -function CreatePredefinedSearches() -{ - global $CFG, $content; - if ( isset($CFG['Search']) ) - { - // Enable predefined searches - $content['EnablePredefinedSearches'] = true; - - // Loop through all predefined searches! - foreach ($CFG['Search'] as $mykey => $mySearch) - { - // Copy configured searches into content array! - $content['Search'][$mykey]["ID"] = $mykey; - $content['Search'][$mykey]["Selected"] = false; - - // --- Set CSS Class - if ( $mykey % 2 == 0 ) - $content['Search'][$mykey]['cssclass'] = "line1"; - else - $content['Search'][$mykey]['cssclass'] = "line2"; - // --- - - } - } - else // Disable predefined searches - $content['EnablePredefinedSearches'] = false; -} - -function InitPhpDebugMode() -{ - global $content, $CFG; - - // --- Set Global DEBUG Level! - if ( $CFG['MiscShowDebugMsg'] == 1 ) - ini_set( "error_reporting", E_ALL ); // ALL PHP MESSAGES! -// else -// ini_set( "error_reporting", E_ERROR ); // ONLY PHP ERROR'S! - // --- -} - -function CheckAndSetRunMode() -{ - global $RUNMODE, $MaxExecutionTime; - // Set to command line mode if argv is set! - if ( !isset($_SERVER["GATEWAY_INTERFACE"]) ) - $RUNMODE = RUNMODE_COMMANDLINE; - - // Obtain max_execution_time - $MaxExecutionTime = ini_get("max_execution_time"); -} - -function InitRuntimeInformations() -{ - global $content, $CFG; - - // TODO| maybe not needed! - - // Enable GZIP Compression if enabled! - if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && (isset($CFG['MiscEnableGzipCompression']) && $CFG['MiscEnableGzipCompression'] == 1) ) - { - // This starts gzip compression! - ob_start("ob_gzhandler"); - $content['GzipCompressionEnmabled'] = "yes"; - } - else - $content['GzipCompressionEnmabled'] = "no"; -} - -function CreateDebugModes() -{ - global $content; - - $content['DBGMODES'][0]['DisplayName'] = STR_DEBUG_ULTRADEBUG; - if ( $content['parser_debugmode'] == $content['DBGMODES'][0]['DisplayName'] ) { $content['DBGMODES'][0]['selected'] = "selected"; } else { $content['DBGMODES'][0]['selected'] = ""; } - $content['DBGMODES'][1]['DisplayName'] = STR_DEBUG_DEBUG; - if ( $content['parser_debugmode'] == $content['DBGMODES'][1]['DisplayName'] ) { $content['DBGMODES'][1]['selected'] = "selected"; } else { $content['DBGMODES'][1]['selected'] = ""; } - $content['DBGMODES'][2]['DisplayName'] = STR_DEBUG_INFO; - if ( $content['parser_debugmode'] == $content['DBGMODES'][2]['DisplayName'] ) { $content['DBGMODES'][2]['selected'] = "selected"; } else { $content['DBGMODES'][2]['selected'] = ""; } - $content['DBGMODES'][3]['DisplayName'] = STR_DEBUG_WARN; - if ( $content['parser_debugmode'] == $content['DBGMODES'][3]['DisplayName'] ) { $content['DBGMODES'][3]['selected'] = "selected"; } else { $content['DBGMODES'][3]['selected'] = ""; } - $content['DBGMODES'][4]['DisplayName'] = STR_DEBUG_ERROR; - if ( $content['parser_debugmode'] == $content['DBGMODES'][4]['DisplayName'] ) { $content['DBGMODES'][4]['selected'] = "selected"; } else { $content['DBGMODES'][4]['selected'] = ""; } -} - -function InitFrontEndVariables() -{ - global $content; - - $content['MENU_FOLDER_OPEN'] = $content['BASEPATH'] . "images/icons/folder_closed.png"; - $content['MENU_FOLDER_CLOSED'] = $content['BASEPATH'] . "images/icons/folder.png"; - $content['MENU_HOMEPAGE'] = $content['BASEPATH'] . "images/icons/home.png"; - $content['MENU_LINK'] = $content['BASEPATH'] . "images/icons/link.png"; - $content['MENU_LINK_VIEW'] = $content['BASEPATH'] . "images/icons/link_view.png"; - $content['MENU_VIEW'] = $content['BASEPATH'] . "images/icons/view.png"; - $content['MENU_PREFERENCES'] = $content['BASEPATH'] . "images/icons/preferences.png"; - $content['MENU_ADMINENTRY'] = $content['BASEPATH'] . "images/icons/star_blue.png"; - $content['MENU_ADMINLOGOFF'] = $content['BASEPATH'] . "images/icons/exit.png"; - $content['MENU_ADMINUSERS'] = $content['BASEPATH'] . "images/icons/businessmen.png"; - $content['MENU_SEARCH'] = $content['BASEPATH'] . "images/icons/view.png"; - $content['MENU_SELECTION_DISABLED'] = $content['BASEPATH'] . "images/icons/selection.png"; - $content['MENU_SELECTION_ENABLED'] = $content['BASEPATH'] . "images/icons/selection_delete.png"; - $content['MENU_TEXT_FIND'] = $content['BASEPATH'] . "images/icons/text_find.png"; - $content['MENU_NETWORK'] = $content['BASEPATH'] . "images/icons/earth_network.png"; - - - $content['MENU_PAGER_BEGIN'] = $content['BASEPATH'] . "images/icons/media_beginning.png"; - $content['MENU_PAGER_PREVIOUS'] = $content['BASEPATH'] . "images/icons/media_rewind.png"; - $content['MENU_PAGER_NEXT'] = $content['BASEPATH'] . "images/icons/media_fast_forward.png"; - $content['MENU_PAGER_END'] = $content['BASEPATH'] . "images/icons/media_end.png"; - $content['MENU_NAV_LEFT'] = $content['BASEPATH'] . "images/icons/navigate_left.png"; - $content['MENU_NAV_RIGHT'] = $content['BASEPATH'] . "images/icons/navigate_right.png"; - $content['MENU_NAV_CLOSE'] = $content['BASEPATH'] . "images/icons/navigate_close.png"; - $content['MENU_NAV_OPEN'] = $content['BASEPATH'] . "images/icons/navigate_open.png"; - $content['MENU_PAGER_BEGIN_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_beginning.png"; - $content['MENU_PAGER_PREVIOUS_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_rewind.png"; - $content['MENU_PAGER_NEXT_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_fast_forward.png"; - $content['MENU_PAGER_END_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_end.png"; - - $content['MENU_BULLET_BLUE'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_blue.png"; - $content['MENU_BULLET_GREEN'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_green.png"; - $content['MENU_BULLET_RED'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_red.png"; - $content['MENU_BULLET_YELLOW'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_yellow.png"; - $content['MENU_BULLET_GREY'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_grey.png"; - - $content['MENU_ICON_GOOGLE'] = $content['BASEPATH'] . "images/icons/googleicon.png"; -} - -// Lang Helper for Strings with ONE variable -function GetAndReplaceLangStr( $strlang, $param1 = "", $param2 = "", $param3 = "", $param4 = "", $param5 = "" ) -{ - $strfinal = str_replace ( "%1", $param1, $strlang ); - if ( strlen($param2) > 0 ) - $strfinal = str_replace ( "%1", $param2, $strfinal ); - if ( strlen($param3) > 0 ) - $strfinal = str_replace ( "%1", $param3, $strfinal ); - if ( strlen($param4) > 0 ) - $strfinal = str_replace ( "%1", $param4, $strfinal ); - if ( strlen($param5) > 0 ) - $strfinal = str_replace ( "%1", $param5, $strfinal ); - - // And return - return $strfinal; -} - -function InitConfigurationValues() -{ - global $content, $CFG, $LANG, $gl_root_path; - - // If Database is enabled, try to read from database! - if ( $CFG['UserDBEnabled'] ) - { - $result = DB_Query("SELECT * FROM " . DB_CONFIG); - $rows = DB_GetAllRows($result, true, true); - - if ( isset($rows ) ) - { - for($i = 0; $i < count($rows); $i++) - $content[ $rows[$i]['name'] ] = $rows[$i]['value']; - } - // General defaults - // --- Language Handling - if ( !isset($content['gen_lang']) ) { $content['gen_lang'] = $CFG['ViewDefaultLanguage'] /*"en"*/; } - - // --- PHP Debug Mode - if ( !isset($content['gen_phpdebug']) ) { $content['gen_phpdebug'] = "no"; } - // --- - - // Database Version Checker! - if ( $content['database_internalversion'] > $content['database_installedversion'] ) - { - // Database is out of date, we need to upgrade - $content['database_forcedatabaseupdate'] = "yes"; - } - } - else - { - // --- Set Defaults... - // Language Handling - if ( isset($_SESSION['CUSTOM_LANG']) && VerifyLanguage($_SESSION['CUSTOM_LANG']) ) - { - $content['user_lang'] = $_SESSION['CUSTOM_LANG']; - $LANG = $content['user_lang']; - } - else if ( isset($content['gen_lang']) && VerifyLanguage($content['gen_lang'])) - { - $content['user_lang'] = $content['gen_lang']; - $LANG = $content['user_lang']; - } - else // Failsave! - { - $content['user_lang'] = $CFG['ViewDefaultLanguage'] /*"en"*/; - $LANG = $content['user_lang']; - $content['gen_lang'] = $content['user_lang']; - } - } - - // Paging Size handling! - if ( !isset($_SESSION['PAGESIZE_ID']) ) - { - // Default is 0! - $_SESSION['PAGESIZE_ID'] = 0; - } - - // Auto reload handling! - if ( !isset($_SESSION['AUTORELOAD_ID']) ) - { - if ( isset($CFG['ViewEnableAutoReloadSeconds']) && $CFG['ViewEnableAutoReloadSeconds'] > 0 ) - $_SESSION['AUTORELOAD_ID'] = 1; // Autoreload ID will be the first item! - else // Default is 0, which means auto reload disabled - $_SESSION['AUTORELOAD_ID'] = 0; - } - - // Theme Handling - if ( !isset($content['web_theme']) ) { $content['web_theme'] = $CFG['ViewDefaultTheme'] /*"default"*/; } - if ( isset($_SESSION['CUSTOM_THEME']) && VerifyTheme($_SESSION['CUSTOM_THEME']) ) - $content['user_theme'] = $_SESSION['CUSTOM_THEME']; - else - $content['user_theme'] = $content['web_theme']; - - //Init Theme About Info ^^ - InitThemeAbout($content['user_theme']); - // --- - - // Init main langauge file now! - IncludeLanguageFile( $gl_root_path . '/lang/' . $LANG . '/main.php' ); - - // Init other things which are needed - InitFrontEndVariables(); -} - -function SetDebugModeFromString( $facility ) -{ - global $DEBUGMODE; - - switch ( $facility ) - { - case STR_DEBUG_ULTRADEBUG: - $DEBUGMODE = DEBUG_ULTRADEBUG; - break; - case STR_DEBUG_DEBUG: - $DEBUGMODE = DEBUG_DEBUG; - break; - case STR_DEBUG_INFO: - $DEBUGMODE = DEBUG_INFO; - break; - case STR_DEBUG_WARN: - $DEBUGMODE = DEBUG_WARN; - break; - case STR_DEBUG_ERROR: - $DEBUGMODE = DEBUG_ERROR; - break; - } -} - - -function InitPageRenderStats() -{ - global $gl_starttime, $querycount; - $gl_starttime = microtime_float(); - $querycount = 0; -} - -function FinishPageRenderStats( &$mycontent) -{ - global $gl_starttime, $querycount; - - $endtime = microtime_float(); - $mycontent['PAGERENDERTIME'] = number_format($endtime - $gl_starttime, 4, '.', ''); - $mycontent['TOTALQUERIES'] = $querycount; -} - -function microtime_float() -{ - list($usec, $sec) = explode(" ", microtime()); - return ((float)$usec + (float)$sec); -} - -function SetLineBreakVar() -{ - // Used for some functions - global $RUNMODE, $linesep; - - if ( $RUNMODE == RUNMODE_COMMANDLINE ) - $linesep = "\r\n"; - else if ( $RUNMODE == RUNMODE_WEBSERVER ) - $linesep = "
      "; -} - -function CheckUrlOrIP($ip) -{ - $long = ip2long($ip); - if ( $long == -1 ) - return false; - else - return true; -} - -function DieWithErrorMsg( $szerrmsg ) -{ - global $content; - print(""); - print("
      {LN_CFG_DISKTYPEOPTIONS}
      {LN_CFG_LOGLINETYPE}{LN_CFG_LOGLINETYPE} +
      {LN_CFG_DATABASETYPEOPTIONS}
      + +
      + - - - - - + +
      {LN_CFG_DBTABLETYPE}
      {LN_CFG_DBSTORAGEENGINE}{LN_CFG_DBSTORAGEENGINE}
      +
      + + + + + + @@ -332,7 +369,7 @@ - + @@ -348,7 +385,7 @@ From 1101fccb6f04fdd6fa2678407ae56d373782da60 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 23 May 2008 17:39:29 +0200 Subject: [PATCH 39/79] Added changelog entry --- ChangeLog | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6aae488..79cf798 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,16 @@ --------------------------------------------------------------------------- +Version 2.3.3 (devel), 2008-05-23 +- Initial Added the new DB Driver (Logstream) which uses PHP PDO. + PDO is the latest generic database interface for PHP5 and recommended + for best performance. It is possible to use other database engines with + this new logstream class like mssql, postgres sql, odbc, oracle + or even ibm db2. +- Optimized the logic of the pager and increased performance + related to it. +- Added support for the new Database driver into the installation script. + The old driver has been renamed to MYSQL Native and is also + recommended if you use MYSQL as database server. +--------------------------------------------------------------------------- Version 2.3.2 (devel), 2008-05-20 - Implemented Online Search button into the field submenus. The search uses our new repository at kb.monitorware.com. From 311946cb309d68b573ec3539de603a52cf4dfae2 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 23 May 2008 17:46:08 +0200 Subject: [PATCH 40/79] Incremented Version number to 2.3.3 in common --- src/include/functions_common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 6bf22e1..fcc0765 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -73,7 +73,7 @@ $LANG_EN = "en"; // Used for fallback $LANG = "en"; // Default language // Default Template vars -$content['BUILDNUMBER'] = "2.3.2"; +$content['BUILDNUMBER'] = "2.3.3"; $content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title $content['BASEPATH'] = $gl_root_path; $content['EXTRA_METATAGS'] = ""; From a1c27ade3f4b5bcdece2e42738c03294afff3566 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 30 May 2008 12:18:59 +0200 Subject: [PATCH 41/79] Changed Online Search Parameters --- INSTALL | 137 +++++++++++++++++++++++++++++++++++++++++++++++++- src/index.php | 12 ++--- 2 files changed, 142 insertions(+), 7 deletions(-) diff --git a/INSTALL b/INSTALL index 8c40018..731bf20 100644 --- a/INSTALL +++ b/INSTALL @@ -28,7 +28,7 @@ 1. Upload all files from the phplogcon/src/ folder to you webserver. The other files are not needed on the webserver. - 2. If you webserver has write access to the phplogcon folder, + 2. If your webserver has write access to the phplogcon folder, you can skip the following step: Upload the scripts configure.sh and secure.sh from the @@ -45,6 +45,141 @@ script. The install script will guide you through the phplogcon installation, just follow the instructions. + 3.1 Step 1 - Prerequisites Beginning of installation / welcome site + This is the first page of the installation. It just tells + you, that before installing, some file permission have to + be checked. Simply click "Next" to start the process. + + 3.2 Step 2 - Verify the file permissions + Here you will see, if the config.php can be written or not. + If it cannot be written, you have to repeat the complete + Step 2. + + 3.3 Step 3 - Basic Configuration + You can set several basic options here. + + - Number of syslog messages per page = 50 (default) + This is the number of syslog messages displayed on each page. + You can increase the value (makes phpLogCon slower) or decrease + the value (makes it faster). + + - Message character limit for the main view = 80 (default) + Set the number of characters per message which will be shown + in the last column of the main view. Full messages can be + reviewed by hovering the mouse over it. + + - Show message details popup (default yes) = yes (default) + Here you can set, if you want the small window with the complete + message to pop up if you are hovering over a event with the + cursor. If you choose "No", then you have to click on the + message to see the details. + + 3.4 Step 4 - not implemented yet + + 3.5 Step 5 - not implemented yet + + 3.6 Step 6 - not implemented yet + + 3.7 Step 7 - Create the first source for syslog messages + This is the most important step. Here, you will configure + your first data source, which holds all your syslog data. + + Mainly, you have to choose a "Name of the Source" and a + "Source Type". The name will be displayed later in a drop-down + menu with which you choose your active syslog source. The + "Source Type" can be a file, a MySQL database or the PHP PDO + which supports different database types like mssql, PostgreSQL, + odbc, oracle or even ibm db2. + + + If you choose the diskfile, you have to provide the following + information: + + - Logline Type = Syslog / Rsyslog (default) or Adiscon WinSyslog + This tells phpLogCon, how the lines look like. This is + necessary for show the log messages properly. + + - Syslog File = /var/log/syslog (default) + This is the position of the logfile in your file system. + + + If you choose MySQL native as data source, following information + is needed: + + - Table Type = monitorware (default) + This is the table layout. Currently, you can use "monitorware" + or "syslogng". For more details see "Note on MySQL Databases" + below. + + - Database Host = localhost (default) + This is the host, where the database is located. By default this + is localhost. You can specify any other host if necessary. + + - Database Name = phplogcon (default) + The name of the database you want to use. + + - Database Tablename = systemevents (default) + This is the name of the table in which the data is stored. The + default tablename corresponds to the tables created with the + MonitorWare Line of products. + + - Database User = user (default) + The username for the database. + + - Database Password = not set by default + The password for the username. + + - Enable Row Counting = No (default) + If configured to "Yes", the amount of rows in the table will be + counted with every query, giving you the total records for your + search, though having a lot of impact on your system when using + a very large database. If configured to "No", the rows will not + be counted, providing you a lot more performance. + + + If you choose Database (PDO), the following has to be defined: + + - Database Storage Engine = MySQL Server (default) + Choose the engine of the database you are using. The databases + are available: MySQL Server, Microsoft SQL Server, ODBC + Database Connection, PostgreSQL, Oracle Call Interface, IBM + DB2, Firebird/Interbase 6, IBM Informix Dynamic Server, + SQLite 2. + + - Table Type = monitorware (default) + This is the table layout. Currently, you can use "monitorware" + or "syslogng". For more details see "Note on MySQL Databases" + below. + + - Database Host = localhost (default) + This is the host, where the database is located. By default this + is localhost. You can specify any other host if necessary. + + - Database Name = phplogcon (default) + The name of the database you want to use. + + - Database Tablename = systemevents (default) + This is the name of the table in which the data is stored. The + default tablename corresponds to the tables created with the + MonitorWare Line of products. + + - Database User = user (default) + The username for the database. + + - Database Password = not set by default + The password for the username. + + - Enable Row Counting = No (default) + If configured to "Yes", the amount of rows in the table will be + counted with every query, giving you the total records for your + search, though having a lot of impact on your system when using + a very large database. If configured to "No", the rows will not + be counted, providing you a lot more performance. + + 3.8 Step 8 - Finish + + + 4. If everything went right, you should see syslog messages already in your phplogcon installation. You can now remove the install.php script now. diff --git a/src/index.php b/src/index.php index d0ac432..d52d74d 100644 --- a/src/index.php +++ b/src/index.php @@ -357,7 +357,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_FACILITY']) . '+' . GetFacilityDisplayName($logArray[$mycolkey]), + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&oid=' . SYSLOG_FACILITY . '&q=' . GetFacilityDisplayName($logArray[$mycolkey]), 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_FACILITY'] . " '" . GetFacilityDisplayName($logArray[$mycolkey]) . "'", 'IconSource' => $content['MENU_NETWORK'] ); @@ -386,7 +386,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_SEVERITY']) . '+' . GetSeverityDisplayName($logArray[$mycolkey]), + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&oid=' . SYSLOG_SEVERITY . '&q=' . GetSeverityDisplayName($logArray[$mycolkey]), 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_SEVERITY'] . " '" . GetSeverityDisplayName($logArray[$mycolkey]) . "'", 'IconSource' => $content['MENU_NETWORK'] ); @@ -426,7 +426,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_EVENTID']) . '+' . $logArray[$mycolkey], + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&oid=' . SYSLOG_EVENT_ID . '&q=' . $logArray[$mycolkey], 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTID'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); @@ -516,7 +516,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_SYSLOGTAG']) . '+' . $logArray[$mycolkey], + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&oid=' . SYSLOG_SYSLOGTAG . '&q=' . $logArray[$mycolkey], 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_SYSLOGTAG'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); @@ -542,7 +542,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_EVENTLOGTYPE']) . '+' . $logArray[$mycolkey], + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&oid=' . SYSLOG_EVENT_LOGTYPE . '&q=' . $logArray[$mycolkey], 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTLOGTYPE'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); @@ -557,7 +557,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c 'IconSource' => $content['MENU_BULLET_BLUE'] ); $content['syslogmessages'][$counter]['values'][$mycolkey]['buttons'][] = array( - 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&q=' . PrepareStringForSearch($content['LN_FIELDS_EVENTSOURCE']) . '+' . $logArray[$mycolkey], + 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&oid=' . SYSLOG_EVENT_SOURCE . '&q=' . $logArray[$mycolkey], 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content['LN_FIELDS_EVENTSOURCE'] . " '" . $logArray[$mycolkey] . "'", 'IconSource' => $content['MENU_NETWORK'] ); From 5641cc8b61b53d434d69963969e24c7addd42a27 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 30 May 2008 18:03:57 +0200 Subject: [PATCH 42/79] Started implementing context link generation within the message --- src/css/defaults.css | 10 ++++++++++ src/include/functions_common.php | 26 ++++++++++++++++++++++++++ src/index.php | 4 ++++ src/templates/index.html | 10 ++++++---- src/themes/default/main.css | 19 +++++++++++++++++++ 5 files changed, 65 insertions(+), 4 deletions(-) diff --git a/src/css/defaults.css b/src/css/defaults.css index 28f3ec5..9dc39ec 100644 --- a/src/css/defaults.css +++ b/src/css/defaults.css @@ -47,6 +47,7 @@ } .syslogdetails span {display: none} /*the span will display just on :hover state*/ +/* .syslogdetails:hover span { display:block; @@ -54,6 +55,15 @@ top:15px; left:15px; } +*/ +.syslogdetails_popup span +{ + display:block; + position:absolute; + z-index:5; +/* top:15px; */ +/* left:15px; */ +} .gridline { diff --git a/src/include/functions_common.php b/src/include/functions_common.php index fcc0765..f35f6c6 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -849,6 +849,32 @@ function GetMonthFromString($szMonth) } } +/* +* AddContextLinks +*/ +function AddContextLinks($sourceTxt) +{ + // Create Search Array + $search = array + ( + '|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|', +// '/([\w\d\_\/]+)\.(de|com)/x', + ); + + // Create Replace Array + $replace = array + ( + '$1', +// '$1.$2', + ); + + // Replace and return! + $outTxt = preg_replace( $search, $replace, $sourceTxt ); + +//echo $outTxt . "
      " ; + + return $outTxt; +} // --- BEGIN Usermanagement Function --- function StartPHPSession() diff --git a/src/index.php b/src/index.php index d52d74d..4c89cb4 100644 --- a/src/index.php +++ b/src/index.php @@ -457,6 +457,10 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = ""; } + // --- HOOK here to add context links! + $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = AddContextLinks($content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue']); + // --- + // If we need to highlight some words ^^! if ( isset($content['highlightwords']) ) $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = HighLightString( $content['highlightwords'], $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] ); diff --git a/src/templates/index.html b/src/templates/index.html index fc04c06..a52643f 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -241,8 +241,11 @@ - + + + + @@ -265,8 +268,7 @@ - - {fieldvalue} +
      {fieldvalue}
      {LN_CFG_DBTABLETYPE}
      {LN_CFG_DBSERVER}
      {LN_CFG_DBROWCOUNTING}{LN_CFG_DBROWCOUNTING} Yes No
      @@ -278,7 +280,7 @@
      {popupcaption}
      - +
      - - - - + + + + + + - + - - - {fieldvalue} - + {fieldvalue} - - {fieldvalue} - - + + {fieldvalue} + - - {fieldvalue} - + {fieldvalue} +
      {fieldvalue}
      @@ -282,6 +279,7 @@
      +

      Critical Error occured


      "); - print("Errordetails:
      " . $szerrmsg); - print("
      "); - - exit; -} - -function DieWithFriendlyErrorMsg( $szerrmsg ) -{ - //TODO: Make with template - print(""); - print("

      Error occured


      "); - print("Errordetails:
      " . $szerrmsg); - exit; -} - -/* -* Helper function to initialize the page title! -*/ -function InitPageTitle() -{ - global $content, $CFG, $currentSourceID; - - if ( isset($CFG['PrependTitle']) && strlen($CFG['PrependTitle']) > 0 ) - $szReturn = $CFG['PrependTitle'] . " :: "; - else - $szReturn = ""; - - if ( isset($currentSourceID) && isset($content['Sources'][$currentSourceID]['Name']) ) - $szReturn .= "Source '" . $content['Sources'][$currentSourceID]['Name'] . "' :: "; - - // Append phpLogCon - $szReturn .= "phpLogCon"; - - // return result - return $szReturn; -} - - -function GetStringWithHTMLCodes($myStr) -{ - // Replace all special characters with valid html representations - return htmlentities($myStr); -} - -function InitTemplateParser() -{ - global $page, $gl_root_path; - // ----------------------------------------------- - // Create Template Object and set some variables for the templates - // ----------------------------------------------- - $page = new Template(); - $page -> set_path ( $gl_root_path . "templates/" ); -} - -function VerifyLanguage( $mylang ) -{ - global $gl_root_path; - - if ( is_dir( $gl_root_path . 'lang/' . $mylang ) ) - return true; - else - return false; -} - -function IncludeLanguageFile( $langfile ) -{ - global $LANG, $LANG_EN; - - if ( file_exists( $langfile ) ) - include( $langfile ); - else - { - $langfile = str_replace( $LANG, $LANG_EN, $langfile ); - include( $langfile ); - } -} - -function RedirectPage( $newpage ) -{ - header("Location: $newpage"); - exit; -} - -function RedirectResult( $szMsg, $newpage ) -{ - header("Location: result.php?msg=" . urlencode($szMsg) . "&redir=" . urlencode($newpage)); - exit; -} - -/* -* GetEventTime -* -* Helper function to parse and obtain a valid EventTime Array from the input string. -* Return value: EventTime Array! -* -*/ -function GetEventTime($szTimStr) -{ - // Sample: Mar 10 14:45:44 - if ( preg_match("/(...) ([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) - { - // RFC 3164 typical timestamp - $eventtime[EVTIME_TIMESTAMP] = mktime($out[3], $out[4], $out[5], GetMonthFromString($out[1]), $out[2]); - $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! - $eventtime[EVTIME_MICROSECONDS] = 0; - -// echo gmdate(DATE_RFC822, $eventtime[EVTIME_TIMESTAMP]) . "
      "; -// print_r ( $eventtime ); -// exit; - } - // Sample: 2008-04-02T11:12:32+02:00 - else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\+([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) - { - // RFC 3164 typical timestamp - $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); - $eventtime[EVTIME_TIMEZONE] = $out[7]; - $eventtime[EVTIME_MICROSECONDS] = 0; - } - // Sample: 2008-04-02T11:12:32.380449+02:00 - else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\.([0-9]{1,6})\+([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) - { - // RFC 3164 typical timestamp - $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); - $eventtime[EVTIME_TIMEZONE] = $out[8]; - $eventtime[EVTIME_MICROSECONDS] = $out[7]; - } - // Sample: 2008-04-02,15:19:06 - else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2}),([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) - { - // RFC 3164 typical timestamp - $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); - $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! - $eventtime[EVTIME_MICROSECONDS] = 0; - } - // Sample: 2008-02-19 12:52:37 - else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) - { - // RFC 3164 typical timestamp - $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); - $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! - $eventtime[EVTIME_MICROSECONDS] = 0; - } - // Sample: 2007-4-18T00:00:00 - else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) - { - // RFC 3164 typical timestamp - $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); - $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! - $eventtime[EVTIME_MICROSECONDS] = 0; - } - else - { - die ("wtf GetEventTime unparsable time - " . $szTimStr ); - } - - // return result! - return $eventtime; -} - -/* -* GetMonthFromString -* -* Simple Helper function to obtain the numeric represantation of the month -*/ -function GetMonthFromString($szMonth) -{ - switch($szMonth) - { - case "Jan": - return 1; - case "Feb": - return 2; - case "Mar": - return 3; - case "Apr": - return 4; - case "May": - return 5; - case "Jun": - return 6; - case "Jul": - return 7; - case "Aug": - return 8; - case "Sep": - return 9; - case "Oct": - return 10; - case "Nov": - return 11; - case "Dez": - return 12; - } -} - -/* -* AddContextLinks -*/ -function AddContextLinks(&$sourceTxt) -{ - global $szTLDDomains, $CFG; - - // Return if not enabled! - if ( !isset($CFG['EnableIPAddressResolve']) || $CFG['EnableIPAddressResolve'] == 1 ) - { - // Search for IP's and Add Reverse Lookup first! - $sourceTxt = preg_replace( '/\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/e', "'\\1.\\2.\\3.\\4' . ReverseResolveIP('\\1.\\2.\\3.\\4', ' {', '} ')", $sourceTxt ); - } - - // Create if not set! - if ( !isset($szTLDDomains) ) - CreateTopLevelDomainSearch(); - - // Create Search Array - $search = array - ( - '/\.([\w\d\_]+)\.(' . $szTLDDomains . ')([^a-zA-Z0-9])/x', -// '|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|', - '/\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/x', - ); - - // Create Replace Array - $replace = array - ( - '.$1.$2$3', - '$1.$2.$3.$4', - ); - - // Replace and return! - $sourceTxt = preg_replace( $search, $replace, $sourceTxt ); - -//echo $outTxt . "
      " ; -//return $outTxt; -} - -/* -* Reserve Resolve IP Address! -*/ -function ReverseResolveIP( $szIP, $prepend, $append ) -{ - global $gl_starttime, $MaxExecutionTime; - - // Substract 5 savety seconds! - $scriptruntime = intval(microtime_float() - $gl_starttime); - if ( $scriptruntime > ($MaxExecutionTime-5) ) - { -echo "WTF $scriptruntime - $MaxExecutionTime"; - return ""; - } - - // Abort if these IP's are postet - if ( strpos("0.0.0.0", $szIP) !== false | strpos("127.", $szIP) !== false | strpos("255.255.255.255", $szIP) !== false ) - return ""; - else - { - // Resolve name if needed - if ( !isset($_SESSION['dns_cache'][$szIP]) ) - $_SESSION['dns_cache'][$szIP] = gethostbyaddr($szIP); - - // Abort if IP and RESOLVED name are the same ^^! - if ( $_SESSION['dns_cache'][$szIP] == $szIP ) - return; - - // Create string - $szReturn = $prepend; - $szReturn .= $_SESSION['dns_cache'][$szIP]; - $szReturn .= $append; - - // return result - return $szReturn; - } -} - -/* -* Helper function to create a top level domain search string ONCE per process! -*/ -function CreateTopLevelDomainSearch() -{ - // Current list taken from http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains! - global $szTLDDomains; - $szTLDDomains = "aero|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel|cTLD|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw"; -} - -// --- BEGIN Usermanagement Function --- -function StartPHPSession() -{ - global $RUNMODE; - if ( $RUNMODE == RUNMODE_WEBSERVER ) - { - // This will start the session - if (session_id() == "") - session_start(); - - if ( !isset($_SESSION['SESSION_STARTED']) ) - $_SESSION['SESSION_STARTED'] = "true"; - } -} - -function CheckForUserLogin( $isloginpage, $isUpgradePage = false ) -{ - global $content; - - if ( isset($_SESSION['SESSION_LOGGEDIN']) ) - { - if ( !$_SESSION['SESSION_LOGGEDIN'] ) - RedirectToUserLogin(); - else - { - $content['SESSION_LOGGEDIN'] = "true"; - $content['SESSION_USERNAME'] = $_SESSION['SESSION_USERNAME']; - } - - // New, Check for database Version and may redirect to updatepage! - if ( isset($content['database_forcedatabaseupdate']) && - $content['database_forcedatabaseupdate'] == "yes" && - $isUpgradePage == false - ) - RedirectToDatabaseUpgrade(); - } - else - { - if ( $isloginpage == false ) - RedirectToUserLogin(); - } - -} - -function CreateUserName( $username, $password, $access_level ) -{ - $md5pass = md5($password); - $result = DB_Query("SELECT username FROM " . STATS_USERS . " WHERE username = '" . $username . "'"); - $rows = DB_GetAllRows($result, true); - if ( isset($rows) ) - { - DieWithFriendlyErrorMsg( "User $username already exists!" ); - - // User not created! - return false; - } - else - { - // Create User - $result = DB_Query("INSERT INTO " . STATS_USERS . " (username, password, access_level) VALUES ('$username', '$md5pass', $access_level)"); - DB_FreeQuery($result); - - // Success - return true; - } -} - -function CheckUserLogin( $username, $password ) -{ - global $content, $CFG; - - // TODO: SessionTime and AccessLevel check - - $md5pass = md5($password); - $sqlselect = "SELECT access_level FROM " . STATS_USERS . " WHERE username = '" . $username . "' and password = '" . $md5pass . "'"; - $result = DB_Query($sqlselect); - $rows = DB_GetAllRows($result, true); - if ( isset($rows) ) - { - $_SESSION['SESSION_LOGGEDIN'] = true; - $_SESSION['SESSION_USERNAME'] = $username; - $_SESSION['SESSION_ACCESSLEVEL'] = $rows[0]['access_level']; - - $content['SESSION_LOGGEDIN'] = "true"; - $content['SESSION_USERNAME'] = $username; - - // Success ! - return true; - } - else - { - if ( $CFG['MiscShowDebugMsg'] == 1 ) - DieWithFriendlyErrorMsg( "Debug Error: Could not login user '" . $username . "'

      Sessionarray
      " . var_export($_SESSION, true) . "

      SQL Statement: " . $sqlselect ); - - // Default return false - return false; - } -} - -function DoLogOff() -{ - global $content; - - unset( $_SESSION['SESSION_LOGGEDIN'] ); - unset( $_SESSION['SESSION_USERNAME'] ); - unset( $_SESSION['SESSION_ACCESSLEVEL'] ); - - // Redir to Index Page - RedirectPage( "index.php"); -} - -function RedirectToUserLogin() -{ - // TODO Referer - header("Location: login.php?referer=" . $_SERVER['PHP_SELF']); - exit; -} - -function RedirectToDatabaseUpgrade() -{ - // TODO Referer - header("Location: upgrade.php"); // ?referer=" . $_SERVER['PHP_SELF']); - exit; -} -// --- END Usermanagement Function --- - - + www.phplogcon.org <- * + * ----------------------------------------------------------------- * + * Common needed functions * + * * + * -> * + * * + * All directives are explained within this file * + * + * Copyright (C) 2008 Adiscon GmbH. + * + * This file is part of phpLogCon. + * + * PhpLogCon is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PhpLogCon is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with phpLogCon. If not, see . + * + * A copy of the GPL can be found in the file "COPYING" in this + * distribution. + ********************************************************************* +*/ + +// --- Avoid directly accessing this file! +if ( !defined('IN_PHPLOGCON') ) +{ + die('Hacking attempt'); + exit; +} +// --- + +// --- Basic Includes +include($gl_root_path . 'include/constants_general.php'); +include($gl_root_path . 'include/constants_logstream.php'); + +/* +if ( is_file($gl_root_path . 'config.php') ) + include($gl_root_path . 'config.php'); +else +{ + // Check for installscript! + if ( !defined('IN_PHPLOGCON_INSTALL') ) + CheckForInstallPhp(); +} +*/ + +include($gl_root_path . 'classes/class_template.php'); +include($gl_root_path . 'include/functions_themes.php'); +include($gl_root_path . 'include/functions_db.php'); +include($gl_root_path . 'include/functions_config.php'); +// --- + +// --- Define Basic vars +$RUNMODE = RUNMODE_WEBSERVER; +$DEBUGMODE = DEBUG_INFO; + +// --- Disable ARGV setting @webserver! +ini_set( "register_argc_argv", "Off" ); +// --- + +// Default language +$LANG_EN = "en"; // Used for fallback +$LANG = "en"; // Default language + +// Default Template vars +$content['BUILDNUMBER'] = "2.3.4"; +$content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title +$content['BASEPATH'] = $gl_root_path; +$content['EXTRA_METATAGS'] = ""; +$content['EXTRA_JAVASCRIPT'] = ""; +$content['EXTRA_STYLESHEET'] = ""; +// --- + +// --- Check PHP Version! If lower the 5, phplogcon will not work proberly! +$myPhpVer = phpversion(); +$myPhpVerArray = explode('.', $myPhpVer); +if ( $myPhpVerArray[0] < 5 ) + DieWithErrorMsg( 'Error, the PHP Version on this Server does not meet the installation requirements.
      PHP5 or higher is needed. Current installed Version is: ' . $myPhpVer . ''); +// --- + +function InitBasicPhpLogCon() +{ + // Needed to make global + global $CFG, $gl_root_path, $content; + + // Check RunMode first! + CheckAndSetRunMode(); + + // Set the default line sep + SetLineBreakVar(); + + // Start the PHP Session + StartPHPSession(); +} + +function InitPhpLogConConfigFile($bHandleMissing = true) +{ + // Needed to make global + global $CFG, $gl_root_path, $content; + + if ( file_exists($gl_root_path . 'config.php') && GetFileLength($gl_root_path . 'config.php') > 0 ) + { + // Include the main config + include_once($gl_root_path . 'config.php'); + + // Easier DB Access + define('DB_CONFIG', $CFG['UserDBPref'] . "config"); + + // If DEBUG Mode is enabled, we prepend the UID field into the col list! + if ( $CFG['MiscShowDebugMsg'] == 1 ) + array_unshift($CFG['Columns'], SYSLOG_UID); + + // Now Copy all entries into content variable + foreach ($CFG as $key => $value ) + $content[$key] = $value; + + // For MiscShowPageRenderStats + if ( $CFG['MiscShowPageRenderStats'] == 1 ) + { + $content['ShowPageRenderStats'] = "true"; + InitPageRenderStats(); + } + + // return result + return true; + } + else + { + // if handled ourselfe, we die in CheckForInstallPhp. + if ( $bHandleMissing == true ) + { + // Check for installscript! + CheckForInstallPhp(); + } + else + return false; + } +} + +function CheckForInstallPhp() +{ + // Check for installscript! + if ( file_exists($content['BASEPATH'] . "install.php") ) + $strinstallmsg = '

      ' + . '
      Click here to Install PhpLogCon!

      ' +// . 'See the Installation Guides for more Details!
      ' +// . 'English Installation Guide | ' +// . 'German Installation Guide

      ' +// . 'Also take a look to the Readme for some basics around PhpLogCon!
      ' + . '
      '; + else + $strinstallmsg = ""; + DieWithErrorMsg( 'Error, main configuration file is missing!' . $strinstallmsg ); +} + +function GetFileLength($szFileName) +{ + if ( is_file($szFileName) ) + return filesize($szFileName); + else + return 0; +} + +function InitPhpLogCon() +{ + // Needed to make global + global $CFG, $gl_root_path, $content; + + // Init Basics which do not need a database + InitBasicPhpLogCon(); + + // Will init the config file! + InitPhpLogConConfigFile(); + + // Moved here, because we do not need if GZIP needs to be enabled before the config is loaded! + InitRuntimeInformations(); + + // Establish DB Connection + if ( $CFG['UserDBEnabled'] ) + DB_Connect(); + + // Now load the Page configuration values + InitConfigurationValues(); + + // Now Create Themes List because we haven't the config before! + CreateThemesList(); + + // Create Language List + CreateLanguageList(); + + // Init Predefined Searches List + CreatePredefinedSearches(); + + // Init predefined paging sizes + CreatePagesizesList(); + + // Init predefined reload times + CreateReloadTimesList(); + + // --- Enable PHP Debug Mode + InitPhpDebugMode(); + // --- +} + +function CreateLogLineTypesList( $selectedType ) +{ + global $content; + + // syslog + $content['LOGLINETYPES']["syslog"]['type'] = "syslog"; + $content['LOGLINETYPES']["syslog"]['DisplayName'] = "Syslog / RSyslog"; + if ( $selectedType == $content['LOGLINETYPES']["syslog"]['type'] ) { $content['LOGLINETYPES']["syslog"]['selected'] = "selected"; } else { $content['LOGLINETYPES']["syslog"]['selected'] = ""; } + + // Adiscon Winsyslog + $content['LOGLINETYPES']["winsyslog"]['type'] = "winsyslog"; + $content['LOGLINETYPES']["winsyslog"]['DisplayName'] = "Adiscon WinSyslog"; + if ( $selectedType == $content['LOGLINETYPES']["winsyslog"]['type'] ) { $content['LOGLINETYPES']["winsyslog"]['selected'] = "selected"; } else { $content['LOGLINETYPES']["winsyslog"]['selected'] = ""; } +} + +function CreateSourceTypesList( $selectedSource ) +{ + global $content; + + // SOURCE_DISK + $content['SOURCETYPES'][SOURCE_DISK]['type'] = SOURCE_DISK; + $content['SOURCETYPES'][SOURCE_DISK]['DisplayName'] = $content['LN_GEN_SOURCE_DISK']; + if ( $selectedSource == $content['SOURCETYPES'][SOURCE_DISK]['type'] ) { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = ""; } + + // SOURCE_DB ( MYSQL NATIVE ) + $content['SOURCETYPES'][SOURCE_DB]['type'] = SOURCE_DB; + $content['SOURCETYPES'][SOURCE_DB]['DisplayName'] = $content['LN_GEN_SOURCE_DB']; + if ( $selectedSource == $content['SOURCETYPES'][SOURCE_DB]['type'] ) { $content['SOURCETYPES'][SOURCE_DB]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_DB]['selected'] = ""; } + + // SOURCE_PDO ( PDO DB Wrapper) + $content['SOURCETYPES'][SOURCE_PDO]['type'] = SOURCE_PDO; + $content['SOURCETYPES'][SOURCE_PDO]['DisplayName'] = $content['LN_GEN_SOURCE_PDO']; + if ( $selectedSource == $content['SOURCETYPES'][SOURCE_PDO]['type'] ) { $content['SOURCETYPES'][SOURCE_PDO]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_PDO]['selected'] = ""; } +} + +function CreateDBTypesList( $selectedDBType ) +{ + global $content; + + // DB_MYSQL + $content['DBTYPES'][DB_MYSQL]['type'] = DB_MYSQL; + $content['DBTYPES'][DB_MYSQL]['typeastext'] = "DB_MYSQL"; + $content['DBTYPES'][DB_MYSQL]['DisplayName'] = $content['LN_GEN_DB_MYSQL']; + if ( $selectedDBType == $content['DBTYPES'][DB_MYSQL]['type'] ) { $content['DBTYPES'][DB_MYSQL]['selected'] = "selected"; } else { $content['DBTYPES'][DB_MYSQL]['selected'] = ""; } + + // DB_MSSQL + $content['DBTYPES'][DB_MSSQL]['type'] = DB_MSSQL; + $content['DBTYPES'][DB_MSSQL]['typeastext'] = "DB_MSSQL"; + $content['DBTYPES'][DB_MSSQL]['DisplayName'] = $content['LN_GEN_DB_MSSQL']; + if ( $selectedDBType == $content['DBTYPES'][DB_MSSQL]['type'] ) { $content['DBTYPES'][DB_MSSQL]['selected'] = "selected"; } else { $content['DBTYPES'][DB_MSSQL]['selected'] = ""; } + + // DB_ODBC + $content['DBTYPES'][DB_ODBC]['type'] = DB_ODBC; + $content['DBTYPES'][DB_ODBC]['typeastext'] = "DB_ODBC"; + $content['DBTYPES'][DB_ODBC]['DisplayName'] = $content['LN_GEN_DB_ODBC']; + if ( $selectedDBType == $content['DBTYPES'][DB_ODBC]['type'] ) { $content['DBTYPES'][DB_ODBC]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_ODBC]['selected'] = ""; } + + // DB_PGSQL + $content['DBTYPES'][DB_PGSQL]['type'] = DB_PGSQL; + $content['DBTYPES'][DB_PGSQL]['typeastext'] = "DB_PGSQL"; + $content['DBTYPES'][DB_PGSQL]['DisplayName'] = $content['LN_GEN_DB_PGSQL']; + if ( $selectedDBType == $content['DBTYPES'][DB_PGSQL]['type'] ) { $content['DBTYPES'][DB_PGSQL]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_PGSQL]['selected'] = ""; } + + // DB_OCI + $content['DBTYPES'][DB_OCI]['type'] = DB_OCI; + $content['DBTYPES'][DB_OCI]['typeastext'] = "DB_OCI"; + $content['DBTYPES'][DB_OCI]['DisplayName'] = $content['LN_GEN_DB_OCI']; + if ( $selectedDBType == $content['DBTYPES'][DB_OCI]['type'] ) { $content['DBTYPES'][DB_OCI]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_OCI]['selected'] = ""; } + + // DB_DB2 + $content['DBTYPES'][DB_DB2]['type'] = DB_DB2; + $content['DBTYPES'][DB_DB2]['typeastext'] = "DB_DB2"; + $content['DBTYPES'][DB_DB2]['DisplayName'] = $content['LN_GEN_DB_DB2']; + if ( $selectedDBType == $content['DBTYPES'][DB_DB2]['type'] ) { $content['DBTYPES'][DB_DB2]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_DB2]['selected'] = ""; } + + // DB_FIREBIRD + $content['DBTYPES'][DB_FIREBIRD]['type'] = DB_FIREBIRD; + $content['DBTYPES'][DB_FIREBIRD]['typeastext'] = "DB_FIREBIRD"; + $content['DBTYPES'][DB_FIREBIRD]['DisplayName'] = $content['LN_GEN_DB_FIREBIRD']; + if ( $selectedDBType == $content['DBTYPES'][DB_FIREBIRD]['type'] ) { $content['DBTYPES'][DB_FIREBIRD]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_FIREBIRD]['selected'] = ""; } + + // DB_INFORMIX + $content['DBTYPES'][DB_INFORMIX]['type'] = DB_INFORMIX; + $content['DBTYPES'][DB_INFORMIX]['typeastext'] = "DB_INFORMIX"; + $content['DBTYPES'][DB_INFORMIX]['DisplayName'] = $content['LN_GEN_DB_INFORMIX']; + if ( $selectedDBType == $content['DBTYPES'][DB_INFORMIX]['type'] ) { $content['DBTYPES'][DB_INFORMIX]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_INFORMIX]['selected'] = ""; } + + // DB_SQLITE + $content['DBTYPES'][DB_SQLITE]['type'] = DB_SQLITE; + $content['DBTYPES'][DB_SQLITE]['typeastext'] = "DB_SQLITE"; + $content['DBTYPES'][DB_SQLITE]['DisplayName'] = $content['LN_GEN_DB_SQLITE']; + if ( $selectedDBType == $content['DBTYPES'][DB_SQLITE]['type'] ) { $content['DBTYPES'][DB_SQLITE]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_SQLITE]['selected'] = ""; } +} + +function CreatePagesizesList() +{ + global $CFG, $content; + + $iCounter = 0; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_GEN_PRECONFIGURED'] . " (" . $CFG['ViewEntriesPerPage'] . ")", "Value" => $CFG['ViewEntriesPerPage'] ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 25 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 25 ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 50 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 50 ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 75 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 75 ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 100 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 100 ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 250 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 250 ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 500 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 500 ); $iCounter++; + + // Set default selected pagesize + $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Selected"] = "selected"; + + // The content variable will now contain the user selected oaging size + $content["ViewEntriesPerPage"] = $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Value"]; +} + +function CreateReloadTimesList() +{ + global $CFG, $content; + +// $CFG['ViewEnableAutoReloadSeconds'] + $iCounter = 0; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_DISABLED'], "Value" => 0 ); $iCounter++; + if ( isset($CFG['ViewEnableAutoReloadSeconds']) && $CFG['ViewEnableAutoReloadSeconds'] > 0 ) + { + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_PRECONFIGURED'] . " (" . $CFG['ViewEnableAutoReloadSeconds'] . " " . $content['LN_AUTORELOAD_SECONDS'] . ") ", "Value" => $CFG['ViewEnableAutoReloadSeconds'] ); $iCounter++; + } + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 5 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 5 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 10 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 10 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 15 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 15 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 30 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 30 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 60 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 60 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 5 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 300 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 10 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 600 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 15 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 900 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 30 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 1800 ); $iCounter++; + + // Set default selected autoreloadid + $content['reloadtimes'][ $_SESSION['AUTORELOAD_ID'] ]["Selected"] = "selected"; + + // The content variable will now contain the user selected oaging size + $content["ViewEnableAutoReloadSeconds"] = $content['reloadtimes'][ $_SESSION['AUTORELOAD_ID'] ]["Value"]; + +} + +function CreatePredefinedSearches() +{ + global $CFG, $content; + if ( isset($CFG['Search']) ) + { + // Enable predefined searches + $content['EnablePredefinedSearches'] = true; + + // Loop through all predefined searches! + foreach ($CFG['Search'] as $mykey => $mySearch) + { + // Copy configured searches into content array! + $content['Search'][$mykey]["ID"] = $mykey; + $content['Search'][$mykey]["Selected"] = false; + + // --- Set CSS Class + if ( $mykey % 2 == 0 ) + $content['Search'][$mykey]['cssclass'] = "line1"; + else + $content['Search'][$mykey]['cssclass'] = "line2"; + // --- + + } + } + else // Disable predefined searches + $content['EnablePredefinedSearches'] = false; +} + +function InitPhpDebugMode() +{ + global $content, $CFG; + + // --- Set Global DEBUG Level! + if ( $CFG['MiscShowDebugMsg'] == 1 ) + ini_set( "error_reporting", E_ALL ); // ALL PHP MESSAGES! +// else +// ini_set( "error_reporting", E_ERROR ); // ONLY PHP ERROR'S! + // --- +} + +function CheckAndSetRunMode() +{ + global $RUNMODE, $MaxExecutionTime; + // Set to command line mode if argv is set! + if ( !isset($_SERVER["GATEWAY_INTERFACE"]) ) + $RUNMODE = RUNMODE_COMMANDLINE; + + // Obtain max_execution_time + $MaxExecutionTime = ini_get("max_execution_time"); +} + +function InitRuntimeInformations() +{ + global $content, $CFG; + + // TODO| maybe not needed! + + // Enable GZIP Compression if enabled! + if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && (isset($CFG['MiscEnableGzipCompression']) && $CFG['MiscEnableGzipCompression'] == 1) ) + { + // This starts gzip compression! + ob_start("ob_gzhandler"); + $content['GzipCompressionEnmabled'] = "yes"; + } + else + $content['GzipCompressionEnmabled'] = "no"; +} + +function CreateDebugModes() +{ + global $content; + + $content['DBGMODES'][0]['DisplayName'] = STR_DEBUG_ULTRADEBUG; + if ( $content['parser_debugmode'] == $content['DBGMODES'][0]['DisplayName'] ) { $content['DBGMODES'][0]['selected'] = "selected"; } else { $content['DBGMODES'][0]['selected'] = ""; } + $content['DBGMODES'][1]['DisplayName'] = STR_DEBUG_DEBUG; + if ( $content['parser_debugmode'] == $content['DBGMODES'][1]['DisplayName'] ) { $content['DBGMODES'][1]['selected'] = "selected"; } else { $content['DBGMODES'][1]['selected'] = ""; } + $content['DBGMODES'][2]['DisplayName'] = STR_DEBUG_INFO; + if ( $content['parser_debugmode'] == $content['DBGMODES'][2]['DisplayName'] ) { $content['DBGMODES'][2]['selected'] = "selected"; } else { $content['DBGMODES'][2]['selected'] = ""; } + $content['DBGMODES'][3]['DisplayName'] = STR_DEBUG_WARN; + if ( $content['parser_debugmode'] == $content['DBGMODES'][3]['DisplayName'] ) { $content['DBGMODES'][3]['selected'] = "selected"; } else { $content['DBGMODES'][3]['selected'] = ""; } + $content['DBGMODES'][4]['DisplayName'] = STR_DEBUG_ERROR; + if ( $content['parser_debugmode'] == $content['DBGMODES'][4]['DisplayName'] ) { $content['DBGMODES'][4]['selected'] = "selected"; } else { $content['DBGMODES'][4]['selected'] = ""; } +} + +function InitFrontEndVariables() +{ + global $content; + + $content['MENU_FOLDER_OPEN'] = $content['BASEPATH'] . "images/icons/folder_closed.png"; + $content['MENU_FOLDER_CLOSED'] = $content['BASEPATH'] . "images/icons/folder.png"; + $content['MENU_HOMEPAGE'] = $content['BASEPATH'] . "images/icons/home.png"; + $content['MENU_LINK'] = $content['BASEPATH'] . "images/icons/link.png"; + $content['MENU_LINK_VIEW'] = $content['BASEPATH'] . "images/icons/link_view.png"; + $content['MENU_VIEW'] = $content['BASEPATH'] . "images/icons/view.png"; + $content['MENU_PREFERENCES'] = $content['BASEPATH'] . "images/icons/preferences.png"; + $content['MENU_ADMINENTRY'] = $content['BASEPATH'] . "images/icons/star_blue.png"; + $content['MENU_ADMINLOGOFF'] = $content['BASEPATH'] . "images/icons/exit.png"; + $content['MENU_ADMINUSERS'] = $content['BASEPATH'] . "images/icons/businessmen.png"; + $content['MENU_SEARCH'] = $content['BASEPATH'] . "images/icons/view.png"; + $content['MENU_SELECTION_DISABLED'] = $content['BASEPATH'] . "images/icons/selection.png"; + $content['MENU_SELECTION_ENABLED'] = $content['BASEPATH'] . "images/icons/selection_delete.png"; + $content['MENU_TEXT_FIND'] = $content['BASEPATH'] . "images/icons/text_find.png"; + $content['MENU_NETWORK'] = $content['BASEPATH'] . "images/icons/earth_network.png"; + + + $content['MENU_PAGER_BEGIN'] = $content['BASEPATH'] . "images/icons/media_beginning.png"; + $content['MENU_PAGER_PREVIOUS'] = $content['BASEPATH'] . "images/icons/media_rewind.png"; + $content['MENU_PAGER_NEXT'] = $content['BASEPATH'] . "images/icons/media_fast_forward.png"; + $content['MENU_PAGER_END'] = $content['BASEPATH'] . "images/icons/media_end.png"; + $content['MENU_NAV_LEFT'] = $content['BASEPATH'] . "images/icons/navigate_left.png"; + $content['MENU_NAV_RIGHT'] = $content['BASEPATH'] . "images/icons/navigate_right.png"; + $content['MENU_NAV_CLOSE'] = $content['BASEPATH'] . "images/icons/navigate_close.png"; + $content['MENU_NAV_OPEN'] = $content['BASEPATH'] . "images/icons/navigate_open.png"; + $content['MENU_PAGER_BEGIN_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_beginning.png"; + $content['MENU_PAGER_PREVIOUS_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_rewind.png"; + $content['MENU_PAGER_NEXT_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_fast_forward.png"; + $content['MENU_PAGER_END_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_end.png"; + + $content['MENU_BULLET_BLUE'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_blue.png"; + $content['MENU_BULLET_GREEN'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_green.png"; + $content['MENU_BULLET_RED'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_red.png"; + $content['MENU_BULLET_YELLOW'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_yellow.png"; + $content['MENU_BULLET_GREY'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_grey.png"; + + $content['MENU_ICON_GOOGLE'] = $content['BASEPATH'] . "images/icons/googleicon.png"; +} + +// Lang Helper for Strings with ONE variable +function GetAndReplaceLangStr( $strlang, $param1 = "", $param2 = "", $param3 = "", $param4 = "", $param5 = "" ) +{ + $strfinal = str_replace ( "%1", $param1, $strlang ); + if ( strlen($param2) > 0 ) + $strfinal = str_replace ( "%1", $param2, $strfinal ); + if ( strlen($param3) > 0 ) + $strfinal = str_replace ( "%1", $param3, $strfinal ); + if ( strlen($param4) > 0 ) + $strfinal = str_replace ( "%1", $param4, $strfinal ); + if ( strlen($param5) > 0 ) + $strfinal = str_replace ( "%1", $param5, $strfinal ); + + // And return + return $strfinal; +} + +function InitConfigurationValues() +{ + global $content, $CFG, $LANG, $gl_root_path; + + // If Database is enabled, try to read from database! + if ( $CFG['UserDBEnabled'] ) + { + $result = DB_Query("SELECT * FROM " . DB_CONFIG); + $rows = DB_GetAllRows($result, true, true); + + if ( isset($rows ) ) + { + for($i = 0; $i < count($rows); $i++) + $content[ $rows[$i]['name'] ] = $rows[$i]['value']; + } + // General defaults + // --- Language Handling + if ( !isset($content['gen_lang']) ) { $content['gen_lang'] = $CFG['ViewDefaultLanguage'] /*"en"*/; } + + // --- PHP Debug Mode + if ( !isset($content['gen_phpdebug']) ) { $content['gen_phpdebug'] = "no"; } + // --- + + // Database Version Checker! + if ( $content['database_internalversion'] > $content['database_installedversion'] ) + { + // Database is out of date, we need to upgrade + $content['database_forcedatabaseupdate'] = "yes"; + } + } + else + { + // --- Set Defaults... + // Language Handling + if ( isset($_SESSION['CUSTOM_LANG']) && VerifyLanguage($_SESSION['CUSTOM_LANG']) ) + { + $content['user_lang'] = $_SESSION['CUSTOM_LANG']; + $LANG = $content['user_lang']; + } + else if ( isset($content['gen_lang']) && VerifyLanguage($content['gen_lang'])) + { + $content['user_lang'] = $content['gen_lang']; + $LANG = $content['user_lang']; + } + else // Failsave! + { + $content['user_lang'] = $CFG['ViewDefaultLanguage'] /*"en"*/; + $LANG = $content['user_lang']; + $content['gen_lang'] = $content['user_lang']; + } + } + + // Paging Size handling! + if ( !isset($_SESSION['PAGESIZE_ID']) ) + { + // Default is 0! + $_SESSION['PAGESIZE_ID'] = 0; + } + + // Auto reload handling! + if ( !isset($_SESSION['AUTORELOAD_ID']) ) + { + if ( isset($CFG['ViewEnableAutoReloadSeconds']) && $CFG['ViewEnableAutoReloadSeconds'] > 0 ) + $_SESSION['AUTORELOAD_ID'] = 1; // Autoreload ID will be the first item! + else // Default is 0, which means auto reload disabled + $_SESSION['AUTORELOAD_ID'] = 0; + } + + // Theme Handling + if ( !isset($content['web_theme']) ) { $content['web_theme'] = $CFG['ViewDefaultTheme'] /*"default"*/; } + if ( isset($_SESSION['CUSTOM_THEME']) && VerifyTheme($_SESSION['CUSTOM_THEME']) ) + $content['user_theme'] = $_SESSION['CUSTOM_THEME']; + else + $content['user_theme'] = $content['web_theme']; + + //Init Theme About Info ^^ + InitThemeAbout($content['user_theme']); + // --- + + // Init main langauge file now! + IncludeLanguageFile( $gl_root_path . '/lang/' . $LANG . '/main.php' ); + + // Init other things which are needed + InitFrontEndVariables(); +} + +function SetDebugModeFromString( $facility ) +{ + global $DEBUGMODE; + + switch ( $facility ) + { + case STR_DEBUG_ULTRADEBUG: + $DEBUGMODE = DEBUG_ULTRADEBUG; + break; + case STR_DEBUG_DEBUG: + $DEBUGMODE = DEBUG_DEBUG; + break; + case STR_DEBUG_INFO: + $DEBUGMODE = DEBUG_INFO; + break; + case STR_DEBUG_WARN: + $DEBUGMODE = DEBUG_WARN; + break; + case STR_DEBUG_ERROR: + $DEBUGMODE = DEBUG_ERROR; + break; + } +} + + +function InitPageRenderStats() +{ + global $gl_starttime, $querycount; + $gl_starttime = microtime_float(); + $querycount = 0; +} + +function FinishPageRenderStats( &$mycontent) +{ + global $gl_starttime, $querycount; + + $endtime = microtime_float(); + $mycontent['PAGERENDERTIME'] = number_format($endtime - $gl_starttime, 4, '.', ''); + $mycontent['TOTALQUERIES'] = $querycount; +} + +function microtime_float() +{ + list($usec, $sec) = explode(" ", microtime()); + return ((float)$usec + (float)$sec); +} + +function SetLineBreakVar() +{ + // Used for some functions + global $RUNMODE, $linesep; + + if ( $RUNMODE == RUNMODE_COMMANDLINE ) + $linesep = "\r\n"; + else if ( $RUNMODE == RUNMODE_WEBSERVER ) + $linesep = "
      "; +} + +function CheckUrlOrIP($ip) +{ + $long = ip2long($ip); + if ( $long == -1 ) + return false; + else + return true; +} + +function DieWithErrorMsg( $szerrmsg ) +{ + global $content; + print(""); + print("

      Critical Error occured


      "); + print("Errordetails:
      " . $szerrmsg); + print("
      "); + + exit; +} + +function DieWithFriendlyErrorMsg( $szerrmsg ) +{ + //TODO: Make with template + print(""); + print("

      Error occured


      "); + print("Errordetails:
      " . $szerrmsg); + exit; +} + +/* +* Helper function to initialize the page title! +*/ +function InitPageTitle() +{ + global $content, $CFG, $currentSourceID; + + if ( isset($CFG['PrependTitle']) && strlen($CFG['PrependTitle']) > 0 ) + $szReturn = $CFG['PrependTitle'] . " :: "; + else + $szReturn = ""; + + if ( isset($currentSourceID) && isset($content['Sources'][$currentSourceID]['Name']) ) + $szReturn .= "Source '" . $content['Sources'][$currentSourceID]['Name'] . "' :: "; + + // Append phpLogCon + $szReturn .= "phpLogCon"; + + // return result + return $szReturn; +} + + +function GetStringWithHTMLCodes($myStr) +{ + // Replace all special characters with valid html representations + return htmlentities($myStr); +} + +function InitTemplateParser() +{ + global $page, $gl_root_path; + // ----------------------------------------------- + // Create Template Object and set some variables for the templates + // ----------------------------------------------- + $page = new Template(); + $page -> set_path ( $gl_root_path . "templates/" ); +} + +function VerifyLanguage( $mylang ) +{ + global $gl_root_path; + + if ( is_dir( $gl_root_path . 'lang/' . $mylang ) ) + return true; + else + return false; +} + +function IncludeLanguageFile( $langfile ) +{ + global $LANG, $LANG_EN; + + if ( file_exists( $langfile ) ) + include( $langfile ); + else + { + $langfile = str_replace( $LANG, $LANG_EN, $langfile ); + include( $langfile ); + } +} + +function RedirectPage( $newpage ) +{ + header("Location: $newpage"); + exit; +} + +function RedirectResult( $szMsg, $newpage ) +{ + header("Location: result.php?msg=" . urlencode($szMsg) . "&redir=" . urlencode($newpage)); + exit; +} + +/* +* GetEventTime +* +* Helper function to parse and obtain a valid EventTime Array from the input string. +* Return value: EventTime Array! +* +*/ +function GetEventTime($szTimStr) +{ + // Sample: Mar 10 14:45:44 + if ( preg_match("/(...) ([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) + { + // RFC 3164 typical timestamp + $eventtime[EVTIME_TIMESTAMP] = mktime($out[3], $out[4], $out[5], GetMonthFromString($out[1]), $out[2]); + $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! + $eventtime[EVTIME_MICROSECONDS] = 0; + +// echo gmdate(DATE_RFC822, $eventtime[EVTIME_TIMESTAMP]) . "
      "; +// print_r ( $eventtime ); +// exit; + } + // Sample: 2008-04-02T11:12:32+02:00 + else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\+([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) + { + // RFC 3164 typical timestamp + $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); + $eventtime[EVTIME_TIMEZONE] = $out[7]; + $eventtime[EVTIME_MICROSECONDS] = 0; + } + // Sample: 2008-04-02T11:12:32.380449+02:00 + else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\.([0-9]{1,6})\+([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) + { + // RFC 3164 typical timestamp + $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); + $eventtime[EVTIME_TIMEZONE] = $out[8]; + $eventtime[EVTIME_MICROSECONDS] = $out[7]; + } + // Sample: 2008-04-02,15:19:06 + else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2}),([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) + { + // RFC 3164 typical timestamp + $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); + $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! + $eventtime[EVTIME_MICROSECONDS] = 0; + } + // Sample: 2008-02-19 12:52:37 + else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) + { + // RFC 3164 typical timestamp + $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); + $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! + $eventtime[EVTIME_MICROSECONDS] = 0; + } + // Sample: 2007-4-18T00:00:00 + else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) + { + // RFC 3164 typical timestamp + $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); + $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! + $eventtime[EVTIME_MICROSECONDS] = 0; + } + else + { + die ("wtf GetEventTime unparsable time - " . $szTimStr ); + } + + // return result! + return $eventtime; +} + +/* +* GetMonthFromString +* +* Simple Helper function to obtain the numeric represantation of the month +*/ +function GetMonthFromString($szMonth) +{ + switch($szMonth) + { + case "Jan": + return 1; + case "Feb": + return 2; + case "Mar": + return 3; + case "Apr": + return 4; + case "May": + return 5; + case "Jun": + return 6; + case "Jul": + return 7; + case "Aug": + return 8; + case "Sep": + return 9; + case "Oct": + return 10; + case "Nov": + return 11; + case "Dez": + return 12; + } +} + +/* +* AddContextLinks +*/ +function AddContextLinks(&$sourceTxt) +{ + global $szTLDDomains, $CFG; + + // Return if not enabled! + if ( !isset($CFG['EnableIPAddressResolve']) || $CFG['EnableIPAddressResolve'] == 1 ) + { + // Search for IP's and Add Reverse Lookup first! + $sourceTxt = preg_replace( '/([^\[])\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/e', "'\\1\\2.\\3.\\4.\\5' . ReverseResolveIP('\\2.\\3.\\4.\\5', ' {', '} ')", $sourceTxt ); + } + + // Create if not set! + if ( !isset($szTLDDomains) ) + CreateTopLevelDomainSearch(); + + // Create Search Array + $search = array + ( + '/\.([\w\d\_\-]+)\.(' . $szTLDDomains . ')([^a-zA-Z0-9\.])/x', +// '|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|', + '/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/x', + ); + + // Create Replace Array + $replace = array + ( + '.$1.$2$3', + '$1.$2.$3.$4', + ); + + // Replace and return! + $sourceTxt = preg_replace( $search, $replace, $sourceTxt ); + +//echo $outTxt . "
      " ; +//return $outTxt; +} + +/* +* Reserve Resolve IP Address! +*/ +function ReverseResolveIP( $szIP, $prepend, $append ) +{ + global $gl_starttime, $MaxExecutionTime; + + // Substract 5 savety seconds! + $scriptruntime = intval(microtime_float() - $gl_starttime); + if ( $scriptruntime > ($MaxExecutionTime-5) ) + return ""; + + // Abort if these IP's are postet + if ( strpos($szIP, "0.0.0.0") !== false | strpos($szIP, "127.") !== false | strpos($szIP, "255.255.255.255") !== false ) + return ""; + else + { + // Resolve name if needed + if ( !isset($_SESSION['dns_cache'][$szIP]) ) + $_SESSION['dns_cache'][$szIP] = gethostbyaddr($szIP); + + // Abort if IP and RESOLVED name are the same ^^! + if ( $_SESSION['dns_cache'][$szIP] == $szIP || strlen($_SESSION['dns_cache'][$szIP]) <= 0 ) + return; + + // Create string + $szReturn = $prepend; + $szReturn .= $_SESSION['dns_cache'][$szIP]; + $szReturn .= $append; + + // return result + return $szReturn; + } +} + +/* +* Helper function to create a top level domain search string ONCE per process! +*/ +function CreateTopLevelDomainSearch() +{ + // Current list taken from http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains! + global $szTLDDomains; + $szTLDDomains = "co.th|com.au|co.uk|co.jp"; + $szTLDDomains .= "aero|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel|cTLD|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw"; +} + +// --- BEGIN Usermanagement Function --- +function StartPHPSession() +{ + global $RUNMODE; + if ( $RUNMODE == RUNMODE_WEBSERVER ) + { + // This will start the session + if (session_id() == "") + session_start(); + + if ( !isset($_SESSION['SESSION_STARTED']) ) + $_SESSION['SESSION_STARTED'] = "true"; + } +} + +function CheckForUserLogin( $isloginpage, $isUpgradePage = false ) +{ + global $content; + + if ( isset($_SESSION['SESSION_LOGGEDIN']) ) + { + if ( !$_SESSION['SESSION_LOGGEDIN'] ) + RedirectToUserLogin(); + else + { + $content['SESSION_LOGGEDIN'] = "true"; + $content['SESSION_USERNAME'] = $_SESSION['SESSION_USERNAME']; + } + + // New, Check for database Version and may redirect to updatepage! + if ( isset($content['database_forcedatabaseupdate']) && + $content['database_forcedatabaseupdate'] == "yes" && + $isUpgradePage == false + ) + RedirectToDatabaseUpgrade(); + } + else + { + if ( $isloginpage == false ) + RedirectToUserLogin(); + } + +} + +function CreateUserName( $username, $password, $access_level ) +{ + $md5pass = md5($password); + $result = DB_Query("SELECT username FROM " . STATS_USERS . " WHERE username = '" . $username . "'"); + $rows = DB_GetAllRows($result, true); + if ( isset($rows) ) + { + DieWithFriendlyErrorMsg( "User $username already exists!" ); + + // User not created! + return false; + } + else + { + // Create User + $result = DB_Query("INSERT INTO " . STATS_USERS . " (username, password, access_level) VALUES ('$username', '$md5pass', $access_level)"); + DB_FreeQuery($result); + + // Success + return true; + } +} + +function CheckUserLogin( $username, $password ) +{ + global $content, $CFG; + + // TODO: SessionTime and AccessLevel check + + $md5pass = md5($password); + $sqlselect = "SELECT access_level FROM " . STATS_USERS . " WHERE username = '" . $username . "' and password = '" . $md5pass . "'"; + $result = DB_Query($sqlselect); + $rows = DB_GetAllRows($result, true); + if ( isset($rows) ) + { + $_SESSION['SESSION_LOGGEDIN'] = true; + $_SESSION['SESSION_USERNAME'] = $username; + $_SESSION['SESSION_ACCESSLEVEL'] = $rows[0]['access_level']; + + $content['SESSION_LOGGEDIN'] = "true"; + $content['SESSION_USERNAME'] = $username; + + // Success ! + return true; + } + else + { + if ( $CFG['MiscShowDebugMsg'] == 1 ) + DieWithFriendlyErrorMsg( "Debug Error: Could not login user '" . $username . "'

      Sessionarray
      " . var_export($_SESSION, true) . "

      SQL Statement: " . $sqlselect ); + + // Default return false + return false; + } +} + +function DoLogOff() +{ + global $content; + + unset( $_SESSION['SESSION_LOGGEDIN'] ); + unset( $_SESSION['SESSION_USERNAME'] ); + unset( $_SESSION['SESSION_ACCESSLEVEL'] ); + + // Redir to Index Page + RedirectPage( "index.php"); +} + +function RedirectToUserLogin() +{ + // TODO Referer + header("Location: login.php?referer=" . $_SERVER['PHP_SELF']); + exit; +} + +function RedirectToDatabaseUpgrade() +{ + // TODO Referer + header("Location: upgrade.php"); // ?referer=" . $_SERVER['PHP_SELF']); + exit; +} +// --- END Usermanagement Function --- + + ?> \ No newline at end of file From d7740b0fa71865d0a60c05c8885bc52e1e6fa4f8 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 6 Jun 2008 16:57:22 +0200 Subject: [PATCH 49/79] Incremented build number --- src/include/functions_common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 777f823..c9ef71d 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -73,7 +73,7 @@ $LANG_EN = "en"; // Used for fallback $LANG = "en"; // Default language // Default Template vars -$content['BUILDNUMBER'] = "2.3.4"; +$content['BUILDNUMBER'] = "2.3.5"; $content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title $content['BASEPATH'] = $gl_root_path; $content['EXTRA_METATAGS'] = ""; From 050b18c409d4fa0d325f787559b9f95cfc5eecd4 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 6 Jun 2008 17:04:16 +0200 Subject: [PATCH 50/79] Added changelog entry --- ChangeLog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0f32e88..1e26b6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,13 @@ --------------------------------------------------------------------------- +Version 2.3.5 (devel), 2008-06-06 +- Enhanced the detected of IP Addresses and domain names, so the automatic + generated context links match better now. +- Added new option (enabled by default) to resolve IP Addresses into + hostnames. Note that this will only be done if the IP Address is NOT in + square brackets. The resolved names will be cached in the users session, + to speed up the resolving process. The resolved IP Addresses will be + injected behind the IP Address in curly brackets, and a diffirent colour. +--------------------------------------------------------------------------- Version 2.3.4 (devel), 2008-06-02 - Added new feature to automatically link IP and domain names with our whois search engine. So you can research these informations with one From 75a8086806c9c264d6cfa491bcae4dc8fe4085b8 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 6 Jun 2008 17:17:38 +0200 Subject: [PATCH 51/79] Fixed display bug with icons before message --- src/templates/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/templates/index.html b/src/templates/index.html index 35c75cd..957e720 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -220,6 +220,7 @@
      + - + - - + From 06e2e4a9740d7a4f2309e44411cca7c45763abea Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 9 Jun 2008 16:43:01 +0200 Subject: [PATCH 52/79] Added new feature of configureable views which can be configured and selected by source If no VIEW is defined in the options of the current selected source, the default VIEW will be selected. If no default VIEW is configured, the default will be set ot the SYSLOG View. The old Column format will also automatically converted into the new list of views. So in case you have no default view set in your configuration, but the columns variable, your old column format becomes the default view. --- src/include/functions_common.php | 23 +++----- src/include/functions_config.php | 87 +++++++++++++++++++++++++++++++ src/index.php | 3 ++ src/lang/de/main.php | 1 + src/lang/en/main.php | 2 + src/templates/include_header.html | 26 +++++++-- src/userchange.php | 20 +++++++ 7 files changed, 143 insertions(+), 19 deletions(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index c9ef71d..2bb75ac 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -43,17 +43,6 @@ if ( !defined('IN_PHPLOGCON') ) include($gl_root_path . 'include/constants_general.php'); include($gl_root_path . 'include/constants_logstream.php'); -/* -if ( is_file($gl_root_path . 'config.php') ) - include($gl_root_path . 'config.php'); -else -{ - // Check for installscript! - if ( !defined('IN_PHPLOGCON_INSTALL') ) - CheckForInstallPhp(); -} -*/ - include($gl_root_path . 'classes/class_template.php'); include($gl_root_path . 'include/functions_themes.php'); include($gl_root_path . 'include/functions_db.php'); @@ -101,6 +90,9 @@ function InitBasicPhpLogCon() // Start the PHP Session StartPHPSession(); + + // Init View Configs prior loading config.php! + InitViewConfigs(); } function InitPhpLogConConfigFile($bHandleMissing = true) @@ -116,13 +108,14 @@ function InitPhpLogConConfigFile($bHandleMissing = true) // Easier DB Access define('DB_CONFIG', $CFG['UserDBPref'] . "config"); - // If DEBUG Mode is enabled, we prepend the UID field into the col list! - if ( $CFG['MiscShowDebugMsg'] == 1 ) - array_unshift($CFG['Columns'], SYSLOG_UID); + // Legacy support for old columns definition format! + if ( isset($CFG['Columns']) && is_array($CFG['Columns']) ) + AppendLegacyColumns(); - // Now Copy all entries into content variable + // --- Now Copy all entries into content variable foreach ($CFG as $key => $value ) $content[$key] = $value; + // --- // For MiscShowPageRenderStats if ( $CFG['MiscShowPageRenderStats'] == 1 ) diff --git a/src/include/functions_config.php b/src/include/functions_config.php index b55a387..671ef02 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -64,6 +64,22 @@ if ( !isset($mysource['LogLineType']) ) $content['Sources'][$iSourceID]['LogLineType'] = "syslog"; + // Set different view if necessary + if ( isset($_SESSION[$iSourceID . "-View"]) ) + { + // Overwrite configured view! + $content['Sources'][$iSourceID]['ViewID'] = $_SESSION[$iSourceID . "-View"]; + } + else + { + if ( isset($mysource['ViewID']) ) + // Set to configured Source ViewID + $content['Sources'][$iSourceID]['ViewID'] = $mysource['ViewID']; + else + // Not configured, maybe old legacy cfg. Set default view. + $content['Sources'][$iSourceID]['ViewID'] = strlen($CFG['DefaultViewsID']) > 0 ? $CFG['DefaultViewsID'] : "SYSLOG"; + } + // Only for the display box $content['Sources'][$iSourceID]['selected'] = ""; @@ -161,6 +177,77 @@ // Set for the selection box in the header $content['Sources'][$currentSourceID]['selected'] = "selected"; + + // --- Additional handling needed for the current view! + global $currentViewID; + $currentViewID = $content['Sources'][$currentSourceID]['ViewID']; + + // Set selected state for correct View, for selection box ^^ + $content['Views'][ $currentViewID ]['selected'] = "selected"; + + // If DEBUG Mode is enabled, we prepend the UID field into the col list! + if ( $CFG['MiscShowDebugMsg'] == 1 && isset($content['Views'][$currentViewID]) ) + array_unshift( $content['Views'][$currentViewID]['Columns'], SYSLOG_UID); + // --- + } + + /* + * This function Inits preconfigured Views. + */ + function InitViewConfigs() + { + global $CFG, $content, $currentViewID; + + // Predefined phpLogCon Views + $CFG['Views']['SYSLOG']= array( + 'ID' => "SYSLOG", + 'DisplayName' =>"Syslog Fields", + 'Columns' => array ( SYSLOG_DATE, SYSLOG_FACILITY, SYSLOG_SEVERITY, SYSLOG_HOST, SYSLOG_SYSLOGTAG, SYSLOG_PROCESSID, SYSLOG_MESSAGETYPE, SYSLOG_MESSAGE ), + ); + $CFG['Views']['EVTRPT']= array( + 'ID' => "EVTRPT", + 'DisplayName' =>"EventLog Fields", + 'Columns' => array ( SYSLOG_DATE, SYSLOG_HOST, SYSLOG_SEVERITY, SYSLOG_EVENT_LOGTYPE, SYSLOG_EVENT_SOURCE, SYSLOG_EVENT_ID, SYSLOG_EVENT_USER, SYSLOG_MESSAGE ), + ); + + // Set default of 'DefaultViewsID' + $CFG['DefaultViewsID'] = "SYSLOG"; + + // Loop through views now and copy into content array! + foreach ( $CFG['Views'] as $key => $view ) + { + $content['Views'][$key] = $view; + + /* + // Set View from session if available! + if ( isset($_SESSION['currentSourceID']) ) + { + $currentSourceID = $_SESSION['currentSourceID']; + + if ( isset($_SESSION[$currentSourceID . "-View"]) && ) + $content['Views'][$key]['selected'] = "selected"; + } + */ + } + } + + /* + * This function Inits preconfigured Views. + */ + function AppendLegacyColumns() + { + global $CFG, $content; + + // Init View from legacy Columns + $CFG['Views']['LEGACY']= array( + 'ID' => "LEGACY", + 'DisplayName' =>"Legacy Columns Configuration", + 'Columns' => $CFG['Columns'], + ); + + // set default to legacy of no default view is specified! + if ( !isset($CFG['DefaultViewsID']) || strlen($CFG['DefaultViewsID']) <= 0 ) + $CFG['DefaultViewsID'] = "LEGACY"; } ?> \ No newline at end of file diff --git a/src/index.php b/src/index.php index 0780c1e..fb3b1c4 100644 --- a/src/index.php +++ b/src/index.php @@ -206,6 +206,9 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // Create LogStream Object $stream = $stream_config->LogStreamFactory($stream_config); $stream->SetFilter($content['searchstr']); + + // Copy current used columns here! + $content['Columns'] = $content['Views'][$currentViewID]['Columns']; // --- Init the fields we need foreach($content['Columns'] as $mycolkey) diff --git a/src/lang/de/main.php b/src/lang/de/main.php index 067abdd..e76e87a 100644 --- a/src/lang/de/main.php +++ b/src/lang/de/main.php @@ -55,6 +55,7 @@ $content['LN_GEN_SOURCE_DB'] = "Datenbank"; $content['LN_GEN_DB_FIREBIRD'] = "Firebird/Interbase 6"; $content['LN_GEN_DB_INFORMIX'] = "IBM Informix Dynamic Server"; $content['LN_GEN_DB_SQLITE'] = "SQLite 2"; + $content['LN_GEN_SELECTVIEW'] = "Select View"; // Index Site $content['LN_ERROR_INSTALLFILEREMINDER'] = "Warnung! Du hast das Installationsscript 'install.php' noch nicht aus dem phpLogCon Hauptordner entfernt!"; diff --git a/src/lang/en/main.php b/src/lang/en/main.php index 9f61ae1..751f451 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -56,6 +56,8 @@ $content['LN_GEN_DB_DB2'] = " IBM DB2"; $content['LN_GEN_DB_FIREBIRD'] = "Firebird/Interbase 6"; $content['LN_GEN_DB_INFORMIX'] = "IBM Informix Dynamic Server"; $content['LN_GEN_DB_SQLITE'] = "SQLite 2"; + $content['LN_GEN_SELECTVIEW'] = "Select View"; + // Main Index Site $content['LN_ERROR_INSTALLFILEREMINDER'] = "Warning! You still have NOT removed the 'install.php' from your phpLogCon main directory!"; diff --git a/src/templates/include_header.html b/src/templates/include_header.html index 6899990..5517866 100644 --- a/src/templates/include_header.html +++ b/src/templates/include_header.html @@ -29,7 +29,7 @@  {LN_MAIN_SELECTSTYLE}  - @@ -51,7 +51,7 @@  {LN_GEN_LANGUAGE}  - @@ -71,7 +71,7 @@
       {LN_GEN_SELECTSOURCE}  - @@ -84,7 +84,25 @@
        + +
      + + + + + +
       {LN_GEN_SELECTVIEW}  + + +
      +
      + +
      diff --git a/src/userchange.php b/src/userchange.php index 772ae95..0b84233 100644 --- a/src/userchange.php +++ b/src/userchange.php @@ -62,6 +62,26 @@ if ( isset($_GET['op']) ) $_SESSION['CUSTOM_LANG'] = $_GET['langcode']; } + if ( $_GET['op'] == "changeview" && isset($_GET['viewid']) ) + { + // Obtain VIEW ID! + $newViewID = $_GET['viewid']; + + if ( isset($content['Views'][$newViewID]) && isset($_SESSION['currentSourceID'])) + { + + // Save new View into session! + $_SESSION[$_SESSION['currentSourceID'] . "-View"] = $newViewID; + } + else + { + // DEBUG + echo "DEBUG: " . $_SESSION['currentSourceID'] . " - $newViewID"; + exit; + } + } + + if ( $_GET['op'] == "changepagesize" && isset($_GET['pagesizeid']) ) { if ( intval($_GET['pagesizeid']) >= 0 && intval($_GET['pagesizeid']) < count($content['pagesizes']) ) From 777e69414072358efb84b69b930a565ebebe3db0 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 9 Jun 2008 17:21:44 +0200 Subject: [PATCH 53/79] Added View selector into the installer and the new EnableIPAddressResolve option. Both lately added features can be configured during the installation as well now. --- src/include/config.sample.php | 35 +++++++++++++++------------- src/include/functions_config.php | 1 + src/install.php | 40 +++++++++++++++++++++++++++++++- src/lang/de/main.php | 1 + src/lang/en/main.php | 1 + src/templates/install.html | 16 +++++++++++++ 6 files changed, 77 insertions(+), 17 deletions(-) diff --git a/src/include/config.sample.php b/src/include/config.sample.php index 56ac775..1c6e6d7 100644 --- a/src/include/config.sample.php +++ b/src/include/config.sample.php @@ -75,7 +75,8 @@ $CFG['EnableIPAddressResolve'] = 1; // If enabled, IP Addresses inline message // --- Define which fields you want to see //$CFG['ShowMessage'] = true; // If enabled, the Message column will be appended to the columns list. //Eventlog based fields: $CFG['Columns'] = array ( SYSLOG_DATE, SYSLOG_HOST, SYSLOG_EVENT_LOGTYPE, SYSLOG_EVENT_SOURCE, /*SYSLOG_EVENT_CATEGORY, */SYSLOG_EVENT_ID, SYSLOG_MESSAGE ); -$CFG['Columns'] = array ( SYSLOG_DATE, SYSLOG_FACILITY, SYSLOG_SEVERITY, SYSLOG_HOST, SYSLOG_SYSLOGTAG, SYSLOG_MESSAGETYPE, SYSLOG_MESSAGE ); +//$CFG['Columns'] = array ( SYSLOG_DATE, SYSLOG_FACILITY, SYSLOG_SEVERITY, SYSLOG_HOST, SYSLOG_SYSLOGTAG, SYSLOG_MESSAGETYPE, SYSLOG_MESSAGE ); +$CFG['DefaultViewsID'] = ""; // --- // --- Predefined Searches! @@ -91,22 +92,24 @@ $CFG['Search'][] = array ( "DisplayName" => "All messages from last 31 days", "S // --- Source Options /* Example for DiskType Source: - $CFG['Sources'][Source1]['ID'] = "Source1"; - $CFG['Sources'][Source1]['Name'] = "Syslog Disk File"; - $CFG['Sources'][Source1]['SourceType'] = SOURCE_DISK; - $CFG['Sources'][Source1]['LogLineType'] = "syslog"; - $CFG['Sources'][Source1]['DiskFile'] = "/var/log/syslog"; + $CFG['Sources']['Source1']['ID'] = "Source1"; + $CFG['Sources']['Source1']['Name'] = "Syslog Disk File"; + $CFG['Sources']['Source1']['SourceType'] = SOURCE_DISK; + $CFG['Sources']['Source1']['LogLineType'] = "syslog"; + $CFG['Sources']['Source1']['DiskFile'] = "/var/log/syslog"; + $CFG['Sources']['Source1']['ViewID'] = "SYSLOG"; - $CFG['Sources'][Source2]['ID'] = "Source5"; - $CFG['Sources'][Source2]['Name'] = "WinSyslog DB"; - $CFG['Sources'][Source2]['SourceType'] = SOURCE_DB; - $CFG['Sources'][Source2]['DBTableType'] = "winsyslog"; - $CFG['Sources'][Source2]['DBType'] = DB_MYSQL; - $CFG['Sources'][Source2]['DBServer'] = "localhost"; - $CFG['Sources'][Source2]['DBName'] = "phplogcon"; - $CFG['Sources'][Source2]['DBUser'] = "root"; - $CFG['Sources'][Source2]['DBPassword'] = ""; - $CFG['Sources'][Source2]['DBTableName'] = "systemevents"; + $CFG['Sources']['Source2']['ID'] = "Source5"; + $CFG['Sources']['Source2']['Name'] = "WinSyslog DB"; + $CFG['Sources']['Source2']['SourceType'] = SOURCE_DB; + $CFG['Sources']['Source2']['DBTableType'] = "winsyslog"; + $CFG['Sources']['Source2']['DBType'] = DB_MYSQL; + $CFG['Sources']['Source2']['DBServer'] = "localhost"; + $CFG['Sources']['Source2']['DBName'] = "phplogcon"; + $CFG['Sources']['Source2']['DBUser'] = "root"; + $CFG['Sources']['Source2']['DBPassword'] = ""; + $CFG['Sources']['Source2']['DBTableName'] = "systemevents"; + $CFG['Sources']['Source2']['ViewID'] = "SYSLOG"; */ // --- %Insert Source Here% diff --git a/src/include/functions_config.php b/src/include/functions_config.php index 671ef02..b9eaac3 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -78,6 +78,7 @@ else // Not configured, maybe old legacy cfg. Set default view. $content['Sources'][$iSourceID]['ViewID'] = strlen($CFG['DefaultViewsID']) > 0 ? $CFG['DefaultViewsID'] : "SYSLOG"; + } // Only for the display box diff --git a/src/install.php b/src/install.php index d6b00e5..1fbc98b 100644 --- a/src/install.php +++ b/src/install.php @@ -228,6 +228,17 @@ else if ( $content['INSTALL_STEP'] == 3 ) $content['ViewEnableDetailPopups_true'] = ""; $content['ViewEnableDetailPopups_false'] = "checked"; } + if ( isset($_SESSION['EnableIPAddressResolve']) ) { $content['EnableIPAddressResolve'] = $_SESSION['EnableIPAddressResolve']; } else { $content['EnableIPAddressResolve'] = 1; } + if ( $content['EnableIPAddressResolve'] == 1 ) + { + $content['EnableIPAddressResolve_true'] = "checked"; + $content['EnableIPAddressResolve_false'] = ""; + } + else + { + $content['EnableIPAddressResolve_true'] = ""; + $content['EnableIPAddressResolve_false'] = "checked"; + } // --- // Disable the bottom next button, as the Form in this step has its own button! @@ -315,6 +326,12 @@ else if ( $content['INSTALL_STEP'] == 4 ) $_SESSION['ViewEnableDetailPopups'] = intval( DB_RemoveBadChars($_POST['ViewEnableDetailPopups']) ); else $_SESSION['ViewEnableDetailPopups'] = 1; // Fallback default! + + if ( isset($_POST['EnableIPAddressResolve']) ) + $_SESSION['EnableIPAddressResolve'] = intval( DB_RemoveBadChars($_POST['EnableIPAddressResolve']) ); + else + $_SESSION['EnableIPAddressResolve'] = 1; // Fallback default! + // --- // If UserDB is disabled, skip next step! @@ -463,6 +480,17 @@ else if ( $content['INSTALL_STEP'] == 7 ) if ( isset($_SESSION['SourceType']) ) { $content['SourceType'] = $_SESSION['SourceType']; } else { $content['SourceType'] = SOURCE_DISK; } CreateSourceTypesList($content['SourceType']); if ( isset($_SESSION['SourceName']) ) { $content['SourceName'] = $_SESSION['SourceName']; } else { $content['SourceName'] = "My Syslog Source"; } + + // Init default View + if ( isset($_SESSION['SourceViewID']) ) { $content['SourceViewID'] = $_SESSION['SourceViewID']; } else { $content['SourceViewID'] = 'SYSLOG'; } + foreach ( $content['Views'] as $myView ) + { + if ( $myView['ID'] == $content['SourceViewID'] ) + $content['Views'][ $myView['ID'] ]['selected'] = "selected"; + else + $content['Views'][ $myView['ID'] ]['selected'] = ""; + } + // SOURCE_DISK specific if ( isset($_SESSION['SourceLogLineType']) ) { $content['SourceLogLineType'] = $_SESSION['SourceLogLineType']; } else { $content['SourceLogLineType'] = ""; } @@ -510,6 +538,12 @@ else if ( $content['INSTALL_STEP'] == 8 ) else RevertOneStep( $content['INSTALL_STEP']-1, $content['LN_CFG_PARAMMISSING'] . $content['LN_CFG_NAMEOFTHESOURCE'] ); + if ( isset($_POST['SourceViewID']) ) + $_SESSION['SourceViewID'] = DB_RemoveBadChars($_POST['SourceViewID']); + else + RevertOneStep( $content['INSTALL_STEP']-1, $content['LN_CFG_PARAMMISSING'] . $content['LN_CFG_VIEW'] ); + + // Check DISK Parameters! if ( $_SESSION['SourceType'] == SOURCE_DISK) { @@ -581,10 +615,12 @@ else if ( $content['INSTALL_STEP'] == 8 ) $patterns[] = "/\\\$CFG\['ViewMessageCharacterLimit'\] = [0-9]{1,2};/"; $patterns[] = "/\\\$CFG\['ViewEntriesPerPage'\] = [0-9]{1,2};/"; $patterns[] = "/\\\$CFG\['ViewEnableDetailPopups'\] = [0-9]{1,2};/"; + $patterns[] = "/\\\$CFG\['EnableIPAddressResolve'\] = [0-9]{1,2};/"; $patterns[] = "/\\\$CFG\['UserDBEnabled'\] = [0-9]{1,2};/"; $replacements[] = "\$CFG['ViewMessageCharacterLimit'] = " . $_SESSION['ViewMessageCharacterLimit'] . ";"; $replacements[] = "\$CFG['ViewEntriesPerPage'] = " . $_SESSION['ViewEntriesPerPage'] . ";"; $replacements[] = "\$CFG['ViewEnableDetailPopups'] = " . $_SESSION['ViewEnableDetailPopups'] . ";"; + $replacements[] = "\$CFG['EnableIPAddressResolve'] = " . $_SESSION['EnableIPAddressResolve'] . ";"; $replacements[] = "\$CFG['UserDBEnabled'] = " . $_SESSION['UserDBEnabled'] . ";"; //User Database Options @@ -596,7 +632,9 @@ else if ( $content['INSTALL_STEP'] == 8 ) //Add the first source! $firstsource = "\$CFG['DefaultSourceID'] = 'Source1';\n\n" . "\$CFG['Sources']['Source1']['ID'] = 'Source1';\n" . - "\$CFG['Sources']['Source1']['Name'] = '" . $_SESSION['SourceName'] . "';\n"; + "\$CFG['Sources']['Source1']['Name'] = '" . $_SESSION['SourceName'] . "';\n" . + "\$CFG['Sources']['Source1']['ViewID'] = '" . $_SESSION['SourceViewID'] . "';\n"; + if ( $_SESSION['SourceType'] == SOURCE_DISK ) { $firstsource .= "\$CFG['Sources']['Source1']['SourceType'] = SOURCE_DISK;\n" . diff --git a/src/lang/de/main.php b/src/lang/de/main.php index e76e87a..afded35 100644 --- a/src/lang/de/main.php +++ b/src/lang/de/main.php @@ -145,6 +145,7 @@ $content['LN_CFG_DBSTORAGEENGINE'] = "Datenbank Typ"; $content['LN_CFG_DBTABLENAME'] = "Datenbank Tabellenname"; $content['LN_CFG_NAMEOFTHESOURCE'] = "Name der Quelle"; $content['LN_CFG_FIRSTSYSLOGSOURCE'] = "Erste Syslog Quelle"; + $content['LN_CFG_VIEW'] = "Select View"; // Details page $content['LN_DETAILS_FORSYSLOGMSG'] = "Details für syslog-Nachrichten mit der ID"; diff --git a/src/lang/en/main.php b/src/lang/en/main.php index 751f451..8c67bb0 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -148,6 +148,7 @@ $content['LN_CFG_DBTABLENAME'] = "Database Tablename"; $content['LN_CFG_NAMEOFTHESOURCE'] = "Name of the Source"; $content['LN_CFG_FIRSTSYSLOGSOURCE'] = "First Syslog Source"; $content['LN_CFG_DBROWCOUNTING'] = "Enable Row Counting"; + $content['LN_CFG_VIEW'] = "Select View"; // Details page $content['LN_DETAILS_FORSYSLOGMSG'] = "Details for the syslog messages with id"; diff --git a/src/templates/install.html b/src/templates/install.html index 75e40d5..319d70d 100644 --- a/src/templates/install.html +++ b/src/templates/install.html @@ -183,6 +183,12 @@ Yes No
      Automatically resolved IP Addresses (inline) + Yes No +

       

      @@ -301,6 +307,16 @@
    {LN_CFG_VIEW} + +
    From b6a8f81201d380067a31657bcb3133f56c059a38 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 9 Jun 2008 17:26:56 +0200 Subject: [PATCH 54/79] Incremented build and added changelog entry --- ChangeLog | 6 ++++++ src/include/functions_common.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1e26b6f..6399df1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@ --------------------------------------------------------------------------- +Version 2.3.6 (devel), 2008-06-09 +- Added new feature, multiple configureable views which can be configured + and selected for each source seperately. Old configurations can still + be used with the new Views feature. The installer also supports + selecting the default View for the first added source. +--------------------------------------------------------------------------- Version 2.3.5 (devel), 2008-06-06 - Enhanced the detected of IP Addresses and domain names, so the automatic generated context links match better now. diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 2bb75ac..e282e49 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -62,7 +62,7 @@ $LANG_EN = "en"; // Used for fallback $LANG = "en"; // Default language // Default Template vars -$content['BUILDNUMBER'] = "2.3.5"; +$content['BUILDNUMBER'] = "2.3.6"; $content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title $content['BASEPATH'] = $gl_root_path; $content['EXTRA_METATAGS'] = ""; From 67b91f066155b17efbe45ce25c6632216f8e7e37 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 3 Jul 2008 14:06:56 +0200 Subject: [PATCH 55/79] Added translation for Brazilian Portuguese, thanks to Ricardo Maraschini --- src/lang/pt/info.txt | 1 + src/lang/pt/main.php | 160 +++++++++++++++++++++++++++++++++++++++ src/lang/pt/main.php.bak | 160 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 321 insertions(+) create mode 100644 src/lang/pt/info.txt create mode 100644 src/lang/pt/main.php create mode 100644 src/lang/pt/main.php.bak diff --git a/src/lang/pt/info.txt b/src/lang/pt/info.txt new file mode 100644 index 0000000..83c8031 --- /dev/null +++ b/src/lang/pt/info.txt @@ -0,0 +1 @@ +Portugues diff --git a/src/lang/pt/main.php b/src/lang/pt/main.php new file mode 100644 index 0000000..af3686d --- /dev/null +++ b/src/lang/pt/main.php @@ -0,0 +1,160 @@ + www.phplogcon.org <- + * ----------------------------------------------------------------- + * + * Copyright (C) 2008 Adiscon GmbH. + * + * This file is part of phpLogCon. + * + * Translation by Ricardo Maraschini + * [mailto:ricardo.maraschini@opservices.com.br] + * + * PhpLogCon is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PhpLogCon is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with phpLogCon. If not, see . + * + * A copy of the GPL can be found in the file "COPYING" in this + * distribution. + ********************************************************************* +*/ +global $content; + +// Global Stuff +$content['LN_MAINTITLE'] = "Controle de Logs"; +$content['LN_MAIN_SELECTSTYLE'] = "Selecione um estilo"; +$content['LN_GEN_LANGUAGE'] = "Selecione uma linguagem"; +$content['LN_GEN_SELECTSOURCE'] = "Selecione Origem"; +$content['LN_GEN_MOREPAGES'] = "Mais que uma página disponível"; +$content['LN_GEN_FIRSTPAGE'] = "Primeira Página"; +$content['LN_GEN_LASTPAGE'] = "Última Página"; +$content['LN_GEN_NEXTPAGE'] = "Próxima Página"; +$content['LN_GEN_PREVIOUSPAGE'] = "Página Anterior"; +$content['LN_GEN_RECORDCOUNT'] = "Total de registros encontrados"; +$content['LN_GEN_PAGERSIZE'] = "Registros/página"; +$content['LN_GEN_PAGE'] = "Página"; +$content['LN_GEN_PREDEFINEDSEARCHES'] = "Buscas pré-definidas"; +$content['LN_GEN_SOURCE_DISK'] = "Arquivo em disco"; +$content['LN_GEN_SOURCE_DB'] = "Base de dados"; + $content['LN_GEN_SOURCE_PDO'] = "Database (PDO)"; +$content['LN_GEN_RECORDSPERPAGE'] = "registros por página"; +$content['LN_GEN_PRECONFIGURED'] = "Pré-configurado"; +$content['LN_GEN_AVAILABLESEARCHES'] = "Buscas disponíveis"; + $content['LN_GEN_DB_MYSQL'] = "Mysql Server"; + $content['LN_GEN_DB_MSSQL'] = "Microsoft SQL Server"; + $content['LN_GEN_DB_ODBC'] = "ODBC Database Source"; + $content['LN_GEN_DB_PGSQL'] = "PostgreSQL"; + $content['LN_GEN_DB_OCI'] = "Oracle Call Interface"; + $content['LN_GEN_DB_DB2'] = " IBM DB2"; + $content['LN_GEN_DB_FIREBIRD'] = "Firebird/Interbase 6"; + $content['LN_GEN_DB_INFORMIX'] = "IBM Informix Dynamic Server"; + $content['LN_GEN_DB_SQLITE'] = "SQLite 2"; + $content['LN_GEN_SELECTVIEW'] = "Select View"; + +// Main Index Site +$content['LN_ERROR_INSTALLFILEREMINDER'] = "Atenção! Você ainda NÃO removeu o arquivo 'install.php' do diretório de seu phpLogCon!"; +$content['LN_TOP_NUM'] = "Não."; +$content['LN_TOP_UID'] = "uID"; +$content['LN_GRID_POPUPDETAILS'] = "Detalhes para a mensagem ID '%1'"; + +$content['LN_SEARCH_USETHISBLA'] = "Use o formulário abaixo"; +$content['LN_SEARCH_FILTER'] = "Busca (filtro):"; +$content['LN_SEARCH_ADVANCED'] = "Busca Avançada"; +$content['LN_SEARCH'] = "Busca"; +$content['LN_SEARCH_RESET'] = "Limpa"; +$content['LN_SEARCH_PERFORMADVANCED'] = "Realizar Busca Avançada"; +$content['LN_VIEW_MESSAGECENTERED'] = "Eliminar filtros e visualizar esta mensagem no topo"; +$content['LN_VIEW_RELATEDMSG'] = "Ver mensagens relacionadas"; +$content['LN_VIEW_FILTERFOR'] = "Filtrar mensagens por "; + $content['LN_VIEW_SEARCHFOR'] = "Search online for "; + $content['LN_VIEW_SEARCHFORGOOGLE'] = "Search Google for "; + $content['LN_GEN_MESSAGEDETAILS'] = "Message Details"; + +$content['LN_HIGHLIGHT'] = "Destacar >>"; +$content['LN_HIGHLIGHT_OFF'] = "Destacar <<"; +$content['LN_HIGHLIGHT_WORDS'] = "Utilize uma lista de palavras separadas por vírgula"; + + $content['LN_AUTORELOAD'] = "Set auto reload"; + $content['LN_AUTORELOAD_DISABLED'] = "Auto reload disabled"; + $content['LN_AUTORELOAD_PRECONFIGURED'] = "Preconfigured auto reload "; + $content['LN_AUTORELOAD_SECONDS'] = "seconds"; + $content['LN_AUTORELOAD_MINUTES'] = "minutes"; + +$content['LN_ERROR_NORECORDS'] = "Sem mensagens encontradas."; + +// Filter Options +$content['LN_FILTER_DATE'] = "Intervalo Data/Hora"; +$content['LN_FILTER_DATEMODE'] = "Selecionar Modo"; +$content['LN_DATEMODE_ALL'] = "Todo o tempo"; +$content['LN_DATEMODE_RANGE'] = "Intervalo de tempo"; +$content['LN_DATEMODE_LASTX'] = "Tempo X desde hoje"; +$content['LN_FILTER_DATEFROM'] = "Data a partir de "; +$content['LN_FILTER_DATETO'] = "Até"; +$content['LN_FILTER_DATELASTX'] = "Tempo desde"; +$content['LN_FILTER_ADD2SEARCH'] = "Adicionar a busca"; +$content['LN_DATE_LASTX_HOUR'] = "Última hora"; +$content['LN_DATE_LASTX_12HOURS'] = "Últimas 12 horas"; +$content['LN_DATE_LASTX_24HOURS'] = "Últimas 24 horas"; +$content['LN_DATE_LASTX_7DAYS'] = "Últimos 7 dias"; +$content['LN_DATE_LASTX_31DAYS'] = "Últimos 31 dias"; +$content['LN_FILTER_FACILITY'] = "Facility"; +$content['LN_FILTER_SEVERITY'] = "Severidade"; +$content['LN_FILTER_OTHERS'] = "Outros Filtros"; +$content['LN_FILTER_MESSAGE'] = "Mensagem Syslog"; +$content['LN_FILTER_SYSLOGTAG'] = "Syslogtag"; +$content['LN_FILTER_SOURCE'] = "Origem (Hostname)"; +$content['LN_FILTER_MESSAGETYPE'] = "Tipo de mensagem"; + +// Field Captions +$content['LN_FIELDS_DATE'] = "Data"; +$content['LN_FIELDS_FACILITY'] = "Facility"; +$content['LN_FIELDS_SEVERITY'] = "Severidade"; +$content['LN_FIELDS_HOST'] = "Host"; +$content['LN_FIELDS_SYSLOGTAG'] = "Syslogtag"; +$content['LN_FIELDS_PROCESSID'] = "ID do processo"; +$content['LN_FIELDS_MESSAGETYPE'] = "Tipo da Mensagem"; +$content['LN_FIELDS_UID'] = "uID"; +$content['LN_FIELDS_MESSAGE'] = "Mensagem"; + $content['LN_FIELDS_EVENTID'] = "Event ID"; + $content['LN_FIELDS_EVENTLOGTYPE'] = "Eventlog Type"; + $content['LN_FIELDS_EVENTSOURCE'] = "Event Source"; + $content['LN_FIELDS_EVENTCATEGORY'] = "Event Category"; + $content['LN_FIELDS_EVENTUSER'] = "Event User"; + +// Install Page +$content['LN_CFG_DBSERVER'] = "Servidor BD"; +$content['LN_CFG_DBPORT'] = "Porta BD"; +$content['LN_CFG_DBNAME'] = "Nome BD"; +$content['LN_CFG_DBPREF'] = "Prefixo para as tabelas"; +$content['LN_CFG_DBUSER'] = "Usuário"; +$content['LN_CFG_DBPASSWORD'] = "Password"; +$content['LN_CFG_PARAMMISSING'] = "O seguinte parâmetro esta faltando: "; +$content['LN_CFG_SOURCETYPE'] = "Tipo de Origem"; +$content['LN_CFG_DISKTYPEOPTIONS'] = "Opç&oatilde;oes de disco"; +$content['LN_CFG_LOGLINETYPE'] = "Formato linha do log"; +$content['LN_CFG_SYSLOGFILE'] = "Arquivo Syslog"; +$content['LN_CFG_DATABASETYPEOPTIONS'] = "Opç&oatilde;es BD"; +$content['LN_CFG_DBTABLETYPE'] = "Tipo de tabela"; +$content['LN_CFG_DBSTORAGEENGINE'] = "Engine BD"; +$content['LN_CFG_DBTABLENAME'] = "Nome tabela"; +$content['LN_CFG_NAMEOFTHESOURCE'] = "Nome da origem"; +$content['LN_CFG_FIRSTSYSLOGSOURCE'] = "Fonte primária Syslog"; +$content['LN_CFG_DBROWCOUNTING'] = "Habilitar contagem de registro"; + $content['LN_CFG_VIEW'] = "Select View"; + +// Details page +$content['LN_DETAILS_FORSYSLOGMSG'] = "Detalhes para a mensagem com id"; +$content['LN_DETAILS_DETAILSFORMSG'] = "Detalhes para a mensagem com id"; +$content['LN_DETAIL_BACKTOLIST'] = "Voltar para a lista"; + +?> diff --git a/src/lang/pt/main.php.bak b/src/lang/pt/main.php.bak new file mode 100644 index 0000000..af3686d --- /dev/null +++ b/src/lang/pt/main.php.bak @@ -0,0 +1,160 @@ + www.phplogcon.org <- + * ----------------------------------------------------------------- + * + * Copyright (C) 2008 Adiscon GmbH. + * + * This file is part of phpLogCon. + * + * Translation by Ricardo Maraschini + * [mailto:ricardo.maraschini@opservices.com.br] + * + * PhpLogCon is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PhpLogCon is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with phpLogCon. If not, see . + * + * A copy of the GPL can be found in the file "COPYING" in this + * distribution. + ********************************************************************* +*/ +global $content; + +// Global Stuff +$content['LN_MAINTITLE'] = "Controle de Logs"; +$content['LN_MAIN_SELECTSTYLE'] = "Selecione um estilo"; +$content['LN_GEN_LANGUAGE'] = "Selecione uma linguagem"; +$content['LN_GEN_SELECTSOURCE'] = "Selecione Origem"; +$content['LN_GEN_MOREPAGES'] = "Mais que uma página disponível"; +$content['LN_GEN_FIRSTPAGE'] = "Primeira Página"; +$content['LN_GEN_LASTPAGE'] = "Última Página"; +$content['LN_GEN_NEXTPAGE'] = "Próxima Página"; +$content['LN_GEN_PREVIOUSPAGE'] = "Página Anterior"; +$content['LN_GEN_RECORDCOUNT'] = "Total de registros encontrados"; +$content['LN_GEN_PAGERSIZE'] = "Registros/página"; +$content['LN_GEN_PAGE'] = "Página"; +$content['LN_GEN_PREDEFINEDSEARCHES'] = "Buscas pré-definidas"; +$content['LN_GEN_SOURCE_DISK'] = "Arquivo em disco"; +$content['LN_GEN_SOURCE_DB'] = "Base de dados"; + $content['LN_GEN_SOURCE_PDO'] = "Database (PDO)"; +$content['LN_GEN_RECORDSPERPAGE'] = "registros por página"; +$content['LN_GEN_PRECONFIGURED'] = "Pré-configurado"; +$content['LN_GEN_AVAILABLESEARCHES'] = "Buscas disponíveis"; + $content['LN_GEN_DB_MYSQL'] = "Mysql Server"; + $content['LN_GEN_DB_MSSQL'] = "Microsoft SQL Server"; + $content['LN_GEN_DB_ODBC'] = "ODBC Database Source"; + $content['LN_GEN_DB_PGSQL'] = "PostgreSQL"; + $content['LN_GEN_DB_OCI'] = "Oracle Call Interface"; + $content['LN_GEN_DB_DB2'] = " IBM DB2"; + $content['LN_GEN_DB_FIREBIRD'] = "Firebird/Interbase 6"; + $content['LN_GEN_DB_INFORMIX'] = "IBM Informix Dynamic Server"; + $content['LN_GEN_DB_SQLITE'] = "SQLite 2"; + $content['LN_GEN_SELECTVIEW'] = "Select View"; + +// Main Index Site +$content['LN_ERROR_INSTALLFILEREMINDER'] = "Atenção! Você ainda NÃO removeu o arquivo 'install.php' do diretório de seu phpLogCon!"; +$content['LN_TOP_NUM'] = "Não."; +$content['LN_TOP_UID'] = "uID"; +$content['LN_GRID_POPUPDETAILS'] = "Detalhes para a mensagem ID '%1'"; + +$content['LN_SEARCH_USETHISBLA'] = "Use o formulário abaixo"; +$content['LN_SEARCH_FILTER'] = "Busca (filtro):"; +$content['LN_SEARCH_ADVANCED'] = "Busca Avançada"; +$content['LN_SEARCH'] = "Busca"; +$content['LN_SEARCH_RESET'] = "Limpa"; +$content['LN_SEARCH_PERFORMADVANCED'] = "Realizar Busca Avançada"; +$content['LN_VIEW_MESSAGECENTERED'] = "Eliminar filtros e visualizar esta mensagem no topo"; +$content['LN_VIEW_RELATEDMSG'] = "Ver mensagens relacionadas"; +$content['LN_VIEW_FILTERFOR'] = "Filtrar mensagens por "; + $content['LN_VIEW_SEARCHFOR'] = "Search online for "; + $content['LN_VIEW_SEARCHFORGOOGLE'] = "Search Google for "; + $content['LN_GEN_MESSAGEDETAILS'] = "Message Details"; + +$content['LN_HIGHLIGHT'] = "Destacar >>"; +$content['LN_HIGHLIGHT_OFF'] = "Destacar <<"; +$content['LN_HIGHLIGHT_WORDS'] = "Utilize uma lista de palavras separadas por vírgula"; + + $content['LN_AUTORELOAD'] = "Set auto reload"; + $content['LN_AUTORELOAD_DISABLED'] = "Auto reload disabled"; + $content['LN_AUTORELOAD_PRECONFIGURED'] = "Preconfigured auto reload "; + $content['LN_AUTORELOAD_SECONDS'] = "seconds"; + $content['LN_AUTORELOAD_MINUTES'] = "minutes"; + +$content['LN_ERROR_NORECORDS'] = "Sem mensagens encontradas."; + +// Filter Options +$content['LN_FILTER_DATE'] = "Intervalo Data/Hora"; +$content['LN_FILTER_DATEMODE'] = "Selecionar Modo"; +$content['LN_DATEMODE_ALL'] = "Todo o tempo"; +$content['LN_DATEMODE_RANGE'] = "Intervalo de tempo"; +$content['LN_DATEMODE_LASTX'] = "Tempo X desde hoje"; +$content['LN_FILTER_DATEFROM'] = "Data a partir de "; +$content['LN_FILTER_DATETO'] = "Até"; +$content['LN_FILTER_DATELASTX'] = "Tempo desde"; +$content['LN_FILTER_ADD2SEARCH'] = "Adicionar a busca"; +$content['LN_DATE_LASTX_HOUR'] = "Última hora"; +$content['LN_DATE_LASTX_12HOURS'] = "Últimas 12 horas"; +$content['LN_DATE_LASTX_24HOURS'] = "Últimas 24 horas"; +$content['LN_DATE_LASTX_7DAYS'] = "Últimos 7 dias"; +$content['LN_DATE_LASTX_31DAYS'] = "Últimos 31 dias"; +$content['LN_FILTER_FACILITY'] = "Facility"; +$content['LN_FILTER_SEVERITY'] = "Severidade"; +$content['LN_FILTER_OTHERS'] = "Outros Filtros"; +$content['LN_FILTER_MESSAGE'] = "Mensagem Syslog"; +$content['LN_FILTER_SYSLOGTAG'] = "Syslogtag"; +$content['LN_FILTER_SOURCE'] = "Origem (Hostname)"; +$content['LN_FILTER_MESSAGETYPE'] = "Tipo de mensagem"; + +// Field Captions +$content['LN_FIELDS_DATE'] = "Data"; +$content['LN_FIELDS_FACILITY'] = "Facility"; +$content['LN_FIELDS_SEVERITY'] = "Severidade"; +$content['LN_FIELDS_HOST'] = "Host"; +$content['LN_FIELDS_SYSLOGTAG'] = "Syslogtag"; +$content['LN_FIELDS_PROCESSID'] = "ID do processo"; +$content['LN_FIELDS_MESSAGETYPE'] = "Tipo da Mensagem"; +$content['LN_FIELDS_UID'] = "uID"; +$content['LN_FIELDS_MESSAGE'] = "Mensagem"; + $content['LN_FIELDS_EVENTID'] = "Event ID"; + $content['LN_FIELDS_EVENTLOGTYPE'] = "Eventlog Type"; + $content['LN_FIELDS_EVENTSOURCE'] = "Event Source"; + $content['LN_FIELDS_EVENTCATEGORY'] = "Event Category"; + $content['LN_FIELDS_EVENTUSER'] = "Event User"; + +// Install Page +$content['LN_CFG_DBSERVER'] = "Servidor BD"; +$content['LN_CFG_DBPORT'] = "Porta BD"; +$content['LN_CFG_DBNAME'] = "Nome BD"; +$content['LN_CFG_DBPREF'] = "Prefixo para as tabelas"; +$content['LN_CFG_DBUSER'] = "Usuário"; +$content['LN_CFG_DBPASSWORD'] = "Password"; +$content['LN_CFG_PARAMMISSING'] = "O seguinte parâmetro esta faltando: "; +$content['LN_CFG_SOURCETYPE'] = "Tipo de Origem"; +$content['LN_CFG_DISKTYPEOPTIONS'] = "Opç&oatilde;oes de disco"; +$content['LN_CFG_LOGLINETYPE'] = "Formato linha do log"; +$content['LN_CFG_SYSLOGFILE'] = "Arquivo Syslog"; +$content['LN_CFG_DATABASETYPEOPTIONS'] = "Opç&oatilde;es BD"; +$content['LN_CFG_DBTABLETYPE'] = "Tipo de tabela"; +$content['LN_CFG_DBSTORAGEENGINE'] = "Engine BD"; +$content['LN_CFG_DBTABLENAME'] = "Nome tabela"; +$content['LN_CFG_NAMEOFTHESOURCE'] = "Nome da origem"; +$content['LN_CFG_FIRSTSYSLOGSOURCE'] = "Fonte primária Syslog"; +$content['LN_CFG_DBROWCOUNTING'] = "Habilitar contagem de registro"; + $content['LN_CFG_VIEW'] = "Select View"; + +// Details page +$content['LN_DETAILS_FORSYSLOGMSG'] = "Detalhes para a mensagem com id"; +$content['LN_DETAILS_DETAILSFORMSG'] = "Detalhes para a mensagem com id"; +$content['LN_DETAIL_BACKTOLIST'] = "Voltar para a lista"; + +?> From ad46747dbef896e1c23a55df23dd1a4634177217 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 3 Jul 2008 14:08:40 +0200 Subject: [PATCH 56/79] removed .bak file from git --- src/lang/pt/main.php.bak | 160 --------------------------------------- 1 file changed, 160 deletions(-) delete mode 100644 src/lang/pt/main.php.bak diff --git a/src/lang/pt/main.php.bak b/src/lang/pt/main.php.bak deleted file mode 100644 index af3686d..0000000 --- a/src/lang/pt/main.php.bak +++ /dev/null @@ -1,160 +0,0 @@ - www.phplogcon.org <- - * ----------------------------------------------------------------- - * - * Copyright (C) 2008 Adiscon GmbH. - * - * This file is part of phpLogCon. - * - * Translation by Ricardo Maraschini - * [mailto:ricardo.maraschini@opservices.com.br] - * - * PhpLogCon is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpLogCon is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with phpLogCon. If not, see . - * - * A copy of the GPL can be found in the file "COPYING" in this - * distribution. - ********************************************************************* -*/ -global $content; - -// Global Stuff -$content['LN_MAINTITLE'] = "Controle de Logs"; -$content['LN_MAIN_SELECTSTYLE'] = "Selecione um estilo"; -$content['LN_GEN_LANGUAGE'] = "Selecione uma linguagem"; -$content['LN_GEN_SELECTSOURCE'] = "Selecione Origem"; -$content['LN_GEN_MOREPAGES'] = "Mais que uma página disponível"; -$content['LN_GEN_FIRSTPAGE'] = "Primeira Página"; -$content['LN_GEN_LASTPAGE'] = "Última Página"; -$content['LN_GEN_NEXTPAGE'] = "Próxima Página"; -$content['LN_GEN_PREVIOUSPAGE'] = "Página Anterior"; -$content['LN_GEN_RECORDCOUNT'] = "Total de registros encontrados"; -$content['LN_GEN_PAGERSIZE'] = "Registros/página"; -$content['LN_GEN_PAGE'] = "Página"; -$content['LN_GEN_PREDEFINEDSEARCHES'] = "Buscas pré-definidas"; -$content['LN_GEN_SOURCE_DISK'] = "Arquivo em disco"; -$content['LN_GEN_SOURCE_DB'] = "Base de dados"; - $content['LN_GEN_SOURCE_PDO'] = "Database (PDO)"; -$content['LN_GEN_RECORDSPERPAGE'] = "registros por página"; -$content['LN_GEN_PRECONFIGURED'] = "Pré-configurado"; -$content['LN_GEN_AVAILABLESEARCHES'] = "Buscas disponíveis"; - $content['LN_GEN_DB_MYSQL'] = "Mysql Server"; - $content['LN_GEN_DB_MSSQL'] = "Microsoft SQL Server"; - $content['LN_GEN_DB_ODBC'] = "ODBC Database Source"; - $content['LN_GEN_DB_PGSQL'] = "PostgreSQL"; - $content['LN_GEN_DB_OCI'] = "Oracle Call Interface"; - $content['LN_GEN_DB_DB2'] = " IBM DB2"; - $content['LN_GEN_DB_FIREBIRD'] = "Firebird/Interbase 6"; - $content['LN_GEN_DB_INFORMIX'] = "IBM Informix Dynamic Server"; - $content['LN_GEN_DB_SQLITE'] = "SQLite 2"; - $content['LN_GEN_SELECTVIEW'] = "Select View"; - -// Main Index Site -$content['LN_ERROR_INSTALLFILEREMINDER'] = "Atenção! Você ainda NÃO removeu o arquivo 'install.php' do diretório de seu phpLogCon!"; -$content['LN_TOP_NUM'] = "Não."; -$content['LN_TOP_UID'] = "uID"; -$content['LN_GRID_POPUPDETAILS'] = "Detalhes para a mensagem ID '%1'"; - -$content['LN_SEARCH_USETHISBLA'] = "Use o formulário abaixo"; -$content['LN_SEARCH_FILTER'] = "Busca (filtro):"; -$content['LN_SEARCH_ADVANCED'] = "Busca Avançada"; -$content['LN_SEARCH'] = "Busca"; -$content['LN_SEARCH_RESET'] = "Limpa"; -$content['LN_SEARCH_PERFORMADVANCED'] = "Realizar Busca Avançada"; -$content['LN_VIEW_MESSAGECENTERED'] = "Eliminar filtros e visualizar esta mensagem no topo"; -$content['LN_VIEW_RELATEDMSG'] = "Ver mensagens relacionadas"; -$content['LN_VIEW_FILTERFOR'] = "Filtrar mensagens por "; - $content['LN_VIEW_SEARCHFOR'] = "Search online for "; - $content['LN_VIEW_SEARCHFORGOOGLE'] = "Search Google for "; - $content['LN_GEN_MESSAGEDETAILS'] = "Message Details"; - -$content['LN_HIGHLIGHT'] = "Destacar >>"; -$content['LN_HIGHLIGHT_OFF'] = "Destacar <<"; -$content['LN_HIGHLIGHT_WORDS'] = "Utilize uma lista de palavras separadas por vírgula"; - - $content['LN_AUTORELOAD'] = "Set auto reload"; - $content['LN_AUTORELOAD_DISABLED'] = "Auto reload disabled"; - $content['LN_AUTORELOAD_PRECONFIGURED'] = "Preconfigured auto reload "; - $content['LN_AUTORELOAD_SECONDS'] = "seconds"; - $content['LN_AUTORELOAD_MINUTES'] = "minutes"; - -$content['LN_ERROR_NORECORDS'] = "Sem mensagens encontradas."; - -// Filter Options -$content['LN_FILTER_DATE'] = "Intervalo Data/Hora"; -$content['LN_FILTER_DATEMODE'] = "Selecionar Modo"; -$content['LN_DATEMODE_ALL'] = "Todo o tempo"; -$content['LN_DATEMODE_RANGE'] = "Intervalo de tempo"; -$content['LN_DATEMODE_LASTX'] = "Tempo X desde hoje"; -$content['LN_FILTER_DATEFROM'] = "Data a partir de "; -$content['LN_FILTER_DATETO'] = "Até"; -$content['LN_FILTER_DATELASTX'] = "Tempo desde"; -$content['LN_FILTER_ADD2SEARCH'] = "Adicionar a busca"; -$content['LN_DATE_LASTX_HOUR'] = "Última hora"; -$content['LN_DATE_LASTX_12HOURS'] = "Últimas 12 horas"; -$content['LN_DATE_LASTX_24HOURS'] = "Últimas 24 horas"; -$content['LN_DATE_LASTX_7DAYS'] = "Últimos 7 dias"; -$content['LN_DATE_LASTX_31DAYS'] = "Últimos 31 dias"; -$content['LN_FILTER_FACILITY'] = "Facility"; -$content['LN_FILTER_SEVERITY'] = "Severidade"; -$content['LN_FILTER_OTHERS'] = "Outros Filtros"; -$content['LN_FILTER_MESSAGE'] = "Mensagem Syslog"; -$content['LN_FILTER_SYSLOGTAG'] = "Syslogtag"; -$content['LN_FILTER_SOURCE'] = "Origem (Hostname)"; -$content['LN_FILTER_MESSAGETYPE'] = "Tipo de mensagem"; - -// Field Captions -$content['LN_FIELDS_DATE'] = "Data"; -$content['LN_FIELDS_FACILITY'] = "Facility"; -$content['LN_FIELDS_SEVERITY'] = "Severidade"; -$content['LN_FIELDS_HOST'] = "Host"; -$content['LN_FIELDS_SYSLOGTAG'] = "Syslogtag"; -$content['LN_FIELDS_PROCESSID'] = "ID do processo"; -$content['LN_FIELDS_MESSAGETYPE'] = "Tipo da Mensagem"; -$content['LN_FIELDS_UID'] = "uID"; -$content['LN_FIELDS_MESSAGE'] = "Mensagem"; - $content['LN_FIELDS_EVENTID'] = "Event ID"; - $content['LN_FIELDS_EVENTLOGTYPE'] = "Eventlog Type"; - $content['LN_FIELDS_EVENTSOURCE'] = "Event Source"; - $content['LN_FIELDS_EVENTCATEGORY'] = "Event Category"; - $content['LN_FIELDS_EVENTUSER'] = "Event User"; - -// Install Page -$content['LN_CFG_DBSERVER'] = "Servidor BD"; -$content['LN_CFG_DBPORT'] = "Porta BD"; -$content['LN_CFG_DBNAME'] = "Nome BD"; -$content['LN_CFG_DBPREF'] = "Prefixo para as tabelas"; -$content['LN_CFG_DBUSER'] = "Usuário"; -$content['LN_CFG_DBPASSWORD'] = "Password"; -$content['LN_CFG_PARAMMISSING'] = "O seguinte parâmetro esta faltando: "; -$content['LN_CFG_SOURCETYPE'] = "Tipo de Origem"; -$content['LN_CFG_DISKTYPEOPTIONS'] = "Opç&oatilde;oes de disco"; -$content['LN_CFG_LOGLINETYPE'] = "Formato linha do log"; -$content['LN_CFG_SYSLOGFILE'] = "Arquivo Syslog"; -$content['LN_CFG_DATABASETYPEOPTIONS'] = "Opç&oatilde;es BD"; -$content['LN_CFG_DBTABLETYPE'] = "Tipo de tabela"; -$content['LN_CFG_DBSTORAGEENGINE'] = "Engine BD"; -$content['LN_CFG_DBTABLENAME'] = "Nome tabela"; -$content['LN_CFG_NAMEOFTHESOURCE'] = "Nome da origem"; -$content['LN_CFG_FIRSTSYSLOGSOURCE'] = "Fonte primária Syslog"; -$content['LN_CFG_DBROWCOUNTING'] = "Habilitar contagem de registro"; - $content['LN_CFG_VIEW'] = "Select View"; - -// Details page -$content['LN_DETAILS_FORSYSLOGMSG'] = "Detalhes para a mensagem com id"; -$content['LN_DETAILS_DETAILSFORMSG'] = "Detalhes para a mensagem com id"; -$content['LN_DETAIL_BACKTOLIST'] = "Voltar para a lista"; - -?> From d3c459b86f73ef224bea4cf4e8236d53b2e0b346 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 3 Jul 2008 14:47:24 +0200 Subject: [PATCH 57/79] Added missing db mapping for program field of syslogng - thanks to Micha "Wolvverine" Panasiewicz --- src/include/constants_logstream.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/include/constants_logstream.php b/src/include/constants_logstream.php index 79eb224..6fdd8aa 100644 --- a/src/include/constants_logstream.php +++ b/src/include/constants_logstream.php @@ -195,6 +195,7 @@ $dbmapping['syslogng'][SYSLOG_MESSAGE] = "msg"; //TODO $dbmapping['syslogng'][SYSLOG_FACILITY] = "Facility"; //TODO $dbmapping['syslogng'][SYSLOG_SEVERITY] = "Priority" $dbmapping['syslogng'][SYSLOG_SYSLOGTAG] = "tag"; +$dbmapping['syslogng'][SYSLOG_PROCESSID] = "program"; // --- // EventTime Constants From f5ece09152c1b2efe37dd7c616412cf520fbc7a9 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 3 Jul 2008 16:38:10 +0200 Subject: [PATCH 58/79] Nothing changed really, tried to improve automatic IP links --- src/include/functions_common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index e282e49..ec43904 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -868,7 +868,7 @@ function AddContextLinks(&$sourceTxt) ( '/\.([\w\d\_\-]+)\.(' . $szTLDDomains . ')([^a-zA-Z0-9\.])/x', // '|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|', - '/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/x', +/* (?:127)| */ '/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/x', ); // Create Replace Array From fef267ebb6aff02b24ed91655547d7331f5fd763 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 7 Jul 2008 17:05:09 +0200 Subject: [PATCH 59/79] Added new translation files for portugues thanks to Ricardo Maraschini --- src/lang/pt/info.txt | 2 +- src/lang/pt/main.php | 50 ++++++++++++++++++++++---------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/lang/pt/info.txt b/src/lang/pt/info.txt index 83c8031..0ed10cd 100644 --- a/src/lang/pt/info.txt +++ b/src/lang/pt/info.txt @@ -1 +1 @@ -Portugues +Português diff --git a/src/lang/pt/main.php b/src/lang/pt/main.php index af3686d..718e37c 100644 --- a/src/lang/pt/main.php +++ b/src/lang/pt/main.php @@ -46,20 +46,20 @@ $content['LN_GEN_PAGE'] = "Página"; $content['LN_GEN_PREDEFINEDSEARCHES'] = "Buscas pré-definidas"; $content['LN_GEN_SOURCE_DISK'] = "Arquivo em disco"; $content['LN_GEN_SOURCE_DB'] = "Base de dados"; - $content['LN_GEN_SOURCE_PDO'] = "Database (PDO)"; +$content['LN_GEN_SOURCE_PDO'] = "Base de dados (PDO)"; $content['LN_GEN_RECORDSPERPAGE'] = "registros por página"; $content['LN_GEN_PRECONFIGURED'] = "Pré-configurado"; $content['LN_GEN_AVAILABLESEARCHES'] = "Buscas disponíveis"; - $content['LN_GEN_DB_MYSQL'] = "Mysql Server"; - $content['LN_GEN_DB_MSSQL'] = "Microsoft SQL Server"; - $content['LN_GEN_DB_ODBC'] = "ODBC Database Source"; - $content['LN_GEN_DB_PGSQL'] = "PostgreSQL"; - $content['LN_GEN_DB_OCI'] = "Oracle Call Interface"; - $content['LN_GEN_DB_DB2'] = " IBM DB2"; - $content['LN_GEN_DB_FIREBIRD'] = "Firebird/Interbase 6"; - $content['LN_GEN_DB_INFORMIX'] = "IBM Informix Dynamic Server"; - $content['LN_GEN_DB_SQLITE'] = "SQLite 2"; - $content['LN_GEN_SELECTVIEW'] = "Select View"; +$content['LN_GEN_DB_MYSQL'] = "Servidor MySQL"; +$content['LN_GEN_DB_MSSQL'] = "Microsoft SQL Server"; +$content['LN_GEN_DB_ODBC'] = "Conexão via ODBC"; +$content['LN_GEN_DB_PGSQL'] = "PostgreSQL"; +$content['LN_GEN_DB_OCI'] = "Oracle Call Interface"; +$content['LN_GEN_DB_DB2'] = " IBM DB2"; +$content['LN_GEN_DB_FIREBIRD'] = "Firebird/Interbase 6"; +$content['LN_GEN_DB_INFORMIX'] = "IBM Informix Dynamic Server"; +$content['LN_GEN_DB_SQLITE'] = "SQLite 2"; +$content['LN_GEN_SELECTVIEW'] = "Selecionar Visão"; // Main Index Site $content['LN_ERROR_INSTALLFILEREMINDER'] = "Atenção! Você ainda NÃO removeu o arquivo 'install.php' do diretório de seu phpLogCon!"; @@ -76,19 +76,19 @@ $content['LN_SEARCH_PERFORMADVANCED'] = "Realizar Busca Avançada"; $content['LN_VIEW_MESSAGECENTERED'] = "Eliminar filtros e visualizar esta mensagem no topo"; $content['LN_VIEW_RELATEDMSG'] = "Ver mensagens relacionadas"; $content['LN_VIEW_FILTERFOR'] = "Filtrar mensagens por "; - $content['LN_VIEW_SEARCHFOR'] = "Search online for "; - $content['LN_VIEW_SEARCHFORGOOGLE'] = "Search Google for "; - $content['LN_GEN_MESSAGEDETAILS'] = "Message Details"; +$content['LN_VIEW_SEARCHFOR'] = "Busca online por "; +$content['LN_VIEW_SEARCHFORGOOGLE'] = "Busca no Google por "; +$content['LN_GEN_MESSAGEDETAILS'] = "Detalhes da Mensagem"; $content['LN_HIGHLIGHT'] = "Destacar >>"; $content['LN_HIGHLIGHT_OFF'] = "Destacar <<"; $content['LN_HIGHLIGHT_WORDS'] = "Utilize uma lista de palavras separadas por vírgula"; - $content['LN_AUTORELOAD'] = "Set auto reload"; - $content['LN_AUTORELOAD_DISABLED'] = "Auto reload disabled"; - $content['LN_AUTORELOAD_PRECONFIGURED'] = "Preconfigured auto reload "; - $content['LN_AUTORELOAD_SECONDS'] = "seconds"; - $content['LN_AUTORELOAD_MINUTES'] = "minutes"; +$content['LN_AUTORELOAD'] = "Define auto recarregamento"; +$content['LN_AUTORELOAD_DISABLED'] = "Auto recarregamento desabilitado"; +$content['LN_AUTORELOAD_PRECONFIGURED'] = "Auto recarregamento pré-configurado "; +$content['LN_AUTORELOAD_SECONDS'] = "segundos"; +$content['LN_AUTORELOAD_MINUTES'] = "minutos"; $content['LN_ERROR_NORECORDS'] = "Sem mensagens encontradas."; @@ -125,11 +125,11 @@ $content['LN_FIELDS_PROCESSID'] = "ID do processo"; $content['LN_FIELDS_MESSAGETYPE'] = "Tipo da Mensagem"; $content['LN_FIELDS_UID'] = "uID"; $content['LN_FIELDS_MESSAGE'] = "Mensagem"; - $content['LN_FIELDS_EVENTID'] = "Event ID"; - $content['LN_FIELDS_EVENTLOGTYPE'] = "Eventlog Type"; - $content['LN_FIELDS_EVENTSOURCE'] = "Event Source"; - $content['LN_FIELDS_EVENTCATEGORY'] = "Event Category"; - $content['LN_FIELDS_EVENTUSER'] = "Event User"; +$content['LN_FIELDS_EVENTID'] = "ID do Evento"; +$content['LN_FIELDS_EVENTLOGTYPE'] = "Tipo do Evento"; +$content['LN_FIELDS_EVENTSOURCE'] = "Origem do Evento"; +$content['LN_FIELDS_EVENTCATEGORY'] = "Categoria do Evento"; +$content['LN_FIELDS_EVENTUSER'] = "Evento de Usu´rio"; // Install Page $content['LN_CFG_DBSERVER'] = "Servidor BD"; @@ -150,7 +150,7 @@ $content['LN_CFG_DBTABLENAME'] = "Nome tabela"; $content['LN_CFG_NAMEOFTHESOURCE'] = "Nome da origem"; $content['LN_CFG_FIRSTSYSLOGSOURCE'] = "Fonte primária Syslog"; $content['LN_CFG_DBROWCOUNTING'] = "Habilitar contagem de registro"; - $content['LN_CFG_VIEW'] = "Select View"; +$content['LN_CFG_VIEW'] = "Selecione visão"; // Details page $content['LN_DETAILS_FORSYSLOGMSG'] = "Detalhes para a mensagem com id"; From 3e647291ba2e5cba972a52679cd8640db0a6614f Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 7 Jul 2008 17:08:00 +0200 Subject: [PATCH 60/79] Incremented build and added changelog entry --- ChangeLog | 5 +++++ src/include/functions_common.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6399df1..d382724 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ --------------------------------------------------------------------------- +Version 2.3.7 (beta), 2008-07-07 +- Added missing db mapping for program field of syslogng - thanks to + Micha "Wolvverine" Panasiewicz +- Added translation for Brazilian Portuguese, thanks to Ricardo Maraschini +--------------------------------------------------------------------------- Version 2.3.6 (devel), 2008-06-09 - Added new feature, multiple configureable views which can be configured and selected for each source seperately. Old configurations can still diff --git a/src/include/functions_common.php b/src/include/functions_common.php index ec43904..836dcd9 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -62,7 +62,7 @@ $LANG_EN = "en"; // Used for fallback $LANG = "en"; // Default language // Default Template vars -$content['BUILDNUMBER'] = "2.3.6"; +$content['BUILDNUMBER'] = "2.3.7"; $content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title $content['BASEPATH'] = $gl_root_path; $content['EXTRA_METATAGS'] = ""; From 336923f134dee9b59d5e77328483aad0f1bce2cd Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 10 Jul 2008 14:29:06 +0200 Subject: [PATCH 61/79] Added minor cosmetic fixes to the translations of Ricardo for portugese --- src/lang/pt/info.txt | 1 - src/lang/pt_BR/info.txt | 1 + src/lang/{pt => pt_BR}/main.php | 14 +++++++------- 3 files changed, 8 insertions(+), 8 deletions(-) delete mode 100644 src/lang/pt/info.txt create mode 100644 src/lang/pt_BR/info.txt rename src/lang/{pt => pt_BR}/main.php (94%) diff --git a/src/lang/pt/info.txt b/src/lang/pt/info.txt deleted file mode 100644 index 0ed10cd..0000000 --- a/src/lang/pt/info.txt +++ /dev/null @@ -1 +0,0 @@ -Português diff --git a/src/lang/pt_BR/info.txt b/src/lang/pt_BR/info.txt new file mode 100644 index 0000000..8b7d535 --- /dev/null +++ b/src/lang/pt_BR/info.txt @@ -0,0 +1 @@ +Português diff --git a/src/lang/pt/main.php b/src/lang/pt_BR/main.php similarity index 94% rename from src/lang/pt/main.php rename to src/lang/pt_BR/main.php index 718e37c..1039ab7 100644 --- a/src/lang/pt/main.php +++ b/src/lang/pt_BR/main.php @@ -32,9 +32,9 @@ global $content; // Global Stuff $content['LN_MAINTITLE'] = "Controle de Logs"; -$content['LN_MAIN_SELECTSTYLE'] = "Selecione um estilo"; -$content['LN_GEN_LANGUAGE'] = "Selecione uma linguagem"; -$content['LN_GEN_SELECTSOURCE'] = "Selecione Origem"; +$content['LN_MAIN_SELECTSTYLE'] = "Estilo"; +$content['LN_GEN_LANGUAGE'] = "Linguagem"; +$content['LN_GEN_SELECTSOURCE'] = "Origem"; $content['LN_GEN_MOREPAGES'] = "Mais que uma página disponível"; $content['LN_GEN_FIRSTPAGE'] = "Primeira Página"; $content['LN_GEN_LASTPAGE'] = "Última Página"; @@ -59,7 +59,7 @@ $content['LN_GEN_DB_DB2'] = " IBM DB2"; $content['LN_GEN_DB_FIREBIRD'] = "Firebird/Interbase 6"; $content['LN_GEN_DB_INFORMIX'] = "IBM Informix Dynamic Server"; $content['LN_GEN_DB_SQLITE'] = "SQLite 2"; -$content['LN_GEN_SELECTVIEW'] = "Selecionar Visão"; +$content['LN_GEN_SELECTVIEW'] = "Visão"; // Main Index Site $content['LN_ERROR_INSTALLFILEREMINDER'] = "Atenção! Você ainda NÃO removeu o arquivo 'install.php' do diretório de seu phpLogCon!"; @@ -84,7 +84,7 @@ $content['LN_HIGHLIGHT'] = "Destacar >>"; $content['LN_HIGHLIGHT_OFF'] = "Destacar <<"; $content['LN_HIGHLIGHT_WORDS'] = "Utilize uma lista de palavras separadas por vírgula"; -$content['LN_AUTORELOAD'] = "Define auto recarregamento"; +$content['LN_AUTORELOAD'] = "Recarregamento"; $content['LN_AUTORELOAD_DISABLED'] = "Auto recarregamento desabilitado"; $content['LN_AUTORELOAD_PRECONFIGURED'] = "Auto recarregamento pré-configurado "; $content['LN_AUTORELOAD_SECONDS'] = "segundos"; @@ -121,8 +121,8 @@ $content['LN_FIELDS_FACILITY'] = "Facility"; $content['LN_FIELDS_SEVERITY'] = "Severidade"; $content['LN_FIELDS_HOST'] = "Host"; $content['LN_FIELDS_SYSLOGTAG'] = "Syslogtag"; -$content['LN_FIELDS_PROCESSID'] = "ID do processo"; -$content['LN_FIELDS_MESSAGETYPE'] = "Tipo da Mensagem"; +$content['LN_FIELDS_PROCESSID'] = "PID"; +$content['LN_FIELDS_MESSAGETYPE'] = "Tipo"; $content['LN_FIELDS_UID'] = "uID"; $content['LN_FIELDS_MESSAGE'] = "Mensagem"; $content['LN_FIELDS_EVENTID'] = "ID do Evento"; From 3f0d45efe9eb7bb7378bcd4b185b6c65e751cefc Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 17 Jul 2008 11:25:34 +0200 Subject: [PATCH 62/79] Fixed a little bug in the installer, which was missing to save the DBType for MYSQL Datasource. This isn't really an issue as the DBTYPE can only be MYSQL for this Source. However it caused an unnecessary NOTICE issue when debugging was enabled. --- src/include/functions_config.php | 7 ++++++- src/install.php | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/include/functions_config.php b/src/include/functions_config.php index b9eaac3..4ff98ee 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -102,7 +102,12 @@ $content['Sources'][$iSourceID]['ObjRef'] = new LogStreamConfigDB(); $content['Sources'][$iSourceID]['ObjRef']->DBServer = $mysource['DBServer']; $content['Sources'][$iSourceID]['ObjRef']->DBName = $mysource['DBName']; - $content['Sources'][$iSourceID]['ObjRef']->DBType = $mysource['DBType']; + // Workaround a little bug from the installer script + if ( isset($mysource['DBType']) ) + $content['Sources'][$iSourceID]['ObjRef']->DBType = $mysource['DBType']; + else + $content['Sources'][$iSourceID]['ObjRef']->DBType = DB_MYSQL; + $content['Sources'][$iSourceID]['ObjRef']->DBTableName = $mysource['DBTableName']; // Legacy handling for tabletype! diff --git a/src/install.php b/src/install.php index 1fbc98b..e683e03 100644 --- a/src/install.php +++ b/src/install.php @@ -644,8 +644,12 @@ else if ( $content['INSTALL_STEP'] == 8 ) } else if ( $_SESSION['SourceType'] == SOURCE_DB ) { + // Need to create the LIST first! + CreateDBTypesList($_SESSION['SourceDBType']); + $firstsource .= "\$CFG['Sources']['Source1']['SourceType'] = SOURCE_DB;\n" . "\$CFG['Sources']['Source1']['DBTableType'] = '" . $_SESSION['SourceDBTableType'] . "';\n" . + "\$CFG['Sources']['Source1']['DBType'] = " . $content['DBTYPES'][$_SESSION['SourceDBType']]['typeastext'] . ";\n" . "\$CFG['Sources']['Source1']['DBServer'] = '" . $_SESSION['SourceDBServer'] . "';\n" . "\$CFG['Sources']['Source1']['DBName'] = '" . $_SESSION['SourceDBName'] . "';\n" . "\$CFG['Sources']['Source1']['DBUser'] = '" . $_SESSION['SourceDBUser'] . "';\n" . From 369cd6cb60651ce52b4b9aee43f4881f92f82b93 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 24 Jul 2008 11:59:39 +0200 Subject: [PATCH 63/79] Fixed a bug in the pdo logstream class which caused display of empty rows when no records where found. --- src/classes/logstreampdo.class.php | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/classes/logstreampdo.class.php b/src/classes/logstreampdo.class.php index 5ea4a7e..ef8eeb4 100644 --- a/src/classes/logstreampdo.class.php +++ b/src/classes/logstreampdo.class.php @@ -627,12 +627,12 @@ class LogStreamPDO extends LogStream { { // Get SQL Statement $szSql = $this->CreateSQLStatement($uID); - + // Perform Database Query $this->_myDBQuery = $this->_dbhandle->query($szSql); if ( !$this->_myDBQuery ) { - $this->PrintDebugError("Invalid SQL: ".$szSql); + $this->PrintDebugError( "Invalid SQL: ".$szSql . "

    Errorcode: " . $this->_dbhandle->errorCode() ); return ERROR_DB_QUERYFAILED; } @@ -672,19 +672,23 @@ class LogStreamPDO extends LogStream { // return error if there was one! if ( ($res = $this->CreateMainSQLQuery($uID)) != SUCCESS ) return $res; + + // return specially with NO RECORDS when 0 records are returned! Otherwise it will be -1 + if ( $this->_myDBQuery->rowCount() == 0 ) + return ERROR_NOMORERECORDS; } // Copy rows into the buffer! $iBegin = $this->_currentRecordNum; $iCount = 0; - while( $this->_logStreamConfigObj->RecordsPerQuery > $iCount ) + while( $this->_logStreamConfigObj->RecordsPerQuery > $iCount) { //Obtain next record $myRow = $this->_myDBQuery->fetch(PDO::FETCH_ASSOC); - + // Check if result was successfull! - if ( $myRow === FALSE ) + if ( $myRow === FALSE || !$myRow ) break; $this->bufferedRecords[$iBegin] = $myRow; @@ -694,16 +698,6 @@ class LogStreamPDO extends LogStream { $iCount++; } -/* - // Only obtain count if enabled and not done before - if ( $this->_logStreamConfigObj->DBEnableRowCounting && $this->_totalRecordCount == -1 ) - { - $this->_totalRecordCount = $this->GetRowCountFromTable(); - -// if ( $this->_totalRecordCount <= 0 ) -// return ERROR_NOMORERECORDS; - } -*/ // return success state if reached this point! return SUCCESS; } From 15c611b32eb2fdfba54bf44a45e937c8f813bf5b Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 25 Jul 2008 14:48:58 +0200 Subject: [PATCH 64/79] Fixed Bug 82 from bugtracker. Internal IP Addresses are not linked anymore --- src/include/functions_common.php | 37 ++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 836dcd9..364ee07 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -866,16 +866,16 @@ function AddContextLinks(&$sourceTxt) // Create Search Array $search = array ( - '/\.([\w\d\_\-]+)\.(' . $szTLDDomains . ')([^a-zA-Z0-9\.])/x', + '/\.([\w\d\_\-]+)\.(' . $szTLDDomains . ')([^a-zA-Z0-9\.])/e', // '|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|', -/* (?:127)| */ '/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/x', +/* (?:127)| */ '/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/e', ); // Create Replace Array $replace = array ( - '.$1.$2$3', - '$1.$2.$3.$4', + "'.' . InsertLookupLink(\"\", \"\\1.\\2\", \"\", \"\\3\")", + "'.' . InsertLookupLink(\"\\1.\\2.\\3.\\4\", \"\", \"\", \"\")", ); // Replace and return! @@ -885,6 +885,35 @@ function AddContextLinks(&$sourceTxt) //return $outTxt; } +/* +* Helper to create a Lookup Link! +*/ +function InsertLookupLink( $szIP, $szDomain, $prepend, $append ) +{ + // Create string + $szReturn = $prepend; + if ( strlen($szIP) > 0 ) + { + if ( + (($pos = strpos($szIP, "10.")) !== FALSE && $pos == 0) || + (($pos = strpos($szIP, "127.")) !== FALSE && $pos == 0) || + (($pos = strpos($szIP, "172.")) !== FALSE && $pos == 0) || + (($pos = strpos($szIP, "192.")) !== FALSE && $pos == 0) + ) + // Do not create a LINK in this case! + $szReturn .= '' . $szIP . ''; + else + // Normal LINK! + $szReturn .= '' . $szIP . ''; + } + else if ( strlen($szDomain) > 0 ) + $szReturn .= '' . $szDomain . ''; + $szReturn .= $append; + + // return result + return $szReturn; +} + /* * Reserve Resolve IP Address! */ From b4ada93a252e0134baabcf10fba1226e98f9c65d Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 25 Jul 2008 14:54:18 +0200 Subject: [PATCH 65/79] Changed common include to UNIX Line Encoding --- src/include/functions_common.php | 2178 +++++++++++++++--------------- 1 file changed, 1089 insertions(+), 1089 deletions(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 364ee07..4927ed1 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -1,1090 +1,1090 @@ - www.phplogcon.org <- * - * ----------------------------------------------------------------- * - * Common needed functions * - * * - * -> * - * * - * All directives are explained within this file * - * - * Copyright (C) 2008 Adiscon GmbH. - * - * This file is part of phpLogCon. - * - * PhpLogCon is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpLogCon is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with phpLogCon. If not, see . - * - * A copy of the GPL can be found in the file "COPYING" in this - * distribution. - ********************************************************************* -*/ - -// --- Avoid directly accessing this file! -if ( !defined('IN_PHPLOGCON') ) -{ - die('Hacking attempt'); - exit; -} -// --- - -// --- Basic Includes -include($gl_root_path . 'include/constants_general.php'); -include($gl_root_path . 'include/constants_logstream.php'); - -include($gl_root_path . 'classes/class_template.php'); -include($gl_root_path . 'include/functions_themes.php'); -include($gl_root_path . 'include/functions_db.php'); -include($gl_root_path . 'include/functions_config.php'); -// --- - -// --- Define Basic vars -$RUNMODE = RUNMODE_WEBSERVER; -$DEBUGMODE = DEBUG_INFO; - -// --- Disable ARGV setting @webserver! -ini_set( "register_argc_argv", "Off" ); -// --- - -// Default language -$LANG_EN = "en"; // Used for fallback -$LANG = "en"; // Default language - -// Default Template vars -$content['BUILDNUMBER'] = "2.3.7"; -$content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title -$content['BASEPATH'] = $gl_root_path; -$content['EXTRA_METATAGS'] = ""; -$content['EXTRA_JAVASCRIPT'] = ""; -$content['EXTRA_STYLESHEET'] = ""; -// --- - -// --- Check PHP Version! If lower the 5, phplogcon will not work proberly! -$myPhpVer = phpversion(); -$myPhpVerArray = explode('.', $myPhpVer); -if ( $myPhpVerArray[0] < 5 ) - DieWithErrorMsg( 'Error, the PHP Version on this Server does not meet the installation requirements.
    PHP5 or higher is needed. Current installed Version is: ' . $myPhpVer . ''); -// --- - -function InitBasicPhpLogCon() -{ - // Needed to make global - global $CFG, $gl_root_path, $content; - - // Check RunMode first! - CheckAndSetRunMode(); - - // Set the default line sep - SetLineBreakVar(); - - // Start the PHP Session - StartPHPSession(); - - // Init View Configs prior loading config.php! - InitViewConfigs(); -} - -function InitPhpLogConConfigFile($bHandleMissing = true) -{ - // Needed to make global - global $CFG, $gl_root_path, $content; - - if ( file_exists($gl_root_path . 'config.php') && GetFileLength($gl_root_path . 'config.php') > 0 ) - { - // Include the main config - include_once($gl_root_path . 'config.php'); - - // Easier DB Access - define('DB_CONFIG', $CFG['UserDBPref'] . "config"); - - // Legacy support for old columns definition format! - if ( isset($CFG['Columns']) && is_array($CFG['Columns']) ) - AppendLegacyColumns(); - - // --- Now Copy all entries into content variable - foreach ($CFG as $key => $value ) - $content[$key] = $value; - // --- - - // For MiscShowPageRenderStats - if ( $CFG['MiscShowPageRenderStats'] == 1 ) - { - $content['ShowPageRenderStats'] = "true"; - InitPageRenderStats(); - } - - // return result - return true; - } - else - { - // if handled ourselfe, we die in CheckForInstallPhp. - if ( $bHandleMissing == true ) - { - // Check for installscript! - CheckForInstallPhp(); - } - else - return false; - } -} - -function CheckForInstallPhp() -{ - // Check for installscript! - if ( file_exists($content['BASEPATH'] . "install.php") ) - $strinstallmsg = '

    ' - . '
    Click here to Install PhpLogCon!

    ' -// . 'See the Installation Guides for more Details!
    ' -// . 'English Installation Guide | ' -// . 'German Installation Guide

    ' -// . 'Also take a look to the Readme for some basics around PhpLogCon!
    ' - . '
    '; - else - $strinstallmsg = ""; - DieWithErrorMsg( 'Error, main configuration file is missing!' . $strinstallmsg ); -} - -function GetFileLength($szFileName) -{ - if ( is_file($szFileName) ) - return filesize($szFileName); - else - return 0; -} - -function InitPhpLogCon() -{ - // Needed to make global - global $CFG, $gl_root_path, $content; - - // Init Basics which do not need a database - InitBasicPhpLogCon(); - - // Will init the config file! - InitPhpLogConConfigFile(); - - // Moved here, because we do not need if GZIP needs to be enabled before the config is loaded! - InitRuntimeInformations(); - - // Establish DB Connection - if ( $CFG['UserDBEnabled'] ) - DB_Connect(); - - // Now load the Page configuration values - InitConfigurationValues(); - - // Now Create Themes List because we haven't the config before! - CreateThemesList(); - - // Create Language List - CreateLanguageList(); - - // Init Predefined Searches List - CreatePredefinedSearches(); - - // Init predefined paging sizes - CreatePagesizesList(); - - // Init predefined reload times - CreateReloadTimesList(); - - // --- Enable PHP Debug Mode - InitPhpDebugMode(); - // --- -} - -function CreateLogLineTypesList( $selectedType ) -{ - global $content; - - // syslog - $content['LOGLINETYPES']["syslog"]['type'] = "syslog"; - $content['LOGLINETYPES']["syslog"]['DisplayName'] = "Syslog / RSyslog"; - if ( $selectedType == $content['LOGLINETYPES']["syslog"]['type'] ) { $content['LOGLINETYPES']["syslog"]['selected'] = "selected"; } else { $content['LOGLINETYPES']["syslog"]['selected'] = ""; } - - // Adiscon Winsyslog - $content['LOGLINETYPES']["winsyslog"]['type'] = "winsyslog"; - $content['LOGLINETYPES']["winsyslog"]['DisplayName'] = "Adiscon WinSyslog"; - if ( $selectedType == $content['LOGLINETYPES']["winsyslog"]['type'] ) { $content['LOGLINETYPES']["winsyslog"]['selected'] = "selected"; } else { $content['LOGLINETYPES']["winsyslog"]['selected'] = ""; } -} - -function CreateSourceTypesList( $selectedSource ) -{ - global $content; - - // SOURCE_DISK - $content['SOURCETYPES'][SOURCE_DISK]['type'] = SOURCE_DISK; - $content['SOURCETYPES'][SOURCE_DISK]['DisplayName'] = $content['LN_GEN_SOURCE_DISK']; - if ( $selectedSource == $content['SOURCETYPES'][SOURCE_DISK]['type'] ) { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = ""; } - - // SOURCE_DB ( MYSQL NATIVE ) - $content['SOURCETYPES'][SOURCE_DB]['type'] = SOURCE_DB; - $content['SOURCETYPES'][SOURCE_DB]['DisplayName'] = $content['LN_GEN_SOURCE_DB']; - if ( $selectedSource == $content['SOURCETYPES'][SOURCE_DB]['type'] ) { $content['SOURCETYPES'][SOURCE_DB]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_DB]['selected'] = ""; } - - // SOURCE_PDO ( PDO DB Wrapper) - $content['SOURCETYPES'][SOURCE_PDO]['type'] = SOURCE_PDO; - $content['SOURCETYPES'][SOURCE_PDO]['DisplayName'] = $content['LN_GEN_SOURCE_PDO']; - if ( $selectedSource == $content['SOURCETYPES'][SOURCE_PDO]['type'] ) { $content['SOURCETYPES'][SOURCE_PDO]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_PDO]['selected'] = ""; } -} - -function CreateDBTypesList( $selectedDBType ) -{ - global $content; - - // DB_MYSQL - $content['DBTYPES'][DB_MYSQL]['type'] = DB_MYSQL; - $content['DBTYPES'][DB_MYSQL]['typeastext'] = "DB_MYSQL"; - $content['DBTYPES'][DB_MYSQL]['DisplayName'] = $content['LN_GEN_DB_MYSQL']; - if ( $selectedDBType == $content['DBTYPES'][DB_MYSQL]['type'] ) { $content['DBTYPES'][DB_MYSQL]['selected'] = "selected"; } else { $content['DBTYPES'][DB_MYSQL]['selected'] = ""; } - - // DB_MSSQL - $content['DBTYPES'][DB_MSSQL]['type'] = DB_MSSQL; - $content['DBTYPES'][DB_MSSQL]['typeastext'] = "DB_MSSQL"; - $content['DBTYPES'][DB_MSSQL]['DisplayName'] = $content['LN_GEN_DB_MSSQL']; - if ( $selectedDBType == $content['DBTYPES'][DB_MSSQL]['type'] ) { $content['DBTYPES'][DB_MSSQL]['selected'] = "selected"; } else { $content['DBTYPES'][DB_MSSQL]['selected'] = ""; } - - // DB_ODBC - $content['DBTYPES'][DB_ODBC]['type'] = DB_ODBC; - $content['DBTYPES'][DB_ODBC]['typeastext'] = "DB_ODBC"; - $content['DBTYPES'][DB_ODBC]['DisplayName'] = $content['LN_GEN_DB_ODBC']; - if ( $selectedDBType == $content['DBTYPES'][DB_ODBC]['type'] ) { $content['DBTYPES'][DB_ODBC]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_ODBC]['selected'] = ""; } - - // DB_PGSQL - $content['DBTYPES'][DB_PGSQL]['type'] = DB_PGSQL; - $content['DBTYPES'][DB_PGSQL]['typeastext'] = "DB_PGSQL"; - $content['DBTYPES'][DB_PGSQL]['DisplayName'] = $content['LN_GEN_DB_PGSQL']; - if ( $selectedDBType == $content['DBTYPES'][DB_PGSQL]['type'] ) { $content['DBTYPES'][DB_PGSQL]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_PGSQL]['selected'] = ""; } - - // DB_OCI - $content['DBTYPES'][DB_OCI]['type'] = DB_OCI; - $content['DBTYPES'][DB_OCI]['typeastext'] = "DB_OCI"; - $content['DBTYPES'][DB_OCI]['DisplayName'] = $content['LN_GEN_DB_OCI']; - if ( $selectedDBType == $content['DBTYPES'][DB_OCI]['type'] ) { $content['DBTYPES'][DB_OCI]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_OCI]['selected'] = ""; } - - // DB_DB2 - $content['DBTYPES'][DB_DB2]['type'] = DB_DB2; - $content['DBTYPES'][DB_DB2]['typeastext'] = "DB_DB2"; - $content['DBTYPES'][DB_DB2]['DisplayName'] = $content['LN_GEN_DB_DB2']; - if ( $selectedDBType == $content['DBTYPES'][DB_DB2]['type'] ) { $content['DBTYPES'][DB_DB2]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_DB2]['selected'] = ""; } - - // DB_FIREBIRD - $content['DBTYPES'][DB_FIREBIRD]['type'] = DB_FIREBIRD; - $content['DBTYPES'][DB_FIREBIRD]['typeastext'] = "DB_FIREBIRD"; - $content['DBTYPES'][DB_FIREBIRD]['DisplayName'] = $content['LN_GEN_DB_FIREBIRD']; - if ( $selectedDBType == $content['DBTYPES'][DB_FIREBIRD]['type'] ) { $content['DBTYPES'][DB_FIREBIRD]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_FIREBIRD]['selected'] = ""; } - - // DB_INFORMIX - $content['DBTYPES'][DB_INFORMIX]['type'] = DB_INFORMIX; - $content['DBTYPES'][DB_INFORMIX]['typeastext'] = "DB_INFORMIX"; - $content['DBTYPES'][DB_INFORMIX]['DisplayName'] = $content['LN_GEN_DB_INFORMIX']; - if ( $selectedDBType == $content['DBTYPES'][DB_INFORMIX]['type'] ) { $content['DBTYPES'][DB_INFORMIX]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_INFORMIX]['selected'] = ""; } - - // DB_SQLITE - $content['DBTYPES'][DB_SQLITE]['type'] = DB_SQLITE; - $content['DBTYPES'][DB_SQLITE]['typeastext'] = "DB_SQLITE"; - $content['DBTYPES'][DB_SQLITE]['DisplayName'] = $content['LN_GEN_DB_SQLITE']; - if ( $selectedDBType == $content['DBTYPES'][DB_SQLITE]['type'] ) { $content['DBTYPES'][DB_SQLITE]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_SQLITE]['selected'] = ""; } -} - -function CreatePagesizesList() -{ - global $CFG, $content; - - $iCounter = 0; - $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_GEN_PRECONFIGURED'] . " (" . $CFG['ViewEntriesPerPage'] . ")", "Value" => $CFG['ViewEntriesPerPage'] ); $iCounter++; - $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 25 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 25 ); $iCounter++; - $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 50 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 50 ); $iCounter++; - $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 75 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 75 ); $iCounter++; - $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 100 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 100 ); $iCounter++; - $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 250 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 250 ); $iCounter++; - $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 500 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 500 ); $iCounter++; - - // Set default selected pagesize - $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Selected"] = "selected"; - - // The content variable will now contain the user selected oaging size - $content["ViewEntriesPerPage"] = $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Value"]; -} - -function CreateReloadTimesList() -{ - global $CFG, $content; - -// $CFG['ViewEnableAutoReloadSeconds'] - $iCounter = 0; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_DISABLED'], "Value" => 0 ); $iCounter++; - if ( isset($CFG['ViewEnableAutoReloadSeconds']) && $CFG['ViewEnableAutoReloadSeconds'] > 0 ) - { - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_PRECONFIGURED'] . " (" . $CFG['ViewEnableAutoReloadSeconds'] . " " . $content['LN_AUTORELOAD_SECONDS'] . ") ", "Value" => $CFG['ViewEnableAutoReloadSeconds'] ); $iCounter++; - } - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 5 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 5 ); $iCounter++; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 10 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 10 ); $iCounter++; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 15 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 15 ); $iCounter++; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 30 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 30 ); $iCounter++; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 60 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 60 ); $iCounter++; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 5 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 300 ); $iCounter++; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 10 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 600 ); $iCounter++; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 15 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 900 ); $iCounter++; - $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 30 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 1800 ); $iCounter++; - - // Set default selected autoreloadid - $content['reloadtimes'][ $_SESSION['AUTORELOAD_ID'] ]["Selected"] = "selected"; - - // The content variable will now contain the user selected oaging size - $content["ViewEnableAutoReloadSeconds"] = $content['reloadtimes'][ $_SESSION['AUTORELOAD_ID'] ]["Value"]; - -} - -function CreatePredefinedSearches() -{ - global $CFG, $content; - if ( isset($CFG['Search']) ) - { - // Enable predefined searches - $content['EnablePredefinedSearches'] = true; - - // Loop through all predefined searches! - foreach ($CFG['Search'] as $mykey => $mySearch) - { - // Copy configured searches into content array! - $content['Search'][$mykey]["ID"] = $mykey; - $content['Search'][$mykey]["Selected"] = false; - - // --- Set CSS Class - if ( $mykey % 2 == 0 ) - $content['Search'][$mykey]['cssclass'] = "line1"; - else - $content['Search'][$mykey]['cssclass'] = "line2"; - // --- - - } - } - else // Disable predefined searches - $content['EnablePredefinedSearches'] = false; -} - -function InitPhpDebugMode() -{ - global $content, $CFG; - - // --- Set Global DEBUG Level! - if ( $CFG['MiscShowDebugMsg'] == 1 ) - ini_set( "error_reporting", E_ALL ); // ALL PHP MESSAGES! -// else -// ini_set( "error_reporting", E_ERROR ); // ONLY PHP ERROR'S! - // --- -} - -function CheckAndSetRunMode() -{ - global $RUNMODE, $MaxExecutionTime; - // Set to command line mode if argv is set! - if ( !isset($_SERVER["GATEWAY_INTERFACE"]) ) - $RUNMODE = RUNMODE_COMMANDLINE; - - // Obtain max_execution_time - $MaxExecutionTime = ini_get("max_execution_time"); -} - -function InitRuntimeInformations() -{ - global $content, $CFG; - - // TODO| maybe not needed! - - // Enable GZIP Compression if enabled! - if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && (isset($CFG['MiscEnableGzipCompression']) && $CFG['MiscEnableGzipCompression'] == 1) ) - { - // This starts gzip compression! - ob_start("ob_gzhandler"); - $content['GzipCompressionEnmabled'] = "yes"; - } - else - $content['GzipCompressionEnmabled'] = "no"; -} - -function CreateDebugModes() -{ - global $content; - - $content['DBGMODES'][0]['DisplayName'] = STR_DEBUG_ULTRADEBUG; - if ( $content['parser_debugmode'] == $content['DBGMODES'][0]['DisplayName'] ) { $content['DBGMODES'][0]['selected'] = "selected"; } else { $content['DBGMODES'][0]['selected'] = ""; } - $content['DBGMODES'][1]['DisplayName'] = STR_DEBUG_DEBUG; - if ( $content['parser_debugmode'] == $content['DBGMODES'][1]['DisplayName'] ) { $content['DBGMODES'][1]['selected'] = "selected"; } else { $content['DBGMODES'][1]['selected'] = ""; } - $content['DBGMODES'][2]['DisplayName'] = STR_DEBUG_INFO; - if ( $content['parser_debugmode'] == $content['DBGMODES'][2]['DisplayName'] ) { $content['DBGMODES'][2]['selected'] = "selected"; } else { $content['DBGMODES'][2]['selected'] = ""; } - $content['DBGMODES'][3]['DisplayName'] = STR_DEBUG_WARN; - if ( $content['parser_debugmode'] == $content['DBGMODES'][3]['DisplayName'] ) { $content['DBGMODES'][3]['selected'] = "selected"; } else { $content['DBGMODES'][3]['selected'] = ""; } - $content['DBGMODES'][4]['DisplayName'] = STR_DEBUG_ERROR; - if ( $content['parser_debugmode'] == $content['DBGMODES'][4]['DisplayName'] ) { $content['DBGMODES'][4]['selected'] = "selected"; } else { $content['DBGMODES'][4]['selected'] = ""; } -} - -function InitFrontEndVariables() -{ - global $content; - - $content['MENU_FOLDER_OPEN'] = $content['BASEPATH'] . "images/icons/folder_closed.png"; - $content['MENU_FOLDER_CLOSED'] = $content['BASEPATH'] . "images/icons/folder.png"; - $content['MENU_HOMEPAGE'] = $content['BASEPATH'] . "images/icons/home.png"; - $content['MENU_LINK'] = $content['BASEPATH'] . "images/icons/link.png"; - $content['MENU_LINK_VIEW'] = $content['BASEPATH'] . "images/icons/link_view.png"; - $content['MENU_VIEW'] = $content['BASEPATH'] . "images/icons/view.png"; - $content['MENU_PREFERENCES'] = $content['BASEPATH'] . "images/icons/preferences.png"; - $content['MENU_ADMINENTRY'] = $content['BASEPATH'] . "images/icons/star_blue.png"; - $content['MENU_ADMINLOGOFF'] = $content['BASEPATH'] . "images/icons/exit.png"; - $content['MENU_ADMINUSERS'] = $content['BASEPATH'] . "images/icons/businessmen.png"; - $content['MENU_SEARCH'] = $content['BASEPATH'] . "images/icons/view.png"; - $content['MENU_SELECTION_DISABLED'] = $content['BASEPATH'] . "images/icons/selection.png"; - $content['MENU_SELECTION_ENABLED'] = $content['BASEPATH'] . "images/icons/selection_delete.png"; - $content['MENU_TEXT_FIND'] = $content['BASEPATH'] . "images/icons/text_find.png"; - $content['MENU_NETWORK'] = $content['BASEPATH'] . "images/icons/earth_network.png"; - - - $content['MENU_PAGER_BEGIN'] = $content['BASEPATH'] . "images/icons/media_beginning.png"; - $content['MENU_PAGER_PREVIOUS'] = $content['BASEPATH'] . "images/icons/media_rewind.png"; - $content['MENU_PAGER_NEXT'] = $content['BASEPATH'] . "images/icons/media_fast_forward.png"; - $content['MENU_PAGER_END'] = $content['BASEPATH'] . "images/icons/media_end.png"; - $content['MENU_NAV_LEFT'] = $content['BASEPATH'] . "images/icons/navigate_left.png"; - $content['MENU_NAV_RIGHT'] = $content['BASEPATH'] . "images/icons/navigate_right.png"; - $content['MENU_NAV_CLOSE'] = $content['BASEPATH'] . "images/icons/navigate_close.png"; - $content['MENU_NAV_OPEN'] = $content['BASEPATH'] . "images/icons/navigate_open.png"; - $content['MENU_PAGER_BEGIN_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_beginning.png"; - $content['MENU_PAGER_PREVIOUS_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_rewind.png"; - $content['MENU_PAGER_NEXT_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_fast_forward.png"; - $content['MENU_PAGER_END_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_end.png"; - - $content['MENU_BULLET_BLUE'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_blue.png"; - $content['MENU_BULLET_GREEN'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_green.png"; - $content['MENU_BULLET_RED'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_red.png"; - $content['MENU_BULLET_YELLOW'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_yellow.png"; - $content['MENU_BULLET_GREY'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_grey.png"; - - $content['MENU_ICON_GOOGLE'] = $content['BASEPATH'] . "images/icons/googleicon.png"; -} - -// Lang Helper for Strings with ONE variable -function GetAndReplaceLangStr( $strlang, $param1 = "", $param2 = "", $param3 = "", $param4 = "", $param5 = "" ) -{ - $strfinal = str_replace ( "%1", $param1, $strlang ); - if ( strlen($param2) > 0 ) - $strfinal = str_replace ( "%1", $param2, $strfinal ); - if ( strlen($param3) > 0 ) - $strfinal = str_replace ( "%1", $param3, $strfinal ); - if ( strlen($param4) > 0 ) - $strfinal = str_replace ( "%1", $param4, $strfinal ); - if ( strlen($param5) > 0 ) - $strfinal = str_replace ( "%1", $param5, $strfinal ); - - // And return - return $strfinal; -} - -function InitConfigurationValues() -{ - global $content, $CFG, $LANG, $gl_root_path; - - // If Database is enabled, try to read from database! - if ( $CFG['UserDBEnabled'] ) - { - $result = DB_Query("SELECT * FROM " . DB_CONFIG); - $rows = DB_GetAllRows($result, true, true); - - if ( isset($rows ) ) - { - for($i = 0; $i < count($rows); $i++) - $content[ $rows[$i]['name'] ] = $rows[$i]['value']; - } - // General defaults - // --- Language Handling - if ( !isset($content['gen_lang']) ) { $content['gen_lang'] = $CFG['ViewDefaultLanguage'] /*"en"*/; } - - // --- PHP Debug Mode - if ( !isset($content['gen_phpdebug']) ) { $content['gen_phpdebug'] = "no"; } - // --- - - // Database Version Checker! - if ( $content['database_internalversion'] > $content['database_installedversion'] ) - { - // Database is out of date, we need to upgrade - $content['database_forcedatabaseupdate'] = "yes"; - } - } - else - { - // --- Set Defaults... - // Language Handling - if ( isset($_SESSION['CUSTOM_LANG']) && VerifyLanguage($_SESSION['CUSTOM_LANG']) ) - { - $content['user_lang'] = $_SESSION['CUSTOM_LANG']; - $LANG = $content['user_lang']; - } - else if ( isset($content['gen_lang']) && VerifyLanguage($content['gen_lang'])) - { - $content['user_lang'] = $content['gen_lang']; - $LANG = $content['user_lang']; - } - else // Failsave! - { - $content['user_lang'] = $CFG['ViewDefaultLanguage'] /*"en"*/; - $LANG = $content['user_lang']; - $content['gen_lang'] = $content['user_lang']; - } - } - - // Paging Size handling! - if ( !isset($_SESSION['PAGESIZE_ID']) ) - { - // Default is 0! - $_SESSION['PAGESIZE_ID'] = 0; - } - - // Auto reload handling! - if ( !isset($_SESSION['AUTORELOAD_ID']) ) - { - if ( isset($CFG['ViewEnableAutoReloadSeconds']) && $CFG['ViewEnableAutoReloadSeconds'] > 0 ) - $_SESSION['AUTORELOAD_ID'] = 1; // Autoreload ID will be the first item! - else // Default is 0, which means auto reload disabled - $_SESSION['AUTORELOAD_ID'] = 0; - } - - // Theme Handling - if ( !isset($content['web_theme']) ) { $content['web_theme'] = $CFG['ViewDefaultTheme'] /*"default"*/; } - if ( isset($_SESSION['CUSTOM_THEME']) && VerifyTheme($_SESSION['CUSTOM_THEME']) ) - $content['user_theme'] = $_SESSION['CUSTOM_THEME']; - else - $content['user_theme'] = $content['web_theme']; - - //Init Theme About Info ^^ - InitThemeAbout($content['user_theme']); - // --- - - // Init main langauge file now! - IncludeLanguageFile( $gl_root_path . '/lang/' . $LANG . '/main.php' ); - - // Init other things which are needed - InitFrontEndVariables(); -} - -function SetDebugModeFromString( $facility ) -{ - global $DEBUGMODE; - - switch ( $facility ) - { - case STR_DEBUG_ULTRADEBUG: - $DEBUGMODE = DEBUG_ULTRADEBUG; - break; - case STR_DEBUG_DEBUG: - $DEBUGMODE = DEBUG_DEBUG; - break; - case STR_DEBUG_INFO: - $DEBUGMODE = DEBUG_INFO; - break; - case STR_DEBUG_WARN: - $DEBUGMODE = DEBUG_WARN; - break; - case STR_DEBUG_ERROR: - $DEBUGMODE = DEBUG_ERROR; - break; - } -} - - -function InitPageRenderStats() -{ - global $gl_starttime, $querycount; - $gl_starttime = microtime_float(); - $querycount = 0; -} - -function FinishPageRenderStats( &$mycontent) -{ - global $gl_starttime, $querycount; - - $endtime = microtime_float(); - $mycontent['PAGERENDERTIME'] = number_format($endtime - $gl_starttime, 4, '.', ''); - $mycontent['TOTALQUERIES'] = $querycount; -} - -function microtime_float() -{ - list($usec, $sec) = explode(" ", microtime()); - return ((float)$usec + (float)$sec); -} - -function SetLineBreakVar() -{ - // Used for some functions - global $RUNMODE, $linesep; - - if ( $RUNMODE == RUNMODE_COMMANDLINE ) - $linesep = "\r\n"; - else if ( $RUNMODE == RUNMODE_WEBSERVER ) - $linesep = "
    "; -} - -function CheckUrlOrIP($ip) -{ - $long = ip2long($ip); - if ( $long == -1 ) - return false; - else - return true; -} - -function DieWithErrorMsg( $szerrmsg ) -{ - global $content; - print(""); - print("

    Critical Error occured


    "); - print("Errordetails:
    " . $szerrmsg); - print("
    "); - - exit; -} - -function DieWithFriendlyErrorMsg( $szerrmsg ) -{ - //TODO: Make with template - print(""); - print("

    Error occured


    "); - print("Errordetails:
    " . $szerrmsg); - exit; -} - -/* -* Helper function to initialize the page title! -*/ -function InitPageTitle() -{ - global $content, $CFG, $currentSourceID; - - if ( isset($CFG['PrependTitle']) && strlen($CFG['PrependTitle']) > 0 ) - $szReturn = $CFG['PrependTitle'] . " :: "; - else - $szReturn = ""; - - if ( isset($currentSourceID) && isset($content['Sources'][$currentSourceID]['Name']) ) - $szReturn .= "Source '" . $content['Sources'][$currentSourceID]['Name'] . "' :: "; - - // Append phpLogCon - $szReturn .= "phpLogCon"; - - // return result - return $szReturn; -} - - -function GetStringWithHTMLCodes($myStr) -{ - // Replace all special characters with valid html representations - return htmlentities($myStr); -} - -function InitTemplateParser() -{ - global $page, $gl_root_path; - // ----------------------------------------------- - // Create Template Object and set some variables for the templates - // ----------------------------------------------- - $page = new Template(); - $page -> set_path ( $gl_root_path . "templates/" ); -} - -function VerifyLanguage( $mylang ) -{ - global $gl_root_path; - - if ( is_dir( $gl_root_path . 'lang/' . $mylang ) ) - return true; - else - return false; -} - -function IncludeLanguageFile( $langfile ) -{ - global $LANG, $LANG_EN; - - if ( file_exists( $langfile ) ) - include( $langfile ); - else - { - $langfile = str_replace( $LANG, $LANG_EN, $langfile ); - include( $langfile ); - } -} - -function RedirectPage( $newpage ) -{ - header("Location: $newpage"); - exit; -} - -function RedirectResult( $szMsg, $newpage ) -{ - header("Location: result.php?msg=" . urlencode($szMsg) . "&redir=" . urlencode($newpage)); - exit; -} - -/* -* GetEventTime -* -* Helper function to parse and obtain a valid EventTime Array from the input string. -* Return value: EventTime Array! -* -*/ -function GetEventTime($szTimStr) -{ - // Sample: Mar 10 14:45:44 - if ( preg_match("/(...) ([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) - { - // RFC 3164 typical timestamp - $eventtime[EVTIME_TIMESTAMP] = mktime($out[3], $out[4], $out[5], GetMonthFromString($out[1]), $out[2]); - $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! - $eventtime[EVTIME_MICROSECONDS] = 0; - -// echo gmdate(DATE_RFC822, $eventtime[EVTIME_TIMESTAMP]) . "
    "; -// print_r ( $eventtime ); -// exit; - } - // Sample: 2008-04-02T11:12:32+02:00 - else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\+([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) - { - // RFC 3164 typical timestamp - $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); - $eventtime[EVTIME_TIMEZONE] = $out[7]; - $eventtime[EVTIME_MICROSECONDS] = 0; - } - // Sample: 2008-04-02T11:12:32.380449+02:00 - else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\.([0-9]{1,6})\+([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) - { - // RFC 3164 typical timestamp - $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); - $eventtime[EVTIME_TIMEZONE] = $out[8]; - $eventtime[EVTIME_MICROSECONDS] = $out[7]; - } - // Sample: 2008-04-02,15:19:06 - else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2}),([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) - { - // RFC 3164 typical timestamp - $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); - $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! - $eventtime[EVTIME_MICROSECONDS] = 0; - } - // Sample: 2008-02-19 12:52:37 - else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) - { - // RFC 3164 typical timestamp - $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); - $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! - $eventtime[EVTIME_MICROSECONDS] = 0; - } - // Sample: 2007-4-18T00:00:00 - else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) - { - // RFC 3164 typical timestamp - $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); - $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! - $eventtime[EVTIME_MICROSECONDS] = 0; - } - else - { - die ("wtf GetEventTime unparsable time - " . $szTimStr ); - } - - // return result! - return $eventtime; -} - -/* -* GetMonthFromString -* -* Simple Helper function to obtain the numeric represantation of the month -*/ -function GetMonthFromString($szMonth) -{ - switch($szMonth) - { - case "Jan": - return 1; - case "Feb": - return 2; - case "Mar": - return 3; - case "Apr": - return 4; - case "May": - return 5; - case "Jun": - return 6; - case "Jul": - return 7; - case "Aug": - return 8; - case "Sep": - return 9; - case "Oct": - return 10; - case "Nov": - return 11; - case "Dez": - return 12; - } -} - -/* -* AddContextLinks -*/ -function AddContextLinks(&$sourceTxt) -{ - global $szTLDDomains, $CFG; - - // Return if not enabled! - if ( !isset($CFG['EnableIPAddressResolve']) || $CFG['EnableIPAddressResolve'] == 1 ) - { - // Search for IP's and Add Reverse Lookup first! - $sourceTxt = preg_replace( '/([^\[])\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/e', "'\\1\\2.\\3.\\4.\\5' . ReverseResolveIP('\\2.\\3.\\4.\\5', ' {', '} ')", $sourceTxt ); - } - - // Create if not set! - if ( !isset($szTLDDomains) ) - CreateTopLevelDomainSearch(); - - // Create Search Array - $search = array - ( - '/\.([\w\d\_\-]+)\.(' . $szTLDDomains . ')([^a-zA-Z0-9\.])/e', -// '|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|', -/* (?:127)| */ '/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/e', - ); - - // Create Replace Array - $replace = array - ( - "'.' . InsertLookupLink(\"\", \"\\1.\\2\", \"\", \"\\3\")", - "'.' . InsertLookupLink(\"\\1.\\2.\\3.\\4\", \"\", \"\", \"\")", - ); - - // Replace and return! - $sourceTxt = preg_replace( $search, $replace, $sourceTxt ); - -//echo $outTxt . "
    " ; -//return $outTxt; -} - -/* -* Helper to create a Lookup Link! -*/ -function InsertLookupLink( $szIP, $szDomain, $prepend, $append ) -{ - // Create string - $szReturn = $prepend; - if ( strlen($szIP) > 0 ) - { - if ( - (($pos = strpos($szIP, "10.")) !== FALSE && $pos == 0) || - (($pos = strpos($szIP, "127.")) !== FALSE && $pos == 0) || - (($pos = strpos($szIP, "172.")) !== FALSE && $pos == 0) || - (($pos = strpos($szIP, "192.")) !== FALSE && $pos == 0) - ) - // Do not create a LINK in this case! - $szReturn .= '' . $szIP . ''; - else - // Normal LINK! - $szReturn .= '' . $szIP . ''; - } - else if ( strlen($szDomain) > 0 ) - $szReturn .= '' . $szDomain . ''; - $szReturn .= $append; - - // return result - return $szReturn; -} - -/* -* Reserve Resolve IP Address! -*/ -function ReverseResolveIP( $szIP, $prepend, $append ) -{ - global $gl_starttime, $MaxExecutionTime; - - // Substract 5 savety seconds! - $scriptruntime = intval(microtime_float() - $gl_starttime); - if ( $scriptruntime > ($MaxExecutionTime-5) ) - return ""; - - // Abort if these IP's are postet - if ( strpos($szIP, "0.0.0.0") !== false | strpos($szIP, "127.") !== false | strpos($szIP, "255.255.255.255") !== false ) - return ""; - else - { - // Resolve name if needed - if ( !isset($_SESSION['dns_cache'][$szIP]) ) - $_SESSION['dns_cache'][$szIP] = gethostbyaddr($szIP); - - // Abort if IP and RESOLVED name are the same ^^! - if ( $_SESSION['dns_cache'][$szIP] == $szIP || strlen($_SESSION['dns_cache'][$szIP]) <= 0 ) - return; - - // Create string - $szReturn = $prepend; - $szReturn .= $_SESSION['dns_cache'][$szIP]; - $szReturn .= $append; - - // return result - return $szReturn; - } -} - -/* -* Helper function to create a top level domain search string ONCE per process! -*/ -function CreateTopLevelDomainSearch() -{ - // Current list taken from http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains! - global $szTLDDomains; - $szTLDDomains = "co.th|com.au|co.uk|co.jp"; - $szTLDDomains .= "aero|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel|cTLD|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw"; -} - -// --- BEGIN Usermanagement Function --- -function StartPHPSession() -{ - global $RUNMODE; - if ( $RUNMODE == RUNMODE_WEBSERVER ) - { - // This will start the session - if (session_id() == "") - session_start(); - - if ( !isset($_SESSION['SESSION_STARTED']) ) - $_SESSION['SESSION_STARTED'] = "true"; - } -} - -function CheckForUserLogin( $isloginpage, $isUpgradePage = false ) -{ - global $content; - - if ( isset($_SESSION['SESSION_LOGGEDIN']) ) - { - if ( !$_SESSION['SESSION_LOGGEDIN'] ) - RedirectToUserLogin(); - else - { - $content['SESSION_LOGGEDIN'] = "true"; - $content['SESSION_USERNAME'] = $_SESSION['SESSION_USERNAME']; - } - - // New, Check for database Version and may redirect to updatepage! - if ( isset($content['database_forcedatabaseupdate']) && - $content['database_forcedatabaseupdate'] == "yes" && - $isUpgradePage == false - ) - RedirectToDatabaseUpgrade(); - } - else - { - if ( $isloginpage == false ) - RedirectToUserLogin(); - } - -} - -function CreateUserName( $username, $password, $access_level ) -{ - $md5pass = md5($password); - $result = DB_Query("SELECT username FROM " . STATS_USERS . " WHERE username = '" . $username . "'"); - $rows = DB_GetAllRows($result, true); - if ( isset($rows) ) - { - DieWithFriendlyErrorMsg( "User $username already exists!" ); - - // User not created! - return false; - } - else - { - // Create User - $result = DB_Query("INSERT INTO " . STATS_USERS . " (username, password, access_level) VALUES ('$username', '$md5pass', $access_level)"); - DB_FreeQuery($result); - - // Success - return true; - } -} - -function CheckUserLogin( $username, $password ) -{ - global $content, $CFG; - - // TODO: SessionTime and AccessLevel check - - $md5pass = md5($password); - $sqlselect = "SELECT access_level FROM " . STATS_USERS . " WHERE username = '" . $username . "' and password = '" . $md5pass . "'"; - $result = DB_Query($sqlselect); - $rows = DB_GetAllRows($result, true); - if ( isset($rows) ) - { - $_SESSION['SESSION_LOGGEDIN'] = true; - $_SESSION['SESSION_USERNAME'] = $username; - $_SESSION['SESSION_ACCESSLEVEL'] = $rows[0]['access_level']; - - $content['SESSION_LOGGEDIN'] = "true"; - $content['SESSION_USERNAME'] = $username; - - // Success ! - return true; - } - else - { - if ( $CFG['MiscShowDebugMsg'] == 1 ) - DieWithFriendlyErrorMsg( "Debug Error: Could not login user '" . $username . "'

    Sessionarray
    " . var_export($_SESSION, true) . "

    SQL Statement: " . $sqlselect ); - - // Default return false - return false; - } -} - -function DoLogOff() -{ - global $content; - - unset( $_SESSION['SESSION_LOGGEDIN'] ); - unset( $_SESSION['SESSION_USERNAME'] ); - unset( $_SESSION['SESSION_ACCESSLEVEL'] ); - - // Redir to Index Page - RedirectPage( "index.php"); -} - -function RedirectToUserLogin() -{ - // TODO Referer - header("Location: login.php?referer=" . $_SERVER['PHP_SELF']); - exit; -} - -function RedirectToDatabaseUpgrade() -{ - // TODO Referer - header("Location: upgrade.php"); // ?referer=" . $_SERVER['PHP_SELF']); - exit; -} -// --- END Usermanagement Function --- - - + www.phplogcon.org <- * + * ----------------------------------------------------------------- * + * Common needed functions * + * * + * -> * + * * + * All directives are explained within this file * + * + * Copyright (C) 2008 Adiscon GmbH. + * + * This file is part of phpLogCon. + * + * PhpLogCon is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PhpLogCon is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with phpLogCon. If not, see . + * + * A copy of the GPL can be found in the file "COPYING" in this + * distribution. + ********************************************************************* +*/ + +// --- Avoid directly accessing this file! +if ( !defined('IN_PHPLOGCON') ) +{ + die('Hacking attempt'); + exit; +} +// --- + +// --- Basic Includes +include($gl_root_path . 'include/constants_general.php'); +include($gl_root_path . 'include/constants_logstream.php'); + +include($gl_root_path . 'classes/class_template.php'); +include($gl_root_path . 'include/functions_themes.php'); +include($gl_root_path . 'include/functions_db.php'); +include($gl_root_path . 'include/functions_config.php'); +// --- + +// --- Define Basic vars +$RUNMODE = RUNMODE_WEBSERVER; +$DEBUGMODE = DEBUG_INFO; + +// --- Disable ARGV setting @webserver! +ini_set( "register_argc_argv", "Off" ); +// --- + +// Default language +$LANG_EN = "en"; // Used for fallback +$LANG = "en"; // Default language + +// Default Template vars +$content['BUILDNUMBER'] = "2.3.7"; +$content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title +$content['BASEPATH'] = $gl_root_path; +$content['EXTRA_METATAGS'] = ""; +$content['EXTRA_JAVASCRIPT'] = ""; +$content['EXTRA_STYLESHEET'] = ""; +// --- + +// --- Check PHP Version! If lower the 5, phplogcon will not work proberly! +$myPhpVer = phpversion(); +$myPhpVerArray = explode('.', $myPhpVer); +if ( $myPhpVerArray[0] < 5 ) + DieWithErrorMsg( 'Error, the PHP Version on this Server does not meet the installation requirements.
    PHP5 or higher is needed. Current installed Version is: ' . $myPhpVer . ''); +// --- + +function InitBasicPhpLogCon() +{ + // Needed to make global + global $CFG, $gl_root_path, $content; + + // Check RunMode first! + CheckAndSetRunMode(); + + // Set the default line sep + SetLineBreakVar(); + + // Start the PHP Session + StartPHPSession(); + + // Init View Configs prior loading config.php! + InitViewConfigs(); +} + +function InitPhpLogConConfigFile($bHandleMissing = true) +{ + // Needed to make global + global $CFG, $gl_root_path, $content; + + if ( file_exists($gl_root_path . 'config.php') && GetFileLength($gl_root_path . 'config.php') > 0 ) + { + // Include the main config + include_once($gl_root_path . 'config.php'); + + // Easier DB Access + define('DB_CONFIG', $CFG['UserDBPref'] . "config"); + + // Legacy support for old columns definition format! + if ( isset($CFG['Columns']) && is_array($CFG['Columns']) ) + AppendLegacyColumns(); + + // --- Now Copy all entries into content variable + foreach ($CFG as $key => $value ) + $content[$key] = $value; + // --- + + // For MiscShowPageRenderStats + if ( $CFG['MiscShowPageRenderStats'] == 1 ) + { + $content['ShowPageRenderStats'] = "true"; + InitPageRenderStats(); + } + + // return result + return true; + } + else + { + // if handled ourselfe, we die in CheckForInstallPhp. + if ( $bHandleMissing == true ) + { + // Check for installscript! + CheckForInstallPhp(); + } + else + return false; + } +} + +function CheckForInstallPhp() +{ + // Check for installscript! + if ( file_exists($content['BASEPATH'] . "install.php") ) + $strinstallmsg = '

    ' + . '
    Click here to Install PhpLogCon!

    ' +// . 'See the Installation Guides for more Details!
    ' +// . 'English Installation Guide | ' +// . 'German Installation Guide

    ' +// . 'Also take a look to the Readme for some basics around PhpLogCon!
    ' + . '
    '; + else + $strinstallmsg = ""; + DieWithErrorMsg( 'Error, main configuration file is missing!' . $strinstallmsg ); +} + +function GetFileLength($szFileName) +{ + if ( is_file($szFileName) ) + return filesize($szFileName); + else + return 0; +} + +function InitPhpLogCon() +{ + // Needed to make global + global $CFG, $gl_root_path, $content; + + // Init Basics which do not need a database + InitBasicPhpLogCon(); + + // Will init the config file! + InitPhpLogConConfigFile(); + + // Moved here, because we do not need if GZIP needs to be enabled before the config is loaded! + InitRuntimeInformations(); + + // Establish DB Connection + if ( $CFG['UserDBEnabled'] ) + DB_Connect(); + + // Now load the Page configuration values + InitConfigurationValues(); + + // Now Create Themes List because we haven't the config before! + CreateThemesList(); + + // Create Language List + CreateLanguageList(); + + // Init Predefined Searches List + CreatePredefinedSearches(); + + // Init predefined paging sizes + CreatePagesizesList(); + + // Init predefined reload times + CreateReloadTimesList(); + + // --- Enable PHP Debug Mode + InitPhpDebugMode(); + // --- +} + +function CreateLogLineTypesList( $selectedType ) +{ + global $content; + + // syslog + $content['LOGLINETYPES']["syslog"]['type'] = "syslog"; + $content['LOGLINETYPES']["syslog"]['DisplayName'] = "Syslog / RSyslog"; + if ( $selectedType == $content['LOGLINETYPES']["syslog"]['type'] ) { $content['LOGLINETYPES']["syslog"]['selected'] = "selected"; } else { $content['LOGLINETYPES']["syslog"]['selected'] = ""; } + + // Adiscon Winsyslog + $content['LOGLINETYPES']["winsyslog"]['type'] = "winsyslog"; + $content['LOGLINETYPES']["winsyslog"]['DisplayName'] = "Adiscon WinSyslog"; + if ( $selectedType == $content['LOGLINETYPES']["winsyslog"]['type'] ) { $content['LOGLINETYPES']["winsyslog"]['selected'] = "selected"; } else { $content['LOGLINETYPES']["winsyslog"]['selected'] = ""; } +} + +function CreateSourceTypesList( $selectedSource ) +{ + global $content; + + // SOURCE_DISK + $content['SOURCETYPES'][SOURCE_DISK]['type'] = SOURCE_DISK; + $content['SOURCETYPES'][SOURCE_DISK]['DisplayName'] = $content['LN_GEN_SOURCE_DISK']; + if ( $selectedSource == $content['SOURCETYPES'][SOURCE_DISK]['type'] ) { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = ""; } + + // SOURCE_DB ( MYSQL NATIVE ) + $content['SOURCETYPES'][SOURCE_DB]['type'] = SOURCE_DB; + $content['SOURCETYPES'][SOURCE_DB]['DisplayName'] = $content['LN_GEN_SOURCE_DB']; + if ( $selectedSource == $content['SOURCETYPES'][SOURCE_DB]['type'] ) { $content['SOURCETYPES'][SOURCE_DB]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_DB]['selected'] = ""; } + + // SOURCE_PDO ( PDO DB Wrapper) + $content['SOURCETYPES'][SOURCE_PDO]['type'] = SOURCE_PDO; + $content['SOURCETYPES'][SOURCE_PDO]['DisplayName'] = $content['LN_GEN_SOURCE_PDO']; + if ( $selectedSource == $content['SOURCETYPES'][SOURCE_PDO]['type'] ) { $content['SOURCETYPES'][SOURCE_PDO]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_PDO]['selected'] = ""; } +} + +function CreateDBTypesList( $selectedDBType ) +{ + global $content; + + // DB_MYSQL + $content['DBTYPES'][DB_MYSQL]['type'] = DB_MYSQL; + $content['DBTYPES'][DB_MYSQL]['typeastext'] = "DB_MYSQL"; + $content['DBTYPES'][DB_MYSQL]['DisplayName'] = $content['LN_GEN_DB_MYSQL']; + if ( $selectedDBType == $content['DBTYPES'][DB_MYSQL]['type'] ) { $content['DBTYPES'][DB_MYSQL]['selected'] = "selected"; } else { $content['DBTYPES'][DB_MYSQL]['selected'] = ""; } + + // DB_MSSQL + $content['DBTYPES'][DB_MSSQL]['type'] = DB_MSSQL; + $content['DBTYPES'][DB_MSSQL]['typeastext'] = "DB_MSSQL"; + $content['DBTYPES'][DB_MSSQL]['DisplayName'] = $content['LN_GEN_DB_MSSQL']; + if ( $selectedDBType == $content['DBTYPES'][DB_MSSQL]['type'] ) { $content['DBTYPES'][DB_MSSQL]['selected'] = "selected"; } else { $content['DBTYPES'][DB_MSSQL]['selected'] = ""; } + + // DB_ODBC + $content['DBTYPES'][DB_ODBC]['type'] = DB_ODBC; + $content['DBTYPES'][DB_ODBC]['typeastext'] = "DB_ODBC"; + $content['DBTYPES'][DB_ODBC]['DisplayName'] = $content['LN_GEN_DB_ODBC']; + if ( $selectedDBType == $content['DBTYPES'][DB_ODBC]['type'] ) { $content['DBTYPES'][DB_ODBC]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_ODBC]['selected'] = ""; } + + // DB_PGSQL + $content['DBTYPES'][DB_PGSQL]['type'] = DB_PGSQL; + $content['DBTYPES'][DB_PGSQL]['typeastext'] = "DB_PGSQL"; + $content['DBTYPES'][DB_PGSQL]['DisplayName'] = $content['LN_GEN_DB_PGSQL']; + if ( $selectedDBType == $content['DBTYPES'][DB_PGSQL]['type'] ) { $content['DBTYPES'][DB_PGSQL]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_PGSQL]['selected'] = ""; } + + // DB_OCI + $content['DBTYPES'][DB_OCI]['type'] = DB_OCI; + $content['DBTYPES'][DB_OCI]['typeastext'] = "DB_OCI"; + $content['DBTYPES'][DB_OCI]['DisplayName'] = $content['LN_GEN_DB_OCI']; + if ( $selectedDBType == $content['DBTYPES'][DB_OCI]['type'] ) { $content['DBTYPES'][DB_OCI]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_OCI]['selected'] = ""; } + + // DB_DB2 + $content['DBTYPES'][DB_DB2]['type'] = DB_DB2; + $content['DBTYPES'][DB_DB2]['typeastext'] = "DB_DB2"; + $content['DBTYPES'][DB_DB2]['DisplayName'] = $content['LN_GEN_DB_DB2']; + if ( $selectedDBType == $content['DBTYPES'][DB_DB2]['type'] ) { $content['DBTYPES'][DB_DB2]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_DB2]['selected'] = ""; } + + // DB_FIREBIRD + $content['DBTYPES'][DB_FIREBIRD]['type'] = DB_FIREBIRD; + $content['DBTYPES'][DB_FIREBIRD]['typeastext'] = "DB_FIREBIRD"; + $content['DBTYPES'][DB_FIREBIRD]['DisplayName'] = $content['LN_GEN_DB_FIREBIRD']; + if ( $selectedDBType == $content['DBTYPES'][DB_FIREBIRD]['type'] ) { $content['DBTYPES'][DB_FIREBIRD]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_FIREBIRD]['selected'] = ""; } + + // DB_INFORMIX + $content['DBTYPES'][DB_INFORMIX]['type'] = DB_INFORMIX; + $content['DBTYPES'][DB_INFORMIX]['typeastext'] = "DB_INFORMIX"; + $content['DBTYPES'][DB_INFORMIX]['DisplayName'] = $content['LN_GEN_DB_INFORMIX']; + if ( $selectedDBType == $content['DBTYPES'][DB_INFORMIX]['type'] ) { $content['DBTYPES'][DB_INFORMIX]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_INFORMIX]['selected'] = ""; } + + // DB_SQLITE + $content['DBTYPES'][DB_SQLITE]['type'] = DB_SQLITE; + $content['DBTYPES'][DB_SQLITE]['typeastext'] = "DB_SQLITE"; + $content['DBTYPES'][DB_SQLITE]['DisplayName'] = $content['LN_GEN_DB_SQLITE']; + if ( $selectedDBType == $content['DBTYPES'][DB_SQLITE]['type'] ) { $content['DBTYPES'][DB_SQLITE]['selected'] = "selected"; } else { $content['DB_ODBC'][DB_SQLITE]['selected'] = ""; } +} + +function CreatePagesizesList() +{ + global $CFG, $content; + + $iCounter = 0; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_GEN_PRECONFIGURED'] . " (" . $CFG['ViewEntriesPerPage'] . ")", "Value" => $CFG['ViewEntriesPerPage'] ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 25 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 25 ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 50 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 50 ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 75 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 75 ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 100 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 100 ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 250 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 250 ); $iCounter++; + $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 500 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 500 ); $iCounter++; + + // Set default selected pagesize + $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Selected"] = "selected"; + + // The content variable will now contain the user selected oaging size + $content["ViewEntriesPerPage"] = $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Value"]; +} + +function CreateReloadTimesList() +{ + global $CFG, $content; + +// $CFG['ViewEnableAutoReloadSeconds'] + $iCounter = 0; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_DISABLED'], "Value" => 0 ); $iCounter++; + if ( isset($CFG['ViewEnableAutoReloadSeconds']) && $CFG['ViewEnableAutoReloadSeconds'] > 0 ) + { + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_PRECONFIGURED'] . " (" . $CFG['ViewEnableAutoReloadSeconds'] . " " . $content['LN_AUTORELOAD_SECONDS'] . ") ", "Value" => $CFG['ViewEnableAutoReloadSeconds'] ); $iCounter++; + } + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 5 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 5 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 10 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 10 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 15 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 15 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 30 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 30 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 60 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 60 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 5 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 300 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 10 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 600 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 15 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 900 ); $iCounter++; + $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 30 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 1800 ); $iCounter++; + + // Set default selected autoreloadid + $content['reloadtimes'][ $_SESSION['AUTORELOAD_ID'] ]["Selected"] = "selected"; + + // The content variable will now contain the user selected oaging size + $content["ViewEnableAutoReloadSeconds"] = $content['reloadtimes'][ $_SESSION['AUTORELOAD_ID'] ]["Value"]; + +} + +function CreatePredefinedSearches() +{ + global $CFG, $content; + if ( isset($CFG['Search']) ) + { + // Enable predefined searches + $content['EnablePredefinedSearches'] = true; + + // Loop through all predefined searches! + foreach ($CFG['Search'] as $mykey => $mySearch) + { + // Copy configured searches into content array! + $content['Search'][$mykey]["ID"] = $mykey; + $content['Search'][$mykey]["Selected"] = false; + + // --- Set CSS Class + if ( $mykey % 2 == 0 ) + $content['Search'][$mykey]['cssclass'] = "line1"; + else + $content['Search'][$mykey]['cssclass'] = "line2"; + // --- + + } + } + else // Disable predefined searches + $content['EnablePredefinedSearches'] = false; +} + +function InitPhpDebugMode() +{ + global $content, $CFG; + + // --- Set Global DEBUG Level! + if ( $CFG['MiscShowDebugMsg'] == 1 ) + ini_set( "error_reporting", E_ALL ); // ALL PHP MESSAGES! +// else +// ini_set( "error_reporting", E_ERROR ); // ONLY PHP ERROR'S! + // --- +} + +function CheckAndSetRunMode() +{ + global $RUNMODE, $MaxExecutionTime; + // Set to command line mode if argv is set! + if ( !isset($_SERVER["GATEWAY_INTERFACE"]) ) + $RUNMODE = RUNMODE_COMMANDLINE; + + // Obtain max_execution_time + $MaxExecutionTime = ini_get("max_execution_time"); +} + +function InitRuntimeInformations() +{ + global $content, $CFG; + + // TODO| maybe not needed! + + // Enable GZIP Compression if enabled! + if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && (isset($CFG['MiscEnableGzipCompression']) && $CFG['MiscEnableGzipCompression'] == 1) ) + { + // This starts gzip compression! + ob_start("ob_gzhandler"); + $content['GzipCompressionEnmabled'] = "yes"; + } + else + $content['GzipCompressionEnmabled'] = "no"; +} + +function CreateDebugModes() +{ + global $content; + + $content['DBGMODES'][0]['DisplayName'] = STR_DEBUG_ULTRADEBUG; + if ( $content['parser_debugmode'] == $content['DBGMODES'][0]['DisplayName'] ) { $content['DBGMODES'][0]['selected'] = "selected"; } else { $content['DBGMODES'][0]['selected'] = ""; } + $content['DBGMODES'][1]['DisplayName'] = STR_DEBUG_DEBUG; + if ( $content['parser_debugmode'] == $content['DBGMODES'][1]['DisplayName'] ) { $content['DBGMODES'][1]['selected'] = "selected"; } else { $content['DBGMODES'][1]['selected'] = ""; } + $content['DBGMODES'][2]['DisplayName'] = STR_DEBUG_INFO; + if ( $content['parser_debugmode'] == $content['DBGMODES'][2]['DisplayName'] ) { $content['DBGMODES'][2]['selected'] = "selected"; } else { $content['DBGMODES'][2]['selected'] = ""; } + $content['DBGMODES'][3]['DisplayName'] = STR_DEBUG_WARN; + if ( $content['parser_debugmode'] == $content['DBGMODES'][3]['DisplayName'] ) { $content['DBGMODES'][3]['selected'] = "selected"; } else { $content['DBGMODES'][3]['selected'] = ""; } + $content['DBGMODES'][4]['DisplayName'] = STR_DEBUG_ERROR; + if ( $content['parser_debugmode'] == $content['DBGMODES'][4]['DisplayName'] ) { $content['DBGMODES'][4]['selected'] = "selected"; } else { $content['DBGMODES'][4]['selected'] = ""; } +} + +function InitFrontEndVariables() +{ + global $content; + + $content['MENU_FOLDER_OPEN'] = $content['BASEPATH'] . "images/icons/folder_closed.png"; + $content['MENU_FOLDER_CLOSED'] = $content['BASEPATH'] . "images/icons/folder.png"; + $content['MENU_HOMEPAGE'] = $content['BASEPATH'] . "images/icons/home.png"; + $content['MENU_LINK'] = $content['BASEPATH'] . "images/icons/link.png"; + $content['MENU_LINK_VIEW'] = $content['BASEPATH'] . "images/icons/link_view.png"; + $content['MENU_VIEW'] = $content['BASEPATH'] . "images/icons/view.png"; + $content['MENU_PREFERENCES'] = $content['BASEPATH'] . "images/icons/preferences.png"; + $content['MENU_ADMINENTRY'] = $content['BASEPATH'] . "images/icons/star_blue.png"; + $content['MENU_ADMINLOGOFF'] = $content['BASEPATH'] . "images/icons/exit.png"; + $content['MENU_ADMINUSERS'] = $content['BASEPATH'] . "images/icons/businessmen.png"; + $content['MENU_SEARCH'] = $content['BASEPATH'] . "images/icons/view.png"; + $content['MENU_SELECTION_DISABLED'] = $content['BASEPATH'] . "images/icons/selection.png"; + $content['MENU_SELECTION_ENABLED'] = $content['BASEPATH'] . "images/icons/selection_delete.png"; + $content['MENU_TEXT_FIND'] = $content['BASEPATH'] . "images/icons/text_find.png"; + $content['MENU_NETWORK'] = $content['BASEPATH'] . "images/icons/earth_network.png"; + + + $content['MENU_PAGER_BEGIN'] = $content['BASEPATH'] . "images/icons/media_beginning.png"; + $content['MENU_PAGER_PREVIOUS'] = $content['BASEPATH'] . "images/icons/media_rewind.png"; + $content['MENU_PAGER_NEXT'] = $content['BASEPATH'] . "images/icons/media_fast_forward.png"; + $content['MENU_PAGER_END'] = $content['BASEPATH'] . "images/icons/media_end.png"; + $content['MENU_NAV_LEFT'] = $content['BASEPATH'] . "images/icons/navigate_left.png"; + $content['MENU_NAV_RIGHT'] = $content['BASEPATH'] . "images/icons/navigate_right.png"; + $content['MENU_NAV_CLOSE'] = $content['BASEPATH'] . "images/icons/navigate_close.png"; + $content['MENU_NAV_OPEN'] = $content['BASEPATH'] . "images/icons/navigate_open.png"; + $content['MENU_PAGER_BEGIN_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_beginning.png"; + $content['MENU_PAGER_PREVIOUS_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_rewind.png"; + $content['MENU_PAGER_NEXT_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_fast_forward.png"; + $content['MENU_PAGER_END_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_end.png"; + + $content['MENU_BULLET_BLUE'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_blue.png"; + $content['MENU_BULLET_GREEN'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_green.png"; + $content['MENU_BULLET_RED'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_red.png"; + $content['MENU_BULLET_YELLOW'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_yellow.png"; + $content['MENU_BULLET_GREY'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_grey.png"; + + $content['MENU_ICON_GOOGLE'] = $content['BASEPATH'] . "images/icons/googleicon.png"; +} + +// Lang Helper for Strings with ONE variable +function GetAndReplaceLangStr( $strlang, $param1 = "", $param2 = "", $param3 = "", $param4 = "", $param5 = "" ) +{ + $strfinal = str_replace ( "%1", $param1, $strlang ); + if ( strlen($param2) > 0 ) + $strfinal = str_replace ( "%1", $param2, $strfinal ); + if ( strlen($param3) > 0 ) + $strfinal = str_replace ( "%1", $param3, $strfinal ); + if ( strlen($param4) > 0 ) + $strfinal = str_replace ( "%1", $param4, $strfinal ); + if ( strlen($param5) > 0 ) + $strfinal = str_replace ( "%1", $param5, $strfinal ); + + // And return + return $strfinal; +} + +function InitConfigurationValues() +{ + global $content, $CFG, $LANG, $gl_root_path; + + // If Database is enabled, try to read from database! + if ( $CFG['UserDBEnabled'] ) + { + $result = DB_Query("SELECT * FROM " . DB_CONFIG); + $rows = DB_GetAllRows($result, true, true); + + if ( isset($rows ) ) + { + for($i = 0; $i < count($rows); $i++) + $content[ $rows[$i]['name'] ] = $rows[$i]['value']; + } + // General defaults + // --- Language Handling + if ( !isset($content['gen_lang']) ) { $content['gen_lang'] = $CFG['ViewDefaultLanguage'] /*"en"*/; } + + // --- PHP Debug Mode + if ( !isset($content['gen_phpdebug']) ) { $content['gen_phpdebug'] = "no"; } + // --- + + // Database Version Checker! + if ( $content['database_internalversion'] > $content['database_installedversion'] ) + { + // Database is out of date, we need to upgrade + $content['database_forcedatabaseupdate'] = "yes"; + } + } + else + { + // --- Set Defaults... + // Language Handling + if ( isset($_SESSION['CUSTOM_LANG']) && VerifyLanguage($_SESSION['CUSTOM_LANG']) ) + { + $content['user_lang'] = $_SESSION['CUSTOM_LANG']; + $LANG = $content['user_lang']; + } + else if ( isset($content['gen_lang']) && VerifyLanguage($content['gen_lang'])) + { + $content['user_lang'] = $content['gen_lang']; + $LANG = $content['user_lang']; + } + else // Failsave! + { + $content['user_lang'] = $CFG['ViewDefaultLanguage'] /*"en"*/; + $LANG = $content['user_lang']; + $content['gen_lang'] = $content['user_lang']; + } + } + + // Paging Size handling! + if ( !isset($_SESSION['PAGESIZE_ID']) ) + { + // Default is 0! + $_SESSION['PAGESIZE_ID'] = 0; + } + + // Auto reload handling! + if ( !isset($_SESSION['AUTORELOAD_ID']) ) + { + if ( isset($CFG['ViewEnableAutoReloadSeconds']) && $CFG['ViewEnableAutoReloadSeconds'] > 0 ) + $_SESSION['AUTORELOAD_ID'] = 1; // Autoreload ID will be the first item! + else // Default is 0, which means auto reload disabled + $_SESSION['AUTORELOAD_ID'] = 0; + } + + // Theme Handling + if ( !isset($content['web_theme']) ) { $content['web_theme'] = $CFG['ViewDefaultTheme'] /*"default"*/; } + if ( isset($_SESSION['CUSTOM_THEME']) && VerifyTheme($_SESSION['CUSTOM_THEME']) ) + $content['user_theme'] = $_SESSION['CUSTOM_THEME']; + else + $content['user_theme'] = $content['web_theme']; + + //Init Theme About Info ^^ + InitThemeAbout($content['user_theme']); + // --- + + // Init main langauge file now! + IncludeLanguageFile( $gl_root_path . '/lang/' . $LANG . '/main.php' ); + + // Init other things which are needed + InitFrontEndVariables(); +} + +function SetDebugModeFromString( $facility ) +{ + global $DEBUGMODE; + + switch ( $facility ) + { + case STR_DEBUG_ULTRADEBUG: + $DEBUGMODE = DEBUG_ULTRADEBUG; + break; + case STR_DEBUG_DEBUG: + $DEBUGMODE = DEBUG_DEBUG; + break; + case STR_DEBUG_INFO: + $DEBUGMODE = DEBUG_INFO; + break; + case STR_DEBUG_WARN: + $DEBUGMODE = DEBUG_WARN; + break; + case STR_DEBUG_ERROR: + $DEBUGMODE = DEBUG_ERROR; + break; + } +} + + +function InitPageRenderStats() +{ + global $gl_starttime, $querycount; + $gl_starttime = microtime_float(); + $querycount = 0; +} + +function FinishPageRenderStats( &$mycontent) +{ + global $gl_starttime, $querycount; + + $endtime = microtime_float(); + $mycontent['PAGERENDERTIME'] = number_format($endtime - $gl_starttime, 4, '.', ''); + $mycontent['TOTALQUERIES'] = $querycount; +} + +function microtime_float() +{ + list($usec, $sec) = explode(" ", microtime()); + return ((float)$usec + (float)$sec); +} + +function SetLineBreakVar() +{ + // Used for some functions + global $RUNMODE, $linesep; + + if ( $RUNMODE == RUNMODE_COMMANDLINE ) + $linesep = "\r\n"; + else if ( $RUNMODE == RUNMODE_WEBSERVER ) + $linesep = "
    "; +} + +function CheckUrlOrIP($ip) +{ + $long = ip2long($ip); + if ( $long == -1 ) + return false; + else + return true; +} + +function DieWithErrorMsg( $szerrmsg ) +{ + global $content; + print(""); + print("

    Critical Error occured


    "); + print("Errordetails:
    " . $szerrmsg); + print("
    "); + + exit; +} + +function DieWithFriendlyErrorMsg( $szerrmsg ) +{ + //TODO: Make with template + print(""); + print("

    Error occured


    "); + print("Errordetails:
    " . $szerrmsg); + exit; +} + +/* +* Helper function to initialize the page title! +*/ +function InitPageTitle() +{ + global $content, $CFG, $currentSourceID; + + if ( isset($CFG['PrependTitle']) && strlen($CFG['PrependTitle']) > 0 ) + $szReturn = $CFG['PrependTitle'] . " :: "; + else + $szReturn = ""; + + if ( isset($currentSourceID) && isset($content['Sources'][$currentSourceID]['Name']) ) + $szReturn .= "Source '" . $content['Sources'][$currentSourceID]['Name'] . "' :: "; + + // Append phpLogCon + $szReturn .= "phpLogCon"; + + // return result + return $szReturn; +} + + +function GetStringWithHTMLCodes($myStr) +{ + // Replace all special characters with valid html representations + return htmlentities($myStr); +} + +function InitTemplateParser() +{ + global $page, $gl_root_path; + // ----------------------------------------------- + // Create Template Object and set some variables for the templates + // ----------------------------------------------- + $page = new Template(); + $page -> set_path ( $gl_root_path . "templates/" ); +} + +function VerifyLanguage( $mylang ) +{ + global $gl_root_path; + + if ( is_dir( $gl_root_path . 'lang/' . $mylang ) ) + return true; + else + return false; +} + +function IncludeLanguageFile( $langfile ) +{ + global $LANG, $LANG_EN; + + if ( file_exists( $langfile ) ) + include( $langfile ); + else + { + $langfile = str_replace( $LANG, $LANG_EN, $langfile ); + include( $langfile ); + } +} + +function RedirectPage( $newpage ) +{ + header("Location: $newpage"); + exit; +} + +function RedirectResult( $szMsg, $newpage ) +{ + header("Location: result.php?msg=" . urlencode($szMsg) . "&redir=" . urlencode($newpage)); + exit; +} + +/* +* GetEventTime +* +* Helper function to parse and obtain a valid EventTime Array from the input string. +* Return value: EventTime Array! +* +*/ +function GetEventTime($szTimStr) +{ + // Sample: Mar 10 14:45:44 + if ( preg_match("/(...) ([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) + { + // RFC 3164 typical timestamp + $eventtime[EVTIME_TIMESTAMP] = mktime($out[3], $out[4], $out[5], GetMonthFromString($out[1]), $out[2]); + $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! + $eventtime[EVTIME_MICROSECONDS] = 0; + +// echo gmdate(DATE_RFC822, $eventtime[EVTIME_TIMESTAMP]) . "
    "; +// print_r ( $eventtime ); +// exit; + } + // Sample: 2008-04-02T11:12:32+02:00 + else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\+([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) + { + // RFC 3164 typical timestamp + $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); + $eventtime[EVTIME_TIMEZONE] = $out[7]; + $eventtime[EVTIME_MICROSECONDS] = 0; + } + // Sample: 2008-04-02T11:12:32.380449+02:00 + else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\.([0-9]{1,6})\+([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) + { + // RFC 3164 typical timestamp + $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); + $eventtime[EVTIME_TIMEZONE] = $out[8]; + $eventtime[EVTIME_MICROSECONDS] = $out[7]; + } + // Sample: 2008-04-02,15:19:06 + else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2}),([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) + { + // RFC 3164 typical timestamp + $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); + $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! + $eventtime[EVTIME_MICROSECONDS] = 0; + } + // Sample: 2008-02-19 12:52:37 + else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) + { + // RFC 3164 typical timestamp + $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); + $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! + $eventtime[EVTIME_MICROSECONDS] = 0; + } + // Sample: 2007-4-18T00:00:00 + else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) ) + { + // RFC 3164 typical timestamp + $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]); + $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! + $eventtime[EVTIME_MICROSECONDS] = 0; + } + else + { + die ("wtf GetEventTime unparsable time - " . $szTimStr ); + } + + // return result! + return $eventtime; +} + +/* +* GetMonthFromString +* +* Simple Helper function to obtain the numeric represantation of the month +*/ +function GetMonthFromString($szMonth) +{ + switch($szMonth) + { + case "Jan": + return 1; + case "Feb": + return 2; + case "Mar": + return 3; + case "Apr": + return 4; + case "May": + return 5; + case "Jun": + return 6; + case "Jul": + return 7; + case "Aug": + return 8; + case "Sep": + return 9; + case "Oct": + return 10; + case "Nov": + return 11; + case "Dez": + return 12; + } +} + +/* +* AddContextLinks +*/ +function AddContextLinks(&$sourceTxt) +{ + global $szTLDDomains, $CFG; + + // Return if not enabled! + if ( !isset($CFG['EnableIPAddressResolve']) || $CFG['EnableIPAddressResolve'] == 1 ) + { + // Search for IP's and Add Reverse Lookup first! + $sourceTxt = preg_replace( '/([^\[])\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/e', "'\\1\\2.\\3.\\4.\\5' . ReverseResolveIP('\\2.\\3.\\4.\\5', ' {', '} ')", $sourceTxt ); + } + + // Create if not set! + if ( !isset($szTLDDomains) ) + CreateTopLevelDomainSearch(); + + // Create Search Array + $search = array + ( + '/\.([\w\d\_\-]+)\.(' . $szTLDDomains . ')([^a-zA-Z0-9\.])/e', +// '|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|', +/* (?:127)| */ '/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/e', + ); + + // Create Replace Array + $replace = array + ( + "'.' . InsertLookupLink(\"\", \"\\1.\\2\", \"\", \"\\3\")", + "'.' . InsertLookupLink(\"\\1.\\2.\\3.\\4\", \"\", \"\", \"\")", + ); + + // Replace and return! + $sourceTxt = preg_replace( $search, $replace, $sourceTxt ); + +//echo $outTxt . "
    " ; +//return $outTxt; +} + +/* +* Helper to create a Lookup Link! +*/ +function InsertLookupLink( $szIP, $szDomain, $prepend, $append ) +{ + // Create string + $szReturn = $prepend; + if ( strlen($szIP) > 0 ) + { + if ( + (($pos = strpos($szIP, "10.")) !== FALSE && $pos == 0) || + (($pos = strpos($szIP, "127.")) !== FALSE && $pos == 0) || + (($pos = strpos($szIP, "172.")) !== FALSE && $pos == 0) || + (($pos = strpos($szIP, "192.")) !== FALSE && $pos == 0) + ) + // Do not create a LINK in this case! + $szReturn .= '' . $szIP . ''; + else + // Normal LINK! + $szReturn .= '' . $szIP . ''; + } + else if ( strlen($szDomain) > 0 ) + $szReturn .= '' . $szDomain . ''; + $szReturn .= $append; + + // return result + return $szReturn; +} + +/* +* Reserve Resolve IP Address! +*/ +function ReverseResolveIP( $szIP, $prepend, $append ) +{ + global $gl_starttime, $MaxExecutionTime; + + // Substract 5 savety seconds! + $scriptruntime = intval(microtime_float() - $gl_starttime); + if ( $scriptruntime > ($MaxExecutionTime-5) ) + return ""; + + // Abort if these IP's are postet + if ( strpos($szIP, "0.0.0.0") !== false | strpos($szIP, "127.") !== false | strpos($szIP, "255.255.255.255") !== false ) + return ""; + else + { + // Resolve name if needed + if ( !isset($_SESSION['dns_cache'][$szIP]) ) + $_SESSION['dns_cache'][$szIP] = gethostbyaddr($szIP); + + // Abort if IP and RESOLVED name are the same ^^! + if ( $_SESSION['dns_cache'][$szIP] == $szIP || strlen($_SESSION['dns_cache'][$szIP]) <= 0 ) + return; + + // Create string + $szReturn = $prepend; + $szReturn .= $_SESSION['dns_cache'][$szIP]; + $szReturn .= $append; + + // return result + return $szReturn; + } +} + +/* +* Helper function to create a top level domain search string ONCE per process! +*/ +function CreateTopLevelDomainSearch() +{ + // Current list taken from http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains! + global $szTLDDomains; + $szTLDDomains = "co.th|com.au|co.uk|co.jp"; + $szTLDDomains .= "aero|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel|cTLD|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw"; +} + +// --- BEGIN Usermanagement Function --- +function StartPHPSession() +{ + global $RUNMODE; + if ( $RUNMODE == RUNMODE_WEBSERVER ) + { + // This will start the session + if (session_id() == "") + session_start(); + + if ( !isset($_SESSION['SESSION_STARTED']) ) + $_SESSION['SESSION_STARTED'] = "true"; + } +} + +function CheckForUserLogin( $isloginpage, $isUpgradePage = false ) +{ + global $content; + + if ( isset($_SESSION['SESSION_LOGGEDIN']) ) + { + if ( !$_SESSION['SESSION_LOGGEDIN'] ) + RedirectToUserLogin(); + else + { + $content['SESSION_LOGGEDIN'] = "true"; + $content['SESSION_USERNAME'] = $_SESSION['SESSION_USERNAME']; + } + + // New, Check for database Version and may redirect to updatepage! + if ( isset($content['database_forcedatabaseupdate']) && + $content['database_forcedatabaseupdate'] == "yes" && + $isUpgradePage == false + ) + RedirectToDatabaseUpgrade(); + } + else + { + if ( $isloginpage == false ) + RedirectToUserLogin(); + } + +} + +function CreateUserName( $username, $password, $access_level ) +{ + $md5pass = md5($password); + $result = DB_Query("SELECT username FROM " . STATS_USERS . " WHERE username = '" . $username . "'"); + $rows = DB_GetAllRows($result, true); + if ( isset($rows) ) + { + DieWithFriendlyErrorMsg( "User $username already exists!" ); + + // User not created! + return false; + } + else + { + // Create User + $result = DB_Query("INSERT INTO " . STATS_USERS . " (username, password, access_level) VALUES ('$username', '$md5pass', $access_level)"); + DB_FreeQuery($result); + + // Success + return true; + } +} + +function CheckUserLogin( $username, $password ) +{ + global $content, $CFG; + + // TODO: SessionTime and AccessLevel check + + $md5pass = md5($password); + $sqlselect = "SELECT access_level FROM " . STATS_USERS . " WHERE username = '" . $username . "' and password = '" . $md5pass . "'"; + $result = DB_Query($sqlselect); + $rows = DB_GetAllRows($result, true); + if ( isset($rows) ) + { + $_SESSION['SESSION_LOGGEDIN'] = true; + $_SESSION['SESSION_USERNAME'] = $username; + $_SESSION['SESSION_ACCESSLEVEL'] = $rows[0]['access_level']; + + $content['SESSION_LOGGEDIN'] = "true"; + $content['SESSION_USERNAME'] = $username; + + // Success ! + return true; + } + else + { + if ( $CFG['MiscShowDebugMsg'] == 1 ) + DieWithFriendlyErrorMsg( "Debug Error: Could not login user '" . $username . "'

    Sessionarray
    " . var_export($_SESSION, true) . "

    SQL Statement: " . $sqlselect ); + + // Default return false + return false; + } +} + +function DoLogOff() +{ + global $content; + + unset( $_SESSION['SESSION_LOGGEDIN'] ); + unset( $_SESSION['SESSION_USERNAME'] ); + unset( $_SESSION['SESSION_ACCESSLEVEL'] ); + + // Redir to Index Page + RedirectPage( "index.php"); +} + +function RedirectToUserLogin() +{ + // TODO Referer + header("Location: login.php?referer=" . $_SERVER['PHP_SELF']); + exit; +} + +function RedirectToDatabaseUpgrade() +{ + // TODO Referer + header("Location: upgrade.php"); // ?referer=" . $_SERVER['PHP_SELF']); + exit; +} +// --- END Usermanagement Function --- + + ?> \ No newline at end of file From d2893c446deb2db450e5e7becf69a966db808881 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 25 Jul 2008 15:19:11 +0200 Subject: [PATCH 66/79] IP Addresses or Broadcasts are not linked anymore --- src/include/functions_common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 4927ed1..2428902 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -867,7 +867,6 @@ function AddContextLinks(&$sourceTxt) $search = array ( '/\.([\w\d\_\-]+)\.(' . $szTLDDomains . ')([^a-zA-Z0-9\.])/e', -// '|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|', /* (?:127)| */ '/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/e', ); @@ -898,7 +897,8 @@ function InsertLookupLink( $szIP, $szDomain, $prepend, $append ) (($pos = strpos($szIP, "10.")) !== FALSE && $pos == 0) || (($pos = strpos($szIP, "127.")) !== FALSE && $pos == 0) || (($pos = strpos($szIP, "172.")) !== FALSE && $pos == 0) || - (($pos = strpos($szIP, "192.")) !== FALSE && $pos == 0) + (($pos = strpos($szIP, "192.")) !== FALSE && $pos == 0) || + (($pos = strpos($szIP, "255.")) !== FALSE && $pos == 0) ) // Do not create a LINK in this case! $szReturn .= '' . $szIP . ''; From d02044b92c6728927e40dbb30617e2a1908a06e8 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 25 Jul 2008 15:34:39 +0200 Subject: [PATCH 67/79] Perfected private IP Address detection --- src/include/functions_common.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 2428902..c8039df 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -893,12 +893,15 @@ function InsertLookupLink( $szIP, $szDomain, $prepend, $append ) $szReturn = $prepend; if ( strlen($szIP) > 0 ) { + // Split IP into array + $IPArray = explode(".", $szIP); + if ( - (($pos = strpos($szIP, "10.")) !== FALSE && $pos == 0) || - (($pos = strpos($szIP, "127.")) !== FALSE && $pos == 0) || - (($pos = strpos($szIP, "172.")) !== FALSE && $pos == 0) || - (($pos = strpos($szIP, "192.")) !== FALSE && $pos == 0) || - (($pos = strpos($szIP, "255.")) !== FALSE && $pos == 0) + (intval($IPArray[0]) == 10 ) || + (intval($IPArray[0]) == 127 ) || + (intval($IPArray[0]) == 172 && intval($IPArray[1]) >= 16 && intval($IPArray[1]) <= 31) || + (intval($IPArray[0]) == 192 && intval($IPArray[1]) == 168) || + (intval($IPArray[0]) == 255 ) ) // Do not create a LINK in this case! $szReturn .= '' . $szIP . ''; From da75604ea2bff60343a0713807f54a1c29b90026 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 25 Jul 2008 15:46:01 +0200 Subject: [PATCH 68/79] Minro bug fixed in IP Lookup Link creation --- src/include/functions_common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index c8039df..7a56881 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -874,7 +874,7 @@ function AddContextLinks(&$sourceTxt) $replace = array ( "'.' . InsertLookupLink(\"\", \"\\1.\\2\", \"\", \"\\3\")", - "'.' . InsertLookupLink(\"\\1.\\2.\\3.\\4\", \"\", \"\", \"\")", + "InsertLookupLink(\"\\1.\\2.\\3.\\4\", \"\", \"\", \"\")", ); // Replace and return! From 959798078ecbbb48bc162e4de589399ab206c952 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 28 Jul 2008 12:01:16 +0200 Subject: [PATCH 69/79] Added changelog entry --- ChangeLog | 9 +++++++++ src/include/functions_common.php | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d382724..18818df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,13 @@ --------------------------------------------------------------------------- +Version 2.3.8 (beta), 2008-07-28 +- Fixed a "notice" bug in the installer, which was missing to save the + DBType for MYSQL Datasource. +- Fixed a bug in the pdo logstream class which caused display of empty + rows when no records where found. +- Fixed Bug ID82 from bugtracker. Internal and invalid IP Addresses are + not linked to whois anymore. +- Fixed Line Ending to Unix in some code files. +--------------------------------------------------------------------------- Version 2.3.7 (beta), 2008-07-07 - Added missing db mapping for program field of syslogng - thanks to Micha "Wolvverine" Panasiewicz diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 7a56881..a2aed48 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -62,7 +62,7 @@ $LANG_EN = "en"; // Used for fallback $LANG = "en"; // Default language // Default Template vars -$content['BUILDNUMBER'] = "2.3.7"; +$content['BUILDNUMBER'] = "2.3.8"; $content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title $content['BASEPATH'] = $gl_root_path; $content['EXTRA_METATAGS'] = ""; From fb7a76a63fdacce1a6de7c710836d710ad05b482 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 30 Jul 2008 16:58:50 +0200 Subject: [PATCH 70/79] Changed a little bit in the instructions of the INSTALL document for better understanding. --- INSTALL | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/INSTALL b/INSTALL index 731bf20..7d0e1ca 100644 --- a/INSTALL +++ b/INSTALL @@ -32,8 +32,9 @@ you can skip the following step: Upload the scripts configure.sh and secure.sh from the - contrib folder to your webserver, and set the execution - flag to them (chmod +x configure.sh secure.sh). + contrib folder to your webserver, into the same folder + where you uploaded the other phplogcon files into. Then set + the execution flag to them (chmod +x configure.sh secure.sh). Now run ./configure.sh, this will create a blank config.php, and will also set write access to everyone to it. From 12e08741ac693da7d2708b5f6dd22f6795f10bcf Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 1 Aug 2008 17:00:43 +0200 Subject: [PATCH 71/79] Fixed case senstive issue with dbmapping fieldsnames which causes problems with postgresql. --- src/include/constants_logstream.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/include/constants_logstream.php b/src/include/constants_logstream.php index 6fdd8aa..f5023bd 100644 --- a/src/include/constants_logstream.php +++ b/src/include/constants_logstream.php @@ -187,7 +187,6 @@ $dbmapping['monitorware'][SYSLOG_EVENT_SOURCE] = "EventSource"; $dbmapping['monitorware'][SYSLOG_EVENT_CATEGORY] = "EventCategory"; $dbmapping['monitorware'][SYSLOG_EVENT_USER] = "EventUser"; - $dbmapping['syslogng'][SYSLOG_UID] = "seq"; $dbmapping['syslogng'][SYSLOG_DATE] = "datetime"; $dbmapping['syslogng'][SYSLOG_HOST] = "host"; @@ -196,6 +195,14 @@ $dbmapping['syslogng'][SYSLOG_MESSAGE] = "msg"; //TODO $dbmapping['syslogng'][SYSLOG_SEVERITY] = "Priority" $dbmapping['syslogng'][SYSLOG_SYSLOGTAG] = "tag"; $dbmapping['syslogng'][SYSLOG_PROCESSID] = "program"; + +// Convert all fieldnames to lowercase to avoid problems with case sensitive array keys later +foreach( $dbmapping as &$myMapping ) +{ + foreach( $myMapping as &$myField ) + $myField = strtolower($myField); +} + // --- // EventTime Constants From fce57ba48a0a9355e77b3508dfe1840d7f0adb2f Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 6 Aug 2008 18:05:12 +0200 Subject: [PATCH 72/79] Fixed a bug parsing the Syslog date from a RFC 3164 Date String. Dates from the 1. to the 9. of a month were not correctly parsed. --- .../logstreamlineparsersyslog.class.php | 30 +++++++++---------- src/include/functions_common.php | 7 ++++- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/classes/logstreamlineparsersyslog.class.php b/src/classes/logstreamlineparsersyslog.class.php index 718a35b..60b85f1 100644 --- a/src/classes/logstreamlineparsersyslog.class.php +++ b/src/classes/logstreamlineparsersyslog.class.php @@ -64,31 +64,31 @@ class LogStreamLineParsersyslog extends LogStreamLineParser { $arrArguments[SYSLOG_MESSAGETYPE] = IUT_Syslog; // Sample (Syslog): Mar 10 14:45:44 debandre anacron[3226]: Job `cron.daily' terminated (mailing output) - if ( preg_match("/(... [0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) (.*?) (.*?)\[(.*?)\]:(.*?)$/", $szLine, $out ) ) + if ( preg_match("/(...)(?:.|..)([0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) (.*?) (.*?)\[(.*?)\]:(.*?)$/", $szLine, $out ) ) { // Copy parsed properties! - $arrArguments[SYSLOG_DATE] = GetEventTime($out[1]); - $arrArguments[SYSLOG_HOST] = $out[2]; - $arrArguments[SYSLOG_SYSLOGTAG] = $out[3]; - $arrArguments[SYSLOG_PROCESSID] = $out[4]; - $arrArguments[SYSLOG_MESSAGE] = $out[5]; + $arrArguments[SYSLOG_DATE] = GetEventTime($out[1] . " " . $out[2]); + $arrArguments[SYSLOG_HOST] = $out[3]; + $arrArguments[SYSLOG_SYSLOGTAG] = $out[4]; + $arrArguments[SYSLOG_PROCESSID] = $out[5]; + $arrArguments[SYSLOG_MESSAGE] = $out[6]; } // Sample (Syslog): Mar 10 14:45:39 debandre syslogd 1.4.1#18: restart. - else if ( preg_match("/(... [0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) (.*?) (.*?):(.*?)$/", $szLine, $out ) ) + else if ( preg_match("/(...)(?:.|..)([0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) (.*?) (.*?):(.*?)$/", $szLine, $out ) ) { // Copy parsed properties! - $arrArguments[SYSLOG_DATE] = GetEventTime($out[1]); - $arrArguments[SYSLOG_HOST] = $out[2]; - $arrArguments[SYSLOG_SYSLOGTAG] = $out[3]; - $arrArguments[SYSLOG_MESSAGE] = $out[4]; + $arrArguments[SYSLOG_DATE] = GetEventTime($out[1] . " " . $out[2]); + $arrArguments[SYSLOG_HOST] = $out[3]; + $arrArguments[SYSLOG_SYSLOGTAG] = $out[4]; + $arrArguments[SYSLOG_MESSAGE] = $out[5]; } // Sample (Syslog): Mar 7 17:18:35 debandre exiting on signal 15 - else if ( preg_match("/(... [0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) (.*?) (.*?)$/", $szLine, $out ) ) + else if ( preg_match("/(...)(?:.|..)([0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) (.*?) (.*?)$/", $szLine, $out ) ) { // Copy parsed properties! - $arrArguments[SYSLOG_DATE] = GetEventTime($out[1]); - $arrArguments[SYSLOG_HOST] = $out[2]; - $arrArguments[SYSLOG_MESSAGE] = $out[3]; + $arrArguments[SYSLOG_DATE] = GetEventTime($out[1] . " " . $out[2]); + $arrArguments[SYSLOG_HOST] = $out[3]; + $arrArguments[SYSLOG_MESSAGE] = $out[4]; } // Sample (RSyslog): 2008-03-28T11:07:40+01:00 localhost rger: test 1 else if ( preg_match("/([0-9]{4,4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]{1,2}:[0-9]{1,2}) (.*?) (.*?):(.*?)$/", $szLine, $out ) ) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index a2aed48..085ff18 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -802,7 +802,12 @@ function GetEventTime($szTimStr) } else { - die ("wtf GetEventTime unparsable time - " . $szTimStr ); + $eventtime[EVTIME_TIMESTAMP] = 0; + $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO! + $eventtime[EVTIME_MICROSECONDS] = 0; + + // Print Error! + OutputDebugMessage("GetEventTime got an unparsable time '" . $szTimStr . "', returning 0"); } // return result! From 1f0fe601c697c15813068b730ecbef4c68fe983c Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 7 Aug 2008 16:09:43 +0200 Subject: [PATCH 73/79] Enhanced the detail popup window, it performs much better now and is less annoying. You can close a detail popup by clicking into its content now. And it locates itself to the middle of your mouse pointer location. --- src/css/defaults.css | 16 +++++++++-- src/css/menu.css | 2 +- src/js/common.js | 62 ++++++++++++++++++++++++++++++++++++++++ src/templates/index.html | 8 +++--- 4 files changed, 81 insertions(+), 7 deletions(-) diff --git a/src/css/defaults.css b/src/css/defaults.css index 9dc39ec..4907eb8 100644 --- a/src/css/defaults.css +++ b/src/css/defaults.css @@ -33,19 +33,30 @@ { font-weight:normal; text-decoration:none; + position:relative; + overflow:visible; } .syslogdetails { - position:relative; /*this is the key*/ + position:relative; + overflow:visible; z-index:4; } .syslogdetails:hover { + position:relative; /*this is the key*/ font-weight:normal; z-index:5; } -.syslogdetails span {display: none} +.syslogdetails span +{ + position:relative; + overflow:visible; + display: none; + z-index:-1; + +} /*the span will display just on :hover state*/ /* .syslogdetails:hover span @@ -60,6 +71,7 @@ { display:block; position:absolute; + overflow:auto; z-index:5; /* top:15px; */ /* left:15px; */ diff --git a/src/css/menu.css b/src/css/menu.css index 4066524..a9156b3 100644 --- a/src/css/menu.css +++ b/src/css/menu.css @@ -19,7 +19,7 @@ #menu h2 { font-size: 12px; - font: bold; + font-weight: bold; text-align: center; } diff --git a/src/js/common.js b/src/js/common.js index fef542a..e0dfdf6 100644 --- a/src/js/common.js +++ b/src/js/common.js @@ -234,3 +234,65 @@ function DebugShowElementsById(ObjName) document.write(obj[key]); } } + + +/* +* Detail popup handling functions +*/ +var myPopupHovering = false; +function HoveringPopup(event, parentObj) +{ + // This will allow the detail window to be relocated + myPopupHovering = true; +} + +function FinishHoveringPopup(event, parentObj) +{ + // This will avoid moving the detail window when it is open + myPopupHovering = false; +} + +function initPopupWindow(parentObj) +{ + // Change CSS Class + parentObj.className='syslogdetails_popup'; +} + +function FinishPopupWindow(parentObj) +{ + // Change CSS Class + parentObj.className='syslogdetails'; +} + +function disableEventPropagation(myEvent) +{ + /* This workaround is specially for our beloved Internet Explorer */ + if ( window.event) + { + window.event.cancelBubble = true; + } +} + +function movePopupWindow(myEvent, ObjName, PopupContentWidth, parentObj) +{ + var obj = document.getElementById(ObjName); + var middle = PopupContentWidth / 2; +// alert ( parentObj.className ) ; + if (myPopupHovering == false) + { + obj.style.left = (myEvent.clientX - middle) + 'px'; + } +} + +function GoToPopupTarget(myTarget, parentObj) +{ + if (!myPopupHovering) + { + // Change document location + document.location=myTarget; + } + else /* Close Popup */ + { + FinishPopupWindow(parentObj); + } +} diff --git a/src/templates/index.html b/src/templates/index.html index 957e720..27ff4c5 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -265,14 +265,14 @@ -
    {fieldvalue}
    - - +
    {fieldvalue}
    + +
    - +
    {popupcaption}
    {detailfieldtitle}{detailfieldvalue}{detailfieldvalue}
    From 960e2f62efcfa7d78235c32ae25792062d1caf75 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 7 Aug 2008 16:25:07 +0200 Subject: [PATCH 74/79] Fixed image alignment problem in the main view once and for all! --- src/index.php | 4 +++- src/templates/index.html | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/index.php b/src/index.php index fb3b1c4..daaf5dc 100644 --- a/src/index.php +++ b/src/index.php @@ -322,6 +322,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c $content['syslogmessages'][$counter]['values'][$mycolkey]['fieldbgcolor'] = ""; $content['syslogmessages'][$counter]['values'][$mycolkey]['isnowrap'] = "nowrap"; $content['syslogmessages'][$counter]['values'][$mycolkey]['hasdetails'] = "false"; + $content['syslogmessages'][$counter]['values'][$mycolkey]['detailimagealign'] = "TOP"; // Set default link $content['syslogmessages'][$counter]['values'][$mycolkey]['detaillink'] = "#"; @@ -472,7 +473,8 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c { $content['syslogmessages'][$counter]['values'][$mycolkey]['popupcaption'] = GetAndReplaceLangStr( $content['LN_GRID_POPUPDETAILS'], $logArray[SYSLOG_UID]); $content['syslogmessages'][$counter]['values'][$mycolkey]['hasdetails'] = "true"; - + $content['syslogmessages'][$counter]['values'][$mycolkey]['detailimagealign'] = "left"; // Other alignment needed! + foreach($content['syslogmessages'][$counter]['values'] as $mykey => $myfield) { // Set Caption! diff --git a/src/templates/index.html b/src/templates/index.html index 27ff4c5..e577625 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -244,7 +244,7 @@ - + From adcedff3038b4d9101714c71f43a068530789fdc Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 7 Aug 2008 16:29:29 +0200 Subject: [PATCH 75/79] Added changelog entry --- ChangeLog | 8 ++++++++ src/include/functions_common.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 18818df..34f1976 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,12 @@ --------------------------------------------------------------------------- +Version 2.3.9 (beta), 2008-08-07 +- Fixed a bug in the parsing of RFC 3164 date and time stamps which + occured from the 1st to the 9th of each month. During this time, the + date was not correctly parsed. +- Enhanced detail popup window, it performs much better now and is less + annoying. It still can be turned off very easily. +- Fixed an image alignment problem of the message once and for all. +--------------------------------------------------------------------------- Version 2.3.8 (beta), 2008-07-28 - Fixed a "notice" bug in the installer, which was missing to save the DBType for MYSQL Datasource. diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 085ff18..e7aa9d1 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -62,7 +62,7 @@ $LANG_EN = "en"; // Used for fallback $LANG = "en"; // Default language // Default Template vars -$content['BUILDNUMBER'] = "2.3.8"; +$content['BUILDNUMBER'] = "2.3.9"; $content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title $content['BASEPATH'] = $gl_root_path; $content['EXTRA_METATAGS'] = ""; From 5bfa615b3371931c8ee33b90e0e1edb50d2ca3a6 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 27 Aug 2008 13:17:38 +0200 Subject: [PATCH 76/79] Fixed regex rules in syslog message parser Non RFC 3164 syslog messages are correctly processed now. --- src/classes/logstreamlineparsersyslog.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/classes/logstreamlineparsersyslog.class.php b/src/classes/logstreamlineparsersyslog.class.php index 60b85f1..275e069 100644 --- a/src/classes/logstreamlineparsersyslog.class.php +++ b/src/classes/logstreamlineparsersyslog.class.php @@ -64,7 +64,7 @@ class LogStreamLineParsersyslog extends LogStreamLineParser { $arrArguments[SYSLOG_MESSAGETYPE] = IUT_Syslog; // Sample (Syslog): Mar 10 14:45:44 debandre anacron[3226]: Job `cron.daily' terminated (mailing output) - if ( preg_match("/(...)(?:.|..)([0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) (.*?) (.*?)\[(.*?)\]:(.*?)$/", $szLine, $out ) ) + if ( preg_match("/(...)(?:.|..)([0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) ([a-zA-Z0-9_\-\.]{1,256}) ([A-Za-z0-9_\-\/\.]{1,32})\[(.*?)\]:(.*?)$/", $szLine, $out ) ) { // Copy parsed properties! $arrArguments[SYSLOG_DATE] = GetEventTime($out[1] . " " . $out[2]); @@ -73,8 +73,8 @@ class LogStreamLineParsersyslog extends LogStreamLineParser { $arrArguments[SYSLOG_PROCESSID] = $out[5]; $arrArguments[SYSLOG_MESSAGE] = $out[6]; } - // Sample (Syslog): Mar 10 14:45:39 debandre syslogd 1.4.1#18: restart. - else if ( preg_match("/(...)(?:.|..)([0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) (.*?) (.*?):(.*?)$/", $szLine, $out ) ) + // Sample (Syslog): Mar 10 14:45:39 debandre syslogd 1.4.1#18: restart. ([A-Za-z0-9_\/]{1,32}) + else if ( preg_match("/(...)(?:.|..)([0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) ([a-zA-Z0-9_\-\.]{1,256}) ([A-Za-z0-9_\-\/\.]{1,32}):(.*?)$/", $szLine, $out ) ) { // Copy parsed properties! $arrArguments[SYSLOG_DATE] = GetEventTime($out[1] . " " . $out[2]); From bbe1e00ec9ab9c2e7176944be9a5f45a1e169b28 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 27 Aug 2008 13:38:49 +0200 Subject: [PATCH 77/79] Added changelog entry --- ChangeLog | 5 +++++ src/include/functions_common.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 34f1976..51faf08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ --------------------------------------------------------------------------- +Version 2.3.10 (beta), 2008-08-27 +- Fixed a few parsing issues with prior RFC 3164 syslog messages. + These messages are now correctly parsed, or better do not cause + any parsing problems anymore. +--------------------------------------------------------------------------- Version 2.3.9 (beta), 2008-08-07 - Fixed a bug in the parsing of RFC 3164 date and time stamps which occured from the 1st to the 9th of each month. During this time, the diff --git a/src/include/functions_common.php b/src/include/functions_common.php index e7aa9d1..73f594d 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -62,7 +62,7 @@ $LANG_EN = "en"; // Used for fallback $LANG = "en"; // Default language // Default Template vars -$content['BUILDNUMBER'] = "2.3.9"; +$content['BUILDNUMBER'] = "2.3.10"; $content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title $content['BASEPATH'] = $gl_root_path; $content['EXTRA_METATAGS'] = ""; From 93f49396c3cb1d95e64f18807c85e636aadb2cdc Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 8 Sep 2008 12:35:07 +0200 Subject: [PATCH 78/79] Fixed logline parsing of syslog files, which is used by the logstream disk class --- src/classes/logstreamlineparsersyslog.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/classes/logstreamlineparsersyslog.class.php b/src/classes/logstreamlineparsersyslog.class.php index 275e069..c5a90be 100644 --- a/src/classes/logstreamlineparsersyslog.class.php +++ b/src/classes/logstreamlineparsersyslog.class.php @@ -73,7 +73,7 @@ class LogStreamLineParsersyslog extends LogStreamLineParser { $arrArguments[SYSLOG_PROCESSID] = $out[5]; $arrArguments[SYSLOG_MESSAGE] = $out[6]; } - // Sample (Syslog): Mar 10 14:45:39 debandre syslogd 1.4.1#18: restart. ([A-Za-z0-9_\/]{1,32}) + // Sample (Syslog): Mar 10 14:45:39 debandre syslogd 1.4.1#18: restart else if ( preg_match("/(...)(?:.|..)([0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) ([a-zA-Z0-9_\-\.]{1,256}) ([A-Za-z0-9_\-\/\.]{1,32}):(.*?)$/", $szLine, $out ) ) { // Copy parsed properties! @@ -82,6 +82,15 @@ class LogStreamLineParsersyslog extends LogStreamLineParser { $arrArguments[SYSLOG_SYSLOGTAG] = $out[4]; $arrArguments[SYSLOG_MESSAGE] = $out[5]; } + // Sample (Syslog): Mar 10 14:45:39 debandre syslogd restart + else if ( preg_match("/(...)(?:.|..)([0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) ([a-zA-Z0-9_\-\.]{1,256}) ([A-Za-z0-9_\-\/\.]{1,32}) (.*?)$/", $szLine, $out ) ) + { + // Copy parsed properties! + $arrArguments[SYSLOG_DATE] = GetEventTime($out[1] . " " . $out[2]); + $arrArguments[SYSLOG_HOST] = $out[3]; + $arrArguments[SYSLOG_SYSLOGTAG] = $out[4]; + $arrArguments[SYSLOG_MESSAGE] = $out[5]; + } // Sample (Syslog): Mar 7 17:18:35 debandre exiting on signal 15 else if ( preg_match("/(...)(?:.|..)([0-9]{1,2} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}) (.*?) (.*?)$/", $szLine, $out ) ) { From b115b472a6513bb1ba8430883c7bbfecbf5688ca Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 8 Sep 2008 12:37:28 +0200 Subject: [PATCH 79/79] Added changelog entry --- ChangeLog | 5 +++++ src/include/functions_common.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 51faf08..5628f2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ --------------------------------------------------------------------------- +Version 2.3.11 (beta), 2008-09-08 +- Fix another parsing issue in the logline parser. Most of RFC 3164 + formatted syslog messages should now be correctly splitted into their + fields. +--------------------------------------------------------------------------- Version 2.3.10 (beta), 2008-08-27 - Fixed a few parsing issues with prior RFC 3164 syslog messages. These messages are now correctly parsed, or better do not cause diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 73f594d..39e1c71 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -62,7 +62,7 @@ $LANG_EN = "en"; // Used for fallback $LANG = "en"; // Default language // Default Template vars -$content['BUILDNUMBER'] = "2.3.10"; +$content['BUILDNUMBER'] = "2.3.11"; $content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title $content['BASEPATH'] = $gl_root_path; $content['EXTRA_METATAGS'] = "";