#!/usr/local/bin/perl # edit_ffile.cgi # Allow editing of a filter config file require './virtual-server-lib.pl'; &ReadParse(); $d = &get_domain($in{'dom'}); &can_edit_domain($d) || &error($text{'aliases_ecannot'}); &can_edit_afiles() || &error($text{'ffile_ecannot'}); &ui_print_header(undef, $text{'ffile_title'}, ""); &switch_to_domain_user($d); if (-e $in{'file'}) { open(FILE, $in{'file'}) || &error(&text('ffile_eread', $in{'file'}, $d->{'user'}, $!)); while() { s/\r|\n//g; if (/^(\S+)\s+(\S+)\s+(\S+)\s+(.*)$/) { push(@filter, [ $1, $2, $3, $4 ]); } elsif (/^(2)\s+(\S+)$/) { $other = $2; } } close(FILE); } print "",&text('ffile_desc', "$in{'file'}"),"

\n"; $what = $in{'alias'} ? 'alias' : 'user'; print "

\n"; print "\n"; print "\n"; print "\n"; $i = 0; foreach $f (@filter, [ 1, '', '', '' ], [ 1, '', '', '' ], [ 1, '', '', '' ], [ 1, '', '', '' ], [ 1, '', '', '' ]) { $field = "\n"; $what = "\n"; $match = "\n"; $action = "\n"; print &text('ffile_line', $field, $what, $match, $action),"
\n"; $i++; } print &text('ffile_other', ""),"
\n"; print "\n"; print "
\n"; &ui_print_footer("edit_$what.cgi?dom=$in{'dom'}&$what=$in{$what}", $text{$what.'_return'});