#!/usr/local/bin/perl # index.cgi # Display icons for defined PPTP tunnels require './pptp-client-lib.pl'; $vers = &get_pppd_version(\$out); &ui_print_header(undef, $text{'index_title'}, undef, "intro", 1, 1, 0, undef, undef, undef, $vers ? &text('index_version', $vers) : undef); # Create the PPTP options file if non-existent. This ensures that it can be # used in the peer scripts, even if it is empty if (!-r $config{'pptp_options'} && $config{'pptp_options'}) { &open_tempfile(OPTS, ">>$config{'pptp_options'}"); &close_tempfile(OPTS); } if (!&has_command($config{'pptp'})) { # The PPTP command is not installed print "

",&text('index_epptp', "$config{'pptp'}", "$gconfig{'webprefix'}/config.cgi?$module_name"),"

\n"; } elsif (!$vers) { # The PPP daemon is not installed print "

",&text('index_epppd', "pppd"),"

\n"; } else { # Show icons @tunnels = &list_tunnels(); %tunnels = map { $_->{'name'}, 1 } @tunnels; print &ui_subheading($text{'index_header'}); if (@tunnels) { @links = map { "edit.cgi?tunnel=$_->{'name'}" } @tunnels; @titles = map { $_->{'name'} } @tunnels; @icons = map { "images/tunnel.gif" } @tunnels; &icons_table(\@links, \@titles, \@icons); } else { print "$text{'index_none'}

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

\n"; print &ui_hr(); print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; @conns = grep { $tunnels{$_->[0]} } &list_connected(); %conns = map { @$_ } @conns; @notconns = grep { !$conns{$_->{'name'}} } @tunnels; if (@notconns) { # Show connect button, if any are disconnected print "\n"; print "\n"; } if (@conns) { # If any tunnels appear to be active, show disconnect button print "\n"; print "\n"; } # Show at-boot button if (&foreign_check("init") && @tunnels) { print "\n"; &foreign_require("init", "init-lib.pl"); $starting = &init::action_status($module_name); $config{'boot'} = undef if ($starting != 2); print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'index_optsdesc'}
\n"; print "\n"; print "\n"; print $text{'index_pass'}," ",&ui_password("cpass", undef, 10); print "$text{'index_conndesc'}
\n"; print "\n"; print "$text{'index_discdesc'}
\n"; print "$text{'index_bootdesc'}
\n"; } &ui_print_footer("/", $text{'index'});