Fixed merge conflicts

Merge branch 'beta' into devel

Conflicts:

	src/include/functions_common.php
This commit is contained in:
Andre Lorbach 2008-10-07 11:24:06 +02:00
commit defad2dedd
9 changed files with 178 additions and 7 deletions

View File

@ -1,4 +1,7 @@
---------------------------------------------------------------------------
Version 2.5.13 (beta), 2008-10-07
-
---------------------------------------------------------------------------
Version 2.5.12 (beta), 2008-09-29
- Fixed several SQL issues in the logstream classes when filtering
was used.

View File

@ -3,8 +3,10 @@
*********************************************************************
* -> www.phplogcon.org <- *
* ----------------------------------------------------------------- *
* Apache Logfile Parser used to split WebLog fields if found
* in the msg
* Apache Logfile Parser used to split WebLog fields if
* found in the msg.
*
* This Parser is for the default apache "combined" format!
* *
* All directives are explained within this file *
*
@ -63,6 +65,9 @@ class MsgParser_apache2 extends MsgParser {
{
global $content, $fields;
//trim the msg first to remove spaces from begin and end
$szMsg = trim($szMsg);
//return ERROR_MSG_NOMATCH;
// LogFormat "%h %l %u %t \"%r\" %>s %b" common
@ -95,7 +100,7 @@ class MsgParser_apache2 extends MsgParser {
$arrArguments[SYSLOG_WEBLOG_QUERYSTRING]= substr( $out[6], strpos($out[6], "?")+1 );
}
// $arrArguments[SYSLOG_WEBLOG_QUERYSTRING] = $out[7];
// Number based fields
$arrArguments[SYSLOG_WEBLOG_PVER] = $out[7];
$arrArguments[SYSLOG_WEBLOG_STATUS] = $out[8];
$arrArguments[SYSLOG_WEBLOG_BYTESSEND] = $out[9];

View File

@ -0,0 +1,149 @@
<?php
/*
*********************************************************************
* -> www.phplogcon.org <- *
* ----------------------------------------------------------------- *
* Apache Logfile Parser used to split WebLog fields if
* found in the msg.
*
* This Parser is for the default apache "common" format!
* *
* 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;
}
// ---
// --- 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 MsgParser_apache2common extends MsgParser {
// protected $_arrProperties = null;
// Constructor
public function MsgParser_apache2common() {
return; // Nothing
}
/**
* ParseLine
*
* @param arrArguments array in&out: properties of interest. There can be no guarantee the logstream can actually deliver them.
* @return integer Error stat
*/
public function ParseMsg($szMsg, &$arrArguments)
{
global $content, $fields;
//trim the msg first to remove spaces from begin and end
$szMsg = trim($szMsg);
//return ERROR_MSG_NOMATCH;
// LogFormat "%h %l %u %t \"%r\" %>s %b" common
// LogFormat "%{Referer}i -> %U" referer
// LogFormat "%{User-agent}i" agent
// LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
// Sample (apache2): 127.0.0.1 - - [14/Sep/2008:06:50:15 +0200] "GET / HTTP/1.0" 200 19023
// Sample: 65.55.211.112 - - [16/Sep/2008:13:37:47 +0200] "GET /index.php?name=News&file=article&sid=1&theme=Printer HTTP/1.1" 200 4908
if ( preg_match('/(.|.*?) (.|.*?) (.|.*?) \[(.*?)\] "(.*?) (.*?) (.*?)" (.|[0-9]{1,12}) (.|[0-9]{1,12})$/', $szMsg, $out ) )
{
// print_r ( $out );
// exit;
// Set generic properties
$arrArguments[SYSLOG_HOST] = $out[1];
$arrArguments[SYSLOG_DATE] = GetEventTime($out[4]);
// Set weblog specific properties!
$arrArguments[SYSLOG_WEBLOG_USER] = $out[3];
$arrArguments[SYSLOG_WEBLOG_METHOD] = $out[5];
if ( strpos($out[6], "?") === false )
{
$arrArguments[SYSLOG_WEBLOG_URL] = $out[6];
$arrArguments[SYSLOG_WEBLOG_QUERYSTRING]= "";
}
else
{
$arrArguments[SYSLOG_WEBLOG_URL] = substr( $out[6], 0, strpos($out[6], "?"));
$arrArguments[SYSLOG_WEBLOG_QUERYSTRING]= substr( $out[6], strpos($out[6], "?")+1 );
}
// Number based fields
$arrArguments[SYSLOG_WEBLOG_PVER] = $out[7];
$arrArguments[SYSLOG_WEBLOG_STATUS] = $out[8];
$arrArguments[SYSLOG_WEBLOG_BYTESSEND] = $out[9];
// Set msg to whole logline
$arrArguments[SYSLOG_MESSAGE] = $out[0];
if ( $this->_MsgNormalize == 1 )
{
//Init tmp msg
$szTmpMsg = "";
// Create Field Array to prepend into msg! Reverse Order here
$myFields = array( SYSLOG_WEBLOG_USER, SYSLOG_WEBLOG_PVER, SYSLOG_WEBLOG_BYTESSEND, SYSLOG_WEBLOG_STATUS, SYSLOG_WEBLOG_METHOD, SYSLOG_WEBLOG_QUERYSTRING, SYSLOG_WEBLOG_URL );
foreach ( $myFields as $myField )
{
// Set Field Caption
if ( isset($content[ $fields[$myField]['FieldCaptionID'] ]) )
$szFieldName = $content[ $fields[$myField]['FieldCaptionID'] ];
else
$szFieldName = $fields[$myField]['FieldCaptionID'];
// Append Field into msg
$szTmpMsg = $szFieldName . ": '" . $arrArguments[$myField] . "'\n" . $szTmpMsg;
}
// copy finished MSG back!
$arrArguments[SYSLOG_MESSAGE] = $szTmpMsg;
}
}
else
{
// return no match in this case!
return ERROR_MSG_NOMATCH;
}
// Set IUT Property if success!
$arrArguments[SYSLOG_MESSAGETYPE] = IUT_WEBSERVERLOG;
// If we reached this position, return success!
return SUCCESS;
}
}
?>

View File

@ -63,6 +63,9 @@ class MsgParser_eventlog extends MsgParser {
{
global $content, $fields;
//trim the msg first to remove spaces from begin and end
$szMsg = trim($szMsg);
// 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 ) )

View File

@ -62,6 +62,9 @@ class MsgParser_iis extends MsgParser {
public function ParseMsg($szMsg, &$arrArguments)
{
global $content, $fields;
//trim the msg first to remove spaces from begin and end
$szMsg = trim($szMsg);
// $iSharpPos = strpos($szMsg, "#");
// if ( $iSharpPos !== false && $iSharpPos == 0 )

View File

@ -117,6 +117,8 @@ function InitUserSystemPhpLogCon()
function CheckForInstallPhp()
{
global $content;
// Check for installscript!
if ( file_exists($content['BASEPATH'] . "install.php") )
$strinstallmsg = '<br><br>'

View File

@ -321,6 +321,9 @@ function InitPhpLogConConfigFile($bHandleMissing = true)
// Needed to make global
global $CFG, $gl_root_path, $content;
// Bugfix for race conditions, clear file stats cache!
clearstatcache();
if ( file_exists($gl_root_path . 'config.php') && GetFileLength($gl_root_path . 'config.php') > 0 )
{
// Include the main config
@ -359,7 +362,7 @@ function InitPhpLogConConfigFile($bHandleMissing = true)
else
{
// if handled ourselfe, we die in CheckForInstallPhp.
if ( $bHandleMissing == true )
if ( $bHandleMissing == true )
{
// Check for installscript!
CheckForInstallPhp();

View File

@ -56,7 +56,7 @@ $content['web_theme'] = "default";
$content['user_theme'] = "default";
$configsamplefile = $content['BASEPATH'] . "include/config.sample.php";
//ini_set('error_reporting', E_ERROR); // NO PHP ERROR'S!
//ini_set('error_reporting', E_ALL); // DEBUG ENABLE
// *** *** //
// --- CONTENT Vars
@ -100,7 +100,7 @@ else
// --- Set Title
$content['TITLE'] = GetAndReplaceLangStr( $content['TITLE'], $content['INSTALL_STEP'] );
$content['LN_INSTALL_TITLETOP'] = GetAndReplaceLangStr( $content['LN_INSTALL_TITLETOP'], $content['BUILDNUMBER'], $content['INSTALL_STEP'] );
$content['INSTALL_TITLETOP'] = GetAndReplaceLangStr( $content['LN_INSTALL_TITLETOP'], $content['BUILDNUMBER'], $content['INSTALL_STEP'] );
// ---
// --- Start Setup Processing
@ -201,6 +201,8 @@ else if ( $content['INSTALL_STEP'] == 3 )
if ( isset($_SESSION['UserDBPref']) ) { $content['UserDBPref'] = $_SESSION['UserDBPref']; } else { $content['UserDBPref'] = "logcon_"; }
if ( isset($_SESSION['UserDBUser']) ) { $content['UserDBUser'] = $_SESSION['UserDBUser']; } else { $content['UserDBUser'] = "user"; }
if ( isset($_SESSION['UserDBPass']) ) { $content['UserDBPass'] = $_SESSION['UserDBPass']; } else { $content['UserDBPass'] = ""; }
if ( isset($_SESSION['UserDBLoginRequired']) ) { $content['UserDBLoginRequired'] = $_SESSION['UserDBLoginRequired']; } else { $content['UserDBLoginRequired'] = false; }
if ( $content['UserDBEnabled'] == 1 )
{
$content['UserDBEnabled_true'] = "checked";
@ -745,6 +747,7 @@ else if ( $content['INSTALL_STEP'] == 8 )
RevertOneStep( $content['INSTALL_STEP']-1, GetAndReplaceLangStr($content['LN_INSTALL_FAILEDCREATECFGFILE'], $content['BASEPATH'] . "config.php") );
fwrite($handle, $filebuffer);
fflush($handle);
fclose($handle);
// ---

View File

@ -56,7 +56,7 @@
<table width="100%" cellpadding="2" cellspacing="1" border="0" align="center" class="with_border_alternate">
<tr>
<td class="title">
<h1 align="center">{LN_INSTALL_TITLETOP}</h1>
<h1 align="center">{INSTALL_TITLETOP}</h1>
</td>
</tr>
</table>