#!/usr/bin/perl # # SmoothWall CGIs # # This code is distributed under the terms of the GPL # # (c) The SmoothWall Team # # $Id: upload.cgi,v 1.2.2.21 2005/08/14 23:43:38 gespinasse Exp $ # use File::Copy; use strict; # enable only the following on debugging purpose #use warnings; #use CGI::Carp 'fatalsToBrowser'; require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; my %uploadsettings=(); my $errormessage = ''; &Header::showhttpheaders(); $uploadsettings{'ACTION'} = ''; &Header::getcgihash(\%uploadsettings, {'wantfile' => 1, 'filevar' => 'FH'}); my $extraspeedtouchmessage=''; my $extrafritzdslmessage=''; my $extraeciadslmessage=''; my $modem=''; my $firmwarename=''; my $kernel=''; my $speedtouch = &Header::speedtouchversion; if ($speedtouch == 4) { $modem='v4_b'; $firmwarename="$Lang::tr{'upload'} ZZZL_3.012"; } else { $modem='v0123'; $firmwarename="$Lang::tr{'upload'} KQD6_3.012"; } $kernel=`/bin/uname -r | /usr/bin/tr -d '\012'`; if ($uploadsettings{'ACTION'} eq $firmwarename) { if ($modem eq 'v0123' || $modem eq 'v4_b') { if (copy ($uploadsettings{'FH'}, "${General::swroot}/alcatelusb/firmware.$modem.bin") != 1) { $errormessage = $!; } else { $extraspeedtouchmessage = $Lang::tr{'upload successful'}; } } } elsif ($uploadsettings{'ACTION'} eq "$Lang::tr{'upload'} fcdsl-${General::version}.tgz") { if (copy ($uploadsettings{'FH'}, "/var/patches/fcdsl-x.tgz") != 1) { $errormessage = $!; } else { $extrafritzdslmessage = $Lang::tr{'upload successful'}; } } elsif ($uploadsettings{'ACTION'} eq $Lang::tr{'upload synch.bin'}) { if (copy ($uploadsettings{'FH'}, "${General::swroot}/eciadsl/synch.bin") != 1) { $errormessage = $!; } else { $extraeciadslmessage = $Lang::tr{'upload successful'}; } } &Header::openpage($Lang::tr{'firmware upload'}, 1, ''); &Header::openbigbox('100%', 'left', '', $errormessage); if ($errormessage) { &Header::openbox('100%', 'left', $Lang::tr{'error messages'}); print "$errormessage \n"; &Header::closebox(); } print "
\n"; &Header::openbox('100%','left', $Lang::tr{'alcatelusb upload'}); print < $Lang::tr{'alcatelusb help'}
URL: http://www.speedtouch.com/support.htm $Lang::tr{'modem'}: Rev $speedtouch $Lang::tr{'upload file'}:  END ; if (-e "${General::swroot}/alcatelusb/firmware.$modem.bin") { if ($extraspeedtouchmessage ne '') { print ("$extraspeedtouchmessage"); } else { print ("$Lang::tr{'present'}"); } } else { print ("$Lang::tr{'not present'}"); } print < END ; &Header::closebox(); &Header::openbox('100%','left', $Lang::tr{'eciadsl upload'}); print < $Lang::tr{'eciadsl help'}
URL: http://eciadsl.flashtux.org/ $Lang::tr{'upload file'}:  END ; if (-e "${General::swroot}/eciadsl/synch.bin") { if ($extraeciadslmessage ne '') { print ("$extraeciadslmessage"); } else { print ("$Lang::tr{'present'}"); } } else { print ("$Lang::tr{'not present'}"); } print < END ; &Header::closebox(); &Header::openbox('100%','left', $Lang::tr{'fritzdsl upload'}); print < $Lang::tr{'fritzdsl help'}
URL: http://www.ipfire.org/ $Lang::tr{'upload file'}:  END ; if ($extrafritzdslmessage ne '') { print ("$extrafritzdslmessage 
");
	print `/usr/local/bin/installfcdsl`;
	print ("
"); } else { if (-e "/lib/modules/$kernel/misc/fcdsl.o.gz") { print ("$Lang::tr{'present'}"); } else { print ("$Lang::tr{'not present'}"); } } print < END ; &Header::closebox(); print "\n"; &Header::closebigbox(); &Header::closepage();