From e930ee68f13a9979dbe131684deffd4a5008971f Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 22 Mar 2016 21:11:47 -0700 Subject: [PATCH] PDO Fix for saving of e107::serialize() data. Saving of Extended Field data now working correctly. --- e107_admin/users.php | 6 +++--- e107_handlers/core_functions.php | 5 +++++ e107_handlers/form_handler.php | 5 ++++- e107_handlers/mysql_class.php | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/e107_admin/users.php b/e107_admin/users.php index 6b2b86fb4..fcbd4d74d 100644 --- a/e107_admin/users.php +++ b/e107_admin/users.php @@ -495,16 +495,16 @@ class users_admin_ui extends e_admin_ui } - function saveExtended($new_data) { $update = array(); + $fieldtype = array(); foreach($this->extended as $key) // Grab Extended field data. { - $update[$key] = vartrue($new_data['ue'][$key],'_NULL_'); + $update['data'][$key] = vartrue($new_data['ue'][$key],'_NULL_'); } - e107::getMessage()->addDebug(print_a($update,true)); + e107::getUserExt()->addFieldTypes($update); if(!empty($update)) { diff --git a/e107_handlers/core_functions.php b/e107_handlers/core_functions.php index f126db7e8..bbbc08932 100644 --- a/e107_handlers/core_functions.php +++ b/e107_handlers/core_functions.php @@ -447,8 +447,13 @@ class e_array { $ArrayData = stripslashes($ArrayData); } + $ArrayData = str_replace('=>','=>',$ArrayData); //FIX for PDO encoding of strings. . + + $data = ""; $ArrayData = '$data = '.$ArrayData.';'; + + @eval($ArrayData); if (!isset($data) || !is_array($data)) { diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index df5deae24..a66bbf1d8 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -1522,7 +1522,8 @@ class e_form elseif(!empty($options['useLabelValues'])) { $key = $label; - $c = in_array($label, $checked) ? true : false; + //print_a($label); + $c = in_array($label, e107::getParser()->toDB($checked)) ? true : false; } else { @@ -1535,6 +1536,8 @@ class e_form $text .= $this->checkbox($cname, $key, $c, $label); } + // return print_a($checked,true); + if(!empty($text)) { return "
".$text."
"; diff --git a/e107_handlers/mysql_class.php b/e107_handlers/mysql_class.php index 604234f63..12f899de1 100644 --- a/e107_handlers/mysql_class.php +++ b/e107_handlers/mysql_class.php @@ -1224,7 +1224,7 @@ class e_db_mysql case 'array': if(is_array($fieldValue)) { - return e107::serialize($fieldValue, true); + return e107::serialize($fieldValue); } return $fieldValue; break;