ftimme
2013-01-23 7c7d9f375e91f33fc84dd4f41cf293e7d3ec4e7b
interface/web/mail/mail_domain_del.php
@@ -60,7 +60,7 @@
      // we will delete all depending records.
      
      // Delete all forwardings where the osurce or destination belongs to this domain
      $records = $app->db->queryAllRecords("SELECT forwarding_id as id FROM mail_forwarding WHERE source like '%@".$app->db->quote($domain)."' OR destination like '%@".$app->db->quote($domain)."'");
      $records = $app->db->queryAllRecords("SELECT forwarding_id as id FROM mail_forwarding WHERE source like '%@".$app->db->quote($domain)."' OR (destination like '%@".$app->db->quote($domain)."' AND type != 'forward'");
      foreach($records as $rec) {
         $app->db->datalogDelete('mail_forwarding','forwarding_id',$rec['id']);
      }
@@ -78,11 +78,17 @@
      }
      
      // Delete all spamfilters that belong to this domain
      $records = $app->db->queryAllRecords("SELECT id FROM spamfilter_users WHERE email = '@".$app->db->quote($domain)."'");
      $records = $app->db->queryAllRecords("SELECT id FROM spamfilter_users WHERE email = '%@".$app->db->quote($domain)."'");
      foreach($records as $rec) {
         $app->db->datalogDelete('spamfilter_users','id',$rec['id']);
      }
      
      // Delete all mailinglists that belong to this domain
      $records = $app->db->queryAllRecords("SELECT mailinglist_id FROM mail_mailinglist WHERE domain = '".$app->db->quote($domain)."'");
      foreach($records as $rec) {
         $app->db->datalogDelete('mail_mailinglist','mailinglist_id',$rec['id']);
      }
   }
}