Code

Modified xml_to_array. Automatically create an array if tag is given more than once
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 23 Apr 2008 11:56:06 +0000 (11:56 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 23 Apr 2008 11:56:06 +0000 (11:56 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10645 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_gosaSupportDaemon.inc

index 828dd87fc8d43dc5c349ee0e4a07cc25705aea1c..3b847f8e2bda86dc1bdb1f3e30d492900965f3ae 100644 (file)
@@ -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");
           }