OSSP CVS Repository

ossp - Difference in ossp-pkg/tabea/tabea.cgi versions 1.23 and 1.24
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/tabea/tabea.cgi 1.23 -> 1.24

--- tabea.cgi    2002/05/17 13:00:04     1.23
+++ tabea.cgi    2002/05/17 18:28:01     1.24
@@ -27,7 +27,6 @@
 ##
 ##  tabea.cgi: Tabea CGI (syntax: Perl)
 ##
-##
 
 require 5.000;
 use strict;
@@ -36,7 +35,6 @@
 
 $|++;
 
-
 my $cfgfile    = "./tabea.cfg";
 my $pwdfile    = "./tabea.pw";
 my $configsdir = "./tabea.d";
@@ -65,7 +63,6 @@
     exit(0);
 };
 
-
 #   update cookies
 my $cookies = [];
 foreach my $param (qw(username)) { # FIXME!
@@ -79,7 +76,7 @@
         ));
     }
     if ($cgi->param($param) eq '' and $cgi->cookie($param) ne '') {
-         $cgi->param(-name => $param, -value => [$cgi->cookie($param)]);
+        $cgi->param(-name => $param, -value => [$cgi->cookie($param)]);
     }
 }
 
@@ -101,18 +98,18 @@
     }
 }
 
-NEXTFORM:    
+NEXTFORM:
 my $page = $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1));
 
 if ($form eq '') {
     $page .= &login();
 }
 elsif ($form eq 'mainw') {
-    $page .= mainw(); 
+    $page .= mainw();
 }
 elsif ($form eq 'edit') {
     $page .= &edit($cgi->param('configslist'));
-} 
+}
 elsif ($form eq 'save') {
     $page .= &save($cgi->param('editfile'), $cgi->param('editwindow'));
 }
@@ -123,15 +120,15 @@
     $page .= &new($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username);
 }
 elsif ($form eq 'newf') {
-    $page .= &newfile($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username, $cgi->param('newfile'), 
-                      $cgi->param('new_rights'));
+    $page .= &newfile($cfghash{'BaseDir'} . $cfghash{'ConfigDir'},
+                      $username, $cgi->param('newfile'), $cgi->param('new_rights'));
 }
 elsif ($form eq 'confr') {
     $page .= &config_rights($cgi->param('configslist'));
 }
 elsif ($form eq 'changer') {
-    $page .= &change_rights($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" .  $cgi->param('filename'), 
-                            $cgi->param('changerights') );
+    $page .= &change_rights($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/"
+                            . $cgi->param('filename'), $cgi->param('changerights') );
 }
 elsif ($form eq 'copyt') {
     $page .= &copy_file($cgi->param('templatelist') );
@@ -140,7 +137,7 @@
     $page .= &copy_file($cgi->param('configslist'));
 }
 elsif ($form eq 'copy' ) {
-    $page .= &copy($cgi->param('srcfile'), $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" .  
+    $page .= &copy($cgi->param('srcfile'), $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" .
                    $username . "/". $cgi->param('dstfile'));
 }
 elsif ($form eq 'del' ) {
@@ -153,7 +150,7 @@
     die "no correct dialog found";
 }
 
-$page .= $cgi->hidden(-name => 'password', -default => $password ) ;
+$page .= $cgi->hidden(-name => 'password', -default => $password);
 $page .= $cgi->endform;
 
 my $out = $MY->{TEMPLATE};
@@ -162,7 +159,8 @@
 
 print $cgi->header(-cookie => $cookies, -expires => '+1s') . $out;
 
-exit (0);
+exit(0);
+
 ############### End of main part #######################################################
 
 ########################################################################################
@@ -170,7 +168,7 @@
 ########################################################################################
     my $text = '';
 
-    $text .= 
+    $text .=
     "<table cellspacing=0 cellpadding=0>" .
     "  <tr>" .
     "    <td>Username:</td>" .
@@ -212,8 +210,8 @@
 ########################################################################################
     my $text = '';
 
-    &validpassword($username, $password, $cfghash{'BaseDir'}.$cfghash{'PasswdFile'}) 
-                || print STDOUT $cgi->redirect(-uri => $cgi->url(-full => 1), -type => "text/html");
+    &validpassword($username, $password, $cfghash{'BaseDir'}.$cfghash{'PasswdFile'})
+        || print STDOUT $cgi->redirect(-uri => $cgi->url(-full => 1), -type => "text/html");
 
     my $templatesfiles = &get_name_files($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username, 4);
     my $configsfiles = &get_name_files($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username, 6);
@@ -222,17 +220,17 @@
 
     $templatesfiles = &strsort($templatesfiles);
     $configsfiles = &strsort($configsfiles);
-    
+
     my @templatesarray = split(/ /,$templatesfiles);
     my @configsarray = split(/ /,$configsfiles);
-           
-    $text .= 
-    # Begin with templates part         
+
+    $text .=
+    # Begin with templates part
     "<font size=+1>" .
     "<br> Active User: $username<br><br>\n" .
     "</font>" .
     "<table> <caption>Templates</caption>" .
-    "  <td>" . 
+    "  <td>" .
     "    <td>" .
     $cgi->scrolling_list(
         -name => 'templatelist',
@@ -259,7 +257,7 @@
     "   </table>" .
     " </td>" .
     "</table>" .
-    # Now the configuration part         
+    # Now the configuration part
     "<br><br>" .
     "<table> <caption>Configuration</caption>" .
     "<td>" .
@@ -293,10 +291,10 @@
     "    </table>" .
     "  </td>" .
     "<td>" .
-    "</table>" ;
+    "</table>";
 
     return $text;
-}    
+}
 ########################################################################################
 
 
