#!/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 "