+ // Check if registration wents fine
+ switch ($ret) {
+ case 'done':
+ $done = changeDataInFile(constant('PATH') . 'inc/cache/config-local.php', "ADMIN-SETUP", "setConfigEntry('ADMIN_REGISTERED', \"", "\");", 'Y', 0);
+ if ($done === true) {
+ // Registering is done
+ redirectToUrl('modules.php?module=admin&register=done');
+ } else {
+ $ret = getMessage('ADMIN_CANNOT_COMPLETE');
+ }
+ break;
+
+ case 'failed':
+ $ret = getMessage('ADMIN_REGISTER_FAILED');
+ break;
+
+ case 'already':
+ default:
+ if ($ret == 'already') {
+ // Admin does already exists!
+ $ret = getMessage('ADMIN_LOGIN_ALREADY_REG');
+ } else {
+ // Any other kind will be logged and interpreted as 'done'
+ DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown return code %s from CHECK_ADMIN_LOGIN() and interpreted as 'done'!", $ret));
+ // @TODO Why is this set to 'done'?
+ $ret = 'done';
+ }
+
+ // Admin still not registered?
+ if (!isAdminRegistered()) {
+ // Write to config that registration is done
+ changeDataInFile(constant('PATH') . 'inc/cache/config-local.php', "ADMIN-SETUP", "setConfigEntry('ADMIN_REGISTERED', \"", "\");", 'Y', 0);
+
+ // Load URL for login
+ redirectToUrl('modules.php?module=admin');
+ } // END - if
+ break;
+ } // END - switch