provide techlevels in the pro server role. Should have no visible effect on other roles.

This commit is contained in:
redmatrix
2016-08-31 17:49:22 -07:00
parent e9462ba145
commit ea0be8ea1a
12 changed files with 81 additions and 20 deletions

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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,

View File

@@ -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'),

View File

@@ -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();

View File

@@ -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',