aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorStefan Parviainen <saparvia@caterva.eu>2015-01-01 10:08:20 +0100
committerStefan Parviainen <saparvia@caterva.eu>2015-01-01 10:08:20 +0100
commit70f0019905f8c44ed875379a9af65988e536b4f4 (patch)
tree7470fc4ee3199c585be3e9e023a135eda8e34b02 /mod
parent26069e6ca189533152c825a96755f7ef31cb28a8 (diff)
downloadvolse-hubzilla-70f0019905f8c44ed875379a9af65988e536b4f4.tar.gz
volse-hubzilla-70f0019905f8c44ed875379a9af65988e536b4f4.tar.bz2
volse-hubzilla-70f0019905f8c44ed875379a9af65988e536b4f4.zip
Checkboxify yesno-fields, but use CSS to show them as switches in Redbasic
Diffstat (limited to 'mod')
-rw-r--r--mod/profiles.php13
-rw-r--r--mod/settings.php20
2 files changed, 20 insertions, 13 deletions
diff --git a/mod/profiles.php b/mod/profiles.php
index f2695f332..6bdc7f11a 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -596,13 +596,12 @@ function profiles_content(&$a) {
$opt_tpl = get_markup_template("profile_hide_friends.tpl");
- $hide_friends = replace_macros($opt_tpl,array(
- '$desc' => t('Hide your contact/friend list from viewers of this profile?'),
- '$yes_str' => t('Yes'),
- '$no_str' => t('No'),
- '$yes_selected' => (($r[0]['hide_friends']) ? " checked=\"checked\" " : ""),
- '$no_selected' => (($r[0]['hide_friends'] == 0) ? " checked=\"checked\" " : "")
- ));
+ $hide_friends = replace_macros($opt_tpl,array('$field' => array(
+ 'hide-friends',
+ t('Hide your contact/friend list from viewers of this profile?'),
+ $r[0]['hide_friends'],
+ '',
+ )));
$q = q("select * from profdef where true");
if($q) {
diff --git a/mod/settings.php b/mod/settings.php
index be6f2cfb9..bb1ec8cb8 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -122,10 +122,19 @@ function settings_post(&$a) {
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));
- }
+
+ // Build list of features and check which are set
+ $features = get_features();
+ $all_features = array();
+ foreach($features as $k => $v) {
+ foreach($v as $f)
+ $all_features[] = $f[0];
+ }
+ foreach($all_features as $k) {
+ if(x($_POST,"feature_$k"))
+ set_pconfig(local_user(),'feature',$k, 1);
+ else
+ set_pconfig(local_user(),'feature',$k, 0);
}
build_sync_packet();
return;
@@ -707,7 +716,6 @@ function settings_content(&$a) {
'$title' => t('Additional Features'),
'$features' => $arr,
'$submit' => t('Submit'),
- '$field_yesno' => 'field_yesno.tpl',
));
return $o;
@@ -938,7 +946,7 @@ function settings_content(&$a) {
$timezone = date_default_timezone_get();
- $opt_tpl = get_markup_template("field_yesno.tpl");
+ $opt_tpl = get_markup_template("field_checkbox.tpl");
if(get_config('system','publish_all')) {
$profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
}