OSSP CVS Repository

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

ossp-pkg/tabea/tabea.cgi 1.21 -> 1.22

--- tabea.cgi    2002/05/16 15:54:59     1.21
+++ tabea.cgi    2002/05/17 08:09:07     1.22
@@ -91,49 +91,60 @@
 my $password = $cgi->param("password") || "";
 my $filename = $cgi->param("filename") || "";
 
-my $page = '';
+my $form = '';
 
-if ($cfghash{"TabeaUser"} ne '') {
+for my $name (qw(mainw copyt view new copyc edit del run confr newf changer copy save)) {
+    my $val = $cgi->param("dialog_$name") || "";
+    if ($val ne '') {
+        $form = $name;
+    }
+}
+    
+my $page = $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1));
 
-if ($dialog eq "") {
+#if ($dialog eq "") {
+if ($form eq '') {
+#    if ($form eq "mainw") {
+#        $page .= "Form new is login<br><br>";
+#    }
     $page .= 
-        $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) .
-        "<table cellspacing=0 cellpadding=0>" .
-        "  <tr>" .
-        "    <td>Username:</td>" .
-        "    <td>" .
-        $cgi->textfield(
-            -name => 'username',
-            -default => $username,
-            -size => 20,
-            -maxlength => 8
-        ) .
-        "    </td>" .
-        "  </tr>" .
-        "  <tr>" .
-        "    <td>Password:</td>" .
-        "    <td>" .
-        $cgi->password_field(
-            -name => 'password',
-            -value => $password,
-            -size => 20,
-            -maxlength => 80
-        ) .
-        "    </td>" .
-        "  </tr>" .
-        "  <tr>" .
-        "    <td colspan=2 align=right>" .
-        $cgi->reset() .
-        $cgi->submit(-name => 'dialog', -value => 'login') .
-        "    </td>" .
-        "  </tr>" .
-        "</table>" .
-        $cgi->endform;
+    "<table cellspacing=0 cellpadding=0>" .
+    "  <tr>" .
+    "    <td>Username:</td>" .
+    "    <td>" .
+    $cgi->textfield(
+        -name => 'username',
+        -default => $username,
+        -size => 20,
+        -maxlength => 8
+    ) .
+    "    </td>" .
+    "  </tr>" .
+    "  <tr>" .
+    "    <td>Password:</td>" .
+    "    <td>" .
+    $cgi->password_field(
+        -name => 'password',
+        -value => $password,
+        -size => 20,
+        -maxlength => 80
+    ) .
+    "    </td>" .
+    "  </tr>" .
+    "  <tr>" .
+    "    <td colspan=2 align=right>" .
+    $cgi->reset() .
+    $cgi->submit(-name => 'dialog_mainw', -value => 'login') .
+    "    </td>" .
+    "  </tr>" .
+    "</table>" ;
 }
-elsif (($dialog eq 'login') || ($dialog eq 'Back')) {
+#elsif (($dialog eq 'login') || ($dialog eq 'Back')) {
+elsif ($form eq 'mainw') {
     #   enter Select form
     
-    &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);
@@ -145,126 +156,106 @@
     
     my @templatesarray = split(/ /,$templatesfiles);
     my @configsarray = split(/ /,$configsfiles);
-    
-    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) .
+           
+    $page .= 
     $cgi->hidden(-name => 'password', -default => $password ) .
