Fixes for right PATH and URL under Windows, admins cache loader fixed
authorRoland Häder <roland@mxchange.org>
Mon, 3 Nov 2008 19:26:17 +0000 (19:26 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 3 Nov 2008 19:26:17 +0000 (19:26 +0000)
DOCS/de/THANK_YOU.txt
inc/config.php
inc/databases.php
inc/loader/load_cache-admin.php

index d6253ba..39e93fa 100644 (file)
@@ -29,6 +29,8 @@ Personen:
   (http://www.simplemail.de)
 - AndreasJung aus dem MXChange-Community Forum wegen zahlreicher Bugmeldungen.
   (http://www.onlinewerbebombe.de)
+- Der User profi-concept aus meinem Forum hat mir Patches fuer die config.php
+  zugesandt, die Probleme unter Windows gefixt haben.
 
 Websites / Programmierer / etc.:
 - SF.net: Hosten meine Projektdateien (nur Archive)
index 6449250..b01adc6 100644 (file)
@@ -84,10 +84,10 @@ define('MAIN_TITLE', "Your mail-exchanger title");
 // CFG: SLOGAN
 define('SLOGAN', "Your cool slogan here");
 
-// Auto-detection...
-$URL = "http://".getenv('SERVER_NAME').dirname($_SERVER['PHP_SELF']);
+// Auto-detection... (patched by "Stelzi" aka. profi-concept, thanks again!)
+$URL = "http://".getenv('SERVER_NAME') . str_replace("\\", "/", dirname($_SERVER['PHP_SELF']));
 while (substr($URL, -1, 1) == "/") { $URL = substr($URL, 0, -1); }
-$PATH = substr(dirname(__FILE__), 0, -3);
+$PATH = str_replace("\\", "/", substr(dirname(__FILE__), 0, -3));
 
 // CFG: HOST-URL (without trailing '/' !)
 define('URL', $URL);
index 1d24874..e7a61f0 100644 (file)
@@ -114,7 +114,7 @@ define('USAGE_BASE', "usage");
 define('SERVER_URL', "http://www.mxchange.org");
 
 // This current patch level
-define('CURR_SVN_REVISION', "522");
+define('CURR_SVN_REVISION', "523");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index 2de9487..b9cbd32 100644 (file)
@@ -47,61 +47,33 @@ if (($cacheInstance->cache_file("admins", true) == true) && ($cacheInstance->ext
        if ((is_array($cacheArray['admins']['login'])) && (is_array($cacheArray['admins']['aid']))) {
                // Check count
                if (count($cacheArray['admins']['login']) == count($cacheArray['admins']['aid'])) {
-                       //* DEBUG: */ echo "<PRE>";
-                       //* DEBUG: */ print_r($cacheArray['admins']);
-
-                       // The cache file seems to be fine
-                       foreach ($cacheArray['admins']['login'] as $k => $login) {
-                               // Rewrite admin id
-                               $cacheArray['admins']['aid'][$login]    = $cacheArray['admins']['aid'][$k];
-
-                               // Shortcut admin id
-                               $aid = $cacheArray['admins']['aid'][$login];
-
-                               // Rewrite others...
-                               $cacheArray['admins']['password'][$aid] = $cacheArray['admins']['password'][$k];
-                               $cacheArray['admins']['email'][$aid]    = $cacheArray['admins']['email'][$k];
-
-                               // Some extra data depending on version
-                               if (GET_EXT_VERSION("admins") >= "0.3") {
-                                       // Default ACL
-                                       $cacheArray['admins']['def_acl'][$aid]  = $cacheArray['admins']['def_acl'][$k];
-                                       if (GET_EXT_VERSION("admins") >= "0.6.7") {
-                                               // "Logical Area" mode
-                                               $cacheArray['admins']['la_mode'][$aid]  = $cacheArray['admins']['la_mode'][$k];
-                                               if (GET_EXT_VERSION("admins") >= "0.7.0") {
-                                                       // Login failtures
-                                                       $cacheArray['admins']['login_failtures'][$aid] = $cacheArray['admins']['login_failtures'][$k];
-                                                       $cacheArray['admins']['last_failture'][$aid]   = $cacheArray['admins']['last_failture'][$k];
-                                               } // END - if
+                       // Get "id map"
+                       $idMap = $cacheArray['admins']['aid'];
+
+                       // Rewrite the cache array
+                       for ($idx = (count($idMap) - 1); $idx >= 0; $idx--) {
+                               // Rewrite all entries
+                               foreach ($cacheArray['admins'] as $key=>$entryArray) {
+                                       // Rewrite the entry
+                                       if ($key == "aid") {
+                                               // Rewrite admin id (use login name as index)
+                                               $cacheArray['admins']['aid'][$cacheArray['admins']['login'][$idx]] = $entryArray[$idx];
+                                       } else {
+                                               // Rewrite regular entry
+                                               $cacheArray['admins'][$key][$idMap[$idx]] = $entryArray[$idx];
+                                       }
+
+                                       // Is the last entry reached?
+                                       if ($idx == 0) {
+                                               // Remove it
+                                               unset($cacheArray['admins'][$key][0]);
                                        } // END - if
                                } // END - if
-
-                               //* DEBUG: */ print_r($cacheArray['admins']);
-
-                               // Clear array
-                               foreach (array('aid', 'def_acl', 'la_mode', 'password', 'email', 'login_failtures', 'last_failture') as $rem) {
-                                       if (isset($cacheArray['admins'][$rem][$k])) unset($cacheArray['admins'][$rem][$k]);
-                               } // END - foreach
-                       } // END - if
-
-                       //* DEBUG: */ print_r($cacheArray['admins']);
-
-                       // Rewrite Login
-                       foreach ($cacheArray['admins']['login'] as $k => $login) {
-                               $cacheArray['admins']['login'][$cacheArray['admins']['aid'][$login]] = $login;
-                               if (!in_array($k, $cacheArray['admins']['aid'])) {
-                                       unset($cacheArray['admins']['login'][$k]);
-                               } // END - if
-                       } // END - foreach
-
-                       //* DEBUG: */ echo "****\n";
-                       //* DEBUG: */ print_r($cacheArray['admins']);
-                       //* DEBUG: */ echo "</PRE>";
-                       //* DEBUG: */ die();
+                       } // END - for
                } else {
                        // Nope, cache file is corrupted!
                        $cacheInstance->cache_destroy();
+                       unset($cacheArray['admins']);
                }
        } else {
                // Nope, cache file is corrupted!