-Force NOTICE Debug mode for PHP, so we see errors and notices

-Removed some NOTICE bugs
-Fixed a bug in the template parser so it ignores object variables
-added source selector into header and backend
This commit is contained in:
Andre Lorbach 2008-03-11 17:55:04 +01:00
parent 79aeab308e
commit bcf8c70283
10 changed files with 80 additions and 28 deletions

View File

@ -174,7 +174,9 @@ function template_parser_sub($template, $values)
}
else
{
$template = str_replace('{'.$k.'}', "$v", $template);
// FIXED BY ANDRE | Do not convert OBJECTS into strings!
if ( !is_object($k) && !is_object($v) )
$template = str_replace('{'.$k.'}', "$v", $template);
}
}
}

View File

@ -27,6 +27,10 @@ if ( !defined('IN_PHPLOGCON') )
}
// ---
// --- Required Includes!
require_once($gl_root_path . 'include/constants_errors.php');
// ---
class LogStreamDisk extends LogStream {
private $_currentOffset = -1;
private $_currentStartPos = -1;
@ -138,7 +142,7 @@ class LogStreamDisk extends LogStream {
}
private function ReadNextForwards(&$uID, &$arrProperitesOut) {
if ($this->bEOF) {
if ($this->_bEOF) {
// Take a
return ERROR_FILE_EOF;
}

View File

@ -22,7 +22,7 @@ if ( !defined('IN_PHPLOGCON') )
}
// ---
define('SUCCESS ', 0);
define('SUCCESS', 0);
define('ERROR_FILE_NOT_FOUND', 1);
define('ERROR_FILE_CANT_CLOSE', 2);
define('ERROR_FILE_EOF', 3);

View File

@ -148,6 +148,10 @@ function InitPhpDebugMode()
global $content;
// --- Set Global DEBUG Level!
// HARDCODED !!!
$content['gen_phpdebug'] = "yes";
if ( $content['gen_phpdebug'] == "yes" )
ini_set( "error_reporting", E_ALL ); // ALL PHP MESSAGES!
else

View File

@ -25,8 +25,8 @@
function InitSourceConfigs()
{
global $CFG, $Sources, $currentSourceID;
global $CFG, $content, $currentSourceID;
// Init Source Configs!
if ( isset($CFG['Sources']) )
{
@ -37,17 +37,19 @@
{
// Set Array Index, TODO: Check for invalid characters!
$iSourceID = $CFG['Sources'][$i]['ID'];
if ( !isset($Sources[$iSourceID]) )
if ( !isset($content['Sources'][$iSourceID]) )
{
// Copy general properties
$Sources[$iSourceID]['Name'] = $CFG['Sources'][$i]['Name'];
$Sources[$iSourceID]['SourceType'] = $CFG['Sources'][$i]['SourceType'];
$content['Sources'][$iSourceID]['ID'] = $CFG['Sources'][$i]['ID'];
$content['Sources'][$iSourceID]['Name'] = $CFG['Sources'][$i]['Name'];
$content['Sources'][$iSourceID]['SourceType'] = $CFG['Sources'][$i]['SourceType'];
$content['Sources'][$iSourceID]['selected'] = ""; // Only for the display box
// Create Config instance!
if ( $CFG['Sources'][$i]['SourceType'] == SOURCE_DISK )
{
$Sources[$iSourceID]['ObjRef'] = new LogStreamConfigDisk();
$Sources[$iSourceID]['ObjRef']->FileName = $CFG['Sources'][$i]['DiskFile'];
$content['Sources'][$iSourceID]['ObjRef'] = new LogStreamConfigDisk();
$content['Sources'][$iSourceID]['ObjRef']->FileName = $CFG['Sources'][$i]['DiskFile'];
}
else if ( $CFG['Sources'][$i]['SourceType'] == SOURCE_MYSQLDB )
{
@ -57,13 +59,13 @@
else
{
// UNKNOWN, remove config entry!
unset($Sources[$iSourceID]);
unset($content['Sources'][$iSourceID]);
// TODO: Output CONFIG WARNING
}
// Set default SourceID here!
if ( isset($Sources[$iSourceID]) && !isset($currentSourceID) )
if ( isset($content['Sources'][$iSourceID]) && !isset($currentSourceID) )
$currentSourceID = $iSourceID;
}
else
@ -74,14 +76,26 @@
}
}
// Set Source from session if available!
if ( isset($_SESSION['currentSourceID']) && isset($Sources[$_SESSION['currentSourceID']]) )
$currentSourceID = $_SESSION['currentSourceID'];
else
// Read SourceID from GET Querystring
if ( isset($_GET['sourceid']) && isset($content['Sources'][$_GET['sourceid']]) )
{
// No Source stored in session, then to so now!
$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";
}
?>

View File

@ -63,7 +63,7 @@ function CreateCurrentUrl()
$counter = 0;
for ( $i = 0; $i < count($queries); $i++ )
{
if ( strpos($queries[$i], "serverid") === false )
if ( strpos($queries[$i], "sourceid") === false )
{
$tmpvars = explode ("=", $queries[$i]);
// 4Server Selector

View File

@ -33,17 +33,17 @@ InitFrontEndDefaults(); // Only in WebFrontEnd
// ---
// --- BEGIN Custom Code
if ( isset($Sources[$currentSourceID]) && $Sources[$currentSourceID]['SourceType'] == SOURCE_DISK )
if ( isset($content['Sources'][$currentSourceID]) && $content['Sources'][$currentSourceID]['SourceType'] == SOURCE_DISK )
{
require_once('classes/enums.class.php');
require_once('classes/logstream.class.php');
require_once('classes/logstreamdisk.class.php');
require_once('include/constants_errors.php');
require_once('include/constants_logstream.php');
require_once($gl_root_path . 'classes/enums.class.php');
require_once($gl_root_path . 'classes/logstream.class.php');
require_once($gl_root_path . 'classes/logstreamdisk.class.php');
require_once($gl_root_path . 'include/constants_errors.php');
require_once($gl_root_path . 'include/constants_logstream.php');
// Obtain Config Object
$stream_config = $Sources[$currentSourceID]['ObjRef'];
$stream_config = $content['Sources'][$currentSourceID]['ObjRef'];
// Create LogStream Object
$stream = $stream_config->LogStreamFactory($stream_config);

View File

@ -5,8 +5,17 @@ global $content;
$content['LN_MAINTITLE'] = "Main PhpLogCon";
$content['LN_MAIN_SELECTSTYLE'] = "Style auswählen";
$content['LN_GEN_LANGUAGE'] = "Sprache auswählen";
$content['LN_GEN_SELECTSOURCE'] = "Select Source";
// Index Site
$content['LN_ERROR_INSTALLFILEREMINDER'] = "Warnung! Du hast das Installationsscript 'install.php' noch nicht aus dem UltraStats Hauptordner entfernt!";
$content['LN_TOP_NUM'] = "No.";
$content['LN_GRID_DATE'] = "Date";
$content['LN_GRID_FACILITY'] = "Facility";
$content['LN_GRID_SEVERITY'] = "Severity";
$content['LN_GRID_SYSLOGTAG'] = "SyslogTag";
$content['LN_GRID_INFOUNIT'] = "InfoUnit";
$content['LN_GRID_HOST'] = "Source";
$content['LN_GRID_MSG'] = "Message";
?>

View File

@ -5,6 +5,7 @@ global $content;
$content['LN_MAINTITLE'] = "Main PhpLogCon";
$content['LN_MAIN_SELECTSTYLE'] = "Select a Style";
$content['LN_GEN_LANGUAGE'] = "Select language";
$content['LN_GEN_SELECTSOURCE'] = "Select Source";
// Main Index Site
$content['LN_ERROR_INSTALLFILEREMINDER'] = "Warning! You still have NOT removed the 'install.php' from your PhpLogCon main directory!";

View File

@ -16,7 +16,7 @@
<td width="100%" align="center" valign="top" height="20">
<form action="userchange.php" method="get" name="styleidform">
<table width="250" border="0" cellspacing="0" cellpadding="0" class="with_border" align="right">
<table width="300" border="0" cellspacing="0" cellpadding="0" class="with_border" align="right">
<tr>
<td class="cellmenu1" nowrap><B>&nbsp;{LN_MAIN_SELECTSTYLE}&nbsp;</B></td>
<td align="right">
@ -38,7 +38,7 @@
<td width="100%" align="center" valign="top" height="20">
<form action="userchange.php" method="get" name="langidform">
<table width="250" border="0" cellspacing="0" cellpadding="0" class="with_border" align="right">
<table width="300" border="0" cellspacing="0" cellpadding="0" class="with_border" align="right">
<tr>
<td class="cellmenu1" nowrap><B>&nbsp;{LN_GEN_LANGUAGE}&nbsp;</B></td>
<td align="right">
@ -57,7 +57,25 @@
</tr>
<tr>
<td width="100%" align="center" valign="top" height="20">
&nbsp;
<form action="{CURRENTURL}" method="get" name="sourceidform">
<table width="300" border="0" cellspacing="0" cellpadding="0" class="with_border" align="right">
<tr>
<td class="cellmenu1" nowrap><B>&nbsp;{LN_GEN_SELECTSOURCE}&nbsp;</B></td>
<td align="right">
<!-- BEGIN HIDDENVARS -->
<input type="hidden" name="{varname}" value="{varvalue}">
<!-- END HIDDENVARS -->
<select name="sourceid" size="1" OnChange="document.sourceidform.submit();">
<!-- BEGIN Sources -->
<option {selected} value="{ID}">{Name}</option>
<!-- END Sources -->
</select>
</td>
</tr>
</table>
</form>
</td>
</tr>
<tr>