From 6e598c94306895ee3065de24371e44b88d09e290 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 14 Feb 2015 12:22:07 -0800 Subject: [PATCH] Admin-UI: Make sure data is returned as an array when stored as one. Attention: @SecretR --- e107_handlers/form_handler.php | 46 +++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index f8f7f246a..f22802a87 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -1103,8 +1103,8 @@ class e_form return $text; } else - { - return "".$text.$gen."".vartrue($addon); + { + return "".$text.$gen."".vartrue($addon); } } @@ -1679,15 +1679,15 @@ class e_form { switch ($type) - { - case 'checkbox': - return e107::getUserClass()->uc_checkboxes($name,$curval,$options,null,true); - break; + { + case 'checkbox': + return e107::getUserClass()->uc_checkboxes($name,$curval,$options,null,true); + break; - case 'dropdown': - default: - return e107::getUserClass()->uc_dropdown($name,$curval,$options); - break; + case 'dropdown': + default: + return e107::getUserClass()->uc_dropdown($name,$curval,$options); + break; } } @@ -3418,6 +3418,12 @@ class e_form case 'method': // Custom Function $method = $attributes['field']; // prevents table alias in method names. ie. u.my_method. $_value = $value; + + if($attributes['data'] == 'array') // FIXME @SecretR - please move this to where it should be. + { + $value = e107::unserialize($value); // (saved as array, return it as an array) + } + $value = call_user_func_array(array($this, $method), array($value, 'read', $parms)); // print_a($attributes); @@ -3432,9 +3438,9 @@ class e_form { switch ($attributes['inline']) { - - case 'checklist': - $xtype = 'checklist'; + + case 'checklist': + $xtype = 'checklist'; break; case 'select': @@ -3443,13 +3449,13 @@ class e_form case 'textarea': $xtype = 'textarea'; - break; + break; - - default: + + default: $xtype = 'text'; - $methodParms = null; - break; + $methodParms = null; + break; } } @@ -3643,8 +3649,8 @@ class e_form $ret = vartrue($parms['pre']).$this->password($key, $value, $maxlength, $parms).vartrue($parms['post']); } else - { - $ret = vartrue($parms['pre']).$this->text($key, $value, $maxlength, $parms).vartrue($parms['post']); // vartrue($parms['__options']) is limited. See 'required'=>true + { + $ret = vartrue($parms['pre']).$this->text($key, $value, $maxlength, $parms).vartrue($parms['post']); // vartrue($parms['__options']) is limited. See 'required'=>true } break;