X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fadmin-inc.php;h=57a889db6c197ca5ad162709d20716beac2a32eb;hb=dcc3ad7ebb9a1b9c6cf9122785301a0a18e42157;hp=c9f941dbd568b1277a4b9b82d658bb71d375b5f3;hpb=1d22c70e65e858422ee0d17a7612f4b5c0757a42;p=mailer.git diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index c9f941dbd5..57a889db6c 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { } // END - if // Register an administrator account -function addAdminAccount ($adminLogin, $passHash, $adminEmail) { +function addAdminAccount ($adminLogin, $passHash, $adminEmail, $accessLevel = 'deny') { // Login does already exist $ret = 'already'; @@ -51,13 +51,25 @@ function addAdminAccount ($adminLogin, $passHash, $adminEmail) { // Is the entry there? if (SQL_HASZERONUMS($result)) { - // Ok, let's create the admin login - SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`) VALUES ('%s', '%s', '%s')", - array( - $adminLogin, - $passHash, - $adminEmail - ), __FUNCTION__, __LINE__); + // Is ext-admins installed and version at least 0.3.0? + if (isExtensionInstalledAndNewer('admins', '0.3.0')) { + // Ok, let's create the admin login + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`, `default_acl`) VALUES ('%s', '%s', '%s', '%s')", + array( + $adminLogin, + $passHash, + $adminEmail, + $accessLevel + ), __FUNCTION__, __LINE__); + } else { + // Ok, let's create the admin login + SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`) VALUES ('%s', '%s', '%s')", + array( + $adminLogin, + $passHash, + $adminEmail + ), __FUNCTION__, __LINE__); + } // All done $ret = 'done'; @@ -1333,7 +1345,7 @@ function doVerifyExpertSettings () { // Okay, does he want to see them? if (isAdminsExpertWarningEnabled()) { // Ask for them - if (isFormSent()) { + if (isFormSent('save_expert')) { // Is the element set, then we need to change the admin if (isPostRequestElementSet('expert_settings')) { // Get it and prepare final post data array @@ -1611,7 +1623,7 @@ function registerFirstAdmin () { destroyAdminSession(); // Do registration - $ret = addAdminAccount(postRequestElement('admin_login'), $hashedPass, getWebmaster()); + $ret = addAdminAccount(postRequestElement('admin_login'), $hashedPass, getWebmaster(), 'allow'); // Check if registration wents fine switch ($ret) {