-        # Begin with templates part         
-        "<font size=+1>" .
-        "<br> Active User: $username<br><br>\n" .
-        "</font>" .
-        "<table> <caption>Templates</caption>" .
-        "  <td>" . 
-        "    <td>" .
-        $cgi->scrolling_list(
-            -name => 'templatelist',
-            -value => [@templatesarray],
-            -size => 3
-        ) .
-        "   </td>" .
-        "  <td>" .
-        "    <table>" .
-        "   <td>" .
-        "   <tr>" .
-        "     <td>" .
-        $cgi->submit(-name => 'dialog', -value => 'Copy_Temp') .
-        "     </td>" .
-        "   </tr>" .
-        "   <tr>" .
-        "     <td>" .
-        $cgi->submit(-name => 'dialog', -value => 'View') .
-        "     </td>" .
-        "   </tr>" .
-        "   </td>" .
-        "   </table>" .
-        "   </td>" .
-        "   </table>" .
-        " </td>" .
-        "</table>" .
-
-# Now the configuration part         
-        "<br><br>" .
-        "<table> <caption>Configuration</caption>" .
-        "<td>" .
-        "    <td>" .
-        $cgi->scrolling_list(
-            -name => 'configslist',
-            -value => [@configsarray],
-            -size => 10
-        ) .
-        "   </td>" .
-        "   <td>" .
-        "     <table>" .
-
-        "      <tr><td>" .
-        $cgi->submit(-name => 'dialog', -value => 'New') .
-        "      </td></tr>" .
-
-        "      <tr><td>" .
-        $cgi->submit(-name => 'dialog', -value => 'Copy_Conf') .
-        "      </td></tr>" .
-
-        "      <tr><td>" .
-        $cgi->submit(-name => 'dialog', -value => 'Edit') .
-        "      </td></tr>" .
-
-        "      <tr><td>" .
-        $cgi->submit(-name => 'dialog', -value => 'Del') .
-        "      </td></tr>" .
-
-        "      <tr><td>" .
-        $cgi->submit(-name => 'dialog', -value => 'Run') .
-        "      </td></tr>" .
-
-        "      <tr><td>" .
-        $cgi->submit(-name => 'dialog', -value => 'Config_rights') .
-        "      </td></tr>" .
-
-        "    </table>" .
-        "  </td>" .
-        "<td>" .
-        "</table>" ;
-
-
-        $page .= $cgi->endform;  
-
+    # Begin with templates part         
+    "<font size=+1>" .
+    "<br> Active User: $username<br><br>\n" .
+    "</font>" .
+    "<table> <caption>Templates</caption>" .
+    "  <td>" . 
+    "    <td>" .
+    $cgi->scrolling_list(
+        -name => 'templatelist',
+        -value => [@templatesarray],
+        -size => 3
+    ) .
+    "   </td>" .
+    "  <td>" .
+    "    <table>" .
+    "   <td>" .
+    "   <tr>" .
+    "     <td>" .
+    $cgi->submit(-name => 'dialog_view', -value => 'View') .
+    "     </td>" .
+    "   </tr>" .
+    "   <tr>" .
+    "     <td>" .
+    $cgi->submit(-name => 'dialog_copyt', -value => 'Copy') .
+    "     </td>" .
+    "   </tr>" .
+    "   </td>" .
+    "   </table>" .
+    "   </td>" .
+    "   </table>" .
+    " </td>" .
+    "</table>" .
+    # Now the configuration part         
+    "<br><br>" .
+    "<table> <caption>Configuration</caption>" .
+    "<td>" .
+    "    <td>" .
+    $cgi->scrolling_list(
+        -name => 'configslist',
+        -value => [@configsarray],
+        -size => 10
+    ) .
+    "   </td>" .
+    "   <td>" .
+    "     <table>" .
+    "      <tr><td>" .
+    $cgi->submit(-name => 'dialog_new', -value => 'New') .
+    "      </td></tr>" .
+    "      <tr><td>" .
+    $cgi->submit(-name => 'dialog_del', -value => 'Del') .
+    "      </td></tr>" .
+    "      <tr><td>" .
+    $cgi->submit(-name => 'dialog_edit', -value => 'Edit') .
+    "      </td></tr>" .
+    "      <tr><td>" .
+    $cgi->submit(-name => 'dialog_copyc', -value => 'Copy') .
+    "      </td></tr>" .
+    "      <tr><td>" .
+    $cgi->submit(-name => 'dialog_confr', -value => 'Rights') .
+    "      </td></tr>" .
+    "      <tr><td>" .
+    $cgi->submit(-name => 'dialog_run', -value => 'Run') .
+    "      </td></tr>" .
+    "    </table>" .
+    "  </td>" .
+    "<td>" .
+    "</table>" ;
 }
