#!/usr/local/bin/perl # index.cgi # Display the current list of procmail recipes require './procmail-lib.pl'; if ($minfo{'usermin'}) { &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1); } else { &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1); } # Make sure procmail is installed if (!$module_info{'usermin'} && !&has_command($config{'procmail'})) { print &text('index_ecmd', "$config{'procmail'}", "../config.cgi?$module_name"),"

\n"; &foreign_require("software", "software-lib.pl"); $lnk = &software::missing_install_link( "procmail", $text{'index_procmail'}, "../$module_name/", $text{'index_title'}); print $lnk,"

\n" if ($lnk); &ui_print_footer("/", $text{'index_return'}); exit; } # Tell user when procmail will be used if ($module_info{'usermin'}) { print &text('index_desc', "$procmailrc"),"

\n"; } else { ($ms, $mserr) = &check_mailserver_config(); if ($mserr) { print "",&text('index_mserr', $mserr),"

\n"; } elsif (!$ms) { print &text('index_desc_other', "$procmailrc"),"

\n"; } } # Build links for adding things @links = ( "$text{'index_add'}", "$text{'index_badd'}", "$text{'index_eadd'}" ); push(@links, "$text{'index_iadd'}") if (!$includes); @conf = &get_procmailrc(); if (@conf) { @tds = ( "width=5" ); print &ui_form_start("delete_recipes.cgi", "post"); unshift(@links, &select_all_link("d"), &select_invert_link("d") ); print &ui_links_row(\@links); print &ui_columns_start([ "", $text{'index_action'}, $text{'index_conds'}, $text{'index_move'}, $text{'index_ba'} ], 100, 0, \@tds); foreach $c (@conf) { local @cols; local @tds = ( "width=5" ); if ($c->{'name'}) { # Environment variable assignment local $v = length($c->{'value'}) > 80 ? substr($c->{'value'}, 0, 80)." ..." : $c->{'value'}; push(@cols, "". &text('index_env', "".&html_escape($c->{'name'})."", "".&html_escape($v)."").""); push(@tds, "width=100% colspan=2"); } elsif ($c->{'include'}) { # Included file push(@cols, "". &text('index_include', "".&html_escape($c->{'include'}).""). ""); push(@tds, "width=100% colspan=2"); } else { # Procmail recipe local ($t, $a) = &parse_action($c); push(@cols, "". &text('index_act'.$t, "".&html_escape($a)."").""); push(@tds, "valign=top width=50%"); local @c = @{$c->{'conds'}}; if (!@c) { push(@cols, $text{'index_noconds'}); } else { local $c; foreach $n (@c) { local $he ="".&html_escape($n->[1]). ""; if ($n->[0] eq '') { $c .= &text('index_re', $he); } elsif ($n->[0] eq '!') { $c .= &text('index_nre', $he); } elsif ($n->[0] eq '$') { $c .= &text('index_shell', $he); } elsif ($n->[0] eq '?') { $c .= &text('index_exit', $he); } elsif ($n->[0] eq '<') { $c .= &text('index_lt',$n->[1]); } elsif ($n->[0] eq '>') { $c .= &text('index_gt',$n->[1]); } $c .= "
\n"; } push(@cols, $c); } push(@tds, "width=50%"); } # Move up/down links local $mover; if ($c eq $conf[@conf-1] || $c->{'file'} ne $conf[$c->{'index'}+1]->{'file'}) { $mover .= ""; } else { $mover .= "". ""; } if ($c eq $conf[0] || $c->{'file'} ne $conf[$c->{'index'}-1]->{'file'}) { $mover .= ""; } else { $mover .= "". ""; } push(@cols, $mover); push(@tds, "width=32"); # Add before/after links push(@cols, ""); print &ui_checked_columns_row(\@cols, \@tds, "d",$c->{'index'}); } print &ui_columns_end(); print &ui_links_row(\@links); print &ui_form_end([ [ "delete", $text{'index_delete'} ] ]); } else { print "$text{'index_none'}

\n"; print &ui_links_row(\@links); } # Manual edit button print &ui_hr(); print &ui_buttons_start(); print &ui_buttons_row("manual_form.cgi", $text{'index_man'}, $text{'index_mandesc'}); print &ui_buttons_end(); print "$text{'index_manual'}\n"; print "

\n"; &ui_print_footer("/", $text{'index'});