From: hickert Date: Wed, 23 Apr 2008 11:56:06 +0000 (+0000) Subject: Modified xml_to_array. Automatically create an array if tag is given more than once X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d3beeb5096f5eaf83bd27ebc7ee67f986d451b18;p=gosa.git Modified xml_to_array. Automatically create an array if tag is given more than once git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10645 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_gosaSupportDaemon.inc b/gosa-core/include/class_gosaSupportDaemon.inc index 828dd87fc..3b847f8e2 100644 --- a/gosa-core/include/class_gosaSupportDaemon.inc +++ b/gosa-core/include/class_gosaSupportDaemon.inc @@ -819,13 +819,21 @@ class gosaSupportDaemon } if ($xml_elem['type'] == 'complete') { $start_level = 1; - $php_stmt = '$params'; + $test2 = &$params; while($start_level < $xml_elem['level']) { - $php_stmt .= '[$level['.$start_level.']]'; + $test2 = &$test2[$level[$start_level]]; $start_level++; } - $php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];'; - @eval($php_stmt); + if(!isset($test2[$xml_elem['tag']])){ + if(isset($xml_elem['value'])){ + $test2[$xml_elem['tag']] = $xml_elem['value']; + } + }else{ + if(!is_array($test2[$xml_elem['tag']])){ + $test2[$xml_elem['tag']] = array($test2[$xml_elem['tag']]); + } + $test2[$xml_elem['tag']][] = $xml_elem['value']; + } } } } @@ -1073,6 +1081,9 @@ class gosaSupportDaemon if(isset($entries['XML']['ERROR_STRING'])) { $this->set_error($entries['XML']['ERROR_STRING']); new log("debug","DaemonEvent (IDS) ", "gosaSupportDaemon::_send()", array($data=>$data),"FAILED ".$this->get_error()); + }elseif(isset($entries['XML']['ERROR'])){ + $this->set_error($entries['XML']['ERROR']); + new log("debug","DaemonEvent (IDS) ", "gosaSupportDaemon::_send()", array($data=>$data),"FAILED ".$this->get_error()); }else{ new log("debug","DaemonEvent (IDS) ", "gosaSupportDaemon::_send()", array($data=>$data),"SUCCESS"); }