From 285c5bbde90391f694439e19371ec17ba3f77c53 Mon Sep 17 00:00:00 2001 From: ms Date: Fri, 17 Aug 2007 11:25:26 +0000 Subject: [PATCH] Code bereinigt... git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@777 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- html/cgi-bin/pppsetup.cgi | 198 ++------------------------------------ 1 file changed, 9 insertions(+), 189 deletions(-) diff --git a/html/cgi-bin/pppsetup.cgi b/html/cgi-bin/pppsetup.cgi index 120f028ea..0a3ce09ab 100644 --- a/html/cgi-bin/pppsetup.cgi +++ b/html/cgi-bin/pppsetup.cgi @@ -51,7 +51,7 @@ if ($pppsettings{'ACTION'} ne '' && } elsif ($pppsettings{'ACTION'} eq $Lang::tr{'refresh'}) { - unless ($pppsettings{'TYPE'} =~ /^(modem|serial|isdn|pppoe|pptp|alcatelusb|alcatelusbk|amedynusbadsl|conexantusbadsl|conexantpciadsl|3cp4218usbadsl|pulsardsl|eciadsl|fritzdsl|bewanadsl|eagleusbadsl)$/) { + unless ($pppsettings{'TYPE'} =~ /^(modem|serial|isdn|pppoe|pptp)$/) { $errormessage = $Lang::tr{'invalid input'}; goto ERROR; } my $type = $pppsettings{'TYPE'}; @@ -130,39 +130,6 @@ elsif ($pppsettings{'ACTION'} eq $Lang::tr{'save'}) $errormessage = $Lang::tr{'only digits allowed in holdoff field'}; goto ERROR; } - my $drivererror = 0; - if ($pppsettings{'TYPE'} =~ /^(alcatelusb|alcatelusbk)$/) { - my $modem = ''; - my $speedtouch = &Header::speedtouchversion; - if ($speedtouch >=0 && $speedtouch <=4) { - if ($speedtouch ==4) { $modem='v4_b'; } else { $modem='v0123'; } - $pppsettings{'MODEM'} = $modem; - } else { - $modem='v0123'; - $errormessage ="$Lang::tr{'unknown'} Rev $speedtouch"; - goto ERROR; - } - if (! -e "${General::swroot}/alcatelusb/firmware.$modem.bin") { - $errormessage = $Lang::tr{'no alcatelusb firmware'}; - $drivererror = 1; - goto ERROR; - } - } - - if($pppsettings{'TYPE'} eq 'eciadsl' && (!(-e "${General::swroot}/eciadsl/synch.bin"))) { - $errormessage = $Lang::tr{'no eciadsl synch.bin file'}; - $drivererror = 1; - goto ERROR; } - - if($pppsettings{'TYPE'} eq 'fritzdsl' && (!(-e "/lib/modules/$kernel/misc/fcdslusb.o.gz"))) { - $errormessage = $Lang::tr{'no fritzdsl driver'}; - $drivererror = 1; - goto ERROR; } - - if( $pppsettings{'USEIBOD'} eq 'on' && $pppsettings{'COMPORT'} eq 'isdn1') { - $errormessage = $Lang::tr{'ibod for dual isdn only'}; - goto ERROR; } - if ($pppsettings{'TYPE'} eq 'pptp') { $errormessage = ''; if ($pppsettings{'METHOD'} eq 'STATIC') { @@ -177,21 +144,6 @@ elsif ($pppsettings{'ACTION'} eq $Lang::tr{'save'}) if ($errormessage ne '') {goto ERROR; } } - if ($pppsettings{'TYPE'} =~ /^(alcatelusb|alcatelusbk|amedynusbadsl|conexantusbadsl|conexantpciadsl|3cp4218usbadsl|pulsardsl|eciadsl|fritzdsl|bewanadsl|eagleusbadsl)$/) { - if ( ($pppsettings{'VPI'} eq '') || ($pppsettings{'VCI'} eq '') ) { - $errormessage = $Lang::tr{'invalid vpi vpci'}; - goto ERROR; } - if ( (!($pppsettings{'VPI'} =~ /^\d+$/)) || (!($pppsettings{'VCI'} =~ /^\d+$/)) ) { - $errormessage = $Lang::tr{'invalid vpi vpci'}; - goto ERROR; } - if (($pppsettings{'VPI'} eq '0') && ($pppsettings{'VCI'} eq '0')) { - $errormessage = $Lang::tr{'invalid vpi vpci'}; - goto ERROR; } - if ( $pppsettings{'PROTOCOL'} eq '' ) { - $errormessage = $Lang::tr{'invalid input'}; - goto ERROR; } - } - if ( ($pppsettings{'PROTOCOL'} eq 'RFC1483') && ($pppsettings{'METHOD'} eq '') && \ ($pppsettings{'TYPE'} !~ /^(alcatelusb|fritzdsl)$/)) { $errormessage = $Lang::tr{'invalid input'}; @@ -230,10 +182,6 @@ elsif ($pppsettings{'ACTION'} eq $Lang::tr{'save'}) $errormessage = $Lang::tr{'dod not compatible with ddns'}; goto ERROR; } - if ( ($pppsettings{'TYPE'} =~ /^(bewanadsl)$/) && $pppsettings{'MODEM'} eq '') { - $errormessage = $Lang::tr{'no modem selected'}; - goto ERROR; } - if( $pppsettings{'PROTOCOL'} eq 'RFC1483') { $pppsettings{'ENCAP'} = $pppsettings{'ENCAP_RFC1483'}; } if( $pppsettings{'PROTOCOL'} eq 'RFC2364') { @@ -341,20 +289,8 @@ $selected{'BACKUPPROFILE'}{$pppsettings{'BACKUPPROFILE'}} = "selected='selected' $selected{'TYPE'}{'modem'} = ''; $selected{'TYPE'}{'serial'} = ''; -$selected{'TYPE'}{'isdn'} = ''; $selected{'TYPE'}{'pppoe'} = ''; $selected{'TYPE'}{'pptp'} = ''; -$selected{'TYPE'}{'alcatelusb'} = ''; -$selected{'TYPE'}{'alcatelusbk'} = ''; -$selected{'TYPE'}{'pulsardsl'} = ''; -$selected{'TYPE'}{'eciadsl'} = ''; -$selected{'TYPE'}{'fritzdsl'} = ''; -$selected{'TYPE'}{'bewanadsl'} = ''; -$selected{'TYPE'}{'eagleusbadsl'} = ''; -$selected{'TYPE'}{'conexantusbadsl'} = ''; -$selected{'TYPE'}{'conexantpciadsl'} = ''; -$selected{'TYPE'}{'amedynusbadsl'} = ''; -$selected{'TYPE'}{'3cp4218usbadsl'} = ''; $selected{'TYPE'}{$pppsettings{'TYPE'}} = "selected='selected'"; $checked{'DEBUG'}{'off'} = ''; @@ -514,9 +450,6 @@ print <$Lang::tr{'serial'} END ; -#if ($isdnsettings{'ENABLED'} eq 'on') { -# print "\t\n"; -#} if ($netsettings{'RED_TYPE'} eq 'PPPOE') { print "\t\n"; } @@ -556,7 +489,7 @@ if (-f "/proc/bus/usb/devices") { if ($pppsettings{'TYPE'}) { print "

"; - if ($pppsettings{'TYPE'} =~ /^(modem|serial|isdn)$/) { + if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/) { print < $Lang::tr{'interface'}: @@ -576,14 +509,6 @@ END END -; - } elsif ($pppsettings{'TYPE'} eq 'isdn') { - print <$Lang::tr{'isdn1'} - - - -END ; } if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/ ) { @@ -603,7 +528,7 @@ END END ; } - if ($pppsettings{'TYPE'} =~ /^(modem|isdn)$/ ) { + if ($pppsettings{'TYPE'} =~ /^(modem)$/ ) { print "$Lang::tr{'number'}\n"; print "\n"; if ($pppsettings{'TYPE'} eq 'modem' ) { @@ -698,24 +623,6 @@ print <

- - $Lang::tr{'isdn settings'} - - - $Lang::tr{'use ibod'} - - - - $Lang::tr{'use dov'} - - -END -; -} - if ($pppsettings{'TYPE'} eq 'pptp') { print <$Lang::tr{'concentrator name'} * -END -; -# -# MRU -# -# -# -print < MTU @@ -775,57 +674,6 @@ END ; } -if ($pppsettings{'TYPE'} eq 'fritzdsl') -{ -print <

- - $Lang::tr{'adsl settings'}: - - - $Lang::tr{'vpi number'} - - - - $Lang::tr{'vci number'} - - - - $Lang::tr{'protocol'}: - RFC2364 PPPoA - - - RFC 1483 / 2684 - - - $Lang::tr{'encapsulation'}: - - - - - - $Lang::tr{'encapsulation'}: - - - - -END -; - print "$Lang::tr{'driver'}:"; - if (-e "/lib/modules/$kernel/misc/fcdslusb.o.gz") { - print "$Lang::tr{'present'}"; - } else { - print "$Lang::tr{'not present'}"; } -} - print <

@@ -906,27 +754,6 @@ sub updatesettings link("${General::swroot}/ppp/settings-$pppsettings{'PROFILE'}", "${General::swroot}/ppp/settings"); system ("/usr/bin/touch", "${General::swroot}/ppp/updatesettings"); - if ($pppsettings{'TYPE'} eq 'eagleusbadsl') { - # eagle-usb.conf is in backup but link DSPcode.bin can't, so the link is created in rc.eagleusbadsl - open(FILE, ">/${General::swroot}/eagle-usb/eagle-usb.conf") or die "Unable to write eagle-usb.conf file"; - flock(FILE, 2); - # decimal to hexa - $modemsettings{'VPI'} = uc(sprintf('%X', $pppsettings{'VPI'})); - $modemsettings{'VCI'} = uc(sprintf('%X', $pppsettings{'VCI'})); - if( $pppsettings{'PROTOCOL'} eq 'RFC1483') { - $modemsettings{'Encapsulation'} =1+$pppsettings{'ENCAP'} - } elsif ( $pppsettings{'PROTOCOL'} eq 'RFC2364') { - $modemsettings{'Encapsulation'} =6-$pppsettings{'ENCAP'} - } - print FILE "\n"; - print FILE "VPI=$modemsettings{'VPI'}\n"; - print FILE "VCI=$modemsettings{'VCI'}\n"; - print FILE "Encapsulation=$modemsettings{'Encapsulation'}\n"; - print FILE "Linetype=0A\n"; - print FILE "RatePollFreq=00000009\n"; - print FILE "\n"; - close FILE; - } } sub writesecrets @@ -959,13 +786,12 @@ sub initprofile $pppsettings{'PHONEBOOK'} = 'RELAY_PPP1'; $pppsettings{'PROTOCOL'} = 'RFC2364'; $pppsettings{'METHOD'} = 'PPPOE_PLUGIN'; - if ( $pppsettings{'METHOD'} eq 'PPPOE_PLUGIN' ){ - $pppsettings{'MTU'} = '1492'; - $pppsettings{'MRU'} = '1492'; - } - else{ - $pppsettings{'MTU'} = '1452'; - $pppsettings{'MRU'} = '1452'; + if ( $pppsettings{'METHOD'} eq 'PPPOE_PLUGIN' ) { + $pppsettings{'MTU'} = '1492'; + $pppsettings{'MRU'} = '1492'; + } else { + $pppsettings{'MTU'} = '1452'; + $pppsettings{'MRU'} = '1452'; } $pppsettings{'DIALMODE'} = 'T'; $pppsettings{'MAXRETRIES'} = 5; @@ -976,10 +802,6 @@ sub initprofile $pppsettings{'DNS'} = 'Automatic'; $pppsettings{'DEBUG'} = 'off'; $pppsettings{'BACKUPPROFILE'} = $pppsettings{'PROFILE'}; - - # Get ISDN settings so we can see if ISDN is enabled or not. - $isdnsettings{'ENABLED'} = 'off'; - &General::readhash("${General::swroot}/isdn/settings", \%isdnsettings); # Get PPPoE settings so we can see if PPPoE is enabled or not. &General::readhash("${General::swroot}/ethernet/settings", \%netsettings); @@ -987,8 +809,6 @@ sub initprofile # empty profile partial pre-initialization if ($netsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/) { $pppsettings{'TYPE'}=lc($netsettings{'RED_TYPE'}); - } elsif ($isdnsettings{'ENABLED'} eq 'on') { - $pppsettings{'TYPE'}='isdn'; } else { $pppsettings{'TYPE'}='modem'; }