aboutsummaryrefslogtreecommitdiffstats
path: root/include/account.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-01-27 22:49:18 -0800
committerfriendica <info@friendica.com>2013-01-27 22:49:18 -0800
commit4c5d2fe0fe4466fbcb142afa019e29a67df0b38b (patch)
treec23f07a8a76b6d95539ccffe3f4f5e8cc8b889fb /include/account.php
parent1dbd16039278e21c13e196399bccf3418c602d6a (diff)
downloadvolse-hubzilla-4c5d2fe0fe4466fbcb142afa019e29a67df0b38b.tar.gz
volse-hubzilla-4c5d2fe0fe4466fbcb142afa019e29a67df0b38b.tar.bz2
volse-hubzilla-4c5d2fe0fe4466fbcb142afa019e29a67df0b38b.zip
check for mcrypt during install, allow admin email account to be admin *if* it's the first account.
Diffstat (limited to 'include/account.php')
-rw-r--r--include/account.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/account.php b/include/account.php
index e675f376f..f313e5126 100644
--- a/include/account.php
+++ b/include/account.php
@@ -86,6 +86,13 @@ function check_account_admin($arr) {
return false;
}
+function account_total() {
+ $r = q("select account_id from account where 1");
+ if(is_array($r))
+ return count($r);
+ return false;
+}
+
function create_account($arr) {
@@ -110,6 +117,8 @@ function create_account($arr) {
return $result;
}
+ // prevent form hackery
+
if($roles & ACCOUNT_ROLE_ADMIN) {
$admin_result = check_account_admin($arr);
if(! $admin_result) {
@@ -117,6 +126,13 @@ function create_account($arr) {
}
}
+ // allow the admin_email account to be admin, but only if it's the first account.
+
+ $c = account_total();
+ if((c === 0) && (check_account_admin($arr)))
+ $roles |= ACCOUNT_ROLE_ADMIN;
+
+
$invite_result = check_account_invite($invite_code);
if($invite_result['error']) {
$result['message'] = $invite_result['message'];