aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Lib/ThreadItem.php3
-rw-r--r--Zotlabs/Module/Settings.php23
-rwxr-xr-xZotlabs/Render/SmartyTemplate.php1
-rwxr-xr-xboot.php2
-rw-r--r--include/account.php27
-rw-r--r--include/bbcode.php3
-rw-r--r--include/conversation.php4
-rw-r--r--include/features.php6
-rw-r--r--include/nav.php1
-rw-r--r--include/widgets.php15
-rw-r--r--install/update.php9
-rwxr-xr-xview/tpl/settings_account.tpl7
12 files changed, 81 insertions, 20 deletions
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index eee3b2a4f..f50b9680e 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -246,10 +246,11 @@ class ThreadItem {
}
$server_role = get_config('system','server_role');
+
$has_bookmarks = false;
if(is_array($item['term'])) {
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;
}
}
diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php
index bd16b930e..81c24e02b 100644
--- a/Zotlabs/Module/Settings.php
+++ b/Zotlabs/Module/Settings.php
@@ -306,6 +306,8 @@ class Settings extends \Zotlabs\Web\Controller {
$errs = array();
$email = ((x($_POST,'email')) ? trim(notags($_POST['email'])) : '');
+ $techlevel = ((array_key_exists('techlevel',$_POST)) ? intval($_POST['techlevel']) : 0);
+
$account = \App::get_account();
if($email != $account['account_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.');
}
}
+ 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) {
foreach($errs as $err)
@@ -783,8 +792,17 @@ class Settings extends \Zotlabs\Web\Controller {
call_hooks('account_settings', $account_settings);
$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");
$o .= replace_macros($tpl, array(
'$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'), ' ',''),
'$password1'=> array('npassword', t('Enter New Password'), '', ''),
'$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'),
'$email' => array('email', t('Email Address:'), $email, ''),
'$removeme' => t('Remove Account'),
diff --git a/Zotlabs/Render/SmartyTemplate.php b/Zotlabs/Render/SmartyTemplate.php
index 7abe0731c..ffe58e286 100755
--- a/Zotlabs/Render/SmartyTemplate.php
+++ b/Zotlabs/Render/SmartyTemplate.php
@@ -35,6 +35,7 @@ class SmartyTemplate implements TemplateEngine {
$r['$z_baseurl'] = z_root();
$r['$z_server_role'] = \Zotlabs\Lib\System::get_server_role();
+ $r['$z_techlevel'] = get_account_techlevel();
if(gettype($s) === 'string') {
$template = $s;
diff --git a/boot.php b/boot.php
index dc1d08aff..ea3522dc7 100755
--- a/boot.php
+++ b/boot.php
@@ -47,7 +47,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '1.13' );
define ( 'ZOT_REVISION', '1.1' );
-define ( 'DB_UPDATE_VERSION', 1181 );
+define ( 'DB_UPDATE_VERSION', 1182 );
/**
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',
diff --git a/install/update.php b/install/update.php
index 3d0e5b00d..2b3a9b338 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1181 );
+define( 'UPDATE_VERSION' , 1182 );
/**
*
@@ -2429,3 +2429,10 @@ function update_r1180() {
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;
+}
+
diff --git a/view/tpl/settings_account.tpl b/view/tpl/settings_account.tpl
index 06f47bbe1..4a94bb93d 100755
--- a/view/tpl/settings_account.tpl
+++ b/view/tpl/settings_account.tpl
@@ -11,6 +11,13 @@
{{include file="field_password.tpl" field=$origpass}}
{{include file="field_password.tpl" field=$password1}}
{{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" >
<button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>
</div>