Marius Burkard
2016-07-01 49441bdd0f3ff75d5092d5b832b97ea722a66363
server/plugins-available/maildrop_plugin.inc.php
@@ -137,10 +137,14 @@
            }
            // Load the master template
            $tpl = file_get_contents($conf["rootpath"].'/conf/autoresponder.master');
            if(file_exists($conf["rootpath"].'/conf-custom/autoresponder.master')) {
               $tpl = file_get_contents($conf["rootpath"].'/conf-custom/autoresponder.master');
            } else {
               $tpl = file_get_contents($conf["rootpath"].'/conf/autoresponder.master');
            }
            $tpl = str_replace('{vmail_mailbox_base}', $mail_config["homedir_path"], $tpl);
            if ($data["new"]["autoresponder_start_date"] != '0000-00-00 00:00:00') { // Dates have been set
            if ($data['new']['autoresponder_start_date'] && $data["new"]["autoresponder_start_date"] != '0000-00-00 00:00:00') { // Dates have been set
               $tpl = str_replace('{start_date}', strtotime($data["new"]["autoresponder_start_date"]), $tpl);
               $tpl = str_replace('{end_date}', strtotime($data["new"]["autoresponder_end_date"]), $tpl);
            } else {
@@ -192,14 +196,22 @@
            $mailfilter_content = '';
            if($data["new"]["cc"] != '') {
               $mailfilter_content .= "cc \"!".$data["new"]["cc"]."\"\n";
               $tmp_mails_arr = explode(',',$data["new"]["cc"]);
               foreach($tmp_mails_arr as $address) {
                  if(trim($address) != '') $mailfilter_content .= "cc \"!".trim($address)."\"\n";
               }
               //$mailfilter_content .= "cc \"!".$data["new"]["cc"]."\"\n";
               $app->log("Added CC address ".$data["new"]["cc"].' to mailfilter file.', LOGLEVEL_DEBUG);
            }
            if($data["new"]["move_junk"] == 'y') {
               $mailfilter_content .= file_get_contents($conf["rootpath"].'/conf/mailfilter_move_junk.master')."\n";
               if(file_exists($conf["rootpath"].'/conf-custom/mailfilter_move_junk.master')) {
                  $mailfilter_content .= file_get_contents($conf["rootpath"].'/conf-custom/mailfilter_move_junk.master')."\n";
               } else {
                  $mailfilter_content .= file_get_contents($conf["rootpath"].'/conf/mailfilter_move_junk.master')."\n";
               }
            }
            $mailfilter_content .= $data["new"]["custom_mailfilter"];
            $mailfilter_content .= str_replace("\r\n","\n",$data["new"]["custom_mailfilter"]);
            // Replace windows linebreaks in mailfilter file
            $mailfilter_content = str_replace("\r\n", "\n", $mailfilter_content);