#!/usr/local/bin/perl # index.cgi # Display ADSL configuration options # XXX new-style ADSL config in redhat 7.2 and above! # XXX effects start/stop and bootup as well require './adsl-client-lib.pl'; $vers = &get_pppoe_version(\$out); &ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1, 0, &help_search_link("pppoe", "man", "doc"), undef, undef, $vers ? &text('index_version', $vers) : undef); if (!$vers) { # Not installed print "
",&text('index_eadsl', "$config{'pppoe_cmd'}", "$gconfig{'webprefix'}/config.cgi?$module_name"),"
\n"; } elsif (!($conf = &get_config())) { # Missing config file if ($config{'conf_style'} == 0) { # Just give up print "
", &text('index_econfig', "$config{'pppoe_conf'}", "$gconfig{'webprefix'}/config.cgi?$module_name"),"
\n"; } else { # On redhat systems, the file needs to be created by this # module :-( print "
",&text('index_esetup', "$config{'pppoe_conf'}"),"
\n"; print "
",&text('index_emodem', "$1", "$gconfig{'webprefix'}/config.cgi?$module_name"),"
\n"; } else { # Show configuration form $conf = &get_config(); print "$text{'index_desc'}
\n"; print "
\n"; # Show connected/disconnect buttons print &ui_hr(); print &ui_buttons_start(); local ($dev, $ip) = &get_adsl_ip(); if ($ip) { # Offer to shut down print &ui_buttons_row("stop.cgi", $text{'index_stop'}, &text('index_stopdesc', "$ip", "$config{'stop_cmd'}")); } elsif ($dev eq "demand") { # Offer to cancel on-demand connection print &ui_buttons_row("stop.cgi", $text{'index_cdemand'}, &text('index_cdemanddesc', "$config{'stop_cmd'}")); } elsif ($dev) { # Offer to cancel connect print &ui_buttons_row("stop.cgi", $text{'index_cancel'}, &text('index_canceldesc', "$config{'stop_cmd'}")); } else { # Offer to start up print &ui_buttons_row("start.cgi", $text{'index_start'}, &text('index_startdesc', "$config{'start_cmd'}")); } # Show boot-time button if ($config{'conf_style'} == 1 && ($onboot = find("ONBOOT", $conf))) { # Offer to turn on/off starting at boot print &ui_buttons_row("rbootup.cgi", $text{'index_boot'}, $text{'index_bootdesc'}, undef, &ui_yesno_radio("onboot", $onboot =~ /yes/i ? 1 : 0)); } elsif (&foreign_check("init")) { # Offer to enable/disable init script &foreign_require("init", "init-lib.pl"); $boot = &init::action_status("adsl"); if ($boot > 0) { print &ui_buttons_row("bootup.cgi", $text{'index_boot'}, $text{'index_bootdesc'}, undef, &ui_yesno_radio("boot", $boot == 2 ? 1 : 0)); } } print &ui_buttons_end(); } &ui_print_footer("/", $text{'index'});