diff --git a/classes/class_template.php b/classes/class_template.php index 4b835e5..c2b772c 100644 --- a/classes/class_template.php +++ b/classes/class_template.php @@ -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); } } } diff --git a/classes/logstreamdisk.class.php b/classes/logstreamdisk.class.php index 28f638b..aea44d2 100644 --- a/classes/logstreamdisk.class.php +++ b/classes/logstreamdisk.class.php @@ -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; } diff --git a/include/constants_errors.php b/include/constants_errors.php index 2d2e7c4..1c65dcd 100644 --- a/include/constants_errors.php +++ b/include/constants_errors.php @@ -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); diff --git a/include/functions_common.php b/include/functions_common.php index 65aa2c3..12a9235 100644 --- a/include/functions_common.php +++ b/include/functions_common.php @@ -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 diff --git a/include/functions_config.php b/include/functions_config.php index c85a2cb..702e8ec 100644 --- a/include/functions_config.php +++ b/include/functions_config.php @@ -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"; } ?> \ No newline at end of file diff --git a/include/functions_frontendhelpers.php b/include/functions_frontendhelpers.php index 3a8bb3e..78ef4dd 100644 --- a/include/functions_frontendhelpers.php +++ b/include/functions_frontendhelpers.php @@ -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 diff --git a/index.php b/index.php index a585b68..72f1948 100644 --- a/index.php +++ b/index.php @@ -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); diff --git a/lang/de/main.php b/lang/de/main.php index 1537371..3a60188 100644 --- a/lang/de/main.php +++ b/lang/de/main.php @@ -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"; ?> \ No newline at end of file diff --git a/lang/en/main.php b/lang/en/main.php index 660fade..2dc3bcb 100644 --- a/lang/en/main.php +++ b/lang/en/main.php @@ -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!"; diff --git a/templates/include_header.html b/templates/include_header.html index ddbd9aa..ac803a8 100644 --- a/templates/include_header.html +++ b/templates/include_header.html @@ -16,7 +16,7 @@
- +
 {LN_MAIN_SELECTSTYLE}  @@ -38,7 +38,7 @@ - +
 {LN_GEN_LANGUAGE}  @@ -57,7 +57,25 @@
-   + + + + + + + +
 {LN_GEN_SELECTSOURCE}  + + + + +
+ +