provide techlevels in the pro server role. Should have no visible effect on other roles.
This commit is contained in:
parent
e9462ba145
commit
ea0be8ea1a
@ -246,10 +246,11 @@ class ThreadItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$server_role = get_config('system','server_role');
|
$server_role = get_config('system','server_role');
|
||||||
|
|
||||||
$has_bookmarks = false;
|
$has_bookmarks = false;
|
||||||
if(is_array($item['term'])) {
|
if(is_array($item['term'])) {
|
||||||
foreach($item['term'] as $t) {
|
foreach($item['term'] as $t) {
|
||||||
if(($server_role != 'basic') && ($t['ttype'] == TERM_BOOKMARK))
|
if((get_account_techlevel() > 0) && ($t['ttype'] == TERM_BOOKMARK))
|
||||||
$has_bookmarks = true;
|
$has_bookmarks = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -306,6 +306,8 @@ class Settings extends \Zotlabs\Web\Controller {
|
|||||||
$errs = array();
|
$errs = array();
|
||||||
|
|
||||||
$email = ((x($_POST,'email')) ? trim(notags($_POST['email'])) : '');
|
$email = ((x($_POST,'email')) ? trim(notags($_POST['email'])) : '');
|
||||||
|
$techlevel = ((array_key_exists('techlevel',$_POST)) ? intval($_POST['techlevel']) : 0);
|
||||||
|
|
||||||
$account = \App::get_account();
|
$account = \App::get_account();
|
||||||
if($email != $account['account_email']) {
|
if($email != $account['account_email']) {
|
||||||
if(! valid_email($email))
|
if(! valid_email($email))
|
||||||
@ -324,6 +326,13 @@ class Settings extends \Zotlabs\Web\Controller {
|
|||||||
$errs[] = t('System failure storing new email. Please try again.');
|
$errs[] = t('System failure storing new email. Please try again.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($techlevel != $account['account_level']) {
|
||||||
|
$r = q("update account set account_level = %d where account_id = %d",
|
||||||
|
intval($techlevel),
|
||||||
|
intval($account['account_id'])
|
||||||
|
);
|
||||||
|
info( t('Technical skill level updated') . EOL);
|
||||||
|
}
|
||||||
|
|
||||||
if($errs) {
|
if($errs) {
|
||||||
foreach($errs as $err)
|
foreach($errs as $err)
|
||||||
@ -783,8 +792,17 @@ class Settings extends \Zotlabs\Web\Controller {
|
|||||||
call_hooks('account_settings', $account_settings);
|
call_hooks('account_settings', $account_settings);
|
||||||
|
|
||||||
$email = \App::$account['account_email'];
|
$email = \App::$account['account_email'];
|
||||||
|
|
||||||
|
$techlevels = [
|
||||||
|
'0' => t('Beginner/Basic'),
|
||||||
|
'1' => t('Novice - not skilled but willing to learn'),
|
||||||
|
'2' => t('Intermediate - somewhat comfortable'),
|
||||||
|
'3' => t('Advanced - very comfortable'),
|
||||||
|
'4' => t('Expert - I can write computer code'),
|
||||||
|
'5' => t('Wizard - I probably know more than you do')
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
$tpl = get_markup_template("settings_account.tpl");
|
$tpl = get_markup_template("settings_account.tpl");
|
||||||
$o .= replace_macros($tpl, array(
|
$o .= replace_macros($tpl, array(
|
||||||
'$form_security_token' => get_form_security_token("settings_account"),
|
'$form_security_token' => get_form_security_token("settings_account"),
|
||||||
@ -792,6 +810,7 @@ class Settings extends \Zotlabs\Web\Controller {
|
|||||||
'$origpass' => array('origpass', t('Current Password'), ' ',''),
|
'$origpass' => array('origpass', t('Current Password'), ' ',''),
|
||||||
'$password1'=> array('npassword', t('Enter New Password'), '', ''),
|
'$password1'=> array('npassword', t('Enter New Password'), '', ''),
|
||||||
'$password2'=> array('confirm', t('Confirm New Password'), '', t('Leave password fields blank unless changing')),
|
'$password2'=> array('confirm', t('Confirm New Password'), '', t('Leave password fields blank unless changing')),
|
||||||
|
'$techlevel' => [ 'techlevel', t('Your technical skill level'), \App::$account['account_level'], t('Used to provide a member experience matched to your comfort level'), $techlevels ],
|
||||||
'$submit' => t('Submit'),
|
'$submit' => t('Submit'),
|
||||||
'$email' => array('email', t('Email Address:'), $email, ''),
|
'$email' => array('email', t('Email Address:'), $email, ''),
|
||||||
'$removeme' => t('Remove Account'),
|
'$removeme' => t('Remove Account'),
|
||||||
|
@ -35,6 +35,7 @@ class SmartyTemplate implements TemplateEngine {
|
|||||||
|
|
||||||
$r['$z_baseurl'] = z_root();
|
$r['$z_baseurl'] = z_root();
|
||||||
$r['$z_server_role'] = \Zotlabs\Lib\System::get_server_role();
|
$r['$z_server_role'] = \Zotlabs\Lib\System::get_server_role();
|
||||||
|
$r['$z_techlevel'] = get_account_techlevel();
|
||||||
|
|
||||||
if(gettype($s) === 'string') {
|
if(gettype($s) === 'string') {
|
||||||
$template = $s;
|
$template = $s;
|
||||||
|
2
boot.php
2
boot.php
@ -47,7 +47,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' );
|
|||||||
define ( 'STD_VERSION', '1.13' );
|
define ( 'STD_VERSION', '1.13' );
|
||||||
define ( 'ZOT_REVISION', '1.1' );
|
define ( 'ZOT_REVISION', '1.1' );
|
||||||
|
|
||||||
define ( 'DB_UPDATE_VERSION', 1181 );
|
define ( 'DB_UPDATE_VERSION', 1182 );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,6 +14,13 @@ require_once('include/crypto.php');
|
|||||||
require_once('include/channel.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) {
|
function check_account_email($email) {
|
||||||
|
|
||||||
$result = array('error' => false, 'message' => '');
|
$result = array('error' => false, 'message' => '');
|
||||||
@ -751,3 +758,23 @@ function upgrade_bool_message($bbcode = false) {
|
|||||||
$x = upgrade_link($bbcode);
|
$x = upgrade_link($bbcode);
|
||||||
return t('This action is not available under your subscription plan.') . (($x) ? ' ' . $x : '') ;
|
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);
|
||||||
|
|
||||||
|
}
|
@ -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);
|
$Text = preg_replace("/\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '<a class="zrl" href="$1" target="_blank" >$2</a>', $Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove bookmarks from UNO
|
if (get_account_techlevel() > 2)
|
||||||
if (get_config('system','server_role') === 'basic')
|
|
||||||
$Text = str_replace('<span class="bookmark-identifier">#^</span>', '', $Text);
|
$Text = str_replace('<span class="bookmark-identifier">#^</span>', '', $Text);
|
||||||
|
|
||||||
// Perform MAIL Search
|
// Perform MAIL Search
|
||||||
|
@ -1621,6 +1621,8 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
|
|||||||
|
|
||||||
|
|
||||||
$uid = ((App::$profile['profile_uid']) ? App::$profile['profile_uid'] : local_channel());
|
$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()) {
|
if($uid == local_channel()) {
|
||||||
$cal_link = '';
|
$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(
|
$tabs[] = array(
|
||||||
'label' => t('Wiki'),
|
'label' => t('Wiki'),
|
||||||
'url' => z_root() . '/wiki/' . $nickname,
|
'url' => z_root() . '/wiki/' . $nickname,
|
||||||
|
@ -38,7 +38,7 @@ function get_feature_default($feature) {
|
|||||||
|
|
||||||
function get_features($filtered = true) {
|
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)
|
if($server_role === 'basic' && $filtered)
|
||||||
return array();
|
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('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('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('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('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('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')),
|
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'][] = [
|
$arr['general'][] = [
|
||||||
'premium_channel',
|
'premium_channel',
|
||||||
t('Premium Channel'),
|
t('Premium Channel'),
|
||||||
|
@ -63,6 +63,7 @@ EOT;
|
|||||||
|
|
||||||
$server_role = get_config('system','server_role');
|
$server_role = get_config('system','server_role');
|
||||||
$basic = (($server_role === 'basic') ? true : false);
|
$basic = (($server_role === 'basic') ? true : false);
|
||||||
|
$techlevel = get_account_techlevel();
|
||||||
|
|
||||||
// nav links: array of array('href', 'text', 'extra css classes', 'title')
|
// nav links: array of array('href', 'text', 'extra css classes', 'title')
|
||||||
$nav = Array();
|
$nav = Array();
|
||||||
|
@ -594,14 +594,11 @@ function widget_settings_menu($arr) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IF can go away when UNO export and import is fully functional
|
$tabs[] = array(
|
||||||
if(get_config('system','server_role') !== 'basic') {
|
'label' => t('Export channel'),
|
||||||
$tabs[] = array(
|
'url' => z_root() . '/uexport',
|
||||||
'label' => t('Export channel'),
|
'selected' => ''
|
||||||
'url' => z_root() . '/uexport',
|
);
|
||||||
'selected' => ''
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$tabs[] = array(
|
$tabs[] = array(
|
||||||
'label' => t('Connected apps'),
|
'label' => t('Connected apps'),
|
||||||
@ -609,7 +606,7 @@ function widget_settings_menu($arr) {
|
|||||||
'selected' => ((argv(1) === 'oauth') ? 'active' : ''),
|
'selected' => ((argv(1) === 'oauth') ? 'active' : ''),
|
||||||
);
|
);
|
||||||
|
|
||||||
if(get_config('system','server_role') !== 'basic') {
|
if(get_account_techlevel() > 2) {
|
||||||
$tabs[] = array(
|
$tabs[] = array(
|
||||||
'label' => t('Guest Access Tokens'),
|
'label' => t('Guest Access Tokens'),
|
||||||
'url' => z_root() . '/settings/tokens',
|
'url' => z_root() . '/settings/tokens',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define( 'UPDATE_VERSION' , 1181 );
|
define( 'UPDATE_VERSION' , 1182 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -2429,3 +2429,10 @@ function update_r1180() {
|
|||||||
return UPDATE_FAILED;
|
return UPDATE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_r1181() {
|
||||||
|
if(\Zotlabs\Lib\System::get_server_role() == 'pro') {
|
||||||
|
q("update account set account_level = 5 where true");
|
||||||
|
}
|
||||||
|
return UPDATE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,13 @@
|
|||||||
{{include file="field_password.tpl" field=$origpass}}
|
{{include file="field_password.tpl" field=$origpass}}
|
||||||
{{include file="field_password.tpl" field=$password1}}
|
{{include file="field_password.tpl" field=$password1}}
|
||||||
{{include file="field_password.tpl" field=$password2}}
|
{{include file="field_password.tpl" field=$password2}}
|
||||||
|
|
||||||
|
{{if $z_server_role == 'pro'}}
|
||||||
|
{{include file="field_select.tpl" field=$techlevel}}
|
||||||
|
{{else}}
|
||||||
|
<input type="hidden" name="techlevel" value="{{$techlevel.2}}" />
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<div class="settings-submit-wrapper" >
|
<div class="settings-submit-wrapper" >
|
||||||
<button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>
|
<button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user