Fixes for missing secret file
authorRoland Häder <roland@mxchange.org>
Sat, 27 Sep 2008 16:47:40 +0000 (16:47 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 27 Sep 2008 16:47:40 +0000 (16:47 +0000)
inc/extensions/ext-sql_patches.php
inc/functions.php
inc/install-inc.php

index 88543231a82dbee74b3296bd03840c0aad090450..2efdb59de6e0a6d6ab189b899415bb9001993f44 100644 (file)
@@ -636,7 +636,7 @@ default: // Do stuff when extension is loaded
                        // Maybe need setup of secret key!
                        require_once(PATH."inc/gen_sql_patches.php");
 
                        // Maybe need setup of secret key!
                        require_once(PATH."inc/gen_sql_patches.php");
 
-                       if (GET_EXT_VERSION("cache") >= "0.1.2") {
+                       if ((GET_EXT_VERSION("cache") >= "0.1.2") && (is_object($cacheInstance))) {
                                // Remove extensions and mod_reg cache file
                                require_once(PATH."inc/libs/cache_functions.php");
                                require_once(PATH."inc/extensions/ext-cache.php");
                                // Remove extensions and mod_reg cache file
                                require_once(PATH."inc/libs/cache_functions.php");
                                require_once(PATH."inc/extensions/ext-cache.php");
@@ -653,8 +653,11 @@ default: // Do stuff when extension is loaded
                                // Read file
                                $_CONFIG['secret_key'] = implode("", file($hashFile));
                        } else {
                                // Read file
                                $_CONFIG['secret_key'] = implode("", file($hashFile));
                        } else {
+                               // Remove it from database
+                               UPDATE_CONFIG("file_hash", "");
+
                                // Cannot read secret file!
                                // Cannot read secret file!
-                               mxchange_die("Cannot read secret file!");
+                               mxchange_die("Cannot read secret file! Please try to reload");
                        }
                } // END - if
 
                        }
                } // END - if
 
index b3db62630d21ef8df21c4fd0b3e415ef01eb4acf..9a7b1fc6f1fb23c6758cf81baf23b15a7d45cf5b 100644 (file)
@@ -1927,7 +1927,7 @@ function generateHash ($plainText, $salt = "") {
        global $_CONFIG, $_SERVER;
 
        // Is the required extension "sql_patches" there and a salt is not given?
        global $_CONFIG, $_SERVER;
 
        // Is the required extension "sql_patches" there and a salt is not given?
-       if (((EXT_VERSION_IS_OLDER("sql_patches", "0.3.6")) || (GET_EXT_VERSION("sql_patches") == "")) && (empty($salt))) {
+       if (((EXT_VERSION_IS_OLDER("sql_patches", "0.3.6")) || (EXT_IS_ACTIVE("sql_patches"))) && (empty($salt))) {
                // Extension sql_patches is missing/outdated so we return the plain text
                return $plainText;
        } // END - if
                // Extension sql_patches is missing/outdated so we return the plain text
                return $plainText;
        } // END - if
@@ -1941,7 +1941,7 @@ function generateHash ($plainText, $salt = "") {
        } // END - if
 
        // When the salt is empty build a new one, else use the first x configured characters as the salt
        } // END - if
 
        // When the salt is empty build a new one, else use the first x configured characters as the salt
-       if ($salt == "") {
+       if (empty($salt)) {
                // Build server string
                $server = $_SERVER['PHP_SELF'].":".getenv('HTTP_USER_AGENT').":".getenv('SERVER_SOFTWARE').":".getenv('REMOTE_ADDR').":".":".filemtime(PATH."inc/databases.php");
 
                // Build server string
                $server = $_SERVER['PHP_SELF'].":".getenv('HTTP_USER_AGENT').":".getenv('SERVER_SOFTWARE').":".getenv('REMOTE_ADDR').":".":".filemtime(PATH."inc/databases.php");
 
index 47f6e86b481c8b1983dd619551e54f77fda37bea..552956e9a6683588bf8b98c332e2bce73c2f8e79 100644 (file)
@@ -104,7 +104,7 @@ if (isset($_POST['mysql']) && is_array($_POST['mysql'])) $mysql = $_POST['mysql'
 if (URL != "http://your-server.com") {
        // Already installed???
        $burl = URL;
 if (URL != "http://your-server.com") {
        // Already installed???
        $burl = URL;
-} elseif ($burl == "") {
+} elseif (empty($burl)) {
        // Auto-detect URL
        $burl = "http://".$SERVER_NAME.$_SERVER['PHP_SELF'];
        $burl = substr($burl, 0, strpos($burl, "install.php"));
        // Auto-detect URL
        $burl = "http://".$SERVER_NAME.$_SERVER['PHP_SELF'];
        $burl = substr($burl, 0, strpos($burl, "install.php"));