From: <jgs...@us...> - 2003-12-11 16:28:54
|
Update of /cvsroot/serverfilters In directory sc8-pr-cvs1:/tmp/cvs-serv3576 Modified Files: ChangeLog config.php functions.php recipie_functions.php Log Message: Added option to create dot forward files. Index: config.php =================================================================== RCS file: /cvsroot/serverfilters/config.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** config.php 11 Dec 2003 15:51:40 -0000 1.7 --- config.php 11 Dec 2003 16:28:51 -0000 1.8 *************** *** 28,31 **** --- 28,33 ---- * you may put [DOMAIN] and [USERNAME] in this entry * and the appropriate domain name and username will be entered. + * Additionally for virtual domains you can use [DOMUSER] which will be replaced + * with the username that owns the domain. */ //$FILTERDIR = '/var/lib/squirrelmail/home/[DOMAIN]/[USERNAME]'; *************** *** 108,118 **** $SEPERATOR = '@'; ! // Plugin will creat appropriate .qmail file for your filter ! // filter application if you set this to 1. ! // Set this to 0 if you do not use qmail or you want to create the // files yourself ! // Currently only works if FTP method is selected ! $CREATE_DOT_QMAIL = 1; $DOT_QMAIL_DIR = "/home/email/[DOMUSER]/"; ?> --- 110,125 ---- $SEPERATOR = '@'; ! // Plugin will creat appropriate .qmail or .forward file for your filter ! // filter application if you set this to true. ! // Set this to false if you do not use qmail or you want to create the // files yourself ! // .forward files don't really make sense for virtual domains, so this ! // option will be ignored if virtual domains are enabled. If you really ! // want this capability try adding a "| forward" to the default delivery ! $CREATE_DOT_QMAIL = true; $DOT_QMAIL_DIR = "/home/email/[DOMUSER]/"; + + $CREATE_DOT_FORWARD = false; + $DOT_FORWARD_DIR = "/home/[USERNAME]/"; ?> Index: functions.php =================================================================== RCS file: /cvsroot/serverfilters/functions.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** functions.php 11 Dec 2003 15:51:40 -0000 1.6 --- functions.php 11 Dec 2003 16:28:51 -0000 1.7 *************** *** 77,88 **** $tmpfile = "/tmp/.qmail-$username"; if ($VIRTUAL_DOMAINS) { list($user, $domain) = split($SEPERATOR,$username); $user = my_virtual_domain_user($domain); ! $dot_qmail = "$DOT_QMAIL_DIR/.qmail-$user"; } else { $user = $username; ! $dot_qmail = "$DOT_QMAIL_DIR/.qmail"; } $fd = fopen($tmpfile,"w"); $filterpath = vd_replace($FILTERDIR); --- 77,91 ---- $tmpfile = "/tmp/.qmail-$username"; + $qmail_dir = vd_replace($DOT_QMAIL_DIR); + if ($VIRTUAL_DOMAINS) { list($user, $domain) = split($SEPERATOR,$username); $user = my_virtual_domain_user($domain); ! $dot_qmail = "$qmail_dir/.qmail-$user"; } else { $user = $username; ! $dot_qmail = "$qmail_dir/.qmail"; } + $fd = fopen($tmpfile,"w"); $filterpath = vd_replace($FILTERDIR); *************** *** 92,98 **** fclose($fd); ! $command = escapeshellcmd("sudo ../plugins/serversidefilter/script/putrc $user $tmpfile $dot_qmail"); ! system($command, $exists); } --- 95,122 ---- fclose($fd); ! $command = escapeshellcmd("../plugins/serversidefilter/script/filtercmd putrc $user $tmpfile $dot_qmail"); ! system($command); ! } ! ! function write_dot_forward() { ! global $username, $VIRTUAL_DOMAINS, $FILTERDIR, $FILTERFILE, $FILTER_APP_PATH, $DOT_FORWARD_DIR; ! ! if ($VIRTUAL_DOMAINS) { ! return; ! } ! ! $tmpfile = "/tmp/.forward-$username"; ! $forward_dir = vd_replace($DOT_FORWARD_DIR); ! $dot_forward = "$forward_dir/.forward"; ! ! $fd = fopen($tmpfile,"w"); ! $filterpath = vd_replace($FILTERDIR); ! $filterfile = "$filterpath/$FILTERFILE"; ! $contents = "|$FILTER_APP_PATH $filterfile\n"; ! fwrite($fd, $contents); ! fclose($fd); + $command = escapeshellcmd("../plugins/serversidefilter/script/filtercmd putrc $username $tmpfile $dot_forward"); + system($command); } Index: recipie_functions.php =================================================================== RCS file: /cvsroot/serverfilters/recipie_functions.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** recipie_functions.php 9 Dec 2003 06:50:12 -0000 1.3 --- recipie_functions.php 11 Dec 2003 16:28:51 -0000 1.4 *************** *** 97,101 **** function write_recipies($oldfile, $newfile) { global $username, $recipies, $SEPERATOR, $SPAMFILTER, $SPAMHEADER, $UNSUREVALUE, $SPAMVALUE, ! $VIRTUAL_DOMAINS, $LOCAL_MAILDIR, $FILE_BACKEND, $CREATE_DOT_QMAIL; if (isset($VIRTUAL_DOMAINS) && $VIRTUAL_DOMAINS==1) --- 97,101 ---- function write_recipies($oldfile, $newfile) { global $username, $recipies, $SEPERATOR, $SPAMFILTER, $SPAMHEADER, $UNSUREVALUE, $SPAMVALUE, ! $VIRTUAL_DOMAINS, $LOCAL_MAILDIR, $FILE_BACKEND, $CREATE_DOT_QMAIL, $CREATE_DOT_FORWARD; if (isset($VIRTUAL_DOMAINS) && $VIRTUAL_DOMAINS==1) *************** *** 162,172 **** fclose($nf); ! if (isset($CREATE_DOT_QMAIL) && $CREATE_DOT_QMAIL == 1) write_dot_qmail(); } function create_filter() { global $username, $SEPERATOR, $SPAMFILTER, $FILTERFILE, ! $VIRTUAL_DOMAINS, $LOCAL_MAILDIR, $FILE_BACKEND, $CREATE_DOT_QMAIL; if (isset($VIRTUAL_DOMAINS) && $VIRTUAL_DOMAINS==1) --- 162,175 ---- fclose($nf); ! if (isset($CREATE_DOT_QMAIL) && $CREATE_DOT_QMAIL) write_dot_qmail(); + if (isset($CREATE_DOT_FORWARD) && $CREATE_DOT_FORWARD) + write_dot_forward(); + } function create_filter() { global $username, $SEPERATOR, $SPAMFILTER, $FILTERFILE, ! $VIRTUAL_DOMAINS, $LOCAL_MAILDIR, $FILE_BACKEND, $CREATE_DOT_QMAIL, $CREATE_DOT_FORWARD; if (isset($VIRTUAL_DOMAINS) && $VIRTUAL_DOMAINS==1) *************** *** 193,199 **** filter_put($file); unlink($file); ! if (isset($CREATE_DOT_QMAIL) && $CREATE_DOT_QMAIL == 1 && ! $FILE_BACKEND != 'local') write_dot_qmail(); } --- 196,203 ---- filter_put($file); unlink($file); ! if (isset($CREATE_DOT_QMAIL) && $CREATE_DOT_QMAIL) write_dot_qmail(); + if (isset($CREATE_DOT_FORWARD) && $CREATE_DOT_FORWARD) + write_dot_forward(); } |