Implemented MsgParser interface, and first interface parser.

Also implemented database upgrade routine, because we hjave the
first database upgrade now ;)!
This commit is contained in:
Andre Lorbach 2008-09-02 14:47:26 +02:00
parent 378006eb14
commit c5b7ff8e3a
25 changed files with 547 additions and 53 deletions

View File

@ -67,6 +67,7 @@ if ( isset($_GET['op']) )
$content['Name'] = "";
$content['SourceType'] = SOURCE_DISK;
CreateSourceTypesList($content['SourceType']);
$content['MsgParserList'] = "";
// Init View List!
$content['SourceViewID'] = 'SYSLOG';
@ -131,6 +132,7 @@ if ( isset($_GET['op']) )
$content['Name'] = $mysource['Name'];
$content['SourceType'] = $mysource['SourceType'];
CreateSourceTypesList($content['SourceType']);
$content['MsgParserList'] = $mysource['MsgParserList'];
// Init View List!
$content['SourceViewID'] = $mysource['ViewID'];
@ -259,6 +261,7 @@ if ( isset($_POST['op']) )
if ( isset($_POST['id']) ) { $content['SOURCEID'] = intval(DB_RemoveBadChars($_POST['id'])); } else {$content['SOURCEID'] = -1; }
if ( isset($_POST['Name']) ) { $content['Name'] = DB_RemoveBadChars($_POST['Name']); } else {$content['Name'] = ""; }
if ( isset($_POST['SourceType']) ) { $content['SourceType'] = DB_RemoveBadChars($_POST['SourceType']); }
if ( isset($_POST['MsgParserList']) ) { $content['MsgParserList'] = DB_RemoveBadChars($_POST['MsgParserList']); }
if ( isset($_POST['SourceViewID']) ) { $content['SourceViewID'] = DB_RemoveBadChars($_POST['SourceViewID']); }
if ( isset($content['SourceType']) )
@ -408,6 +411,7 @@ if ( isset($_POST['op']) )
$tmpSource['ID'] = $content['SOURCEID'];
$tmpSource['Name'] = $content['Name'];
$tmpSource['SourceType']= $content['SourceType'];
$tmpSource['MsgParserList']= $content['MsgParserList'];
$tmpSource['ViewID'] = $content['SourceViewID'];
if ( $tmpSource['SourceType'] == SOURCE_DISK )
{
@ -455,9 +459,10 @@ if ( isset($_POST['op']) )
// Add custom search now!
if ( $content['SourceType'] == SOURCE_DISK )
{
$sqlquery = "INSERT INTO " . DB_SOURCES . " (Name, SourceType, ViewID, LogLineType, DiskFile, userid, groupid)
$sqlquery = "INSERT INTO " . DB_SOURCES . " (Name, SourceType, MsgParserList, ViewID, LogLineType, DiskFile, userid, groupid)
VALUES ('" . $content['Name'] . "',
" . $content['SourceType'] . ",
'" . $content['MsgParserList'] . "',
'" . $content['SourceViewID'] . "',
'" . $content['SourceLogLineType'] . "',
'" . $content['SourceDiskFile'] . "',
@ -467,9 +472,10 @@ if ( isset($_POST['op']) )
}
else if ( $content['SourceType'] == SOURCE_DB || $content['SourceType'] == SOURCE_PDO )
{
$sqlquery = "INSERT INTO " . DB_SOURCES . " (Name, SourceType, ViewID, DBTableType, DBType, DBServer, DBName, DBUser, DBPassword, DBTableName, DBEnableRowCounting, userid, groupid)
$sqlquery = "INSERT INTO " . DB_SOURCES . " (Name, SourceType, MsgParserList, ViewID, DBTableType, DBType, DBServer, DBName, DBUser, DBPassword, DBTableName, DBEnableRowCounting, userid, groupid)
VALUES ('" . $content['Name'] . "',
" . $content['SourceType'] . ",
'" . $content['MsgParserList'] . "',
'" . $content['SourceViewID'] . "',
'" . $content['SourceDBTableType'] . "',
" . $content['SourceDBType'] . ",
@ -507,6 +513,7 @@ if ( isset($_POST['op']) )
$sqlquery = "UPDATE " . DB_SOURCES . " SET
Name = '" . $content['Name'] . "',
SourceType = " . $content['SourceType'] . ",
MsgParserList = '" . $content['MsgParserList'] . "',
ViewID = '" . $content['SourceViewID'] . "',
LogLineType = '" . $content['SourceLogLineType'] . "',
DiskFile = '" . $content['SourceDiskFile'] . "',
@ -519,6 +526,7 @@ if ( isset($_POST['op']) )
$sqlquery = "UPDATE " . DB_SOURCES . " SET
Name = '" . $content['Name'] . "',
SourceType = " . $content['SourceType'] . ",
MsgParserList = '" . $content['MsgParserList'] . "',
ViewID = '" . $content['SourceViewID'] . "',
DBTableType = '" . $content['SourceDBTableType'] . "',
DBType = " . $content['SourceDBType'] . ",
@ -625,6 +633,14 @@ if ( !isset($_POST['op']) && !isset($_GET['op']) )
// ---
// print_r ( $content['SOURCES'] );
}
/*
* Helper function to read and init available msg parsers
*/
function ReadMsgParserList()
{
global $gl_root_path, $content;
}
// --- END Custom Code
// --- BEGIN CREATE TITLE

195
src/admin/upgrade.php Normal file
View File

@ -0,0 +1,195 @@
<?php
/*
*********************************************************************
* phpLogCon - http://www.phplogcon.org
* -----------------------------------------------------------------
* Sources Admin File
*
* -> Helps administrating phplogcon datasources
*
* 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
*********************************************************************
*/
// *** Default includes and procedures *** //
define('IN_PHPLOGCON', true);
$gl_root_path = './../';
// Now include necessary include files!
include($gl_root_path . 'include/functions_common.php');
include($gl_root_path . 'include/functions_frontendhelpers.php');
//include($gl_root_path . 'include/functions_filters.php');
// Set Upgrade Page!
define('IS_UPRGADEPAGE', true);
$content['IS_UPRGADEPAGE'] = true;
// Set PAGE to be ADMINPAGE!
define('IS_ADMINPAGE', true);
$content['IS_ADMINPAGE'] = true;
InitPhpLogCon();
InitSourceConfigs();
InitFrontEndDefaults(); // Only in WebFrontEnd
// Init admin langauge file now!
IncludeLanguageFile( $gl_root_path . '/lang/' . $LANG . '/admin.php' );
// *** *** //
// --- BEGIN Custom Code
if ( isset($content['database_forcedatabaseupdate']) && $content['database_forcedatabaseupdate'] == "yes" )
{
if ( isset($_GET['op']) )
{
if ($_GET['op'] == "upgrade")
{
// Lets start the uodating!
$content['UPGRADE_RUNNING'] = "1";
$content['sql_sucess'] = 0;
$content['sql_failed'] = 0;
$totaldbdefs = "";
$tblPref = GetConfigSetting("UserDBPref", "logcon");
// +1 so we start at the right DB Version!
for( $i = $content['database_installedversion']+1; $i <= $content['database_internalversion']; $i++ )
{
$myfilename = "db_update_v" . $i . ".txt";
// Lets read the table definitions :)
$handle = @fopen($content['BASEPATH'] . "include/" . $myfilename, "r");
if ($handle === false)
{
$content['ISERROR'] = "true";
$content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_DBUPGRADE_DBFILENOTFOUND'], $myfilename );
}
else
{
while (!feof($handle))
{
$buffer = fgets($handle, 4096);
$pos = strpos($buffer, "--");
if ($pos === false)
$totaldbdefs .= $buffer;
else if ( $pos > 2 && strlen( trim($buffer) ) > 1 )
$totaldbdefs .= $buffer;
}
fclose($handle);
}
}
if ( !isset($content['ISERROR']) )
{
if ( strlen($totaldbdefs) <= 0 )
{
$content['ISERROR'] = "true";
$content['ERROR_MSG'] = $content['LN_DBUPGRADE_DBDEFFILESHORT'];
}
// Replace stats_ with the custom one ;)
$totaldbdefs = str_replace( "`logcon_", "`" . $tblPref, $totaldbdefs );
// Now split by sql command
$mycommands = split( ";\r\n", $totaldbdefs );
// check for different linefeed
if ( count($mycommands) <= 1 )
$mycommands = split( ";\n", $totaldbdefs );
//Still only one? Abort
if ( count($mycommands) <= 1 )
{
$content['ISERROR'] = "true";
$content['ERROR_MSG'] = $content['LN_DBUPGRADE_DBDEFFILESHORT'];
}
if ( !isset($content['ISERROR']) )
{
// --- Now execute all commands
ini_set('error_reporting', E_WARNING); // Enable Warnings!
for($i = 0; $i < count($mycommands); $i++)
{
if ( strlen(trim($mycommands[$i])) > 1 )
{
$result = DB_Query( $mycommands[$i], false );
if ($result == FALSE)
{
$content['failedstatements'][ $content['sql_failed'] ]['myerrmsg'] = DB_ReturnSimpleErrorMsg();
$content['failedstatements'][ $content['sql_failed'] ]['mystatement'] = $mycommands[$i];
// --- Set CSS Class
if ( $content['sql_failed'] % 2 == 0 )
$content['failedstatements'][ $content['sql_failed'] ]['cssclass'] = "line1";
else
$content['failedstatements'][ $content['sql_failed'] ]['cssclass'] = "line2";
// ---
$content['sql_failed']++;
}
else
$content['sql_sucess']++;
// Free result
DB_FreeQuery($result);
}
}
// ---
// --- Upgrade Database Version in Config Table
$content['database_installedversion'] = $content['database_internalversion'];
WriteConfigValue( "database_installedversion", true );
// ---
}
}
}
else
$content['UPGRADE_DEFAULT'] = "1";
}
else
$content['UPGRADE_DEFAULT'] = "1";
}
else
$content['UPGRADE_DEFAULT'] = "0";
// disable running to be save! ;)
if ( isset($content['ISERROR']) )
$content['UPGRADE_RUNNING'] = "0";
// --- END Custom Code
// --- BEGIN CREATE TITLE
$content['TITLE'] = InitPageTitle();
$content['TITLE'] .= " :: " . $content['LN_DBUPGRADE_TITLE'];
// --- END CREATE TITLE
// --- Parsen and Output
InitTemplateParser();
$page -> parser($content, "admin/admin_upgrade.html");
$page -> output();
// ---
?>

View File

@ -40,6 +40,7 @@ if ( !defined('IN_PHPLOGCON') )
// --- Basic Includes
require_once($gl_root_path . 'classes/enums.class.php');
require_once($gl_root_path . 'classes/msgparser.class.php');
require_once($gl_root_path . 'include/constants_errors.php');
require_once($gl_root_path . 'include/constants_logstream.php');
// ---
@ -204,6 +205,14 @@ abstract class LogStream {
*/
public abstract function IsPropertySortable($myProperty);
/*
* Helper functino to trigger initialisation of MsgParsers
*/
public function RunBasicInits()
{
$this->_logStreamConfigObj->InitMsgParsers();
}
/**
* Set the filter for the current stream.
*
@ -582,7 +591,6 @@ abstract class LogStream {
return -1;
}
}
?>
?>

View File

@ -48,8 +48,89 @@ abstract class LogStreamConfig {
protected $_logStreamName = '';
protected $_defaultFacility = '';
protected $_defaultSeverity = '';
// helpers properties for message parser list!
protected $_msgParserList = null; // Contains a string list of configure msg parsers
protected $_msgParserObjList = null; // Contains an object reference list to the msg parsers
// Constructor prototype
public abstract function LogStreamFactory($o);
/*
* Initialize Msg Parsers!
*/
public function InitMsgParsers()
{
// Init parsers if available and not initialized already!
if ( $this->_msgParserList != null && $this->_msgParserObjList == null )
{
// Loop through parsers
foreach( $this->_msgParserList as $szParser )
{
// Set Classname
$szClassName = "MsgParser_" . $szParser;
// Create OBjectRef!
$this->_msgParserObjList[] = new $szClassName();
}
}
}
/*
*
*/
public function SetMsgParserList( $szParsers )
{
global $gl_root_path;
// Check if we have at least something to check
if ( $szParsers == null || strlen($szParsers) <= 0 )
return;
// Set list of Parsers!
if ( strpos($szParsers, ",") )
$aParsers = explode( ",", $szParsers );
else
$aParsers[0] = $szParsers;
// Loop through parsers
foreach( $aParsers as $szParser )
{
// Remove whitespaces
$szParser = trim($szParser);
// Check if parser file include exists
$szIncludeFile = $gl_root_path . 'classes/msgparsers/msgparser.' . $szParser . '.class.php';
if ( file_exists($szIncludeFile) )
{
// Try to include
if ( @include_once($szIncludeFile) )
$this->_msgParserList[] = $szParser;
else
OutputDebugMessage("Error, MsgParser '" . $szParser . "' could not be included. ", DEBUG_ERROR);
}
}
// print_r ( $this->_msgParserList );
}
public function ProcessMsgParsers($szMsg, &$arrArguments)
{
// Process if set!
if ( $this->_msgParserObjList != null )
{
foreach( $this->_msgParserObjList as $myMsgParser )
{
// Perform Parsing, and return if was successfull! Otherwise the next Parser will be called.
if ( $myMsgParser->ParseMsg($szMsg, $arrArguments) == SUCCESS )
return SUCCESS;
}
}
// reached this means all work is done!
return SUCCESS;
}
}
?>

View File

@ -84,6 +84,9 @@ class LogStreamDB extends LogStream {
{
global $dbmapping;
// Initialise Basic stuff within the Classs
$this->RunBasicInits();
// Verify database connection (This also opens the database!)
$res = $this->Verify();
if ( $res != SUCCESS )

View File

@ -73,7 +73,10 @@ class LogStreamDisk extends LogStream {
* @param arrProperties array in: Properties wish list.
* @return integer Error stat
*/
public function Open($arrProperties) {
public function Open($arrProperties)
{
// Initialise Basic stuff within the Classs
$this->RunBasicInits();
// Check if file exists!
$result = $this->Verify();
@ -235,6 +238,9 @@ class LogStreamDisk extends LogStream {
{
// Line Parser Hook here
$this->_logStreamConfigObj->_lineParser->ParseLine($arrProperitesOut[SYSLOG_MESSAGE], $arrProperitesOut);
// Run optional Message Parsers now
$this->_logStreamConfigObj->ProcessMsgParsers($arrProperitesOut[SYSLOG_MESSAGE], $arrProperitesOut);
// Set uID to the PropertiesOut!
$arrProperitesOut[SYSLOG_UID] = $uID;

View File

@ -87,6 +87,9 @@ class LogStreamPDO extends LogStream {
{
global $dbmapping;
// Initialise Basic stuff within the Classs
$this->RunBasicInits();
// Verify database driver and connection (This also opens the database!)
$res = $this->Verify();
if ( $res != SUCCESS )

View File

@ -40,16 +40,16 @@ if ( !defined('IN_PHPLOGCON') )
// --- Basic Includes
require_once($gl_root_path . 'classes/enums.class.php');
require_once($gl_root_path . 'classes/msgparser.class.php');
require_once($gl_root_path . 'include/constants_errors.php');
require_once($gl_root_path . 'include/constants_logstream.php');
// ---
class MsgParserEventLog extends MsgParser {
class MsgParser_eventlog extends MsgParser {
// protected $_arrProperties = null;
// Constructor
public function LogStreamLineParserwinsyslog() {
public function MsgParser_eventlog() {
return; // Nothing
}
@ -63,28 +63,28 @@ class MsgParserEventLog extends MsgParser {
{
global $content;
// Set IUT Property first!
$arrArguments[SYSLOG_MESSAGETYPE] = IUT_Syslog;
/*
// Sample (WinSyslog/EventReporter): 2008-04-02,15:19:06,2008-04-02,15:19:06,127.0.0.1,16,5,EvntSLog: Performance counters for the RSVP (QoS RSVP) service were loaded successfully.
if ( preg_match("/([0-9]{4,4}-[0-9]{1,2}-[0-9]{1,2},[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}),([0-9]{4,4}-[0-9]{1,2}-[0-9]{1,2},[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}),(.*?),([0-9]{1,2}),([0-9]{1,2}),(.*?):(.*?)$/", $szMsg, $out ) )
// Sample (WinSyslog/EventReporter): 7035,XPVS2005\Administrator,Service Control Manager,System,[INF],0,The Adiscon EvntSLog service was successfully sent a start control.
// Source: %id%,%user%,%sourceproc%,%NTEventLogType%,%severity%,%category%,%msg%%$CRLF%
if ( preg_match("/([0-9]{1,12}),(.*?),(.*?),(.*?),(.*?),([0-9]{1,12}),(.*?)$/", $szMsg, $out ) )
{
// Copy parsed properties!
$arrArguments[SYSLOG_DATE] = GetEventTime($out[1]);
$arrArguments[SYSLOG_HOST] = $out[3];
$arrArguments[SYSLOG_FACILITY] = $out[4];
$arrArguments[SYSLOG_SEVERITY] = $out[5];
$arrArguments[SYSLOG_SYSLOGTAG] = $out[6];
$arrArguments[SYSLOG_EVENT_ID] = $out[1];
$arrArguments[SYSLOG_EVENT_USER] = $out[2];
$arrArguments[SYSLOG_EVENT_SOURCE] = $out[3];
$arrArguments[SYSLOG_EVENT_LOGTYPE] = $out[4];
/// $arrArguments[SYSLOG_SEVERITY] = $out[5];
$arrArguments[SYSLOG_EVENT_CATEGORY] = $out[6];
$arrArguments[SYSLOG_MESSAGE] = $out[7];
}
else
*/
{
// return no match in this case!
return ERROR_MSG_NOMATCH;
}
// Set IUT Property if success!
$arrArguments[SYSLOG_MESSAGETYPE] = IUT_NT_EventReport;
// If we reached this position, return success!
return SUCCESS;
}

View File

@ -162,7 +162,7 @@ else if ( $content['CONVERT_STEP'] == 3 )
}
// Append INSERT Statement for Config Table to set the Database Version ^^!
$mycommands[count($mycommands)] = "INSERT INTO `" . GetConfigSetting("UserDBPref") . "config` (`propname`, `propvalue`, `is_global`) VALUES ('database_installedversion', '" . $content['database_internalversion'] . "', 1)";
$mycommands[count($mycommands)] = "INSERT INTO `" . GetConfigSetting("UserDBPref") . "config` (`propname`, `propvalue`, `is_global`) VALUES ('database_installedversion', '" . $content['database_internalversion'] . "', " . $content['database_internalversion'] . ")";
// --- Now execute all commands
ini_set('error_reporting', E_WARNING); // Enable Warnings!

View File

@ -104,12 +104,14 @@ $CFG['Search'][] = array ( "DisplayName" => "All messages from last 31 days", "S
$CFG['Sources']['Source1']['Name'] = "Syslog Disk File";
$CFG['Sources']['Source1']['SourceType'] = SOURCE_DISK;
$CFG['Sources']['Source1']['LogLineType'] = "syslog";
$CFG['Sources']['Source1']['MsgParserList'] = "";
$CFG['Sources']['Source1']['DiskFile'] = "/var/log/syslog";
$CFG['Sources']['Source1']['ViewID'] = "SYSLOG";
$CFG['Sources']['Source2']['ID'] = "Source5";
$CFG['Sources']['Source2']['Name'] = "WinSyslog DB";
$CFG['Sources']['Source2']['SourceType'] = SOURCE_DB;
$CFG['Sources']['Source1']['MsgParserList'] = "";
$CFG['Sources']['Source2']['DBTableType'] = "winsyslog";
$CFG['Sources']['Source2']['DBType'] = DB_MYSQL;
$CFG['Sources']['Source2']['DBServer'] = "localhost";

View File

@ -60,10 +60,11 @@ CREATE TABLE IF NOT EXISTS `logcon_searches` (
--
DROP TABLE IF EXISTS `logcon_sources`;
CREATE TABLE IF NOT EXISTS `logcon_sources` (
CREATE TABLE `logcon_sources` (
`ID` int(11) NOT NULL auto_increment,
`Name` varchar(255) NOT NULL,
`SourceType` tinyint(4) NOT NULL,
`MsgParserList` varchar(255) NOT NULL,
`ViewID` varchar(64) NOT NULL,
`LogLineType` varchar(64) default NULL,
`DiskFile` varchar(255) default NULL,

View File

@ -0,0 +1,6 @@
-- New Database Structure Updates
ALTER TABLE `logcon_sources` ADD `MsgParserList` VARCHAR( 255 ) NOT NULL AFTER `SourceType` ;
-- Insert data
-- Updated Data

View File

@ -40,13 +40,13 @@ if ( !defined('IN_PHPLOGCON') )
// ---
// --- Basic Includes
include($gl_root_path . 'include/constants_general.php');
include($gl_root_path . 'include/constants_logstream.php');
include_once($gl_root_path . 'include/constants_general.php');
include_once($gl_root_path . 'include/constants_logstream.php');
include($gl_root_path . 'classes/class_template.php');
include($gl_root_path . 'include/functions_themes.php');
include($gl_root_path . 'include/functions_db.php');
include($gl_root_path . 'include/functions_config.php');
include_once($gl_root_path . 'classes/class_template.php');
include_once($gl_root_path . 'include/functions_themes.php');
include_once($gl_root_path . 'include/functions_db.php');
include_once($gl_root_path . 'include/functions_config.php');
// ---
// --- Define Basic vars
@ -551,6 +551,13 @@ function InitConfigurationValues()
else // Critical ERROR HERE!
DieWithFriendlyErrorMsg( "Critical Error occured while trying to access the database in table '" . DB_CONFIG . "'" );
// Database Version Checker!
if ( $content['database_internalversion'] > $content['database_installedversion'] )
{
// Database is out of date, we need to upgrade
$content['database_forcedatabaseupdate'] = "yes";
}
// Now we init the user session stuff
InitUserSession();
@ -579,14 +586,6 @@ function InitConfigurationValues()
// Load Configured Sources
LoadSourcesFromDatabase();
// Database Version Checker!
if ( $content['database_internalversion'] > $content['database_installedversion'] )
{
// Database is out of date, we need to upgrade
$content['database_forcedatabaseupdate'] = "yes";
}
}
else
{

View File

@ -67,6 +67,12 @@ function InitSource(&$mysource)
$CFG['Sources'][$iSourceID]['groupid'] = null;
$content['Sources'][$iSourceID]['groupid'] = null;
}
if ( !isset($mysource['MsgParserList']) )
{
$CFG['Sources'][$iSourceID]['MsgParserList'] = null;
$content['Sources'][$iSourceID]['MsgParserList'] = null;
}
// ---
// Set default view id to source
@ -165,6 +171,7 @@ function InitSource(&$mysource)
// Set generic configuration options
$mysource['ObjRef']->_pageCount = GetConfigSetting("ViewEntriesPerPage", 50);
$mysource['ObjRef']->SetMsgParserList( $mysource['MsgParserList'] );
// Set default SourceID here!
if ( isset($content['Sources'][$iSourceID]) && !isset($currentSourceID) )

View File

@ -45,7 +45,7 @@ $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_internalversion'] = "2"; // Whenever incremented, a database upgrade is needed
$content['database_installedversion'] = "0"; // 0 is default which means Prior Versioning Database
// ---

View File

@ -97,18 +97,15 @@ function InitUserSession()
else // Critical ERROR HERE!
DieWithFriendlyErrorMsg( "Critical Error occured while trying to access the database in table '" . DB_CONFIG . "'" );
// ---
// --- Extracheck for available database updates!
if ( isset($content['database_forcedatabaseupdate']) && $content['database_forcedatabaseupdate'] == "yes" && !defined('IS_UPRGADEPAGE') )
RedirectToDatabaseUpgrade();
// ---
// Successfully logged in
return true;
}
/*
// New, Check for database Version and may redirect to updatepage!
if ( isset($content['database_forcedatabaseupdate']) &&
$content['database_forcedatabaseupdate'] == "yes" &&
$isUpgradePage == false
)
RedirectToDatabaseUpgrade();
*/
}
else
{
@ -189,12 +186,16 @@ function CheckUserLogin( $username, $password )
$_SESSION['SESSION_GROUPIDS'] = $content['SESSION_GROUPIDS'];
// ---
// ---Set LASTLOGIN Time!
$result = DB_Query("UPDATE " . DB_USERS . " SET last_login = " . time() . " WHERE ID = " . $content['SESSION_USERID']);
DB_FreeQuery($result);
// ---
// --- Extracheck for available database updates!
if ( isset($content['database_forcedatabaseupdate']) && $content['database_forcedatabaseupdate'] == "yes" && !defined('IS_UPRGADEPAGE') )
RedirectToDatabaseUpgrade();
// ---
// Success !
return true;
}
@ -236,12 +237,14 @@ function RedirectToUserLogin()
function RedirectToDatabaseUpgrade()
{
global $content;
// build referer
$referer = $_SERVER['PHP_SELF'];
if ( isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0 )
$referer .= "?" . $_SERVER['QUERY_STRING'];
header("Location: upgrade.php?referer=" . urlencode($referer) );
header("Location: " . $content['BASEPATH'] . "admin/upgrade.php?referer=" . urlencode($referer) );
exit;
}
// --- END Usermanagement Function ---

View File

@ -394,7 +394,7 @@ else if ( $content['INSTALL_STEP'] == 5 )
}
// Append INSERT Statement for Config Table to set the Database Version ^^!
$mycommands[count($mycommands)] = "INSERT INTO `" . $_SESSION["UserDBPref"] . "config` (`propname`, `propvalue`, `is_global`) VALUES ('database_installedversion', '" . $content['database_internalversion'] . "', 1)";
$mycommands[count($mycommands)] = "INSERT INTO `" . $_SESSION["UserDBPref"] . "config` (`propname`, `propvalue`, `is_global`) VALUES ('database_installedversion', '" . $content['database_internalversion'] . "', " . $content['database_internalversion'] . ")";
// --- Now execute all commands
ini_set('error_reporting', E_WARNING); // Enable Warnings!

View File

@ -166,7 +166,7 @@ $content['LN_SEARCH_ERROR_DELSEARCH'] = "Deleting of the Custom Search with id '
$content['LN_SEARCH_ERROR_HASBEENDEL'] = "The Custom Search '%1' has been successfully deleted!";
$content['LN_SEARCH_'] = "";
// Custom Searches center
// Custom Views center
$content['LN_VIEWS_CENTER'] = "Views Options";
$content['LN_VIEWS_ID'] = "ID";
$content['LN_VIEWS_NAME'] = "View Name";
@ -190,6 +190,7 @@ $content['LN_VIEWS_ERROR_NOCOLUMNS'] = "You need to add at least one column in o
$content['LN_VIEWS_HASBEENEDIT'] = "The Custom Search '%1' has been successfully edited.";
$content['LN_VIEWS_'] = "";
// Custom Sources center
$content['LN_SOURCES_CENTER'] = "Sources Options";
$content['LN_SOURCES_EDIT'] = "Edit Source";
$content['LN_SOURCES_DELETE'] = "Delete Source";
@ -217,5 +218,19 @@ $content['LN_SOURCES_ERROR_DELSOURCE'] = "Deleting of the Source with id '%1' fa
$content['LN_SOURCES_ERROR_HASBEENDEL'] = "The Source '%1' has been successfully deleted!";
$content['LN_SOURCES_'] = "";
// Database Upgrade
$content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update";
$content['LN_DBUPGRADE_DBFILENOTFOUND'] = "The database upgrade file '%1' could not be found in the include folder! Please check if all files were successfully uploaded.";
$content['LN_DBUPGRADE_DBDEFFILESHORT'] = "The database upgrade files where empty or did not contain any SQL Command! Please check if all files were successfully uploaded.";
$content['LN_DBUPGRADE_WELCOME'] = "Welcome to the database upgrade";
$content['LN_DBUPGRADE_BEFORESTART'] = "Before you start upgrading your database, you should create a <b>FULL BACKUP OF YOUR DATABASE</b>. Anything else will be done automatically by the upgrade Script.";
$content['LN_DBUPGRADE_CURRENTINSTALLED'] = "Current Installed Database Version";
$content['LN_DBUPGRADE_TOBEINSTALLED'] = "Do be Installed Database Version";
$content['LN_DBUPGRADE_HASBEENDONE'] = "Database Update has been performed, see the results below";
$content['LN_DBUPGRADE_SUCCESSEXEC'] = "Successfully executed statements";
$content['LN_DBUPGRADE_FAILEDEXEC'] = "Failed statements";
$content['LN_DBUPGRADE_ONESTATEMENTFAILED'] = "At least one statement failed, you may need to correct and fix this issue manually. See error details below";
$content['LN_DBUPGRADE_ERRMSG'] = "Error Message";
$content['LN_DBUPGRADE_ULTRASTATSDBVERSION'] = "phpLogCon Database Version";
?>

View File

@ -190,6 +190,7 @@ $content['LN_CFG_NAMEOFTHESOURCE'] = "Name der Quelle";
$content['LN_CFG_FIRSTSYSLOGSOURCE'] = "Erste Syslog Quelle";
$content['LN_CFG_VIEW'] = "Select View";
$content['LN_CFG_DBUSERLOGINREQUIRED'] = "Require user to be logged in";
$content['LN_CFG_MSGPARSERS'] = "Message Parsers (comma seperated)";
// Details page
$content['LN_DETAILS_FORSYSLOGMSG'] = "Details für syslog-Nachrichten mit der ID";

View File

@ -49,7 +49,6 @@ $content['LN_GEN_USERONLY_LONG'] = "For me only <br>(Only available to your user
$content['LN_GEN_GROUPONLY_LONG'] = "For this group <br>(Only available to the selected group)";
$content['LN_GEN_GROUPONLYNAME'] = "Group '%1'";
// General Options
$content['LN_ADMIN_GLOBFRONTEND'] = "Global frontend options";
$content['LN_ADMIN_USERFRONTEND'] = "User specific frontend options";
@ -166,7 +165,7 @@ $content['LN_SEARCH_ERROR_DELSEARCH'] = "Deleting of the Custom Search with id '
$content['LN_SEARCH_ERROR_HASBEENDEL'] = "The Custom Search '%1' has been successfully deleted!";
$content['LN_SEARCH_'] = "";
// Custom Searches center
// Custom Views center
$content['LN_VIEWS_CENTER'] = "Views Options";
$content['LN_VIEWS_ID'] = "ID";
$content['LN_VIEWS_NAME'] = "View Name";
@ -190,6 +189,7 @@ $content['LN_VIEWS_ERROR_NOCOLUMNS'] = "You need to add at least one column in o
$content['LN_VIEWS_HASBEENEDIT'] = "The Custom Search '%1' has been successfully edited.";
$content['LN_VIEWS_'] = "";
// Custom Sources center
$content['LN_SOURCES_CENTER'] = "Sources Options";
$content['LN_SOURCES_EDIT'] = "Edit Source";
$content['LN_SOURCES_DELETE'] = "Delete Source";
@ -217,5 +217,21 @@ $content['LN_SOURCES_ERROR_DELSOURCE'] = "Deleting of the Source with id '%1' fa
$content['LN_SOURCES_ERROR_HASBEENDEL'] = "The Source '%1' has been successfully deleted!";
$content['LN_SOURCES_'] = "";
// Database Upgrade
$content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update";
$content['LN_DBUPGRADE_DBFILENOTFOUND'] = "The database upgrade file '%1' could not be found in the include folder! Please check if all files were successfully uploaded.";
$content['LN_DBUPGRADE_DBDEFFILESHORT'] = "The database upgrade files where empty or did not contain any SQL Command! Please check if all files were successfully uploaded.";
$content['LN_DBUPGRADE_WELCOME'] = "Welcome to the database upgrade";
$content['LN_DBUPGRADE_BEFORESTART'] = "Before you start upgrading your database, you should create a <b>FULL BACKUP OF YOUR DATABASE</b>. Anything else will be done automatically by the upgrade Script.";
$content['LN_DBUPGRADE_CURRENTINSTALLED'] = "Current Installed Database Version";
$content['LN_DBUPGRADE_TOBEINSTALLED'] = "Do be Installed Database Version";
$content['LN_DBUPGRADE_HASBEENDONE'] = "Database Update has been performed, see the results below";
$content['LN_DBUPGRADE_SUCCESSEXEC'] = "Successfully executed statements";
$content['LN_DBUPGRADE_FAILEDEXEC'] = "Failed statements";
$content['LN_DBUPGRADE_ONESTATEMENTFAILED'] = "At least one statement failed, you may need to correct and fix this issue manually. See error details below";
$content['LN_DBUPGRADE_ERRMSG'] = "Error Message";
$content['LN_DBUPGRADE_ULTRASTATSDBVERSION'] = "phpLogCon Database Version";
?>

View File

@ -190,6 +190,7 @@ $content['LN_CFG_FIRSTSYSLOGSOURCE'] = "First Syslog Source";
$content['LN_CFG_DBROWCOUNTING'] = "Enable Row Counting";
$content['LN_CFG_VIEW'] = "Select View";
$content['LN_CFG_DBUSERLOGINREQUIRED'] = "Require user to be logged in";
$content['LN_CFG_MSGPARSERS'] = "Message Parsers (comma seperated)";
// Details page
$content['LN_DETAILS_FORSYSLOGMSG'] = "Details for the syslog messages with id";

View File

@ -165,7 +165,7 @@ $content['LN_SEARCH_ERROR_DELSEARCH'] = "Deleting of the Custom Search with id '
$content['LN_SEARCH_ERROR_HASBEENDEL'] = "The Custom Search '%1' has been successfully deleted!";
$content['LN_SEARCH_'] = "";
// Custom Searches center
// Custom Views center
$content['LN_VIEWS_CENTER'] = "Views Options";
$content['LN_VIEWS_ID'] = "ID";
$content['LN_VIEWS_NAME'] = "View Name";
@ -189,6 +189,7 @@ $content['LN_VIEWS_ERROR_NOCOLUMNS'] = "You need to add at least one column in o
$content['LN_VIEWS_HASBEENEDIT'] = "The Custom Search '%1' has been successfully edited.";
$content['LN_VIEWS_'] = "";
// Custom Sources center
$content['LN_SOURCES_CENTER'] = "Sources Options";
$content['LN_SOURCES_EDIT'] = "Edit Source";
$content['LN_SOURCES_DELETE'] = "Delete Source";
@ -216,5 +217,19 @@ $content['LN_SOURCES_ERROR_DELSOURCE'] = "Deleting of the Source with id '%1' fa
$content['LN_SOURCES_ERROR_HASBEENDEL'] = "The Source '%1' has been successfully deleted!";
$content['LN_SOURCES_'] = "";
// Database Upgrade
$content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update";
$content['LN_DBUPGRADE_DBFILENOTFOUND'] = "The database upgrade file '%1' could not be found in the include folder! Please check if all files were successfully uploaded.";
$content['LN_DBUPGRADE_DBDEFFILESHORT'] = "The database upgrade files where empty or did not contain any SQL Command! Please check if all files were successfully uploaded.";
$content['LN_DBUPGRADE_WELCOME'] = "Welcome to the database upgrade";
$content['LN_DBUPGRADE_BEFORESTART'] = "Before you start upgrading your database, you should create a <b>FULL BACKUP OF YOUR DATABASE</b>. Anything else will be done automatically by the upgrade Script.";
$content['LN_DBUPGRADE_CURRENTINSTALLED'] = "Current Installed Database Version";
$content['LN_DBUPGRADE_TOBEINSTALLED'] = "Do be Installed Database Version";
$content['LN_DBUPGRADE_HASBEENDONE'] = "Database Update has been performed, see the results below";
$content['LN_DBUPGRADE_SUCCESSEXEC'] = "Successfully executed statements";
$content['LN_DBUPGRADE_FAILEDEXEC'] = "Failed statements";
$content['LN_DBUPGRADE_ONESTATEMENTFAILED'] = "At least one statement failed, you may need to correct and fix this issue manually. See error details below";
$content['LN_DBUPGRADE_ERRMSG'] = "Error Message";
$content['LN_DBUPGRADE_ULTRASTATSDBVERSION'] = "phpLogCon Database Version";
?>

View File

@ -194,6 +194,8 @@ $content['LN_CFG_NAMEOFTHESOURCE'] = "Nome da origem";
$content['LN_CFG_FIRSTSYSLOGSOURCE'] = "Fonte prim&aacute;ria Syslog";
$content['LN_CFG_DBROWCOUNTING'] = "Habilitar contagem de registro";
$content['LN_CFG_VIEW'] = "Selecione vis&atilde;o";
$content['LN_CFG_DBUSERLOGINREQUIRED'] = "Require user to be logged in";
$content['LN_CFG_MSGPARSERS'] = "Message Parsers (comma seperated)";
// Details page
$content['LN_DETAILS_FORSYSLOGMSG'] = "Detalhes para a mensagem com id";

View File

@ -122,6 +122,10 @@
</select>
</td>
</tr>
<tr>
<td align="left" class="cellmenu2" nowrap><b>{LN_CFG_MSGPARSERS}</b></td>
<td align="right" class="line1"><input type="text" name="MsgParserList" size="55" maxlength="255" value="{MsgParserList}"></td>
</tr>
<tr>
<td align="left" class="cellmenu2"><b>{LN_GEN_USERONLY}</b></td>
<td align="right" class="line1"><input type="checkbox" name="isuseronly" value="{userid}" {CHECKED_ISUSERONLY}></td>

View File

@ -0,0 +1,110 @@
<!-- INCLUDE include_header.html -->
<!-- IF ISERROR="true" -->
<br><br>
<center>
<div class="table_with_border_second ErrorMsg" style="width:600px">
<div class="PriorityError">{LN_GEN_ERRORDETAILS}</div>
<p>{ERROR_MSG}</p>
</div>
<br><br>
<a href="javascript:history.back();" target="_top">{LN_GEN_ERRORRETURNPREV}</a>
</center>
<br><br>
<!-- ENDIF ISERROR="true" -->
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="with_border">
<tr>
<td colspan="3" class="title" nowrap><B>{LN_DBUPGRADE_TITLE}</B></td>
</tr>
<tr>
<td align="center" class="line2">
<!-- IF UPGRADE_DEFAULT="1" -->
<table width="100%" cellpadding="5" cellspacing="1" border="0" align="center" class="with_border_alternate">
<tr>
<td class="line1">
<br><br>
<h1>{LN_DBUPGRADE_WELCOME}</h1>
<p>{LN_DBUPGRADE_BEFORESTART}<br><br>
{LN_DBUPGRADE_CURRENTINSTALLED}: <B>{database_installedversion}</B><br>
{LN_DBUPGRADE_TOBEINSTALLED}: <B>{database_internalversion}</B><br></p>
<br><br>
<center>Click on <a href="?op=upgrade"><B>Upgrade</B></a> to start!</center>
<p>&nbsp;</p>
</td>
</tr>
</table>
<!-- ENDIF UPGRADE_DEFAULT="1" -->
<!-- IF UPGRADE_RUNNING="1" -->
<table width="100%" cellpadding="5" cellspacing="1" border="0" align="center" class="with_border_alternate">
<tr>
<td class="line1">
<br><br>
<p>{LN_DBUPGRADE_HASBEENDONE}: <br><br>
<li>{LN_DBUPGRADE_SUCCESSEXEC}: <B>{sql_sucess}</B><br>
<li>{LN_DBUPGRADE_FAILEDEXEC}: <B>{sql_failed}</B> <br>
<!-- IF sql_failed!="0" -->
<table width="700" class="with_border_alternate" cellpadding="2" cellspacing="1" border="0" align="center">
<tr>
<td colspan="2" nowrap class="cellmenu1" align="center"><B>{LN_DBUPGRADE_ONESTATEMENTFAILED}</B></td>
</tr>
<tr>
<td width="400" class="cellmenu1">{LN_DBUPGRADE_ERRMSG}</td>
<td width="300" class="cellmenu1" align="center"><B>SQL Statement</B></td>
</tr>
<!-- BEGIN failedstatements -->
<tr>
<td class="line0">{myerrmsg}</td>
<td class="line0" align="center">{mystatement}</td>
</tr>
<!-- END failedstatements -->
</table>
<p>&nbsp;</p>
<!-- ENDIF sql_failed!="0" -->
{LN_DBUPGRADE_CURRENTINSTALLED}: <B>{database_installedversion}</B><br>
{LN_DBUPGRADE_TOBEINSTALLED}: <B>{database_internalversion}</B><br>
<br><br>
<center>Click on <a href="index.php"><B>here</B></a> to return to the <B>Admin Center</B></center>
<p>&nbsp;</p>
</td>
</tr>
</table>
<!-- ENDIF UPGRADE_RUNNING="1" -->
<!-- IF UPGRADE_DEFAULT="0" -->
<table width="100%" cellpadding="5" cellspacing="1" border="0" align="center" class="with_border_alternate">
<tr>
<td class="line1">
<h1>Welcome to the Database Upgrade</h1>
<center><h2><font color="blue">Your database is fully updated!</font></h2></center></p>
{LN_DBUPGRADE_CURRENTINSTALLED}: <B>{database_installedversion}</B><br>
{LN_DBUPGRADE_ULTRASTATSDBVERSION}: <B>{database_internalversion}</B><br></p>
<br><br>
<center>Click on <a href="index.php"><B>here</B></a> to return to the <B>Admin Center</B></center>
<p>&nbsp;</p>
</td>
</tr>
</table>
<!-- ENDIF UPGRADE_DEFAULT="0" -->
<br><br>
</td>
</tr>
</table>
<!-- INCLUDE include_footer.html -->