X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin.php;h=d3980ba8d75bd9a8a7764ddc459421c213def790;hb=0ee25da287821512e09137a752465f09b6e1a799;hp=67f359aa6a960039b212e717211f94cdc4295342;hpb=4c83f0cc7459cad9ec9c1c68963f5365155ee935;p=mailer.git diff --git a/inc/modules/admin.php b/inc/modules/admin.php index 67f359aa6a..d3980ba8d7 100644 --- a/inc/modules/admin.php +++ b/inc/modules/admin.php @@ -37,12 +37,6 @@ if (!defined('__SECURITY')) { require($INC); } -// Login is default -if ((empty($GLOBALS['action'])) && ($check == "admin_only")) { - // Redirect to right URL - LOAD_URL("modules.php?module=admin&action=login"); -} // END - if - // Load include file LOAD_INC_ONCE("inc/modules/admin/admin-inc.php"); @@ -53,7 +47,7 @@ FIX_DELETED_COOKIES(array('admin_login', 'admin_md5', 'admin_last', 'admin_to')) $ret = "init"; // Is no admin registered? -if (!isBooleanConstantAndTrue('admin_registered')) { +if (!isAdminRegistered()) { // Admin is not registered so we have to inform the user if ((IS_FORM_SENT()) && ((!REQUEST_ISSET_POST(('login'))) || (!REQUEST_ISSET_POST(('pass'))) || (strlen(REQUEST_POST('pass')) < 4))) { REQUEST_SET_POST('ok', "***"); @@ -71,8 +65,8 @@ if (!isBooleanConstantAndTrue('admin_registered')) { switch ($ret) { case "done": - changeDataInFile(constant('PATH')."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0); - if (!constant('_FATAL')) { + $done = changeDataInFile(constant('PATH')."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0); + if ($done === true) { // Registering is done LOAD_URL("modules.php?module=admin&action=login®ister=done"); } else { @@ -91,13 +85,13 @@ if (!isBooleanConstantAndTrue('admin_registered')) { $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()", $ret)); + 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 (!isBooleanConstantAndTrue('admin_registered')) { + if (!isAdminRegistered()) { // Write to config that registration is done changeDataInFile(constant('PATH')."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0); @@ -338,7 +332,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) { LOAD_TEMPLATE("admin_settings_saved", false, "
{--ADMIN_LOGOUT_FAILED--}
"); // Add fatal message - addFatalMessage(getMessage('CANNOT_UNREG_SESS')); + addFatalMessage(__FILE__, __LINE__, getMessage('CANNOT_UNREG_SESS')); } } else { // Maybe an Admin want's to login? @@ -347,7 +341,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) { { case "done": // Check for access control line of current menu entry - define('__ACL_ALLOW', RUN_FILTER('check_admin_acl')); + $GLOBALS['acl_allow'] = runFilterChain('check_admin_acl'); // When type of admin menu is not set fallback to old menu system if (!isConfigEntrySet('admin_menu')) setConfigEntry('admin_menu', "OLD"); @@ -375,13 +369,13 @@ if (!isBooleanConstantAndTrue('admin_registered')) { case "404": // Administrator login not found REQUEST_SET_POST('ok', $ret); destroyAdminSession(); - addFatalMessage(getMessage('ADMIN_NOT_FOUND')); + addFatalMessage(__FILE__, __LINE__, getMessage('ADMIN_NOT_FOUND')); break; case "pass": // Wrong password REQUEST_SET_POST('ok', $ret); destroyAdminSession(); - addFatalMessage(getMessage('WRONG_PASS')); + addFatalMessage(__FILE__, __LINE__, getMessage('WRONG_PASS')); break; default: // Others will be logged