]> git.mxchange.org Git - mailer.git/commitdiff
ext-admins must be checked here, first admin had never 'allow'
authorRoland Häder <roland@mxchange.org>
Thu, 27 Dec 2012 04:21:25 +0000 (04:21 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 27 Dec 2012 04:21:25 +0000 (04:21 +0000)
inc/libs/admins_functions.php
inc/modules/admin/admin-inc.php

index 1e85afc09005cbc875df914a2e4c4814c90966f8..46ac5a0f89d08b328ebd2c05f36c7838f308c344 100644 (file)
@@ -54,7 +54,7 @@ function isAdminsAllowedByAcl ($action, $what) {
        }
 
        // But default result is failed
-       $GLOBALS[__FUNCTION__][$action][$what] = FALSE;
+       $GLOBALS[__FUNCTION__][$adminId][$action][$what] = FALSE;
 
        // Get admin's defult access right
        $default = getAdminDefaultAcl($adminId);
index c9f941dbd568b1277a4b9b82d658bb71d375b5f3..ce7680ee51ef7a567f5f7031eb4b507ee907dfd2 100644 (file)
@@ -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';
@@ -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) {