Code

More speed optimizations
[gosa.git] / plugins / admin / systems / class_goSpamServer.inc
index b0a61d6fa767b712a9ea431aa099eb815f82488c..1d47712203a724b0c2a3380daa0d805a23dc0923 100644 (file)
@@ -40,10 +40,10 @@ class gospamserver extends plugin{
   var $ui               = NULL;
   var $acl              = NULL;
 
-  function gospamserver($config,$dn)
+  function gospamserver($config,$dn, $parent= NULL)
   {
     /* Init class */
-    plugin::plugin($config,$dn);
+    plugin::plugin($config,$dn, $parent);
     $this->DisplayName = _("Spamassassin");
 
     /* Get userinfo & acls */
@@ -227,7 +227,11 @@ class gospamserver extends plugin{
   function AddTrust($post)
   {
     if(!empty($post)){
-      $this->TrustedNetworks[$post] = $post;
+      if(is_ip($post) || is_domain($post) || (is_ip_with_subnetmask($post))){
+        $this->TrustedNetworks[$post] = $post;
+      }else{
+        print_red(_("Specified value is not a valid 'trusted network' value."));
+      }
     }
   }
 
@@ -246,9 +250,17 @@ class gospamserver extends plugin{
   /* remove this extension */
   function remove_from_parent()
   {
+
     if(!$this->is_account && $this->initially_was_account){
+
       plugin::remove_from_parent();
 
+      /* Remove status flag, it is not a memeber of
+         this->attributes, so ensure that it is deleted too */
+      if(!empty($this->StatusFlag)){
+        $this->attrs[$this->StatusFlag] = array();
+      }
+
       /* Check if this is a new entry ... add/modify */
       $ldap = $this->config->get_ldap_link();
       $ldap->cat($this->dn,array("objectClass"));
@@ -271,7 +283,7 @@ class gospamserver extends plugin{
     plugin::save();
 
     /* Create Flags */     
-    $this->attrs['saFlags'] = "";
+    $this->attrs['saFlags'] = array();
     foreach($this->Flags as $flag){
       $var = "saFlags".$flag;
       if($this->$var){