Code

Removed jpgraph | qpl license doesn't match our needs
[gosa.git] / gosa-core / include / class_config.inc
index 7001880bfbefa983323db212d13d8e022c28900a..7c9fe51fc80b69af961f9acfb0e5f8ccd9589073 100644 (file)
@@ -64,6 +64,8 @@ class config  {
     var $filename = "";
     var $last_modified = 0;
 
+    var $gosaUUID = "";
+
     private $jsonRPChandle = NULL; 
 
     public $configRegistry = NULL;
@@ -79,6 +81,8 @@ class config  {
         $this->parser = xml_parser_create();
         $this->basedir= $basedir;
 
+        $this->gosaUUID = uniqid();
+
         xml_set_object($this->parser, $this);
         xml_set_element_handler($this->parser, "tag_open", "tag_close");
 
@@ -92,6 +96,12 @@ class config  {
     }
 
 
+    function getGOsaUUID()
+    {
+        return($this->gosaUUID);
+    }    
+
+
     /*! \brief Check and reload the configuration
      * 
      * This function checks if the configuration has changed, since it was
@@ -304,13 +314,19 @@ class config  {
     }
 
 
-    function getRpcHandle()
+    function getRpcHandle($connectUrl="", $username="", $userPassword="", $authModeDigest=FALSE)
     {
+        // Get conenct information, if no info was given use the default values from gosa.conf
+        $connectUrl   = (!empty($connectUrl))   ? $connectUrl   : $this->get_cfg_value('core','gosaRpcServer');
+        $username     = (!empty($username))     ? $username     : $this->get_cfg_value('core','gosaRpcUser');
+        $userPassword = (!empty($userPassword)) ? $userPassword : $this->get_cfg_value('core','gosaRpcPassword');
+        $authModeDigest = $authModeDigest;
+
         // Create jsonRPC handle on demand.
-        if(!$this->jsonRPChandle){
-            $this->jsonRPChandle = new jsonRPC($this);
+        if(!isset($this->jsonRPChandle[$connectUrl][$username]) || !$this->jsonRPChandle[$connectUrl][$username]){
+            $this->jsonRPChandle[$connectUrl][$username] = new jsonRPC($this, $connectUrl, $username, $userPassword, $authModeDigest);
         }
-        return($this->jsonRPChandle);
+        return($this->jsonRPChandle[$connectUrl][$username]);
     }