allow changing the server role - as well as configuring any of the three options during installation

This commit is contained in:
redmatrix 2016-08-23 23:00:24 -07:00
parent 206054678b
commit 238621ee92
4 changed files with 30 additions and 5 deletions

View File

@ -268,6 +268,8 @@ class Admin extends \Zotlabs\Web\Controller {
check_form_security_token_redirectOnErr('/admin/site', 'admin_site'); check_form_security_token_redirectOnErr('/admin/site', 'admin_site');
$sitename = ((x($_POST,'sitename')) ? notags(trim($_POST['sitename'])) : ''); $sitename = ((x($_POST,'sitename')) ? notags(trim($_POST['sitename'])) : '');
$server_role = ((x($_POST,'server_role')) ? notags(trim($_POST['server_role'])) : 'standard');
$banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false); $banner = ((x($_POST,'banner')) ? trim($_POST['banner']) : false);
$admininfo = ((x($_POST,'admininfo')) ? trim($_POST['admininfo']) : false); $admininfo = ((x($_POST,'admininfo')) ? trim($_POST['admininfo']) : false);
$language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : ''); $language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : '');
@ -308,6 +310,8 @@ class Admin extends \Zotlabs\Web\Controller {
$feed_contacts = ((x($_POST,'feed_contacts')) ? intval($_POST['feed_contacts']) : 0); $feed_contacts = ((x($_POST,'feed_contacts')) ? intval($_POST['feed_contacts']) : 0);
$verify_email = ((x($_POST,'verify_email')) ? 1 : 0); $verify_email = ((x($_POST,'verify_email')) ? 1 : 0);
set_config('system', 'server_role', $server_role);
set_config('system', 'feed_contacts', $feed_contacts); set_config('system', 'feed_contacts', $feed_contacts);
set_config('system', 'delivery_interval', $delivery_interval); set_config('system', 'delivery_interval', $delivery_interval);
set_config('system', 'delivery_batch_count', $delivery_batch_count); set_config('system', 'delivery_batch_count', $delivery_batch_count);
@ -481,6 +485,12 @@ class Admin extends \Zotlabs\Web\Controller {
// now invert the logic for the setting. // now invert the logic for the setting.
$discover_tab = (1 - $discover_tab); $discover_tab = (1 - $discover_tab);
$server_roles = [
'basic' => t('Basic/Minimal Social Networking'),
'standard' => t('Standard Configuration (default)'),
'pro' => t('Professional')
];
$homelogin = get_config('system','login_on_homepage'); $homelogin = get_config('system','login_on_homepage');
$enable_context_help = get_config('system','enable_context_help'); $enable_context_help = get_config('system','enable_context_help');
@ -498,6 +508,9 @@ class Admin extends \Zotlabs\Web\Controller {
'$baseurl' => z_root(), '$baseurl' => z_root(),
// name, label, value, help string, extra data... // name, label, value, help string, extra data...
'$sitename' => array('sitename', t("Site name"), htmlspecialchars(get_config('system','sitename'), ENT_QUOTES, 'UTF-8'),''), '$sitename' => array('sitename', t("Site name"), htmlspecialchars(get_config('system','sitename'), ENT_QUOTES, 'UTF-8'),''),
'$server_role' => array('server_role', t("Server Configuration/Role"), get_config('system','server_role'),'',$server_roles),
'$banner' => array('banner', t("Banner/Logo"), $banner, ""), '$banner' => array('banner', t("Banner/Logo"), $banner, ""),
'$admininfo' => array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode can be used here")), '$admininfo' => array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode can be used here")),
'$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices), '$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices),

View File

