X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fconfig-functions.php;h=aaa1472e200f0ff278db761bee95e64d06cd8ed0;hb=d6bbcf951f45052d6888da6ec83a02eb215058df;hp=87c8e28d8b0ed746ab299d87ff1ccbb570b229b0;hpb=f9ea8181b9349ea6965f45f19fd4ba894d141eab;p=mailer.git diff --git a/inc/config-functions.php b/inc/config-functions.php index 87c8e28d8b..aaa1472e20 100644 --- a/inc/config-functions.php +++ b/inc/config-functions.php @@ -86,6 +86,18 @@ function getConfig ($configEntry) { function setConfigEntry ($configEntry, $value) { // Just set it (unsecured won't hurt?) $GLOBALS['config'][$configEntry] = $value; + + // Remove cache + removeGlobalCache($configEntry); +} + +// Removes entry in $GLOBALS +function removeGlobalCache ($configEntry) { + // Generate key + $key = 'get' . capitalizeUnderscoreString($configEntry); + + // Remove it + unset($GLOBALS[$key]); } // Checks whether the given config entry is set @@ -136,37 +148,37 @@ function updateOldConfigFile () { // Watch out for these lines and execute them as single command // @TODO Make this all better... :-/ $watchLines = array( - 'SITE_KEY' => 'SITE_KEY', - 'DEFAULT_LANG' => 'DEFAULT_LANG', - 'warn_no_pass' => 'WARN_NO_PASS', - 'WRITE_FOOTER' => 'WRITE_FOOTER', - 'OUTPUT_MODE' => 'OUTPUT_MODE', - 'MAIN_TITLE' => 'MAIN_TITLE', - 'SLOGAN' => 'SLOGAN', - 'WEBMASTER' => 'WEBMASTER', - 'mxchange_installed' => 'MXCHANGE_INSTALLED', - 'admin_registered' => 'ADMIN_REGISTERED', - '_MYSQL_PREFIX' => '_MYSQL_PREFIX', - '_TABLE_TYPE' => '_TABLE_TYPE', - '_DB_TYPE' => '_DB_TYPE', - 'SMTP_HOSTNAME' => 'SMTP_HOSTNAME', - 'SMTP_USER' => 'SMTP_USER', - 'SMTP_PASSWORD' => 'SMTP_PASSWORD', - 'ENABLE_BACKLINK' => 'ENABLE_BACKLINK', - 'MAIN_TITLE' => 'MAIN_TITLE', - 'SLOGAN' => 'SLOGAN', - 'WEBMASTER' => 'WEBMASTER', - 'PATH' => 'PATH', - 'URL' => 'URL', + 'SITE_KEY' => 'SITE_KEY', + 'DEFAULT_LANG' => 'DEFAULT_LANG', + 'warn_no_pass' => 'WARN_NO_PASS', + 'WRITE_FOOTER' => 'WRITE_FOOTER', + 'OUTPUT_MODE' => 'OUTPUT_MODE', + 'MAIN_TITLE' => 'MAIN_TITLE', + 'SLOGAN' => 'SLOGAN', + 'WEBMASTER' => 'WEBMASTER', + 'mailer_installed' => 'MAILER_INSTALLED', + 'admin_registered' => 'ADMIN_REGISTERED', + '_MYSQL_PREFIX' => '_MYSQL_PREFIX', + '_TABLE_TYPE' => '_TABLE_TYPE', + '_DB_TYPE' => '_DB_TYPE', + 'SMTP_HOSTNAME' => 'SMTP_HOSTNAME', + 'SMTP_USER' => 'SMTP_USER', + 'SMTP_PASSWORD' => 'SMTP_PASSWORD', + 'ENABLE_BACKLINK' => 'ENABLE_BACKLINK', + 'MAIN_TITLE' => 'MAIN_TITLE', + 'SLOGAN' => 'SLOGAN', + 'WEBMASTER' => 'WEBMASTER', + 'PATH' => 'PATH', + 'URL' => 'URL', ); // Make these lower-case! (damn stupid code...) - $lowerCase = array('WARN_NO_PASS', 'MXCHANGE_INSTALLED', 'ADMIN_REGISTERED'); + $lowerCase = array('WARN_NO_PASS', 'MAILER_INSTALLED', 'ADMIN_REGISTERED'); // Special comments... $comments = array( 'WARN_NO_PASS' => 'NULLPASS-WARNING', - 'MXCHANGE_INSTALLED' => 'INSTALLED', + 'MAILER_INSTALLED ' => 'INSTALLED', 'ADMIN_REGISTERED' => 'ADMIN-SETUP', '_MYSQL_PREFIX' => 'MYSQL-PREFIX', '_TABLE_TYPE' => 'TABLE-TYPE', @@ -182,7 +194,7 @@ function updateOldConfigFile () { copyFileVerified(getPath() . 'inc/config-local.php.dist', getCachePath() . 'config-local.php', 0644); // First of all, load the old one! - $oldConfig = explode(chr(10), readFromFile(getPath() . 'inc/config.php')); + $oldConfig = explode(PHP_EOL, readFromFile(getPath() . 'inc/config.php')); // Now, analyze every entry $done = array(); @@ -206,13 +218,13 @@ function updateOldConfigFile () { // Default comment $comment = str_replace('_', '-', $new); - // Do we have a special comment? + // Is there a special comment? if (isset($comments[$new])) { // Then use it $comment = $comments[$new]; } // END - if - // Do we need to make $new lowercase? + // Does $new needs to be lower-case? $oldNew = $new; if (in_array($new, $lowerCase)) { // Then do so... :) @@ -231,7 +243,7 @@ function updateOldConfigFile () { } // END - foreach // By default the old array $MySQL was not found - $found = false; + $found = FALSE; // Analyze every entry again for the MySQL configuration foreach ($oldConfig as $line) { @@ -241,8 +253,8 @@ function updateOldConfigFile () { // Is the $MySQL found? if (substr($line, 0, 6) == '$MySQL') { // Okay, found - $found = true; - } elseif ($found === true) { + $found = TRUE; + } elseif ($found === TRUE) { // Now check this row if (substr($line, 0, 2) == ');') { // MySQL array is closed so stop looking for it @@ -283,7 +295,7 @@ function updateConfiguration ($entries, $values, $updateMode = '', $config = '0' // Default is empty SQL $SQL = ''; - // Do we have multiple entries? + // Is there multiple entries? if (is_array($entries)) { // Walk through all foreach ($entries as $idx => $entry) { @@ -295,7 +307,7 @@ function updateConfiguration ($entries, $values, $updateMode = '', $config = '0' // Check if string or number but no array if (is_array($values[$idx])) { // Arrays must be fixed... - reportBug(__FUNCTION__, __LINE__, 'values[' . $idx . '] should not be an array! Content=
'.print_r($values[$idx], true).'
'); + reportBug(__FUNCTION__, __LINE__, 'values[' . $idx . '] should not be an array! Content=
'.print_r($values[$idx], TRUE).'
'); } elseif ($values[$idx] == 'UNIX_TIMESTAMP()') { // Function UNIX_TIMESTAMP() detected $SQL .= sprintf("`%s`=UNIX_TIMESTAMP(),", $entry); @@ -372,6 +384,12 @@ function updateConfiguration ($entries, $values, $updateMode = '', $config = '0' // Filter for loading configuration function FILTER_LOAD_CONFIGURATION ($no = '0') { + // Is installation phase? + if (isInstallationPhase()) { + // Then don't load any configuration + return; + } // END - if + // Is the value null, it comes from the 'init' filter chain if (is_null($no)) { $no = '0';