Code

Store currently selcted base in session
[gosa.git] / gosa-core / include / class_gosaSupportDaemon.inc
index 6c1fd89606671a616dc39c4530530dd6dc79b116..44d05cfe0d0e0e9628474e76c7c2b1a4cf4614d0 100644 (file)
@@ -46,13 +46,18 @@ class gosaSupportDaemon
     #FIXME: bad idea about referencing global variables from within classes
     global $config;
 
+    /* This should only be the case if we call this from setup.
+        __autoload() 
+     */
+    if(!is_object($config)) { return; }
+
     # load from config, store statically
-    if (isset($config->current['GOSA_SI'])){
+    if ($config->get_cfg_value("gosa_si") != ""){
 
       if ($this->s_host == ""){
-        $this->s_host= preg_replace("/^.*@([^:]+):.*$/", "$1", $config->current['GOSA_SI']);
-        $this->i_port= preg_replace("/^.*@[^:]+:(.*)$/", "$1", $config->current['GOSA_SI']);
-        $this->s_encryption_key = preg_replace("/^(.*)@[^:]+:.*$/", "$1", $config->current['GOSA_SI']);
+        $this->s_host= preg_replace("/^.*@([^:]+):.*$/", "$1", $config->get_cfg_value("gosa_si"));
+        $this->i_port= preg_replace("/^.*@[^:]+:(.*)$/", "$1", $config->get_cfg_value("gosa_si"));
+        $this->s_encryption_key = preg_replace("/^(.*)@[^:]+:.*$/", "$1", $config->get_cfg_value("gosa_si"));
       }
 
       $this->f_timeout = $timeout;
@@ -84,6 +89,16 @@ class gosaSupportDaemon
     return($this->is_connected);
   }
 
+  
+  /*! \brief  Returns TRUE whether we are connected or not 
+      @return BOOLEAN  Returns TRUE when connected else FALSE
+   */
+  public function is_connected()
+  {
+    return($this->is_connected);
+  }
+  
+
 
   /*! \brief  Disconnect from gosa daemon.
    */