diff options
author | Mario Vavti <mario@mariovavti.com> | 2018-03-05 08:54:46 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2018-03-05 08:54:46 +0100 |
commit | a0e390c6c89c4009fc2a29ffbefabb0a135d67cf (patch) | |
tree | 64993f75fabca35b86cdc7f6496de32cc71265cd /Zotlabs/Module/Admin/Profs.php | |
parent | fd7d3f9286b1a399db074a78cdc63ab1f0b05686 (diff) | |
parent | 59a2057fa0faac2db7b36a5d6c40435c6e13d378 (diff) | |
download | volse-hubzilla-a0e390c6c89c4009fc2a29ffbefabb0a135d67cf.tar.gz volse-hubzilla-a0e390c6c89c4009fc2a29ffbefabb0a135d67cf.tar.bz2 volse-hubzilla-a0e390c6c89c4009fc2a29ffbefabb0a135d67cf.zip |
Merge remote-tracking branch 'mike/master' into dev
Diffstat (limited to 'Zotlabs/Module/Admin/Profs.php')
-rw-r--r-- | Zotlabs/Module/Admin/Profs.php | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/Zotlabs/Module/Admin/Profs.php b/Zotlabs/Module/Admin/Profs.php index b3da09cb7..eb2501d43 100644 --- a/Zotlabs/Module/Admin/Profs.php +++ b/Zotlabs/Module/Admin/Profs.php @@ -9,17 +9,37 @@ class Profs { if(array_key_exists('basic',$_REQUEST)) { $arr = explode(',',$_REQUEST['basic']); - for($x = 0; $x < count($arr); $x ++) - if(trim($arr[$x])) - $arr[$x] = trim($arr[$x]); - set_config('system','profile_fields_basic',$arr); - + array_walk($arr,'array_trim'); + $narr = []; + if(count($arr)) { + foreach($arr as $a) { + if(strlen($a)) { + $narr[] = $a; + } + } + } + if(! $narr) + del_config('system','profile_fields_basic'); + else + set_config('system','profile_fields_basic',$narr); + + if(array_key_exists('advanced',$_REQUEST)) { $arr = explode(',',$_REQUEST['advanced']); - for($x = 0; $x < count($arr); $x ++) - if(trim($arr[$x])) - $arr[$x] = trim($arr[$x]); - set_config('system','profile_fields_advanced',$arr); + array_walk($arr,'array_trim'); + $narr = []; + if(count($arr)) { + foreach($arr as $a) { + if(strlen($a)) { + $narr[] = $a; + } + } + } + if(! $narr) + del_config('system','profile_fields_advanced'); + else + set_config('system','profile_fields_advanced',$narr); + } goaway(z_root() . '/admin/profs'); } @@ -98,6 +118,7 @@ class Profs { $basic = ''; $barr = array(); $fields = get_profile_fields_basic(); + if(! $fields) $fields = get_profile_fields_basic(1); if($fields) { |