Another patch to put section data into an array instead in a string
separated by "<br />"


Le Fri, 20 Aug 2010 23:18:01 +0200
David DURIEUX <[email protected]> a écrit:

>Hello,
>
>I have made 3 modifications of structure (Patch 0001 to 0003) with
>using PHP CONSTANTS to use lib with external program with other
>folders, etc...
>
>
>For patch 0004, it's a patch when you use only one criteria (because
>it return an error but no error in this case)
>
>So now, we can use lib in GLPI ;)
>
>Enjoy ^^
>
>Best regards,
>
>David DURIEUX
>Tel : +33 (0)4.74.04.81.34
>Port : +33 (0)6.34.99.45.18
>Mail : [email protected]
>Site Web : http://www.siprossii.com/
>
>SIPROSSII
>847 route de Frans (Créacité)
>69400 Villefranche sur Saône
>FRANCE
>From a78351ed5038e04de3c78d204b6ef3f6f92766bc Mon Sep 17 00:00:00 2001
From: David Durieux <[email protected]>
Date: Sat, 21 Aug 2010 17:36:52 +0200
Subject: [PATCH] Add datas of section in an array instead in a variable separated with <br />

---
 Classes/Action/InventoryAction.class.php |    9 +++------
 Classes/FusionLibServer.class.php        |    2 +-
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/Classes/Action/InventoryAction.class.php b/Classes/Action/InventoryAction.class.php
index a2c88b0..92dc61e 100644
--- a/Classes/Action/InventoryAction.class.php
+++ b/Classes/Action/InventoryAction.class.php
@@ -161,19 +161,16 @@ class InventoryAction extends Action
                 DataFilter::filter($section);
             }
 
-
-            ob_start();
+            $sectionData = array();
             foreach ($section->children() as $data)
             {
-                echo $data->getName()." = ".$data."<br />";
+                $sectionData[$data->getName()] = (string)$data;
             }
-            $sectionData = ob_get_contents();
-            ob_end_clean();
 
             //sectionId initialization, we will affect id after hook createSection return value.
             array_push($xmlSections, (array(
             "sectionId" => 0,
-            "sectionHash" => md5($sectionData),
+            "sectionHash" => md5(extract($sectionData)),
             "sectionName" => $section->getName(),
             "sectionData" => $sectionData)));
         }
diff --git a/Classes/FusionLibServer.class.php b/Classes/FusionLibServer.class.php
index e7ddb6e..1db02e6 100644
--- a/Classes/FusionLibServer.class.php
+++ b/Classes/FusionLibServer.class.php
@@ -81,7 +81,7 @@ class FusionLibServer
 
     public function start()
     {
-       $simpleXMLObj = simplexml_load_string(@gzuncompress($GLOBALS["HTTP_RAW_POST_DATA"]));
+       $simpleXMLObj = simplexml_load_string(@gzuncompress($GLOBALS["HTTP_RAW_POST_DATA"],'SimpleXMLElement', LIBXML_NOCDATA));
         //$simpleXMLObj = simplexml_load_file(dirname(__FILE__) ."/../data/aofr.ocs");
 
         $log = new Logger();
-- 
1.7.1

_______________________________________________
Fusioninventory-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/fusioninventory-devel

Répondre à