-elsif ($dialog eq 'Edit') {
+elsif ($form eq 'edit') {
     #   enter Edit form
-    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1));
     $page .= &edit($cgi->param('configslist'));
     $page .= $cgi->hidden(-name => 'password', -default => $password ) ;
-    $page .= $cgi->endform;
+    
 } 
-elsif ($dialog eq 'Save') {
+elsif ($form eq 'save') {
     #  enter save form
-    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1));
     $page .= "<br>" . $cgi->param('editfile') . "<br>" ;
     $page .= &save($cgi->param('editfile'), $cgi->param('editwindow'));
     $page .= $cgi->hidden(-name => 'password', -default => $password ) ;
-    $page .= $cgi->endform;
 }
-elsif ($dialog eq 'View') {
+elsif ($form eq 'view') {
     #   enter View form
-    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1));
     $page .= &view($cgi->param('templatelist'));
     $page .= $cgi->hidden(-name => 'password', -default => $password ) ;
-    $page .= $cgi->endform;
 }
-elsif ($dialog eq 'New') {
-    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1));
+elsif ($form eq 'new') {
     $page .= &new($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username);
     $page .= $cgi->hidden(-name => 'password', -default => $password ) ;
-    $page .= $cgi->endform;
 }
-elsif ($dialog eq 'New_file') {
-    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1));
+#elsif ($dialog eq 'New_file') {
+elsif ($form eq 'newf') {
     $page .= &newfile($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username, $cgi->param('newfile'), 
                       $cgi->param('new_rights'));
     $page .= $cgi->hidden(-name => 'password', -default => $password ) ;
-    $page .= $cgi->endform;
 }
-elsif ($dialog eq 'Config_rights') {
-    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1));
+#elsif ($dialog eq 'Config_rights') {
+elsif ($form eq 'confr') {
     my $configfile;        
     if (! defined $cgi->param('configslist') ) {
         $configfile = '';
@@ -273,53 +264,40 @@
     }
     $page .= &config_rights($configfile, $username);
     $page .= $cgi->hidden(-name => 'password', -default => $password ) ;
-    $page .= $cgi->endform;
 }
-elsif ($dialog eq 'Change_rights') {
-    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1));
+#elsif ($dialog eq 'Change_rights') {
+elsif ($form eq 'changer') {
     $page .= &change_rights($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" .  $cgi->param('filename'), 
                             $cgi->param('changerights') );
     $page .= $cgi->hidden(-name => 'password', -default => $password ) ;
-    $page .= $cgi->endform;
 }
-elsif ($dialog eq 'Copy_Temp') {
-    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1));
+#elsif ($dialog eq 'Copy_Temp') {
+elsif ($form eq 'copyt') {
     $page .= &copy_file($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" .$cgi->param('templatelist'), $username );
     $page .= $cgi->hidden(-name => 'password', -default => $password ) ;
-    $page .= $cgi->endform;
 }
-elsif ($dialog eq 'Copy_Conf') {
-    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1));
+#elsif ($dialog eq 'Copy_Conf') {
+elsif ($form eq 'copyc') {
     $page .= &copy_file($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" .$cgi->param('configslist'), $username );
     $page .= $cgi->hidden(-name => 'password', -default => $password ) ;
-    $page .= $cgi->endform;
 }
-elsif ($dialog eq 'Copy' ) {
-    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1));
+elsif ($form eq 'copy' ) {
     $page .= &copy($cgi->param('srcfile'), $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" .  $username . "/". $cgi->param('dstfile'));
     $page .= $cgi->hidden(-name => 'password', -default => $password ) ;
-$page .= $cgi->endform;
 }
-elsif ($dialog eq 'Del' ) {
-    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1));
+elsif ($form eq 'del' ) {
     $page .= &del($cgi->param('configslist'), $username );
     $page .= $cgi->hidden(-name => 'password', -default => $password ) ;
-    $page .= $cgi->endform;
 }
