} // END - if
// Register an administrator account
-function addAdminAccount ($adminLogin, $passHash, $adminEmail) {
+function addAdminAccount ($adminLogin, $passHash, $adminEmail, $accessLevel = 'deny') {
// Login does already exist
$ret = 'already';
// 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';
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) {