diff --git a/ChangeLog b/ChangeLog
index b5b1170..f93d3a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,88 @@
---------------------------------------------------------------------------
+Version 2.4.0 (v2-stable), 2008-09-24
+- Merged beta branch into v2-stable branch.
+---------------------------------------------------------------------------
+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
+ 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
+ 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.
+- 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
+- Added translation for Brazilian Portuguese, thanks to Ricardo Maraschini
+---------------------------------------------------------------------------
Version 2.2.0 (v2-stable), 2008-06-10
- Moved beta branch to v2-stable branch.
---------------------------------------------------------------------------
+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.
+- 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
+ 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
+ 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.
+- 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.
@@ -12,9 +93,30 @@ Version 2.1.6 (beta), 2008-05-19
- Added check for installed PHP Version. phpLogCon will refuse to run
on PHP4 or lower from now on!
---------------------------------------------------------------------------
+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.1.5 (beta), 2008-05-05
- Converted all files into UNIX format (^M has been removed)
---------------------------------------------------------------------------
+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 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
+ is still room for further optimization
+---------------------------------------------------------------------------
Version 2.1.4 (beta), 2008-04-29
- Added missing facility 10 to 15 from RFC3164 into phhlogcon
---------------------------------------------------------------------------
@@ -32,7 +134,7 @@ Version 2.1.2 (beta), 2008-04-28
- Changed database layout from winsyslog to monitorware.
Added more debug handling
---------------------------------------------------------------------------
-Version 2.1.1 (devel), 2008-04-25
+Version 2.1.1 (beta), 2008-04-25
- 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.
@@ -43,5 +145,5 @@ Version 2.1.1 (devel), 2008-04-25
duplicated ones from before.
- added full german translation (thanks to Tom Bergfeld for providing it)
---------------------------------------------------------------------------
-Version 2.1.0 (devel), 2008-04-24
+Version 2.1.0 (beta), 2008-04-24
- initial release of the rewritten phpLogCon v2
diff --git a/INSTALL b/INSTALL
index 8c40018..7d0e1ca 100644
--- a/INSTALL
+++ b/INSTALL
@@ -28,12 +28,13 @@
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
- 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.
@@ -45,6 +46,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/classes/logstream.class.php b/src/classes/logstream.class.php
index c32d9d6..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!
@@ -317,6 +323,62 @@ 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;
+ /* 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;
@@ -479,6 +541,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/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/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 24a7d3a..afd2015 100644
--- a/src/classes/logstreamdb.class.php
+++ b/src/classes/logstreamdb.class.php
@@ -57,20 +57,11 @@ class LogStreamDB extends LogStream {
private $_totalRecordCount = -1;
private $_previousPageUID = -1;
private $_lastPageUID = -1;
+ private $_firstPageUID = -1;
private $_currentPageNumber = 0;
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;
@@ -112,12 +103,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 +260,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 )
@@ -345,14 +336,61 @@ 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.
*/
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,8 +416,9 @@ class LogStreamDB extends LogStream {
// Increment for the Footer Stats
$querycount++;
}
+*/
- // finally return result!
+ // Return result!
return $this->_lastPageUID;
}
@@ -561,8 +600,6 @@ class LogStreamDB extends LogStream {
//echo $this->_SQLwhereClause;
//$dbmapping[$szTableType][SYSLOG_UID]
-
- //$this->_SQLwhereClause;
}
else // No filters means nothing to do!
return SUCCESS;
@@ -602,6 +639,15 @@ class LogStreamDB extends LogStream {
// Free Query ressources
mysql_free_result ($myquery);
+ // 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++;
@@ -641,6 +687,15 @@ class LogStreamDB extends LogStream {
// Free Query ressources
mysql_free_result ($myquery);
+ // 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++;
@@ -659,8 +714,13 @@ class LogStreamDB extends LogStream {
$szTableType = $this->_logStreamConfigObj->DBTableType;
$szSortColumn = $this->_logStreamConfigObj->SortColumn;
- // Create SQL String
- $sqlString = "SELECT " . $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
@@ -758,9 +818,24 @@ class LogStreamDB extends LogStream {
*/
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;
+
+ // 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 +852,7 @@ class LogStreamDB extends LogStream {
}
else
$numRows = -1;
-
- // return result!
- return $numRows;
+ */
}
diff --git a/src/classes/logstreamdisk.class.php b/src/classes/logstreamdisk.class.php
index 6984949..7f4ee03 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!
@@ -477,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!
@@ -487,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!
@@ -499,17 +507,17 @@ 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);
- 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;
+
+ // --- 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/logstreamlineparsersyslog.class.php b/src/classes/logstreamlineparsersyslog.class.php
index 718a35b..c5a90be 100644
--- a/src/classes/logstreamlineparsersyslog.class.php
+++ b/src/classes/logstreamlineparsersyslog.class.php
@@ -64,31 +64,40 @@ 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]);
- $arrArguments[SYSLOG_HOST] = $out[2];
- $arrArguments[SYSLOG_SYSLOGTAG] = $out[3];
- $arrArguments[SYSLOG_PROCESSID] = $out[4];
+ $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}) ([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 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 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]);
- $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/classes/logstreampdo.class.php b/src/classes/logstreampdo.class.php
new file mode 100644
index 0000000..ef8eeb4
--- /dev/null
+++ b/src/classes/logstreampdo.class.php
@@ -0,0 +1,860 @@
+ 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 $_firstPageUID = -1;
+ private $_currentPageNumber = -1;
+
+ private $_SQLwhereClause = "";
+ private $_myDBQuery = null;
+
+ // 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();
+
+ // 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;
+
+ // reached this point means success!
+ return SUCCESS;
+ }
+
+ /**
+ * Close the database connection.
+ *
+ * @return integer Error state
+ */
+ public function Close()
+ {
+ // trigger closing database query!
+ $this->DestroyMainSQLQuery();
+
+// TODO CLOSE DB CONN?!
+
+ return true;
+ }
+
+ /**
+ * 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 "1mowl " . $this->_currentRecordStart . "=" . $this->_currentRecordNum;
+
+ 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 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.
+ */
+ 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;
+ }
+
+ /*
+ * 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 . "
Errorcode: " . $this->_dbhandle->errorCode() );
+ 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)
+ {
+ // Create query if necessary
+ if ( $this->_myDBQuery == null )
+ {
+ // 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)
+ {
+ //Obtain next record
+ $myRow = $this->_myDBQuery->fetch(PDO::FETCH_ASSOC);
+
+ // Check if result was successfull!
+ if ( $myRow === FALSE || !$myRow )
+ break;
+
+ $this->bufferedRecords[$iBegin] = $myRow;
+ $iBegin++;
+
+ // Increment counter
+ $iCount++;
+ }
+
+ // 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
+ {
+ $this->PrintDebugError("RowCount query failed: " . $szSql);
+ $numRows = -1;
+ }
+
+ // return result!
+ return $numRows;
+ }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/src/css/defaults.css b/src/css/defaults.css
index 788a426..4907eb8 100644
--- a/src/css/defaults.css
+++ b/src/css/defaults.css
@@ -1,56 +1,83 @@
-/* Generic Style definitions */
-.ExpansionPlus
-{
- background-image: url("../images/icons/navigate_plus.png");
- background-repeat: no-repeat;
- background-position: left center;
- padding-left: 20px;
-}
-
-.ExpansionMinus
-{
- background-image: url("../images/icons/navigate_minus.png");
- background-repeat: no-repeat;
- background-position: left center;
- padding-left: 20px;
-}
-
-.HiddenContent
-{
- visibility: hidden;
-/* position: relative; */
- display: none;
-}
-
-.SelectSavedFilter
-{
- margin-top: 3px;
- border: 1px solid;
- border-color: #233B51 #124A7C #124A7C #233B51;
-}
-
-.syslogdetails, a.syslogdetails, a.syslogdetails:link, a.syslogdetails:active, a.syslogdetails:visited
-{
- font-weight:normal;
- text-decoration:none;
-}
-.syslogdetails
-{
- position:relative; /*this is the key*/
- z-index:4;
-}
-
-.syslogdetails:hover
-{
- font-weight:normal;
- z-index:5;
-}
-.syslogdetails span {display: none}
-/*the span will display just on :hover state*/
-.syslogdetails:hover span
-{
- display:block;
- position:absolute;
- top:15px;
- left:15px;
-}
+/* Generic Style definitions */
+.ExpansionPlus
+{
+ background-image: url("../images/icons/navigate_plus.png");
+ background-repeat: no-repeat;
+ background-position: left center;
+ padding-left: 20px;
+}
+
+.ExpansionMinus
+{
+ background-image: url("../images/icons/navigate_minus.png");
+ background-repeat: no-repeat;
+ background-position: left center;
+ padding-left: 20px;
+}
+
+.HiddenContent
+{
+ visibility: hidden;
+/* position: relative; */
+ display: none;
+}
+
+.SelectSavedFilter
+{
+ margin-top: 2px;
+ border: 1px solid;
+ border-color: #233B51 #124A7C #124A7C #233B51;
+}
+
+.syslogdetails, a.syslogdetails, a.syslogdetails:link, a.syslogdetails:active, a.syslogdetails:visited
+{
+ font-weight:normal;
+ text-decoration:none;
+ position:relative;
+ overflow:visible;
+}
+.syslogdetails
+{
+ position:relative;
+ overflow:visible;
+ z-index:4;
+}
+
+.syslogdetails:hover
+{
+ position:relative; /*this is the key*/
+ font-weight:normal;
+ z-index:5;
+}
+.syslogdetails span
+{
+ position:relative;
+ overflow:visible;
+ display: none;
+ z-index:-1;
+
+}
+/*the span will display just on :hover state*/
+/*
+.syslogdetails:hover span
+{
+ display:block;
+ position:absolute;
+ top:15px;
+ left:15px;
+}
+*/
+.syslogdetails_popup span
+{
+ display:block;
+ position:absolute;
+ overflow:auto;
+ z-index:5;
+/* top:15px; */
+/* left:15px; */
+}
+
+.gridline
+{
+ height: 16px;
+}
diff --git a/src/css/menu.css b/src/css/menu.css
index 6b5c658..a9156b3 100644
--- a/src/css/menu.css
+++ b/src/css/menu.css
@@ -1,8 +1,10 @@
+
#menu {
width: 16px; /* set width of menu */
}
#menu ul { /* remove bullets and list indents */
+ position: absolute;
list-style: none;
margin: 0;
padding: 0;
@@ -11,44 +13,54 @@
/* style, color and size links and headings to suit */
#menu a, #menu h2 {
display: block;
- border-width: 1px;
- border-style: solid;
- margin: 0;
- padding: 2px 3px;
+ margin: 2px;
+ padding: 1px 1px;
}
#menu h2 {
- font: bold 11px/16px;
+ font-size: 12px;
+ font-weight: 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 {
- z-index:10;
/* make the list elements a containing block for the nested lists */
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: 16px;
- left: 0px; /* to position them to the right of their containing block */
- width: 300; /* width is based on the containing block */
+ top: 12px;
+ left: 4px; /* to position them to the right of their containing block */
+ width: 350; /* 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;
+}
diff --git a/src/details.php b/src/details.php
index b373b0e..4e3a4b4 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 )
{
@@ -251,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
@@ -265,7 +266,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;
@@ -279,10 +280,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'])
@@ -351,10 +361,27 @@ 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");
$page -> output();
// ---
+
?>
\ 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 0000000..143f23c
Binary files /dev/null and b/src/images/icons/bullet_ball_glass_blue.png differ
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 0000000..9e8a4b4
Binary files /dev/null and b/src/images/icons/bullet_ball_glass_green.png differ
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 0000000..5ae8681
Binary files /dev/null and b/src/images/icons/bullet_ball_glass_grey.png differ
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 0000000..9c6e7a1
Binary files /dev/null and b/src/images/icons/bullet_ball_glass_red.png differ
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 0000000..ae0ef19
Binary files /dev/null and b/src/images/icons/bullet_ball_glass_yellow.png differ
diff --git a/src/images/icons/earth_network.png b/src/images/icons/earth_network.png
new file mode 100644
index 0000000..24484ae
Binary files /dev/null and b/src/images/icons/earth_network.png differ
diff --git a/src/include/config.sample.php b/src/include/config.sample.php
index bf0cbfa..1c6e6d7 100644
--- a/src/include/config.sample.php
+++ b/src/include/config.sample.php
@@ -51,9 +51,12 @@ $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
+$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
@@ -61,20 +64,19 @@ $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
+
+$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
//$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 );
+$CFG['DefaultViewsID'] = "";
// ---
// --- Predefined Searches!
@@ -90,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/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_filters.php b/src/include/constants_filters.php
index e5a97bb..c2348a1 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_NT_EventReport, "DisplayName" => "WinEventLog", "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/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 d91ecf9..f5023bd 100644
--- a/src/include/constants_logstream.php
+++ b/src/include/constants_logstream.php
@@ -70,6 +70,13 @@ 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);
+define('DB_SQLITE', 8);
+
// --- Predefine fields array!
$fields[SYSLOG_UID]['FieldID'] = SYSLOG_UID;
@@ -89,7 +96,7 @@ $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;
@@ -115,7 +122,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;
@@ -124,6 +131,36 @@ $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;
@@ -157,6 +194,15 @@ $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";
+
+// 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
@@ -164,4 +210,4 @@ define('EVTIME_TIMESTAMP', '0');
define('EVTIME_TIMEZONE', '1');
define('EVTIME_MICROSECONDS', '2');
-?>
+?>
\ No newline at end of file
diff --git a/src/include/functions_common.php b/src/include/functions_common.php
index d2ed94c..1a30af2 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');
@@ -73,8 +62,8 @@ $LANG_EN = "en"; // Used for fallback
$LANG = "en"; // Default language
// Default Template vars
-$content['BUILDNUMBER'] = "2.2.0";
-$content['TITLE'] = "PhpLogCon - Release " . $content['BUILDNUMBER']; // Title of the Page
+$content['BUILDNUMBER'] = "2.4.0";
+$content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title
$content['BASEPATH'] = $gl_root_path;
$content['EXTRA_METATAGS'] = "";
$content['EXTRA_JAVASCRIPT'] = "";
@@ -96,14 +85,14 @@ function InitBasicPhpLogCon()
// Check RunMode first!
CheckAndSetRunMode();
- // Get and Set RunTime Informations
- InitRuntimeInformations();
-
// Set the default line sep
SetLineBreakVar();
// Start the PHP Session
StartPHPSession();
+
+ // Init View Configs prior loading config.php!
+ InitViewConfigs();
}
function InitPhpLogConConfigFile($bHandleMissing = true)
@@ -119,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 )
@@ -185,6 +175,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();
@@ -201,6 +194,12 @@ function InitPhpLogCon()
// Init Predefined Searches List
CreatePredefinedSearches();
+ // Init predefined paging sizes
+ CreatePagesizesList();
+
+ // Init predefined reload times
+ CreateReloadTimesList();
+
// --- Enable PHP Debug Mode
InitPhpDebugMode();
// ---
@@ -230,10 +229,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 )
@@ -242,20 +246,105 @@ 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()
+{
+ 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"];
}
@@ -301,17 +390,30 @@ 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()
{
- 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()
@@ -334,17 +436,22 @@ 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_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";
@@ -354,11 +461,18 @@ 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";
+
+ $content['MENU_ICON_GOOGLE'] = $content['BASEPATH'] . "images/icons/googleicon.png";
}
// Lang Helper for Strings with ONE variable
@@ -430,6 +544,22 @@ function InitConfigurationValues()
}
}
+ // 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']) )
@@ -535,6 +665,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 = "";
+
+ 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
@@ -649,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!
@@ -692,6 +850,123 @@ function GetMonthFromString($szMonth)
}
}
+/*
+* 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',
+/* (?: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 )
+ {
+ // Split IP into array
+ $IPArray = explode(".", $szIP);
+
+ if (
+ (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 . '';
+ 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()
@@ -820,4 +1095,4 @@ function RedirectToDatabaseUpgrade()
// --- END Usermanagement Function ---
-?>
+?>
\ No newline at end of file
diff --git a/src/include/functions_config.php b/src/include/functions_config.php
index cab5b6b..4ff98ee 100644
--- a/src/include/functions_config.php
+++ b/src/include/functions_config.php
@@ -64,6 +64,23 @@
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'] = "";
@@ -85,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!
@@ -98,6 +120,25 @@
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 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
{
@@ -131,13 +172,88 @@
$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;
}
}
// 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/include/functions_filters.php b/src/include/functions_filters.php
index a113001..66ad2e6 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";
+ }
+ // ---
}
@@ -254,4 +267,4 @@ function GetTimeStampFromTimeString($szTimeString)
}
}
-?>
+?>
\ No newline at end of file
diff --git a/src/include/functions_frontendhelpers.php b/src/include/functions_frontendhelpers.php
index 2ee8a2d..c34716c 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,18 +105,21 @@ 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.
- 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!
{
// 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 )
{
@@ -110,11 +136,16 @@ 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];
}
- $counter++;
+ $hvCounter++;
}
}
}
diff --git a/src/index.php b/src/index.php
index db99479..daaf5dc 100644
--- a/src/index.php
+++ b/src/index.php
@@ -63,6 +63,30 @@ if ( isset($_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;
+
+// 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;
+// ---
+
+
// Init Pager variables
// $content['uid_previous'] = UID_UNKNOWN;
$content['uid_next'] = UID_UNKNOWN;
@@ -74,24 +98,12 @@ $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'] = "";
$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)
{
@@ -106,6 +118,10 @@ function HighLightString($highlightArray, $strmsg)
return $strmsg;
}
+function PrepareStringForSearch($myString)
+{
+ return str_replace(" ", "+", $myString);
+}
// ---
// --- Read and process filters from search dialog!
@@ -171,6 +187,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 )
{
@@ -180,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)
@@ -191,6 +220,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'] = '';
}
}
// ---
@@ -199,13 +233,16 @@ 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;
-
+
// If uID is known, we need to init READ first - this will also seek for available records first!
if ($uID != UID_UNKNOWN)
{
@@ -214,15 +251,28 @@ 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 )
- {
- // 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);
+ // --- Check if Read was successfull!
+ if ( $ret == SUCCESS )
+ {
+ // 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;
+
+ if ( $content['skipone'] )
+ {
+ // 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.";
}
// ---
@@ -265,10 +315,14 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c
if ( isset($fields[$mycolkey]) && 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'] = "";
+ $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'] = "#";
@@ -298,6 +352,19 @@ 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' . $content['additional_url_sourceonly'],
+ '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/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']
+ );
}
else if ( $mycolkey == SYSLOG_SEVERITY )
{
@@ -314,6 +381,19 @@ 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_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/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']
+ );
}
else if ( $mycolkey == SYSLOG_MESSAGETYPE )
{
@@ -330,7 +410,30 @@ 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' . $content['additional_url_sourceonly'],
+ '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' . $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://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']
+ );
}
}
else if ( $content['fields'][$mycolkey]['FieldType'] == FILTER_TYPE_STRING )
@@ -341,13 +444,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
@@ -359,11 +465,16 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c
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]);
$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!
@@ -386,11 +497,83 @@ 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'];
}
}
+
+ if ( strlen($content['searchstr']) > 0 )
+ {
+ // 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 )
+ {
+ // 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' . $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://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']
+ );
+ }
+ 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' . $content['additional_url_sourceonly'],
+ 'DisplayName' => $content['LN_VIEW_FILTERFOR'] . "'" . $logArray[$mycolkey] . "'",
+ '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' . $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://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']
+ );
+ }
+ 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' . $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://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']
+ );
}
}
}
@@ -399,15 +582,18 @@ 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;
+ // temporary store the current last $uID
+ $lastUid = $uID;
+
// --- Handle uid_next page button
if ( $content['read_direction'] == EnumReadDirection::Backward )
{
@@ -419,16 +605,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 )
{
@@ -455,20 +633,37 @@ 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'] = $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;
// ---
@@ -484,7 +679,6 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c
// print_r( $content['syslogmessages'] );
}
-
// This will enable to Main SyslogView
$content['syslogmessagesenabled'] = "true";
}
@@ -499,8 +693,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 unhandled error occured.";
-
+ $content['detailederror'] = "Unknown or unhandled error occured (Error Code " . $res . ") ";
}
// Close file!
diff --git a/src/install.php b/src/install.php
index 7efdb38..e683e03 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!
@@ -347,7 +364,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 )
@@ -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'] = ""; }
@@ -478,6 +506,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']) )
@@ -499,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)
{
@@ -516,7 +561,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']);
@@ -552,7 +597,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!
}
@@ -563,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
@@ -576,24 +630,48 @@ else if ( $content['INSTALL_STEP'] == 8 )
}
//Add the first source!
- $firstsource = "\$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" .
+ "\$CFG['Sources']['Source1']['ViewID'] = '" . $_SESSION['SourceViewID'] . "';\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" .
+ // 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" .
+ "\$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\%/";
@@ -686,4 +764,4 @@ function ImportDataFile($szFileName)
}
// ---
-?>
+?>
\ No newline at end of file
diff --git a/src/js/common.js b/src/js/common.js
index 83e3736..e0dfdf6 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
*/
@@ -133,4 +157,142 @@ function toggleFormareaVisibility(FormFieldName, FirstHiddenArea, SecondHiddenAr
hidevisibility(FirstHiddenArea);
togglevisibility(SecondHiddenArea);
}
-}
\ No newline at end of file
+}
+
+// helper array to keep track of the timeouts!
+var runningTimeouts = new Array();
+var defaultMenuTimeout = 1500;
+/*
+* Toggle display type from NONE to BLOCK
+*/
+function ToggleDisplayTypeById(ObjID)
+{
+ var obj = document.getElementById(ObjID);
+ if (obj != null)
+ {
+ if (obj.style.display == '' || obj.style.display == 'none')
+ {
+ obj.style.display='block';
+
+ // Set Timeout to make sure the menu disappears
+ ToggleDisplaySetTimeout(ObjID);
+ }
+ else
+ {
+ obj.style.display='none';
+
+ // Abort Timeout if set!
+ ToggleDisplayClearTimeout(ObjID);
+ }
+ }
+}
+
+function ToggleDisplaySetTimeout(ObjID)
+{
+ // Set Timeout
+ var szTimeOut = "ToggleDisplayOffTypeById('" + ObjID + "')";
+ runningTimeouts[ObjID] = window.setTimeout(szTimeOut, defaultMenuTimeout);
+}
+
+function ToggleDisplayClearTimeout(ObjID)
+{
+ // Abort Timeout if set!
+ if ( runningTimeouts[ObjID] != null )
+ {
+ window.clearTimeout(runningTimeouts[ObjID]);
+ }
+}
+
+function ToggleDisplayEnhanceTimeOut(ObjID)
+{
+ // First clear timeout
+ ToggleDisplayClearTimeout(ObjID);
+
+ // Set new timeout
+ ToggleDisplaySetTimeout(ObjID);
+}
+
+/*
+* Make Style sheet display OFF in any case
+*/
+function ToggleDisplayOffTypeById(ObjID)
+{
+ var obj = document.getElementById(ObjID);
+ if (obj != null)
+ {
+ obj.style.display='none';
+ }
+}
+
+/*
+* Debug Helper function to read possible properties of an object
+*/
+function DebugShowElementsById(ObjName)
+{
+ var obj = document.getElementById(ObjName);
+ for (var key in obj) {
+ 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/lang/de/main.php b/src/lang/de/main.php
index 2a35dba..afded35 100644
--- a/src/lang/de/main.php
+++ b/src/lang/de/main.php
@@ -43,6 +43,19 @@ $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";
+ $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";
// Index Site
$content['LN_ERROR_INSTALLFILEREMINDER'] = "Warnung! Du hast das Installationsscript 'install.php' noch nicht aus dem phpLogCon Hauptordner entfernt!";
@@ -56,11 +69,23 @@ $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_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 <<";
$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
@@ -84,6 +109,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";
@@ -95,6 +121,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";
@@ -114,9 +145,11 @@ $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";
$content['LN_DETAILS_DETAILSFORMSG'] = "Details für Nachrichten-ID";
+$content['LN_DETAIL_BACKTOLIST'] = "Back to Listview";
-?>
+?>
\ No newline at end of file
diff --git a/src/lang/en/main.php b/src/lang/en/main.php
index eeca194..8c67bb0 100644
--- a/src/lang/en/main.php
+++ b/src/lang/en/main.php
@@ -42,7 +42,22 @@ $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";
+ $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!";
@@ -56,11 +71,23 @@ $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'] = "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_VIEW_SEARCHFORGOOGLE'] = "Search Google for ";
+ $content['LN_GEN_MESSAGEDETAILS'] = "Message Details";
$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
@@ -84,6 +111,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";
@@ -95,6 +123,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'] = "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'] = "Database Host";
@@ -114,9 +147,12 @@ $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";
+ $content['LN_CFG_VIEW'] = "Select View";
// 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/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_BR/main.php b/src/lang/pt_BR/main.php
new file mode 100644
index 0000000..1039ab7
--- /dev/null
+++ b/src/lang/pt_BR/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'] = "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";
+$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'] = "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'] = "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'] = "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!";
+$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'] = "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'] = "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.";
+
+// 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'] = "PID";
+$content['LN_FIELDS_MESSAGETYPE'] = "Tipo";
+$content['LN_FIELDS_UID'] = "uID";
+$content['LN_FIELDS_MESSAGE'] = "Mensagem";
+$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";
+$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'] = "Selecione visão";
+
+// 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/search.php b/src/search.php
index 7ce45ae..d99bb7c 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
@@ -117,7 +110,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 +122,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 +134,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 )
{
@@ -163,17 +169,29 @@ 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);
}
-
// ---
+// --- 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");
$page -> output();
// ---
-?>
+?>
\ No newline at end of file
diff --git a/src/templates/details.html b/src/templates/details.html
index d0e1f3d..04bbf0b 100644
--- a/src/templates/details.html
+++ b/src/templates/details.html
@@ -1,103 +1,104 @@
-
-
-
-
- {LN_DETAILS_FORSYSLOGMSG} '{uid_current}' |
-
-
-
-
-
-
- {LN_GEN_PAGE} {main_currentpagenumber}
-
- |
-
-
-
- {main_recordcount} |
-
-
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
- {mypagenumber} |
-
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {fieldvalue}
- |
-
-
-
-
-
-
-
-
-
- {LN_ERROR_NORECORDS} (code {error_code} ) - Error Details:
- {detailederror}
-
-
-
-
-
-
- |
-
-
-
-
-
+
+
+
+
+ {LN_DETAILS_FORSYSLOGMSG} '{uid_current}' |
+
+
+
+
+
+ {LN_DETAIL_BACKTOLIST}
+
+ {LN_GEN_PAGE} {main_currentpagenumber}
+
+ |
+
+
+
+ {main_recordcount} |
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+ {mypagenumber} |
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {fieldvalue}
+ |
+
+
+
+
+
+
+
+
+
+ {LN_ERROR_NORECORDS} (code {error_code} ) - Error Details:
+ {detailederror}
+
+
+
+
+
+
+ |
+
+
+
+
+
\ No newline at end of file
diff --git a/src/templates/include_footer.html b/src/templates/include_footer.html
index 77bde2d..2d21a4f 100644
--- a/src/templates/include_footer.html
+++ b/src/templates/include_footer.html
@@ -1,36 +1,37 @@
-
-
-
-
- Created 2008 - By Adiscon GmbH |
-
- phpLogCon Version {BUILDNUMBER}
- |
-
- Partners:
- |
-
- rsyslog |
- WinSyslog
- |
-
-
- Page rendered in {PAGERENDERTIME} seconds
- | Total DB Queries {TOTALQUERIES}
- |
-
-
-
-
-
-
-
-
-
-
-  |
-
-
-
-