mirror of
https://github.com/rsyslog/loganalyzer.git
synced 2025-09-26 03:09:21 +02:00
Converted all files from the include folder to UNIX format
This commit is contained in:
parent
fbc290deca
commit
e8940c7330
@ -1,114 +1,114 @@
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* phpLogCon - http://www.phplogcon.org
|
||||
* -----------------------------------------------------------------
|
||||
* Main Configuration File
|
||||
*
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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
|
||||
// ---
|
||||
|
||||
// --- Default Frontend Options
|
||||
$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['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%
|
||||
// ---
|
||||
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* phpLogCon - http://www.phplogcon.org
|
||||
* -----------------------------------------------------------------
|
||||
* Main Configuration File
|
||||
*
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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
|
||||
// ---
|
||||
|
||||
// --- Default Frontend Options
|
||||
$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['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%
|
||||
// ---
|
||||
|
||||
?>
|
@ -1,61 +1,61 @@
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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);
|
||||
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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);
|
||||
|
||||
?>
|
||||
|
@ -1,112 +1,112 @@
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* A copy of the GPL can be found in the file "COPYING" in this
|
||||
* distribution.
|
||||
*********************************************************************
|
||||
*/
|
||||
|
||||
// --- Avoid directly accessing this file!
|
||||
if ( !defined('IN_PHPLOGCON') )
|
||||
{
|
||||
die('Hacking attempt');
|
||||
exit;
|
||||
}
|
||||
// ---
|
||||
|
||||
// --- Some custom defines
|
||||
define('DATEMODE_ALL', 1);
|
||||
define('DATEMODE_RANGE', 2);
|
||||
define('DATEMODE_LASTX', 3);
|
||||
|
||||
define('DATEMODE_RANGE_FROM', 4);
|
||||
define('DATEMODE_RANGE_TO', 5);
|
||||
|
||||
define('DATE_LASTX_HOUR', 1);
|
||||
define('DATE_LASTX_12HOURS', 2);
|
||||
define('DATE_LASTX_24HOURS', 3);
|
||||
define('DATE_LASTX_7DAYS', 4);
|
||||
define('DATE_LASTX_31DAYS', 5);
|
||||
// ---
|
||||
|
||||
|
||||
// Helper constants needed for parsing filters
|
||||
define('FILTER_TMP_KEY', 0);
|
||||
define('FILTER_TMP_VALUE', 1);
|
||||
define('FILTER_DATEMODE', 'datemode');
|
||||
define('FILTER_TYPE', 'filtertype');
|
||||
define('FILTER_DATEMODENAME', 'datemodename');
|
||||
define('FILTER_VALUE', 'value');
|
||||
define('FILTER_MODE', 'filtermode');
|
||||
define('FILTER_MODE_INCLUDE', 0);
|
||||
define('FILTER_MODE_EXCLUDE', 1);
|
||||
|
||||
// --- Init Facility LIST
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_KERN, "DisplayName" => "KERN", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_USER, "DisplayName" => "USER", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_MAIL, "DisplayName" => "MAIL", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_DAEMON, "DisplayName" => "DAEMON", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_AUTH, "DisplayName" => "AUTH", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_SYSLOG, "DisplayName" => "SYSLOG", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LPR, "DisplayName" => "LPR", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_NEWS, "DisplayName" => "NEWS", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_UUCP, "DisplayName" => "UUCP", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_CRON, "DisplayName" => "CRON", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_SECURITY, "DisplayName" => "SECURITY", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_FTP, "DisplayName" => "FTP", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_NTP, "DisplayName" => "NTP", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOGAUDIT, "DisplayName" => "LOGAUDIT", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOGALERT, "DisplayName" => "LOGALERT", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_CLOCK, "DisplayName" => "CLOCK", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL0, "DisplayName" => "LOCAL0", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL1, "DisplayName" => "LOCAL1", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL2, "DisplayName" => "LOCAL2", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL3, "DisplayName" => "LOCAL3", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL4, "DisplayName" => "LOCAL4", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL5, "DisplayName" => "LOCAL5", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL6, "DisplayName" => "LOCAL6", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL7, "DisplayName" => "LOCAL7", "selected" => "" );
|
||||
// ---
|
||||
|
||||
// Init Severity LIST
|
||||
$content['filter_severity_list'][] = array( "ID" => SYSLOG_EMERG, "DisplayName" => "EMERG", "selected" => "" );
|
||||
$content['filter_severity_list'][] = array( "ID" => SYSLOG_ALERT, "DisplayName" => "ALERT", "selected" => "" );
|
||||
$content['filter_severity_list'][] = array( "ID" => SYSLOG_CRIT, "DisplayName" => "CRIT", "selected" => "" );
|
||||
$content['filter_severity_list'][] = array( "ID" => SYSLOG_ERR, "DisplayName" => "ERR", "selected" => "" );
|
||||
$content['filter_severity_list'][] = array( "ID" => SYSLOG_WARNING, "DisplayName" => "WARNING", "selected" => "" );
|
||||
$content['filter_severity_list'][] = array( "ID" => SYSLOG_NOTICE, "DisplayName" => "NOTICE", "selected" => "" );
|
||||
$content['filter_severity_list'][] = array( "ID" => SYSLOG_INFO, "DisplayName" => "INFO", "selected" => "" );
|
||||
$content['filter_severity_list'][] = array( "ID" => SYSLOG_DEBUG, "DisplayName" => "DEBUG", "selected" => "" );
|
||||
// ---
|
||||
|
||||
// Init MessageType LIST
|
||||
$content['filter_messagetype_list'][] = array( "ID" => IUT_Unknown, "DisplayName" => "Unknown", "selected" => "" );
|
||||
$content['filter_messagetype_list'][] = array( "ID" => IUT_Syslog, "DisplayName" => "Syslog", "selected" => "" );
|
||||
$content['filter_messagetype_list'][] = array( "ID" => IUT_NT_EventReport, "DisplayName" => "EventReporter", "selected" => "" );
|
||||
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* A copy of the GPL can be found in the file "COPYING" in this
|
||||
* distribution.
|
||||
*********************************************************************
|
||||
*/
|
||||
|
||||
// --- Avoid directly accessing this file!
|
||||
if ( !defined('IN_PHPLOGCON') )
|
||||
{
|
||||
die('Hacking attempt');
|
||||
exit;
|
||||
}
|
||||
// ---
|
||||
|
||||
// --- Some custom defines
|
||||
define('DATEMODE_ALL', 1);
|
||||
define('DATEMODE_RANGE', 2);
|
||||
define('DATEMODE_LASTX', 3);
|
||||
|
||||
define('DATEMODE_RANGE_FROM', 4);
|
||||
define('DATEMODE_RANGE_TO', 5);
|
||||
|
||||
define('DATE_LASTX_HOUR', 1);
|
||||
define('DATE_LASTX_12HOURS', 2);
|
||||
define('DATE_LASTX_24HOURS', 3);
|
||||
define('DATE_LASTX_7DAYS', 4);
|
||||
define('DATE_LASTX_31DAYS', 5);
|
||||
// ---
|
||||
|
||||
|
||||
// Helper constants needed for parsing filters
|
||||
define('FILTER_TMP_KEY', 0);
|
||||
define('FILTER_TMP_VALUE', 1);
|
||||
define('FILTER_DATEMODE', 'datemode');
|
||||
define('FILTER_TYPE', 'filtertype');
|
||||
define('FILTER_DATEMODENAME', 'datemodename');
|
||||
define('FILTER_VALUE', 'value');
|
||||
define('FILTER_MODE', 'filtermode');
|
||||
define('FILTER_MODE_INCLUDE', 0);
|
||||
define('FILTER_MODE_EXCLUDE', 1);
|
||||
|
||||
// --- Init Facility LIST
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_KERN, "DisplayName" => "KERN", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_USER, "DisplayName" => "USER", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_MAIL, "DisplayName" => "MAIL", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_DAEMON, "DisplayName" => "DAEMON", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_AUTH, "DisplayName" => "AUTH", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_SYSLOG, "DisplayName" => "SYSLOG", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LPR, "DisplayName" => "LPR", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_NEWS, "DisplayName" => "NEWS", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_UUCP, "DisplayName" => "UUCP", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_CRON, "DisplayName" => "CRON", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_SECURITY, "DisplayName" => "SECURITY", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_FTP, "DisplayName" => "FTP", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_NTP, "DisplayName" => "NTP", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOGAUDIT, "DisplayName" => "LOGAUDIT", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOGALERT, "DisplayName" => "LOGALERT", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_CLOCK, "DisplayName" => "CLOCK", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL0, "DisplayName" => "LOCAL0", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL1, "DisplayName" => "LOCAL1", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL2, "DisplayName" => "LOCAL2", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL3, "DisplayName" => "LOCAL3", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL4, "DisplayName" => "LOCAL4", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL5, "DisplayName" => "LOCAL5", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL6, "DisplayName" => "LOCAL6", "selected" => "" );
|
||||
$content['filter_facility_list'][] = array( "ID" => SYSLOG_LOCAL7, "DisplayName" => "LOCAL7", "selected" => "" );
|
||||
// ---
|
||||
|
||||
// Init Severity LIST
|
||||
$content['filter_severity_list'][] = array( "ID" => SYSLOG_EMERG, "DisplayName" => "EMERG", "selected" => "" );
|
||||
$content['filter_severity_list'][] = array( "ID" => SYSLOG_ALERT, "DisplayName" => "ALERT", "selected" => "" );
|
||||
$content['filter_severity_list'][] = array( "ID" => SYSLOG_CRIT, "DisplayName" => "CRIT", "selected" => "" );
|
||||
$content['filter_severity_list'][] = array( "ID" => SYSLOG_ERR, "DisplayName" => "ERR", "selected" => "" );
|
||||
$content['filter_severity_list'][] = array( "ID" => SYSLOG_WARNING, "DisplayName" => "WARNING", "selected" => "" );
|
||||
$content['filter_severity_list'][] = array( "ID" => SYSLOG_NOTICE, "DisplayName" => "NOTICE", "selected" => "" );
|
||||
$content['filter_severity_list'][] = array( "ID" => SYSLOG_INFO, "DisplayName" => "INFO", "selected" => "" );
|
||||
$content['filter_severity_list'][] = array( "ID" => SYSLOG_DEBUG, "DisplayName" => "DEBUG", "selected" => "" );
|
||||
// ---
|
||||
|
||||
// Init MessageType LIST
|
||||
$content['filter_messagetype_list'][] = array( "ID" => IUT_Unknown, "DisplayName" => "Unknown", "selected" => "" );
|
||||
$content['filter_messagetype_list'][] = array( "ID" => IUT_Syslog, "DisplayName" => "Syslog", "selected" => "" );
|
||||
$content['filter_messagetype_list'][] = array( "ID" => IUT_NT_EventReport, "DisplayName" => "EventReporter", "selected" => "" );
|
||||
|
||||
?>
|
@ -1,184 +1,184 @@
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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";
|
||||
// ---
|
||||
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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";
|
||||
// ---
|
||||
|
||||
?>
|
@ -1,167 +1,167 @@
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* A copy of the GPL can be found in the file "COPYING" in this
|
||||
* distribution.
|
||||
*********************************************************************
|
||||
*/
|
||||
|
||||
// --- Avoid directly accessing this file!
|
||||
if ( !defined('IN_PHPLOGCON') )
|
||||
{
|
||||
die('Hacking attempt');
|
||||
exit;
|
||||
}
|
||||
// ---
|
||||
|
||||
// --- Define properties names of all know fields
|
||||
define('SYSLOG_UID', 'uID');
|
||||
define('SYSLOG_DATE', 'timereported');
|
||||
define('SYSLOG_HOST', 'FROMHOST');
|
||||
define('SYSLOG_MESSAGETYPE', 'IUT');
|
||||
define('SYSLOG_MESSAGE', 'msg');
|
||||
|
||||
// Syslog specific
|
||||
define('SYSLOG_FACILITY', 'syslogfacility');
|
||||
define('SYSLOG_SEVERITY', 'syslogseverity');
|
||||
define('SYSLOG_SYSLOGTAG', 'syslogtag');
|
||||
define('SYSLOG_PROCESSID', 'procid');
|
||||
|
||||
// EventLog specific
|
||||
define('SYSLOG_EVENT_ID', 'id');
|
||||
define('SYSLOG_EVENT_LOGTYPE', 'NTEventLogType');
|
||||
define('SYSLOG_EVENT_SOURCE', 'sourceproc');
|
||||
define('SYSLOG_EVENT_CATEGORY', 'category');
|
||||
define('SYSLOG_EVENT_USER', 'user');
|
||||
// ---
|
||||
|
||||
// Defines which kind of field types we have
|
||||
define('FILTER_TYPE_STRING', 0);
|
||||
define('FILTER_TYPE_NUMBER', 1);
|
||||
define('FILTER_TYPE_DATE', 2);
|
||||
define('FILTER_TYPE_UNKNOWN', 99);
|
||||
|
||||
// Define possible database types
|
||||
define('DB_MYSQL', 0);
|
||||
define('DB_MSSQL', 1);
|
||||
define('DB_ODBC', 2);
|
||||
|
||||
// --- Predefine fields array!
|
||||
$fields[SYSLOG_UID]['FieldID'] = SYSLOG_UID;
|
||||
$fields[SYSLOG_UID]['FieldCaptionID'] = 'LN_FIELDS_UID';
|
||||
$fields[SYSLOG_UID]['FieldType'] = FILTER_TYPE_NUMBER;
|
||||
$fields[SYSLOG_UID]['Sortable'] = false;
|
||||
$fields[SYSLOG_UID]['DefaultWidth'] = "50";
|
||||
$fields[SYSLOG_UID]['FieldAlign'] = "center";
|
||||
$fields[SYSLOG_DATE]['FieldID'] = SYSLOG_DATE;
|
||||
$fields[SYSLOG_DATE]['FieldCaptionID'] = 'LN_FIELDS_DATE';
|
||||
$fields[SYSLOG_DATE]['FieldType'] = FILTER_TYPE_DATE;
|
||||
$fields[SYSLOG_DATE]['Sortable'] = true;
|
||||
$fields[SYSLOG_DATE]['DefaultWidth'] = "115";
|
||||
$fields[SYSLOG_DATE]['FieldAlign'] = "center";
|
||||
$fields[SYSLOG_HOST]['FieldID'] = SYSLOG_HOST;
|
||||
$fields[SYSLOG_HOST]['FieldCaptionID'] = 'LN_FIELDS_HOST';
|
||||
$fields[SYSLOG_HOST]['FieldType'] = FILTER_TYPE_STRING;
|
||||
$fields[SYSLOG_HOST]['Sortable'] = true;
|
||||
$fields[SYSLOG_HOST]['DefaultWidth'] = "80";
|
||||
$fields[SYSLOG_HOST]['FieldAlign'] = "center";
|
||||
$fields[SYSLOG_MESSAGETYPE]['FieldID'] = SYSLOG_MESSAGETYPE;
|
||||
$fields[SYSLOG_MESSAGETYPE]['FieldCaptionID'] = 'LN_FIELDS_MESSAGETYPE';
|
||||
$fields[SYSLOG_MESSAGETYPE]['FieldType'] = FILTER_TYPE_NUMBER;
|
||||
$fields[SYSLOG_MESSAGETYPE]['Sortable'] = true;
|
||||
$fields[SYSLOG_MESSAGETYPE]['DefaultWidth'] = "90";
|
||||
$fields[SYSLOG_MESSAGETYPE]['FieldAlign'] = "center";
|
||||
|
||||
// Syslog specific
|
||||
$fields[SYSLOG_FACILITY]['FieldID'] = SYSLOG_FACILITY;
|
||||
$fields[SYSLOG_FACILITY]['FieldCaptionID'] = 'LN_FIELDS_FACILITY';
|
||||
$fields[SYSLOG_FACILITY]['FieldType'] = FILTER_TYPE_NUMBER;
|
||||
$fields[SYSLOG_FACILITY]['Sortable'] = true;
|
||||
$fields[SYSLOG_FACILITY]['DefaultWidth'] = "50";
|
||||
$fields[SYSLOG_FACILITY]['FieldAlign'] = "center";
|
||||
$fields[SYSLOG_SEVERITY]['FieldID'] = SYSLOG_SEVERITY;
|
||||
$fields[SYSLOG_SEVERITY]['FieldCaptionID'] = 'LN_FIELDS_SEVERITY';
|
||||
$fields[SYSLOG_SEVERITY]['FieldType'] = FILTER_TYPE_NUMBER;
|
||||
$fields[SYSLOG_SEVERITY]['Sortable'] = true;
|
||||
$fields[SYSLOG_SEVERITY]['DefaultWidth'] = "50";
|
||||
$fields[SYSLOG_SEVERITY]['FieldAlign'] = "center";
|
||||
$fields[SYSLOG_SYSLOGTAG]['FieldID'] = SYSLOG_SYSLOGTAG;
|
||||
$fields[SYSLOG_SYSLOGTAG]['FieldCaptionID'] = 'LN_FIELDS_SYSLOGTAG';
|
||||
$fields[SYSLOG_SYSLOGTAG]['FieldType'] = FILTER_TYPE_STRING;
|
||||
$fields[SYSLOG_SYSLOGTAG]['Sortable'] = true;
|
||||
$fields[SYSLOG_SYSLOGTAG]['DefaultWidth'] = "85";
|
||||
$fields[SYSLOG_SYSLOGTAG]['FieldAlign'] = "center";
|
||||
$fields[SYSLOG_PROCESSID]['FieldID'] = SYSLOG_PROCESSID;
|
||||
$fields[SYSLOG_PROCESSID]['FieldCaptionID'] = 'LN_FIELDS_PROCESSID';
|
||||
$fields[SYSLOG_PROCESSID]['FieldType'] = FILTER_TYPE_NUMBER;
|
||||
$fields[SYSLOG_PROCESSID]['Sortable'] = true;
|
||||
$fields[SYSLOG_PROCESSID]['DefaultWidth'] = "65";
|
||||
$fields[SYSLOG_PROCESSID]['FieldAlign'] = "center";
|
||||
|
||||
// TODO! EventLog specific
|
||||
|
||||
// Message is the last element, this order is important for the Detail page for now!
|
||||
$fields[SYSLOG_MESSAGE]['FieldID'] = SYSLOG_MESSAGE;
|
||||
$fields[SYSLOG_MESSAGE]['FieldCaptionID'] = 'LN_FIELDS_MESSAGE';
|
||||
$fields[SYSLOG_MESSAGE]['FieldType'] = FILTER_TYPE_STRING;
|
||||
$fields[SYSLOG_MESSAGE]['Sortable'] = false;
|
||||
$fields[SYSLOG_MESSAGE]['DefaultWidth'] = "100%";
|
||||
$fields[SYSLOG_MESSAGE]['FieldAlign'] = "left";
|
||||
|
||||
// ---
|
||||
|
||||
// --- Define default Database field mappings!
|
||||
$dbmapping['monitorware'][SYSLOG_UID] = "ID";
|
||||
$dbmapping['monitorware'][SYSLOG_DATE] = "DeviceReportedTime";
|
||||
$dbmapping['monitorware'][SYSLOG_HOST] = "FromHost";
|
||||
$dbmapping['monitorware'][SYSLOG_MESSAGETYPE] = "InfoUnitID";
|
||||
$dbmapping['monitorware'][SYSLOG_MESSAGE] = "Message";
|
||||
$dbmapping['monitorware'][SYSLOG_FACILITY] = "Facility";
|
||||
$dbmapping['monitorware'][SYSLOG_SEVERITY] = "Priority";
|
||||
$dbmapping['monitorware'][SYSLOG_SYSLOGTAG] = "SysLogTag";
|
||||
$dbmapping['monitorware'][SYSLOG_EVENT_ID] = "EventID";
|
||||
$dbmapping['monitorware'][SYSLOG_EVENT_LOGTYPE] = "EventLogType";
|
||||
$dbmapping['monitorware'][SYSLOG_EVENT_SOURCE] = "EventSource";
|
||||
$dbmapping['monitorware'][SYSLOG_EVENT_CATEGORY] = "EventCategory";
|
||||
$dbmapping['monitorware'][SYSLOG_EVENT_USER] = "EventUser";
|
||||
|
||||
$dbmapping['syslogng'][SYSLOG_UID] = "seq";
|
||||
$dbmapping['syslogng'][SYSLOG_DATE] = "datetime";
|
||||
$dbmapping['syslogng'][SYSLOG_HOST] = "host";
|
||||
$dbmapping['syslogng'][SYSLOG_MESSAGE] = "msg";
|
||||
//TODO $dbmapping['syslogng'][SYSLOG_FACILITY] = "Facility";
|
||||
//TODO $dbmapping['syslogng'][SYSLOG_SEVERITY] = "Priority"
|
||||
$dbmapping['syslogng'][SYSLOG_SYSLOGTAG] = "tag";
|
||||
// ---
|
||||
|
||||
// EventTime Constants
|
||||
define('EVTIME_TIMESTAMP', '0');
|
||||
define('EVTIME_TIMEZONE', '1');
|
||||
define('EVTIME_MICROSECONDS', '2');
|
||||
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* A copy of the GPL can be found in the file "COPYING" in this
|
||||
* distribution.
|
||||
*********************************************************************
|
||||
*/
|
||||
|
||||
// --- Avoid directly accessing this file!
|
||||
if ( !defined('IN_PHPLOGCON') )
|
||||
{
|
||||
die('Hacking attempt');
|
||||
exit;
|
||||
}
|
||||
// ---
|
||||
|
||||
// --- Define properties names of all know fields
|
||||
define('SYSLOG_UID', 'uID');
|
||||
define('SYSLOG_DATE', 'timereported');
|
||||
define('SYSLOG_HOST', 'FROMHOST');
|
||||
define('SYSLOG_MESSAGETYPE', 'IUT');
|
||||
define('SYSLOG_MESSAGE', 'msg');
|
||||
|
||||
// Syslog specific
|
||||
define('SYSLOG_FACILITY', 'syslogfacility');
|
||||
define('SYSLOG_SEVERITY', 'syslogseverity');
|
||||
define('SYSLOG_SYSLOGTAG', 'syslogtag');
|
||||
define('SYSLOG_PROCESSID', 'procid');
|
||||
|
||||
// EventLog specific
|
||||
define('SYSLOG_EVENT_ID', 'id');
|
||||
define('SYSLOG_EVENT_LOGTYPE', 'NTEventLogType');
|
||||
define('SYSLOG_EVENT_SOURCE', 'sourceproc');
|
||||
define('SYSLOG_EVENT_CATEGORY', 'category');
|
||||
define('SYSLOG_EVENT_USER', 'user');
|
||||
// ---
|
||||
|
||||
// Defines which kind of field types we have
|
||||
define('FILTER_TYPE_STRING', 0);
|
||||
define('FILTER_TYPE_NUMBER', 1);
|
||||
define('FILTER_TYPE_DATE', 2);
|
||||
define('FILTER_TYPE_UNKNOWN', 99);
|
||||
|
||||
// Define possible database types
|
||||
define('DB_MYSQL', 0);
|
||||
define('DB_MSSQL', 1);
|
||||
define('DB_ODBC', 2);
|
||||
|
||||
// --- Predefine fields array!
|
||||
$fields[SYSLOG_UID]['FieldID'] = SYSLOG_UID;
|
||||
$fields[SYSLOG_UID]['FieldCaptionID'] = 'LN_FIELDS_UID';
|
||||
$fields[SYSLOG_UID]['FieldType'] = FILTER_TYPE_NUMBER;
|
||||
$fields[SYSLOG_UID]['Sortable'] = false;
|
||||
$fields[SYSLOG_UID]['DefaultWidth'] = "50";
|
||||
$fields[SYSLOG_UID]['FieldAlign'] = "center";
|
||||
$fields[SYSLOG_DATE]['FieldID'] = SYSLOG_DATE;
|
||||
$fields[SYSLOG_DATE]['FieldCaptionID'] = 'LN_FIELDS_DATE';
|
||||
$fields[SYSLOG_DATE]['FieldType'] = FILTER_TYPE_DATE;
|
||||
$fields[SYSLOG_DATE]['Sortable'] = true;
|
||||
$fields[SYSLOG_DATE]['DefaultWidth'] = "115";
|
||||
$fields[SYSLOG_DATE]['FieldAlign'] = "center";
|
||||
$fields[SYSLOG_HOST]['FieldID'] = SYSLOG_HOST;
|
||||
$fields[SYSLOG_HOST]['FieldCaptionID'] = 'LN_FIELDS_HOST';
|
||||
$fields[SYSLOG_HOST]['FieldType'] = FILTER_TYPE_STRING;
|
||||
$fields[SYSLOG_HOST]['Sortable'] = true;
|
||||
$fields[SYSLOG_HOST]['DefaultWidth'] = "80";
|
||||
$fields[SYSLOG_HOST]['FieldAlign'] = "center";
|
||||
$fields[SYSLOG_MESSAGETYPE]['FieldID'] = SYSLOG_MESSAGETYPE;
|
||||
$fields[SYSLOG_MESSAGETYPE]['FieldCaptionID'] = 'LN_FIELDS_MESSAGETYPE';
|
||||
$fields[SYSLOG_MESSAGETYPE]['FieldType'] = FILTER_TYPE_NUMBER;
|
||||
$fields[SYSLOG_MESSAGETYPE]['Sortable'] = true;
|
||||
$fields[SYSLOG_MESSAGETYPE]['DefaultWidth'] = "90";
|
||||
$fields[SYSLOG_MESSAGETYPE]['FieldAlign'] = "center";
|
||||
|
||||
// Syslog specific
|
||||
$fields[SYSLOG_FACILITY]['FieldID'] = SYSLOG_FACILITY;
|
||||
$fields[SYSLOG_FACILITY]['FieldCaptionID'] = 'LN_FIELDS_FACILITY';
|
||||
$fields[SYSLOG_FACILITY]['FieldType'] = FILTER_TYPE_NUMBER;
|
||||
$fields[SYSLOG_FACILITY]['Sortable'] = true;
|
||||
$fields[SYSLOG_FACILITY]['DefaultWidth'] = "50";
|
||||
$fields[SYSLOG_FACILITY]['FieldAlign'] = "center";
|
||||
$fields[SYSLOG_SEVERITY]['FieldID'] = SYSLOG_SEVERITY;
|
||||
$fields[SYSLOG_SEVERITY]['FieldCaptionID'] = 'LN_FIELDS_SEVERITY';
|
||||
$fields[SYSLOG_SEVERITY]['FieldType'] = FILTER_TYPE_NUMBER;
|
||||
$fields[SYSLOG_SEVERITY]['Sortable'] = true;
|
||||
$fields[SYSLOG_SEVERITY]['DefaultWidth'] = "50";
|
||||
$fields[SYSLOG_SEVERITY]['FieldAlign'] = "center";
|
||||
$fields[SYSLOG_SYSLOGTAG]['FieldID'] = SYSLOG_SYSLOGTAG;
|
||||
$fields[SYSLOG_SYSLOGTAG]['FieldCaptionID'] = 'LN_FIELDS_SYSLOGTAG';
|
||||
$fields[SYSLOG_SYSLOGTAG]['FieldType'] = FILTER_TYPE_STRING;
|
||||
$fields[SYSLOG_SYSLOGTAG]['Sortable'] = true;
|
||||
$fields[SYSLOG_SYSLOGTAG]['DefaultWidth'] = "85";
|
||||
$fields[SYSLOG_SYSLOGTAG]['FieldAlign'] = "center";
|
||||
$fields[SYSLOG_PROCESSID]['FieldID'] = SYSLOG_PROCESSID;
|
||||
$fields[SYSLOG_PROCESSID]['FieldCaptionID'] = 'LN_FIELDS_PROCESSID';
|
||||
$fields[SYSLOG_PROCESSID]['FieldType'] = FILTER_TYPE_NUMBER;
|
||||
$fields[SYSLOG_PROCESSID]['Sortable'] = true;
|
||||
$fields[SYSLOG_PROCESSID]['DefaultWidth'] = "65";
|
||||
$fields[SYSLOG_PROCESSID]['FieldAlign'] = "center";
|
||||
|
||||
// TODO! EventLog specific
|
||||
|
||||
// Message is the last element, this order is important for the Detail page for now!
|
||||
$fields[SYSLOG_MESSAGE]['FieldID'] = SYSLOG_MESSAGE;
|
||||
$fields[SYSLOG_MESSAGE]['FieldCaptionID'] = 'LN_FIELDS_MESSAGE';
|
||||
$fields[SYSLOG_MESSAGE]['FieldType'] = FILTER_TYPE_STRING;
|
||||
$fields[SYSLOG_MESSAGE]['Sortable'] = false;
|
||||
$fields[SYSLOG_MESSAGE]['DefaultWidth'] = "100%";
|
||||
$fields[SYSLOG_MESSAGE]['FieldAlign'] = "left";
|
||||
|
||||
// ---
|
||||
|
||||
// --- Define default Database field mappings!
|
||||
$dbmapping['monitorware'][SYSLOG_UID] = "ID";
|
||||
$dbmapping['monitorware'][SYSLOG_DATE] = "DeviceReportedTime";
|
||||
$dbmapping['monitorware'][SYSLOG_HOST] = "FromHost";
|
||||
$dbmapping['monitorware'][SYSLOG_MESSAGETYPE] = "InfoUnitID";
|
||||
$dbmapping['monitorware'][SYSLOG_MESSAGE] = "Message";
|
||||
$dbmapping['monitorware'][SYSLOG_FACILITY] = "Facility";
|
||||
$dbmapping['monitorware'][SYSLOG_SEVERITY] = "Priority";
|
||||
$dbmapping['monitorware'][SYSLOG_SYSLOGTAG] = "SysLogTag";
|
||||
$dbmapping['monitorware'][SYSLOG_EVENT_ID] = "EventID";
|
||||
$dbmapping['monitorware'][SYSLOG_EVENT_LOGTYPE] = "EventLogType";
|
||||
$dbmapping['monitorware'][SYSLOG_EVENT_SOURCE] = "EventSource";
|
||||
$dbmapping['monitorware'][SYSLOG_EVENT_CATEGORY] = "EventCategory";
|
||||
$dbmapping['monitorware'][SYSLOG_EVENT_USER] = "EventUser";
|
||||
|
||||
$dbmapping['syslogng'][SYSLOG_UID] = "seq";
|
||||
$dbmapping['syslogng'][SYSLOG_DATE] = "datetime";
|
||||
$dbmapping['syslogng'][SYSLOG_HOST] = "host";
|
||||
$dbmapping['syslogng'][SYSLOG_MESSAGE] = "msg";
|
||||
//TODO $dbmapping['syslogng'][SYSLOG_FACILITY] = "Facility";
|
||||
//TODO $dbmapping['syslogng'][SYSLOG_SEVERITY] = "Priority"
|
||||
$dbmapping['syslogng'][SYSLOG_SYSLOGTAG] = "tag";
|
||||
// ---
|
||||
|
||||
// EventTime Constants
|
||||
define('EVTIME_TIMESTAMP', '0');
|
||||
define('EVTIME_TIMEZONE', '1');
|
||||
define('EVTIME_MICROSECONDS', '2');
|
||||
|
||||
?>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,143 +1,143 @@
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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']; }
|
||||
}
|
||||
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
|
||||
{
|
||||
// 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";
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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']; }
|
||||
}
|
||||
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
|
||||
{
|
||||
// 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";
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -1,340 +1,340 @@
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
@ -1,257 +1,257 @@
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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_LOCAL0, SYSLOG_LOCAL1, SYSLOG_LOCAL2, SYSLOG_LOCAL3, SYSLOG_LOCAL4, SYSLOG_LOCAL5, SYSLOG_LOCAL6, SYSLOG_LOCAL7 );
|
||||
// $filters['filter_facility'] = SYSLOG_LOCAL0;
|
||||
|
||||
$iCount = count($content['filter_facility_list']);
|
||||
for ( $i = 0; $i < $iCount; $i++ )
|
||||
{
|
||||
// echo $content['filter_facility_list'][$i]["ID"] . "-" . $filters['filter_facility'] . "<br>";
|
||||
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 );
|
||||
// $filters['filter_severity'] = SYSLOG_NOTICE;
|
||||
|
||||
$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";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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_LOCAL0, SYSLOG_LOCAL1, SYSLOG_LOCAL2, SYSLOG_LOCAL3, SYSLOG_LOCAL4, SYSLOG_LOCAL5, SYSLOG_LOCAL6, SYSLOG_LOCAL7 );
|
||||
// $filters['filter_facility'] = SYSLOG_LOCAL0;
|
||||
|
||||
$iCount = count($content['filter_facility_list']);
|
||||
for ( $i = 0; $i < $iCount; $i++ )
|
||||
{
|
||||
// echo $content['filter_facility_list'][$i]["ID"] . "-" . $filters['filter_facility'] . "<br>";
|
||||
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 );
|
||||
// $filters['filter_severity'] = SYSLOG_NOTICE;
|
||||
|
||||
$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";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -1,162 +1,162 @@
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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;
|
||||
$content['CURRENTURL'] = $_SERVER['PHP_SELF']; // . "?" . $_SERVER['QUERY_STRING']
|
||||
|
||||
// Init additional_url helper variable
|
||||
$content['additional_url'] = "";
|
||||
$content['additional_url_uidonly'] = "";
|
||||
$content['additional_url_sortingonly'] = "";
|
||||
|
||||
// Now the query string:
|
||||
if ( isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0 )
|
||||
{
|
||||
// Append ?
|
||||
$content['CURRENTURL'] .= "?";
|
||||
|
||||
$queries = explode ("&", $_SERVER['QUERY_STRING']);
|
||||
$counter = 0;
|
||||
for ( $i = 0; $i < count($queries); $i++ )
|
||||
{
|
||||
// Some properties need to be filtered out.
|
||||
if ( strpos($queries[$i], "direction") === false )
|
||||
{
|
||||
$tmpvars = explode ("=", $queries[$i]);
|
||||
if ( isset($tmpvars[1]) ) // Only if value param is set!
|
||||
{
|
||||
// For forms!
|
||||
$content['HIDDENVARS'][$counter]['varname'] = $tmpvars[0];
|
||||
$content['HIDDENVARS'][$counter]['varvalue'] = $tmpvars[1];
|
||||
|
||||
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
|
||||
$content['additional_url'] .= "&" . $tmpvars[0] . "=" . $tmpvars[1];
|
||||
}
|
||||
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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("<table width=\"600\" align=\"center\" class=\"with_border\">");
|
||||
print("<tr><td valign='top'><B>Debugmessage:</B> </td>");
|
||||
print("<td>" . $szDbg . "</td></tr>");
|
||||
print("</table><br>");
|
||||
}
|
||||
}
|
||||
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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;
|
||||
$content['CURRENTURL'] = $_SERVER['PHP_SELF']; // . "?" . $_SERVER['QUERY_STRING']
|
||||
|
||||
// Init additional_url helper variable
|
||||
$content['additional_url'] = "";
|
||||
$content['additional_url_uidonly'] = "";
|
||||
$content['additional_url_sortingonly'] = "";
|
||||
|
||||
// Now the query string:
|
||||
if ( isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0 )
|
||||
{
|
||||
// Append ?
|
||||
$content['CURRENTURL'] .= "?";
|
||||
|
||||
$queries = explode ("&", $_SERVER['QUERY_STRING']);
|
||||
$counter = 0;
|
||||
for ( $i = 0; $i < count($queries); $i++ )
|
||||
{
|
||||
// Some properties need to be filtered out.
|
||||
if ( strpos($queries[$i], "direction") === false )
|
||||
{
|
||||
$tmpvars = explode ("=", $queries[$i]);
|
||||
if ( isset($tmpvars[1]) ) // Only if value param is set!
|
||||
{
|
||||
// For forms!
|
||||
$content['HIDDENVARS'][$counter]['varname'] = $tmpvars[0];
|
||||
$content['HIDDENVARS'][$counter]['varvalue'] = $tmpvars[1];
|
||||
|
||||
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
|
||||
$content['additional_url'] .= "&" . $tmpvars[0] . "=" . $tmpvars[1];
|
||||
}
|
||||
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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("<table width=\"600\" align=\"center\" class=\"with_border\">");
|
||||
print("<tr><td valign='top'><B>Debugmessage:</B> </td>");
|
||||
print("<td>" . $szDbg . "</td></tr>");
|
||||
print("</table><br>");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,179 +1,179 @@
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
*********************************************************************
|
||||
* -> 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user