-elsif ($dialog eq 'Run' ) {
-    $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1));
+elsif ($form eq 'run' ) {
     $page .= &run($cgi->param('configslist') );
     $page .= $cgi->hidden(-name => 'password', -default => $password ) ;
-    $page .= $cgi->endform;
 }
 else {
     die "no correct dialog found";
 }
 
-
-} else {
-    die "no configuration found";
-}
+$page .= $cgi->endform;
 
 my $out = $MY->{TEMPLATE};
 $out =~ s|%%BODY%%|$page|s;
@@ -353,13 +331,13 @@
             next FILE if  (((stat($dirname . "/" . $subdir . "/" . $entry))[2]) & 07)  !=  $rights;
             $filelist .= $subdir . "/" . $entry . " ";
         }
-   }
-
+    }
     
     return $filelist;
 }
 ########################################################################################
 
+
 ########################################################################################
 sub get_own_files {
 ########################################################################################
@@ -384,9 +362,6 @@
 ########################################################################################
     my ($editfile) = @_;
     my $text;
-    #   enter Edit form
-   
- 
 
     if($editfile) {
         my $filename = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $editfile;
@@ -394,13 +369,14 @@
         $cgi->hidden(-name => 'editfile', -default => $filename ) ;
     } else {
         $text .= "<font color=red>Missing filename<br><br>\n" .
-        $cgi->submit(-name => 'dialog', -value => 'Back') ;
+        $cgi->submit(-name => 'dialog_mainw', -value => 'Back') ;
     }
     
     return $text;
 }
 ########################################################################################
 
+
 ########################################################################################
 sub save {
 ########################################################################################
@@ -421,12 +397,13 @@
         $text .= "<font color=red>Cannot save file<br><br>\n" ;
     }
 
-    $text .= $cgi->submit(-name => 'dialog', -value => 'Back');
+    $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
     
     return $text;
 }
 ########################################################################################
 
+
 ########################################################################################
 sub view {
 ########################################################################################
@@ -438,7 +415,7 @@
         $text .= &editconfig($filename, 'r', $username);
     } else {
         $text .= "<font color=red>Missing filename<br><br>\n" .
-        $cgi->submit(-name => 'dialog', -value => 'Back') ;
+        $cgi->submit(-name => 'dialog_mainw', -value => 'Back') ;
     }
     return $text;
 }
@@ -454,7 +431,6 @@
     $text= "<font size=+2>" .
     "New File:<br><br>\n" .
     "</font>" .
-
     "<table spacing=0 cellpadding=0>" .
     "  <tr>" .
     "    <td>New Filename: $dirname " . "/" . "$user" . "/" . "</td>" .
@@ -471,12 +447,6 @@
     "<tr><td><br></td></tr>" .
     "<td></td>" .
     " <td align=left>" .
-#    $cgi->checkbox_group(
-#       -name => 'new_rights',
-#       -values => ['private', 'protected', 'public'],
-#       -defaults => 'private',
-#       -linebreak => 'true'
-#    ) .
     $cgi->scrolling_list(
        -name => 'new_rights',
        -value => ['private', 'protected', 'public'],
@@ -488,8 +458,8 @@
     "  <tr>" . 
     "<td></td>" .
     "    <td colspan=2 align=left>" .
-    $cgi->submit(-name => 'dialog', -value => 'Back') .
-    $cgi->submit(-name => 'dialog', -value => 'New_file') .
+    $cgi->submit(-name => 'dialog_mainw', -value => 'Back') .
+    $cgi->submit(-name => 'dialog_newf', -value => 'Create') .
     "    </td>" .
     "  </tr>" . 
     "</table>"; 
@@ -498,6 +468,9 @@
 }
 
 ########################################################################################
