diff --git a/interface/web/dns/dns_soa_del.php b/interface/web/dns/dns_soa_del.php index de223fa970746e7031f42b5246a0a514577a8151..0a1944b5f2a55b110cb9fbebf1eb99c36cfe1cd4 100644 --- a/interface/web/dns/dns_soa_del.php +++ b/interface/web/dns/dns_soa_del.php @@ -45,7 +45,25 @@ require_once('../../lib/app.inc.php'); //* Check permissions for module $app->auth->check_module_permissions('dns'); -$app->uses("tform_actions"); -$app->tform_actions->onDelete(); +$app->uses('tpl,tform,tform_actions'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + + function onBeforeDelete() { + global $app; $conf; + + if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission')); + + // Delete all records that belog to this zone. + $records = $app->db->queryAllRecords("SELECT id FROM dns_rr WHERE zone = '".intval($this->id)."'"); + foreach($records as $rec) { + $app->db->datalogDelete('dns_rr','id',$rec['id']); + } + } +} + +$page = new page_action; +$page->onDelete(); ?> \ No newline at end of file diff --git a/interface/web/mail/mail_user_filter_edit.php b/interface/web/mail/mail_user_filter_edit.php index a4199880b46b778626b80a7bfef3aa4a5e603670..0256aa8c24e33646daa51fb45bcde1221513f83d 100644 --- a/interface/web/mail/mail_user_filter_edit.php +++ b/interface/web/mail/mail_user_filter_edit.php @@ -114,11 +114,12 @@ class page_action extends tform_actions { if($this->dataRecord["action"] == 'move') { $content .= " -`test -e ".'$DEFAULT/'.$this->dataRecord["target"]."` +`test -e ".'$DEFAULT/.'.$this->dataRecord["target"]."` if ( ".'$RETURNCODE'." != 0 ) { `maildirmake -f ".$this->dataRecord["target"].' $DEFAULT'."` `chmod -R 0700 ".'$DEFAULT/'.$this->dataRecord["target"]."` + `echo INBOX.".$this->dataRecord["target"]." >> ".'$MAILDIR'."/courierimapsubscribed` } "; } @@ -139,7 +140,7 @@ if ( ".'$RETURNCODE'." != 0 ) $content .= "exception {\n"; if($this->dataRecord["action"] == 'move') { - $content .= 'to $DEFAULT/'.$this->dataRecord["target"]."/\n"; + $content .= 'to $DEFAULT/.'.$this->dataRecord["target"]."/\n"; } else { $content .= "to /dev/null\n"; } diff --git a/interface/web/sites/web_domain_del.php b/interface/web/sites/web_domain_del.php index 46dd2b9c96efdef086c814b75facfcd5df1cfd0e..867d1f40ea12142ab9a5551b6b6a7ef0799ff4de 100644 --- a/interface/web/sites/web_domain_del.php +++ b/interface/web/sites/web_domain_del.php @@ -45,7 +45,37 @@ require_once('../../lib/app.inc.php'); //* Check permissions for module $app->auth->check_module_permissions('sites'); -$app->uses("tform_actions"); -$app->tform_actions->onDelete(); +$app->uses('tpl,tform,tform_actions'); +$app->load('tform_actions'); + +class page_action extends tform_actions { + + function onBeforeDelete() { + global $app; $conf; + + if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission')); + + // Delete all records that belog to this zone. + $records = $app->db->queryAllRecords("SELECT domain_id FROM web_domain WHERE parent_domain_id = '".intval($this->id)."' AND type != 'vhost'"); + foreach($records as $rec) { + $app->db->datalogDelete('web_domain','domain_id',$rec['domain_id']); + } + + // Delete all records that belog to this zone. + $records = $app->db->queryAllRecords("SELECT ftp_user_id FROM ftp_user WHERE parent_domain_id = '".intval($this->id)."'"); + foreach($records as $rec) { + $app->db->datalogDelete('ftp_user','ftp_user_id',$rec['ftp_user_id']); + } + + // Delete all records that belog to this zone. + $records = $app->db->queryAllRecords("SELECT shell_user_id FROM shell_user WHERE parent_domain_id = '".intval($this->id)."'"); + foreach($records as $rec) { + $app->db->datalogDelete('shell_user','shell_user_id',$rec['shell_user_id']); + } + } +} + +$page = new page_action; +$page->onDelete(); ?> \ No newline at end of file diff --git a/server/conf/autoresponder.master b/server/conf/autoresponder.master index d88f9de85bd71ed4ba66143a9f5b10d69f671fe8..ffb924a7fc24af57b6be455388ea4fcc63853a1e 100644 --- a/server/conf/autoresponder.master +++ b/server/conf/autoresponder.master @@ -1,8 +1,8 @@ -cc $DEFAULT +# cc $DEFAULT xfilter "reformail -r -t -I 'From: $LOGNAME'" /^To:.*/ getaddr{$MATCH}=~ /^.*/; -MATH=tolower${MATCH} +MATCH=tolower${MATCH} flock "{vmail_mailbox_base}/mailfilters/$HOST/$USER/.vacation.lock" { `fgrep -iqx "$MATCH" {vmail_mailbox_base}/mailfilters/$HOST/$USER/.vacation.lst 2>/dev/null || { \ echo "$MATCH" >> {vmail_mailbox_base}/mailfilters/$HOST/$USER/.vacation.lst ; \ @@ -11,4 +11,4 @@ flock "{vmail_mailbox_base}/mailfilters/$HOST/$USER/.vacation.lock" { } if ( $RETURNCODE == 0 ) exit -to "| (cat - ; echo ''; cat {vmail_mailbox_base}/mailfilters/$HOST/$USER/.vacation.msg) | $SENDMAIL -t" \ No newline at end of file +cc "| (cat - ; echo ''; cat {vmail_mailbox_base}/mailfilters/$HOST/$USER/.vacation.msg) | $SENDMAIL -t" \ No newline at end of file diff --git a/server/plugins-available/maildrop_plugin.inc.php b/server/plugins-available/maildrop_plugin.inc.php index 961088c4330bf1a7e57caa619d5e7a37ba2ca5ce..9216b1f8502db628e4c1bdf78be430be4c9637b0 100644 --- a/server/plugins-available/maildrop_plugin.inc.php +++ b/server/plugins-available/maildrop_plugin.inc.php @@ -67,67 +67,81 @@ class maildrop_plugin { // Check if the config directory exists. if(!is_dir($this->mailfilter_config_dir)) { - $app->log("Mailfilter config directory '".$this->mailfilter_config_dir."' does not exist.",LOGLEVEL_ERROR); + $app->log("Mailfilter config directory '".$this->mailfilter_config_dir."' does not exist. Creating it now.",LOGLEVEL_WARN); + mkdir($this->mailfilter_config_dir); + exec("chown vmail ".$this->mailfilter_config_dir); + exec("chmod 770 ".$this->mailfilter_config_dir); + } + + if(isset($data["new"]["email"])) { + $email_parts = explode("@",$data["new"]["email"]); } else { - // Check if something has been changed regarding the autoresponders - if($data["old"]["autoresponder_text"] != $data["new"]["autoresponder_text"] + $email_parts = explode("@",$data["old"]["email"]); + } + + // make sure that the config directories exist + if(!is_dir($this->mailfilter_config_dir.'/'.$email_parts[1])) { + mkdir($this->mailfilter_config_dir.'/'.$email_parts[1]); + exec("chown vmail ".$this->mailfilter_config_dir.'/'.$email_parts[1]); + exec("chmod 770 ".$this->mailfilter_config_dir.'/'.$email_parts[1]); + } + if(!is_dir($this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0])) { + mkdir($this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0]); + exec("chown vmail ".$this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0]); + exec("chmod 770 ".$this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0]); + } + + + // Check if something has been changed regarding the autoresponders + if($data["old"]["autoresponder_text"] != $data["new"]["autoresponder_text"] or $data["old"]["autoresponder"] != $data["new"]["autoresponder"] or (isset($data["new"]["email"]) and $data["old"]["email"] != $data["new"]["email"])) { - // We delete the old autoresponder, if it exists - $email_parts = explode("@",$data["old"]["email"]); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lock'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.msg'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN); - $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.autoresponder'; - if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN); + // We delete the old autoresponder, if it exists + $email_parts = explode("@",$data["old"]["email"]); + $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lock'; + if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN); + $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst'; + if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN); + $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.msg'; + if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN); + $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.autoresponder'; + if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN); - //Now we create the new autoresponder, if it is enabled - if($data["new"]["autoresponder"] == 'y') { - if(isset($data["new"]["email"])) { - $email_parts = explode("@",$data["new"]["email"]); - } else { - $email_parts = explode("@",$data["old"]["email"]); - } - - // make sure that the config directories exist - if(!is_dir($this->mailfilter_config_dir.'/'.$email_parts[1])) { - mkdir($this->mailfilter_config_dir.'/'.$email_parts[1]); - exec("chown vmail ".$this->mailfilter_config_dir.'/'.$email_parts[1]); - exec("chmod 400 ".$this->mailfilter_config_dir.'/'.$email_parts[1]); - } - if(!is_dir($this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0])) { - mkdir($this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0]); - exec("chown vmail ".$this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0]); - exec("chmod 400 ".$this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0]); - } + //Now we create the new autoresponder, if it is enabled + if($data["new"]["autoresponder"] == 'y') { + if(isset($data["new"]["email"])) { + $email_parts = explode("@",$data["new"]["email"]); + } else { + $email_parts = explode("@",$data["old"]["email"]); + } - // Load the master template - $tpl = file_get_contents($conf["rootpath"].'/conf/autoresponder.master'); - $tpl = str_replace('{vmail_mailbox_base}',$mail_config["homedir_path"],$tpl); - // Write the config file. - $config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.autoresponder'; - file_put_contents($config_file_path,$tpl); - $app->log("Writing Autoresponder mailfilter file: $config_file_path",LOGLEVEL_DEBUG); - exec("chmod 400 $config_file_path"); - exec("chown vmail $config_file_path"); - unset($tpl); - unset($config_file_path); + // Load the master template + $tpl = file_get_contents($conf["rootpath"].'/conf/autoresponder.master'); + $tpl = str_replace('{vmail_mailbox_base}',$mail_config["homedir_path"],$tpl); + // Write the config file. + $config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.autoresponder'; + file_put_contents($config_file_path,$tpl); + $app->log("Writing Autoresponder mailfilter file: $config_file_path",LOGLEVEL_DEBUG); + exec("chmod 770 $config_file_path"); + exec("chown vmail $config_file_path"); + unset($tpl); + unset($config_file_path); - // Write the autoresponder message file - $config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.msg'; - file_put_contents($config_file_path,$data["new"]["autoresponder_text"]); - exec("chmod 400 $config_file_path"); - exec("chown vmail $config_file_path"); - $app->log("Writing Autoresponder message file: $config_file_path",LOGLEVEL_DEBUG); - } + // Write the autoresponder message file + $config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.msg'; + file_put_contents($config_file_path,$data["new"]["autoresponder_text"]); + exec("chmod 770 $config_file_path"); + exec("chown vmail $config_file_path"); + $app->log("Writing Autoresponder message file: $config_file_path",LOGLEVEL_DEBUG); } + } + + $app->log("HERE",LOGLEVEL_DEBUG); // Write the custom mailfilter script, if mailfilter recipe has changed if($data["old"]["custom_mailfilter"] != $data["new"]["custom_mailfilter"]) { + $app->log("Mailfilter config has been changed",LOGLEVEL_DEBUG); if(trim($data["new"]["custom_mailfilter"]) != '') { // Delete the old filter recipe $email_parts = explode("@",$data["old"]["email"]); @@ -142,7 +156,8 @@ class maildrop_plugin { } $config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter'; file_put_contents($config_file_path,$data["new"]["custom_mailfilter"]); - exec("chmod 400 $config_file_path"); + $app->log("Writing new custom Mailfiter".$config_file_path,LOGLEVEL_DEBUG); + exec("chmod 770 $config_file_path"); exec("chown vmail $config_file_path"); unset($config_file_path); } else { @@ -150,8 +165,9 @@ class maildrop_plugin { $email_parts = explode("@",$data["old"]["email"]); $file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter'; if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN); + $app->log("Deleting custom Mailfiter".$file,LOGLEVEL_DEBUG); } - } + //} } }