From ea0be8ea1a22abfdedae0d0c47677a9de44e08c0 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 31 Aug 2016 17:49:22 -0700 Subject: provide techlevels in the pro server role. Should have no visible effect on other roles. --- include/account.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'include/account.php') diff --git a/include/account.php b/include/account.php index 5c44f13ca..c11f1668b 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' => ''); @@ -751,3 +758,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 -- cgit v1.2.3