+
+
+########################################################################################
 sub newfile {
 ########################################################################################
     my ( $dirname, $user, $newfilename, $newrights ) = @_;
@@ -533,14 +506,13 @@
     } else {
         $text .= "<font color=red>Cannot write file. It exists<br><br>\n" ;
     }
-    $text .= $cgi->submit(-name => 'dialog', -value => 'Back');
+    $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
 
     return $text;
 }
 ########################################################################################
 
 
-
 ########################################################################################
 sub config_rights {
 ########################################################################################
@@ -580,16 +552,15 @@
             "</tr>" .
             "</table>" .
             "<br><br>" .
-            $cgi->submit(-name => 'dialog', -value => 'Back') .
-            $cgi->submit(-name => 'dialog', -value => 'Change_rights');
+            $cgi->submit(-name => 'dialog_mainw', -value => 'Back') .
+            $cgi->submit(-name => 'dialog_changer', -value => 'Set_rights');
         } else {
             $text .= "<font color=red>You can only change file rights in your own directory<br><br>\n" .
             $cgi->submit(-name => 'dialog', -value => 'Back');
         }
     } else {
-
         $text .= "<font color=red>Missing filename<br><br>\n" .
-        $cgi->submit(-name => 'dialog', -value => 'Back');
+        $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
     }
 
    return $text;
@@ -607,7 +578,7 @@
     $text= "<font size=+2>" .
     "Changing rights of file:<br>" .
     "</font>" .
-   "<br><font size=+1> $filename </font> to <font size=+1> $newrights </font><br>";
+    "<br><font size=+1> $filename </font> to <font size=+1> $newrights </font><br>";
     if ($newrights eq "private" ) {
            $filerights = '';
     } elsif ($newrights eq "protected" ) {
@@ -617,10 +588,9 @@
     } else {
            die "Unknown file rights";
     }
-#    $text .= "Name : $filename<br>Rights: $filerights<br>" ;
     system("chmod o=$filerights $filename") && die "Cannot set new file rights";
     $text .= "<br>Done.<br><br>" .
-    $cgi->submit(-name => 'dialog', -value => 'Back');
+    $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
 
     return $text;
 }
@@ -665,17 +635,15 @@
     "<table>" .
     " <td>" .
     " <td>" .
-    $cgi->submit(-name => 'dialog', -value => 'Back').
+    $cgi->submit(-name => 'dialog_mainw', -value => 'Back').
     " </td>" .    
     " <td>" .
-    $cgi->submit(-name => 'dialog', -value => 'Copy').
+    $cgi->submit(-name => 'dialog_copy', -value => 'Copy').
     " </td>" .    
     " </td>" .    
     "</table>" ;
-    
 
     return $text; 
-
 }
 ########################################################################################
 
@@ -698,7 +666,7 @@
         $text .= "<font color=red>You can only delete file in your own directory<br><br>\n" ;
     }
     
-    $text .= $cgi->submit(-name => 'dialog', -value => 'Back');
+    $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
 
     return $text;
 }
@@ -716,14 +684,18 @@
     my $fileoutput;
     my $outputtext = '';
 
+    if ($runfile eq '') {
+        $text .= "<font color=red>No configuration selected <br><br>\n" ;            
+        $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
+        return $text;
+    }
     $rcommand =~ s|%{profile}%|$rpath|s;
 
     if (-e $output) {
         system("/bin/rm $output");
     }
 
-
-    $text= "<font size=+2>" .
+    $text .= "<font size=+2>" .
     "Running Configuration: $rpath<br><br>\n" .
     "</font>" .
     "<br><br>" .
@@ -744,12 +716,14 @@
                             -columns => 80
         };
         $outputhash->{readonly}="";
-        $text .= $cgi->textarea($outputhash);
+        $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');
 