@@ -311,12 +309,12 @@
     my $filemode = '';
     my $entry = '';
 
-    my $dirlist = &readsubdir($dirname . "/" );    
-    my @dirarray =  split (/ /, $dirlist);
+    my $dirlist = &readsubdir($dirname . "/");
+    my @dirarray = split (/ /, $dirlist);
 
-    DIR: foreach $subdir (@dirarray)  {
+    DIR: foreach $subdir (@dirarray) {
         next DIR if $subdir eq $user;
-        $filel = &readdir($dirname . "/" . $subdir . "/") ;
+        $filel = &readdir($dirname . "/" . $subdir . "/");
         @filelarray = split (/ /, $filel);
         FILE: foreach $entry (@filelarray) {
             my $path = $dirname . "/" . $subdir . "/" . $entry;
@@ -324,7 +322,7 @@
             $filelist .= $subdir . "/" . $entry . " ";
         }
     }
-    
+
     return $filelist;
 }
 ########################################################################################
@@ -355,15 +353,15 @@
     my ($editfile) = @_;
     my $text;
 
-    if($editfile) {
+    if ($editfile) {
         my $filename = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $editfile;
-        $text .=&editconfig($filename, 'w', $username).
-        $cgi->hidden(-name => 'editfile', -default => $filename ) ;
+        $text .= &editconfig($filename, 'w', $username) .
+                 $cgi->hidden(-name => 'editfile', -default => $filename );
     } else {
         $text .= "<font color=red>Missing filename<br><br>\n" .
-        $cgi->submit(-name => 'dialog_mainw', -value => 'Back') ;
+                 $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
     }
-    
+
     return $text;
 }
 ########################################################################################
@@ -372,14 +370,14 @@
 ########################################################################################
 sub save {
 ########################################################################################
-    my ( $file, $edittext) = @_;
+    my ($file, $edittext) = @_;
     my $text = '';
-    my $fileout; 
+    my $fileout;
 
     $text= "<font size=+2>" .
-    "Save File: $file<br><br>\n" .
-    "</font>" .
-    "<br><br>" ;
+           "Save File: $file<br><br>\n" .
+           "</font>" .
+           "<br><br>";
 
     $fileout = IO::File->new(">$file");
     if (defined $fileout) {
@@ -388,11 +386,11 @@
         $form = 'mainw';
         goto NEXTFORM;
     } else {
-        $text .= "<font color=red>Cannot save file<br><br>\n" ;
+        $text .= "<font color=red>Cannot save file<br><br>\n";
     }
 
     $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
-    
+
     return $text;
 }
 ########################################################################################
