Diff for /loncom/cgi/decompress.pl between versions 1.16 and 1.17

version 1.16, 2006/05/05 21:07:19 version 1.17, 2008/11/28 20:42:20
Line 31 Line 31
 ####  ####
 use strict;  use strict;
 use lib '/home/httpd/lib/perl';  use lib '/home/httpd/lib/perl';
   use Apache::lonnet;
   use Apache::lonlocal;
 use LONCAPA::loncgi;  use LONCAPA::loncgi;
   
 my %location_of;  my %location_of;
Line 43  foreach my $program ('tar','gunzip','bun Line 45  foreach my $program ('tar','gunzip','bun
     }      }
 }  }
   
   print("Content-type: text/html\n\n");
   
 if (!&LONCAPA::loncgi::check_cookie_and_load_env()) {  if (!&LONCAPA::loncgi::check_cookie_and_load_env()) {
     print("Content-type: text/html\n\n");      &Apache::lonlocal::get_language_handle();
     print(<<END);      print(&LONCAPA::loncgi::missing_cookie_msg());
     <html><body>NO COOKIE!</body></html>  
 END  
 } else {  } else {
     print "Content-type: text/html\n\n";      &Apache::lonlocal::get_language_handle();
       my %lt = &Apache::lonlocal::texthash (
                                               bade => 'Bad Environment!',
                                               outo => 'Output of decompress:',
                                               comp => 'Decompress complete.', 
                                               erro => 'An error occurred',
                                            );
     my $file=$Apache::lonnet::env{'cgi.file'};      my $file=$Apache::lonnet::env{'cgi.file'};
     my $dir=$Apache::lonnet::env{'cgi.dir'};       my $dir=$Apache::lonnet::env{'cgi.dir'}; 
     if(! $file || ! $dir) {      if(! $file || ! $dir) {
         print(<<END);          print(<<END);
         <html><body>Bad Enviroment!</body></html>          <html><body><span class="LC_error">$lt{'bade'}</span></body></html>
 END  END
     } else {      } else {
         print(<<END);          print(<<END);
  <html><body><p><b>Output of decompress:</b></p>   <html><body><p><b>$lt{'outo'}</b></p>
 END  END
         chdir($dir);          chdir($dir);
  my @cmd;   my @cmd;
Line 76  END Line 84  END
         } elsif ($file =~ m|\.tar$|) {          } elsif ($file =~ m|\.tar$|) {
             @cmd = ($location_of{'tar'},"-xpvf");              @cmd = ($location_of{'tar'},"-xpvf");
         } else {          } else {
             print("There has been an error in determining the file type of $file, please check name");              print('<span class="LC_error">'.&Apache::lonlocal::mt('There has been an error in determining the file type of [_1], please check the name',$file).'</span>');
         }          }
  if (@cmd) {   if (@cmd) {
     undef($!);      undef($!);
Line 84  END Line 92  END
     open(OUTPUT,"-|", @cmd, $file);      open(OUTPUT,"-|", @cmd, $file);
     while (my $line = <OUTPUT>) { print("$line<br />"); }      while (my $line = <OUTPUT>) { print("$line<br />"); }
     close(OUTPUT);      close(OUTPUT);
     print("<p><b>Decompress complete.</b></p>");      print("<p><b>$lt{'comp'}</b></p>");
     if ($! || $@) {      if ($! || $@) {
  print("<p><b>An error occurred</b></p><p>$!</p><p>$@</p>");   print('<p><span class="LC_error">'.$lt{'erro'}.'<br />'.$!.'<br />'.$@.'</span></p>');
     }      }
     print("</body></html>");  
  }   }
           print('</body></html>');
     }      }
 }  }
   

Removed from v.1.16  
changed lines
  Added in v.1.17


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>