Code

Updated class_plugin.inc
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 28 Oct 2008 13:44:16 +0000 (13:44 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 28 Oct 2008 13:44:16 +0000 (13:44 +0000)
-Fixed config attribute request for "SNAPSHOTBASE" in class plugin. use $config->get_cfg_value

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12789 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_plugin.inc

index 5c9dadf3703f26b2f566c0607aacc6e592ab856b..de802b12923ddae7d9294e8e239d5cbc81bc7adc 100644 (file)
@@ -1356,27 +1356,23 @@ class plugin
     $cfg= &$this->config->current;
 
     /* check if there are special server configurations for snapshots */
-
-    if(isset($cfg['SERVER']) && isset($cfg['SNAPSHOTURI']) && $cfg['SERVER'] == $cfg['SNAPSHOTURI']){
-      $ldap_to    = $ldap;
-    }elseif(isset($cfg['SNAPSHOTURI'])){
-      $server       = $cfg['SNAPSHOTURI'];
-      $user         = $cfg['SNAPSHOTADMINDN'];
-      $password     = $cfg['SNAPSHOTADMINPASSWORD'];
-      $snapldapbase = $cfg['SNAPSHOTBASE'];
-
-      $ldap_to      = new ldapMultiplexer(new LDAP($user,$password, $server));
-      $ldap_to -> cd ($snapldapbase);
+    if($this->config->get_cfg_value("snapshotURI") == ""){
+      $ldap_to      = $ldap;
+    }else{
+      $server         = $this->config->get_cfg_value("snapshotURI");
+      $user           = $this->config->get_cfg_value("snapshotAdminDn");
+      $password       = $this->config->get_cfg_value("snapshotAdminPassword");
+      $snapldapbase   = $this->config->get_cfg_value("snapshotBase");
+      $ldap_to        = new ldapMultiplexer(new LDAP($user,$password, $server));
+      $ldap_to -> cd($snapldapbase);
       if (!$ldap_to->success()){
         msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap_to->get_error(), $snapldapbase, "", get_class()));
       }
-    }else{
-      $ldap_to    = $ldap;
     }
 
     /* Prepare bases and some other infos */
     $base           = $this->config->current['BASE'];
-    $snap_base      = $cfg['SNAPSHOTBASE'];
+    $snap_base      = $this->config->get_cfg_value("snapshotBase");
     $base_of_object = preg_replace ('/^[^,]+,/i', '', $dn);
     $new_base       = preg_replace("/".normalizePreg($base)."$/","",$base_of_object).$snap_base;
     $tmp            = array(); 
@@ -1418,23 +1414,23 @@ class plugin
     $cfg= &$this->config->current;
 
     /* check if there are special server configurations for snapshots */
-    if(isset($cfg['SNAPSHOTURI'])){
-      $server       = $cfg['SNAPSHOTURI'];
-      $user         = $cfg['SNAPSHOTADMINDN'];
-      $password     = $cfg['SNAPSHOTADMINPASSWORD'];
-      $snapldapbase = $cfg['SNAPSHOTBASE'];
-      $ldap_to      = new ldapMultiplexer(new LDAP($user,$password, $server));
-      $ldap_to->cd ($snapldapbase);
+    if($this->config->get_cfg_value("snapshotURI") == ""){
+      $ldap_to      = $ldap;
+    }else{
+      $server         = $this->config->get_cfg_value("snapshotURI");
+      $user           = $this->config->get_cfg_value("snapshotAdminDn");
+      $password       = $this->config->get_cfg_value("snapshotAdminPassword");
+      $snapldapbase   = $this->config->get_cfg_value("snapshotBase");
+      $ldap_to        = new ldapMultiplexer(new LDAP($user,$password, $server));
+      $ldap_to -> cd($snapldapbase);
       if (!$ldap_to->success()){
         msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap_to->get_error(), $snapldapbase, "", get_class()));
       }
-    }else{
-      $ldap_to    = $ldap;
     }
 
     /* Prepare bases */ 
     $base           = $this->config->current['BASE'];
-    $snap_base      = $cfg['SNAPSHOTBASE'];
+    $snap_base      = $this->config->get_cfg_value("snapshotBase");
     $new_base       = preg_replace("/".normalizePreg($base)."$/","",$base_of_object).$snap_base;
 
     /* Fetch all objects and check if they do not exist anymore */
@@ -1484,18 +1480,18 @@ class plugin
     $cfg= &$this->config->current;
 
     /* check if there are special server configurations for snapshots */
-    if(isset($cfg['SNAPSHOTURI'])){
-      $server       = $cfg['SNAPSHOTURI'];
-      $user         = $cfg['SNAPSHOTADMINDN'];
-      $password     = $cfg['SNAPSHOTADMINPASSWORD'];
-      $snapldapbase = $cfg['SNAPSHOTBASE'];
-      $ldap_to      = new ldapMultiplexer(new LDAP($user,$password, $server));
-      $ldap_to->cd ($snapldapbase);
+    if($this->config->get_cfg_value("snapshotURI") == ""){
+      $ldap_to      = $ldap;
+    }else{
+      $server         = $this->config->get_cfg_value("snapshotURI");
+      $user           = $this->config->get_cfg_value("snapshotAdminDn");
+      $password       = $this->config->get_cfg_value("snapshotAdminPassword");
+      $snapldapbase   = $this->config->get_cfg_value("snapshotBase");
+      $ldap_to        = new ldapMultiplexer(new LDAP($user,$password, $server));
+      $ldap_to -> cd($snapldapbase);
       if (!$ldap_to->success()){
         msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap_to->get_error(), $snapldapbase, "", get_class()));
       }
-    }else{
-      $ldap_to    = $ldap;
     }
 
     /* Get the snapshot */