PlFilterOrder is an abstract class, put a default implementation for
[platal.git] / classes / xmlrpcclient.php
index cbcae3c..c359730 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2007 Polytechnique.org                              *
+ *  Copyright (C) 2003-2010 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -32,6 +32,7 @@ class XmlrpcClient
 {
     private $url;
     private $urlparts;
+    public $bt = null;
 
     public function __construct($url)
     {
@@ -99,8 +100,21 @@ class XmlrpcClient
     public function __call($method, $args)
     {
         $query  = xmlrpc_encode_request($method, $args);
+        if ($this->bt) {
+            $this->bt->start($method . "\n" . var_export($args, true));
+        }
         $answer = $this->http_post($query, $this->urlparts);
+        if ($this->bt) {
+            $this->bt->stop();
+        }
         $result = $this->find_and_decode_xml($answer);
+        if ($this->bt) {
+            if (is_array($result) && isset($result['faultCode'])) {
+                $this->bt->update(0, $result['faultString']);
+            } else {
+                $this->bt->update(count($result));
+            }
+        }
 
         if (is_array($result) && isset($result['faultCode'])) {
             trigger_error("Error in xmlrpc call $function\n".
@@ -112,5 +126,5 @@ class XmlrpcClient
     }
 }
 
-// vim:set et sw=4 sts=4 sws=4:
+// vim:set et sw=4 sts=4 sws=4 enc=utf-8:
 ?>