diff options
Diffstat (limited to 'include/account.php')
-rw-r--r-- | include/account.php | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/include/account.php b/include/account.php index 5c44f13ca..47310912f 100644 --- a/include/account.php +++ b/include/account.php @@ -14,6 +14,13 @@ require_once('include/crypto.php'); require_once('include/channel.php'); +function get_account_by_id($account_id) { + $r = q("select * from account where account_id = %d", + intval($account_id) + ); + return (($r) ? $r[0] : false); +} + function check_account_email($email) { $result = array('error' => false, 'message' => ''); @@ -112,6 +119,7 @@ function create_account($arr) { $flags = ((x($arr,'account_flags')) ? intval($arr['account_flags']) : ACCOUNT_OK); $roles = ((x($arr,'account_roles')) ? intval($arr['account_roles']) : 0 ); $expires = ((x($arr,'expires')) ? intval($arr['expires']) : NULL_DATE); + $techlevel = ((array_key_exists('techlevel',$arr)) ? intval($arr['techlevel']) : intval(get_config('system','techlevel'))); $default_service_class = get_config('system','default_service_class'); @@ -171,16 +179,17 @@ function create_account($arr) { $r = q("INSERT INTO account ( account_parent, account_salt, account_password, account_email, account_language, - account_created, account_flags, account_roles, account_expires, account_service_class ) - VALUES ( %d, '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s' )", + account_created, account_flags, account_roles, account_level, account_expires, account_service_class ) + VALUES ( %d, '%s', '%s', '%s', '%s', '%s', %d, %d, %d, '%s', '%s' )", intval($parent), dbesc($salt), dbesc($password_encoded), dbesc($email), dbesc(get_best_language()), dbesc(datetime_convert()), - dbesc($flags), - dbesc($roles), + intval($flags), + intval($roles), + intval($techlevel), dbesc($expires), dbesc($default_service_class) ); @@ -751,3 +760,23 @@ function upgrade_bool_message($bbcode = false) { $x = upgrade_link($bbcode); return t('This action is not available under your subscription plan.') . (($x) ? ' ' . $x : '') ; } + + +function get_account_techlevel($account_id = 0) { + + $role = \Zotlabs\Lib\System::get_server_role(); + if($role == 'basic') + return 0; + if($role == 'standard') + return 5; + + if(! $account_id) { + $x = \App::get_account(); + } + else { + $x = get_account_by_id($account_id); + } + + return (($x) ? intval($x['account_level']) : 0); + +}
\ No newline at end of file |