From 87dc69ba8951e298966881cbb83dfaeebe30a0ff Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 3 Nov 2008 19:26:17 +0000 Subject: [PATCH] Fixes for right PATH and URL under Windows, admins cache loader fixed --- DOCS/de/THANK_YOU.txt | 2 + inc/config.php | 6 +-- inc/databases.php | 2 +- inc/loader/load_cache-admin.php | 72 ++++++++++----------------------- 4 files changed, 28 insertions(+), 54 deletions(-) diff --git a/DOCS/de/THANK_YOU.txt b/DOCS/de/THANK_YOU.txt index d6253ba04f..39e93fa9cd 100644 --- a/DOCS/de/THANK_YOU.txt +++ b/DOCS/de/THANK_YOU.txt @@ -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) diff --git a/inc/config.php b/inc/config.php index 644925084c..b01adc6810 100644 --- a/inc/config.php +++ b/inc/config.php @@ -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); diff --git a/inc/databases.php b/inc/databases.php index 1d2487436d..e7a61f00a7 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -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); diff --git a/inc/loader/load_cache-admin.php b/inc/loader/load_cache-admin.php index 2de94871bc..b9cbd32f4b 100644 --- a/inc/loader/load_cache-admin.php +++ b/inc/loader/load_cache-admin.php @@ -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 "
";
-			//* 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 "
"; - //* DEBUG: */ die(); + } // END - for } else { // Nope, cache file is corrupted! $cacheInstance->cache_destroy(); + unset($cacheArray['admins']); } } else { // Nope, cache file is corrupted! -- 2.39.5