]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
captive: Allow uploading JPEG images, too
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 28 Apr 2017 13:29:15 +0000 (14:29 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 22 Sep 2017 17:56:04 +0000 (18:56 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/captive.cgi

index 9851aba70d89ebf46f3bad243b913b3bc86490d7..2d2c792ad9cd552fb85d2cfe5ebaa6da1faf0b4e 100755 (executable)
@@ -59,15 +59,15 @@ unless (-e $settingsfile)   { system("touch $settingsfile"); }
 
 &Header::showhttpheaders();
 
-#actions
-if ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}"){
+if ($cgiparams{'ACTION'} eq $Lang::tr{'save'}) {
        my $file = $cgiparams{'logo'};
-       if ($file){
-               #Check if extension is png
+       if ($file) {
+               # Check if the file extension is PNG/JPEG
                chomp $file;
+
                my ($name, $path, $ext) = fileparse($file, qr/\.[^.]*$/);
-               if ($ext ne ".png"){
-                       $errormessage=$Lang::tr{'Captive wrong ext'};
+               if ($ext ne ".png" && $ext ne ".jpg" && $ext ne ".jpeg") {
+                       $errormessage = $Lang::tr{'Captive wrong ext'};
                }
        }
 
@@ -623,20 +623,6 @@ sub validremark
        return 1;
 }
 
-sub pngsize {
-       my $Buffer = shift;
-       my ($width,$height) = ( undef, undef );
-
-       if ($Buffer =~ /IHDR(.{8})/) {
-               my $PNG = $1;
-               ($width,$height) = unpack( "NN", $PNG );
-       } else {
-               $width="invalid";
-               $height= "invalid";
-       };
-       return ($width,$height);
-}
-
 sub error{
        #if an errormessage exits, show a box with errormessage
        if ($errormessage) {