| | |
| | | $tpl->newTemplate($filter_file_template); |
| | | |
| | | // cc Field |
| | | $tmp_mails_arr = explode(',',$data["new"]["cc"]); |
| | | $tmp_addresses_arr = array(); |
| | | foreach($tmp_mails_arr as $address) { |
| | | if(trim($address) != '') $tmp_addresses_arr[] = array('address' => trim($address)); |
| | | } |
| | | |
| | | $tpl->setVar('cc', $data["new"]["cc"]); |
| | | $tpl->setLoop('ccloop', $tmp_addresses_arr); |
| | | |
| | | // Custom filters |
| | | if($data["new"]["custom_mailfilter"] == 'NULL') $data["new"]["custom_mailfilter"] = ''; |
| | | $tpl->setVar('custom_mailfilter', $data["new"]["custom_mailfilter"]); |
| | | |
| | | // Move junk |
| | |
| | | |
| | | $tpl->setVar('addresses', $address_str); |
| | | |
| | | file_put_contents($sieve_file_isp, $tpl->grab()); |
| | | if ( ! is_dir($data["new"]["maildir"].'/sieve/') ) { |
| | | $app->system->mkdirpath($data["new"]["maildir"].'/sieve/', 0700, $mail_config['mailuser_name'], $mail_config['mailuser_group']); |
| | | } |
| | | file_put_contents($sieve_file, $tpl->grab()); |
| | | exec('chown '.$mail_config['mailuser_name'].':'.$mail_config['mailuser_group'].' '.escapeshellcmd($sieve_file)); |
| | | |
| | | chown($sieve_file_isp,$mail_config['mailuser_name']); |
| | | chgrp($sieve_file_isp,$mail_config['mailuser_group']); |
| | | chdir($data["new"]["maildir"]); |
| | | //* create symlink to activate sieve script |
| | | symlink("sieve/ispconfig.sieve", ".sieve") or $app->log("Unable to create symlink to active sieve filter", LOGLEVEL_WARN); |
| | | symlink("sieve/ispconfig.sieve", ".sieve") or $app->log("Unable to create symlink to active sieve filter", LOGLEVEL_WARN); |
| | | if (is_link(".sieve")) { |
| | | lchown(".sieve",$mail_config['mailuser_name']); |
| | | lchgrp(".sieve",$mail_config['mailuser_group']); |
| | | } |
| | | unset($tpl); |
| | | |
| | | } |