diff options
author | redmatrix <mike@macgirvin.com> | 2016-08-31 17:49:22 -0700 |
---|---|---|
committer | redmatrix <mike@macgirvin.com> | 2016-08-31 17:49:22 -0700 |
commit | ea0be8ea1a22abfdedae0d0c47677a9de44e08c0 (patch) | |
tree | 277e9a08e4958fef0801aeb83f73d2fb3cbee952 /include | |
parent | e9462ba14529b7172ba5a21e7985d24de91faa37 (diff) | |
download | volse-hubzilla-ea0be8ea1a22abfdedae0d0c47677a9de44e08c0.tar.gz volse-hubzilla-ea0be8ea1a22abfdedae0d0c47677a9de44e08c0.tar.bz2 volse-hubzilla-ea0be8ea1a22abfdedae0d0c47677a9de44e08c0.zip |
provide techlevels in the pro server role. Should have no visible effect on other roles.
Diffstat (limited to 'include')
-rw-r--r-- | include/account.php | 27 | ||||
-rw-r--r-- | include/bbcode.php | 3 | ||||
-rw-r--r-- | include/conversation.php | 4 | ||||
-rw-r--r-- | include/features.php | 6 | ||||
-rw-r--r-- | include/nav.php | 1 | ||||
-rw-r--r-- | include/widgets.php | 15 |
6 files changed, 41 insertions, 15 deletions
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 diff --git a/include/bbcode.php b/include/bbcode.php index 2d86bd263..9c65afc59 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -666,8 +666,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) $Text = preg_replace("/\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '<a class="zrl" href="$1" target="_blank" >$2</a>', $Text); } - // Remove bookmarks from UNO - if (get_config('system','server_role') === 'basic') + if (get_account_techlevel() > 2) $Text = str_replace('<span class="bookmark-identifier">#^</span>', '', $Text); // Perform MAIL Search diff --git a/include/conversation.php b/include/conversation.php index 2e056b620..a56a765be 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1621,6 +1621,8 @@ function profile_tabs($a, $is_owner = false, $nickname = null){ $uid = ((App::$profile['profile_uid']) ? App::$profile['profile_uid'] : local_channel()); + $account_id = ((App::$profile['profile_uid']) ? App::$profile['channel_account_id'] : App::get_account_id()); + if($uid == local_channel()) { $cal_link = ''; @@ -1723,7 +1725,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null){ ); } - if(feature_enabled($uid,'wiki') && (get_config('system','server_role') !== 'basic')) { + if(feature_enabled($uid,'wiki') && (get_account_techlevel($account_id) > 3)) { $tabs[] = array( 'label' => t('Wiki'), 'url' => z_root() . '/wiki/' . $nickname, diff --git a/include/features.php b/include/features.php index 4e86b7881..6c5ce147c 100644 --- a/include/features.php +++ b/include/features.php @@ -38,7 +38,7 @@ function get_feature_default($feature) { function get_features($filtered = true) { - $server_role = get_config('system','server_role'); + $server_role = \Zotlabs\Lib\System::get_server_role(); if($server_role === 'basic' && $filtered) return array(); @@ -54,7 +54,7 @@ function get_features($filtered = true) { array('advanced_profiles', t('Advanced Profiles'), t('Additional profile sections and selections'),false,get_config('feature_lock','advanced_profiles')), array('profile_export', t('Profile Import/Export'), t('Save and load profile details across sites/channels'),false,get_config('feature_lock','profile_export')), array('webpages', t('Web Pages'), t('Provide managed web pages on your channel'),false,get_config('feature_lock','webpages')), - array('wiki', t('Wiki'), t('Provide a wiki for your channel'),(($server_role === 'basic') ? false : true),get_config('feature_lock','wiki')), + array('wiki', t('Wiki'), t('Provide a wiki for your channel'),(($server_role === 'basic' || get_account_techlevel() < 3) ? false : true),get_config('feature_lock','wiki')), // array('hide_rating', t('Hide Rating'), t('Hide the rating buttons on your channel and profile pages. Note: People can still rate you somewhere else.'),false,get_config('feature_lock','hide_rating')), array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders (note: not encrypted)'),false,get_config('feature_lock','private_notes')), array('nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu'),false,get_config('feature_lock','nav_channel_select')), @@ -105,7 +105,7 @@ function get_features($filtered = true) { - if(\Zotlabs\Lib\System::get_server_role() === 'pro') { + if($server_role === 'pro' && get_account_techlevel() > 3) { $arr['general'][] = [ 'premium_channel', t('Premium Channel'), diff --git a/include/nav.php b/include/nav.php index 025da71b3..9b6896d15 100644 --- a/include/nav.php +++ b/include/nav.php @@ -63,6 +63,7 @@ EOT; $server_role = get_config('system','server_role'); $basic = (($server_role === 'basic') ? true : false); + $techlevel = get_account_techlevel(); // nav links: array of array('href', 'text', 'extra css classes', 'title') $nav = Array(); diff --git a/include/widgets.php b/include/widgets.php index 9429df249..16582d084 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -594,14 +594,11 @@ function widget_settings_menu($arr) { ); } - // IF can go away when UNO export and import is fully functional - if(get_config('system','server_role') !== 'basic') { - $tabs[] = array( - 'label' => t('Export channel'), - 'url' => z_root() . '/uexport', - 'selected' => '' - ); - } + $tabs[] = array( + 'label' => t('Export channel'), + 'url' => z_root() . '/uexport', + 'selected' => '' + ); $tabs[] = array( 'label' => t('Connected apps'), @@ -609,7 +606,7 @@ function widget_settings_menu($arr) { 'selected' => ((argv(1) === 'oauth') ? 'active' : ''), ); - if(get_config('system','server_role') !== 'basic') { + if(get_account_techlevel() > 2) { $tabs[] = array( 'label' => t('Guest Access Tokens'), 'url' => z_root() . '/settings/tokens', |