diff --git a/src/include/config.sample.php b/src/include/config.sample.php
index 34c32ae..72f0c50 100644
--- a/src/include/config.sample.php
+++ b/src/include/config.sample.php
@@ -1,118 +1,118 @@
- Configuration need variables for the Database connection
- *
- * 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;
-}
-// ---
-
-// --- Database options
-$CFG['UserDBEnabled'] = false;
-$CFG['UserDBServer'] = "";
-$CFG['UserDBPort'] = 3306;
-$CFG['UserDBName'] = "";
-$CFG['UserDBPref'] = "";
-$CFG['UserDBUser'] = "";
-$CFG['UserDBPass'] = "";
-// ---
-
-// --- Misc Options
-$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
-$CFG['ViewEnableDetailPopups'] = 1; // If enabled, you will see additional Details for each syslog message on mouse over.
-$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
-// ---
-
-// --- 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;
-// ---
-
-// --- Predefined Searches!
-$CFG['Search'][] = array ( "DisplayName" => "Syslog Warnings and Errors", "SearchQuery" => "filter=severity%3A0%2C1%2C2%2C3%2C4&search=Search" );
-$CFG['Search'][] = array ( "DisplayName" => "Syslog Errors", "SearchQuery" => "filter=severity%3A0%2C1%2C2%2C3&search=Search" );
-$CFG['Search'][] = array ( "DisplayName" => "All messages from the last hour", "SearchQuery" => "filter=datelastx%3A1&search=Search" );
-$CFG['Search'][] = array ( "DisplayName" => "All messages from last 12 hours", "SearchQuery" => "filter=datelastx%3A2&search=Search" );
-$CFG['Search'][] = array ( "DisplayName" => "All messages from last 24 hours", "SearchQuery" => "filter=datelastx%3A3&search=Search" );
-$CFG['Search'][] = array ( "DisplayName" => "All messages from last 7 days", "SearchQuery" => "filter=datelastx%3A4&search=Search" );
-$CFG['Search'][] = array ( "DisplayName" => "All messages from last 31 days", "SearchQuery" => "filter=datelastx%3A5&search=Search" );
-// $CFG['Search'][] = array ( "DisplayName" => "", "SearchQuery" => "" );
-// ---
-
-// --- 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'][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";
-*/
-
-// --- %Insert Source Here%
-// ---
-
+ Configuration need variables for the Database connection
+ *
+ * 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;
+}
+// ---
+
+// --- Database options
+$CFG['UserDBEnabled'] = false;
+$CFG['UserDBServer'] = "";
+$CFG['UserDBPort'] = 3306;
+$CFG['UserDBName'] = "";
+$CFG['UserDBPref'] = "";
+$CFG['UserDBUser'] = "";
+$CFG['UserDBPass'] = "";
+// ---
+
+// --- Misc Options
+$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
+$CFG['ViewEnableDetailPopups'] = 1; // If enabled, you will see additional Details for each syslog message on mouse over.
+$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
+// ---
+
+// --- 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;
+// ---
+
+// --- Predefined Searches!
+$CFG['Search'][] = array ( "DisplayName" => "Syslog Warnings and Errors", "SearchQuery" => "filter=severity%3A0%2C1%2C2%2C3%2C4&search=Search" );
+$CFG['Search'][] = array ( "DisplayName" => "Syslog Errors", "SearchQuery" => "filter=severity%3A0%2C1%2C2%2C3&search=Search" );
+$CFG['Search'][] = array ( "DisplayName" => "All messages from the last hour", "SearchQuery" => "filter=datelastx%3A1&search=Search" );
+$CFG['Search'][] = array ( "DisplayName" => "All messages from last 12 hours", "SearchQuery" => "filter=datelastx%3A2&search=Search" );
+$CFG['Search'][] = array ( "DisplayName" => "All messages from last 24 hours", "SearchQuery" => "filter=datelastx%3A3&search=Search" );
+$CFG['Search'][] = array ( "DisplayName" => "All messages from last 7 days", "SearchQuery" => "filter=datelastx%3A4&search=Search" );
+$CFG['Search'][] = array ( "DisplayName" => "All messages from last 31 days", "SearchQuery" => "filter=datelastx%3A5&search=Search" );
+// $CFG['Search'][] = array ( "DisplayName" => "", "SearchQuery" => "" );
+// ---
+
+// --- 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'][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";
+*/
+
+// --- %Insert Source Here%
+// ---
+
?>
\ No newline at end of file
diff --git a/src/include/constants_errors.php b/src/include/constants_errors.php
index 0bbb22b..7f63664 100644
--- a/src/include/constants_errors.php
+++ b/src/include/constants_errors.php
@@ -1,61 +1,61 @@
- www.phplogcon.org <- *
- * ----------------------------------------------------------------- *
- * Some constants *
- * *
- * -> Stuff which has to be static and predefined *
- * *
- * All directives are explained within this file *
- *
- * Copyright (C) 2008 Adiscon GmbH.
- *
- * This file is part of phpLogCon.
- *
- * PhpLogCon is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PhpLogCon is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpLogCon. If not, see .
- *
- * A copy of the GPL can be found in the file "COPYING" in this
- * distribution.
- *********************************************************************
-*/
-
-// --- Avoid directly accessing this file!
-if ( !defined('IN_PHPLOGCON') )
-{
- die('Hacking attempt');
- exit;
-}
-// ---
-
-define('SUCCESS', 0);
-define('ERROR', 1); // This is a simple helper constant! which we can use to check if there even was an error! Any result code above 0 is an error!
-define('ERROR_FILE_NOT_FOUND', 2);
-define('ERROR_FILE_CANT_CLOSE', 3);
-define('ERROR_FILE_EOF', 4);
-define('ERROR_FILE_BOF', 5);
-define('ERROR_UNDEFINED', 6);
-define('ERROR_EOS', 7);
-define('ERROR_NOMORERECORDS', 8);
-define('ERROR_FILTER_NOT_MATCH', 9);
-
-define('ERROR_DB_CONNECTFAILED', 10);
-define('ERROR_DB_CANNOTSELECTDB', 11);
-define('ERROR_DB_QUERYFAILED', 12);
-define('ERROR_DB_NOPROPERTIES', 13);
-define('ERROR_DB_INVALIDDBMAPPING', 14);
-
-define('ERROR_FILE_NOT_READABLE', 15);
-
-?>
+ www.phplogcon.org <- *
+ * ----------------------------------------------------------------- *
+ * Some constants *
+ * *
+ * -> Stuff which has to be static and predefined *
+ * *
+ * All directives are explained within this file *
+ *
+ * Copyright (C) 2008 Adiscon GmbH.
+ *
+ * This file is part of phpLogCon.
+ *
+ * PhpLogCon is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * PhpLogCon is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpLogCon. If not, see .
+ *
+ * A copy of the GPL can be found in the file "COPYING" in this
+ * distribution.
+ *********************************************************************
+*/
+
+// --- Avoid directly accessing this file!
+if ( !defined('IN_PHPLOGCON') )
+{
+ die('Hacking attempt');
+ exit;
+}
+// ---
+
+define('SUCCESS', 0);
+define('ERROR', 1); // This is a simple helper constant! which we can use to check if there even was an error! Any result code above 0 is an error!
+define('ERROR_FILE_NOT_FOUND', 2);
+define('ERROR_FILE_CANT_CLOSE', 3);
+define('ERROR_FILE_EOF', 4);
+define('ERROR_FILE_BOF', 5);
+define('ERROR_UNDEFINED', 6);
+define('ERROR_EOS', 7);
+define('ERROR_NOMORERECORDS', 8);
+define('ERROR_FILTER_NOT_MATCH', 9);
+
+define('ERROR_DB_CONNECTFAILED', 10);
+define('ERROR_DB_CANNOTSELECTDB', 11);
+define('ERROR_DB_QUERYFAILED', 12);
+define('ERROR_DB_NOPROPERTIES', 13);
+define('ERROR_DB_INVALIDDBMAPPING', 14);
+
+define('ERROR_FILE_NOT_READABLE', 15);
+
+?>
diff --git a/src/include/constants_general.php b/src/include/constants_general.php
index 3bca4b8..eb545f2 100644
--- a/src/include/constants_general.php
+++ b/src/include/constants_general.php
@@ -1,184 +1,184 @@
- www.phplogcon.org <- *
- * ----------------------------------------------------------------- *
- * Some constants *
- * *
- * -> Stuff which has to be static and predefined *
- * *
- * All directives are explained within this file *
- *
- * Copyright (C) 2008 Adiscon GmbH.
- *
- * This file is part of phpLogCon.
- *
- * PhpLogCon is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PhpLogCon is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpLogCon. If not, see .
- *
- * A copy of the GPL can be found in the file "COPYING" in this
- * distribution.
- *********************************************************************
-*/
-
-// --- Avoid directly accessing this file!
-if ( !defined('IN_PHPLOGCON') )
-{
- die('Hacking attempt');
- exit;
-}
-// ---
-
-// --- Some custom defines
-define('RUNMODE_COMMANDLINE', 1);
-define('RUNMODE_WEBSERVER', 2);
-
-define('DEBUG_ULTRADEBUG', 5);
-define('DEBUG_DEBUG', 4);
-define('DEBUG_INFO', 3);
-define('DEBUG_WARN', 2);
-define('DEBUG_ERROR', 1);
-define('DEBUG_ERROR_WTF', 0);
-
-define('STR_DEBUG_ULTRADEBUG', "UltraDebug");
-define('STR_DEBUG_DEBUG', "Debug");
-define('STR_DEBUG_INFO', "Information");
-define('STR_DEBUG_WARN', "Warning");
-define('STR_DEBUG_ERROR', "Error");
-define('STR_DEBUG_ERROR_WTF', "WTF OMFG");
-
-// --- Source Type defines
-define('SOURCE_DISK', '1');
-define('SOURCE_DB', '2');
-// ---
-
-// ---
-define('UID_UNKNOWN', -1);
-// ---
-
-// --- Syslog specific defines!
-define('SYSLOG_KERN', 0);
-define('SYSLOG_USER', 1);
-define('SYSLOG_MAIL', 2);
-define('SYSLOG_DAEMON', 3);
-define('SYSLOG_AUTH', 4);
-define('SYSLOG_SYSLOG', 5);
-define('SYSLOG_LPR', 6);
-define('SYSLOG_NEWS', 7);
-define('SYSLOG_UUCP', 8);
-define('SYSLOG_CRON', 9);
-define('SYSLOG_SECURITY', 10);
-define('SYSLOG_FTP', 11);
-define('SYSLOG_NTP', 12);
-define('SYSLOG_LOGAUDIT', 13);
-define('SYSLOG_LOGALERT', 14);
-define('SYSLOG_CLOCK', 15);
-define('SYSLOG_LOCAL0', 16);
-define('SYSLOG_LOCAL1', 17);
-define('SYSLOG_LOCAL2', 18);
-define('SYSLOG_LOCAL3', 19);
-define('SYSLOG_LOCAL4', 20);
-define('SYSLOG_LOCAL5', 21);
-define('SYSLOG_LOCAL6', 22);
-define('SYSLOG_LOCAL7', 23);
-$facility_colors[SYSLOG_KERN] = "#F1BEA7";
-$facility_colors[SYSLOG_USER] = "#F1D0A7";
-$facility_colors[SYSLOG_MAIL] = "#F1E3A7";
-$facility_colors[SYSLOG_DAEMON] = "#E5F1A7";
-$facility_colors[SYSLOG_AUTH] = "#D3F1A7";
-$facility_colors[SYSLOG_SYSLOG] = "#C1F1A7";
-$facility_colors[SYSLOG_LPR] = "#A7F1D6";
-$facility_colors[SYSLOG_NEWS] = "#A7F1E8";
-$facility_colors[SYSLOG_UUCP] = "#A7E1F1";
-$facility_colors[SYSLOG_CRON] = "#A7C8F1";
-$facility_colors[SYSLOG_SECURITY] = "#F2ECD8";
-$facility_colors[SYSLOG_FTP] = "#ECE3C4";
-$facility_colors[SYSLOG_NTP] = "#E7DAB1";
-$facility_colors[SYSLOG_LOGAUDIT] = "#F2D8E2";
-$facility_colors[SYSLOG_LOGALERT] = "#ECC4D3";
-$facility_colors[SYSLOG_CLOCK] = "#E7B1C5";
-$facility_colors[SYSLOG_LOCAL0] = "#F2F2F2";
-$facility_colors[SYSLOG_LOCAL1] = "#E4E5E6";
-$facility_colors[SYSLOG_LOCAL2] = "#D6D9DA";
-$facility_colors[SYSLOG_LOCAL3] = "#C9CDCF";
-$facility_colors[SYSLOG_LOCAL4] = "#BEC2C4";
-$facility_colors[SYSLOG_LOCAL5] = "#B1B6B9";
-$facility_colors[SYSLOG_LOCAL6] = "#A3AAAD";
-$facility_colors[SYSLOG_LOCAL7] = "#969DA1";
-
-define('SYSLOG_EMERG', 0);
-define('SYSLOG_ALERT', 1);
-define('SYSLOG_CRIT', 2);
-define('SYSLOG_ERR', 3);
-define('SYSLOG_WARNING', 4);
-define('SYSLOG_NOTICE', 5);
-define('SYSLOG_INFO', 6);
-define('SYSLOG_DEBUG', 7);
-$severity_colors[SYSLOG_EMERG] = "#840A15";
-$severity_colors[SYSLOG_ALERT] = "#BA0716";
-$severity_colors[SYSLOG_CRIT] = "#CE0819";
-$severity_colors[SYSLOG_ERR] = "#FF0A1F";
-$severity_colors[SYSLOG_WARNING] = "#EF8200";
-$severity_colors[SYSLOG_NOTICE] = "#14AD42";
-$severity_colors[SYSLOG_INFO] = "#0C9C91";
-$severity_colors[SYSLOG_DEBUG] = "#119BDE";
-// ---
-
-// --- MonitorWare InfoUnit Defines | Messagetypes
-define('IUT_Unknown', '0');
-define('IUT_Syslog', '1');
-define('IUT_Heartbeat', '2');
-define('IUT_NT_EventReport', '3');
-define('IUT_SNMP_Trap', '4');
-define('IUT_File_Monitor', '5');
-define('IUT_PingProbe', '8');
-define('IUT_Port_Probe', '9');
-define('IUT_NTService_Monitor', '10');
-define('IUT_DiskSpace_Monitor', '11');
-define('IUT_DB_Monitor', '12');
-define('IUT_Serial_Monitor', '13');
-define('IUT_CPU_Monitor', '14');
-define('IUT_AliveMonRequest', '16');
-define('IUT_SMTPProbe', '17');
-define('IUT_FTPProbe', '18');
-define('IUT_HTTPProbe', '19');
-define('IUT_POP3Probe', '20');
-define('IUT_IMAPProbe', '21');
-define('IUT_NNTPProbe', '22');
-define('IUT_WEVTMONV2', '23');
-define('IUT_SMTPLISTENER', '24');
-$msgtype_colors[IUT_Unknown] = "#D0FBDC";
-$msgtype_colors[IUT_Syslog] = "#D0FBF1";
-$msgtype_colors[IUT_Heartbeat] = "#D0EEFB";
-$msgtype_colors[IUT_NT_EventReport] = "#D0E5FB";
-$msgtype_colors[IUT_SNMP_Trap] = "#D0DBFB";
-$msgtype_colors[IUT_File_Monitor] = "#DAD0FB";
-$msgtype_colors[IUT_PingProbe] = "#E0D0FB";
-$msgtype_colors[IUT_Port_Probe] = "#F6D0FB";
-$msgtype_colors[IUT_NTService_Monitor] = "#FBD0E7";
-$msgtype_colors[IUT_DiskSpace_Monitor] = "#FBD0D3";
-$msgtype_colors[IUT_DB_Monitor] = "#FBD8D0";
-$msgtype_colors[IUT_Serial_Monitor] = "#FBE0D0";
-$msgtype_colors[IUT_CPU_Monitor] = "#FBEBD0";
-$msgtype_colors[IUT_AliveMonRequest] = "#FBF6D0";
-$msgtype_colors[IUT_SMTPProbe] = "#F5FBD0";
-$msgtype_colors[IUT_FTPProbe] = "#EBFBD0";
-$msgtype_colors[IUT_HTTPProbe] = "#E1FBD0";
-$msgtype_colors[IUT_POP3Probe] = "#D0FBD4";
-$msgtype_colors[IUT_IMAPProbe] = "#D0FBE8";
-$msgtype_colors[IUT_NNTPProbe] = "#D0F7FB";
-$msgtype_colors[IUT_WEVTMONV2] = "#CCE4D2";
-$msgtype_colors[IUT_SMTPLISTENER] = "#CCE4DE";
-// ---
-
+ www.phplogcon.org <- *
+ * ----------------------------------------------------------------- *
+ * Some constants *
+ * *
+ * -> Stuff which has to be static and predefined *
+ * *
+ * All directives are explained within this file *
+ *
+ * Copyright (C) 2008 Adiscon GmbH.
+ *
+ * This file is part of phpLogCon.
+ *
+ * PhpLogCon is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * PhpLogCon is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpLogCon. If not, see .
+ *
+ * A copy of the GPL can be found in the file "COPYING" in this
+ * distribution.
+ *********************************************************************
+*/
+
+// --- Avoid directly accessing this file!
+if ( !defined('IN_PHPLOGCON') )
+{
+ die('Hacking attempt');
+ exit;
+}
+// ---
+
+// --- Some custom defines
+define('RUNMODE_COMMANDLINE', 1);
+define('RUNMODE_WEBSERVER', 2);
+
+define('DEBUG_ULTRADEBUG', 5);
+define('DEBUG_DEBUG', 4);
+define('DEBUG_INFO', 3);
+define('DEBUG_WARN', 2);
+define('DEBUG_ERROR', 1);
+define('DEBUG_ERROR_WTF', 0);
+
+define('STR_DEBUG_ULTRADEBUG', "UltraDebug");
+define('STR_DEBUG_DEBUG', "Debug");
+define('STR_DEBUG_INFO', "Information");
+define('STR_DEBUG_WARN', "Warning");
+define('STR_DEBUG_ERROR', "Error");
+define('STR_DEBUG_ERROR_WTF', "WTF OMFG");
+
+// --- Source Type defines
+define('SOURCE_DISK', '1');
+define('SOURCE_DB', '2');
+// ---
+
+// ---
+define('UID_UNKNOWN', -1);
+// ---
+
+// --- Syslog specific defines!
+define('SYSLOG_KERN', 0);
+define('SYSLOG_USER', 1);
+define('SYSLOG_MAIL', 2);
+define('SYSLOG_DAEMON', 3);
+define('SYSLOG_AUTH', 4);
+define('SYSLOG_SYSLOG', 5);
+define('SYSLOG_LPR', 6);
+define('SYSLOG_NEWS', 7);
+define('SYSLOG_UUCP', 8);
+define('SYSLOG_CRON', 9);
+define('SYSLOG_SECURITY', 10);
+define('SYSLOG_FTP', 11);
+define('SYSLOG_NTP', 12);
+define('SYSLOG_LOGAUDIT', 13);
+define('SYSLOG_LOGALERT', 14);
+define('SYSLOG_CLOCK', 15);
+define('SYSLOG_LOCAL0', 16);
+define('SYSLOG_LOCAL1', 17);
+define('SYSLOG_LOCAL2', 18);
+define('SYSLOG_LOCAL3', 19);
+define('SYSLOG_LOCAL4', 20);
+define('SYSLOG_LOCAL5', 21);
+define('SYSLOG_LOCAL6', 22);
+define('SYSLOG_LOCAL7', 23);
+$facility_colors[SYSLOG_KERN] = "#F1BEA7";
+$facility_colors[SYSLOG_USER] = "#F1D0A7";
+$facility_colors[SYSLOG_MAIL] = "#F1E3A7";
+$facility_colors[SYSLOG_DAEMON] = "#E5F1A7";
+$facility_colors[SYSLOG_AUTH] = "#D3F1A7";
+$facility_colors[SYSLOG_SYSLOG] = "#C1F1A7";
+$facility_colors[SYSLOG_LPR] = "#A7F1D6";
+$facility_colors[SYSLOG_NEWS] = "#A7F1E8";
+$facility_colors[SYSLOG_UUCP] = "#A7E1F1";
+$facility_colors[SYSLOG_CRON] = "#A7C8F1";
+$facility_colors[SYSLOG_SECURITY] = "#F2ECD8";
+$facility_colors[SYSLOG_FTP] = "#ECE3C4";
+$facility_colors[SYSLOG_NTP] = "#E7DAB1";
+$facility_colors[SYSLOG_LOGAUDIT] = "#F2D8E2";
+$facility_colors[SYSLOG_LOGALERT] = "#ECC4D3";
+$facility_colors[SYSLOG_CLOCK] = "#E7B1C5";
+$facility_colors[SYSLOG_LOCAL0] = "#F2F2F2";
+$facility_colors[SYSLOG_LOCAL1] = "#E4E5E6";
+$facility_colors[SYSLOG_LOCAL2] = "#D6D9DA";
+$facility_colors[SYSLOG_LOCAL3] = "#C9CDCF";
+$facility_colors[SYSLOG_LOCAL4] = "#BEC2C4";
+$facility_colors[SYSLOG_LOCAL5] = "#B1B6B9";
+$facility_colors[SYSLOG_LOCAL6] = "#A3AAAD";
+$facility_colors[SYSLOG_LOCAL7] = "#969DA1";
+
+define('SYSLOG_EMERG', 0);
+define('SYSLOG_ALERT', 1);
+define('SYSLOG_CRIT', 2);
+define('SYSLOG_ERR', 3);
+define('SYSLOG_WARNING', 4);
+define('SYSLOG_NOTICE', 5);
+define('SYSLOG_INFO', 6);
+define('SYSLOG_DEBUG', 7);
+$severity_colors[SYSLOG_EMERG] = "#840A15";
+$severity_colors[SYSLOG_ALERT] = "#BA0716";
+$severity_colors[SYSLOG_CRIT] = "#CE0819";
+$severity_colors[SYSLOG_ERR] = "#FF0A1F";
+$severity_colors[SYSLOG_WARNING] = "#EF8200";
+$severity_colors[SYSLOG_NOTICE] = "#14AD42";
+$severity_colors[SYSLOG_INFO] = "#0C9C91";
+$severity_colors[SYSLOG_DEBUG] = "#119BDE";
+// ---
+
+// --- MonitorWare InfoUnit Defines | Messagetypes
+define('IUT_Unknown', '0');
+define('IUT_Syslog', '1');
+define('IUT_Heartbeat', '2');
+define('IUT_NT_EventReport', '3');
+define('IUT_SNMP_Trap', '4');
+define('IUT_File_Monitor', '5');
+define('IUT_PingProbe', '8');
+define('IUT_Port_Probe', '9');
+define('IUT_NTService_Monitor', '10');
+define('IUT_DiskSpace_Monitor', '11');
+define('IUT_DB_Monitor', '12');
+define('IUT_Serial_Monitor', '13');
+define('IUT_CPU_Monitor', '14');
+define('IUT_AliveMonRequest', '16');
+define('IUT_SMTPProbe', '17');
+define('IUT_FTPProbe', '18');
+define('IUT_HTTPProbe', '19');
+define('IUT_POP3Probe', '20');
+define('IUT_IMAPProbe', '21');
+define('IUT_NNTPProbe', '22');
+define('IUT_WEVTMONV2', '23');
+define('IUT_SMTPLISTENER', '24');
+$msgtype_colors[IUT_Unknown] = "#D0FBDC";
+$msgtype_colors[IUT_Syslog] = "#D0FBF1";
+$msgtype_colors[IUT_Heartbeat] = "#D0EEFB";
+$msgtype_colors[IUT_NT_EventReport] = "#D0E5FB";
+$msgtype_colors[IUT_SNMP_Trap] = "#D0DBFB";
+$msgtype_colors[IUT_File_Monitor] = "#DAD0FB";
+$msgtype_colors[IUT_PingProbe] = "#E0D0FB";
+$msgtype_colors[IUT_Port_Probe] = "#F6D0FB";
+$msgtype_colors[IUT_NTService_Monitor] = "#FBD0E7";
+$msgtype_colors[IUT_DiskSpace_Monitor] = "#FBD0D3";
+$msgtype_colors[IUT_DB_Monitor] = "#FBD8D0";
+$msgtype_colors[IUT_Serial_Monitor] = "#FBE0D0";
+$msgtype_colors[IUT_CPU_Monitor] = "#FBEBD0";
+$msgtype_colors[IUT_AliveMonRequest] = "#FBF6D0";
+$msgtype_colors[IUT_SMTPProbe] = "#F5FBD0";
+$msgtype_colors[IUT_FTPProbe] = "#EBFBD0";
+$msgtype_colors[IUT_HTTPProbe] = "#E1FBD0";
+$msgtype_colors[IUT_POP3Probe] = "#D0FBD4";
+$msgtype_colors[IUT_IMAPProbe] = "#D0FBE8";
+$msgtype_colors[IUT_NNTPProbe] = "#D0F7FB";
+$msgtype_colors[IUT_WEVTMONV2] = "#CCE4D2";
+$msgtype_colors[IUT_SMTPLISTENER] = "#CCE4DE";
+// ---
+
?>
\ No newline at end of file
diff --git a/src/include/constants_logstream.php b/src/include/constants_logstream.php
index 6c14185..3b1f667 100644
--- a/src/include/constants_logstream.php
+++ b/src/include/constants_logstream.php
@@ -164,4 +164,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 a13679b..4d1b3c1 100644
--- a/src/include/functions_common.php
+++ b/src/include/functions_common.php
@@ -1,917 +1,917 @@
- www.phplogcon.org <- *
- * ----------------------------------------------------------------- *
- * Common needed functions *
- * *
- * -> *
- * *
- * All directives are explained within this file *
- *
- * Copyright (C) 2008 Adiscon GmbH.
- *
- * This file is part of phpLogCon.
- *
- * PhpLogCon is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PhpLogCon is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpLogCon. If not, see .
- *
- * A copy of the GPL can be found in the file "COPYING" in this
- * distribution.
- *********************************************************************
-*/
-
-// --- Avoid directly accessing this file!
-if ( !defined('IN_PHPLOGCON') )
-{
- die('Hacking attempt');
- exit;
-}
-// ---
-
-// --- Basic Includes
-include($gl_root_path . 'include/constants_general.php');
-include($gl_root_path . 'include/constants_logstream.php');
-
-if ( is_file($gl_root_path . 'config.php') )
- include($gl_root_path . 'config.php');
-else
-{
- // Check for installscript!
- if ( !defined('IN_PHPLOGCON_INSTALL') )
- CheckForInstallPhp();
-}
-
-include($gl_root_path . 'classes/class_template.php');
-include($gl_root_path . 'include/functions_themes.php');
-include($gl_root_path . 'include/functions_db.php');
-include($gl_root_path . 'include/functions_config.php');
-// ---
-
-// --- Define Basic vars
-$RUNMODE = RUNMODE_WEBSERVER;
-$DEBUGMODE = DEBUG_INFO;
-
-// --- Disable ARGV setting @webserver!
-ini_set( "register_argc_argv", "Off" );
-// ---
-
-// Default language
-$LANG_EN = "en"; // Used for fallback
-$LANG = "en"; // Default language
-
-// Default Template vars
-$content['BUILDNUMBER'] = "2.3.1";
-$content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title
-$content['BASEPATH'] = $gl_root_path;
-$content['EXTRA_METATAGS'] = "";
-$content['EXTRA_JAVASCRIPT'] = "";
-$content['EXTRA_STYLESHEET'] = "";
-// ---
-
-function InitBasicPhpLogCon()
-{
- // Needed to make global
- global $CFG, $gl_root_path, $content;
-
- // Check RunMode first!
- CheckAndSetRunMode();
-
- // Get and Set RunTime Informations
- InitRuntimeInformations();
-
- // Set the default line sep
- SetLineBreakVar();
-
- // Start the PHP Session
- StartPHPSession();
-}
-
-function InitPhpLogConConfigFile()
-{
- // Needed to make global
- global $CFG, $gl_root_path, $content;
-
- if ( file_exists($gl_root_path . 'config.php') && GetFileLength($gl_root_path . 'config.php') > 0 )
- {
- // Include the main config
- include_once($gl_root_path . 'config.php');
-
- // Easier DB Access
- define('DB_CONFIG', $CFG['UserDBPref'] . "config");
-
- // If DEBUG Mode is enabled, we prepend the UID field into the col list!
- if ( $CFG['MiscShowDebugMsg'] == 1 )
- array_unshift($CFG['Columns'], SYSLOG_UID);
-
- // Now Copy all entries into content variable
- foreach ($CFG as $key => $value )
- $content[$key] = $value;
-
- // For MiscShowPageRenderStats
- if ( $CFG['MiscShowPageRenderStats'] == 1 )
- {
- $content['ShowPageRenderStats'] = "true";
- InitPageRenderStats();
- }
- }
- else
- {
- // Check for installscript!
- CheckForInstallPhp();
- }
-}
-
-function CheckForInstallPhp()
-{
- // Check for installscript!
- if ( file_exists($content['BASEPATH'] . "install.php") )
- $strinstallmsg = ' '
- . '
Click here to Install PhpLogCon! '
-// . 'See the Installation Guides for more Details! '
-// . 'English Installation Guide | '
-// . 'German Installation Guide '
-// . 'Also take a look to the Readme for some basics around PhpLogCon! '
- . ' ';
- else
- $strinstallmsg = "";
- DieWithErrorMsg( 'Error, main configuration file is missing!' . $strinstallmsg );
-}
-
-function GetFileLength($szFileName)
-{
- if ( is_file($szFileName) )
- return filesize($szFileName);
- else
- return 0;
-}
-
-function InitPhpLogCon()
-{
- // Needed to make global
- global $CFG, $gl_root_path, $content;
-
- // Init Basics which do not need a database
- InitBasicPhpLogCon();
-
- // Will init the config file!
- InitPhpLogConConfigFile();
-
- // Establish DB Connection
- if ( $CFG['UserDBEnabled'] )
- DB_Connect();
-
- // Now load the Page configuration values
- InitConfigurationValues();
-
- // Now Create Themes List because we haven't the config before!
- CreateThemesList();
-
- // Create Language List
- CreateLanguageList();
-
- // Init Predefined Searches List
- CreatePredefinedSearches();
-
- // Init predefined paging sizes
- CreatePagesizesList();
-
- // Init predefined reload times
- CreateReloadTimesList();
-
- // --- Enable PHP Debug Mode
- InitPhpDebugMode();
- // ---
-}
-
-function CreateLogLineTypesList( $selectedType )
-{
- global $content;
-
- // syslog
- $content['LOGLINETYPES']["syslog"]['type'] = "syslog";
- $content['LOGLINETYPES']["syslog"]['DisplayName'] = "Syslog / RSyslog";
- if ( $selectedType == $content['LOGLINETYPES']["syslog"]['type'] ) { $content['LOGLINETYPES']["syslog"]['selected'] = "selected"; } else { $content['LOGLINETYPES']["syslog"]['selected'] = ""; }
-
- // Adiscon Winsyslog
- $content['LOGLINETYPES']["winsyslog"]['type'] = "winsyslog";
- $content['LOGLINETYPES']["winsyslog"]['DisplayName'] = "Adiscon WinSyslog";
- if ( $selectedType == $content['LOGLINETYPES']["winsyslog"]['type'] ) { $content['LOGLINETYPES']["winsyslog"]['selected'] = "selected"; } else { $content['LOGLINETYPES']["winsyslog"]['selected'] = ""; }
-}
-
-function CreateSourceTypesList( $selectedSource )
-{
- global $content;
-
- // SOURCE_DISK
- $content['SOURCETYPES'][SOURCE_DISK]['type'] = SOURCE_DISK;
- $content['SOURCETYPES'][SOURCE_DISK]['DisplayName'] = $content['LN_GEN_SOURCE_DISK'];
- if ( $selectedSource == $content['SOURCETYPES'][SOURCE_DISK]['type'] ) { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = ""; }
-
- // SOURCE_DB
- $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'] = ""; }
-}
-
-function CreateDBTypesList( $selectedDBType )
-{
- global $content;
-
- // DB_MYSQL
- $content['DBTYPES'][DB_MYSQL]['type'] = DB_MYSQL;
- $content['DBTYPES'][DB_MYSQL]['DisplayName'] = "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";
- 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'] = ""; }
-*/
-
-}
-
-function CreatePagesizesList()
-{
- global $CFG, $content;
-
- $iCounter = 0;
- $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_GEN_PRECONFIGURED'] . " (" . $CFG['ViewEntriesPerPage'] . ")", "Value" => $CFG['ViewEntriesPerPage'] ); $iCounter++;
- $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 25 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 25 ); $iCounter++;
- $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 50 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 50 ); $iCounter++;
- $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 75 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 75 ); $iCounter++;
- $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 100 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 100 ); $iCounter++;
- $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 250 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 250 ); $iCounter++;
- $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 500 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 500 ); $iCounter++;
-
- // Set default selected pagesize
- $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Selected"] = "selected";
-
- // The content variable will now contain the user selected oaging size
- $content["ViewEntriesPerPage"] = $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Value"];
-}
-
-function CreateReloadTimesList()
-{
- global $CFG, $content;
-
-// $CFG['ViewEnableAutoReloadSeconds']
- $iCounter = 0;
- $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_DISABLED'], "Value" => 0 ); $iCounter++;
- if ( isset($CFG['ViewEnableAutoReloadSeconds']) && $CFG['ViewEnableAutoReloadSeconds'] > 0 )
- {
- $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_PRECONFIGURED'] . " (" . $CFG['ViewEnableAutoReloadSeconds'] . " " . $content['LN_AUTORELOAD_SECONDS'] . ") ", "Value" => $CFG['ViewEnableAutoReloadSeconds'] ); $iCounter++;
- }
- $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 5 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 5 ); $iCounter++;
- $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 10 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 10 ); $iCounter++;
- $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 15 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 15 ); $iCounter++;
- $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 30 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 30 ); $iCounter++;
- $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 60 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 60 ); $iCounter++;
- $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 5 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 300 ); $iCounter++;
- $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 10 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 600 ); $iCounter++;
- $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 15 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 900 ); $iCounter++;
- $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 30 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 1800 ); $iCounter++;
-
- // Set default selected autoreloadid
- $content['reloadtimes'][ $_SESSION['AUTORELOAD_ID'] ]["Selected"] = "selected";
-
- // The content variable will now contain the user selected oaging size
- $content["ViewEnableAutoReloadSeconds"] = $content['reloadtimes'][ $_SESSION['AUTORELOAD_ID'] ]["Value"];
-
-}
-
-function CreatePredefinedSearches()
-{
- global $CFG, $content;
- if ( isset($CFG['Search']) )
- {
- // Enable predefined searches
- $content['EnablePredefinedSearches'] = true;
-
- // Loop through all predefined searches!
- foreach ($CFG['Search'] as $mykey => $mySearch)
- {
- // Copy configured searches into content array!
- $content['Search'][$mykey]["ID"] = $mykey;
- $content['Search'][$mykey]["Selected"] = false;
-
- // --- Set CSS Class
- if ( $mykey % 2 == 0 )
- $content['Search'][$mykey]['cssclass'] = "line1";
- else
- $content['Search'][$mykey]['cssclass'] = "line2";
- // ---
-
- }
- }
- else // Disable predefined searches
- $content['EnablePredefinedSearches'] = false;
-}
-
-function InitPhpDebugMode()
-{
- global $content, $CFG;
-
- // --- Set Global DEBUG Level!
- if ( $CFG['MiscShowDebugMsg'] == 1 )
- ini_set( "error_reporting", E_ALL ); // ALL PHP MESSAGES!
-// else
-// ini_set( "error_reporting", E_ERROR ); // ONLY PHP ERROR'S!
- // ---
-}
-
-function CheckAndSetRunMode()
-{
- global $RUNMODE;
- // Set to command line mode if argv is set!
- if ( !isset($_SERVER["GATEWAY_INTERFACE"]) )
- $RUNMODE = RUNMODE_COMMANDLINE;
-}
-
-function InitRuntimeInformations()
-{
- global $content, $CFG;
-
- // TODO| maybe not needed!
-
- // Enable GZIP Compression if enabled!
- if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && (isset($CFG['MiscEnableGzipCompression']) && $CFG['MiscEnableGzipCompression'] == 1) )
- {
- // This starts gzip compression!
- ob_start("ob_gzhandler");
- $content['GzipCompressionEnmabled'] = "yes";
- }
- else
- $content['GzipCompressionEnmabled'] = "no";
-}
-
-function CreateDebugModes()
-{
- global $content;
-
- $content['DBGMODES'][0]['DisplayName'] = STR_DEBUG_ULTRADEBUG;
- if ( $content['parser_debugmode'] == $content['DBGMODES'][0]['DisplayName'] ) { $content['DBGMODES'][0]['selected'] = "selected"; } else { $content['DBGMODES'][0]['selected'] = ""; }
- $content['DBGMODES'][1]['DisplayName'] = STR_DEBUG_DEBUG;
- if ( $content['parser_debugmode'] == $content['DBGMODES'][1]['DisplayName'] ) { $content['DBGMODES'][1]['selected'] = "selected"; } else { $content['DBGMODES'][1]['selected'] = ""; }
- $content['DBGMODES'][2]['DisplayName'] = STR_DEBUG_INFO;
- if ( $content['parser_debugmode'] == $content['DBGMODES'][2]['DisplayName'] ) { $content['DBGMODES'][2]['selected'] = "selected"; } else { $content['DBGMODES'][2]['selected'] = ""; }
- $content['DBGMODES'][3]['DisplayName'] = STR_DEBUG_WARN;
- if ( $content['parser_debugmode'] == $content['DBGMODES'][3]['DisplayName'] ) { $content['DBGMODES'][3]['selected'] = "selected"; } else { $content['DBGMODES'][3]['selected'] = ""; }
- $content['DBGMODES'][4]['DisplayName'] = STR_DEBUG_ERROR;
- if ( $content['parser_debugmode'] == $content['DBGMODES'][4]['DisplayName'] ) { $content['DBGMODES'][4]['selected'] = "selected"; } else { $content['DBGMODES'][4]['selected'] = ""; }
-}
-
-function InitFrontEndVariables()
-{
- global $content;
-
- $content['MENU_FOLDER_OPEN'] = $content['BASEPATH'] . "images/icons/folder_closed.png";
- $content['MENU_FOLDER_CLOSED'] = $content['BASEPATH'] . "images/icons/folder.png";
- $content['MENU_HOMEPAGE'] = $content['BASEPATH'] . "images/icons/home.png";
- $content['MENU_LINK'] = $content['BASEPATH'] . "images/icons/link.png";
- $content['MENU_LINK_VIEW'] = $content['BASEPATH'] . "images/icons/link_view.png";
- $content['MENU_VIEW'] = $content['BASEPATH'] . "images/icons/view.png";
- $content['MENU_PREFERENCES'] = $content['BASEPATH'] . "images/icons/preferences.png";
- $content['MENU_ADMINENTRY'] = $content['BASEPATH'] . "images/icons/star_blue.png";
- $content['MENU_ADMINLOGOFF'] = $content['BASEPATH'] . "images/icons/exit.png";
- $content['MENU_ADMINUSERS'] = $content['BASEPATH'] . "images/icons/businessmen.png";
- $content['MENU_SEARCH'] = $content['BASEPATH'] . "images/icons/view.png";
- $content['MENU_SELECTION_DISABLED'] = $content['BASEPATH'] . "images/icons/selection.png";
- $content['MENU_SELECTION_ENABLED'] = $content['BASEPATH'] . "images/icons/selection_delete.png";
- $content['MENU_TEXT_FIND'] = $content['BASEPATH'] . "images/icons/text_find.png";
-
- $content['MENU_PAGER_BEGIN'] = $content['BASEPATH'] . "images/icons/media_beginning.png";
- $content['MENU_PAGER_PREVIOUS'] = $content['BASEPATH'] . "images/icons/media_rewind.png";
- $content['MENU_PAGER_NEXT'] = $content['BASEPATH'] . "images/icons/media_fast_forward.png";
- $content['MENU_PAGER_END'] = $content['BASEPATH'] . "images/icons/media_end.png";
- $content['MENU_NAV_LEFT'] = $content['BASEPATH'] . "images/icons/navigate_left.png";
- $content['MENU_NAV_RIGHT'] = $content['BASEPATH'] . "images/icons/navigate_right.png";
- $content['MENU_NAV_CLOSE'] = $content['BASEPATH'] . "images/icons/navigate_close.png";
- $content['MENU_NAV_OPEN'] = $content['BASEPATH'] . "images/icons/navigate_open.png";
- $content['MENU_PAGER_BEGIN_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_beginning.png";
- $content['MENU_PAGER_PREVIOUS_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_rewind.png";
- $content['MENU_PAGER_NEXT_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_fast_forward.png";
- $content['MENU_PAGER_END_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_end.png";
-
- $content['MENU_BULLET_BLUE'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_blue.png";
- $content['MENU_BULLET_GREEN'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_green.png";
- $content['MENU_BULLET_RED'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_red.png";
- $content['MENU_BULLET_YELLOW'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_yellow.png";
- $content['MENU_BULLET_GREY'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_grey.png";
-}
-
-// Lang Helper for Strings with ONE variable
-function GetAndReplaceLangStr( $strlang, $param1 = "", $param2 = "", $param3 = "", $param4 = "", $param5 = "" )
-{
- $strfinal = str_replace ( "%1", $param1, $strlang );
- if ( strlen($param2) > 0 )
- $strfinal = str_replace ( "%1", $param2, $strfinal );
- if ( strlen($param3) > 0 )
- $strfinal = str_replace ( "%1", $param3, $strfinal );
- if ( strlen($param4) > 0 )
- $strfinal = str_replace ( "%1", $param4, $strfinal );
- if ( strlen($param5) > 0 )
- $strfinal = str_replace ( "%1", $param5, $strfinal );
-
- // And return
- return $strfinal;
-}
-
-function InitConfigurationValues()
-{
- global $content, $CFG, $LANG, $gl_root_path;
-
- // If Database is enabled, try to read from database!
- if ( $CFG['UserDBEnabled'] )
- {
- $result = DB_Query("SELECT * FROM " . DB_CONFIG);
- $rows = DB_GetAllRows($result, true, true);
-
- if ( isset($rows ) )
- {
- for($i = 0; $i < count($rows); $i++)
- $content[ $rows[$i]['name'] ] = $rows[$i]['value'];
- }
- // General defaults
- // --- Language Handling
- if ( !isset($content['gen_lang']) ) { $content['gen_lang'] = $CFG['ViewDefaultLanguage'] /*"en"*/; }
-
- // --- PHP Debug Mode
- if ( !isset($content['gen_phpdebug']) ) { $content['gen_phpdebug'] = "no"; }
- // ---
-
- // Database Version Checker!
- if ( $content['database_internalversion'] > $content['database_installedversion'] )
- {
- // Database is out of date, we need to upgrade
- $content['database_forcedatabaseupdate'] = "yes";
- }
- }
- else
- {
- // --- Set Defaults...
- // Language Handling
- if ( isset($_SESSION['CUSTOM_LANG']) && VerifyLanguage($_SESSION['CUSTOM_LANG']) )
- {
- $content['user_lang'] = $_SESSION['CUSTOM_LANG'];
- $LANG = $content['user_lang'];
- }
- else if ( isset($content['gen_lang']) && VerifyLanguage($content['gen_lang']))
- {
- $content['user_lang'] = $content['gen_lang'];
- $LANG = $content['user_lang'];
- }
- else // Failsave!
- {
- $content['user_lang'] = $CFG['ViewDefaultLanguage'] /*"en"*/;
- $LANG = $content['user_lang'];
- $content['gen_lang'] = $content['user_lang'];
- }
- }
-
- // Paging Size handling!
- if ( !isset($_SESSION['PAGESIZE_ID']) )
- {
- // Default is 0!
- $_SESSION['PAGESIZE_ID'] = 0;
- }
-
- // Auto reload handling!
- if ( !isset($_SESSION['AUTORELOAD_ID']) )
- {
- if ( isset($CFG['ViewEnableAutoReloadSeconds']) && $CFG['ViewEnableAutoReloadSeconds'] > 0 )
- $_SESSION['AUTORELOAD_ID'] = 1; // Autoreload ID will be the first item!
- else // Default is 0, which means auto reload disabled
- $_SESSION['AUTORELOAD_ID'] = 0;
- }
-
- // Theme Handling
- if ( !isset($content['web_theme']) ) { $content['web_theme'] = $CFG['ViewDefaultTheme'] /*"default"*/; }
- if ( isset($_SESSION['CUSTOM_THEME']) && VerifyTheme($_SESSION['CUSTOM_THEME']) )
- $content['user_theme'] = $_SESSION['CUSTOM_THEME'];
- else
- $content['user_theme'] = $content['web_theme'];
-
- //Init Theme About Info ^^
- InitThemeAbout($content['user_theme']);
- // ---
-
- // Init main langauge file now!
- IncludeLanguageFile( $gl_root_path . '/lang/' . $LANG . '/main.php' );
-
- // Init other things which are needed
- InitFrontEndVariables();
-}
-
-function SetDebugModeFromString( $facility )
-{
- global $DEBUGMODE;
-
- switch ( $facility )
- {
- case STR_DEBUG_ULTRADEBUG:
- $DEBUGMODE = DEBUG_ULTRADEBUG;
- break;
- case STR_DEBUG_DEBUG:
- $DEBUGMODE = DEBUG_DEBUG;
- break;
- case STR_DEBUG_INFO:
- $DEBUGMODE = DEBUG_INFO;
- break;
- case STR_DEBUG_WARN:
- $DEBUGMODE = DEBUG_WARN;
- break;
- case STR_DEBUG_ERROR:
- $DEBUGMODE = DEBUG_ERROR;
- break;
- }
-}
-
-
-function InitPageRenderStats()
-{
- global $gl_starttime, $querycount;
- $gl_starttime = microtime_float();
- $querycount = 0;
-}
-
-function FinishPageRenderStats( &$mycontent)
-{
- global $gl_starttime, $querycount;
-
- $endtime = microtime_float();
- $mycontent['PAGERENDERTIME'] = number_format($endtime - $gl_starttime, 4, '.', '');
- $mycontent['TOTALQUERIES'] = $querycount;
-}
-
-function microtime_float()
-{
- list($usec, $sec) = explode(" ", microtime());
- return ((float)$usec + (float)$sec);
-}
-
-function SetLineBreakVar()
-{
- // Used for some functions
- global $RUNMODE, $linesep;
-
- if ( $RUNMODE == RUNMODE_COMMANDLINE )
- $linesep = "\r\n";
- else if ( $RUNMODE == RUNMODE_WEBSERVER )
- $linesep = " ";
-}
-
-function CheckUrlOrIP($ip)
-{
- $long = ip2long($ip);
- if ( $long == -1 )
- return false;
- else
- return true;
-}
-
-function DieWithErrorMsg( $szerrmsg )
-{
- global $content;
- print(" ");
- print("Critical Error occured ");
- print("Errordetails: " . $szerrmsg);
- print("
");
-
- exit;
-}
-
-function DieWithFriendlyErrorMsg( $szerrmsg )
-{
- //TODO: Make with template
- print("");
- print("Error occured ");
- print("Errordetails: " . $szerrmsg);
- exit;
-}
-
-/*
-* Helper function to initialize the page title!
-*/
-function InitPageTitle()
-{
- global $content, $CFG, $currentSourceID;
-
- if ( isset($CFG['PrependTitle']) && strlen($CFG['PrependTitle']) > 0 )
- $szReturn = $CFG['PrependTitle'] . " :: ";
- else
- $szReturn = "";
-
- if ( isset($currentSourceID) && isset($content['Sources'][$currentSourceID]['Name']) )
- $szReturn .= "Source '" . $content['Sources'][$currentSourceID]['Name'] . "' :: ";
-
- // Append phpLogCon
- $szReturn .= "phpLogCon";
-
- // return result
- return $szReturn;
-}
-
-
-function GetStringWithHTMLCodes($myStr)
-{
- // Replace all special characters with valid html representations
- return htmlentities($myStr);
-}
-
-function InitTemplateParser()
-{
- global $page, $gl_root_path;
- // -----------------------------------------------
- // Create Template Object and set some variables for the templates
- // -----------------------------------------------
- $page = new Template();
- $page -> set_path ( $gl_root_path . "templates/" );
-}
-
-function VerifyLanguage( $mylang )
-{
- global $gl_root_path;
-
- if ( is_dir( $gl_root_path . 'lang/' . $mylang ) )
- return true;
- else
- return false;
-}
-
-function IncludeLanguageFile( $langfile )
-{
- global $LANG, $LANG_EN;
-
- if ( file_exists( $langfile ) )
- include( $langfile );
- else
- {
- $langfile = str_replace( $LANG, $LANG_EN, $langfile );
- include( $langfile );
- }
-}
-
-function RedirectPage( $newpage )
-{
- header("Location: $newpage");
- exit;
-}
-
-function RedirectResult( $szMsg, $newpage )
-{
- header("Location: result.php?msg=" . urlencode($szMsg) . "&redir=" . urlencode($newpage));
- exit;
-}
-
-/*
-* GetEventTime
-*
-* Helper function to parse and obtain a valid EventTime Array from the input string.
-* Return value: EventTime Array!
-*
-*/
-function GetEventTime($szTimStr)
-{
- // Sample: Mar 10 14:45:44
- if ( preg_match("/(...) ([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) )
- {
- // RFC 3164 typical timestamp
- $eventtime[EVTIME_TIMESTAMP] = mktime($out[3], $out[4], $out[5], GetMonthFromString($out[1]), $out[2]);
- $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO!
- $eventtime[EVTIME_MICROSECONDS] = 0;
-
-// echo gmdate(DATE_RFC822, $eventtime[EVTIME_TIMESTAMP]) . " ";
-// print_r ( $eventtime );
-// exit;
- }
- // Sample: 2008-04-02T11:12:32+02:00
- else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\+([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) )
- {
- // RFC 3164 typical timestamp
- $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]);
- $eventtime[EVTIME_TIMEZONE] = $out[7];
- $eventtime[EVTIME_MICROSECONDS] = 0;
- }
- // Sample: 2008-04-02T11:12:32.380449+02:00
- else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\.([0-9]{1,6})\+([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) )
- {
- // RFC 3164 typical timestamp
- $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]);
- $eventtime[EVTIME_TIMEZONE] = $out[8];
- $eventtime[EVTIME_MICROSECONDS] = $out[7];
- }
- // Sample: 2008-04-02,15:19:06
- else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2}),([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) )
- {
- // RFC 3164 typical timestamp
- $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]);
- $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO!
- $eventtime[EVTIME_MICROSECONDS] = 0;
- }
- // Sample: 2008-02-19 12:52:37
- else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) )
- {
- // RFC 3164 typical timestamp
- $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]);
- $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO!
- $eventtime[EVTIME_MICROSECONDS] = 0;
- }
- // Sample: 2007-4-18T00:00:00
- else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) )
- {
- // RFC 3164 typical timestamp
- $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]);
- $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO!
- $eventtime[EVTIME_MICROSECONDS] = 0;
- }
- else
- {
- die ("wtf GetEventTime unparsable time - " . $szTimStr );
- }
-
- // return result!
- return $eventtime;
-}
-
-/*
-* GetMonthFromString
-*
-* Simple Helper function to obtain the numeric represantation of the month
-*/
-function GetMonthFromString($szMonth)
-{
- switch($szMonth)
- {
- case "Jan":
- return 1;
- case "Feb":
- return 2;
- case "Mar":
- return 3;
- case "Apr":
- return 4;
- case "May":
- return 5;
- case "Jun":
- return 6;
- case "Jul":
- return 7;
- case "Aug":
- return 8;
- case "Sep":
- return 9;
- case "Oct":
- return 10;
- case "Nov":
- return 11;
- case "Dez":
- return 12;
- }
-}
-
-
-// --- BEGIN Usermanagement Function ---
-function StartPHPSession()
-{
- global $RUNMODE;
- if ( $RUNMODE == RUNMODE_WEBSERVER )
- {
- // This will start the session
- if (session_id() == "")
- session_start();
-
- if ( !isset($_SESSION['SESSION_STARTED']) )
- $_SESSION['SESSION_STARTED'] = "true";
- }
-}
-
-function CheckForUserLogin( $isloginpage, $isUpgradePage = false )
-{
- global $content;
-
- if ( isset($_SESSION['SESSION_LOGGEDIN']) )
- {
- if ( !$_SESSION['SESSION_LOGGEDIN'] )
- RedirectToUserLogin();
- else
- {
- $content['SESSION_LOGGEDIN'] = "true";
- $content['SESSION_USERNAME'] = $_SESSION['SESSION_USERNAME'];
- }
-
- // New, Check for database Version and may redirect to updatepage!
- if ( isset($content['database_forcedatabaseupdate']) &&
- $content['database_forcedatabaseupdate'] == "yes" &&
- $isUpgradePage == false
- )
- RedirectToDatabaseUpgrade();
- }
- else
- {
- if ( $isloginpage == false )
- RedirectToUserLogin();
- }
-
-}
-
-function CreateUserName( $username, $password, $access_level )
-{
- $md5pass = md5($password);
- $result = DB_Query("SELECT username FROM " . STATS_USERS . " WHERE username = '" . $username . "'");
- $rows = DB_GetAllRows($result, true);
- if ( isset($rows) )
- {
- DieWithFriendlyErrorMsg( "User $username already exists!" );
-
- // User not created!
- return false;
- }
- else
- {
- // Create User
- $result = DB_Query("INSERT INTO " . STATS_USERS . " (username, password, access_level) VALUES ('$username', '$md5pass', $access_level)");
- DB_FreeQuery($result);
-
- // Success
- return true;
- }
-}
-
-function CheckUserLogin( $username, $password )
-{
- global $content, $CFG;
-
- // TODO: SessionTime and AccessLevel check
-
- $md5pass = md5($password);
- $sqlselect = "SELECT access_level FROM " . STATS_USERS . " WHERE username = '" . $username . "' and password = '" . $md5pass . "'";
- $result = DB_Query($sqlselect);
- $rows = DB_GetAllRows($result, true);
- if ( isset($rows) )
- {
- $_SESSION['SESSION_LOGGEDIN'] = true;
- $_SESSION['SESSION_USERNAME'] = $username;
- $_SESSION['SESSION_ACCESSLEVEL'] = $rows[0]['access_level'];
-
- $content['SESSION_LOGGEDIN'] = "true";
- $content['SESSION_USERNAME'] = $username;
-
- // Success !
- return true;
- }
- else
- {
- if ( $CFG['MiscShowDebugMsg'] == 1 )
- DieWithFriendlyErrorMsg( "Debug Error: Could not login user '" . $username . "' Sessionarray " . var_export($_SESSION, true) . " SQL Statement : " . $sqlselect );
-
- // Default return false
- return false;
- }
-}
-
-function DoLogOff()
-{
- global $content;
-
- unset( $_SESSION['SESSION_LOGGEDIN'] );
- unset( $_SESSION['SESSION_USERNAME'] );
- unset( $_SESSION['SESSION_ACCESSLEVEL'] );
-
- // Redir to Index Page
- RedirectPage( "index.php");
-}
-
-function RedirectToUserLogin()
-{
- // TODO Referer
- header("Location: login.php?referer=" . $_SERVER['PHP_SELF']);
- exit;
-}
-
-function RedirectToDatabaseUpgrade()
-{
- // TODO Referer
- header("Location: upgrade.php"); // ?referer=" . $_SERVER['PHP_SELF']);
- exit;
-}
-// --- END Usermanagement Function ---
-
-
-?>
+ www.phplogcon.org <- *
+ * ----------------------------------------------------------------- *
+ * Common needed functions *
+ * *
+ * -> *
+ * *
+ * All directives are explained within this file *
+ *
+ * Copyright (C) 2008 Adiscon GmbH.
+ *
+ * This file is part of phpLogCon.
+ *
+ * PhpLogCon is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * PhpLogCon is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpLogCon. If not, see .
+ *
+ * A copy of the GPL can be found in the file "COPYING" in this
+ * distribution.
+ *********************************************************************
+*/
+
+// --- Avoid directly accessing this file!
+if ( !defined('IN_PHPLOGCON') )
+{
+ die('Hacking attempt');
+ exit;
+}
+// ---
+
+// --- Basic Includes
+include($gl_root_path . 'include/constants_general.php');
+include($gl_root_path . 'include/constants_logstream.php');
+
+if ( is_file($gl_root_path . 'config.php') )
+ include($gl_root_path . 'config.php');
+else
+{
+ // Check for installscript!
+ if ( !defined('IN_PHPLOGCON_INSTALL') )
+ CheckForInstallPhp();
+}
+
+include($gl_root_path . 'classes/class_template.php');
+include($gl_root_path . 'include/functions_themes.php');
+include($gl_root_path . 'include/functions_db.php');
+include($gl_root_path . 'include/functions_config.php');
+// ---
+
+// --- Define Basic vars
+$RUNMODE = RUNMODE_WEBSERVER;
+$DEBUGMODE = DEBUG_INFO;
+
+// --- Disable ARGV setting @webserver!
+ini_set( "register_argc_argv", "Off" );
+// ---
+
+// Default language
+$LANG_EN = "en"; // Used for fallback
+$LANG = "en"; // Default language
+
+// Default Template vars
+$content['BUILDNUMBER'] = "2.3.1";
+$content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title
+$content['BASEPATH'] = $gl_root_path;
+$content['EXTRA_METATAGS'] = "";
+$content['EXTRA_JAVASCRIPT'] = "";
+$content['EXTRA_STYLESHEET'] = "";
+// ---
+
+function InitBasicPhpLogCon()
+{
+ // Needed to make global
+ global $CFG, $gl_root_path, $content;
+
+ // Check RunMode first!
+ CheckAndSetRunMode();
+
+ // Get and Set RunTime Informations
+ InitRuntimeInformations();
+
+ // Set the default line sep
+ SetLineBreakVar();
+
+ // Start the PHP Session
+ StartPHPSession();
+}
+
+function InitPhpLogConConfigFile()
+{
+ // Needed to make global
+ global $CFG, $gl_root_path, $content;
+
+ if ( file_exists($gl_root_path . 'config.php') && GetFileLength($gl_root_path . 'config.php') > 0 )
+ {
+ // Include the main config
+ include_once($gl_root_path . 'config.php');
+
+ // Easier DB Access
+ define('DB_CONFIG', $CFG['UserDBPref'] . "config");
+
+ // If DEBUG Mode is enabled, we prepend the UID field into the col list!
+ if ( $CFG['MiscShowDebugMsg'] == 1 )
+ array_unshift($CFG['Columns'], SYSLOG_UID);
+
+ // Now Copy all entries into content variable
+ foreach ($CFG as $key => $value )
+ $content[$key] = $value;
+
+ // For MiscShowPageRenderStats
+ if ( $CFG['MiscShowPageRenderStats'] == 1 )
+ {
+ $content['ShowPageRenderStats'] = "true";
+ InitPageRenderStats();
+ }
+ }
+ else
+ {
+ // Check for installscript!
+ CheckForInstallPhp();
+ }
+}
+
+function CheckForInstallPhp()
+{
+ // Check for installscript!
+ if ( file_exists($content['BASEPATH'] . "install.php") )
+ $strinstallmsg = ' '
+ . 'Click here to Install PhpLogCon! '
+// . 'See the Installation Guides for more Details! '
+// . 'English Installation Guide | '
+// . 'German Installation Guide '
+// . 'Also take a look to the Readme for some basics around PhpLogCon! '
+ . ' ';
+ else
+ $strinstallmsg = "";
+ DieWithErrorMsg( 'Error, main configuration file is missing!' . $strinstallmsg );
+}
+
+function GetFileLength($szFileName)
+{
+ if ( is_file($szFileName) )
+ return filesize($szFileName);
+ else
+ return 0;
+}
+
+function InitPhpLogCon()
+{
+ // Needed to make global
+ global $CFG, $gl_root_path, $content;
+
+ // Init Basics which do not need a database
+ InitBasicPhpLogCon();
+
+ // Will init the config file!
+ InitPhpLogConConfigFile();
+
+ // Establish DB Connection
+ if ( $CFG['UserDBEnabled'] )
+ DB_Connect();
+
+ // Now load the Page configuration values
+ InitConfigurationValues();
+
+ // Now Create Themes List because we haven't the config before!
+ CreateThemesList();
+
+ // Create Language List
+ CreateLanguageList();
+
+ // Init Predefined Searches List
+ CreatePredefinedSearches();
+
+ // Init predefined paging sizes
+ CreatePagesizesList();
+
+ // Init predefined reload times
+ CreateReloadTimesList();
+
+ // --- Enable PHP Debug Mode
+ InitPhpDebugMode();
+ // ---
+}
+
+function CreateLogLineTypesList( $selectedType )
+{
+ global $content;
+
+ // syslog
+ $content['LOGLINETYPES']["syslog"]['type'] = "syslog";
+ $content['LOGLINETYPES']["syslog"]['DisplayName'] = "Syslog / RSyslog";
+ if ( $selectedType == $content['LOGLINETYPES']["syslog"]['type'] ) { $content['LOGLINETYPES']["syslog"]['selected'] = "selected"; } else { $content['LOGLINETYPES']["syslog"]['selected'] = ""; }
+
+ // Adiscon Winsyslog
+ $content['LOGLINETYPES']["winsyslog"]['type'] = "winsyslog";
+ $content['LOGLINETYPES']["winsyslog"]['DisplayName'] = "Adiscon WinSyslog";
+ if ( $selectedType == $content['LOGLINETYPES']["winsyslog"]['type'] ) { $content['LOGLINETYPES']["winsyslog"]['selected'] = "selected"; } else { $content['LOGLINETYPES']["winsyslog"]['selected'] = ""; }
+}
+
+function CreateSourceTypesList( $selectedSource )
+{
+ global $content;
+
+ // SOURCE_DISK
+ $content['SOURCETYPES'][SOURCE_DISK]['type'] = SOURCE_DISK;
+ $content['SOURCETYPES'][SOURCE_DISK]['DisplayName'] = $content['LN_GEN_SOURCE_DISK'];
+ if ( $selectedSource == $content['SOURCETYPES'][SOURCE_DISK]['type'] ) { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_DISK]['selected'] = ""; }
+
+ // SOURCE_DB
+ $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'] = ""; }
+}
+
+function CreateDBTypesList( $selectedDBType )
+{
+ global $content;
+
+ // DB_MYSQL
+ $content['DBTYPES'][DB_MYSQL]['type'] = DB_MYSQL;
+ $content['DBTYPES'][DB_MYSQL]['DisplayName'] = "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";
+ 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'] = ""; }
+*/
+
+}
+
+function CreatePagesizesList()
+{
+ global $CFG, $content;
+
+ $iCounter = 0;
+ $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_GEN_PRECONFIGURED'] . " (" . $CFG['ViewEntriesPerPage'] . ")", "Value" => $CFG['ViewEntriesPerPage'] ); $iCounter++;
+ $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 25 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 25 ); $iCounter++;
+ $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 50 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 50 ); $iCounter++;
+ $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 75 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 75 ); $iCounter++;
+ $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 100 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 100 ); $iCounter++;
+ $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 250 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 250 ); $iCounter++;
+ $content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 500 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 500 ); $iCounter++;
+
+ // Set default selected pagesize
+ $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Selected"] = "selected";
+
+ // The content variable will now contain the user selected oaging size
+ $content["ViewEntriesPerPage"] = $content['pagesizes'][ $_SESSION['PAGESIZE_ID'] ]["Value"];
+}
+
+function CreateReloadTimesList()
+{
+ global $CFG, $content;
+
+// $CFG['ViewEnableAutoReloadSeconds']
+ $iCounter = 0;
+ $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_DISABLED'], "Value" => 0 ); $iCounter++;
+ if ( isset($CFG['ViewEnableAutoReloadSeconds']) && $CFG['ViewEnableAutoReloadSeconds'] > 0 )
+ {
+ $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_PRECONFIGURED'] . " (" . $CFG['ViewEnableAutoReloadSeconds'] . " " . $content['LN_AUTORELOAD_SECONDS'] . ") ", "Value" => $CFG['ViewEnableAutoReloadSeconds'] ); $iCounter++;
+ }
+ $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 5 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 5 ); $iCounter++;
+ $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 10 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 10 ); $iCounter++;
+ $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 15 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 15 ); $iCounter++;
+ $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 30 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 30 ); $iCounter++;
+ $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 60 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 60 ); $iCounter++;
+ $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 5 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 300 ); $iCounter++;
+ $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 10 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 600 ); $iCounter++;
+ $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 15 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 900 ); $iCounter++;
+ $content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 30 " . $content['LN_AUTORELOAD_MINUTES'], "Value" => 1800 ); $iCounter++;
+
+ // Set default selected autoreloadid
+ $content['reloadtimes'][ $_SESSION['AUTORELOAD_ID'] ]["Selected"] = "selected";
+
+ // The content variable will now contain the user selected oaging size
+ $content["ViewEnableAutoReloadSeconds"] = $content['reloadtimes'][ $_SESSION['AUTORELOAD_ID'] ]["Value"];
+
+}
+
+function CreatePredefinedSearches()
+{
+ global $CFG, $content;
+ if ( isset($CFG['Search']) )
+ {
+ // Enable predefined searches
+ $content['EnablePredefinedSearches'] = true;
+
+ // Loop through all predefined searches!
+ foreach ($CFG['Search'] as $mykey => $mySearch)
+ {
+ // Copy configured searches into content array!
+ $content['Search'][$mykey]["ID"] = $mykey;
+ $content['Search'][$mykey]["Selected"] = false;
+
+ // --- Set CSS Class
+ if ( $mykey % 2 == 0 )
+ $content['Search'][$mykey]['cssclass'] = "line1";
+ else
+ $content['Search'][$mykey]['cssclass'] = "line2";
+ // ---
+
+ }
+ }
+ else // Disable predefined searches
+ $content['EnablePredefinedSearches'] = false;
+}
+
+function InitPhpDebugMode()
+{
+ global $content, $CFG;
+
+ // --- Set Global DEBUG Level!
+ if ( $CFG['MiscShowDebugMsg'] == 1 )
+ ini_set( "error_reporting", E_ALL ); // ALL PHP MESSAGES!
+// else
+// ini_set( "error_reporting", E_ERROR ); // ONLY PHP ERROR'S!
+ // ---
+}
+
+function CheckAndSetRunMode()
+{
+ global $RUNMODE;
+ // Set to command line mode if argv is set!
+ if ( !isset($_SERVER["GATEWAY_INTERFACE"]) )
+ $RUNMODE = RUNMODE_COMMANDLINE;
+}
+
+function InitRuntimeInformations()
+{
+ global $content, $CFG;
+
+ // TODO| maybe not needed!
+
+ // Enable GZIP Compression if enabled!
+ if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && (isset($CFG['MiscEnableGzipCompression']) && $CFG['MiscEnableGzipCompression'] == 1) )
+ {
+ // This starts gzip compression!
+ ob_start("ob_gzhandler");
+ $content['GzipCompressionEnmabled'] = "yes";
+ }
+ else
+ $content['GzipCompressionEnmabled'] = "no";
+}
+
+function CreateDebugModes()
+{
+ global $content;
+
+ $content['DBGMODES'][0]['DisplayName'] = STR_DEBUG_ULTRADEBUG;
+ if ( $content['parser_debugmode'] == $content['DBGMODES'][0]['DisplayName'] ) { $content['DBGMODES'][0]['selected'] = "selected"; } else { $content['DBGMODES'][0]['selected'] = ""; }
+ $content['DBGMODES'][1]['DisplayName'] = STR_DEBUG_DEBUG;
+ if ( $content['parser_debugmode'] == $content['DBGMODES'][1]['DisplayName'] ) { $content['DBGMODES'][1]['selected'] = "selected"; } else { $content['DBGMODES'][1]['selected'] = ""; }
+ $content['DBGMODES'][2]['DisplayName'] = STR_DEBUG_INFO;
+ if ( $content['parser_debugmode'] == $content['DBGMODES'][2]['DisplayName'] ) { $content['DBGMODES'][2]['selected'] = "selected"; } else { $content['DBGMODES'][2]['selected'] = ""; }
+ $content['DBGMODES'][3]['DisplayName'] = STR_DEBUG_WARN;
+ if ( $content['parser_debugmode'] == $content['DBGMODES'][3]['DisplayName'] ) { $content['DBGMODES'][3]['selected'] = "selected"; } else { $content['DBGMODES'][3]['selected'] = ""; }
+ $content['DBGMODES'][4]['DisplayName'] = STR_DEBUG_ERROR;
+ if ( $content['parser_debugmode'] == $content['DBGMODES'][4]['DisplayName'] ) { $content['DBGMODES'][4]['selected'] = "selected"; } else { $content['DBGMODES'][4]['selected'] = ""; }
+}
+
+function InitFrontEndVariables()
+{
+ global $content;
+
+ $content['MENU_FOLDER_OPEN'] = $content['BASEPATH'] . "images/icons/folder_closed.png";
+ $content['MENU_FOLDER_CLOSED'] = $content['BASEPATH'] . "images/icons/folder.png";
+ $content['MENU_HOMEPAGE'] = $content['BASEPATH'] . "images/icons/home.png";
+ $content['MENU_LINK'] = $content['BASEPATH'] . "images/icons/link.png";
+ $content['MENU_LINK_VIEW'] = $content['BASEPATH'] . "images/icons/link_view.png";
+ $content['MENU_VIEW'] = $content['BASEPATH'] . "images/icons/view.png";
+ $content['MENU_PREFERENCES'] = $content['BASEPATH'] . "images/icons/preferences.png";
+ $content['MENU_ADMINENTRY'] = $content['BASEPATH'] . "images/icons/star_blue.png";
+ $content['MENU_ADMINLOGOFF'] = $content['BASEPATH'] . "images/icons/exit.png";
+ $content['MENU_ADMINUSERS'] = $content['BASEPATH'] . "images/icons/businessmen.png";
+ $content['MENU_SEARCH'] = $content['BASEPATH'] . "images/icons/view.png";
+ $content['MENU_SELECTION_DISABLED'] = $content['BASEPATH'] . "images/icons/selection.png";
+ $content['MENU_SELECTION_ENABLED'] = $content['BASEPATH'] . "images/icons/selection_delete.png";
+ $content['MENU_TEXT_FIND'] = $content['BASEPATH'] . "images/icons/text_find.png";
+
+ $content['MENU_PAGER_BEGIN'] = $content['BASEPATH'] . "images/icons/media_beginning.png";
+ $content['MENU_PAGER_PREVIOUS'] = $content['BASEPATH'] . "images/icons/media_rewind.png";
+ $content['MENU_PAGER_NEXT'] = $content['BASEPATH'] . "images/icons/media_fast_forward.png";
+ $content['MENU_PAGER_END'] = $content['BASEPATH'] . "images/icons/media_end.png";
+ $content['MENU_NAV_LEFT'] = $content['BASEPATH'] . "images/icons/navigate_left.png";
+ $content['MENU_NAV_RIGHT'] = $content['BASEPATH'] . "images/icons/navigate_right.png";
+ $content['MENU_NAV_CLOSE'] = $content['BASEPATH'] . "images/icons/navigate_close.png";
+ $content['MENU_NAV_OPEN'] = $content['BASEPATH'] . "images/icons/navigate_open.png";
+ $content['MENU_PAGER_BEGIN_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_beginning.png";
+ $content['MENU_PAGER_PREVIOUS_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_rewind.png";
+ $content['MENU_PAGER_NEXT_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_fast_forward.png";
+ $content['MENU_PAGER_END_GREY'] = $content['BASEPATH'] . "images/icons/grey/media_end.png";
+
+ $content['MENU_BULLET_BLUE'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_blue.png";
+ $content['MENU_BULLET_GREEN'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_green.png";
+ $content['MENU_BULLET_RED'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_red.png";
+ $content['MENU_BULLET_YELLOW'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_yellow.png";
+ $content['MENU_BULLET_GREY'] = $content['BASEPATH'] . "images/icons/bullet_ball_glass_grey.png";
+}
+
+// Lang Helper for Strings with ONE variable
+function GetAndReplaceLangStr( $strlang, $param1 = "", $param2 = "", $param3 = "", $param4 = "", $param5 = "" )
+{
+ $strfinal = str_replace ( "%1", $param1, $strlang );
+ if ( strlen($param2) > 0 )
+ $strfinal = str_replace ( "%1", $param2, $strfinal );
+ if ( strlen($param3) > 0 )
+ $strfinal = str_replace ( "%1", $param3, $strfinal );
+ if ( strlen($param4) > 0 )
+ $strfinal = str_replace ( "%1", $param4, $strfinal );
+ if ( strlen($param5) > 0 )
+ $strfinal = str_replace ( "%1", $param5, $strfinal );
+
+ // And return
+ return $strfinal;
+}
+
+function InitConfigurationValues()
+{
+ global $content, $CFG, $LANG, $gl_root_path;
+
+ // If Database is enabled, try to read from database!
+ if ( $CFG['UserDBEnabled'] )
+ {
+ $result = DB_Query("SELECT * FROM " . DB_CONFIG);
+ $rows = DB_GetAllRows($result, true, true);
+
+ if ( isset($rows ) )
+ {
+ for($i = 0; $i < count($rows); $i++)
+ $content[ $rows[$i]['name'] ] = $rows[$i]['value'];
+ }
+ // General defaults
+ // --- Language Handling
+ if ( !isset($content['gen_lang']) ) { $content['gen_lang'] = $CFG['ViewDefaultLanguage'] /*"en"*/; }
+
+ // --- PHP Debug Mode
+ if ( !isset($content['gen_phpdebug']) ) { $content['gen_phpdebug'] = "no"; }
+ // ---
+
+ // Database Version Checker!
+ if ( $content['database_internalversion'] > $content['database_installedversion'] )
+ {
+ // Database is out of date, we need to upgrade
+ $content['database_forcedatabaseupdate'] = "yes";
+ }
+ }
+ else
+ {
+ // --- Set Defaults...
+ // Language Handling
+ if ( isset($_SESSION['CUSTOM_LANG']) && VerifyLanguage($_SESSION['CUSTOM_LANG']) )
+ {
+ $content['user_lang'] = $_SESSION['CUSTOM_LANG'];
+ $LANG = $content['user_lang'];
+ }
+ else if ( isset($content['gen_lang']) && VerifyLanguage($content['gen_lang']))
+ {
+ $content['user_lang'] = $content['gen_lang'];
+ $LANG = $content['user_lang'];
+ }
+ else // Failsave!
+ {
+ $content['user_lang'] = $CFG['ViewDefaultLanguage'] /*"en"*/;
+ $LANG = $content['user_lang'];
+ $content['gen_lang'] = $content['user_lang'];
+ }
+ }
+
+ // Paging Size handling!
+ if ( !isset($_SESSION['PAGESIZE_ID']) )
+ {
+ // Default is 0!
+ $_SESSION['PAGESIZE_ID'] = 0;
+ }
+
+ // Auto reload handling!
+ if ( !isset($_SESSION['AUTORELOAD_ID']) )
+ {
+ if ( isset($CFG['ViewEnableAutoReloadSeconds']) && $CFG['ViewEnableAutoReloadSeconds'] > 0 )
+ $_SESSION['AUTORELOAD_ID'] = 1; // Autoreload ID will be the first item!
+ else // Default is 0, which means auto reload disabled
+ $_SESSION['AUTORELOAD_ID'] = 0;
+ }
+
+ // Theme Handling
+ if ( !isset($content['web_theme']) ) { $content['web_theme'] = $CFG['ViewDefaultTheme'] /*"default"*/; }
+ if ( isset($_SESSION['CUSTOM_THEME']) && VerifyTheme($_SESSION['CUSTOM_THEME']) )
+ $content['user_theme'] = $_SESSION['CUSTOM_THEME'];
+ else
+ $content['user_theme'] = $content['web_theme'];
+
+ //Init Theme About Info ^^
+ InitThemeAbout($content['user_theme']);
+ // ---
+
+ // Init main langauge file now!
+ IncludeLanguageFile( $gl_root_path . '/lang/' . $LANG . '/main.php' );
+
+ // Init other things which are needed
+ InitFrontEndVariables();
+}
+
+function SetDebugModeFromString( $facility )
+{
+ global $DEBUGMODE;
+
+ switch ( $facility )
+ {
+ case STR_DEBUG_ULTRADEBUG:
+ $DEBUGMODE = DEBUG_ULTRADEBUG;
+ break;
+ case STR_DEBUG_DEBUG:
+ $DEBUGMODE = DEBUG_DEBUG;
+ break;
+ case STR_DEBUG_INFO:
+ $DEBUGMODE = DEBUG_INFO;
+ break;
+ case STR_DEBUG_WARN:
+ $DEBUGMODE = DEBUG_WARN;
+ break;
+ case STR_DEBUG_ERROR:
+ $DEBUGMODE = DEBUG_ERROR;
+ break;
+ }
+}
+
+
+function InitPageRenderStats()
+{
+ global $gl_starttime, $querycount;
+ $gl_starttime = microtime_float();
+ $querycount = 0;
+}
+
+function FinishPageRenderStats( &$mycontent)
+{
+ global $gl_starttime, $querycount;
+
+ $endtime = microtime_float();
+ $mycontent['PAGERENDERTIME'] = number_format($endtime - $gl_starttime, 4, '.', '');
+ $mycontent['TOTALQUERIES'] = $querycount;
+}
+
+function microtime_float()
+{
+ list($usec, $sec) = explode(" ", microtime());
+ return ((float)$usec + (float)$sec);
+}
+
+function SetLineBreakVar()
+{
+ // Used for some functions
+ global $RUNMODE, $linesep;
+
+ if ( $RUNMODE == RUNMODE_COMMANDLINE )
+ $linesep = "\r\n";
+ else if ( $RUNMODE == RUNMODE_WEBSERVER )
+ $linesep = " ";
+}
+
+function CheckUrlOrIP($ip)
+{
+ $long = ip2long($ip);
+ if ( $long == -1 )
+ return false;
+ else
+ return true;
+}
+
+function DieWithErrorMsg( $szerrmsg )
+{
+ global $content;
+ print(" ");
+ print("Critical Error occured ");
+ print("Errordetails: " . $szerrmsg);
+ print("
");
+
+ exit;
+}
+
+function DieWithFriendlyErrorMsg( $szerrmsg )
+{
+ //TODO: Make with template
+ print("");
+ print("Error occured ");
+ print("Errordetails: " . $szerrmsg);
+ exit;
+}
+
+/*
+* Helper function to initialize the page title!
+*/
+function InitPageTitle()
+{
+ global $content, $CFG, $currentSourceID;
+
+ if ( isset($CFG['PrependTitle']) && strlen($CFG['PrependTitle']) > 0 )
+ $szReturn = $CFG['PrependTitle'] . " :: ";
+ else
+ $szReturn = "";
+
+ if ( isset($currentSourceID) && isset($content['Sources'][$currentSourceID]['Name']) )
+ $szReturn .= "Source '" . $content['Sources'][$currentSourceID]['Name'] . "' :: ";
+
+ // Append phpLogCon
+ $szReturn .= "phpLogCon";
+
+ // return result
+ return $szReturn;
+}
+
+
+function GetStringWithHTMLCodes($myStr)
+{
+ // Replace all special characters with valid html representations
+ return htmlentities($myStr);
+}
+
+function InitTemplateParser()
+{
+ global $page, $gl_root_path;
+ // -----------------------------------------------
+ // Create Template Object and set some variables for the templates
+ // -----------------------------------------------
+ $page = new Template();
+ $page -> set_path ( $gl_root_path . "templates/" );
+}
+
+function VerifyLanguage( $mylang )
+{
+ global $gl_root_path;
+
+ if ( is_dir( $gl_root_path . 'lang/' . $mylang ) )
+ return true;
+ else
+ return false;
+}
+
+function IncludeLanguageFile( $langfile )
+{
+ global $LANG, $LANG_EN;
+
+ if ( file_exists( $langfile ) )
+ include( $langfile );
+ else
+ {
+ $langfile = str_replace( $LANG, $LANG_EN, $langfile );
+ include( $langfile );
+ }
+}
+
+function RedirectPage( $newpage )
+{
+ header("Location: $newpage");
+ exit;
+}
+
+function RedirectResult( $szMsg, $newpage )
+{
+ header("Location: result.php?msg=" . urlencode($szMsg) . "&redir=" . urlencode($newpage));
+ exit;
+}
+
+/*
+* GetEventTime
+*
+* Helper function to parse and obtain a valid EventTime Array from the input string.
+* Return value: EventTime Array!
+*
+*/
+function GetEventTime($szTimStr)
+{
+ // Sample: Mar 10 14:45:44
+ if ( preg_match("/(...) ([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) )
+ {
+ // RFC 3164 typical timestamp
+ $eventtime[EVTIME_TIMESTAMP] = mktime($out[3], $out[4], $out[5], GetMonthFromString($out[1]), $out[2]);
+ $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO!
+ $eventtime[EVTIME_MICROSECONDS] = 0;
+
+// echo gmdate(DATE_RFC822, $eventtime[EVTIME_TIMESTAMP]) . " ";
+// print_r ( $eventtime );
+// exit;
+ }
+ // Sample: 2008-04-02T11:12:32+02:00
+ else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\+([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) )
+ {
+ // RFC 3164 typical timestamp
+ $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]);
+ $eventtime[EVTIME_TIMEZONE] = $out[7];
+ $eventtime[EVTIME_MICROSECONDS] = 0;
+ }
+ // Sample: 2008-04-02T11:12:32.380449+02:00
+ else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\.([0-9]{1,6})\+([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) )
+ {
+ // RFC 3164 typical timestamp
+ $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]);
+ $eventtime[EVTIME_TIMEZONE] = $out[8];
+ $eventtime[EVTIME_MICROSECONDS] = $out[7];
+ }
+ // Sample: 2008-04-02,15:19:06
+ else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2}),([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) )
+ {
+ // RFC 3164 typical timestamp
+ $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]);
+ $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO!
+ $eventtime[EVTIME_MICROSECONDS] = 0;
+ }
+ // Sample: 2008-02-19 12:52:37
+ else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) )
+ {
+ // RFC 3164 typical timestamp
+ $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]);
+ $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO!
+ $eventtime[EVTIME_MICROSECONDS] = 0;
+ }
+ // Sample: 2007-4-18T00:00:00
+ else if ( preg_match("/([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})T([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $szTimStr, $out ) )
+ {
+ // RFC 3164 typical timestamp
+ $eventtime[EVTIME_TIMESTAMP] = mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]);
+ $eventtime[EVTIME_TIMEZONE] = date_default_timezone_get(); // WTF TODO!
+ $eventtime[EVTIME_MICROSECONDS] = 0;
+ }
+ else
+ {
+ die ("wtf GetEventTime unparsable time - " . $szTimStr );
+ }
+
+ // return result!
+ return $eventtime;
+}
+
+/*
+* GetMonthFromString
+*
+* Simple Helper function to obtain the numeric represantation of the month
+*/
+function GetMonthFromString($szMonth)
+{
+ switch($szMonth)
+ {
+ case "Jan":
+ return 1;
+ case "Feb":
+ return 2;
+ case "Mar":
+ return 3;
+ case "Apr":
+ return 4;
+ case "May":
+ return 5;
+ case "Jun":
+ return 6;
+ case "Jul":
+ return 7;
+ case "Aug":
+ return 8;
+ case "Sep":
+ return 9;
+ case "Oct":
+ return 10;
+ case "Nov":
+ return 11;
+ case "Dez":
+ return 12;
+ }
+}
+
+
+// --- BEGIN Usermanagement Function ---
+function StartPHPSession()
+{
+ global $RUNMODE;
+ if ( $RUNMODE == RUNMODE_WEBSERVER )
+ {
+ // This will start the session
+ if (session_id() == "")
+ session_start();
+
+ if ( !isset($_SESSION['SESSION_STARTED']) )
+ $_SESSION['SESSION_STARTED'] = "true";
+ }
+}
+
+function CheckForUserLogin( $isloginpage, $isUpgradePage = false )
+{
+ global $content;
+
+ if ( isset($_SESSION['SESSION_LOGGEDIN']) )
+ {
+ if ( !$_SESSION['SESSION_LOGGEDIN'] )
+ RedirectToUserLogin();
+ else
+ {
+ $content['SESSION_LOGGEDIN'] = "true";
+ $content['SESSION_USERNAME'] = $_SESSION['SESSION_USERNAME'];
+ }
+
+ // New, Check for database Version and may redirect to updatepage!
+ if ( isset($content['database_forcedatabaseupdate']) &&
+ $content['database_forcedatabaseupdate'] == "yes" &&
+ $isUpgradePage == false
+ )
+ RedirectToDatabaseUpgrade();
+ }
+ else
+ {
+ if ( $isloginpage == false )
+ RedirectToUserLogin();
+ }
+
+}
+
+function CreateUserName( $username, $password, $access_level )
+{
+ $md5pass = md5($password);
+ $result = DB_Query("SELECT username FROM " . STATS_USERS . " WHERE username = '" . $username . "'");
+ $rows = DB_GetAllRows($result, true);
+ if ( isset($rows) )
+ {
+ DieWithFriendlyErrorMsg( "User $username already exists!" );
+
+ // User not created!
+ return false;
+ }
+ else
+ {
+ // Create User
+ $result = DB_Query("INSERT INTO " . STATS_USERS . " (username, password, access_level) VALUES ('$username', '$md5pass', $access_level)");
+ DB_FreeQuery($result);
+
+ // Success
+ return true;
+ }
+}
+
+function CheckUserLogin( $username, $password )
+{
+ global $content, $CFG;
+
+ // TODO: SessionTime and AccessLevel check
+
+ $md5pass = md5($password);
+ $sqlselect = "SELECT access_level FROM " . STATS_USERS . " WHERE username = '" . $username . "' and password = '" . $md5pass . "'";
+ $result = DB_Query($sqlselect);
+ $rows = DB_GetAllRows($result, true);
+ if ( isset($rows) )
+ {
+ $_SESSION['SESSION_LOGGEDIN'] = true;
+ $_SESSION['SESSION_USERNAME'] = $username;
+ $_SESSION['SESSION_ACCESSLEVEL'] = $rows[0]['access_level'];
+
+ $content['SESSION_LOGGEDIN'] = "true";
+ $content['SESSION_USERNAME'] = $username;
+
+ // Success !
+ return true;
+ }
+ else
+ {
+ if ( $CFG['MiscShowDebugMsg'] == 1 )
+ DieWithFriendlyErrorMsg( "Debug Error: Could not login user '" . $username . "' Sessionarray " . var_export($_SESSION, true) . " SQL Statement : " . $sqlselect );
+
+ // Default return false
+ return false;
+ }
+}
+
+function DoLogOff()
+{
+ global $content;
+
+ unset( $_SESSION['SESSION_LOGGEDIN'] );
+ unset( $_SESSION['SESSION_USERNAME'] );
+ unset( $_SESSION['SESSION_ACCESSLEVEL'] );
+
+ // Redir to Index Page
+ RedirectPage( "index.php");
+}
+
+function RedirectToUserLogin()
+{
+ // TODO Referer
+ header("Location: login.php?referer=" . $_SERVER['PHP_SELF']);
+ exit;
+}
+
+function RedirectToDatabaseUpgrade()
+{
+ // TODO Referer
+ header("Location: upgrade.php"); // ?referer=" . $_SERVER['PHP_SELF']);
+ exit;
+}
+// --- END Usermanagement Function ---
+
+
+?>
\ No newline at end of file
diff --git a/src/include/functions_config.php b/src/include/functions_config.php
index cf83742..d37b7a6 100644
--- a/src/include/functions_config.php
+++ b/src/include/functions_config.php
@@ -1,148 +1,148 @@
- www.phplogcon.org <- *
- * ----------------------------------------------------------------- *
- * Maintain and read Source Configurations *
- * *
- * -> Configuration need variables for the Database connection *
- *
- * 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;
- }
- // ---
-
- // --- Perform necessary includes
- require_once($gl_root_path . 'classes/logstreamconfig.class.php');
- // ---
-
- function InitSourceConfigs()
- {
- global $CFG, $content, $currentSourceID, $gl_root_path;
-
- // Init Source Configs!
- if ( isset($CFG['Sources']) )
- {
- $iCount = count($CFG['Sources']);
- foreach( $CFG['Sources'] as &$mysource )
- {
- if ( isset($mysource['SourceType']) )
- {
- // Set Array Index, TODO: Check for invalid characters!
- $iSourceID = $mysource['ID'];
- // Copy general properties
-// $content['Sources'][$iSourceID]['ID'] = $mysource['ID'];
-// $content['Sources'][$iSourceID]['Name'] = $mysource['Name'];
-// $content['Sources'][$iSourceID]['SourceType'] = $mysource['SourceType'];
-
- // Set default if not set!
- if ( !isset($mysource['LogLineType']) )
- $content['Sources'][$iSourceID]['LogLineType'] = "syslog";
-
- // Only for the display box
- $content['Sources'][$iSourceID]['selected'] = "";
-
- // Create Config instance!
- if ( $mysource['SourceType'] == SOURCE_DISK )
- {
- // Perform necessary include
- require_once($gl_root_path . 'classes/logstreamconfigdisk.class.php');
-
- $content['Sources'][$iSourceID]['ObjRef'] = new LogStreamConfigDisk();
- $content['Sources'][$iSourceID]['ObjRef']->FileName = $mysource['DiskFile'];
- $content['Sources'][$iSourceID]['ObjRef']->LineParserType = $mysource['LogLineType'];
- }
- else if ( $mysource['SourceType'] == SOURCE_DB )
- {
- // Perform necessary include
- require_once($gl_root_path . 'classes/logstreamconfigdb.class.php');
-
- $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'];
- $content['Sources'][$iSourceID]['ObjRef']->DBTableName = $mysource['DBTableName'];
-
- // Legacy handling for tabletype!
- if ( isset($mysource['DBTableType']) && strtolower($mysource['DBTableType']) == "winsyslog" )
- $content['Sources'][$iSourceID]['ObjRef']->DBTableType = "monitorware"; // Convert to MonitorWare!
- else
- $content['Sources'][$iSourceID]['ObjRef']->DBTableType = strtolower($mysource['DBTableType']);
-
- // Optional parameters!
- if ( isset($mysource['DBPort']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBPort = $mysource['DBPort']; }
- if ( isset($mysource['DBUser']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBUser = $mysource['DBUser']; }
- if ( isset($mysource['DBPassword']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBPassword = $mysource['DBPassword']; }
- if ( isset($mysource['DBEnableRowCounting']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBEnableRowCounting = $mysource['DBEnableRowCounting']; }
- }
- else
- {
- // UNKNOWN, remove config entry!
- unset($content['Sources'][$iSourceID]);
-
- // TODO: Output CONFIG WARNING
- die( "Not supported yet!" );
- }
-
- // Set generic configuration options
- $content['Sources'][$iSourceID]['ObjRef']->_pageCount = $CFG['ViewEntriesPerPage'];
-
- // Set default SourceID here!
- if ( isset($content['Sources'][$iSourceID]) && !isset($currentSourceID) )
- $currentSourceID = $iSourceID;
- }
- }
- }
-
- // Read SourceID from GET Querystring
- if ( isset($_GET['sourceid']) && isset($content['Sources'][$_GET['sourceid']]) )
- {
- $currentSourceID = $_GET['sourceid'];
- $_SESSION['currentSourceID'] = $currentSourceID;
- }
- else
- {
- // Set Source from session if available!
- if ( isset($_SESSION['currentSourceID']) && isset($content['Sources'][$_SESSION['currentSourceID']]) )
- $currentSourceID = $_SESSION['currentSourceID'];
- else
- {
- 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";
- }
-
-?>
+ www.phplogcon.org <- *
+ * ----------------------------------------------------------------- *
+ * Maintain and read Source Configurations *
+ * *
+ * -> Configuration need variables for the Database connection *
+ *
+ * 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;
+ }
+ // ---
+
+ // --- Perform necessary includes
+ require_once($gl_root_path . 'classes/logstreamconfig.class.php');
+ // ---
+
+ function InitSourceConfigs()
+ {
+ global $CFG, $content, $currentSourceID, $gl_root_path;
+
+ // Init Source Configs!
+ if ( isset($CFG['Sources']) )
+ {
+ $iCount = count($CFG['Sources']);
+ foreach( $CFG['Sources'] as &$mysource )
+ {
+ if ( isset($mysource['SourceType']) )
+ {
+ // Set Array Index, TODO: Check for invalid characters!
+ $iSourceID = $mysource['ID'];
+ // Copy general properties
+// $content['Sources'][$iSourceID]['ID'] = $mysource['ID'];
+// $content['Sources'][$iSourceID]['Name'] = $mysource['Name'];
+// $content['Sources'][$iSourceID]['SourceType'] = $mysource['SourceType'];
+
+ // Set default if not set!
+ if ( !isset($mysource['LogLineType']) )
+ $content['Sources'][$iSourceID]['LogLineType'] = "syslog";
+
+ // Only for the display box
+ $content['Sources'][$iSourceID]['selected'] = "";
+
+ // Create Config instance!
+ if ( $mysource['SourceType'] == SOURCE_DISK )
+ {
+ // Perform necessary include
+ require_once($gl_root_path . 'classes/logstreamconfigdisk.class.php');
+
+ $content['Sources'][$iSourceID]['ObjRef'] = new LogStreamConfigDisk();
+ $content['Sources'][$iSourceID]['ObjRef']->FileName = $mysource['DiskFile'];
+ $content['Sources'][$iSourceID]['ObjRef']->LineParserType = $mysource['LogLineType'];
+ }
+ else if ( $mysource['SourceType'] == SOURCE_DB )
+ {
+ // Perform necessary include
+ require_once($gl_root_path . 'classes/logstreamconfigdb.class.php');
+
+ $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'];
+ $content['Sources'][$iSourceID]['ObjRef']->DBTableName = $mysource['DBTableName'];
+
+ // Legacy handling for tabletype!
+ if ( isset($mysource['DBTableType']) && strtolower($mysource['DBTableType']) == "winsyslog" )
+ $content['Sources'][$iSourceID]['ObjRef']->DBTableType = "monitorware"; // Convert to MonitorWare!
+ else
+ $content['Sources'][$iSourceID]['ObjRef']->DBTableType = strtolower($mysource['DBTableType']);
+
+ // Optional parameters!
+ if ( isset($mysource['DBPort']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBPort = $mysource['DBPort']; }
+ if ( isset($mysource['DBUser']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBUser = $mysource['DBUser']; }
+ if ( isset($mysource['DBPassword']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBPassword = $mysource['DBPassword']; }
+ if ( isset($mysource['DBEnableRowCounting']) ) { $content['Sources'][$iSourceID]['ObjRef']->DBEnableRowCounting = $mysource['DBEnableRowCounting']; }
+ }
+ else
+ {
+ // UNKNOWN, remove config entry!
+ unset($content['Sources'][$iSourceID]);
+
+ // TODO: Output CONFIG WARNING
+ die( "Not supported yet!" );
+ }
+
+ // Set generic configuration options
+ $content['Sources'][$iSourceID]['ObjRef']->_pageCount = $CFG['ViewEntriesPerPage'];
+
+ // Set default SourceID here!
+ if ( isset($content['Sources'][$iSourceID]) && !isset($currentSourceID) )
+ $currentSourceID = $iSourceID;
+ }
+ }
+ }
+
+ // Read SourceID from GET Querystring
+ if ( isset($_GET['sourceid']) && isset($content['Sources'][$_GET['sourceid']]) )
+ {
+ $currentSourceID = $_GET['sourceid'];
+ $_SESSION['currentSourceID'] = $currentSourceID;
+ }
+ else
+ {
+ // Set Source from session if available!
+ if ( isset($_SESSION['currentSourceID']) && isset($content['Sources'][$_SESSION['currentSourceID']]) )
+ $currentSourceID = $_SESSION['currentSourceID'];
+ else
+ {
+ 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";
+ }
+
+?>
\ No newline at end of file
diff --git a/src/include/functions_db.php b/src/include/functions_db.php
index ce89485..b2e0283 100644
--- a/src/include/functions_db.php
+++ b/src/include/functions_db.php
@@ -1,340 +1,340 @@
- www.phplogcon.org <- *
- * ----------------------------------------------------------------- *
- * DB Function Helper File *
- * *
- * -> Needed to establish and maintain the DB connetion *
- * *
- * 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;
-}
-// ---
-
-
-$link_id = 0;
-$errdesc = "";
-$errno = 0;
-
-// --- Current Database Version, this is important for automated database Updates!
-$content['database_internalversion'] = "1"; // Whenever incremented, a database upgrade is needed
-$content['database_installedversion'] = "0"; // 0 is default which means Prior Versioning Database
-// ---
-
-function DB_Connect()
-{
- global $link_id, $CFG;
-
- //TODO: Check variables first
- $link_id = mysql_connect($CFG['DBServer'],$CFG['User'],$CFG['Pass']);
- if (!$link_id)
- DB_PrintError("Link-ID == false, connect to ".$CFG['DBServer']." failed", true);
-
- // --- Now, check Mysql DB Version!
- $strmysqlver = mysql_get_server_info();
- if ( strpos($strmysqlver, "-") !== false )
- {
- $sttmp = explode("-", $strmysqlver );
- $szVerInfo = $sttmp[0];
- }
- else
- $szVerInfo = $strmysqlver;
-
- $szVerSplit = explode(".", $szVerInfo );
-
- //Now check for Major Version
- if ( $szVerSplit[0] <= 3 )
- {
- //Unfortunatelly MYSQL 3.x is NOT Supported dude!
- DieWithFriendlyErrorMsg( "You are running an MySQL 3.x Database Server Version. Unfortunately MySQL 3.x is NOT supported by PhpLogCon due the limited SQL Statement support. If this is a commercial webspace, contact your webhoster in order to upgrade to a higher MySQL Database Version. If this is your own rootserver, consider updating your MySQL Server.");
- }
- // ---
-
- $db_selected = mysql_select_db($CFG['DBName'], $link_id);
- if(!$db_selected)
- DB_PrintError("Cannot use database '" . $CFG['DBName'] . "'", true);
- // :D Success connecting to db
-}
-
-function DB_Disconnect()
-{
- global $link_id;
- mysql_close($link_id);
-}
-
-function DB_Query($query_string, $bProcessError = true, $bCritical = false)
-{
- // --- Abort in this case!
- global $CFG;
- if ( $CFG['UserDBEnabled'] == false )
- return;
- // ---
-
- global $link_id, $querycount;
- $query_id = mysql_query($query_string,$link_id);
- if (!$query_id && $bProcessError)
- DB_PrintError("Invalid SQL: ".$query_string, $bCritical);
-
- // For the Stats ;)
- $querycount++;
-
- return $query_id;
-}
-
-function DB_FreeQuery($query_id)
-{
- // --- Abort in this case!
- global $CFG;
- if ( $CFG['UserDBEnabled'] == false )
- return;
- // ---
-
- if ($query_id != false && $query_id != 1 )
- mysql_free_result($query_id);
-}
-
-function DB_GetRow($query_id)
-{
- // --- Abort in this case!
- global $CFG;
- if ( $CFG['UserDBEnabled'] == false )
- return;
- // ---
-
- $tmp = mysql_fetch_row($query_id);
- $results[] = $tmp;
- return $results[0];
-}
-
-function DB_GetSingleRow($query_id, $bClose)
-{
- // --- Abort in this case!
- global $CFG;
- if ( $CFG['UserDBEnabled'] == false )
- return;
- // ---
-
- if ($query_id != false && $query_id != 1 )
- {
- $row = mysql_fetch_array($query_id, MYSQL_ASSOC);
-
- if ( $bClose )
- DB_FreeQuery ($query_id);
-
- if ( isset($row) )
- {
- // Return array
- return $row;
- }
- else
- return;
- }
-}
-
-function DB_GetAllRows($query_id, $bClose)
-{
- // --- Abort in this case!
- global $CFG;
- if ( $CFG['UserDBEnabled'] == false )
- return;
- // ---
-
- if ($query_id != false && $query_id != 1 )
- {
- while ($row = mysql_fetch_array($query_id, MYSQL_ASSOC))
- $var[] = $row;
-
- if ( $bClose )
- DB_FreeQuery ($query_id);
-
- if ( isset($var) )
- {
- // Return array
- return $var;
- }
- else
- return;
- }
-}
-
-function DB_GetMysqlStats()
-{
- // --- Abort in this case!
- global $CFG;
- if ( $CFG['UserDBEnabled'] == false )
- return;
- // ---
-
- global $link_id;
- $status = explode(' ', mysql_stat($link_id));
- return $status;
-}
-
-function DB_ReturnSimpleErrorMsg()
-{
- // Return Mysql Error
- return "Mysql Error " . mysql_errno() . " - Description: " . mysql_error();
-}
-
-function DB_PrintError($MyErrorMsg, $DieOrNot)
-{
- global $n,$HTTP_COOKIE_VARS, $errdesc, $errno, $linesep, $CFG;
-
- $errdesc = mysql_error();
- $errno = mysql_errno();
-
- $errormsg="Database error: $MyErrorMsg $linesep";
- $errormsg.="mysql error: $errdesc $linesep";
- $errormsg.="mysql error number: $errno $linesep";
- $errormsg.="Date: ".date("d.m.Y @ H:i").$linesep;
- $errormsg.="Script: ".getenv("REQUEST_URI").$linesep;
- $errormsg.="Referer: ".getenv("HTTP_REFERER").$linesep;
-
- if ($DieOrNot == true)
- DieWithErrorMsg( "$linesep" . $errormsg );
- else
- echo $errormsg;
-}
-
-function DB_RemoveParserSpecialBadChars($myString)
-{
-// DO NOT REPLACD! $returnstr = str_replace("\\","\\\\",$myString);
- $returnstr = str_replace("'","\\'",$myString);
- return $returnstr;
-}
-
-function DB_RemoveBadChars($myString)
-{
- $returnstr = str_replace("\\","\\\\",$myString);
- $returnstr = str_replace("'","\\'",$returnstr);
- return $returnstr;
-}
-
-function DB_GetRowCount($query)
-{
- // --- Abort in this case!
- global $CFG;
- if ( $CFG['UserDBEnabled'] == false )
- return;
- // ---
-
- if ($result = mysql_query($query))
- {
- $num_rows = mysql_num_rows($result);
- mysql_free_result ($result);
- }
- return $num_rows;
-}
-
-function DB_GetRowCountByResult($myresult)
-{
- // --- Abort in this case!
- global $CFG;
- if ( $CFG['UserDBEnabled'] == false )
- return;
- // ---
-
- if ($myresult)
- return mysql_num_rows($myresult);
-}
-
-function DB_Exec($query)
-{
- // --- Abort in this case!
- global $CFG;
- if ( $CFG['UserDBEnabled'] == false )
- return;
- // ---
-
- if(mysql_query($query))
- return true;
- else
- return false;
-}
-
-function WriteConfigValue($szValue)
-{
- // --- Abort in this case!
- global $CFG;
- if ( $CFG['UserDBEnabled'] == false )
- return;
- // ---
-
- global $content;
-
- $result = DB_Query("SELECT name FROM " . STATS_CONFIG . " WHERE name = '" . $szValue . "'");
- $rows = DB_GetAllRows($result, true);
- if ( !isset($rows) )
- {
- // New Entry
- $result = DB_Query("INSERT INTO " . STATS_CONFIG . " (name, value) VALUES ( '" . $szValue . "', '" . $content[$szValue] . "')");
- DB_FreeQuery($result);
- }
- else
- {
- // Update Entry
- $result = DB_Query("UPDATE " . STATS_CONFIG . " SET value = '" . $content[$szValue] . "' WHERE name = '" . $szValue . "'");
- DB_FreeQuery($result);
- }
-}
-
-function GetSingleDBEntryOnly( $myqry )
-{
- // --- Abort in this case!
- global $CFG;
- if ( $CFG['UserDBEnabled'] == false )
- return;
- // ---
-
- $result = DB_Query( $myqry );
- $row = DB_GetRow($result);
- DB_FreeQuery ($query_id);
-
- if ( isset($row) )
- return $row[0];
- else
- return -1;
-}
-
-function GetRowsAffected()
-{
- // --- Abort in this case!
- global $CFG;
- if ( $CFG['UserDBEnabled'] == false )
- return;
- // ---
-
- return mysql_affected_rows();
-}
-
-
-
-?>
+ www.phplogcon.org <- *
+ * ----------------------------------------------------------------- *
+ * DB Function Helper File *
+ * *
+ * -> Needed to establish and maintain the DB connetion *
+ * *
+ * 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;
+}
+// ---
+
+
+$link_id = 0;
+$errdesc = "";
+$errno = 0;
+
+// --- Current Database Version, this is important for automated database Updates!
+$content['database_internalversion'] = "1"; // Whenever incremented, a database upgrade is needed
+$content['database_installedversion'] = "0"; // 0 is default which means Prior Versioning Database
+// ---
+
+function DB_Connect()
+{
+ global $link_id, $CFG;
+
+ //TODO: Check variables first
+ $link_id = mysql_connect($CFG['DBServer'],$CFG['User'],$CFG['Pass']);
+ if (!$link_id)
+ DB_PrintError("Link-ID == false, connect to ".$CFG['DBServer']." failed", true);
+
+ // --- Now, check Mysql DB Version!
+ $strmysqlver = mysql_get_server_info();
+ if ( strpos($strmysqlver, "-") !== false )
+ {
+ $sttmp = explode("-", $strmysqlver );
+ $szVerInfo = $sttmp[0];
+ }
+ else
+ $szVerInfo = $strmysqlver;
+
+ $szVerSplit = explode(".", $szVerInfo );
+
+ //Now check for Major Version
+ if ( $szVerSplit[0] <= 3 )
+ {
+ //Unfortunatelly MYSQL 3.x is NOT Supported dude!
+ DieWithFriendlyErrorMsg( "You are running an MySQL 3.x Database Server Version. Unfortunately MySQL 3.x is NOT supported by PhpLogCon due the limited SQL Statement support. If this is a commercial webspace, contact your webhoster in order to upgrade to a higher MySQL Database Version. If this is your own rootserver, consider updating your MySQL Server.");
+ }
+ // ---
+
+ $db_selected = mysql_select_db($CFG['DBName'], $link_id);
+ if(!$db_selected)
+ DB_PrintError("Cannot use database '" . $CFG['DBName'] . "'", true);
+ // :D Success connecting to db
+}
+
+function DB_Disconnect()
+{
+ global $link_id;
+ mysql_close($link_id);
+}
+
+function DB_Query($query_string, $bProcessError = true, $bCritical = false)
+{
+ // --- Abort in this case!
+ global $CFG;
+ if ( $CFG['UserDBEnabled'] == false )
+ return;
+ // ---
+
+ global $link_id, $querycount;
+ $query_id = mysql_query($query_string,$link_id);
+ if (!$query_id && $bProcessError)
+ DB_PrintError("Invalid SQL: ".$query_string, $bCritical);
+
+ // For the Stats ;)
+ $querycount++;
+
+ return $query_id;
+}
+
+function DB_FreeQuery($query_id)
+{
+ // --- Abort in this case!
+ global $CFG;
+ if ( $CFG['UserDBEnabled'] == false )
+ return;
+ // ---
+
+ if ($query_id != false && $query_id != 1 )
+ mysql_free_result($query_id);
+}
+
+function DB_GetRow($query_id)
+{
+ // --- Abort in this case!
+ global $CFG;
+ if ( $CFG['UserDBEnabled'] == false )
+ return;
+ // ---
+
+ $tmp = mysql_fetch_row($query_id);
+ $results[] = $tmp;
+ return $results[0];
+}
+
+function DB_GetSingleRow($query_id, $bClose)
+{
+ // --- Abort in this case!
+ global $CFG;
+ if ( $CFG['UserDBEnabled'] == false )
+ return;
+ // ---
+
+ if ($query_id != false && $query_id != 1 )
+ {
+ $row = mysql_fetch_array($query_id, MYSQL_ASSOC);
+
+ if ( $bClose )
+ DB_FreeQuery ($query_id);
+
+ if ( isset($row) )
+ {
+ // Return array
+ return $row;
+ }
+ else
+ return;
+ }
+}
+
+function DB_GetAllRows($query_id, $bClose)
+{
+ // --- Abort in this case!
+ global $CFG;
+ if ( $CFG['UserDBEnabled'] == false )
+ return;
+ // ---
+
+ if ($query_id != false && $query_id != 1 )
+ {
+ while ($row = mysql_fetch_array($query_id, MYSQL_ASSOC))
+ $var[] = $row;
+
+ if ( $bClose )
+ DB_FreeQuery ($query_id);
+
+ if ( isset($var) )
+ {
+ // Return array
+ return $var;
+ }
+ else
+ return;
+ }
+}
+
+function DB_GetMysqlStats()
+{
+ // --- Abort in this case!
+ global $CFG;
+ if ( $CFG['UserDBEnabled'] == false )
+ return;
+ // ---
+
+ global $link_id;
+ $status = explode(' ', mysql_stat($link_id));
+ return $status;
+}
+
+function DB_ReturnSimpleErrorMsg()
+{
+ // Return Mysql Error
+ return "Mysql Error " . mysql_errno() . " - Description: " . mysql_error();
+}
+
+function DB_PrintError($MyErrorMsg, $DieOrNot)
+{
+ global $n,$HTTP_COOKIE_VARS, $errdesc, $errno, $linesep, $CFG;
+
+ $errdesc = mysql_error();
+ $errno = mysql_errno();
+
+ $errormsg="Database error: $MyErrorMsg $linesep";
+ $errormsg.="mysql error: $errdesc $linesep";
+ $errormsg.="mysql error number: $errno $linesep";
+ $errormsg.="Date: ".date("d.m.Y @ H:i").$linesep;
+ $errormsg.="Script: ".getenv("REQUEST_URI").$linesep;
+ $errormsg.="Referer: ".getenv("HTTP_REFERER").$linesep;
+
+ if ($DieOrNot == true)
+ DieWithErrorMsg( "$linesep" . $errormsg );
+ else
+ echo $errormsg;
+}
+
+function DB_RemoveParserSpecialBadChars($myString)
+{
+// DO NOT REPLACD! $returnstr = str_replace("\\","\\\\",$myString);
+ $returnstr = str_replace("'","\\'",$myString);
+ return $returnstr;
+}
+
+function DB_RemoveBadChars($myString)
+{
+ $returnstr = str_replace("\\","\\\\",$myString);
+ $returnstr = str_replace("'","\\'",$returnstr);
+ return $returnstr;
+}
+
+function DB_GetRowCount($query)
+{
+ // --- Abort in this case!
+ global $CFG;
+ if ( $CFG['UserDBEnabled'] == false )
+ return;
+ // ---
+
+ if ($result = mysql_query($query))
+ {
+ $num_rows = mysql_num_rows($result);
+ mysql_free_result ($result);
+ }
+ return $num_rows;
+}
+
+function DB_GetRowCountByResult($myresult)
+{
+ // --- Abort in this case!
+ global $CFG;
+ if ( $CFG['UserDBEnabled'] == false )
+ return;
+ // ---
+
+ if ($myresult)
+ return mysql_num_rows($myresult);
+}
+
+function DB_Exec($query)
+{
+ // --- Abort in this case!
+ global $CFG;
+ if ( $CFG['UserDBEnabled'] == false )
+ return;
+ // ---
+
+ if(mysql_query($query))
+ return true;
+ else
+ return false;
+}
+
+function WriteConfigValue($szValue)
+{
+ // --- Abort in this case!
+ global $CFG;
+ if ( $CFG['UserDBEnabled'] == false )
+ return;
+ // ---
+
+ global $content;
+
+ $result = DB_Query("SELECT name FROM " . STATS_CONFIG . " WHERE name = '" . $szValue . "'");
+ $rows = DB_GetAllRows($result, true);
+ if ( !isset($rows) )
+ {
+ // New Entry
+ $result = DB_Query("INSERT INTO " . STATS_CONFIG . " (name, value) VALUES ( '" . $szValue . "', '" . $content[$szValue] . "')");
+ DB_FreeQuery($result);
+ }
+ else
+ {
+ // Update Entry
+ $result = DB_Query("UPDATE " . STATS_CONFIG . " SET value = '" . $content[$szValue] . "' WHERE name = '" . $szValue . "'");
+ DB_FreeQuery($result);
+ }
+}
+
+function GetSingleDBEntryOnly( $myqry )
+{
+ // --- Abort in this case!
+ global $CFG;
+ if ( $CFG['UserDBEnabled'] == false )
+ return;
+ // ---
+
+ $result = DB_Query( $myqry );
+ $row = DB_GetRow($result);
+ DB_FreeQuery ($query_id);
+
+ if ( isset($row) )
+ return $row[0];
+ else
+ return -1;
+}
+
+function GetRowsAffected()
+{
+ // --- Abort in this case!
+ global $CFG;
+ if ( $CFG['UserDBEnabled'] == false )
+ return;
+ // ---
+
+ return mysql_affected_rows();
+}
+
+
+
+?>
diff --git a/src/include/functions_filters.php b/src/include/functions_filters.php
index 867a284..66ad2e6 100644
--- a/src/include/functions_filters.php
+++ b/src/include/functions_filters.php
@@ -1,270 +1,270 @@
- www.phplogcon.org <- *
- * ----------------------------------------------------------------- *
- * Filter Helper functions for the frontend *
- *
- * 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;
-}
-// ---
-
-// --- Perform necessary includes
-require_once($gl_root_path . 'include/constants_filters.php');
-// ---
-
-function InitFilterHelpers()
-{
- global $CFG, $content, $filters;
-
- // Init Default DateMode from SESSION!
- if ( isset($_SESSION['filter_datemode']) )
- $filters['filter_datemode'] = intval($_SESSION['filter_datemode']);
- else
- $filters['filter_datemode'] = DATEMODE_ALL;
-
- // Init TimeFilter Helper Array
- $content['datemodes'][0]['ID'] = DATEMODE_ALL;
- $content['datemodes'][0]['DisplayName'] = $content['LN_DATEMODE_ALL'];
- if ( $filters['filter_datemode'] == DATEMODE_ALL ) { $content['datemodes'][0]['selected'] = "selected"; } else { $content['datemodes'][0]['selected'] = ""; }
- $content['datemodes'][1]['ID'] = DATEMODE_RANGE;
- $content['datemodes'][1]['DisplayName'] = $content['LN_DATEMODE_RANGE'];
- if ( $filters['filter_datemode'] == DATEMODE_RANGE ) { $content['datemodes'][1]['selected'] = "selected"; } else { $content['datemodes'][1]['selected'] = ""; }
- $content['datemodes'][2]['ID'] = DATEMODE_LASTX;
- $content['datemodes'][2]['DisplayName'] = $content['LN_DATEMODE_LASTX'];
- if ( $filters['filter_datemode'] == DATEMODE_LASTX ) { $content['datemodes'][2]['selected'] = "selected"; } else { $content['datemodes'][2]['selected'] = ""; }
-
- // Init Date Range Parameters
- $currentTime = time();
- $currentDay = date("d", $currentTime);
- $currentMonth = date("m", $currentTime);
- $currentYear = date("Y", $currentTime);
-
- $tomorrowTime = time(); // + 86400; // Add one day!
- $tomorrowDay = date("d", $tomorrowTime);
- $tomorrowMonth = date("m", $tomorrowTime);
- $tomorrowYear = date("Y", $tomorrowTime);
-
- // Init Year, month and day array!
- for ( $i = $currentYear-5; $i <= $currentYear+5; $i++ )
- $content['years'][] = $i;
- for ( $i = 1; $i <= 12; $i++ )
- $content['months'][] = $i;
- for ( $i = 1; $i <= 31; $i++ )
- $content['days'][] = $i;
-
- // Init filter_daterange_from_year
- if ( isset($_SESSION['filter_daterange_from_year']) )
- $filters['filter_daterange_from_year'] = intval($_SESSION['filter_daterange_from_year']);
- else
- $filters['filter_daterange_from_year'] = $currentYear-1;
- FillDateRangeArray($content['years'], "filter_daterange_from_year_list", "filter_daterange_from_year");
-
- // Init filter_daterange_from_month
- if ( isset($_SESSION['filter_daterange_from_month']) )
- $filters['filter_daterange_from_month'] = intval($_SESSION['filter_daterange_from_month']);
- else
- $filters['filter_daterange_from_month'] = $currentMonth;
- FillDateRangeArray($content['months'], "filter_daterange_from_month_list", "filter_daterange_from_month");
-
- // Init filter_daterange_from_day
- if ( isset($_SESSION['filter_daterange_from_day']) )
- $filters['filter_daterange_from_day'] = intval($_SESSION['filter_daterange_from_day']);
- else
- $filters['filter_daterange_from_day'] = $currentDay;
- FillDateRangeArray($content['days'], "filter_daterange_from_day_list", "filter_daterange_from_day");
-
- // Init filter_daterange_to_year
- if ( isset($_SESSION['filter_daterange_to_year']) )
- $filters['filter_daterange_to_year'] = intval($_SESSION['filter_daterange_to_year']);
- else
- $filters['filter_daterange_to_year'] = $tomorrowYear;
- FillDateRangeArray($content['years'], "filter_daterange_to_year_list", "filter_daterange_to_year");
-
- // Init filter_daterange_to_month
- if ( isset($_SESSION['filter_daterange_to_month']) )
- $filters['filter_daterange_to_month'] = intval($_SESSION['filter_daterange_to_month']);
- else
- $filters['filter_daterange_to_month'] = $tomorrowMonth;
- FillDateRangeArray($content['months'], "filter_daterange_to_month_list", "filter_daterange_to_month");
-
- // Init filter_daterange_to_day
- if ( isset($_SESSION['filter_daterange_to_day']) )
- $filters['filter_daterange_to_day'] = intval($_SESSION['filter_daterange_to_day']);
- else
- $filters['filter_daterange_to_day'] = $tomorrowDay;
- FillDateRangeArray($content['days'], "filter_daterange_to_day_list", "filter_daterange_to_day");
-
- // --- Define LASTX Array
-
- // Init Default DateMode from SESSION!
- if ( isset($_SESSION['filter_lastx_default']) )
- $filters['filter_lastx_default'] = intval($_SESSION['filter_lastx_default']);
- else
- $filters['filter_lastx_default'] = DATE_LASTX_24HOURS;
-
- $content['filter_daterange_last_x_list'][0]['ID'] = DATE_LASTX_HOUR;
- $content['filter_daterange_last_x_list'][0]['DisplayName'] = $content['LN_DATE_LASTX_HOUR'];
- if ( $filters['filter_lastx_default'] == DATE_LASTX_HOUR ) { $content['filter_daterange_last_x_list'][0]['selected'] = "selected"; } else { $content['filter_daterange_last_x_list'][0]['selected'] = ""; }
-
- $content['filter_daterange_last_x_list'][1]['ID'] = DATE_LASTX_12HOURS;
- $content['filter_daterange_last_x_list'][1]['DisplayName'] = $content['LN_DATE_LASTX_12HOURS'];
- if ( $filters['filter_lastx_default'] == DATE_LASTX_12HOURS ) { $content['filter_daterange_last_x_list'][1]['selected'] = "selected"; } else { $content['filter_daterange_last_x_list'][1]['selected'] = ""; }
-
- $content['filter_daterange_last_x_list'][2]['ID'] = DATE_LASTX_24HOURS;
- $content['filter_daterange_last_x_list'][2]['DisplayName'] = $content['LN_DATE_LASTX_24HOURS'];
- if ( $filters['filter_lastx_default'] == DATE_LASTX_24HOURS ) { $content['filter_daterange_last_x_list'][2]['selected'] = "selected"; } else { $content['filter_daterange_last_x_list'][2]['selected'] = ""; }
-
- $content['filter_daterange_last_x_list'][3]['ID'] = DATE_LASTX_7DAYS;
- $content['filter_daterange_last_x_list'][3]['DisplayName'] = $content['LN_DATE_LASTX_7DAYS'];
- if ( $filters['filter_lastx_default'] == DATE_LASTX_7DAYS ) { $content['filter_daterange_last_x_list'][3]['selected'] = "selected"; } else { $content['filter_daterange_last_x_list'][3]['selected'] = ""; }
-
- $content['filter_daterange_last_x_list'][4]['ID'] = DATE_LASTX_31DAYS;
- $content['filter_daterange_last_x_list'][4]['DisplayName'] = $content['LN_DATE_LASTX_31DAYS'];
- 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!
- 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_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++ )
- {
- 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!
- 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 );
-
- $iCount = count($content['filter_severity_list']);
- for ( $i = 0; $i < $iCount; $i++ )
- {
- 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";
- }
- // ---
-
-}
-
-function FillDateRangeArray($sourcearray, $szArrayListName, $szFilterName) // $content['years'], "filter_daterange_from_year_list", "filter_daterange_from_year")
-{
- global $CFG, $content, $filters;
- $iCount = count($sourcearray);
-
- for ( $i = 0; $i < $iCount; $i++)
- {
- $content[$szArrayListName][$i]['value'] = $sourcearray[$i];
- if ( $filters[$szFilterName] == $sourcearray[$i] )
- $content[$szArrayListName][$i]['selected'] = "selected";
- else
- $content[$szArrayListName][$i]['selected'] = "";
- }
-}
-
-function GetFacilityDisplayName( $nFacilityID )
-{
- global $content;
-
- foreach( $content['filter_facility_list'] as $myfacility )
- {
- if ( $myfacility['ID'] == $nFacilityID )
- return $myfacility['DisplayName'];
- }
-
- // Default
- return "Unknown Facility($nFacilityID)";
-}
-
-function GetSeverityDisplayName( $nSeverityID )
-{
- global $content;
-
- foreach( $content['filter_severity_list'] as $myseverity )
- {
- if ( $myseverity['ID'] == $nSeverityID )
- return $myseverity['DisplayName'];
- }
-
- // Default
- return "Unknown Severity($nSeverityID)";
-}
-
-function GetMessageTypeDisplayName( $nMsgTypeID )
-{
- global $content;
-
- foreach( $content['filter_messagetype_list'] as $mymsgtype )
- {
- if ( $mymsgtype['ID'] == $nMsgTypeID )
- return $mymsgtype['DisplayName'];
- }
-
- // Default
- return "Unknown MessageType($nMsgTypeID)";
-}
-
-
-function GetTimeStampFromTimeString($szTimeString)
-{
- //Sample: 2008-4-1T00:00:00
- 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})$/", $szTimeString, $out) )
- {
- // return new timestamp
- return mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]);
- }
- else
- {
- OutputDebugMessage("Unparseable Time in GetTimeStampFromTimeString - '" . $szTimeString . "'");
- return $szTimeString;
- }
-}
-
-?>
+ www.phplogcon.org <- *
+ * ----------------------------------------------------------------- *
+ * Filter Helper functions for the frontend *
+ *
+ * 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;
+}
+// ---
+
+// --- Perform necessary includes
+require_once($gl_root_path . 'include/constants_filters.php');
+// ---
+
+function InitFilterHelpers()
+{
+ global $CFG, $content, $filters;
+
+ // Init Default DateMode from SESSION!
+ if ( isset($_SESSION['filter_datemode']) )
+ $filters['filter_datemode'] = intval($_SESSION['filter_datemode']);
+ else
+ $filters['filter_datemode'] = DATEMODE_ALL;
+
+ // Init TimeFilter Helper Array
+ $content['datemodes'][0]['ID'] = DATEMODE_ALL;
+ $content['datemodes'][0]['DisplayName'] = $content['LN_DATEMODE_ALL'];
+ if ( $filters['filter_datemode'] == DATEMODE_ALL ) { $content['datemodes'][0]['selected'] = "selected"; } else { $content['datemodes'][0]['selected'] = ""; }
+ $content['datemodes'][1]['ID'] = DATEMODE_RANGE;
+ $content['datemodes'][1]['DisplayName'] = $content['LN_DATEMODE_RANGE'];
+ if ( $filters['filter_datemode'] == DATEMODE_RANGE ) { $content['datemodes'][1]['selected'] = "selected"; } else { $content['datemodes'][1]['selected'] = ""; }
+ $content['datemodes'][2]['ID'] = DATEMODE_LASTX;
+ $content['datemodes'][2]['DisplayName'] = $content['LN_DATEMODE_LASTX'];
+ if ( $filters['filter_datemode'] == DATEMODE_LASTX ) { $content['datemodes'][2]['selected'] = "selected"; } else { $content['datemodes'][2]['selected'] = ""; }
+
+ // Init Date Range Parameters
+ $currentTime = time();
+ $currentDay = date("d", $currentTime);
+ $currentMonth = date("m", $currentTime);
+ $currentYear = date("Y", $currentTime);
+
+ $tomorrowTime = time(); // + 86400; // Add one day!
+ $tomorrowDay = date("d", $tomorrowTime);
+ $tomorrowMonth = date("m", $tomorrowTime);
+ $tomorrowYear = date("Y", $tomorrowTime);
+
+ // Init Year, month and day array!
+ for ( $i = $currentYear-5; $i <= $currentYear+5; $i++ )
+ $content['years'][] = $i;
+ for ( $i = 1; $i <= 12; $i++ )
+ $content['months'][] = $i;
+ for ( $i = 1; $i <= 31; $i++ )
+ $content['days'][] = $i;
+
+ // Init filter_daterange_from_year
+ if ( isset($_SESSION['filter_daterange_from_year']) )
+ $filters['filter_daterange_from_year'] = intval($_SESSION['filter_daterange_from_year']);
+ else
+ $filters['filter_daterange_from_year'] = $currentYear-1;
+ FillDateRangeArray($content['years'], "filter_daterange_from_year_list", "filter_daterange_from_year");
+
+ // Init filter_daterange_from_month
+ if ( isset($_SESSION['filter_daterange_from_month']) )
+ $filters['filter_daterange_from_month'] = intval($_SESSION['filter_daterange_from_month']);
+ else
+ $filters['filter_daterange_from_month'] = $currentMonth;
+ FillDateRangeArray($content['months'], "filter_daterange_from_month_list", "filter_daterange_from_month");
+
+ // Init filter_daterange_from_day
+ if ( isset($_SESSION['filter_daterange_from_day']) )
+ $filters['filter_daterange_from_day'] = intval($_SESSION['filter_daterange_from_day']);
+ else
+ $filters['filter_daterange_from_day'] = $currentDay;
+ FillDateRangeArray($content['days'], "filter_daterange_from_day_list", "filter_daterange_from_day");
+
+ // Init filter_daterange_to_year
+ if ( isset($_SESSION['filter_daterange_to_year']) )
+ $filters['filter_daterange_to_year'] = intval($_SESSION['filter_daterange_to_year']);
+ else
+ $filters['filter_daterange_to_year'] = $tomorrowYear;
+ FillDateRangeArray($content['years'], "filter_daterange_to_year_list", "filter_daterange_to_year");
+
+ // Init filter_daterange_to_month
+ if ( isset($_SESSION['filter_daterange_to_month']) )
+ $filters['filter_daterange_to_month'] = intval($_SESSION['filter_daterange_to_month']);
+ else
+ $filters['filter_daterange_to_month'] = $tomorrowMonth;
+ FillDateRangeArray($content['months'], "filter_daterange_to_month_list", "filter_daterange_to_month");
+
+ // Init filter_daterange_to_day
+ if ( isset($_SESSION['filter_daterange_to_day']) )
+ $filters['filter_daterange_to_day'] = intval($_SESSION['filter_daterange_to_day']);
+ else
+ $filters['filter_daterange_to_day'] = $tomorrowDay;
+ FillDateRangeArray($content['days'], "filter_daterange_to_day_list", "filter_daterange_to_day");
+
+ // --- Define LASTX Array
+
+ // Init Default DateMode from SESSION!
+ if ( isset($_SESSION['filter_lastx_default']) )
+ $filters['filter_lastx_default'] = intval($_SESSION['filter_lastx_default']);
+ else
+ $filters['filter_lastx_default'] = DATE_LASTX_24HOURS;
+
+ $content['filter_daterange_last_x_list'][0]['ID'] = DATE_LASTX_HOUR;
+ $content['filter_daterange_last_x_list'][0]['DisplayName'] = $content['LN_DATE_LASTX_HOUR'];
+ if ( $filters['filter_lastx_default'] == DATE_LASTX_HOUR ) { $content['filter_daterange_last_x_list'][0]['selected'] = "selected"; } else { $content['filter_daterange_last_x_list'][0]['selected'] = ""; }
+
+ $content['filter_daterange_last_x_list'][1]['ID'] = DATE_LASTX_12HOURS;
+ $content['filter_daterange_last_x_list'][1]['DisplayName'] = $content['LN_DATE_LASTX_12HOURS'];
+ if ( $filters['filter_lastx_default'] == DATE_LASTX_12HOURS ) { $content['filter_daterange_last_x_list'][1]['selected'] = "selected"; } else { $content['filter_daterange_last_x_list'][1]['selected'] = ""; }
+
+ $content['filter_daterange_last_x_list'][2]['ID'] = DATE_LASTX_24HOURS;
+ $content['filter_daterange_last_x_list'][2]['DisplayName'] = $content['LN_DATE_LASTX_24HOURS'];
+ if ( $filters['filter_lastx_default'] == DATE_LASTX_24HOURS ) { $content['filter_daterange_last_x_list'][2]['selected'] = "selected"; } else { $content['filter_daterange_last_x_list'][2]['selected'] = ""; }
+
+ $content['filter_daterange_last_x_list'][3]['ID'] = DATE_LASTX_7DAYS;
+ $content['filter_daterange_last_x_list'][3]['DisplayName'] = $content['LN_DATE_LASTX_7DAYS'];
+ if ( $filters['filter_lastx_default'] == DATE_LASTX_7DAYS ) { $content['filter_daterange_last_x_list'][3]['selected'] = "selected"; } else { $content['filter_daterange_last_x_list'][3]['selected'] = ""; }
+
+ $content['filter_daterange_last_x_list'][4]['ID'] = DATE_LASTX_31DAYS;
+ $content['filter_daterange_last_x_list'][4]['DisplayName'] = $content['LN_DATE_LASTX_31DAYS'];
+ 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!
+ 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_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++ )
+ {
+ 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!
+ 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 );
+
+ $iCount = count($content['filter_severity_list']);
+ for ( $i = 0; $i < $iCount; $i++ )
+ {
+ 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";
+ }
+ // ---
+
+}
+
+function FillDateRangeArray($sourcearray, $szArrayListName, $szFilterName) // $content['years'], "filter_daterange_from_year_list", "filter_daterange_from_year")
+{
+ global $CFG, $content, $filters;
+ $iCount = count($sourcearray);
+
+ for ( $i = 0; $i < $iCount; $i++)
+ {
+ $content[$szArrayListName][$i]['value'] = $sourcearray[$i];
+ if ( $filters[$szFilterName] == $sourcearray[$i] )
+ $content[$szArrayListName][$i]['selected'] = "selected";
+ else
+ $content[$szArrayListName][$i]['selected'] = "";
+ }
+}
+
+function GetFacilityDisplayName( $nFacilityID )
+{
+ global $content;
+
+ foreach( $content['filter_facility_list'] as $myfacility )
+ {
+ if ( $myfacility['ID'] == $nFacilityID )
+ return $myfacility['DisplayName'];
+ }
+
+ // Default
+ return "Unknown Facility($nFacilityID)";
+}
+
+function GetSeverityDisplayName( $nSeverityID )
+{
+ global $content;
+
+ foreach( $content['filter_severity_list'] as $myseverity )
+ {
+ if ( $myseverity['ID'] == $nSeverityID )
+ return $myseverity['DisplayName'];
+ }
+
+ // Default
+ return "Unknown Severity($nSeverityID)";
+}
+
+function GetMessageTypeDisplayName( $nMsgTypeID )
+{
+ global $content;
+
+ foreach( $content['filter_messagetype_list'] as $mymsgtype )
+ {
+ if ( $mymsgtype['ID'] == $nMsgTypeID )
+ return $mymsgtype['DisplayName'];
+ }
+
+ // Default
+ return "Unknown MessageType($nMsgTypeID)";
+}
+
+
+function GetTimeStampFromTimeString($szTimeString)
+{
+ //Sample: 2008-4-1T00:00:00
+ 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})$/", $szTimeString, $out) )
+ {
+ // return new timestamp
+ return mktime($out[4], $out[5], $out[6], $out[2], $out[3], $out[1]);
+ }
+ else
+ {
+ OutputDebugMessage("Unparseable Time in GetTimeStampFromTimeString - '" . $szTimeString . "'");
+ return $szTimeString;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/src/include/functions_frontendhelpers.php b/src/include/functions_frontendhelpers.php
index 749a892..cd97413 100644
--- a/src/include/functions_frontendhelpers.php
+++ b/src/include/functions_frontendhelpers.php
@@ -1,189 +1,189 @@
- www.phplogcon.org <- *
- * ----------------------------------------------------------------- *
- * Helperfunctions for the web frontend *
- * *
- * -> *
- * *
- * 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;
-}
-// ---
-
-function InitFrontEndDefaults()
-{
- // To create the current URL
- CreateCurrentUrl();
-
- // --- BEGIN Main Info Area
-
-
-
- // --- END Main Info Area
-
- // Check if install file still exists
- InstallFileReminder();
-}
-
-function InstallFileReminder()
-{
- global $content;
-
- if ( is_file($content['BASEPATH'] . "install.php") )
- {
- // No Servers - display warning!
- $content['error_installfilereminder'] = "true";
- }
-}
-
-function CreateCurrentUrl()
-{
- 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 )
- {
- // Append ?
- $content['CURRENTURL'] .= "?";
-
- $queries = explode ("&", $_SERVER['QUERY_STRING']);
- for ( $i = 0; $i < count($queries); $i++ )
- {
- // Some properties need to be filtered out.
- if ( strpos($queries[$i], "direction") === false )
- {
- $tmpvars = explode ("=", $queries[$i]);
- if ( isset($tmpvars[1]) ) // Only if value param is set!
- {
- // For forms!
- $content['HIDDENVARS'][$hvCounter]['varname'] = $tmpvars[0];
- $content['HIDDENVARS'][$hvCounter]['varvalue'] = $tmpvars[1];
-
- if ( strlen($tmpvars[1]) > 0 )
- {
- // Append For URL's
- if ( $tmpvars[0] == "uid" )
- {
- // only add once
- if ( strlen($content['additional_url_uidonly']) <= 0 )
- $content['additional_url_uidonly'] .= "&" . $tmpvars[0] . "=" . $tmpvars[1];
- }
- else if ( $tmpvars[0] == "sorting" )
- {
- // only add once
- 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];
- }
-
- $hvCounter++;
- }
- }
- }
- }
-
- // done
-}
-
-function GetFormatedDate($evttimearray)
-{
- global $content, $CFG;
-
- if ( !is_array($evttimearray) )
- return $evttimearray;
-
- if (
- ( isset($CFG['ViewUseTodayYesterday']) && $CFG['ViewUseTodayYesterday'] == 1 )
- &&
- ( date('m', $evttimearray[EVTIME_TIMESTAMP]) == date('m') && date('Y', $evttimearray[EVTIME_TIMESTAMP]) == date('Y') )
- )
- {
- if ( date('d', $evttimearray[EVTIME_TIMESTAMP]) == date('d') )
- return "Today " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] );
- else if ( date('d', $evttimearray[EVTIME_TIMESTAMP] + 86400) == date('d') )
- return "Yesterday " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] );
- }
-
- // Reach return normal format!
- return $szDateFormatted = date("Y-m-d H:i:s", $evttimearray[EVTIME_TIMESTAMP] );
-}
-
-function OutputDebugMessage($szDbg)
-{
- global $CFG;
-
- if ( $CFG['MiscShowDebugMsg'] == 1 )
- {
- print("");
- print("Debugmessage: ");
- print("" . $szDbg . " ");
- print("
");
- }
-}
-
+ www.phplogcon.org <- *
+ * ----------------------------------------------------------------- *
+ * Helperfunctions for the web frontend *
+ * *
+ * -> *
+ * *
+ * 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;
+}
+// ---
+
+function InitFrontEndDefaults()
+{
+ // To create the current URL
+ CreateCurrentUrl();
+
+ // --- BEGIN Main Info Area
+
+
+
+ // --- END Main Info Area
+
+ // Check if install file still exists
+ InstallFileReminder();
+}
+
+function InstallFileReminder()
+{
+ global $content;
+
+ if ( is_file($content['BASEPATH'] . "install.php") )
+ {
+ // No Servers - display warning!
+ $content['error_installfilereminder'] = "true";
+ }
+}
+
+function CreateCurrentUrl()
+{
+ 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 )
+ {
+ // Append ?
+ $content['CURRENTURL'] .= "?";
+
+ $queries = explode ("&", $_SERVER['QUERY_STRING']);
+ for ( $i = 0; $i < count($queries); $i++ )
+ {
+ // Some properties need to be filtered out.
+ if ( strpos($queries[$i], "direction") === false )
+ {
+ $tmpvars = explode ("=", $queries[$i]);
+ if ( isset($tmpvars[1]) ) // Only if value param is set!
+ {
+ // For forms!
+ $content['HIDDENVARS'][$hvCounter]['varname'] = $tmpvars[0];
+ $content['HIDDENVARS'][$hvCounter]['varvalue'] = $tmpvars[1];
+
+ if ( strlen($tmpvars[1]) > 0 )
+ {
+ // Append For URL's
+ if ( $tmpvars[0] == "uid" )
+ {
+ // only add once
+ if ( strlen($content['additional_url_uidonly']) <= 0 )
+ $content['additional_url_uidonly'] .= "&" . $tmpvars[0] . "=" . $tmpvars[1];
+ }
+ else if ( $tmpvars[0] == "sorting" )
+ {
+ // only add once
+ 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];
+ }
+
+ $hvCounter++;
+ }
+ }
+ }
+ }
+
+ // done
+}
+
+function GetFormatedDate($evttimearray)
+{
+ global $content, $CFG;
+
+ if ( !is_array($evttimearray) )
+ return $evttimearray;
+
+ if (
+ ( isset($CFG['ViewUseTodayYesterday']) && $CFG['ViewUseTodayYesterday'] == 1 )
+ &&
+ ( date('m', $evttimearray[EVTIME_TIMESTAMP]) == date('m') && date('Y', $evttimearray[EVTIME_TIMESTAMP]) == date('Y') )
+ )
+ {
+ if ( date('d', $evttimearray[EVTIME_TIMESTAMP]) == date('d') )
+ return "Today " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] );
+ else if ( date('d', $evttimearray[EVTIME_TIMESTAMP] + 86400) == date('d') )
+ return "Yesterday " . date("H:i:s", $evttimearray[EVTIME_TIMESTAMP] );
+ }
+
+ // Reach return normal format!
+ return $szDateFormatted = date("Y-m-d H:i:s", $evttimearray[EVTIME_TIMESTAMP] );
+}
+
+function OutputDebugMessage($szDbg)
+{
+ global $CFG;
+
+ if ( $CFG['MiscShowDebugMsg'] == 1 )
+ {
+ print("");
+ print("Debugmessage: ");
+ print("" . $szDbg . " ");
+ print("
");
+ }
+}
+
?>
\ No newline at end of file
diff --git a/src/include/functions_themes.php b/src/include/functions_themes.php
index 1a49b90..46990fd 100644
--- a/src/include/functions_themes.php
+++ b/src/include/functions_themes.php
@@ -1,179 +1,179 @@
- www.phplogcon.org <- *
- * ----------------------------------------------------------------- *
- * Theme specific functions *
- * *
- * -> *
- * *
- * All directives are explained within this file *
- *
- * Copyright (C) 2008 Adiscon GmbH.
- *
- * This file is part of phpLogCon.
- *
- * PhpLogCon is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PhpLogCon is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpLogCon. If not, see .
- *
- * A copy of the GPL can be found in the file "COPYING" in this
- * distribution.
- *********************************************************************
-*/
-
-// --- Avoid directly accessing this file!
-if ( !defined('IN_PHPLOGCON') )
-{
- die('Hacking attempt');
- exit;
-}
-// ---
-
-function CreateLanguageList()
-{
- global $gl_root_path, $content;
-
- $alldirectories = list_directories( $gl_root_path . "lang/");
- for($i = 0; $i < count($alldirectories); $i++)
- {
- // --- gen_lang
- $content['LANGUAGES'][$i]['langcode'] = $alldirectories[$i];
- if ( $content['gen_lang'] == $alldirectories[$i] )
- $content['LANGUAGES'][$i]['selected'] = "selected";
- else
- $content['LANGUAGES'][$i]['selected'] = "";
- // ---
-
- // --- user_lang
- $content['USERLANG'][$i]['langcode'] = $alldirectories[$i];
- if ( $content['user_lang'] == $alldirectories[$i] )
- $content['USERLANG'][$i]['is_selected'] = "selected";
- else
- $content['USERLANG'][$i]['is_selected'] = "";
- // ---
-
- // Init Language DisplayName
- $content['USERLANG'][$i]['DisplayName'] = GetLanguageDisplayName( $alldirectories[$i] );
- }
-}
-
-function CreateThemesList()
-{
- global $gl_root_path, $content;
-
- $alldirectories = list_directories( $gl_root_path . "themes/");
- for($i = 0; $i < count($alldirectories); $i++)
- {
- // --- web_theme
- $content['STYLES'][$i]['StyleName'] = $alldirectories[$i];
- if ( $content['web_theme'] == $alldirectories[$i] )
- $content['STYLES'][$i]['selected'] = "selected";
- else
- $content['STYLES'][$i]['selected'] = "";
- // ---
-
- // --- user_theme
- $content['USERSTYLES'][$i]['StyleName'] = $alldirectories[$i];
- if ( $content['user_theme'] == $alldirectories[$i] )
- $content['USERSTYLES'][$i]['is_selected'] = "selected";
- else
- $content['USERSTYLES'][$i]['is_selected'] = "";
- // ---
- }
-}
-
-function list_directories($directory)
-{
- $result = array();
- if (! $directoryHandler = @opendir ($directory))
- DieWithFriendlyErrorMsg( "list_directories: directory \"$directory\" doesn't exist!");
-
- while (false !== ($fileName = @readdir ($directoryHandler)))
- {
- if ( is_dir( $directory . $fileName ) && ( $fileName != "." && $fileName != ".." ))
- @array_push ($result, $fileName);
- }
-
- if ( @count ($result) === 0 )
- DieWithFriendlyErrorMsg( "list_directories: no directories in \"$directory\" found!");
- else
- {
- sort ($result);
- return $result;
- }
-}
-
-function VerifyTheme( $newtheme )
-{
- global $gl_root_path;
-
- if ( is_dir( $gl_root_path . "themes/" . $newtheme ) )
- return true;
- else
- return false;
-}
-
-function InitThemeAbout( $themename )
-{
- global $content, $gl_root_path;
- $szAboutFile = $gl_root_path . "themes/" . $themename . "/about.txt";
- if ( is_file( $szAboutFile ) )
- { //Read About Info!
- $aboutfile = fopen($szAboutFile, 'r');
- if (!feof ($aboutfile))
- {
- while (!feof ($aboutfile))
- {
- $tmpline = fgets($aboutfile, 1024);
- if (!isset($content["theme_madeby"]) )
- $content["theme_madeby"] = substr( trim($tmpline), 0, 25);
- else if (!isset($content["theme_madebylink"]) )
- $content["theme_madebylink"] = substr( trim($tmpline), 0, 256);
- else
- {
- $content["theme_madebyenable"] = "true";
- break;
- }
- }
- }
- fclose($aboutfile);
- }
- else
- $content["theme_madebyenable"] = "false";
-}
-
-function GetLanguageDisplayName( $szLangID )
-{
- global $content, $gl_root_path;
- $szInfoFile = $gl_root_path . "lang/" . $szLangID . "/info.txt";
- if ( is_file( $szInfoFile ) )
- {
- //Read InfoFile!
- $infofile = fopen($szInfoFile, 'r');
- if (!feof ($infofile))
- {
- while (!feof ($infofile))
- {
- // Return max 32 characters
- $tmpline = fgets($infofile, 1024);
- return substr( trim($tmpline), 0, 32);
- }
- }
- fclose($infofile);
- }
- else // No Info, return ID as DisplayName
- return $szLangID;
-}
-
-
-?>
+ www.phplogcon.org <- *
+ * ----------------------------------------------------------------- *
+ * Theme specific functions *
+ * *
+ * -> *
+ * *
+ * All directives are explained within this file *
+ *
+ * Copyright (C) 2008 Adiscon GmbH.
+ *
+ * This file is part of phpLogCon.
+ *
+ * PhpLogCon is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * PhpLogCon is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpLogCon. If not, see .
+ *
+ * A copy of the GPL can be found in the file "COPYING" in this
+ * distribution.
+ *********************************************************************
+*/
+
+// --- Avoid directly accessing this file!
+if ( !defined('IN_PHPLOGCON') )
+{
+ die('Hacking attempt');
+ exit;
+}
+// ---
+
+function CreateLanguageList()
+{
+ global $gl_root_path, $content;
+
+ $alldirectories = list_directories( $gl_root_path . "lang/");
+ for($i = 0; $i < count($alldirectories); $i++)
+ {
+ // --- gen_lang
+ $content['LANGUAGES'][$i]['langcode'] = $alldirectories[$i];
+ if ( $content['gen_lang'] == $alldirectories[$i] )
+ $content['LANGUAGES'][$i]['selected'] = "selected";
+ else
+ $content['LANGUAGES'][$i]['selected'] = "";
+ // ---
+
+ // --- user_lang
+ $content['USERLANG'][$i]['langcode'] = $alldirectories[$i];
+ if ( $content['user_lang'] == $alldirectories[$i] )
+ $content['USERLANG'][$i]['is_selected'] = "selected";
+ else
+ $content['USERLANG'][$i]['is_selected'] = "";
+ // ---
+
+ // Init Language DisplayName
+ $content['USERLANG'][$i]['DisplayName'] = GetLanguageDisplayName( $alldirectories[$i] );
+ }
+}
+
+function CreateThemesList()
+{
+ global $gl_root_path, $content;
+
+ $alldirectories = list_directories( $gl_root_path . "themes/");
+ for($i = 0; $i < count($alldirectories); $i++)
+ {
+ // --- web_theme
+ $content['STYLES'][$i]['StyleName'] = $alldirectories[$i];
+ if ( $content['web_theme'] == $alldirectories[$i] )
+ $content['STYLES'][$i]['selected'] = "selected";
+ else
+ $content['STYLES'][$i]['selected'] = "";
+ // ---
+
+ // --- user_theme
+ $content['USERSTYLES'][$i]['StyleName'] = $alldirectories[$i];
+ if ( $content['user_theme'] == $alldirectories[$i] )
+ $content['USERSTYLES'][$i]['is_selected'] = "selected";
+ else
+ $content['USERSTYLES'][$i]['is_selected'] = "";
+ // ---
+ }
+}
+
+function list_directories($directory)
+{
+ $result = array();
+ if (! $directoryHandler = @opendir ($directory))
+ DieWithFriendlyErrorMsg( "list_directories: directory \"$directory\" doesn't exist!");
+
+ while (false !== ($fileName = @readdir ($directoryHandler)))
+ {
+ if ( is_dir( $directory . $fileName ) && ( $fileName != "." && $fileName != ".." ))
+ @array_push ($result, $fileName);
+ }
+
+ if ( @count ($result) === 0 )
+ DieWithFriendlyErrorMsg( "list_directories: no directories in \"$directory\" found!");
+ else
+ {
+ sort ($result);
+ return $result;
+ }
+}
+
+function VerifyTheme( $newtheme )
+{
+ global $gl_root_path;
+
+ if ( is_dir( $gl_root_path . "themes/" . $newtheme ) )
+ return true;
+ else
+ return false;
+}
+
+function InitThemeAbout( $themename )
+{
+ global $content, $gl_root_path;
+ $szAboutFile = $gl_root_path . "themes/" . $themename . "/about.txt";
+ if ( is_file( $szAboutFile ) )
+ { //Read About Info!
+ $aboutfile = fopen($szAboutFile, 'r');
+ if (!feof ($aboutfile))
+ {
+ while (!feof ($aboutfile))
+ {
+ $tmpline = fgets($aboutfile, 1024);
+ if (!isset($content["theme_madeby"]) )
+ $content["theme_madeby"] = substr( trim($tmpline), 0, 25);
+ else if (!isset($content["theme_madebylink"]) )
+ $content["theme_madebylink"] = substr( trim($tmpline), 0, 256);
+ else
+ {
+ $content["theme_madebyenable"] = "true";
+ break;
+ }
+ }
+ }
+ fclose($aboutfile);
+ }
+ else
+ $content["theme_madebyenable"] = "false";
+}
+
+function GetLanguageDisplayName( $szLangID )
+{
+ global $content, $gl_root_path;
+ $szInfoFile = $gl_root_path . "lang/" . $szLangID . "/info.txt";
+ if ( is_file( $szInfoFile ) )
+ {
+ //Read InfoFile!
+ $infofile = fopen($szInfoFile, 'r');
+ if (!feof ($infofile))
+ {
+ while (!feof ($infofile))
+ {
+ // Return max 32 characters
+ $tmpline = fgets($infofile, 1024);
+ return substr( trim($tmpline), 0, 32);
+ }
+ }
+ fclose($infofile);
+ }
+ else // No Info, return ID as DisplayName
+ return $szLangID;
+}
+
+
+?>