settings/features page to enable/disable software features

This commit is contained in:
friendica 2012-11-03 21:37:19 -07:00
parent a746eb751f
commit e5df0f9ce9
2 changed files with 43 additions and 0 deletions

View File

@ -38,6 +38,12 @@ function settings_init(&$a) {
'selected' => ((argv(1) === 'channel') ? 'active' : ''),
),
array(
'label' => t('Additional features'),
'url' => $a->get_baseurl(true).'/settings/features',
'selected' => ((argv(1) === 'features') ? 'active' : ''),
),
array(
'label' => t('Display settings'),
'url' => $a->get_baseurl(true).'/settings/display',
@ -163,6 +169,18 @@ function settings_post(&$a) {
return;
}
if((argc() > 1) && (argv(1) === 'features')) {
check_form_security_token_redirectOnErr('/settings/features', 'settings_features');
foreach($_POST as $k => $v) {
if(strpos($k,'feature_') === 0) {
set_pconfig(local_user(),'feature',substr($k,8),((intval($v)) ? 1 : 0));
}
}
return;
}
if((argc() > 1) && (argv(1) == 'connectors')) {
check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors');
@ -591,6 +609,30 @@ function settings_content(&$a) {
return $o;
}
if((argc() > 1) && (argv(1) === 'features')) {
$arr = array();
$features = get_features();
foreach($features as $f) {
$arr[] = array('feature_' .$f[0],$f[1],((intval(get_pconfig(local_user(),'feature',$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On')));
}
$tpl = get_markup_template("settings_features.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_features"),
'$title' => t('Additional Features'),
'$features' => $arr,
'$submit' => t('Submit')
));
return $o;
}
if((argc() > 1) && (argv(1) === 'connectors')) {
$settings_connectors = "";

View File

@ -3077,6 +3077,7 @@ aside input[type='text'] {
.field .onoff {
float: left;
width: 80px;
margin-right: 15px;
}
.field .onoff a {
display: block;