[LON-CAPA-cvs] cvs: loncom /cgi decompress.pl

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 20 Oct 2003 15:51:51 -0000


albertel		Mon Oct 20 11:51:51 2003 EDT

  Modified files:              
    /loncom/cgi	decompress.pl 
  Log:
  - xhtmlize
  - retabinated
  
  
Index: loncom/cgi/decompress.pl
diff -u loncom/cgi/decompress.pl:1.2 loncom/cgi/decompress.pl:1.3
--- loncom/cgi/decompress.pl:1.2	Sat Oct 18 13:42:45 2003
+++ loncom/cgi/decompress.pl	Mon Oct 20 11:51:51 2003
@@ -33,51 +33,55 @@
 use LONCAPA::loncgi();
 
 if(! &LONCAPA::loncgi::check_cookie_and_load_env()){
-	print "Content-type: text/html\n\n";
-	 print <<END;
-	 NO COOKIE!
+    print "Content-type: text/html\n\n";
+    print <<END;
+	 <html><body>NO COOKIE!</body></html>
 END
-}
-else
-{
-	$url = $ENV{'HTTP_REFERER'};
-	$url =~ m|/{2}|;
-	$url = $';
-	$url =~ m|/{1}|;
-	$referer = $`;
-	if($referer ne $ENV{'SERVER_NAME'})
-	{	print "Content-type: text/html\n\n";
-		print "You are trying something that is not allowed, go to the real homeserver and try again";
+} else {
+    $url = $ENV{'HTTP_REFERER'};
+    $url =~ m|/{2}|;
+    $url = $'; #' stupid emacs
+    $url =~ m|/{1}|;
+    $referer = $`;
+    if($referer ne $ENV{'SERVER_NAME'}) {
+	print "Content-type: text/html\n\n";
+	print "<html><body>You are trying something that is not allowed, go to the real homeserver and try again</body></html>";
+    } else {
+	$url = $'; #' stupid emacs	
+	$url =~ m|$ENV{'user.name'}/{1}|;
+	$url = $'; #' stupid emacs
+	$url =~ m|\?{1}|;
+	$url = $`;
+	$path ="/home/$ENV{'user.name'}/public_html/";
+	$back_path = "";
+	while($url =~ m|/|) {
+	    $path .= $`;
+	    $back_path .= $`;
+	    $path .= "/";
+	    $back_path .= "/";
+	    $url = $'; #' stupid emacs
 	}
-	else
-	{
-		$url = $';	
-		$url =~ m|$ENV{'user.name'}/{1}|;
-		$url = $';
-		$url =~ m|\?{1}|;
-		$url = $`;
-		$path ="/home/$ENV{'user.name'}/public_html/";
-		$back_path = "";
-		while($url =~ m|/|)
-		{
-			$path .= $`;
-			$back_path .= $`;
-			$path .= "/";
-			$back_path .= "/";
-			$url = $';
-		}
-		chdir $path;
-		$filename=$url;
-		if($url =~ m|zip|){system "unzip -qq $filename &> /dev/null";}
-		elsif($url =~ m|tar.gz|){system "tar -zxpvf $filename &> /dev/null";}
-		elsif($url =~ m|tar.bz2|){system "tar -jxpvf $filename &> /dev/null";}
-		elsif($url =~ m|bz2|){system "bunzip2 $filename &> /dev/null";}
-		elsif($url =~ m|tgz|){system "tar -zxpvf $filename &> /dev/null";}
-		elsif($url =~ m|gz|){system "gunzip $filename &> /dev/null";}
-		elsif($url =~ m|tar|){system "tar -xpvf $filename &> /dev/null";}
+	chdir $path;
+	$filename=$url;
+	if      ($url =~ m|zip|) {
+	    system "unzip -qq $filename &> /dev/null";
+	} elsif ($url =~ m|tar.gz|) {
+	    system "tar -zxpvf $filename &> /dev/null";
+	} elsif ($url =~ m|tar.bz2|){
+	    system "tar -jxpvf $filename &> /dev/null";
+	} elsif ($url =~ m|bz2|){
+	    system "bunzip2 $filename &> /dev/null";
+	} elsif ($url =~ m|tgz|){
+	    system "tar -zxpvf $filename &> /dev/null";
+	} elsif ($url =~ m|gz|){
+	    system "gunzip $filename &> /dev/null";
+	} elsif ($url =~ m|tar|){
+	    system "tar -xpvf $filename &> /dev/null";
 	}
-	
+    }
 }
 print "Content-type: text/html\n\n";
-print '<META http-equiv="refresh" content="0; URL=';
-print "http://$ENV{'SERVER_NAME'}/~$ENV{'user.name'}/$back_path"; print '" >'; 
\ No newline at end of file
+print '<html><head>'
+print '<meta http-equiv="refresh" content="0; URL=';
+print "http://$ENV{'SERVER_NAME'}/~$ENV{'user.name'}/$back_path"; print '" />';
+print '</head></html>';