@@ -401,15 +399,15 @@
 ########################################################################################
 sub view {
 ########################################################################################
-    my ($file) = @_; 
+    my ($file) = @_;
     my $text;
-    
+
     if ($file) {
         my $filename = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $cgi->param('templatelist');
         $text .= &editconfig($filename, 'r', $username);
     } else {
         $text .= "<font color=red>Missing filename<br><br>\n" .
-        $cgi->submit(-name => 'dialog_mainw', -value => 'Back') ;
+        $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
     }
     return $text;
 }
@@ -419,7 +417,7 @@
 #########################################################################################
 sub new {
 ########################################################################################
-    my ( $dirname, $user ) = @_;
+    my ($dirname, $user) = @_;
     my $text = '';
 
     $text= "<font size=+2>" .
@@ -449,14 +447,14 @@
     " </td>" .
     " </tr>" .
     "<tr><td><br></td></tr>" .
-    "  <tr>" . 
+    "  <tr>" .
     "<td></td>" .
     "    <td colspan=2 align=left>" .
     $cgi->submit(-name => 'dialog_mainw', -value => 'Back') .
     $cgi->submit(-name => 'dialog_newf', -value => 'Create') .
     "    </td>" .
-    "  </tr>" . 
-    "</table>"; 
+    "  </tr>" .
+    "</table>";
 
     return $text;
 }
