From 0c1bbbd5c8619927832d15c2aa2441d9a5608fec Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 17 Dec 2017 08:49:17 -0800 Subject: [PATCH] Fix for importing/exporting polls and ratings which use chr(1) --- e107_handlers/xml_class.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/e107_handlers/xml_class.php b/e107_handlers/xml_class.php index b93e2eb71..56ca1ec4c 100644 --- a/e107_handlers/xml_class.php +++ b/e107_handlers/xml_class.php @@ -834,7 +834,7 @@ class xmlClass * @param string $key key for the current value. Used for exception processing. * @return mixed */ - private function e107ExportValue($val, $key = '') + public function e107ExportValue($val, $key = '') { if($key && isset($this->filePathPrepend[$key])) { @@ -860,6 +860,10 @@ class xmlClass return ""; } + + + $val = str_replace(chr(1),'{\u0001}',$val); + return $val; } @@ -1093,7 +1097,7 @@ class xmlClass { //$message = print_r($xmlArray); echo "
".var_export($xmlArray,TRUE)."
"; - return; + return null; } $ret = array(); @@ -1179,7 +1183,7 @@ class xmlClass foreach($item['field'] as $f) { $fieldkey = $f['@attributes']['name']; - $fieldval = (isset($f['@value'])) ? $f['@value'] : ""; + $fieldval = (isset($f['@value'])) ? $this->e107ImportValue($f['@value']) : ""; $insert_array[$fieldkey] = $fieldval; @@ -1212,6 +1216,14 @@ class xmlClass } + function e107ImportValue($val) + { + $val = str_replace('{\u0001}', chr(1), $val); + + return $val; + } + + function getErrors($xml) { libxml_use_internal_errors(true);