- $ret = REGISTER_ADMIN($_POST['login'], $hashedPass);
- switch ($ret)
- {
- case "done":
- admin_WriteData(PATH."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0);
- if (!_FATAL) {
- // Registering is done
- LOAD_URL("modules.php?module=admin&action=login®ister=done");
- } else {
- $ret = ADMIN_CANNOT_COMPLETE;
- }
- break;
-
- case "failed":
- $ret = ADMIN_REGISTER_FAILED;
- break;
-
- case "already":
- default:
- if ($ret == "already") {
- // Admin does already exists!
- $ret = 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()", $ret));
- // @TODO Why is this set to 'done'?
- $ret = "done";
- }
-
- // Admin still not registered?
- if (!isBooleanConstantAndTrue('admin_registered')) {
- // Write to config that registration is done
- admin_WriteData(PATH."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0);
-
- // Load URL for login
- LOAD_URL("modules.php?module=admin&action=login");
- } // END - if
- break;
- }
+ $ret = REGISTER_ADMIN(REQUEST_POST('login'), $hashedPass, constant('WEBMASTER'));
+
+ // 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