@ -73,7 +73,9 @@ class Setup extends \Zotlabs\Web\Controller {
$phpath = trim($_POST['phpath']); $phpath = trim($_POST['phpath']);
$adminmail = trim($_POST['adminmail']); $adminmail = trim($_POST['adminmail']);
$siteurl = trim($_POST['siteurl']); $siteurl = trim($_POST['siteurl']);
$advanced = ((intval($_POST['advanced'])) ? 1 : 0); $server_role = trim($_POST['server_role']);
if(! $server_role)
$server_role = 'standard';
// $siteurl should not have a trailing slash // $siteurl should not have a trailing slash
@ -101,7 +103,9 @@ class Setup extends \Zotlabs\Web\Controller {
$timezone = notags(trim($_POST['timezone'])); $timezone = notags(trim($_POST['timezone']));
$adminmail = notags(trim($_POST['adminmail'])); $adminmail = notags(trim($_POST['adminmail']));
$siteurl = notags(trim($_POST['siteurl'])); $siteurl = notags(trim($_POST['siteurl']));
$advanced = ((intval($_POST['advanced'])) ? 'standard' : 'basic'); $server_role = notags(trim($_POST['server_role']));
if(! $server_role)
$server_role = 'standard';
if($siteurl != z_root()) { if($siteurl != z_root()) {
$test = z_fetch_url($siteurl."/setup/testrewrite"); $test = z_fetch_url($siteurl."/setup/testrewrite");
@ -130,7 +134,7 @@ class Setup extends \Zotlabs\Web\Controller {
'$dbpass' => $dbpass, '$dbpass' => $dbpass,
'$dbdata' => $dbdata, '$dbdata' => $dbdata,
'$dbtype' => $dbtype, '$dbtype' => $dbtype,
'$server_role' => $advanced, '$server_role' => $server_role,
'$timezone' => $timezone, '$timezone' => $timezone,
'$siteurl' => $siteurl, '$siteurl' => $siteurl,
'$site_id' => random_string(), '$site_id' => random_string(),
@ -327,6 +331,12 @@ class Setup extends \Zotlabs\Web\Controller {
$siteurl = notags(trim($_POST['siteurl'])); $siteurl = notags(trim($_POST['siteurl']));
$timezone = ((x($_POST,'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles'); $timezone = ((x($_POST,'timezone')) ? ($_POST['timezone']) : 'America/Los_Angeles');
$server_roles = [
'basic' => t('Basic/Minimal Social Networking'),
'standard' => t('Standard Configuration (default)'),
'pro' => t('Professional')
];
$tpl = get_markup_template('install_settings.tpl'); $tpl = get_markup_template('install_settings.tpl');
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$title' => $install_title, '$title' => $install_title,
@ -344,7 +354,8 @@ class Setup extends \Zotlabs\Web\Controller {
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')), '$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')),
'$siteurl' => array('siteurl', t('Website URL'), z_root(), t('Please use SSL (https) URL if available.')), '$siteurl' => array('siteurl', t('Website URL'), z_root(), t('Please use SSL (https) URL if available.')),
'$advanced' => array('advanced', t('Enable $Projectname <strong>advanced</strong> features?'), 1, t('Some advanced features, while useful - may be best suited for technically proficient audiences')),
'$server_role' => array('server_role', t("Server Configuration/Role"), 'standard','',$server_roles),
'$timezone' => array('timezone', t('Please select a default timezone for your website'), $timezone, '', get_timezones()), '$timezone' => array('timezone', t('Please select a default timezone for your website'), $timezone, '', get_timezones()),

View File

@ -41,6 +41,7 @@
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'> <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
{{include file="field_input.tpl" field=$sitename}} {{include file="field_input.tpl" field=$sitename}}
{{include file="field_select.tpl" field=$server_role}}
{{include file="field_textarea.tpl" field=$banner}} {{include file="field_textarea.tpl" field=$banner}}
{{include file="field_textarea.tpl" field=$admininfo}} {{include file="field_textarea.tpl" field=$admininfo}}
{{include file="field_select.tpl" field=$language}} {{include file="field_select.tpl" field=$language}}

View File

@ -19,7 +19,7 @@
{{include file="field_input.tpl" field=$adminmail}} {{include file="field_input.tpl" field=$adminmail}}
{{include file="field_input.tpl" field=$siteurl}} {{include file="field_input.tpl" field=$siteurl}}
{{include file="field_checkbox.tpl" field=$advanced}} {{include file="field_select.tpl" field=$server_role}}
{{include file="field_select_grouped.tpl" field=$timezone}} {{include file="field_select_grouped.tpl" field=$timezone}}