#!/usr/local/bin/perl # edit_poll.cgi # Display one server polled by fetchmail require './fetchmail-lib.pl'; &ReadParse(); if ($config{'config_file'}) { $file = $config{'config_file'}; } else { &can_edit_user($in{'user'}) || &error($text{'poll_ecannot'}); @uinfo = getpwnam($in{'user'}); $file = "$uinfo[7]/.fetchmailrc"; $uheader = &text('poll_foruser', "$in{'user'}"); } if ($in{'new'}) { &ui_print_header($uheader, $text{'poll_create'}, ""); } else { &ui_print_header($uheader, $text{'poll_edit'}, ""); @conf = &parse_config_file($file); $poll = $conf[$in{'idx'}]; } print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; # Show server options print "\n"; print "\n"; print "
$text{'poll_header'}
\n"; print "\n"; printf "\n", $poll->{'poll'}; print "\n"; printf "\n", $poll->{'skip'} ? 'checked' : '', $text{'no'}; print "\n"; printf "\n", $poll->{'via'}; print "\n"; print "\n"; print "\n"; printf "\n", $poll->{'port'}; print "\n"; print "\n"; @interface = split(/\//, $poll->{'interface'}); print "\n"; print "
$text{'poll_poll'}$text{'poll_skip'} %s\n", $poll->{'skip'} ? '' : 'checked', $text{'yes'}; printf " %s
$text{'poll_via'} %s\n", $poll->{'via'} ? '' : 'checked', $text{'poll_via_def'}; printf "\n", $poll->{'via'} ? 'checked' : ''; printf "
$text{'poll_proto'}$text{'poll_port'} %s\n", $poll->{'port'} ? '' : 'checked', $text{'default'}; printf " %s\n", $poll->{'port'} ? 'checked' : ''; printf "
$text{'poll_auth'}
$text{'poll_interface'}\n"; printf " %s
\n", @interface ? '' : 'checked', $text{'poll_interface_def'}; printf " %s\n", @interface ? 'checked' : '', $text{'poll_interface_ifc'}; print " ", "$text{'poll_interface_ip'}\n"; print " /\n"; print "
\n"; # Show user options @users = @{$poll->{'users'}}; push(@users, undef) if ($in{'new'} || $in{'adduser'}); $i = 0; foreach $u (@users) { print "
\n"; print "\n"; print "
$text{'poll_uheader'}
\n"; print "\n"; printf "\n", $u->{'user'}; print "\n"; print "\n"; print "\n", join(" ", @{$u->{'is'}}) || $remote_user; print "\n"; print "\n"; print "\n"; print "\n"; $u->{'preconnect'} =~ s/'/'/g; printf "\n", $u->{'preconnect'}; print "\n"; $u->{'postconnect'} =~ s/'/'/g; printf "\n", $u->{'postconnect'}; print "
$text{'poll_user'}$text{'poll_pass'}",&ui_password("pass_$i", $u->{'pass'}, 15),"
$text{'poll_is'} \n"; printf "
$text{'poll_keep'} \n"; printf " %s\n", $u->{'keep'} eq '1' ? 'checked' : '', $text{'yes'}; printf " %s\n", $u->{'keep'} eq '0' ? 'checked' : '', $text{'no'}; printf " %s (%s)\n", $u->{'keep'} eq '' ? 'checked' : '', $text{'default'}, $text{'poll_usually'}; print "
$text{'poll_fetchall'} \n"; printf " %s\n", $u->{'fetchall'} eq '1' ? 'checked' : '', $text{'yes'}; printf " %s\n", $u->{'fetchall'} eq '0' ? 'checked' : '', $text{'no'}; printf " %s (%s)\n", $u->{'fetchall'} eq '' ? 'checked' : '', $text{'default'}, $text{'poll_usually'}; print "
$text{'poll_ssl'} \n"; printf " %s\n", $u->{'ssl'} eq '1' ? 'checked' : '', $text{'yes'}; printf " %s\n", $u->{'ssl'} eq '0' ? 'checked' : '', $text{'no'}; printf " %s (%s)\n", $u->{'ssl'} eq '' ? 'checked' : '', $text{'default'}, $text{'poll_usually'}; print "
$text{'poll_preconnect'}
$text{'poll_postconnect'}
\n"; $i++; } print "\n"; if ($in{'new'}) { print "\n"; } else { print "\n"; if (!$in{'adduser'}) { print "\n"; } print "\n"; print "\n"; } print "
\n"; if (!$fetchmail_config && $config{'view_mode'}) { &ui_print_footer("edit_user.cgi?user=$in{'user'}", $text{'user_return'}, "", $text{'index_return'}); } else { &ui_print_footer("", $text{'index_return'}); }