-     $text .= $cgi->submit(-name => 'dialog', -value => 'Back');
+     return $text;
 }
 ########################################################################################
 
@@ -768,59 +742,52 @@
     system("cp $srcf $dstf") && die "Cannot copy file";
     system("chmod o= $dstf") && die "Cannot change file rights";
 
-    $text .= $cgi->submit(-name => 'dialog', -value => 'Back');
+    $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back');
 
     return $text;
 }
 ########################################################################################
 
 
-
-
 ########################################################################################
 sub read_config {
 ########################################################################################
+    my ($cfgfile) = @_;   
+    my %cfghash ;
+    my $cfgin ;
+    my $key;
+    my $content;
+
+    print "Lese 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 
+            next LOOP if $_ eq "";              # Remove empty line
+            next LOOP if $_ =~/^#/;             # Remove comment lines
 
-my ($cfgfile) = @_;   
-my %cfghash ;
-my $cfgin ;
-my $key;
-my $content;
-
-print "Lese 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 
-        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+(.*)$/;
 
-        ($key, $content) =  /^(\w+)\s+(.*)$/;
-
-        $cfghash{$key} = $content;
+            $cfghash{$key} = $content;
+        }
+        $cfgin->close;
+    } else {
+        die "Can't open config file";
     }
-    $cfgin->close;
-}
-
-return (%cfghash);
+    return (%cfghash);
 }
 ########################################################################################
 
 
-
 ########################################################################################
 sub validpassword {
 ########################################################################################
     my ($user, $password) = @_;
-
     my $returnvalue = 0;
     my $uname;
     my $pwd;
@@ -852,8 +819,6 @@
     my $filestring = "";
     my $direntry = "";
 
-
-
     opendir(DIR, "$dir");       # Open dir for scanning
     
     foreach $direntry (readdir(DIR)) {
@@ -866,8 +831,7 @@
     closedir(DIR);
     return $filestring;
 }
-
-
+########################################################################################
 
 
 ########################################################################################
@@ -877,8 +841,6 @@
     my $filestring = "";
     my $direntry = "";
 
-
-
     opendir(DIR, "$dir");       # Open dir for scanning
     
     foreach $direntry (readdir(DIR)) {
@@ -909,23 +871,24 @@
 ########################################################################################
 
 
-
-
-
 ########################################################################################
 sub editconfig {
 ########################################################################################
     my ($file, $mode, $user) = @_;
-    my $text = '';
+    my $texte = '';
     my $filein ;
+    my $editf = '';
     my $readonly ;
     my $titletext ;
 
     $filein = IO::File->new("<$file");
-    while(<$filein>) { $text .= $_; }
-    $filein->close(); 
-
-
+    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') {
@@ -933,15 +896,14 @@
     }
 
     my $textahash ={ -name => 'editwindow',
-          -default => $text,
+          -default => $editf,
           -rows    => 40,
           -columns => 80
     };
     if ($mode eq 'r') {
         $textahash->{readonly}="";
     }
-    $text .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) .
-    "<font size=+2>" .
+    $texte .= "<font size=+2>" .
     $titletext . ":   <br><br>\n" .
     "</font>" .
     "<font size=+1>" .
@@ -952,17 +914,17 @@
     "<table>" .
     "  <td>" .
     "    <td>" .
-    $cgi->submit(-name => 'dialog', -value => 'Back') .
+    $cgi->submit(-name => 'dialog_mainw', -value => 'Back') .
     "   </td>";
     if ($mode eq 'w') {
-    $text .= "   <td>" .
-    $cgi->submit(-name => 'dialog', -value => 'Save') .
+    $texte .= "   <td>" .
+    $cgi->submit(-name => 'dialog_save', -value => 'Save') .
     "   </td>";
     }
-    $text .= "  <td>" .
+    $texte .= "  <td>" .
     " </td>" .
     "</table>" ;
 
-    return $text;
+    return $texte;
 }
 ########################################################################################

CVSTrac 2.0.1