From 8ae0dded1967f459bb826ae8c2f8dd0ba4e21c79 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 28 Oct 2008 13:44:16 +0000 Subject: [PATCH] Updated class_plugin.inc -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 | 62 ++++++++++++++---------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index 5c9dadf37..de802b129 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -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 */ -- 2.30.2