From 5a8c537bc2633402ca515964c9a3a2674f37edc2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 25 Nov 2009 17:08:42 +0000 Subject: [PATCH] Fixes for installation phase, old lost call of FILTER_COMPILE_CONFIG() removed --- inc/functions.php | 15 +++++++++------ inc/install-inc.php | 3 --- inc/language/de.php | 1 + inc/libs/admins_functions.php | 2 +- inc/load_config.php | 7 ++----- inc/mysql-connect.php | 10 +++++----- inc/mysql-manager.php | 2 +- inc/stats-functions.php | 2 +- inc/wrapper-functions.php | 3 +++ 9 files changed, 23 insertions(+), 22 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 41789fdc06..51e21667aa 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -229,7 +229,6 @@ function addFatalMessage ($F, $L, $message, $extra = '') { $GLOBALS['fatal_messages'][] = $message; // Log fatal messages away - debug_report_bug($message); logDebugMessage($F, $L, 'Fatal error message: ' . $message); } @@ -427,12 +426,15 @@ function loadEmailTemplate ($template, $content = array(), $userid = '0') { // Is content an array? if (is_array($content)) { // Add expiration to array - if (getConfig('auto_purge') == '0') { + if ((isConfigEntrySet('auto_purge')) && (getConfig('auto_purge') == '0')) { // Will never expire! $content['expiration'] = getMessage('MAIL_WILL_NEVER_EXPIRE'); - } else { + } elseif (isConfigEntrySet('auto_purge')) { // Create nice date string $content['expiration'] = createFancyTime(getConfig('auto_purge')); + } else { + // Missing entry + $content['expiration'] = getMessage('MAIL_NO_CONFIG_AUTO_PURGE'); } } // END - if @@ -2577,7 +2579,7 @@ function debug_report_bug ($message = '', $sendEmail = true) { $debug .= "Thank you for finding bugs."; // Send an email? (e.g. not wanted for evaluation errors) - if ($sendEmail === true) { + if (($sendEmail === true) && (!isInstallationPhase())) { // Prepare content $content = array( 'message' => trim($message), @@ -3163,7 +3165,8 @@ function shutdown () { // Call the filter chain 'shutdown' runFilterChain('shutdown', null); - if (SQL_IS_LINK_UP()) { + // Check if not in installation phase and the link is up + if ((!isInstallationPhase()) && (SQL_IS_LINK_UP())) { // Close link SQL_CLOSE(__FILE__, __LINE__); } elseif (!isInstallationPhase()) { @@ -3823,7 +3826,7 @@ function encodeUrl ($url, $outputMode = '0') { if (strpos($url, session_name()) !== false) return $url; // Do we have a valid session? - if ((($GLOBALS['valid_session'] === false) || (!isset($_COOKIE[session_name()]))) && (isSpider() === false)) { + if (((!isset($GLOBALS['valid_session'])) || ($GLOBALS['valid_session'] === false) || (!isset($_COOKIE[session_name()]))) && (isSpider() === false)) { // Invalid session // Determine right seperator $seperator = '&'; diff --git a/inc/install-inc.php b/inc/install-inc.php index 8dbe1a834b..01c7ca8e08 100644 --- a/inc/install-inc.php +++ b/inc/install-inc.php @@ -217,9 +217,6 @@ if ((!isInstalled()) || (!isAdminRegistered())) { // Read the file $fileContent = readFromFile($FQFN, true); - // Compile all config entries (we use a filter here, yes...) - $fileContent = FILTER_COMPILE_CONFIG($fileContent); - // Split it up against ";\n" and merge it into existing SQLs mergeSqls(explode(";\n", $fileContent), 'install'); } else { diff --git a/inc/language/de.php b/inc/language/de.php index c10b637c25..592db11ac3 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -923,6 +923,7 @@ addMessages(array( 'ADMIN_REMOVE_STATS_ENTRY' => "Hier klicken, um Mitgliederstatistik zu entfernen.", 'ADMIN_USER_STATS_REMOVED' => "Mitgliederstatistiken entfernt.", 'MAIL_WILL_NEVER_EXPIRE' => "Bestätigungslink verfaellt nicht.", + 'MAIL_NO_CONFIG_AUTO_PURGE' => "Konfigurationseintrag 'auto_purge' fehlt.", 'MEMBER_ENTER_MORE_RECEIVERS' => "Geben Sie mindestens ein Empfänger ein.", 'MEMBER_NO_MORE_RECEIVERS_FOUND' => "Es konnten nicht ausreichend genug empfangsbereite Mitglieder gefunden werden.", 'ADMIN_USER_PROFILE_TITLE' => "Mitgliedsprofil aufrufen", diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 6a1116e65e..4b3aa1bedf 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -181,7 +181,7 @@ function adminsChangeAdminAccount ($postData, $element = '') { // Get admin's id $adminId = getCurrentAdminId(); - $salt = substr(getAdminHash($adminId), 0, -40); + $salt = substr(getAdminHash(getAdminLogin($adminId)), 0, -40); // Rewrite cookie when it's own account if ($adminId == $id) { diff --git a/inc/load_config.php b/inc/load_config.php index 0f277b06e4..b6fe037af4 100644 --- a/inc/load_config.php +++ b/inc/load_config.php @@ -80,13 +80,10 @@ if ((isIncludeReadable(getConfig('CACHE_PATH') . 'config-local.php')) && (isIncl // Set output mode here setConfigEntry('OUTPUT_MODE', 'render'); -} else { - // Redirect to install.php - redirectToUrl('install.php'); } // Check if the user setups his MySQL stuff... -if ((empty($GLOBALS['mysql']['login'])) && (!isInstalling()) && (!isGetRequestElementSet('installing')) && (isInstalled())) { +if ((empty($GLOBALS['mysql']['login'])) && (!isInstalling()) && (!isInstallationPhase()) && (!isGetRequestElementSet('installing')) && (isInstalled())) { // No login entered and outside installation mode outputHtml('{--LANG_WARNING--}:'); if (isInstalled()) { @@ -96,7 +93,7 @@ if ((empty($GLOBALS['mysql']['login'])) && (!isInstalling()) && (!isGetRequestEl // Please run the installation script (maybe again) app_die(__FILE__, __LINE__, '{--DIE_RUN_INSTALL_MYSQL--}'); } -} elseif ((!isInstalling()) && (empty($GLOBALS['mysql']['password'])) && (getConfig('WARN_NO_PASS') == 'Y')) { +} elseif ((!isInstalling()) && (!isInstallationPhase()) && (empty($GLOBALS['mysql']['password'])) && (getConfig('WARN_NO_PASS') == 'Y')) { // No database password entered!!! loadTemplate('admin_settings_saved', false, '
{--LANG_WARNING--}:
{--WARN_NULL_PASSWORD--}'); } diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index 45d1e87f67..8619a85109 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -71,8 +71,8 @@ initFatalMessages(); // Init message system initMessages(); -// Check if this file is writeable or read-only and warn the user -if (!isInstalling()) { +// Are we in installation phase? +if ((!isInstalling()) && (!isInstallationPhase())) { // Load configuration file(s) here loadIncludeOnce('inc/load_config.php'); @@ -156,15 +156,15 @@ if (!isInstalling()) { // Load config loadIncludeOnce('inc/load_config.php'); + // Init filter system here + initFilterSystem(); + // Are we installation routine? if ((!isInstalling()) && (getOutputMode() != 1) && (getOutputMode() != -1)) { // You have to install first! redirectToUrl('install.php'); } // END - if - // Init filter system here - initFilterSystem(); - // Load cache loadIncludeOnce('inc/load_cache.php'); diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 6d8b3c821e..b8f7fed89d 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -1397,7 +1397,7 @@ function getAdminHash ($admin) { incrementStatsEntry('cache_hits'); } elseif (!isExtensionActive('cache')) { // Load from database - $result = SQL_QUERY_ESC("SELECT `password` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `password` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `login`='%s' LIMIT 1", array($admin), __FUNCTION__, __LINE__); // Do we have an entry? diff --git a/inc/stats-functions.php b/inc/stats-functions.php index e38e6114b7..931e40b22b 100644 --- a/inc/stats-functions.php +++ b/inc/stats-functions.php @@ -173,7 +173,7 @@ function writeStatsTable () { // Filter for flushing statistics function FILTER_FLUSH_STATS () { // Now do we have stats? - if ((isset($GLOBALS['stats'])) && (getConfig('STATS_ENABLED') == 'Y')) { + if ((isset($GLOBALS['stats'])) && (!isInstallationPhase()) && (getConfig('STATS_ENABLED') == 'Y')) { // Write statistics to temporary table writeStatsTable(); } // END - if diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 1e36678f6f..01accde60d 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -400,6 +400,9 @@ function flushHeaders () { foreach ($GLOBALS['header'] as $header) { header($header); } // END - foreach + + // Mark them as flushed + $GLOBALS['header'] = array(); } // Wrapper function for chmod() -- 2.39.5