From 7ef1da61eb00a0277f7760072c4704b6898bdbbc Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 19 May 2008 14:07:58 +0200 Subject: [PATCH 1/2] Added check for installed PHP Version. phpLogCon will refuse to run on PHP4 or lower from now on! --- src/include/functions_common.php | 7 +++++++ src/index.php | 15 +++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 653de4e..c56f98c 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -79,6 +79,13 @@ $content['EXTRA_JAVASCRIPT'] = ""; $content['EXTRA_STYLESHEET'] = ""; // --- +// --- Check PHP Version! If lower the 5, phplogcon will not work proberly! +$myPhpVer = phpversion(); +$myPhpVerArray = explode('.', $myPhpVer); +if ( $myPhpVerArray[0] < 5 ) + DieWithErrorMsg( 'Error, the PHP Version on this Server does not meet the installation requirements.
PHP5 or higher is needed. Current installed Version is: ' . $myPhpVer . ''); +// --- + function InitBasicPhpLogCon() { // Needed to make global diff --git a/src/index.php b/src/index.php index 1a4b526..e55a80c 100644 --- a/src/index.php +++ b/src/index.php @@ -184,11 +184,14 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // --- Init the fields we need foreach($content['Columns'] as $mycolkey) { - $content['fields'][$mycolkey]['FieldID'] = $mycolkey; - $content['fields'][$mycolkey]['FieldCaption'] = $content[ $fields[$mycolkey]['FieldCaptionID'] ]; - $content['fields'][$mycolkey]['FieldType'] = $fields[$mycolkey]['FieldType']; - $content['fields'][$mycolkey]['FieldSortable'] = $stream->IsPropertySortable($mycolkey); // $fields[$mycolkey]['Sortable']; - $content['fields'][$mycolkey]['DefaultWidth'] = $fields[$mycolkey]['DefaultWidth']; + if ( isset($fields[$mycolkey]) ) + { + $content['fields'][$mycolkey]['FieldID'] = $mycolkey; + $content['fields'][$mycolkey]['FieldCaption'] = $content[ $fields[$mycolkey]['FieldCaptionID'] ]; + $content['fields'][$mycolkey]['FieldType'] = $fields[$mycolkey]['FieldType']; + $content['fields'][$mycolkey]['FieldSortable'] = $stream->IsPropertySortable($mycolkey); // $fields[$mycolkey]['Sortable']; + $content['fields'][$mycolkey]['DefaultWidth'] = $fields[$mycolkey]['DefaultWidth']; + } } // --- @@ -259,7 +262,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c // --- Now we populate the values array! foreach($content['Columns'] as $mycolkey) { - if ( isset($logArray[$mycolkey]) ) + if ( isset($fields[$mycolkey]) && isset($logArray[$mycolkey]) ) { // Set defaults $content['syslogmessages'][$counter]['values'][$mycolkey]['FieldAlign'] = $fields[$mycolkey]['FieldAlign']; From 6ee90d7e004338045b94c3b5ebcbaafd9b15351c Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Mon, 19 May 2008 14:25:32 +0200 Subject: [PATCH 2/2] Changed install.php handling, so it is not necessary to remove the script anymore. To avoid problems with automatic package updating, we changed the installer handling. From now, the install.php will be allowed to run only in two cases, first if the config.php file is missing, and second if the config.php file is empty. Also removed the install file remove warning. --- src/include/functions_common.php | 17 ++++++++++++++--- src/include/functions_frontendhelpers.php | 2 +- src/install.php | 2 ++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/include/functions_common.php b/src/include/functions_common.php index c56f98c..497f810 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -43,6 +43,7 @@ if ( !defined('IN_PHPLOGCON') ) include($gl_root_path . 'include/constants_general.php'); include($gl_root_path . 'include/constants_logstream.php'); +/* if ( is_file($gl_root_path . 'config.php') ) include($gl_root_path . 'config.php'); else @@ -51,6 +52,7 @@ else if ( !defined('IN_PHPLOGCON_INSTALL') ) CheckForInstallPhp(); } +*/ include($gl_root_path . 'classes/class_template.php'); include($gl_root_path . 'include/functions_themes.php'); @@ -104,7 +106,7 @@ function InitBasicPhpLogCon() StartPHPSession(); } -function InitPhpLogConConfigFile() +function InitPhpLogConConfigFile($bHandleMissing = true) { // Needed to make global global $CFG, $gl_root_path, $content; @@ -131,11 +133,20 @@ function InitPhpLogConConfigFile() $content['ShowPageRenderStats'] = "true"; InitPageRenderStats(); } + + // return result + return true; } else { - // Check for installscript! - CheckForInstallPhp(); + // if handled ourselfe, we die in CheckForInstallPhp. + if ( $bHandleMissing == true ) + { + // Check for installscript! + CheckForInstallPhp(); + } + else + return false; } } diff --git a/src/include/functions_frontendhelpers.php b/src/include/functions_frontendhelpers.php index f93c5ec..2ee8a2d 100644 --- a/src/include/functions_frontendhelpers.php +++ b/src/include/functions_frontendhelpers.php @@ -51,7 +51,7 @@ function InitFrontEndDefaults() // --- END Main Info Area // Check if install file still exists - InstallFileReminder(); + // NOT NEEDED ANYMORE InstallFileReminder(); } function InstallFileReminder() diff --git a/src/install.php b/src/install.php index 391d9aa..7efdb38 100644 --- a/src/install.php +++ b/src/install.php @@ -45,6 +45,8 @@ include($gl_root_path . 'include/functions_frontendhelpers.php'); IncludeLanguageFile( $gl_root_path . '/lang/' . $LANG . '/main.php' ); InitBasicPhpLogCon(); +if ( InitPhpLogConConfigFile(false) ) + DieWithErrorMsg( 'phpLogCon is already configured!

If you want to reconfigure phpLogCon, either delete the current config.php or replace it with an empty file.

Click here to return to pgpLogCon start page.'); //InitPhpLogCon(); // Set some static values