@@ -467,7 +465,7 @@
 ########################################################################################
 sub newfile {
 ########################################################################################
-    my ( $dirname, $user, $newfilename, $newrights ) = @_;
+    my ($dirname, $user, $newfilename, $newrights) = @_;
     my $text = '';
     my $newpath = $dirname . "/" . $user . "/" . $newfilename;
     my $filesinpath = &readdir($dirname . "/" . $user . "/");
@@ -476,31 +474,33 @@
     my $filerights = '';
 
     $text= "<font size=+2>" .
-    "Creating New File: $newfilename <br><br>" .
-    "</font><br><br><br>" ;
+           "Creating New File: $newfilename <br><br>" .
+           "</font><br><br><br>";
     foreach (@filesinpatharray) {
-        if ( $_ eq $newfilename) { $canwrite = 0; };
+        if ($_ eq $newfilename) {
+            $canwrite = 0;
+        };
     }
-    if ( $canwrite ) {
-        if ($newrights eq "private" ) {
+    if ($canwrite) {
+        if ($newrights eq "private") {
             $filerights = '';
-        } elsif ($newrights eq "protected" ) {
+        } elsif ($newrights eq "protected") {
             $filerights = "r";
-        } elsif ($newrights eq "public" ) {
+        } elsif ($newrights eq "public") {
             $filerights = "rw";
         } else {
-            die "Unknown file rights";   
+            die "Unknown file rights";
         }
         $text .= "Creating the new file $newpath<br><br>";
         system("touch $newpath") && die "Cannot create new file";
         $text .= "Setting new file rights for $newpath<br><br>";
         system("chmod u=rw $newpath") && die "Cannot set new file rights";
         system("chmod o=$filerights $newpath") && die "Cannot set new file rights";
-        $text .= "<br><br><br>" ;
+        $text .= "<br><br><br>";
         $form = 'mainw';
         goto NEXTFORM;
     } else {
-        $text .= "<font color=red>Cannot write file. File exists<br><br>\n" ;
+        $text .= "<font color=red>Cannot write file. File exists<br><br>\n";
     }
     $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
 
@@ -512,34 +512,33 @@
 ########################################################################################
 sub config_rights {
 ########################################################################################
-    my ( $namefile ) = @_; 
+    my ($namefile) = @_;
     my $text = '';
     my $defaultright = '';
     my $confname = '';
-    
+
     my $filerights = (stat($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $namefile))[2] & 07;
-  
-     
+
     if ($namefile ne '') {
-        if ( $filerights == 6 ) {
-            $defaultright = "public" ;     
-        } elsif ( $filerights == 4 ) {
-            $defaultright = "protected" ;
+        if ($filerights == 6) {
+            $defaultright = "public" ;
+        } elsif ($filerights == 4) {
+            $defaultright = "protected";
         } else {
-            $defaultright = "private" ;
+            $defaultright = "private";
         }
 
         $text .= "<font size=+2>" .
-        "Changing rights of file:<br><br>" ;
-   
+                 "Changing rights of file:<br><br>";
+
         $namefile =~ m{^([a-zA-Z0-9!"£$%^&*()-_=+#~]+)/(.+)}sg;
         if ($1 eq $username) {
             $text .= "<table>" .
             "<tr>" .
-            " <td>" . 
+            " <td>" .
             "$namefile<br>" .
             " </td>" .
-            " <td>" . 
+            " <td>" .
             $cgi->scrolling_list(
                 -name => 'changerights',
                 -value => ['private', 'protected', 'public'],
@@ -553,17 +552,19 @@
             $cgi->submit(-name => 'dialog_mainw', -value => 'Back') .
             $cgi->submit(-name => 'dialog_changer', -value => 'Set_rights');
             $confname = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $namefile;
-            $text .= $cgi->hidden(-name => 'filename', -default => $namefile ) ; 
-        } else {
+            $text .= $cgi->hidden(-name => 'filename', -default => $namefile ) ;
+        }
+        else {
             $text .= "<font color=red>You can only change file rights in your own directory<br><br>\n" .
-            $cgi->submit(-name => 'dialog', -value => 'Back');
+                     $cgi->submit(-name => 'dialog', -value => 'Back');
         }
-    } else {
+    }
+    else {
         $text .= "<font color=red>Missing filename<br><br>\n" .
-        $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
+                 $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
     }
 
-   return $text;
+    return $text;
 }
 ########################################################################################
 
@@ -571,22 +572,25 @@
 ########################################################################################
 sub change_rights {
 ########################################################################################
-    my ( $filename, $newrights ) = @_;
+    my ($filename, $newrights) = @_;
     my $text = '';
     my $filerights = '';
 
-    $text= "<font size=+2>" .
-    "Changing rights of file:<br>" .
-    "</font>" .
-    "<br><font size=+1> $filename </font> to <font size=+1> $newrights </font><br>";
-    if ($newrights eq "private" ) {
-           $filerights = '';
-    } elsif ($newrights eq "protected" ) {
-           $filerights = "r";
-    } elsif ($newrights eq "public" ) {
-           $filerights = "rw";
-    } else {
-           die "Unknown file rights";
+    $text = "<font size=+2>" .
+            "Changing rights of file:<br>" .
+            "</font>" .
+            "<br><font size=+1> $filename </font> to <font size=+1> $newrights </font><br>";
+    if ($newrights eq "private") {
+        $filerights = '';
+    }
+    elsif ($newrights eq "protected") {
+        $filerights = "r";
+    }
+    elsif ($newrights eq "public") {
+        $filerights = "rw";
+    }
+    else {
+        die "Unknown file rights";
     }
     system("chmod o=$filerights $filename") && die "Cannot set new file rights";
     $form = 'mainw';
@@ -600,13 +604,11 @@
 ########################################################################################
 sub copy_file {
 ########################################################################################
-    my ( $filename ) = @_;
+    my ($filename) = @_;
     my $text = '';
-    
-
 
     if ($filename) {
-        my $srcfile = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $filename; 
+        my $srcfile = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $filename;
         $text .= $cgi->hidden(-name => 'srcfile', -default => $srcfile ) .
         "<font size=+1>" .
         "Copying File:<br>" .
@@ -620,7 +622,7 @@
         "  <td>Destinationfile</td>" .
         " </tr>" .
         " <tr>" .
-        "  <td>$srcfile</td>" . 
+        "  <td>$srcfile</td>" .
         "  <td>" .
         "   <table>" .
         "   <tr>" .
@@ -643,18 +645,19 @@
         " <td>" .
         " <td>" .
         $cgi->submit(-name => 'dialog_mainw', -value => 'Back').
-        " </td>" .    
+        " </td>" .
         " <td>" .
         $cgi->submit(-name => 'dialog_copy', -value => 'Copy').
-        " </td>" .    
-        " </td>" .    
+        " </td>" .
+        " </td>" .
         "</table>" ;
-    } else {
+    }
+    else {
         $text .= "<font color=red>Missing filename<br><br>\n" .
-        $cgi->submit(-name => 'dialog_mainw', -value => 'Back') ;
+                 $cgi->submit(-name => 'dialog_mainw', -value => 'Back') ;
     }
 
-    return $text; 
+    return $text;
 }
 ########################################################################################
 
@@ -662,31 +665,31 @@
 ########################################################################################
 sub del {
 ########################################################################################
-    my ( $delfile ) = @_;
+    my ($delfile) = @_;
     my $text = '';
 
     if ($delfile) {
         my $fpath = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $delfile;
-
-        $text= "<font size=+2>" .
-        "Delete File: $fpath<br><br>\n" .
-        "</font>" .
-        "<br><br>" ;
+        $text = "<font size=+2>" .
+                "Delete File: $fpath<br><br>\n" .
+                "</font>" .
+                "<br><br>";
         $delfile =~ m{^([a-zA-Z0-9!"<A3>$%^&*()-_=+#~]+)/(.+)}sg;
-        if ( $1 eq $username ) {
+        if ($1 eq $username) {
             system("rm $fpath") && die "Cannot delete file";
             $form = 'mainw';
             goto NEXTFORM;
-        } else {
-            $text .= "<font color=red>You can only delete file in your own directory<br><br>\n" ;
         }
-    } else {
-        $text .= "<font color=red>Missing filename<br><br>\n" ;
+        else {
+            $text .= "<font color=red>You can only delete file in your own directory<br><br>\n";
+        }
+    }
+    else {
+        $text .= "<font color=red>Missing filename<br><br>\n";
     }
 
-    
-    $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back') ;
-    
+    $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
+
     return $text;
 }
 ########################################################################################
@@ -695,7 +698,7 @@
 ########################################################################################
 sub run {
 ########################################################################################
-    my ( $runfile ) = @_;
+    my ($runfile) = @_;
     my $text = '';
     my $rpath = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $runfile;
     my $rcommand = $cfghash{'ExecuteCommand'};
@@ -704,7 +707,7 @@
     my $outputtext = '';
 
     if ($runfile eq '') {
-        $text .= "<font color=red>No configuration selected <br><br>\n" ;            
+        $text .= "<font color=red>No configuration selected <br><br>\n" ;
         $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
         return $text;
     }
@@ -715,34 +718,35 @@
     }
 
     $text .= "<font size=+2>" .
-    "Running Configuration: $rpath<br><br>\n" .
-    "</font>" .
-    "<br><br>" .
-    "Run command: " . $rcommand . "<br>" ;
+             "Running Configuration: $rpath<br><br>\n" .
+             "</font>" .
+             "<br><br>" .
+             "Run command: " . $rcommand . "<br>";
 
     system("$rcommand > $output 2>&1");
 
     $fileoutput = IO::File->new("<$output");
-    if(defined $fileoutput) {
+    if (defined $fileoutput) {
         while (<$fileoutput>) {
             $outputtext .= $_;
         }
         $fileoutput->close();
 
-        my $outputhash ={   -name => 'outputwindow',
-                            -default => $outputtext,
-                            -rows    => 40,
-                            -columns => 80
+        my $outputhash = {
+            -name => 'outputwindow',
+            -default => $outputtext,
+            -rows    => 40,
+            -columns => 80
         };
-        $outputhash->{readonly}="";
-        $text .= $cgi->textarea($outputhash).
-        "<br>" ;
-     } else {
-         $text .= "<font color=red>Run command not working<br><br>\n" ;            
-     }
-     $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
+        $outputhash->{readonly} = "";
+        $text .= $cgi->textarea($outputhash) . "<br>";
+    }
+    else {
+        $text .= "<font color=red>Run command not working<br><br>\n";
+    }
+    $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
 
-     return $text;
+    return $text;
 }
 ########################################################################################
 
@@ -750,20 +754,20 @@
 ########################################################################################
 sub copy {
 ########################################################################################
-    my ( $srcf, $dstf ) = @_;
+    my ($srcf, $dstf) = @_;
     my $text = '';
 
     $text .= "<font size=+1>" .
-    "Copying File:<br>" .
-    "</font><br><br>" .
-    "Copying from <font size=+1>$srcf</font> to <font size=+1>$dstf</font><br><br>" ;
+             "Copying File:<br>" .
+             "</font><br><br>" .
+             "Copying from <font size=+1>$srcf</font> to <font size=+1>$dstf</font><br><br>";
 
     system("cp $srcf $dstf") && die "Cannot copy file";
     system("chmod o= $dstf") && die "Cannot change file rights";
 
     $form = 'mainw';
-    goto NEXTFORM; 
-    
+    goto NEXTFORM;
+
     return $text;
 }
 ########################################################################################
@@ -772,31 +776,32 @@
 ########################################################################################
 sub read_config {
 ########################################################################################
-    my ($cfgfile) = @_;   
+    my ($cfgfile) = @_;
     my %cfghash ;
     my $cfgin ;
     my $key;
     my $content;
 
-    print "Lese file: $cfgfile\n"; 
+    print "Reading file: $cfgfile\n";
     $cfgin = IO::File->new("<$cfgfile");
 
     if (defined $cfgin) {
-        LOOP: while(<$cfgin>) { 
-            $_ =~ s|^\s+(.*?)|{$_=$1}|es;       # Remove whitespaces at the beginning 
-            next LOOP if $_ =~ /^\n/;           # Remove the first empty require 
+        LOOP: while(<$cfgin>) {
+            $_ =~ s|^\s+(.*?)|{$_=$1}|es;       # Remove whitespaces at the beginning
+            next LOOP if $_ =~ /^\n/;           # Remove the first empty require
             next LOOP if $_ eq "";              # Remove empty line
             next LOOP if $_ =~/^#/;             # Remove comment lines
 
-            $_ =~ s|^([^#]+)#(.*)$|{$_=$1}|es;  # Remove comments on the end 
-            $_ =~ s|(.*?)\s+$|{$_=$1}|es;       # Remove whitespaces at the end 
+            $_ =~ s|^([^#]+)#(.*)$|{$_=$1}|es;  # Remove comments on the end
+            $_ =~ s|(.*?)\s+$|{$_=$1}|es;       # Remove whitespaces at the end
 
             ($key, $content) =  /^(\w+)\s+(.*)$/;
 
             $cfghash{$key} = $content;
         }
         $cfgin->close;
-    } else {
+    }
+    else {
         die "Can't open config file";
     }
     return (%cfghash);
@@ -812,10 +817,10 @@
     my $uname;
     my $pwd;
     my $pwdin;
- 
+
     $pwdin = IO::File->new("<$pwdfile");
     if(defined $pwdin) {
-        while(<$pwdin>) {
+        while (<$pwdin>) {
             $_ =~ s|^(\w+):(.+)$|{$uname=$1; $pwd=$2}|eg;
             ( $uname =~ $user ) && do {     # check the password
                 if (crypt($password, $pwd) eq $pwd){
@@ -824,9 +829,7 @@
             }
         }
     }
-
     $pwdin->close();
-
     return $returnvalue;
 }
 ########################################################################################
@@ -835,17 +838,16 @@
 ########################################################################################
 sub readsubdir {
 ########################################################################################
-    my ( $dir ) = @_;
+    my ($dir) = @_;
     my $filestring = "";
     my $direntry = "";
 
-    opendir(DIR, "$dir");       # Open dir for scanning
-    
+    opendir(DIR, "$dir");
     foreach $direntry (readdir(DIR)) {
         next if $direntry eq ".";
         next if $direntry eq "..";
         if (-d "$dir/$direntry") {
-            $filestring .= $direntry. " ";
+            $filestring .= $direntry . " ";
         }
     }
     closedir(DIR);
@@ -857,17 +859,16 @@
 ########################################################################################
 sub readdir {
 ########################################################################################
-    my ( $dir ) = @_;
+    my ($dir) = @_;
     my $filestring = "";
     my $direntry = "";
 
-    opendir(DIR, "$dir");       # Open dir for scanning
-    
+    opendir(DIR, "$dir");
     foreach $direntry (readdir(DIR)) {
         next if $direntry eq ".";
         next if $direntry eq "..";
         if (-f "$dir/$direntry") {
-            $filestring .= $direntry. " ";
+            $filestring .= $direntry . " ";
         }
     }
     closedir(DIR);
@@ -879,10 +880,10 @@
 ########################################################################################
 sub strsort {
 ########################################################################################
-    my ( $sortstr ) = @_;
+    my ($sortstr) = @_;
+
+    my @sortarray = split(/ /, $sortstr);
 
-    my @sortarray = split (/ /, $sortstr);
-     
     @sortarray = reverse sort {$b cmp $a} @sortarray;
     $sortstr = join(" ", @sortarray);
 
@@ -902,49 +903,52 @@
     my $titletext ;
 
     $filein = IO::File->new("<$file");
-    if(defined $filein) {
-        while(<$filein>) { $editf .= $_; }
-        $filein->close(); 
-    } else {
+    if (defined $filein) {
+        while(<$filein>) {
+            $editf .= $_;
+        }
+        $filein->close();
+    }
+    else {
         die "Can't open $file";
     }
-    
+
     if ($mode eq 'w') {
         $titletext = "Edit window";
     } elsif ($mode eq 'r') {
-       $titletext = "View window";
+        $titletext = "View window";
     }
 
-    my $textahash ={ -name => 'editwindow',
-          -default => $editf,
-          -rows    => 40,
-          -columns => 80
+    my $textahash = {
+        -name => 'editwindow',
+        -default => $editf,
+        -rows    => 40,
+        -columns => 80
     };
     if ($mode eq 'r') {
         $textahash->{readonly}="";
     }
     $texte .= "<font size=+2>" .
-    $titletext . ":   <br><br>\n" .
-    "</font>" .
-    "<font size=+1>" .
-    "File: $file<br><br>\n" .
-    "</font>" .
-    $cgi->textarea($textahash).
-    "<br><br>\n" .
-    "<table>" .
-    "  <td>" .
-    "    <td>" .
-    $cgi->submit(-name => 'dialog_mainw', -value => 'Back') .
-    "   </td>";
+              $titletext . ":   <br><br>\n" .
+              "</font>" .
+              "<font size=+1>" .
+              "File: $file<br><br>\n" .
+              "</font>" .
+              $cgi->textarea($textahash).
+              "<br><br>\n" .
+              "<table>" .
+              "  <td>" .
+              "    <td>" .
+              $cgi->submit(-name => 'dialog_mainw', -value => 'Back') .
+              "   </td>";
     if ($mode eq 'w') {
-    $texte .= "   <td>" .
-    $cgi->submit(-name => 'dialog_save', -value => 'Save') .
-    "   </td>";
+        $texte .= "   <td>" .
+                  $cgi->submit(-name => 'dialog_save', -value => 'Save') .
+                  "   </td>";
     }
     $texte .= "  <td>" .
-    " </td>" .
-    "</table>" ;
-
+              " </td>" .
+              "</table>";
     return $texte;
 }
 ########################################################################################

CVSTrac 2.0.1