// 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);
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!