#!/usr/local/bin/perl # edit_vfile.cgi # Display the contents of an autoresponder file and alias settings require './virtual-server-lib.pl'; &ReadParse(); $d = &get_domain($in{'dom'}); &can_edit_domain($d) || &error($text{'aliases_ecannot'}); &can_edit_afiles() || &error($text{'vfile_ecannot'}); &ui_print_header(undef, $text{'vfile_title'}, ""); $what = $in{'alias'} ? 'alias' : 'user'; # Find the alias and its settings if ($what eq "alias") { @aliases = &list_domain_aliases($d); ($virt) = grep { $_->{'from'} eq $in{$what} } @aliases; @av = &alias_type($virt->{'to'}->[$in{'idx'}]); } else { @users = &list_domain_users($d); ($user) = grep { $_->{'user'} eq $in{$what} } @users; @av = &alias_type($user->{'to'}->[$in{'idx'}]); } # Read the autoreply file if (-e $in{'file'}) { open(FILE, $in{'file'}) || &error(&text('rfile_eread', $in{'file'}, $d->{'user'}, $!)); while() { push(@lines, $_); } close(FILE); } print &text('vfile_desc', "$in{'file'}"),"

\n"; print "$text{'vfile_desc2'}

\n"; print "

\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; # Show timeouts print "\n"; print "\n"; print "\n"; print "\n"; # Show directory print "\n"; print "\n"; # Show flag options print "\n"; print "\n"; # Show sender address $other = $av[6] eq "" || $av[6] eq "+" || $av[6] eq "\$" ? 0 : 1; print "\n"; print "\n"; print "
$text{'vfile_time'}",&ui_textbox("time", $av[2], 8)," ",$text{'vfile_secs'}, "
$text{'vfile_num'}",&ui_textbox("num", $av[3], 8),"
$text{'vfile_dir'}",&ui_opt_textbox("dir", $av[4] eq $in{'file'}.".log" ? undef : $av[4], 30, $text{'vfile_auto'}),"
$text{'vfile_flag'}",&ui_radio("flag", $av[5], [ [ "", $text{'default'} ], [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"
$text{'vfile_from'}",&ui_radio("from", $other ? "other" : $av[6], [ [ "", $text{'default'} ], [ "+", $text{'vfile_blank'} ], [ "\$", $text{'vfile_to'} ], [ "other", $text{'vfile_other'} ] ]),"\n", &ui_textbox("other", $other ? $av[6] : undef, 20),"
\n"; print " ", "\n"; print "
\n"; &ui_print_footer("edit_$what.cgi?dom=$in{'dom'}&$what=$in{$what}", $text{$what.'_return'});