X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_servDB.inc;h=1275580057ad572b3f278fbbe740a87c4e8fa361;hb=7f51b7c557fe5fb3c73b5bde15856fbfdb08efbb;hp=230407daf24872e885e9f8c001e9976fd40494e5;hpb=9d1120eb982fa5100e9a6a1c9292e5a1dcb9f8a2;p=gosa.git diff --git a/plugins/admin/systems/class_servDB.inc b/plugins/admin/systems/class_servDB.inc index 230407daf..127558005 100644 --- a/plugins/admin/systems/class_servDB.inc +++ b/plugins/admin/systems/class_servDB.inc @@ -27,13 +27,17 @@ class servdb extends plugin var $goFonAreaCode= ""; var $goFonCountryCode= ""; var $ignore_account= TRUE; + var $goGlpiAdmin=""; + var $goGlpiDatabase = ""; + var $goGlpiPassword =""; + /* attribute list for save action */ var $attributes= array("goImapName", "goImapConnect", "goImapAdmin", "goImapPassword", "goImapSieveServer", "goImapSievePort", "goKrbRealm", "goKrbAdmin", "goKrbPassword", "goFaxAdmin", "goFaxPassword", "goLogAdmin", "goLogPassword", "goFonAdmin", "goFonPassword", - "goFonAreaCode", "goFonCountryCode"); + "goFonAreaCode", "goFonCountryCode","goGlpiAdmin","goGlpiDatabase","goGlpiPassword"); var $objectclasses= array("top", "goServer"); var $additionaloc= array("goImapServer" => array("goImapName", "goImapConnect", "goImapAdmin", "goImapPassword", @@ -43,12 +47,13 @@ class servdb extends plugin "goKrbPassword"), "goFaxServer" => array("goFaxAdmin", "goFaxPassword"), "goLogDBServer" => array("goLogAdmin", "goLogPassword"), + "goGlpiServer" => array("goGlpiAdmin","goGlpiDatabase","goGlpiPassword"), "goFonServer" => array("goFonAdmin", "goFonPassword", "goFonAreaCode", "goFonCountryCode")); - function servdb ($config, $dn= NULL) + function servdb ($config, $dn= NULL, $parent= NULL) { - plugin::plugin ($config, $dn); + plugin::plugin ($config, $dn, $parent); /* Make dynamic list of objectClasses */ foreach ($this->additionaloc as $oc => $dummy){ @@ -66,6 +71,9 @@ class servdb extends plugin function execute() { + /* Call parent execute */ + plugin::execute(); + /* Fill templating stuff */ $smarty= get_smarty(); @@ -75,9 +83,6 @@ class servdb extends plugin $smarty->assign("$attr"."ACL", chkacl($this->acl, $attr)); } - /* Don't show Asterisk for non-required attribute ipHostNumber and macAddress */ - $smarty->assign("staticAddress", ""); - /* Classes... */ foreach ($this->additionaloc as $oc => $dummy){ if (isset($this->objectclasses[$oc])){ @@ -122,7 +127,16 @@ class servdb extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + + if(in_array("goGlpiServer",$this->objectclasses)){ + foreach(array("goGlpiAdmin","goGlpiDatabase") as $attr){ + if(empty($this->$attr)){ + $message[]= sprintf(_("The attribute '%s' is empty or contains invalid characters."), $attr); + } + } + } /* All fields are marked as *must* */ if (in_array("goImapServer", $this->objectclasses)){ @@ -132,6 +146,7 @@ class servdb extends plugin } } + /* Check connect string */ if (!preg_match('/^\{[^:]+:[0-9]+.*\}$/', $this->goImapConnect)){ $message[]= sprintf(_("The imap connect string needs to be in the form '%s'."), @@ -189,11 +204,12 @@ class servdb extends plugin foreach($this->objectclasses as $oc){ $objectclasses[]= $oc; } - + + /* Move cn to sieve server */ + $this->goImapSieveServer= $this->cn; + plugin::save(); - - $test = $this->objectclasses; $tmp = array_flip($this->attrs['objectClass']); @@ -223,13 +239,15 @@ class servdb extends plugin /* Write to LDAP */ $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); - $ldap->modify($this->attrs); - show_ldap_error($ldap->get_error()); + $this->cleanup(); + $ldap->modify ($this->attrs); + + show_ldap_error($ldap->get_error(), _("Saving server db settings failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ if ($this->is_modified){ - $this->handle_post_events("mofify"); + $this->handle_post_events("modify"); } } else { $this->handle_post_events("add");