use config system.server_role and deprecate 'UNO'

This commit is contained in:
redmatrix 2016-08-07 17:29:35 -07:00
parent e1659b0725
commit 5243dd153b
24 changed files with 135 additions and 71 deletions

View File

@ -43,8 +43,8 @@ class System {
static public function get_server_role() {
if(UNO)
return 'basic';
if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['server_role'])
return \App::$config['system']['server_role'];
return 'pro';
}

View File

@ -245,10 +245,11 @@ class ThreadItem {
);
}
$server_role = get_config('system','server_role');
$has_bookmarks = false;
if(is_array($item['term'])) {
foreach($item['term'] as $t) {
if(!UNO && $t['ttype'] == TERM_BOOKMARK)
if(($server_role != 'basic') && ($t['ttype'] == TERM_BOOKMARK))
$has_bookmarks = true;
}
}

View File

@ -151,7 +151,7 @@ class Register extends \Zotlabs\Web\Controller {
$new_channel = false;
$next_page = 'new_channel';
if(get_config('system','auto_channel_create') || UNO) {
if(get_config('system','auto_channel_create') || get_config('system','server_role') == 'basic') {
$new_channel = auto_channel_create($result['account']['account_id']);
if($new_channel['success']) {
$channel_id = $new_channel['channel']['channel_id'];
@ -234,9 +234,12 @@ class Register extends \Zotlabs\Web\Controller {
$privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "");
$role = array('permissions_role' , t('Channel role and privacy'), ($privacy_role) ? $privacy_role : 'social', t('Select a channel role with your privacy requirements.') . ' <a href="help/roles" target="_blank">' . t('Read more about roles') . '</a>',get_roles());
$tos = array('tos', $label_tos, '', '', array(t('no'),t('yes')));
$auto_create = ((UNO) || (get_config('system','auto_channel_create')) ? true : false);
$default_role = ((UNO) ? 'social' : get_config('system','default_permissions_role'));
$server_role = get_config('system','server_role');
$auto_create = (($server_role == 'basic') || (get_config('system','auto_channel_create')) ? true : false);
$default_role = (($server_role == 'basic') ? 'social' : get_config('system','default_permissions_role'));
require_once('include/bbcode.php');

View File

@ -101,7 +101,7 @@ class Setup extends \Zotlabs\Web\Controller {
$timezone = notags(trim($_POST['timezone']));
$adminmail = notags(trim($_POST['adminmail']));
$siteurl = notags(trim($_POST['siteurl']));
$advanced = ((intval($_POST['advanced'])) ? 1 : 0);
$advanced = ((intval($_POST['advanced'])) ? 'pro' : 'basic');
if($siteurl != z_root()) {
$test = z_fetch_url($siteurl."/setup/testrewrite");
@ -124,17 +124,17 @@ class Setup extends \Zotlabs\Web\Controller {
$tpl = get_intltext_template('htconfig.tpl');
$txt = replace_macros($tpl,array(
'$dbhost' => $dbhost,
'$dbport' => $dbport,
'$dbuser' => $dbuser,
'$dbpass' => $dbpass,
'$dbdata' => $dbdata,
'$dbtype' => $dbtype,
'$uno' => 1 - $advanced,
'$timezone' => $timezone,
'$siteurl' => $siteurl,
'$site_id' => random_string(),
'$phpath' => $phpath,
'$dbhost' => $dbhost,
'$dbport' => $dbport,
'$dbuser' => $dbuser,
'$dbpass' => $dbpass,
'$dbdata' => $dbdata,
'$dbtype' => $dbtype,
'$server_role' => $advanced,
'$timezone' => $timezone,
'$siteurl' => $siteurl,
'$site_id' => random_string(),
'$phpath' => $phpath,
'$adminmail' => $adminmail
));

View File

@ -602,8 +602,12 @@ function sys_boot() {
@include('.htconfig.php');
if(! defined('UNO'))
define('UNO', 0);
if(defined('UNO')) {
if(UNO)
App::$config['system']['server_role'] = 'basic';
else
App::$config['system']['server_role'] = 'pro';
}
if(array_key_exists('default_timezone',get_defined_vars())) {
App::$config['system']['timezone'] = $default_timezone;

View File

@ -407,7 +407,7 @@ function account_allow($hash) {
pop_lang();
if(get_config('system','auto_channel_create') || UNO)
if(get_config('system','auto_channel_create') || get_config('system','server_role') === 'basic')
auto_channel_create($register[0]['uid']);
if ($res) {
@ -511,7 +511,7 @@ function account_approve($hash) {
if(get_config('system','auto_channel_create') || UNO)
if(get_config('system','auto_channel_create') || get_config('system','server_role') === 'basic')
auto_channel_create($register[0]['uid']);
else {
$_SESSION['login_return_url'] = 'new_channel';

View File

@ -667,7 +667,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
}
// Remove bookmarks from UNO
if (UNO)
if (get_config('system','server_role') === 'basic')
$Text = str_replace('<span class="bookmark-identifier">#^</span>', '', $Text);
// Perform MAIL Search

View File

@ -423,14 +423,6 @@ function create_identity($arr) {
set_pconfig($ret['channel']['channel_id'],'system','attach_path','%Y-%m');
}
// UNO: channel defaults, incl addons (addons specific pconfig will only work after the relevant addon is enabled by the admin). It's located here, so members can modify these defaults after the channel is created.
if(UNO) {
//diaspora protocol addon
set_pconfig($ret['channel']['channel_id'],'system','diaspora_allowed', '1');
set_pconfig($ret['channel']['channel_id'],'system','diaspora_public_comments', '1');
set_pconfig($ret['channel']['channel_id'],'system','prevent_tag_hijacking', '0');
}
// auto-follow any of the hub's pre-configured channel choices.
// Only do this if it's the first channel for this account;
// otherwise it could get annoying. Don't make this list too big

View File

@ -1709,7 +1709,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
);
}
if(feature_enabled($uid,'wiki') && (! UNO)) {
if(feature_enabled($uid,'wiki') && (get_config('system','server_role') !== 'basic')) {
$tabs[] = array(
'label' => t('Wiki'),
'url' => z_root() . '/wiki/' . $nickname,

View File

@ -38,7 +38,9 @@ function get_feature_default($feature) {
function get_features($filtered = true) {
if(UNO && $filtered)
$server_role = get_config('system','server_role');
if($server_role === 'basic' && $filtered)
return array();
$arr = array(
@ -52,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'),((UNO) ? false : true),get_config('feature_lock','wiki')),
array('wiki', t('Wiki'), t('Provide a wiki for your channel'),(($server_role === 'basic') ? 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')),

View File

@ -61,13 +61,15 @@ EOT;
'$banner' => $banner
));
$server_role = get_config('system','server_role');
$basic = (($server_role === 'basic') ? true : false);
// nav links: array of array('href', 'text', 'extra css classes', 'title')
$nav = Array();
/**
* Display login or logout
*/
*/
$nav['usermenu']=array();
$userinfo = null;
@ -76,7 +78,7 @@ EOT;
if(local_channel()) {
if($chans && count($chans) > 1 && feature_enabled(local_channel(),'nav_channel_select') && (! UNO))
if($chans && count($chans) > 1 && feature_enabled(local_channel(),'nav_channel_select') && (! $basic))
$nav['channels'] = $chans;
$nav['logout'] = Array('logout',t('Logout'), "", t('End this session'),'logout_nav_btn');
@ -84,7 +86,7 @@ EOT;
// user menu
$nav['usermenu'][] = Array('channel/' . $channel['channel_address'], t('Home'), "", t('Your posts and conversations'),'channel_nav_btn');
$nav['usermenu'][] = Array('profile/' . $channel['channel_address'], t('View Profile'), "", t('Your profile page'),'profile_nav_btn');
if(feature_enabled(local_channel(),'multi_profiles') && (! UNO))
if(feature_enabled(local_channel(),'multi_profiles') && (! $basic))
$nav['usermenu'][] = Array('profiles', t('Edit Profiles'),"", t('Manage/Edit profiles'),'profiles_nav_btn');
else
$nav['usermenu'][] = Array('profiles/' . $prof[0]['id'], t('Edit Profile'),"", t('Edit your profile'),'profiles_nav_btn');
@ -92,19 +94,19 @@ EOT;
$nav['usermenu'][] = Array('photos/' . $channel['channel_address'], t('Photos'), "", t('Your photos'),'photos_nav_btn');
$nav['usermenu'][] = Array('cloud/' . $channel['channel_address'],t('Files'),"",t('Your files'),'cloud_nav_btn');
if((! UNO) && feature_enabled(local_channel(),'ajaxchat'))
if((! $basic) && feature_enabled(local_channel(),'ajaxchat'))
$nav['usermenu'][] = Array('chat/' . $channel['channel_address'], t('Chat'),"",t('Your chatrooms'),'chat_nav_btn');
require_once('include/menu.php');
$has_bookmarks = menu_list_count(local_channel(),'',MENU_BOOKMARK) + menu_list_count(local_channel(),'',MENU_SYSTEM|MENU_BOOKMARK);
if(($has_bookmarks) && (! UNO)) {
if(($has_bookmarks) && (! $basic)) {
$nav['usermenu'][] = Array('bookmarks', t('Bookmarks'), "", t('Your bookmarks'),'bookmarks_nav_btn');
}
if(feature_enabled($channel['channel_id'],'webpages') && (! UNO))
if(feature_enabled($channel['channel_id'],'webpages') && (! $basic))
$nav['usermenu'][] = Array('webpages/' . $channel['channel_address'],t('Webpages'),"",t('Your webpages'),'webpages_nav_btn');
if(feature_enabled($channel['channel_id'],'wiki') && (! UNO))
if(feature_enabled($channel['channel_id'],'wiki') && (! $basic))
$nav['usermenu'][] = Array('wiki/' . $channel['channel_address'],t('Wiki'),"",t('Your wiki'),'wiki_nav_btn');
}
else {
@ -161,7 +163,7 @@ EOT;
$nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'), 'help_nav_btn', $context_help, $enable_context_help);
}
if(! UNO)
if(! $basic)
$nav['apps'] = array('apps', t('Apps'), "", t('Applications, utilities, links, games'),'apps_nav_btn');
$nav['search'] = array('search', t('Search'), "", t('Search site @name, #tag, ?docs, content'));
@ -204,7 +206,7 @@ EOT;
$nav['all_events']['all']=array('events', t('See all events'), "", "");
$nav['all_events']['mark'] = array('', t('Mark all events seen'), '','');
if(! UNO)
if(! $basic)
$nav['manage'] = array('manage', t('Channel Manager'), "", t('Manage Your Channels'),'manage_nav_btn');
$nav['settings'] = array('settings', t('Settings'),"", t('Account/Channel Settings'),'settings_nav_btn');

View File

@ -595,7 +595,7 @@ function widget_settings_menu($arr) {
}
// IF can go away when UNO export and import is fully functional
if(! UNO) {
if(get_config('system','server_role') !== 'basic') {
$tabs[] = array(
'label' => t('Export channel'),
'url' => z_root() . '/uexport',
@ -609,7 +609,7 @@ function widget_settings_menu($arr) {
'selected' => ((argv(1) === 'oauth') ? 'active' : ''),
);
if(! UNO) {
if(get_config('system','server_role') !== 'basic') {
$tabs[] = array(
'label' => t('Guest Access Tokens'),
'url' => z_root() . '/settings/tokens',

View File

@ -2251,7 +2251,7 @@ function check_location_move($sender_hash,$locations) {
if(! $locations)
return;
if(! UNO)
if(get_config('system','server_role') !== 'basic')
return;
if(count($locations) != 1)
@ -2929,7 +2929,7 @@ function import_site($arr, $pubkey) {
*/
function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) {
if(UNO)
if(get_config('system','server_role') === 'basic')
return;
logger('build_sync_packet');
@ -3077,7 +3077,7 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) {
*/
function process_channel_sync_delivery($sender, $arr, $deliveries) {
if(UNO)
if(get_config('system','server_role') === 'basic')
return;
require_once('include/import.php');

View File

@ -19,8 +19,6 @@ $db_pass = 'mysqlpassword';
$db_data = 'mysqldatabasename';
$db_type = 0; // use 1 for postgres, 0 for mysql
define( 'UNO', 0 );
/*
* Notice: Many of the following settings will be available in the admin panel
* after a successful site install. Once they are set in the admin panel, they
@ -46,6 +44,14 @@ App::$config['system']['sitename'] = "Hubzilla";
App::$config['system']['location_hash'] = 'if the auto install failed, put a unique random string here';
// Choices are 'basic', 'standard', and 'pro'.
// basic sets up the sevrer for basic social networking and removes "complicated" features
// standard provides most desired features except e-commerce
// pro gives you access to everything
App::$config['system']['server_role'] = 'pro';
// These lines set additional security headers to be sent with all responses
// You may wish to set transport_security_header to 0 if your server already sends
// this header. content_security_policy may need to be disabled if you wish to

View File

@ -10,8 +10,6 @@ $db_pass = '{{$dbpass}}';
$db_data = '{{$dbdata}}';
$db_type = '{{$dbtype}}'; // an integer. 0 or unset for mysql, 1 for postgres
define( 'UNO', {{$uno}} );
/*
* Notice: Many of the following settings will be available in the admin panel
* after a successful site install. Once they are set in the admin panel, they
@ -36,6 +34,12 @@ App::$config['system']['baseurl'] = '{{$siteurl}}';
App::$config['system']['sitename'] = "Hubzilla";
App::$config['system']['location_hash'] = '{{$site_id}}';
// Choices are 'basic', 'standard', and 'pro'.
// basic sets up the sevrer for basic social networking and removes "complicated" features
// standard provides most desired features except e-commerce
// pro gives you access to everything
App::$config['system']['server_role'] = '{{$server_role}}';
// These lines set additional security headers to be sent with all responses
// You may wish to set transport_security_header to 0 if your server already sends

View File

@ -10,8 +10,6 @@ $db_pass = '{{$dbpass}}';
$db_data = '{{$dbdata}}';
$db_type = '{{$dbtype}}'; // an integer. 0 or unset for mysql, 1 for postgres
define( 'UNO', {{$uno}} );
/*
* Notice: Many of the following settings will be available in the admin panel
* after a successful site install. Once they are set in the admin panel, they
@ -36,6 +34,12 @@ App::$config['system']['baseurl'] = '{{$siteurl}}';
App::$config['system']['sitename'] = "Hubzilla";
App::$config['system']['location_hash'] = '{{$site_id}}';
// Choices are 'basic', 'standard', and 'pro'.
// basic sets up the sevrer for basic social networking and removes "complicated" features
// standard provides most desired features except e-commerce
// pro gives you access to everything
App::$config['system']['server_role'] = '{{$server_role}}';
// These lines set additional security headers to be sent with all responses
// You may wish to set transport_security_header to 0 if your server already sends

View File

@ -10,8 +10,6 @@ $db_pass = '{{$dbpass}}';
$db_data = '{{$dbdata}}';
$db_type = '{{$dbtype}}'; // an integer. 0 or unset for mysql, 1 for postgres
define( 'UNO', {{$uno}} );
/*
* Notice: Many of the following settings will be available in the admin panel
* after a successful site install. Once they are set in the admin panel, they
@ -36,6 +34,14 @@ App::$config['system']['baseurl'] = '{{$siteurl}}';
App::$config['system']['sitename'] = "Hubzilla";
App::$config['system']['location_hash'] = '{{$site_id}}';
// Choices are 'basic', 'standard', and 'pro'.
// basic sets up the sevrer for basic social networking and removes "complicated" features
// standard provides most desired features except e-commerce
// pro gives you access to everything
App::$config['system']['server_role'] = '{{$server_role}}';
// These lines set additional security headers to be sent with all responses
// You may wish to set transport_security_header to 0 if your server already sends
// this header. content_security_policy may need to be disabled if you wish to

View File

@ -10,8 +10,6 @@ $db_pass = '{{$dbpass}}';
$db_data = '{{$dbdata}}';
$db_type = '{{$dbtype}}'; // an integer. 0 or unset for mysql, 1 for postgres
define( 'UNO', {{$uno}} );
/*
* Notice: Many of the following settings will be available in the admin panel
* after a successful site install. Once they are set in the admin panel, they
@ -36,6 +34,14 @@ App::$config['system']['baseurl'] = '{{$siteurl}}';
App::$config['system']['sitename'] = "Hubzilla";
App::$config['system']['location_hash'] = '{{$site_id}}';
// Choices are 'basic', 'standard', and 'pro'.
// basic sets up the sevrer for basic social networking and removes "complicated" features
// standard provides most desired features except e-commerce
// pro gives you access to everything
App::$config['system']['server_role'] = '{{$server_role}}';
// These lines set additional security headers to be sent with all responses
// You may wish to set transport_security_header to 0 if your server already sends
// this header. content_security_policy may need to be disabled if you wish to

View File

@ -12,8 +12,6 @@ $db_pass = '{{$dbpass}}';
$db_data = '{{$dbdata}}';
$db_type = '{{$dbtype}}'; // an integer. 0 or unset for mysql, 1 for postgres
define( 'UNO', {{$uno}} );
/*
* Note: Plusieurs de ces réglages seront disponibles via le panneau d'administration
* après l'installation. Lorsque des modifications sont apportés à travers le panneau d'administration
@ -37,6 +35,14 @@ App::$config['system']['baseurl'] = '{{$siteurl}}';
App::$config['system']['sitename'] = "Hubzilla";
App::$config['system']['location_hash'] = '{{$site_id}}';
// Choices are 'basic', 'standard', and 'pro'.
// basic sets up the sevrer for basic social networking and removes "complicated" features
// standard provides most desired features except e-commerce
// pro gives you access to everything
App::$config['system']['server_role'] = '{{$server_role}}';
// These lines set additional security headers to be sent with all responses
// You may wish to set transport_security_header to 0 if your server already sends

View File

@ -10,8 +10,6 @@ $db_pass = '{{$dbpass}}';
$db_data = '{{$dbdata}}';
$db_type = '{{$dbtype}}'; // an integer. 0 or unset for mysql, 1 for postgres
define( 'UNO', {{$uno}} );
/*
* Notice: Many of the following settings will be available in the admin panel
* after a successful site install. Once they are set in the admin panel, they
@ -36,6 +34,14 @@ App::$config['system']['baseurl'] = '{{$siteurl}}';
App::$config['system']['sitename'] = "Hubzilla";
App::$config['system']['location_hash'] = '{{$site_id}}';
// Choices are 'basic', 'standard', and 'pro'.
// basic sets up the sevrer for basic social networking and removes "complicated" features
// standard provides most desired features except e-commerce
// pro gives you access to everything
App::$config['system']['server_role'] = '{{$server_role}}';
// These lines set additional security headers to be sent with all responses
// You may wish to set transport_security_header to 0 if your server already sends
// this header. content_security_policy may need to be disabled if you wish to

View File

@ -10,8 +10,6 @@ $db_pass = '{{$dbpass}}';
$db_data = '{{$dbdata}}';
$db_type = '{{$dbtype}}'; // an integer. 0 or unset for mysql, 1 for postgres
define( 'UNO', {{$uno}} );
/*
* Notice: Many of the following settings will be available in the admin panel
* after a successful site install. Once they are set in the admin panel, they
@ -36,6 +34,14 @@ App::$config['system']['baseurl'] = '{{$siteurl}}';
App::$config['system']['sitename'] = "Hubzilla";
App::$config['system']['location_hash'] = '{{$site_id}}';
// Choices are 'basic', 'standard', and 'pro'.
// basic sets up the sevrer for basic social networking and removes "complicated" features
// standard provides most desired features except e-commerce
// pro gives you access to everything
App::$config['system']['server_role'] = '{{$server_role}}';
// These lines set additional security headers to be sent with all responses
// You may wish to set transport_security_header to 0 if your server already sends
// this header. content_security_policy may need to be disabled if you wish to

View File

@ -10,8 +10,6 @@ $db_pass = '{{$dbpass}}';
$db_data = '{{$dbdata}}';
$db_type = '{{$dbtype}}'; // an integer. 0 or unset for mysql, 1 for postgres
define( 'UNO', {{$uno}} );
/*
* Notice: Many of the following settings will be available in the admin panel
* after a successful site install. Once they are set in the admin panel, they
@ -36,6 +34,14 @@ App::$config['system']['baseurl'] = '{{$siteurl}}';
App::$config['system']['sitename'] = "Hubzilla";
App::$config['system']['location_hash'] = '{{$site_id}}';
// Choices are 'basic', 'standard', and 'pro'.
// basic sets up the sevrer for basic social networking and removes "complicated" features
// standard provides most desired features except e-commerce
// pro gives you access to everything
App::$config['system']['server_role'] = '{{$server_role}}';
// These lines set additional security headers to be sent with all responses
// You may wish to set transport_security_header to 0 if your server already sends
// this header. content_security_policy may need to be disabled if you wish to

View File

@ -10,8 +10,6 @@ $db_pass = '{{$dbpass}}';
$db_data = '{{$dbdata}}';
$db_type = '{{$dbtype}}'; // an integer. 0 or unset for mysql, 1 for postgres
define( 'UNO', {{$uno}} );
/*
* Notice: Many of the following settings will be available in the admin panel
* after a successful site install. Once they are set in the admin panel, they
@ -36,6 +34,13 @@ App::$config['system']['baseurl'] = '{{$siteurl}}';
App::$config['system']['sitename'] = "Hubzilla";
App::$config['system']['location_hash'] = '{{$site_id}}';
// Choices are 'basic', 'standard', and 'pro'.
// basic sets up the sevrer for basic social networking and removes "complicated" features
// standard provides most desired features except e-commerce
// pro gives you access to everything
App::$config['system']['server_role'] = '{{$server_role}}';
// Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.
// Be certain to create your own personal account before setting
// REGISTER_CLOSED. 'register_text' (if set) will be displayed prominently on

View File

@ -10,8 +10,6 @@ $db_pass = '{{$dbpass}}';
$db_data = '{{$dbdata}}';
$db_type = '{{$dbtype}}'; // an integer. 0 or unset for mysql, 1 for postgres
define( 'UNO', {{$uno}} );
/*
* Notice: Many of the following settings will be available in the admin panel
* after a successful site install. Once they are set in the admin panel, they
@ -36,6 +34,13 @@ App::$config['system']['baseurl'] = '{{$siteurl}}';
App::$config['system']['sitename'] = "Hubzilla";
App::$config['system']['location_hash'] = '{{$site_id}}';
// Choices are 'basic', 'standard', and 'pro'.
// basic sets up the sevrer for basic social networking and removes "complicated" features
// standard provides most desired features except e-commerce
// pro gives you access to everything
App::$config['system']['server_role'] = '{{$server_role}}';
// Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.
// Be certain to create your own personal account before setting
// REGISTER_CLOSED. 'register_text' (if set) will be displayed prominently on