head 1.38; access; symbols; locks; strict; comment @# @; 1.38 date 2002.07.26.14.54.19; author ps; state Exp; branches; next 1.37; 1.37 date 2002.07.16.14.49.09; author ps; state Exp; branches; next 1.36; 1.36 date 2002.07.10.13.53.44; author ps; state Exp; branches; next 1.35; 1.35 date 2002.07.09.15.08.02; author ps; state Exp; branches; next 1.34; 1.34 date 2002.07.05.13.06.35; author ps; state Exp; branches; next 1.33; 1.33 date 2002.07.05.12.43.08; author ps; state Exp; branches; next 1.32; 1.32 date 2002.07.05.12.05.31; author ps; state Exp; branches; next 1.31; 1.31 date 2002.06.28.15.02.08; author ps; state Exp; branches; next 1.30; 1.30 date 2002.06.27.15.57.10; author ps; state Exp; branches; next 1.29; 1.29 date 2002.06.20.15.09.05; author ps; state Exp; branches; next 1.28; 1.28 date 2002.06.14.14.53.08; author ps; state Exp; branches; next 1.27; 1.27 date 2002.06.14.13.42.32; author ps; state Exp; branches; next 1.26; 1.26 date 2002.05.17.18.36.58; author rse; state Exp; branches; next 1.25; 1.25 date 2002.05.17.18.34.13; author rse; state Exp; branches; next 1.24; 1.24 date 2002.05.17.18.28.01; author rse; state Exp; branches; next 1.23; 1.23 date 2002.05.17.13.00.04; author ps; state Exp; branches; next 1.22; 1.22 date 2002.05.17.08.09.07; author ps; state Exp; branches; next 1.21; 1.21 date 2002.05.16.15.54.59; author ps; state Exp; branches; next 1.20; 1.20 date 2002.05.16.12.22.05; author ps; state Exp; branches; next 1.19; 1.19 date 2002.05.15.15.34.06; author ps; state Exp; branches; next 1.18; 1.18 date 2002.05.15.13.04.20; author ps; state Exp; branches; next 1.17; 1.17 date 2002.05.15.11.47.41; author ps; state Exp; branches; next 1.16; 1.16 date 2002.05.14.15.34.02; author ps; state Exp; branches; next 1.15; 1.15 date 2002.05.14.14.06.21; author ps; state Exp; branches; next 1.14; 1.14 date 2002.05.13.16.28.28; author ps; state Exp; branches; next 1.13; 1.13 date 2002.05.13.13.05.56; author ps; state Exp; branches; next 1.12; 1.12 date 2002.05.10.15.41.18; author ps; state Exp; branches; next 1.11; 1.11 date 2002.05.10.12.27.56; author ps; state Exp; branches; next 1.10; 1.10 date 2002.05.10.07.38.47; author rse; state Exp; branches; next 1.9; 1.9 date 2002.05.08.15.59.21; author ps; state Exp; branches; next 1.8; 1.8 date 2002.05.08.07.38.18; author ps; state Exp; branches; next 1.7; 1.7 date 2002.05.07.14.30.56; author ps; state Exp; branches; next 1.6; 1.6 date 2002.05.07.12.58.21; author ps; state Exp; branches; next 1.5; 1.5 date 2002.04.16.12.09.46; author ps; state Exp; branches; next 1.4; 1.4 date 2002.04.16.08.51.02; author rse; state Exp; branches; next 1.3; 1.3 date 2002.04.16.08.37.21; author ps; state Exp; branches; next 1.2; 1.2 date 2002.04.15.14.45.23; author rse; state Exp; branches; next 1.1; 1.1 date 2002.04.15.09.39.04; author rse; state Exp; branches; next ; desc @@ 1.38 log @Redesign of HTML output @ text @#!/usr/opkg/bin/perl -w ## ## OSSP tabea - Web Configuration Editor ## Copyright (c) 2001-2002 The OSSP Project ## Copyright (c) 2001-2002 Cable & Wireless Deutschland ## ## This file is part of OSSP tabea, a web configuration editor ## which can be found at http://www.ossp.org/pkg/tool/tabea/. ## ## Permission to use, copy, modify, and distribute this software for ## any purpose with or without fee is hereby granted, provided that ## the above copyright notice and this permission notice appear in all ## copies. ## ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ## SUCH DAMAGE. ## ## tabea.cgi: Tabea CGI (syntax: Perl) ## require 5.000; use strict; use IO; use CGI; $|++; my $cfgfile = "./tabea.cfg"; # establish CGI query object my $cgi = new CGI; # activate a general error handler $SIG{__DIE__} = sub { my ($err) = @@_; #$err =~ s|at\s+\S+\s+line\s+(\d+)|(line $1)|s; $err =~ s|\n|
\n|sg; print STDOUT $cgi->header(-expires => '+1s') . "Tabea :: ERROR", "

Tabea :: ERROR

\n" . "
$err
\n"; exit(0); }; # update cookies my $cookies = []; foreach my $param (qw(username)) { # FIXME! if ($cgi->param($param) ne '' and ($cgi->param($param) ne $cgi->cookie($param))) { push(@@{$cookies}, $cgi->cookie( -name => $param, -value => $cgi->param($param), -expires => '+1d', -path => $cgi->url(-absolute => 1), -secure => 0 )); } if ($cgi->param($param) eq '' and $cgi->cookie($param) ne '') { $cgi->param(-name => $param, -value => [$cgi->cookie($param)]); } } # Read the configuration my %cfghash = &read_config($cfgfile); # Get HTML Header my $MY = {}; $MY->{TEMPLATE} = ''; my $fh = new IO::File ("<".$cfghash{'BaseDir'} . $cfghash{'PageTemplate'}) || die; $MY->{TEMPLATE} .= $_ while (<$fh>); $fh->close(); # fetch parameters my $dialog = $cgi->param("dialog") || ""; my $username = $cgi->param("username") || ""; my $password = $cgi->param("password") || ""; my $akt_user = $cgi->param("akt_user") || ""; my $old_password = $cgi->param("old_password") || ""; my $new1_password = $cgi->param("new1_password") || ""; my $new2_password = $cgi->param("new2_password") || ""; my $filename = $cgi->param("filename") || ""; my $headertext = ""; my $form = ''; for my $name (qw(admin cfgedit changepwd changer chpwd confr copy copyc copyt del d2user d3user \ duser edit logout mainw new newf newuser nuser run save view )) { my $val = $cgi->param("dialog_$name") || ""; if ($val ne '') { $form = $name; } } NEXTFORM: my $page = $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)); if ($form eq '') { $page .= &login(); $headertext = "Login"; } elsif ($form eq 'mainw') { $page .= mainw(); $headertext = "Main"; } elsif ($form eq 'edit') { $page .= &edit($cgi->param('configslist')); $headertext = "Edit"; } elsif ($form eq 'save') { $page .= &save($cgi->param('editfile'), $cgi->param('editwindow')); $headertext = "Save"; } elsif ($form eq 'view') { $page .= &view($cgi->param('templatelist')); $headertext = "View"; } elsif ($form eq 'new') { $page .= &new($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username); $headertext = "New File"; } elsif ($form eq 'newf') { $page .= &newfile($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username, $cgi->param('newfile'), $cgi->param('new_rights')); $headertext = "New File"; } elsif ($form eq 'confr') { $page .= &config_rights($cgi->param('configslist')); $headertext = "Config Rights"; } elsif ($form eq 'changer') { $page .= &change_rights($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $cgi->param('filename'), $cgi->param('changerights') ); $headertext = "Config Rights"; } elsif ($form eq 'copyt') { $page .= ©_file($cgi->param('templatelist') ); $headertext = "Copy File"; } elsif ($form eq 'copyc') { $page .= ©_file($cgi->param('configslist')); $headertext = "Copy File"; } elsif ($form eq 'copy' ) { $page .= ©($cgi->param('srcfile'), $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $username . "/". $cgi->param('dstfile')); $headertext = "Copy File"; } elsif ($form eq 'del' ) { $page .= &del($cgi->param('configslist')); $headertext = "Delete File"; } elsif ($form eq 'run' ) { $page .= &run($cgi->param('configslist') ); $headertext = "Run"; } elsif ($form eq 'admin' ) { if ( $cgi->param('username') eq $cfghash{'TabeaUser'}) { $page .= &admin($cgi->param('username') ); $headertext = "Administration"; } else { $page .= &chpwd($cgi->param('username') ); $headertext = "Change Password"; } } elsif ($form eq 'chpwd' ) { if ( $cgi->param('username') eq $cfghash{'TabeaUser'}) { $page .= &chpwd($cgi->param('akt_user') ); $headertext = "Change Password"; } else { $page .= &chpwd($cgi->param('username') ); $headertext = "Change Password"; } } elsif ($form eq 'changepwd' ) { if ( $cgi->param('username') eq $cfghash{'TabeaUser'}) { $page .= &changepwd($cgi->param('akt_user') ); $headertext = "Change Password"; } else { $page .= &changepwd($cgi->param('username') ); $headertext = "Change Password"; } } elsif ($form eq 'nuser' ) { $page .= &nuser(); $headertext = "New User"; } elsif ($form eq 'newuser' ) { $page .= &newuser($cgi->param('akt_user')); $headertext = "New User"; } elsif ($form eq 'duser' ) { $page .= &duser($akt_user); $headertext = "Delete User"; } elsif ($form eq 'd2user' ) { $page .= &d2user($akt_user); $headertext = "Delete New User"; } elsif ($form eq 'd3user' ) { $page .= &d3user($akt_user); $headertext = "Delete New User"; } elsif ($form eq 'cfgedit' ) { $page .= &cfgedit(); $headertext = "Edit Configuration"; } elsif ($form eq 'logout' ) { $cgi->param(-name => 'username', -value => ""); $cgi->param(-name => 'password', -value => ""); $form = ''; goto NEXTFORM; } else { die "no correct dialog found"; } $page .= $cgi->hidden(-name => 'password', -default => $password); $page .= $cgi->hidden(-name => 'username', -default => $username); $page .= $cgi->hidden(-name => 'akt_user', -default => $akt_user); $page .= $cgi->hidden(-name => 'del_u_files', -default => $cgi->param('del_u_files')); $page .= $cgi->endform; my $out = $MY->{TEMPLATE}; $out =~ s|%%BODY%%|$page|s; if ( ! $headertext ) { $headertext .= $cfghash{'StdHeader'}; } $out =~ s|%%TITLE%%|$headertext|s; print STDOUT $cgi->header(-cookie => $cookies, -expires => '+1s') . $out; exit(0); ############### End of main part ####################################################### ######################################################################################## sub login{ ######################################################################################## my $text = ''; $text .= "
" . "" . "". "". "" . " " . " " . " " . " " . " " . " " . " " . " " . " " . " " . " " . " " . "
Login
 
Username:" . $cgi->textfield( -name => 'username', -default => $username, -size => 20, -maxlength => 8 ) . "
Password:" . $cgi->password_field( -name => 'password', -value => $password, -size => 20, -maxlength => 80 ) . "
" . $cgi->reset() . " " . $cgi->submit(-name => 'dialog_mainw', -value => 'login') . "
" . "
" . &logging("Starting Tabea"); return $text; } ######################################################################################## ######################################################################################## sub mainw { ######################################################################################## my $text = ''; # &validpassword($username, $password, $cfghash{'BaseDir'}.$cfghash{'PasswdFile'}) # || print STDOUT $cgi->redirect(-uri => $cgi->url(-full => 1), -type => "text/html"); if (! &validpassword($username, $password, $cfghash{'BaseDir'}.$cfghash{'PasswdFile'}) ) { $cgi->param(-name => 'username', -value => ""); $cgi->param(-name => 'password', -value => ""); &logging("User $username password error"); $form = ''; goto NEXTFORM; } &logging("User $username login successfull"); my $templatesfiles = &get_name_files($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username, 4); my $configsfiles = &get_name_files($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username, 6); $configsfiles .= &get_own_files($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username); $templatesfiles = &strsort($templatesfiles); $configsfiles = &strsort($configsfiles); my @@templatesarray = split(/ /,$templatesfiles); my @@configsarray = split(/ /,$configsfiles); $text .= # Begin with templates part "
" . "

" . "" . "" . "" . "" . "" . "" . "" . "" . "
" . "
" . "" . "" . "Active User:". "" . "". "$username

\n" . "
" . "" . "" . "". "". "
". $cgi->submit(-name => 'dialog_logout', -value => 'Logout') . "
". "
". "

" . "" . "". " " . " " . "
Templates
" . $cgi->scrolling_list( -name => 'templatelist', -value => [@@templatesarray], -size => 3 ) . " " . " " . " " . " " . " " . " " . " " . " " . " " . "
" . "
" . $cgi->submit(-name => 'dialog_view', -value => 'View') . "
" . $cgi->submit(-name => 'dialog_copyt', -value => 'Copy') . "
" . "
" . " " . "" . # Now the configuration part "

" . "" . "". " " . " " . "
Configuration
" . $cgi->scrolling_list( -name => 'configslist', -value => [@@configsarray], -size => 12 ) . " " . " " . " " . " " . " " . " " . " " . " " . " " . "
" . $cgi->submit(-name => 'dialog_new', -value => 'New') . "
" . $cgi->submit(-name => 'dialog_del', -value => 'Del') . "
" . $cgi->submit(-name => 'dialog_edit', -value => 'Edit') . "
" . $cgi->submit(-name => 'dialog_copyc', -value => 'Copy') . "
" . $cgi->submit(-name => 'dialog_confr', -value => 'Rights') . "
" . $cgi->submit(-name => 'dialog_run', -value => 'Run') . "
" . $cgi->submit(-name => 'dialog_admin', -value => 'Admin') . "
" . "
" . "
"; return $text; } ######################################################################################## ######################################################################################## sub get_name_files { ######################################################################################## my ($dirname, $user, $rights) = @@_; my $filel = ''; my @@filelarray; my $filelist = ''; my $subdir = ''; my $filemode = ''; my $entry = ''; my $dirlist = &readsubdir($dirname . "/"); my @@dirarray = split (/ /, $dirlist); DIR: foreach $subdir (@@dirarray) { next DIR if $subdir eq $user; $filel = &readdir($dirname . "/" . $subdir . "/"); @@filelarray = split (/ /, $filel); FILE: foreach $entry (@@filelarray) { my $path = $dirname . "/" . $subdir . "/" . $entry; next FILE if (((stat($dirname . "/" . $subdir . "/" . $entry))[2]) & 07) != $rights; $filelist .= $subdir . "/" . $entry . " "; } } return $filelist; } ######################################################################################## ######################################################################################## sub get_userlist { ######################################################################################## my ($dirname) = @@_; my $ulist = &readsubdir($dirname . "/");; return $ulist; } ######################################################################################## ######################################################################################## sub get_own_files { ######################################################################################## my ($dirname, $user) = @@_; my $filelist = ''; my $entry = ''; my $flist = &readdir($dirname . "/" . $user . "/"); my @@flistarray = split (/ /,$flist); foreach $entry (@@flistarray) { $filelist .= $user . "/" . $entry . " "; } return $filelist; } ######################################################################################## ######################################################################################## sub edit { ######################################################################################## my ($editfile) = @@_; my $text; if ($editfile) { my $filename = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $editfile; $text .= &editconfig($filename, 'w', $username) . $cgi->hidden(-name => 'editfile', -default => $filename ); &logging("Edit file $filename"); } else { $text .= "



" . "
Missing filename


\n" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . "
"; &logging("Missing filename"); } return $text; } ######################################################################################## ######################################################################################## sub save { ######################################################################################## my ($file, $edittext) = @@_; my $text = ''; my $fileout; $text= "" . "Save File: $file

\n" . "
" . "

"; $fileout = IO::File->new(">$file"); if (defined $fileout) { print $fileout $edittext; $fileout->close; if($cgi->param("editfile") =~ ($cfghash{'BaseDir'} . "tabea.cfg") ) { $password = ""; } &logging("Saving $file"); $form = 'mainw'; goto NEXTFORM; } else { $text .= "Cannot save file

\n"; &logging("Cannot save $file"); } $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); return $text; } ######################################################################################## ######################################################################################## sub view { ######################################################################################## my ($file) = @@_; my $text; if ($file) { my $filename = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $cgi->param('templatelist'); $text .= &editconfig($filename, 'r', $username); } else { $text .= "



" . "
" . "Missing filename


\n" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back'). "
" ; } return $text; } ######################################################################################## ######################################################################################### sub new { ######################################################################################## my ($dirname, $user) = @@_; my $text = ''; $text= "
" . "" . "New File

\n" . "
" . "
" . "

" . "
" . "" . " " . " " . " " . " " . " " . "" . "" . " " . " " . "" . " " . " " . "" . " " . "
New Filename: $dirname " . "/" . "$user" . "/" . "" . $cgi->textfield( -name => 'newfile', -default => '', -size => 20, -maxlength => 30 ) . "

" . $cgi->scrolling_list( -name => 'new_rights', -value => ['private', 'protected', 'public'], -size => 1 ) . "

" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . "" . $cgi->submit(-name => 'dialog_newf', -value => 'Create') . "
" . "
" ; return $text; } ######################################################################################## ######################################################################################## sub newfile { ######################################################################################## my ($dirname, $user, $newfilename, $newrights) = @@_; my $text = ''; my $newpath = $dirname . "/" . $user . "/" . $newfilename; my $filesinpath = &readdir($dirname . "/" . $user . "/"); my @@filesinpatharray = split(/ /,$filesinpath); my $canwrite = 1; # true my $filerights = ''; $text= "" . "Creating New File: $newfilename

" . "



"; foreach (@@filesinpatharray) { if ($_ eq $newfilename) { $canwrite = 0; }; } if ($canwrite) { if ($newrights eq "private") { $filerights = ''; } elsif ($newrights eq "protected") { $filerights = "r"; } elsif ($newrights eq "public") { $filerights = "rw"; } else { die "Unknown file rights"; } $text .= "Creating the new file $newpath

"; system("touch $newpath") && die "Cannot create new file"; &logging("Creating new file $newpath"); $text .= "Setting new file rights for $newpath

"; system("chmod u=rw $newpath") && die "Cannot set new file rights"; system("chmod o=$filerights $newpath") && die "Cannot set new file rights"; &logging("Changing filerights of $newpath"); $text .= "


"; $form = 'mainw'; goto NEXTFORM; $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); } else { $text .= "



" . "
" . "Cannot write file. File exists


\n". $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . "
" ; &logging("Cannot write $newpath. File exists"); } return $text; } ######################################################################################## ######################################################################################## sub config_rights { ######################################################################################## 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"; } else { $defaultright = "private"; } $text .= "
" . "" . "Changing Rights of File


\n" . "
" . "
" ; $namefile =~ m{^([a-zA-Z0-9!"£\$%^&*()-_=+#~]+)/(.+)}sg; if ($1 eq $username) { $text .= "



" . "
" . "" . "" . " " . " " . "" . "" . "" . "" . "" . "" . "
" . "$namefile
" . "
" . $cgi->scrolling_list( -name => 'changerights', -value => ['private', 'protected', 'public'], -default => $defaultright, -size => 1 ) . "
" . $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 .= "You can only change file rights in your own directory

\n" . $cgi->submit(-name => 'dialog', -value => 'Back'); &logging("Changing filerights of $namefile not allowed"); } } else { $text .= "



" . "
" . "Missing filename


\n" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . "
" ; &logging("Cannot change rights of empty filename"); } return $text; } ######################################################################################## ######################################################################################## sub change_rights { ######################################################################################## my ($filename, $newrights) = @@_; my $text = ''; my $filerights = ''; $text = "
" . "" . "Changing rights of file:
" . "
" . "
$filename to $newrights
" . "
" ; if ($newrights eq "private") { $filerights = ''; } elsif ($newrights eq "protected") { $filerights = "r"; } elsif ($newrights eq "public") { $filerights = "rw"; } else { die "Unknown file rights"; &logging("Cannot change to unknown file rights"); } system("chmod o=$filerights $filename") && die "Cannot set new file rights"; &logging("Changing file rights of $filename to $newrights"); $form = 'mainw'; goto NEXTFORM; return $text; } ######################################################################################## ######################################################################################## sub copy_file { ######################################################################################## my ($filename) = @@_; my $text = ''; if ($filename) { my $srcfile = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $filename; $text .= $cgi->hidden(-name => 'srcfile', -default => $srcfile ) . "
" . "" . "Copying File
" . "
" . "
". "


" . "
" . "" . " " . " " . " " . " " . " " . " " . "" . " " . " " . "" . " " . "
Sourcefile :$srcfile
Destinationfile:" . " " . " " . " " . " " . " " . "
" . $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $username . "/" . $cgi->textfield( -name=>'dstfile', -default=>'', -size=>30, -maxlength=>80 ) . "
" . "
" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back'). " " . $cgi->submit(-name => 'dialog_copy', -value => 'Copy'). "
" . "
" ; } else { $text .= "



" . "
" . "Missing filename


\n" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . "
" ; } return $text; } ######################################################################################## ######################################################################################## sub del { ######################################################################################## my ($delfile) = @@_; my $text = ''; if ($delfile) { my $fpath = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $delfile; $text = "" . "Delete File: $fpath

\n" . "
" . "

"; $delfile =~ m{^([a-zA-Z0-9!"$%^&*()-_=+#~]+)/(.+)}sg; if ($1 eq $username) { system("rm $fpath") && die "Cannot delete file"; &logging("Deleting $fpath"); $form = 'mainw'; goto NEXTFORM; $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); } else { $text .= "You can only delete file in your own directory

\n"; &logging("Just delete your own files not $fpath"); } } else { $text .= "



" . "
" . "Missing filename


\n" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . "
"; &logging("Missing filename"); } return $text; } ######################################################################################## ######################################################################################## sub run { ######################################################################################## my ($runfile) = @@_; my $text = ''; my $rpath = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $runfile; my $rcommand = $cfghash{'ExecuteCommand'}; my $output = "/tmp/" . $cfghash{'ExecuteTempFile'}; my $fileoutput; my $outputtext = ''; if ($runfile eq '') { $text .= "



" . "
" . "No configuration selected


\n" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . "
" ; &logging("Cannot run configuration without configuration"); return $text; } $rcommand =~ s|%{profile}%|$rpath|s; if (-e $output) { system("/bin/rm $output"); } $text .= "
" . "" . "Running Configuration

\n" . "
" . "
" ; system("$rcommand > $output 2>&1"); &logging("Running command $rcommand"); $fileoutput = IO::File->new("<$output"); if (defined $fileoutput) { while (<$fileoutput>) { $outputtext .= $_; } $fileoutput->close(); my $outputhash = { -name => 'outputwindow', -default => $outputtext, -rows => 40, -columns => 80 }; $outputhash->{readonly} = ""; $text .= "
" ."
". "" . "" . "" . "
" . "Configuration filename:" . "" . $rpath . "
" . "

" . $cgi->textarea($outputhash) . "

" . "" . "" . "" . "" . "
" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . "
" . "
" ; } else { $text .= "
" . "Run command not working

\n" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . "
" ; &logging("Run command $rcommand not working"); } return $text; } ######################################################################################## ######################################################################################## sub admin { ######################################################################################## my ($user) = @@_; my $text; my $userlist = &get_userlist($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}); my @@userlistarray = split(/\s/, $userlist); $akt_user = $username; $text .= "
" . "" . "Administration

\n" . "
" . "
" ; $text .= "


" . "
" . "" . "" . "" . "
". # $cgi->popup_menu( # -name => 'akt_user', # -value => [@@userlistarray], # -default => $username, # ) . "" . "" . "" . "" . "" . "" . "" . "" . "" . "
" . $cgi->submit(-name => 'dialog_nuser', -value => 'New User'). "
" . $cgi->submit(-name => 'dialog_duser', -value => 'Del User'). "
" . "
" . "


" . "" . "" . "" . "
" . $cgi->submit(-name => 'dialog_cfgedit', -value => 'Edit Configuration') . "" . $cgi->submit(-name => 'dialog_chpwd', -value => 'Change Password') . "
" . "

" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . "
" ; return $text; } ######################################################################################## ######################################################################################## sub chpwd { ######################################################################################## my ($user) = @@_; my $ctext; my $texttitle; if ($user =~ $cfghash{'TabeaUser'}) { $texttitle = "Administration: Change Password"; } else { $texttitle = "Change Password"; } $ctext .= "
" . "" . $texttitle . "

\n" . "
" . "
" ; $ctext .= "
" . "" ; if ( (($username eq $cfghash{'TabeaUser'}) && ($user eq $cfghash{'TabeaUser'}) ) || ($username ne $cfghash{'TabeaUser'}) ) { $ctext .= "" . "" . "" . "" . " " . " " . " " ; } $ctext .= " " . " " . " " . " " . " " . " " . " " . " " . " " . " " . " " . "" . "" . "" . "
Changing the password of $user
Old Password:" . $cgi->password_field( -name => 'old_password', -value => $old_password, -size => 20, -maxlength => 80 ) . "
New Password:" . $cgi->password_field( -name => 'new1_password', -value => $new1_password, -size => 20, -maxlength => 80 ) . "
Repeat Password:" . $cgi->password_field( -name => 'new2_password', -value => $new2_password, -size => 20, -maxlength => 80 ) . "
" ; if ( $cgi->param('username') eq $cfghash{'TabeaUser'}) { $ctext .= $cgi->submit(-name => 'dialog_admin', -value => 'Back'); } else { $ctext .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); } $ctext .= "" . $cgi->reset() . $cgi->submit(-name => 'dialog_changepwd', -value => 'Change') . "
" . "
" ; return $ctext; } ######################################################################################## ######################################################################################## sub changepwd { ######################################################################################## my ($user) = @@_; my $cptext; my $valid; my $uname; my $pwd; my $pwdfp; my $pwdfile = $cfghash{'BaseDir'}.$cfghash{'PasswdFile'}; my $pwfiletext; my @@pwarray; my $akt_u_p; &logging("Changing password of user $user"); $valid = &validpassword($user, $old_password, $cfghash{'BaseDir'}.$cfghash{'PasswdFile'}); if ( ($username eq $cfghash{'TabeaUser'}) && ($user ne $cfghash{'TabeaUser'}) ) { $valid = 1; } if ( !$valid ) { $cptext .= "
" . "The password is incorrect.

\n"; &logging("Password is incorrect"); if ( $cgi->param('username') eq $cfghash{'TabeaUser'}) { $cptext .= $cgi->submit(-name => 'dialog_admin', -value => 'Back'); } else { $cptext .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); } $cptext .= "
"; } else { if ($new1_password eq $new2_password) { $pwdfp = IO::File->new("<$pwdfile"); $pwfiletext .= $_ while (<$pwdfp>); @@pwarray = split(/\s/, $pwfiletext); foreach (@@pwarray) { $akt_u_p = $_; $akt_u_p =~ s|^(\w+):(.+)$|{$uname=$1; $pwd=$2}|eg; ( $uname =~ $user ) && do { $_ = $username .":". crypt($new1_password, $pwd); } } $pwdfp->close(); $pwfiletext = join("\n", @@pwarray); $pwdfp = IO::File->new(">$pwdfile"); print $pwdfp $pwfiletext; $pwdfp->close(); &logging("Writing new password for user $user"); if ( $user =~ $username) {$password=$new1_password;} $form = 'mainw'; goto NEXTFORM; } else { $cptext .= "
" . "The password you typed do not match. Type the same password. ". "in both boxes

\n". $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . "
" ; &logging("The password in the two boxes are not the same"); } } ENDE: return $cptext; } ######################################################################################## ######################################################################################## sub nuser { ######################################################################################## my $text; $text .= "
" . "" . "Administration: New User

\n" . "
" . "
" . "


" . "
" . "" . "" . "" . "" . " " . "" . "" . "" . "" . "
New User:" . $cgi->textfield( -name => 'akt_user', -default => "", -override => 1, -size => 20, -maxlength => 8 ) . "
" . $cgi->submit(-name => 'dialog_admin', -value => 'Back'). "" . $cgi->submit(-name => 'dialog_newuser', -value => 'Create User'). "
" . "
" ; return $text; } ######################################################################################## ######################################################################################## sub newuser { ######################################################################################## my ($nuser) = @@_; my $ntext; my $pwdfile = $cfghash{'BaseDir'}.$cfghash{'PasswdFile'}; my $pwdin; my $pwdfiletext; my $pwd; my $uname; my $dirlist; my $nu_error = 1; if ( $nuser !~ /^[A-Za-z0-9]+$/ ) { $nuser = ""; } $ntext .= "
" . "" . "Administration: New User

\n" . "
" . "
" ; if ( $nuser eq "" ) { $ntext .= "
". "" . "
Username wrong

" . "
" . $cgi->submit(-name => 'dialog_admin', -value => 'Back') . "
" ; &logging("Username is wrong"); } else { $pwdin = IO::File->new("<$pwdfile"); while (<$pwdin>) { $_ =~ s|^(\w+):(.+)$|{$uname=$1}|eg; ( $uname =~ $nuser ) && do { $nu_error = 0; }; } $pwdin->close(); $dirlist = &readsubdir($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/"); ( $dirlist =~ m|$nuser| ) && do { $nu_error = 0; }; if ($nu_error) { my $newdir = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $nuser; system("mkdir $newdir ") ; $dirlist = &readsubdir($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/"); my $dirok = 1; ( $dirlist !~ m|$nuser| ) && do { $dirok = 0; }; if ($dirok) { $pwdin = IO::File->new("<$pwdfile"); while (<$pwdin>) { $pwdfiletext .= $_; $_ =~ s|^(\w+):(.+)$|{$uname=$1; $pwd=$2}|eg; # I need an existing password as an example } $pwdin->close(); $pwdfiletext .= $nuser . ":" . (crypt('foobar', $pwd)) ; $pwdin = IO::File->new(">$pwdfile"); print $pwdin $pwdfiletext; $pwdin->close(); } $ntext .= "". "" . "User $nuser created

" . $cgi->submit(-name => 'dialog_admin', -value => 'Back'). "
" ; &logging("New use $nuser created"); } else { $ntext .= "
" . "" . "
User exists

" . "
" . $cgi->submit(-name => 'dialog_admin', -value => 'Back') . "
"; &logging("Cannot create user $nuser. The user exists.") } } return $ntext; } ######################################################################################## ######################################################################################## sub duser { ######################################################################################## my ($duser) = @@_; my $text; my $derror = 0; if ($duser =~ m/^$cfghash{'TabeaUser'}$/ ) { $derror = 1; } if (! $derror ) { $text .= "
" . "" . "Administration: Delete User

\n" . "
" . "
" . "


" . "
" . "" . "". "" . "
" . "User to delete :" . "" . "" . "$duser" . "" . "
" . "

" . # $cgi->checkbox(-name=>'del_u_files', # -value=>'del_files', # -checked=>'', # -label=>'Delete files of user', # -checked=> # ) . "Delete files of user" . "

" . "" . "" . "" . "
" . $cgi->submit(-name => 'dialog_admin', -value => 'Back'). "" . $cgi->submit(-name => 'dialog_d2user', -value => 'Del User'). "
" . "
" ; } else { $text .= "" . "It is not allowed to delete tabea user!!!" . "" . "

" . $cgi->submit(-name => 'dialog_admin', -value => 'Back'); &logging("The Tabea user cannot be deleted"); } return $text; } ######################################################################################## ######################################################################################## sub d2user { ######################################################################################## my ($duser) = @@_; my $dtext; $dtext .= "
" . "" . "Administration: Delete User

\n" . "
" . "
" . "


" . "
" . "" . "". "" . "
" . "User to delete :" . "" . "" . "$duser" . "" . "
" ; if ($cgi->param('del_u_files')) { $dtext .= "
The files of the user will be deleted" ; } else { $dtext .= "
The files of the user will be copied" ; } $dtext .= "


" . "" . "" . "" . "
" . $cgi->submit(-name => 'dialog_admin', -value => 'Back'). "" . $cgi->submit(-name => 'dialog_d3user', -value => 'Really delete user'). "
" . "
" ; return $dtext; } ######################################################################################## ######################################################################################## sub d3user { ######################################################################################## my ($duser) = @@_; my $d3text; my $delfiles = $cgi->param('del_u_files'); my $deldir = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $duser . "/" ; my $pwdfile = $cfghash{'BaseDir'}.$cfghash{'PasswdFile'}; my $pwdin; my $temptxt; my $pwdfiletext; my $uname; $d3text .= "
" . "" . "Administration: Delete User

\n" . "
" . "
" . "


" . "
" . "" . "". "" . "
" . "Deleting user:" . "" . "" . "$duser" . "" . "
" . "
" ; if ( ! $cgi->param('del_u_files')) { my $destdir = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $cfghash {'TabeaUser'} ."/" ; my $copyfiles = &readdir($deldir); my @@copfilesarray = split(/ /,$copyfiles); foreach (@@copfilesarray) { system("cp $deldir$_ $destdir$duser.$_") && die "Copy failed"; &logging("The files of $duser saved"); } } system("rm -rf $deldir"); $pwdin = IO::File->new("<$pwdfile"); while (<$pwdin>) { $temptxt = $_ ; $_ =~ s|^(\w+):(.+)$|{$uname=$1}|eg; if ($uname !~ $duser) { $pwdfiletext .= $temptxt; } } $pwdin->close(); $pwdin = IO::File->new(">$pwdfile"); print $pwdin $pwdfiletext; $pwdin->close(); &logging("User $duser deleted"); $d3text .= "
" . $cgi->submit(-name => 'dialog_admin', -value => 'Back') . "
" ; return $d3text; } ######################################################################################## ######################################################################################## sub cfgedit { ######################################################################################## my $text; &logging("Editing Tabea configuration"); $text .= &editconfig($cfghash{'BaseDir'} . "tabea.cfg", 'w', $cfghash{'TabeaUser'} ); $text .= $cgi->hidden(-name => 'editfile', -default => $cfghash{'BaseDir'} . "tabea.cfg" ); return $text; } ######################################################################################## ######################################################################################## sub copy { ######################################################################################## my ($srcf, $dstf) = @@_; my $text = ''; $text .= "
" . "" . "Copying File:
" . "
" . "
" . "

" . "
" . "Copying from $srcf to $dstf

". "
" ; system("cp $srcf $dstf") && die "Cannot copy file"; system("chmod o= $dstf") && die "Cannot change file rights"; &logging("Copying $srcf to $dstf"); $form = 'mainw'; goto NEXTFORM; return $text; } ######################################################################################## ######################################################################################## sub read_config { ######################################################################################## my ($cfgfile) = @@_; my %cfghash ; my $cfgin ; my $key; my $content; $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 ($key, $content) = /^(\w+)\s+(.*)$/; $cfghash{$key} = $content; } $cfgin->close; } else { die "Can't open config file"; } return (%cfghash); } ######################################################################################## ######################################################################################## sub validpassword { ######################################################################################## my ($user, $password, $pwdfile) = @@_; my $returnvalue = 0; my $uname; my $pwd; my $pwdin; $pwdin = IO::File->new("<$pwdfile"); if(defined $pwdin) { while (<$pwdin>) { $_ =~ s|^(\w+):(.+)$|{$uname=$1; $pwd=$2}|eg; ( $uname =~ $user ) && do { # check the password if (crypt($password, $pwd) eq $pwd){ $returnvalue = 1; } } } } $pwdin->close(); return $returnvalue; } ######################################################################################## ######################################################################################## sub readsubdir { ######################################################################################## my ($dir) = @@_; my $filestring = ""; my $direntry = ""; opendir(DIR, "$dir"); foreach $direntry (readdir(DIR)) { next if $direntry eq "."; next if $direntry eq ".."; if (-d "$dir/$direntry") { $filestring .= $direntry . " "; } } closedir(DIR); return $filestring; } ######################################################################################## ######################################################################################## sub readdir { ######################################################################################## my ($dir) = @@_; my $filestring = ""; my $direntry = ""; opendir(DIR, "$dir"); foreach $direntry (readdir(DIR)) { next if $direntry eq "."; next if $direntry eq ".."; if (-f "$dir/$direntry") { $filestring .= $direntry . " "; } } closedir(DIR); return $filestring; } ######################################################################################## ######################################################################################## sub strsort { ######################################################################################## my ($sortstr) = @@_; my @@sortarray = split(/ /, $sortstr); @@sortarray = reverse sort {$b cmp $a} @@sortarray; $sortstr = join(" ", @@sortarray); return $sortstr; } ######################################################################################## ######################################################################################## sub editconfig { ######################################################################################## my ($file, $mode, $user) = @@_; my $texte = ''; my $filein ; my $editf = ''; my $readonly ; my $titletext ; $filein = IO::File->new("<$file"); if (defined $filein) { while(<$filein>) { $editf .= $_; } $filein->close(); } else { &logging("Cannot open $file"); die "Can't open $file"; } if ($mode eq 'w') { $titletext = "Edit window"; } elsif ($mode eq 'r') { $titletext = "View window"; } my $textahash = { -name => 'editwindow', -default => $editf, -rows => 40, -columns => 80 }; if ($mode eq 'r') { $textahash->{readonly}=""; } $texte .= "
" . "" . $titletext . "

\n" . "
" . "
" . "
" . "
" . "" . "" . "". "\n" . "" . "
". "
". "File:" . "". "$file". "
" . "
" . $cgi->textarea($textahash). "

\n" . "" . " "; if ($mode eq 'w') { $texte .= " "; } $texte .= " " . "
" . " " . $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . " " . $cgi->submit(-name => 'dialog_save', -value => 'Save') . " " . "
" . "" . "" . "
" ; return $texte; } ######################################################################################## ######################################################################################## sub logging{ ######################################################################################## my ($logtext) = @@_; my $logfile = $cfghash{'BaseDir'} . $cfghash{'LogFile'}; my $logout; my $entry; if ( $cfghash{'Logging'} =~ /^[yY][eE][sS]$/) { my ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime(time); my $month = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec') [($mon)]; my $Year = $year + 1900; my $Day = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat') [($wday)]; $entry = sprintf("[%s %s %s %02i:%02i:%02i %s] ",$Day,$month,$mday,$hour,$min,$sec,$Year); $entry .= $logtext . "\n"; $logout = IO::File->new($logfile, "a"); if (defined $logout) { print $logout $entry; } else { die "Cannot open log file $logfile"; } } } ######################################################################################## @ 1.37 log @Changed HTML input formular and use of %%HEADER%% @ text @d266 7 a272 3 "" . " " . " " . d283 1 a283 1 " " . d294 1 a294 1 "
Username:Password:" . d296 2 d301 2 a302 1 "
" ; d342 1 d344 4 a347 1 "" . d349 4 a352 1 "
" . d354 1 a354 1 "Active User: $username

\n" . d357 11 a367 1 "
" . d369 3 d373 1 d375 1 d377 5 a381 2 "" . "
Templates
" . d409 3 a411 3 "" . "" . " " . d640 2 a641 1 "
Configuration
" . " " . d419 1 a419 1 " " . d443 2 a444 2 "
" . "
" ; d524 4 a527 2 $text .= "Missing filename

\n" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); a551 1 $form = 'mainw'; d553 1 a553 1 if($cgi->param("editfile") =~ $cfghash{'BaseDir'} . "tabea.cfg" ) { d559 1 d584 5 a588 2 $text .= "Missing filename

\n" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d601 3 a603 2 $text= "" . "New File:

\n" . d605 3 d633 1 a633 2 "
" . d635 2 d638 1 a638 1 "
"; d688 1 d690 6 a695 1 $text .= "Cannot write file. File exists

\n"; a697 1 $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d723 5 a727 2 $text .= "" . "Changing rights of file:

"; d731 3 a733 1 $text .= "" . d747 11 d759 3 a761 3 "

" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . $cgi->submit(-name => 'dialog_changer', -value => 'Set_rights'); d772 5 a776 2 $text .= "Missing filename

\n" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d792 2 a793 1 $text = "" . d796 3 a798 1 "
$filename to $newrights
"; d831 1 d833 1 a833 1 "Copying File:
" . d835 4 a838 5 "

" . "Active user: $username
" . "
" . "
" . " " . d840 1 a840 1 " " . d843 2 a844 2 " " . " " . "
Destinationfile$srcfile" . d859 2 a860 6 "
" . "

" . "" . " " . "
" . " " . d866 4 a869 2 "
" ; d872 5 a876 2 $text .= "Missing filename

\n" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back') ; d902 1 d906 1 a906 1 &loggong("Just delete your own files not $fpath"); d910 7 a916 2 $text .= "Missing filename

\n"; &loggin("Missing filename"); a918 2 $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d936 5 a940 1 $text .= "No configuration selected

\n" ; a941 1 $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d950 3 a952 2 $text .= "" . "Running Configuration: $rpath

\n" . d954 1 a954 1 "

" ; d973 21 a993 1 $text .= $cgi->textarea($outputhash) . "
"; d996 5 a1000 1 $text .= "Run command not working

\n"; a1002 1 $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d1018 11 a1028 3 &logging("Using admin section"); $text .= "" . "
". d1049 1 a1049 1 "" . a1051 1 d1053 1 a1053 1 "" . d1058 1 a1058 1 "" . d1068 4 a1071 3 "

" . "" . "
" . d1074 1 a1074 1 "" . d1082 2 a1083 1 $cgi->submit(-name => 'dialog_mainw', -value => 'Back') ; d1097 7 d1105 9 a1113 2 $ctext .= "
Changing the password of $user

"; $ctext .= "" ; d1116 5 a1120 1 $ctext .= " " . d1131 1 a1131 2 } d1156 2 a1157 3 " " . " " . " " . "
" . $cgi->reset() ; d1163 9 a1171 5 $ctext .= $cgi->submit(-name => 'dialog_changepwd', -value => 'Change') . "
" ; d1200 2 a1201 1 $cptext .= "The password is incorrect.

\n"; d1208 1 d1229 5 a1233 3 $cptext .= "The password you typed do not match. Type the same password. ". "in both boxes

\n". $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d1249 12 a1260 6 $text .= "Akt User: $akt_user" . "" . " " . " " . "
New User:" . a1269 5 "
" . "

" . "" . d1271 2 a1272 1 "
" . d1276 1 a1276 1 $cgi->submit(-name => 'dialog_newuser', -value => 'Write User'). d1278 3 a1280 2 "
" ; d1306 6 d1313 2 a1314 1 $ntext .= "" . d1317 2 a1318 1 $cgi->submit(-name => 'dialog_admin', -value => 'Back'); d1356 2 a1357 1 $ntext .= "" . d1359 2 a1360 1 $cgi->submit(-name => 'dialog_admin', -value => 'Back'); d1365 2 a1366 1 $ntext .= "" . d1369 2 a1370 1 $cgi->submit(-name => 'dialog_admin', -value => 'Back'); d1392 8 a1399 3 $text .= "" . a1400 1 "" . a1401 1 "" . a1402 1 d1404 1 d1406 1 a1407 2 a1408 1 a1409 1 d1417 3 a1419 6 "


" . "
" . "
" . d1425 2 a1426 3 "
" ; d1450 8 a1457 2 $dtext .= a1459 1 "" . a1460 1 "" . d1464 1 d1466 1 d1488 2 a1489 1 "
" ; d1511 8 a1518 2 $d3text .= d1521 1 a1521 3 "" . "User to delete :" . "" . d1525 2 d1528 1 d1564 2 a1565 1 $cgi->submit(-name => 'dialog_admin', -value => 'Back'); d1594 2 a1595 1 $text .= "" . d1597 6 a1602 2 "

" . "Copying from $srcf to $dstf

"; d1770 3 a1772 5 $texte .= "" . $titletext . ":

\n" . "
" . "" . "File: $file

\n" . d1774 15 d1791 1 a1791 1 "" . d1793 1 a1793 1 "
" . d1797 1 a1797 1 $texte .= " " . d1803 4 a1806 1 "
"; @ 1.36 log @Completed logging subroutine @ text @a40 8 # establish my configuration my $MY = {}; $MY->{PROGNAME} = ($0 =~ m|^.*?([^/]+?)(?:\.[^/.]+)?$|)[0]; $MY->{TEMPLATE} = ''; my $fh = new IO::File ("<".$MY->{PROGNAME}.".html") || die; $MY->{TEMPLATE} .= $_ while (<$fh>); $fh->close(); d77 11 d98 3 d116 1 d120 1 d124 1 d128 1 d132 1 d136 1 d141 1 d145 1 d150 1 d154 1 d158 1 d163 1 d167 1 d171 1 d176 1 d179 1 d185 1 d188 1 d194 1 d197 1 d202 1 d207 1 d210 2 a211 1 $page .= &duser($akt_user); d215 2 a216 1 $page .= &d2user($akt_user); d220 2 a221 1 $page .= &d3user($akt_user); d225 2 a226 1 $page .= &cfgedit(); d248 5 a252 1 $out =~ s|%%TITLE%%|Test|s; d875 1 a875 2 "

" . "Run command: " . $rcommand . "
"; @ 1.35 log @Beginning logging for tabea @ text @d261 1 a261 1 &logging("Starting program"); d611 1 a611 1 &logging("Cannot write $newpath File exists"); d1603 2 a1604 1 # if ( $cfghash{'Logging'} =~ /^[Yy}[Ee][Ss]$/ ) { d1611 2 a1612 2 $entry = "[" . $Day . " " . $month . " " . $mday . " " . $hour . ":".$min. ":" . $sec . " " . $Year . "] "; d1623 1 a1623 1 # } @ 1.34 log @Corrected an error in orthography @ text @d260 2 d279 1 d284 2 d454 1 d458 1 d488 2 d493 1 d601 1 d605 1 d611 1 d668 1 d674 1 d704 1 d707 1 d792 1 d798 1 d803 1 d826 1 d843 1 d863 1 d881 1 d1028 1 d1035 1 d1056 1 d1064 1 d1138 1 d1177 2 a1178 1 $cgi->submit(-name => 'dialog_admin', -value => 'Back'); d1186 1 d1253 1 d1349 1 d1365 1 d1382 1 d1405 1 d1550 1 d1591 32 @ 1.33 log @Initiate new program start after editing of config file @ text @d1218 1 a1218 1 "It is not allowed to delet tabea user!!!" . @ 1.32 log @Changed jump back destination for admin section @ text @d476 5 d487 1 @ 1.31 log @Appended cfgedit part @ text @d965 8 a972 3 $cgi->reset() . $cgi->submit(-name => 'dialog_mainw', -value => 'Back'). $cgi->submit(-name => 'dialog_changepwd', -value => 'Change') . d1003 6 a1008 2 $cptext .= "The password is incorrect.

\n". $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d1067 1 a1067 1 $cgi->submit(-name => 'dialog_mainw', -value => 'Back'). d1103 1 a1103 1 $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d1142 1 a1142 1 $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d1149 1 a1149 1 $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d1201 1 a1201 1 $cgi->submit(-name => 'dialog_mainw', -value => 'Back'). d1215 1 a1215 1 $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d1257 1 a1257 1 $cgi->submit(-name => 'dialog_mainw', -value => 'Back'). d1329 1 a1329 1 $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); @ 1.30 log @Appended newuser and deluser part @ text @d194 1 a194 1 # $page .= &run($cgi->param('configslist') ); a211 2 # A special for admin section and chpw for tabea #$page .= $cgi->hidden(-name => 'akt_user', -default => $akt_user); a851 1 $text .= "Username: $username; User: $user"; d922 1 a922 1 $ctext .= "
Aktueller User: $user
"; a1085 2 $ntext .= "Here is newuser $nuser
"; a1095 3 $ntext .= "Writing new user"; $ntext .= "
Checking passwdord file
" ; a1102 2 $ntext .= "
Checking subdir file
" ; a1104 1 $ntext .= "
$dirlist
" ; a1107 1 $ntext .= "
Creatin subdir file
" ; a1114 1 $ntext .= "
Reading password file
" ; a1121 1 $ntext .= "

" . "$pwdfiletext" . "

" ; a1124 3 $ntext .= "

" . "$pwdfiletext" . "

" ; d1132 1 a1132 1 "User $nuser created

" . d1156 1 a1156 1 if ($duser =~ $cfghash{'TabeaUser'} ) { d1235 1 a1235 1 "
" . a1236 6 "

" . "And his files wil be " ; $dtext .= $cgi->param('del_u_files') . "
"; d1326 1 d1328 13 @ 1.29 log @Created logout section. Created newuser and deleteuser section (incomplete). @ text @d31 1 d97 2 a98 2 for my $name (qw(admin cfgedit changepwd changer chpwd confr copy copyc copyt del d2user duser \ edit logout mainw new newf newuser nuser run save view )) { d182 5 a186 1 $page .= &duser($cgi->param('akt_user') ) d189 3 a191 3 #elsif ($form eq 'duser' ) { # $page .= &duser($cgi->param('akt_user') ) #} d209 2 d853 1 a853 1 d857 19 a875 8 $cgi->popup_menu( -name => 'akt_user', -value => [@@userlistarray], # -default=>'ps', # -default => 'ps', -default => $username, # -default => $cfghash{'TabeaUser'} ) . d1080 8 a1087 3 my $pwfile = $cfghash{'BaseDir'}.$cfghash{'PasswdFile'}; my $pwin; my $pwfiletext; a1101 3 $pwin = IO::File->new("<$pwfile"); if(defined $pwin) { $pwfiletext .= $_ while <$pwin>; d1103 9 a1111 3 } $pwin->close(); d1113 33 a1145 2 # Checken, ob User in pw # Checken, ob Subdir gleichen Namens existiert d1147 5 a1151 2 # Unterverzeichnis anlegen # PW Eintrag machen d1153 6 d1161 1 d1171 59 d1232 8 a1239 1 $text .= a1250 1 d1256 12 d1274 1 a1274 1 $cgi->submit(-name => 'dialog_d2user', -value => 'Del User'). d1279 2 a1280 1 return $text; d1284 66 @ 1.28 log @Corrected wrong password checking @ text @d88 1 d96 2 a97 1 for my $name (qw(mainw changepwd copyt view new copyc edit del run admin confr newf changer copy save)) { d153 12 a164 1 $page .= &admin($cgi->param('username') ); d167 29 a195 1 $page .= &changepwd($cgi->param('username') ); d203 4 d266 9 a274 2 &validpassword($username, $password, $cfghash{'BaseDir'}.$cfghash{'PasswdFile'}) || print STDOUT $cgi->redirect(-uri => $cgi->url(-full => 1), -type => "text/html"); d289 4 d294 1 a294 1 "
Active User: $username

\n" . d296 6 a303 1 "
" . d366 1 a366 1 "
"; d404 12 d618 1 a618 1 $namefile =~ m{^([a-zA-Z0-9!"£$%^&*()-_=+#~]+)/(.+)}sg; d841 1 a841 1 my $user = @@_; d843 50 a893 1 $text .= &chpwd($user); d904 1 a904 1 my $user = @@_; d907 5 a911 3 $ctext .= "" . " " . a913 12 "". # $cgi->password_field( # -name => 'old_password', # -value => $old_password, # -size => 20, # -maxlength => 80 # ) . " " . " " . " " . " " . " " . " " . " " . " " . " " . " " . " " . " " . " " . "
New Password:" . d915 2 a916 2 -name => 'new1_password', -value => $new1_password, d921 35 a955 21 "
Repeat Password:" . $cgi->password_field( -name => 'new2_password', -value => $new2_password, -size => 20, -maxlength => 80 ) . "
" . $cgi->reset() . $cgi->submit(-name => 'dialog_mainw', -value => 'Back'). $cgi->submit(-name => 'dialog_changepwd', -value => 'Change') . "
" ; d979 2 a980 2 if ( $username =~ $cfghash{'TabeaUser'}) { if ( $user !~ $cfghash{'TabeaUser'}) { $valid = 0; } d984 1 a984 1 $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d1000 1 a1001 1 if ( $user =~ $username) {$password=$new1_password;} d1012 124 @ 1.27 log @Appended chage password module @ text @d853 3 a855 1 if ( $user !~ $cfghash{'TabeaUser'}) { $valid = 1; } d883 1 @ 1.26 log @more cleanups @ text @d88 3 d95 1 a95 1 for my $name (qw(mainw copyt view new copyc edit del run confr newf changer copy save)) { d150 7 d276 1 a276 1 -size => 10 d299 3 d761 122 @ 1.25 log @finish unfinished password file stuff @ text @d38 1 a38 1 my $cfgfile = "./tabea.cfg"; d82 1 a82 1 my %cfghash = read_config($cfgfile); d158 1 a158 1 print $cgi->header(-cookie => $cookies, -expires => '+1s') . $out; a782 1 print "Reading file: $cfgfile\n"; a783 1 @ 1.24 log @- fix inconsistencies in coding style - fix indentations - remove trailing whitespaces on lines @ text @a38 2 my $pwdfile = "./tabea.pw"; my $configsdir = "./tabea.d"; d813 1 a813 1 my ($user, $password) = @@_; @ 1.23 log @Cleanups and error correcting @ text @a29 1 ## a37 1 a65 1 d79 1 a79 1 $cgi->param(-name => $param, -value => [$cgi->cookie($param)]); d101 1 a101 1 NEXTFORM: d108 1 a108 1 $page .= mainw(); d112 1 a112 1 } d123 2 a124 2 $page .= &newfile($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username, $cgi->param('newfile'), $cgi->param('new_rights')); d130 2 a131 2 $page .= &change_rights($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $cgi->param('filename'), $cgi->param('changerights') ); d140 1 a140 1 $page .= ©($cgi->param('srcfile'), $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . d153 1 a153 1 $page .= $cgi->hidden(-name => 'password', -default => $password ) ; d162 2 a163 1 exit (0); d171 1 a171 1 $text .= d213 2 a214 2 &validpassword($username, $password, $cfghash{'BaseDir'}.$cfghash{'PasswdFile'}) || print STDOUT $cgi->redirect(-uri => $cgi->url(-full => 1), -type => "text/html"); d223 1 a223 1 d226 3 a228 3 $text .= # Begin with templates part d233 1 a233 1 "
" . d260 1 a260 1 # Now the configuration part d294 1 a294 1 "
" ; d297 1 a297 1 } d312 2 a313 2 my $dirlist = &readsubdir($dirname . "/" ); my @@dirarray = split (/ /, $dirlist); d315 1 a315 1 DIR: foreach $subdir (@@dirarray) { d317 1 a317 1 $filel = &readdir($dirname . "/" . $subdir . "/") ; d325 1 a325 1 d356 1 a356 1 if($editfile) { d358 2 a359 2 $text .=&editconfig($filename, 'w', $username). $cgi->hidden(-name => 'editfile', -default => $filename ) ; d362 1 a362 1 $cgi->submit(-name => 'dialog_mainw', -value => 'Back') ; d364 1 a364 1 d373 1 a373 1 my ( $file, $edittext) = @@_; d375 1 a375 1 my $fileout; d378 3 a380 3 "Save File: $file

\n" . "
" . "

" ; d389 1 a389 1 $text .= "Cannot save file

\n" ; d393 1 a393 1 d402 1 a402 1 my ($file) = @@_; d404 1 a404 1 d410 1 a410 1 $cgi->submit(-name => 'dialog_mainw', -value => 'Back') ; d420 1 a420 1 my ( $dirname, $user ) = @@_; d450 1 a450 1 " " . d456 2 a457 2 " " . ""; d468 1 a468 1 my ( $dirname, $user, $newfilename, $newrights ) = @@_; d477 2 a478 2 "Creating New File: $newfilename

" . "



" ; d480 3 a482 1 if ( $_ eq $newfilename) { $canwrite = 0; }; d484 2 a485 2 if ( $canwrite ) { if ($newrights eq "private" ) { d487 1 a487 1 } elsif ($newrights eq "protected" ) { d489 1 a489 1 } elsif ($newrights eq "public" ) { d492 1 a492 1 die "Unknown file rights"; d499 1 a499 1 $text .= "


" ; d503 1 a503 1 $text .= "Cannot write file. File exists

\n" ; d515 1 a515 1 my ( $namefile ) = @@_; d519 1 a519 1 d521 1 a521 2 d523 4 a526 4 if ( $filerights == 6 ) { $defaultright = "public" ; } elsif ( $filerights == 4 ) { $defaultright = "protected" ; d528 1 a528 1 $defaultright = "private" ; d532 2 a533 2 "Changing rights of file:

" ; d538 1 a538 1 " " . d541 1 a541 1 " " . d555 3 a557 2 $text .= $cgi->hidden(-name => 'filename', -default => $namefile ) ; } else { d559 1 a559 1 $cgi->submit(-name => 'dialog', -value => 'Back'); d561 2 a562 1 } else { d564 1 a564 1 $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d567 1 a567 1 return $text; d575 1 a575 1 my ( $filename, $newrights ) = @@_; d579 15 a593 12 $text= "" . "Changing rights of file:
" . "
" . "
$filename to $newrights
"; if ($newrights eq "private" ) { $filerights = ''; } elsif ($newrights eq "protected" ) { $filerights = "r"; } elsif ($newrights eq "public" ) { $filerights = "rw"; } else { die "Unknown file rights"; d607 1 a607 1 my ( $filename ) = @@_; a608 2 d611 1 a611 1 my $srcfile = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $filename; d625 1 a625 1 " $srcfile" . d648 1 a648 1 " " . d651 2 a652 2 " " . " " . d654 2 a655 1 } else { d657 1 a657 1 $cgi->submit(-name => 'dialog_mainw', -value => 'Back') ; d660 1 a660 1 return $text; d668 1 a668 1 my ( $delfile ) = @@_; d673 4 a676 5 $text= "" . "Delete File: $fpath

\n" . "
" . "

" ; d678 1 a678 1 if ( $1 eq $username ) { a681 2 } else { $text .= "You can only delete file in your own directory

\n" ; d683 6 a688 2 } else { $text .= "Missing filename

\n" ; d691 2 a692 3 $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back') ; d701 1 a701 1 my ( $runfile ) = @@_; d710 1 a710 1 $text .= "No configuration selected

\n" ; d721 4 a724 4 "Running Configuration: $rpath

\n" . "
" . "

" . "Run command: " . $rcommand . "
" ; d729 1 a729 1 if(defined $fileoutput) { d735 5 a739 4 my $outputhash ={ -name => 'outputwindow', -default => $outputtext, -rows => 40, -columns => 80 d741 7 a747 7 $outputhash->{readonly}=""; $text .= $cgi->textarea($outputhash). "
" ; } else { $text .= "Run command not working

\n" ; } $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d749 1 a749 1 return $text; d757 1 a757 1 my ( $srcf, $dstf ) = @@_; d761 3 a763 3 "Copying File:
" . "


" . "Copying from $srcf to $dstf

" ; d769 2 a770 2 goto NEXTFORM; d779 1 a779 1 my ($cfgfile) = @@_; d785 1 a785 1 print "Lese file: $cfgfile\n"; d789 3 a791 3 LOOP: while(<$cfgin>) { $_ =~ s|^\s+(.*?)|{$_=$1}|es; # Remove whitespaces at the beginning next LOOP if $_ =~ /^\n/; # Remove the first empty require d795 2 a796 2 $_ =~ s|^([^#]+)#(.*)$|{$_=$1}|es; # Remove comments on the end $_ =~ s|(.*?)\s+$|{$_=$1}|es; # Remove whitespaces at the end d803 2 a804 1 } else { d820 1 a820 1 d823 1 a823 1 while(<$pwdin>) { a831 1 a832 1 d841 1 a841 1 my ( $dir ) = @@_; d845 1 a845 2 opendir(DIR, "$dir"); # Open dir for scanning d850 1 a850 1 $filestring .= $direntry. " "; d862 1 a862 1 my ( $dir ) = @@_; d866 1 a866 2 opendir(DIR, "$dir"); # Open dir for scanning d871 1 a871 1 $filestring .= $direntry. " "; d883 3 a885 1 my ( $sortstr ) = @@_; a886 2 my @@sortarray = split (/ /, $sortstr); d906 7 a912 4 if(defined $filein) { while(<$filein>) { $editf .= $_; } $filein->close(); } else { d915 1 a915 1 d919 1 a919 1 $titletext = "View window"; d922 5 a926 4 my $textahash ={ -name => 'editwindow', -default => $editf, -rows => 40, -columns => 80 d932 12 a943 12 $titletext . ":

\n" . "
" . "" . "File: $file

\n" . "
" . $cgi->textarea($textahash). "

\n" . "" . " "; d945 3 a947 3 $texte .= " "; d950 2 a951 3 " " . "
" . " " . $cgi->submit(-name => 'dialog_mainw', -value => 'Back') . " " . $cgi->submit(-name => 'dialog_save', -value => 'Save') . "
" ; @ 1.22 log @Changed buttons and forms structure and added a missing check in run @ text @d39 1 d103 2 a104 1 a106 1 #if ($dialog eq "") { d108 66 a173 4 # if ($form eq "mainw") { # $page .= "Form new is login

"; # } $page .= d204 2 d207 8 a214 4 #elsif (($dialog eq 'login') || ($dialog eq 'Back')) { elsif ($form eq 'mainw') { # enter Select form d229 1 a229 2 $page .= $cgi->hidden(-name => 'password', -default => $password ) . a296 70 } elsif ($form eq 'edit') { # enter Edit form $page .= &edit($cgi->param('configslist')); $page .= $cgi->hidden(-name => 'password', -default => $password ) ; } elsif ($form eq 'save') { # enter save form $page .= "
" . $cgi->param('editfile') . "
" ; $page .= &save($cgi->param('editfile'), $cgi->param('editwindow')); $page .= $cgi->hidden(-name => 'password', -default => $password ) ; } elsif ($form eq 'view') { # enter View form $page .= &view($cgi->param('templatelist')); $page .= $cgi->hidden(-name => 'password', -default => $password ) ; } elsif ($form eq 'new') { $page .= &new($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username); $page .= $cgi->hidden(-name => 'password', -default => $password ) ; } #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 ) ; } #elsif ($dialog eq 'Config_rights') { elsif ($form eq 'confr') { my $configfile; if (! defined $cgi->param('configslist') ) { $configfile = ''; } else { $configfile = $cgi->param('configslist'); } $page .= &config_rights($configfile, $username); $page .= $cgi->hidden(-name => 'password', -default => $password ) ; } #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 ) ; } #elsif ($dialog eq 'Copy_Temp') { elsif ($form eq 'copyt') { $page .= ©_file($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" .$cgi->param('templatelist'), $username ); $page .= $cgi->hidden(-name => 'password', -default => $password ) ; } #elsif ($dialog eq 'Copy_Conf') { elsif ($form eq 'copyc') { $page .= ©_file($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" .$cgi->param('configslist'), $username ); $page .= $cgi->hidden(-name => 'password', -default => $password ) ; } elsif ($form eq 'copy' ) { $page .= ©($cgi->param('srcfile'), $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $username . "/". $cgi->param('dstfile')); $page .= $cgi->hidden(-name => 'password', -default => $password ) ; } elsif ($form eq 'del' ) { $page .= &del($cgi->param('configslist'), $username ); $page .= $cgi->hidden(-name => 'password', -default => $password ) ; } elsif ($form eq 'run' ) { $page .= &run($cgi->param('configslist') ); $page .= $cgi->hidden(-name => 'password', -default => $password ) ; } else { die "no correct dialog found"; } d298 3 a300 9 $page .= $cgi->endform; my $out = $MY->{TEMPLATE}; $out =~ s|%%BODY%%|$page|s; $out =~ s|%%TITLE%%|Test|s; print $cgi->header(-cookie => $cookies, -expires => '+1s') . $out; exit (0); d388 2 d500 2 d503 1 a503 1 $text .= "Cannot write file. It exists

\n" ; d515 1 a515 1 my ( $namefile, $user ) = @@_; d518 2 d521 13 a534 13 $text .= $cgi->hidden(-name => 'filename', -default => $namefile ) ; if ( $filerights == 6 ) { $defaultright = "public" ; } elsif ( $filerights == 4 ) { $defaultright = "protected" ; } else { $defaultright = "private" ; } $text .= "" . "Changing rights of file:

" ; if ($namefile ne '') { d536 1 a536 1 if ($1 eq $user) { d555 2 d592 2 a593 2 $text .= "
Done.

" . $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d603 1 a603 1 my ( $srcfile, $user ) = @@_; d606 50 a655 39 $text .= $cgi->hidden(-name => 'srcfile', -default => $srcfile ) . "" . "Copying File:
" . "
" . "

" . "Active user: $user
" . "" . " " . " " . " " . " " . " " . " " . " " . " " . "
Sourcefile :Destinationfile
$srcfile" . " " . " " . " " . " " . " " . "
" . $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $user . "/" . $cgi->textfield(-name=>'dstfile', -default=>'', -size=>30, -maxlength=>80) . "
" . "
" . "

" . "" . " " . " " . " " . "
" . " " . $cgi->submit(-name => 'dialog_mainw', -value => 'Back'). " " . $cgi->submit(-name => 'dialog_copy', -value => 'Copy'). "
" ; d665 1 a665 1 my ( $delfile, $user ) = @@_; a666 1 my $fpath = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $delfile; d668 9 a676 6 $text= "" . "Delete File: $fpath

\n" . "
" . "

" ; $delfile =~ m{^([a-zA-Z0-9!"$%^&*()-_=+#~]+)/(.+)}sg; if ( $1 eq $user ) { d678 5 d684 1 a684 1 $text .= "You can only delete file in your own directory

\n" ; d686 3 a689 2 $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); d764 3 a766 2 $text .= $cgi->submit(-name => 'dialog_mainw', -value => 'Back'); @ 1.21 log @Appended run section @ text @d94 1 a94 1 my $page = ''; d96 8 a103 1 if ($cfghash{"TabeaUser"} ne '') { d105 5 a109 1 if ($dialog eq "") { d111 30 a140 32 $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) . "" . " " . " " . " " . " " . " " . " " . " " . " " . " " . " " . " " . "
Username:" . $cgi->textfield( -name => 'username', -default => $username, -size => 20, -maxlength => 8 ) . "
Password:" . $cgi->password_field( -name => 'password', -value => $password, -size => 20, -maxlength => 80 ) . "
" . $cgi->reset() . $cgi->submit(-name => 'dialog', -value => 'login') . "
" . $cgi->endform; d142 2 a143 1 elsif (($dialog eq 'login') || ($dialog eq 'Back')) { d146 2 a147 1 &validpassword($username, $password, $cfghash{'BaseDir'}.$cfghash{'PasswdFile'}) || print STDOUT $cgi->redirect(-uri => $cgi->url(-full => 1), -type => "text/html"); d159 2 a160 2 $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) . d162 67 a228 79 # Begin with templates part "" . "
Active User: $username

\n" . "
" . "" . " " . " " . "
Templates
" . " " . $cgi->scrolling_list( -name => 'templatelist', -value => [@@templatesarray], -size => 3 ) . " " . " " . " " . " " . " " . " " . " " . " " . " " . "
" . "
" . $cgi->submit(-name => 'dialog', -value => 'Copy_Temp') . "
" . $cgi->submit(-name => 'dialog', -value => 'View') . "
" . "
" . " " . "" . # Now the configuration part "

" . "" . "" . " " . "
Configuration
" . " " . $cgi->scrolling_list( -name => 'configslist', -value => [@@configsarray], -size => 10 ) . " " . " " . " " . " " . " " . " " . " " . " " . "
" . $cgi->submit(-name => 'dialog', -value => 'New') . "
" . $cgi->submit(-name => 'dialog', -value => 'Copy_Conf') . "
" . $cgi->submit(-name => 'dialog', -value => 'Edit') . "
" . $cgi->submit(-name => 'dialog', -value => 'Del') . "
" . $cgi->submit(-name => 'dialog', -value => 'Run') . "
" . $cgi->submit(-name => 'dialog', -value => 'Config_rights') . "
" . "
" . "
" ; $page .= $cgi->endform; d230 1 a230 1 elsif ($dialog eq 'Edit') { a231 1 $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)); d234 1 a234 1 $page .= $cgi->endform; d236 1 a236 1 elsif ($dialog eq 'Save') { a237 1 $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)); a240 1 $page .= $cgi->endform; d242 1 a242 1 elsif ($dialog eq 'View') { a243 1 $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)); a245 1 $page .= $cgi->endform; d247 1 a247 2 elsif ($dialog eq 'New') { $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)); a249 1 $page .= $cgi->endform; d251 2 a252 2 elsif ($dialog eq 'New_file') { $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)); a255 1 $page .= $cgi->endform; d257 2 a258 2 elsif ($dialog eq 'Config_rights') { $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)); a266 1 $page .= $cgi->endform; d268 2 a269 2 elsif ($dialog eq 'Change_rights') { $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)); a272 1 $page .= $cgi->endform; d274 2 a275 2 elsif ($dialog eq 'Copy_Temp') { $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)); a277 1 $page .= $cgi->endform; d279 2 a280 2 elsif ($dialog eq 'Copy_Conf') { $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)); a282 1 $page .= $cgi->endform; d284 1 a284 2 elsif ($dialog eq 'Copy' ) { $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)); a286 1 $page .= $cgi->endform; d288 1 a288 2 elsif ($dialog eq 'Del' ) { $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)); a290 1 $page .= $cgi->endform; d292 1 a292 2 elsif ($dialog eq 'Run' ) { $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)); a294 1 $page .= $cgi->endform; d300 1 a300 4 } else { die "no configuration found"; } d334 1 a334 2 } d340 1 a364 3 # enter Edit form d372 1 a372 1 $cgi->submit(-name => 'dialog', -value => 'Back') ; d379 1 d400 1 a400 1 $text .= $cgi->submit(-name => 'dialog', -value => 'Back'); d406 1 d418 1 a418 1 $cgi->submit(-name => 'dialog', -value => 'Back') ; a433 1 a449 6 # $cgi->checkbox_group( # -name => 'new_rights', # -values => ['private', 'protected', 'public'], # -defaults => 'private', # -linebreak => 'true' # ) . d461 2 a462 2 $cgi->submit(-name => 'dialog', -value => 'Back') . $cgi->submit(-name => 'dialog', -value => 'New_file') . d471 3 d509 1 a509 1 $text .= $cgi->submit(-name => 'dialog', -value => 'Back'); a515 1 d555 2 a556 2 $cgi->submit(-name => 'dialog', -value => 'Back') . $cgi->submit(-name => 'dialog', -value => 'Change_rights'); a561 1 d563 1 a563 1 $cgi->submit(-name => 'dialog', -value => 'Back'); d581 1 a581 1 "
$filename to $newrights
"; a590 1 # $text .= "Name : $filename
Rights: $filerights
" ; d593 1 a593 1 $cgi->submit(-name => 'dialog', -value => 'Back'); d638 1 a638 1 $cgi->submit(-name => 'dialog', -value => 'Back'). d641 1 a641 1 $cgi->submit(-name => 'dialog', -value => 'Copy'). a644 1 a646 1 d669 1 a669 1 $text .= $cgi->submit(-name => 'dialog', -value => 'Back'); d687 5 d698 1 a698 2 $text= "" . d719 2 a720 1 $text .= $cgi->textarea($outputhash); d724 1 d726 1 a726 1 $text .= $cgi->submit(-name => 'dialog', -value => 'Back'); d745 1 a745 1 $text .= $cgi->submit(-name => 'dialog', -value => 'Back'); a751 2 d755 15 d771 2 a772 5 my ($cfgfile) = @@_; my %cfghash ; my $cfgin ; my $key; my $content; d774 1 a774 2 print "Lese file: $cfgfile\n"; $cfgin = IO::File->new("<$cfgfile"); d776 5 a780 16 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 ($key, $content) = /^(\w+)\s+(.*)$/; $cfghash{$key} = $content; d782 1 a782 4 $cfgin->close; } return (%cfghash); a786 1 a790 1 a821 2 d834 1 a834 2 a843 2 a873 3 d878 1 a878 1 my $text = ''; d880 1 d885 7 a891 4 while(<$filein>) { $text .= $_; } $filein->close(); d899 1 a899 1 -default => $text, d906 1 a906 2 $text .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) . "" . d917 1 a917 1 $cgi->submit(-name => 'dialog', -value => 'Back') . d920 2 a921 2 $text .= " " . $cgi->submit(-name => 'dialog', -value => 'Save') . d924 1 a924 1 $text .= " " . d928 1 a928 1 return $text; @ 1.20 log @Appended delete section @ text @d239 6 a244 1 ## FIXME d309 10 d385 1 a385 1 my ($file) = @@_; d388 7 a394 3 if($file) { my $filename = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $file; &editconfig($filename, 'w', $username); d399 1 d404 25 d438 1 a438 1 &editconfig($filename, 'r', $username); d708 48 d926 1 a926 1 $filein->close; d943 1 a943 1 $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) . d958 1 a958 1 $page .= " " . d962 1 a962 1 $page .= " " . d966 1 @ 1.19 log @Appended copy templates section @ text @d30 1 d39 2 a40 4 my $cfgfile = "./tabea.cfg"; # Name of configuration file my $pwdfile = "./tabea.pw"; a42 1 d71 1 a71 7 my $cookieparam; if (defined $cgi->param($param)) { $cookieparam = $cgi->param($param); } else { $cookieparam = ''; } if ($cookieparam ne '' and ($cookieparam ne $cgi->cookie($param))) { d74 1 a74 1 -value => $cookieparam, d80 1 a80 1 if ($cookieparam eq '' and $cookieparam ne '') { a87 1 d99 33 a131 32 $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) . "" . " " . " " . " " . " " . " " . " " . " " . " " . " " . " " . " " . "
Username:" . $cgi->textfield( -name => 'username', -default => $username, -size => 20, -maxlength => 8 ) . "
Password:" . $cgi->password_field( -name => 'password', -value => $password, -size => 20, -maxlength => 80 ) . "
" . $cgi->reset() . $cgi->submit(-name => 'dialog', -value => 'login') . "
" . $cgi->endform; a134 1 a137 1 d149 34 a182 35 $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) . $cgi->hidden(-name => 'password', -default => $password ) . # Begin with templates part "" . "
Active User: $username

\n" . "
" . "" . " " . " " . "
Templates
" . " " . $cgi->scrolling_list( -name => 'templatelist', -value => [@@templatesarray], -size => 3 ) . " " . " " . " " . " " . " " . " " . " " . " " . " " . "
" . "
" . $cgi->submit(-name => 'dialog', -value => 'Copy_Temp') . "
" . $cgi->submit(-name => 'dialog', -value => 'View') . "
" . "
" . " " . "" . d185 44 a228 35 "

" . "" . "" . " " . "
Configuration
" . " " . $cgi->scrolling_list( -name => 'configslist', -value => [@@configsarray], -size => 10 ) . " " . " " . " " . " " . " " . " " . " " . " " . "
" . $cgi->submit(-name => 'dialog', -value => 'New') . "
" . $cgi->submit(-name => 'dialog', -value => 'Copy_Conf') . "
" . $cgi->submit(-name => 'dialog', -value => 'Edit') . "
" . $cgi->submit(-name => 'dialog', -value => 'Del') . "
" . $cgi->submit(-name => 'dialog', -value => 'Run') . "
" . $cgi->submit(-name => 'dialog', -value => 'Config_rights') . "
" . "
" . "
" . $cgi->endform; d238 3 d250 1 a251 1 $page .= &new($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username); d256 2 a258 1 $page .= &newfile($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username, $cgi->param('newfile'), $cgi->param('new_rights')); a262 1 $page .= $cgi->hidden(-name => 'password', -default => $password ) ; d270 1 a270 1 # $page .= "Returnvalue: " . $cgi->param('filename') . "
"; d275 8 a283 1 $page .= &change_rights($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $cgi->param('filename'), $cgi->param('changerights') ); d286 19 d377 1 a377 2 $text = $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) . "Missing iilename

\n" . d471 2 a472 4 } $text .= "$canwrite

"; if ( $canwrite ) { system("touch $newpath") && die "Cannot create new file"; a486 1 # Checking that file dont exist: TODO d506 2 a507 2 $text .= $cgi->hidden(-name => 'filename', -default => $namefile ) ; d541 2 a542 1 $text .= "You can only change file rights in your directory

\n"; d545 3 a547 1 $text .= "Missing filename

\n" ; a549 2 $text .= $cgi->submit(-name => 'dialog', -value => 'Back'); d575 1 d585 101 d871 1 a871 2 "" . a872 1 $cgi->endform; @ 1.18 log @Varios cleanups @ text @a29 1 ## @ 1.17 log @Appended config rights section @ text @d59 1 a59 1 my ($err) = @@@@_; d74 8 a81 2 if ($cgi->param($param) ne '' and ($cgi->param($param) ne $cgi->cookie($param))) { push(@@@@{$cookies}, $cgi->cookie( d83 1 a83 1 -value => $cgi->param($param), d89 1 a89 1 if ($cgi->param($param) eq '' and $cgi->cookie($param) ne '') { a96 2 #print "Test: $cfghash{'TabeaUser'}\n"; d110 31 a140 32 # $cgi->hidden(-name => 'form', -default => ['login']) . "" . " " . " " . " " . " " . " " . " " . " " . " " . " " . " " . " " . "
Username:" . $cgi->textfield( -name => 'username', -default => $username, -size => 20, -maxlength => 8 ) . "
Password:" . $cgi->password_field( -name => 'password', -value => $password, -size => 20, -maxlength => 80 ) . "
" . $cgi->reset() . $cgi->submit(-name => 'dialog', -value => 'login') . "
" . $cgi->endform; a148 3 # my $templatesfiles = &readdir($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} ."/".$cfghash{'TabeaUser'}); # my $configsfiles = &readdir($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} ."/".$username); d157 2 a158 2 my @@@@templatesarray = split(/ /,$templatesfiles); my @@@@configsarray = split(/ /,$configsfiles); a160 1 # d162 1 a162 1 $cgi->hidden(-name => 'form', -default => ['']) . d164 31 a194 31 "" . "
Active User: $username

\n" . "
" . "" . " " . " " . "
Templates
" . " " . $cgi->scrolling_list( -name => 'templatelist', -value => [@@@@templatesarray], -size => 3 ) . " " . " " . " " . " " . " " . " " . " " . " " . " " . "
" . "
" . $cgi->submit(-name => 'dialog', -value => 'Copy_Temp') . "
" . $cgi->submit(-name => 'dialog', -value => 'View') . "
" . "
" . " " . "" . d197 35 a231 44 "

" . "" . "" . " " . "
Configuration
" . " " . $cgi->scrolling_list( -name => 'configslist', -value => [@@@@configsarray], -size => 10 ) . " " . " " . " " . " " . " " . " " . " " . " " . "
" . $cgi->submit(-name => 'dialog', -value => 'New') . "
" . $cgi->submit(-name => 'dialog', -value => 'Copy_Conf') . "
" . $cgi->submit(-name => 'dialog', -value => 'Edit') . "
" . $cgi->submit(-name => 'dialog', -value => 'Del') . "
" . $cgi->submit(-name => 'dialog', -value => 'Run') . "
" . $cgi->submit(-name => 'dialog', -value => 'Config_rights') . "
" . "
" . "
" ; $page .= $cgi->endform; d236 4 a239 1 $page .= &edit($cgi->param('configslist')); d243 1 d245 2 d250 1 d256 1 d262 1 d275 1 d295 1 a295 1 my ($dirname, $user, $rights) = @@@@_; d297 1 a297 1 my @@@@filelarray; d304 1 a304 1 my @@@@dirarray = split (/ /, $dirlist); d306 1 a306 1 DIR: foreach $subdir (@@@@dirarray) { d309 2 a310 2 @@@@filelarray = split (/ /, $filel); FILE: foreach $entry (@@@@filelarray) { d325 1 a325 1 my ($dirname, $user) = @@@@_; d330 1 a330 1 my @@@@flistarray = split (/ /,$flist); d332 1 a332 1 foreach $entry (@@@@flistarray) { d344 1 a344 1 my ($file) = @@@@_; d353 1 a353 2 $cgi->submit(-name => 'dialog', -value => 'Back') . $cgi->endform; d363 1 a363 1 my ($file) = @@@@_; d370 2 a371 4 $text .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) . "Missing filename

\n" . $cgi->submit(-name => 'dialog', -value => 'Back') . $cgi->endform; d381 1 a381 1 my ( $dirname, $user ) = @@@@_; d433 1 a433 1 my ( $dirname, $user, $newfilename, $newrights ) = @@@@_; d436 3 d442 1 a442 1 "Creating New File:

" . d444 22 a465 7 system("touch $newpath") && die "Cannot create new file"; if ($newrights eq "private" ) { $filerights = ''; } elsif ($newrights eq "protected" ) { $filerights = "r"; } elsif ($newrights eq "public" ) { $filerights = "rw"; d467 1 a467 1 die "Unknown file rights"; d469 1 a469 8 $text .= "Creating the new file $newpath

"; system("touch $newpath") && die "Cannot create new file"; $text .= "Setting new file rights for $newpath

"; system("chmod u=rw $newpath") && die "Cannot set new file rights"; system("chmod o=$filerights $newpath") && die "Cannot set new file rights"; # Checking that file dont exist: TODO $text .= "


" . $cgi->submit(-name => 'dialog', -value => 'Back'); d480 1 a480 1 my ( $namefile, $user ) = @@@@_; d483 1 a483 7 my $filerights = stat( (($namefile)[2]) & 07 ); my $fnamehash ={ -name => 'filename', -default => $namefile, -size => 20, -maxlength => 30 }; $fnamehash->{readonly}=""; d485 1 a485 1 # $text .= $cgi->hidden(-name => 'filename', -default => ['xxx', 'xxx2'] ) ; d494 1 a494 1 $text= "" . d503 1 a503 1 $cgi->textfield($fnamehash). d519 1 a519 2 $text .= "You can only change file rights in your directory

\n" . $cgi->submit(-name => 'dialog', -value => 'Back'); d522 2 d525 1 a525 3 $text .= "Missing filename

\n" . $cgi->submit(-name => 'dialog', -value => 'Back'); } d535 1 a535 1 my ( $filename, $newrights ) = @@@@_; a551 1 # $text .= "Name : $filename
Rights: $filerights
" ; d566 1 a566 1 my ($cfgfile) = @@@@_; d604 1 a604 1 my ($user, $password) = @@@@_; d633 1 a633 1 my ( $dir ) = @@@@_; d658 1 a658 1 my ( $dir ) = @@@@_; d682 1 a682 1 my ( $sortstr ) = @@@@_; d684 1 a684 1 my @@@@sortarray = split (/ /, $sortstr); d686 2 a687 2 @@@@sortarray = reverse sort {$b cmp $a} @@@@sortarray; $sortstr = join(" ", @@@@sortarray); d700 1 a700 1 my ($file, $mode, $user) = @@@@_; @ 1.16 log @Created section for creating new file @ text @d30 1 a43 1 #my $tabeauser = "tabea"; d59 1 a59 1 my ($err) = @@_; a70 1 d75 1 a75 1 push(@@{$cookies}, $cgi->cookie( d93 1 d98 1 d157 2 a158 2 my @@templatesarray = split(/ /,$templatesfiles); my @@configsarray = split(/ /,$configsfiles); d173 1 a173 1 -value => [@@templatesarray], d204 1 a204 1 -value => [@@configsarray], d262 16 a277 3 else { die "invalid dialog \"$dialog\""; a278 1 d295 1 a295 1 my ($dirname, $user, $rights) = @@_; d297 1 a297 1 my @@filelarray; d304 1 a304 1 my @@dirarray = split (/ /, $dirlist); d306 1 a306 1 DIR: foreach $subdir (@@dirarray) { d309 2 a310 2 @@filelarray = split (/ /, $filel); FILE: foreach $entry (@@filelarray) { d325 1 a325 1 my ($dirname, $user) = @@_; d330 1 a330 1 my @@flistarray = split (/ /,$flist); d332 1 a332 1 foreach $entry (@@flistarray) { d344 1 a344 1 my ($file) = @@_; d352 1 a352 1 "Missing filename

\n" . d364 1 a364 1 my ($file) = @@_; d384 2 a385 2 my ( $dirname, $user ) = @@_; my $text; d432 1 d436 2 a437 2 my ( $dirname, $user, $newfilename, $newrights ) = @@_; my $text; d468 94 d566 1 a566 1 my ($cfgfile) = @@_; d604 1 a604 1 my ($username, $password) = @@_; d615 1 a615 1 ( $uname =~ $username ) && do { # check the password d633 1 a633 1 my ( $dir ) = @@_; d658 1 a658 1 my ( $dir ) = @@_; d682 1 a682 1 my ( $sortstr ) = @@_; d684 1 a684 1 my @@sortarray = split (/ /, $sortstr); d686 2 a687 2 @@sortarray = reverse sort {$b cmp $a} @@sortarray; $sortstr = join(" ", @@sortarray); d700 1 a700 1 my ($file, $mode, $user) = @@_; @ 1.15 log @Changed view of main window. Changed read in of template and config files @ text @d45 1 d251 11 d363 86 @ 1.14 log @Various cleanups @ text @d143 3 a145 2 my $templatesfiles = &readdir($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} ."/".$cfghash{'TabeaUser'}); my $configsfiles = &readdir($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} ."/".$username); d147 8 d157 2 a158 1 d163 1 d165 2 a166 1 # "Templates:

\n" . d180 1 a180 1 $cgi->submit(-name => 'dialog', -value => 'Copy') . d196 2 a197 1 $page .= "" . d214 1 a214 1 $cgi->submit(-name => 'dialog', -value => 'Copy') . d249 2 a250 1 } else { d268 49 d323 2 a324 2 my $filename = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $username . "/" . $file; &editconfig($filename, 'w', $username); d326 4 a329 4 $text = $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) . "Missing filename

\n" . $cgi->submit(-name => 'dialog', -value => 'Back') . $cgi->endform; d341 1 a341 1 # enter View form d343 2 a344 2 my $filename = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $cfghash{'TabeaUser'} . "/" . $cgi->param('templatelist'); &editconfig($filename, 'r', $username); d346 4 a349 4 $text .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) . "Missing filename

\n" . $cgi->submit(-name => 'dialog', -value => 'Back') . $cgi->endform; a355 1 d425 25 d456 2 d474 18 d523 1 a523 1 "Username: $username

\n" . d525 1 a525 1 "Mode: $mode

\n" . @ 1.13 log @Appended read in tabea configuration section @ text @d153 2 a154 3 "
Active User: $username
\n" . "Templates:

\n" . "
Configuration
" . d160 1 a160 1 -size => 2 d184 2 a185 3 $page .= "Configuration:

\n". "
" . " " . d190 1 a190 1 -size => 5 d222 1 a222 2 " " . d231 1 a231 11 # &validpassword($username, $password, $pwdfile) || print STDOUT $cgi->redirect(-uri => $cgi->url(-full => 1), -type => "text/html"); if ($cgi->param('configslist')) { my $filename = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $username . "/" . $cgi->param('configslist'); &editconfig($filename, 'w', $username); } else { $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) . "Missing filename

\n" . $cgi->submit(-name => 'dialog', -value => 'Back') . $cgi->endform; } d235 1 a235 11 # &validpassword($username, $password, $pwdfile) || print STDOUT $cgi->redirect(-uri => $cgi->url(-full => 1), -type => "text/html"); if ($cgi->param('templatelist')) { my $filename = $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" . $cfghash{'TabeaUser'} . "/" . $cgi->param('templatelist'); &editconfig($filename, 'r', $username); } else { $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) . "Missing filename

\n" . $cgi->submit(-name => 'dialog', -value => 'Back') . $cgi->endform; } d252 42 d390 2 a391 1 d396 16 d413 4 a416 2 "Edit window:

\n" ; $page .= "Username: $username

\n" . d419 2 a420 7 $cgi->textarea( -name => 'editwindow', -default => $text, -rows => 40, -columns => 80 ); $page .= "

\n" . a436 2 @ 1.12 log @Appended first version of view and edit window @ text @d38 3 d43 1 a43 1 my $tabeauser = "tabea"; d88 2 d91 1 d100 2 d141 1 a141 1 &validpassword($username, $password, $pwdfile) || print STDOUT $cgi->redirect(-uri => $cgi->url(-full => 1), -type => "text/html"); d143 2 a144 2 my $templatesfiles = &readdir($configsdir."/".$tabeauser); my $configsfiles = &readdir($configsdir."/".$username); d236 1 a236 1 my $filename = $configsdir . "/" . $username . "/" . $cgi->param('configslist'); d250 1 a250 1 my $filename = $configsdir . "/" . $tabeauser . "/" . $cgi->param('templatelist'); d263 4 d275 36 d371 1 @ 1.11 log @Saving last test version @ text @a40 3 my $dialog; my $copy; my $view; a66 4 # fetch parameters my $form = $cgi->param("form") || ""; my $username = $cgi->param("username") || ""; my $password = $cgi->param("password") || ""; d85 7 d94 1 a94 1 if ($form eq '') { d96 1 a96 1 $cgi->hidden(-name => 'form', -default => ['login']) . d123 1 a123 1 $cgi->submit(-name => 'dialog', -value => 'Login') . d129 1 a129 1 elsif ($dialog eq 'login') { d138 2 a140 9 my @@templateshash = split(/ /,$templatesfiles); my $templateslist = "["; foreach (@@templateshash) { $templateslist .= "'$_', "; } chop($templateslist); chop($templateslist); $templateslist .= "]"; d145 1 a146 1 " Templateslist: $templateslist
" . d152 1 a152 2 # -value => ['default', 'sample'], -value => '\$templateslist', d161 1 a161 1 $cgi->submit(-name => 'copy', -value => 'Copy') . d166 1 a166 1 $cgi->submit(-name => 'view', -value => 'View') . d182 2 a183 2 -name => 'configlist', -value => ['xdefault', 'xsample'], d191 1 a191 1 $cgi->submit(-name => 'new', -value => 'New') . d195 1 a195 1 $cgi->submit(-name => 'copy', -value => 'Copy') . d199 1 a199 1 $cgi->submit(-name => 'edit', -value => 'Edit') . d203 1 a203 1 $cgi->submit(-name => 'del', -value => 'Del') . d207 1 a207 1 $cgi->submit(-name => 'run', -value => 'Run') . d211 1 a211 1 $cgi->submit(-name => 'conf_rights', -value => 'Config_rights') . d218 2 a219 1 "
" . d221 1 a222 2 $cgi->endform; # $dialog = $cgi->param($view) || $cgi->param($copy); d226 12 a237 5 &validpassword($username, $password, $pwdfile) || print STDOUT $cgi->redirect(-uri => $cgi->url(-full => 1), -type => "text/html"); $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)); } d240 13 a252 5 &validpassword($username, $password, $pwdfile) || print STDOUT $cgi->redirect(-uri => $cgi->url(-full => 1), -type => "text/html"); } else { die "invalid form \"$form\""; d317 42 @ 1.10 log @fix HTML rendering @ text @d41 3 d129 1 a129 1 elsif ($form eq 'login') { d134 1 d140 1 a140 1 my $templateslist = ""; d144 4 a147 2 # $templateslist .= "]"; d152 2 a153 1 $page .= "Templates:

\n" . d159 2 a160 1 -value => ['default', 'sample'], d168 1 d170 1 d173 1 d175 1 d229 2 a230 1 $cgi->endform; d232 1 a232 1 elsif ($form eq 'select') { d235 2 d238 7 a244 1 else { @ 1.9 log @Corrected one error in password checking. Created the first construction of second "window" @ text @d175 1 a175 1 " " . d183 1 a183 1 " " . a184 1 " " . d186 1 a186 1 " " . d188 1 a188 1 " " . d190 1 a190 1 " " . d192 1 a192 1 " " . d194 1 a194 1 " " . d196 1 a196 1 " " . d198 1 a198 1 " " . d200 1 a200 1 " " . d202 1 a202 1 " " . d204 1 a204 1 " " . d206 1 a206 1 " " . d208 1 a208 1 " " . a209 1 " " . d211 1 a211 1 " " . d213 1 a213 1 " " . @ 1.8 log @Removed unneeded print statement @ text @d39 2 a88 29 ######################################################################################## sub validpassword { ######################################################################################## my ($username, $password) = @@_; my $returnvalue = 0; my $uname; my $pwd; my $pwdin; $pwdin = IO::File->new("<$pwdfile"); if(defined $pwdin) { while(<$pwdin>) { $_ =~ s|^(\w+):(\w+)$|{$uname=$1; $pwd=$2}|eg; ( $uname =~ $username ) && do { # check the password if (crypt($password, $pwd) eq $pwd){ $returnvalue = 1; } } } } $pwdin->close(); return $returnvalue; } ######################################################################################## d128 1 d131 11 d145 75 a219 35 # "" . # " " . # " " . # " " . # " " . # " " . # " " . # " " . # " " . # " " . # " " . # " " . # "
Username:" . # $cgi->textfield( # -name => 'username', # -default => $username, # -size => 20, # -maxlength => 8 # ) . # "
Password:" . # $cgi->password_field( # -name => 'password', # -value => $password, # -size => 20, # -maxlength => 80 # ) . # "
" . # $cgi->reset() . # $cgi->submit(-name => 'dialog', -value => 'Login') . # "
" . # $cgi->endform; print "$pwd\n"; # $page .= "Dialog: ".$cgi->param("dialog") ."
\n"; # $page .= "Username: ".$cgi->param("username") ."
\n"; # $page .= "Password: ".$cgi->param("password") ."
\n"; d236 55 @ 1.7 log @Appended password checking @ text @a101 1 print "Checking password : "; d155 1 d157 38 a194 3 $page .= "Dialog: ".$cgi->param("dialog") ."
\n"; $page .= "Username: ".$cgi->param("username") ."
\n"; $page .= "Password: ".$cgi->param("password") ."
\n"; @ 1.6 log @flush RSE & PS work @ text @d38 2 d87 1 d89 1 d91 22 a112 1 return ""; d114 2 d156 1 a156 1 # &validpassword($username, $password) || print STDOUT $cgi->redirect(-uri => $cgi->url(-full => 1), -type => "text/html"); d163 1 a163 1 &validpassword($username, $password) || print STDOUT $cgi->redirect(-uri => $cgi->url(-full => 1), -type => "text/html"); @ 1.5 log @Appended two textfields @ text @d46 2 d49 40 a88 2 # establish CGI query object my $Q = new CGI; d91 50 a140 3 $page .= "fuck"; my $page2 =''; $page2 .= "Welcher auch"; d144 1 a144 30 $out =~ s|%%TITLE%%|$page2|s; # generate "ADD" form $out .= $Q->startform( -method => "POST", -action => $Q->url()) . "\n" . # "" . # "" . $Q->submit(-name => 'form', -value => 'Add') . "" . # "" . "" . "Username:" . $Q->textfield( -name => 'username', -default => '', -size => 20, -maxlength => 80 ) . "" . "

" . "" . "Password:" . $Q->textfield( -name => 'password', -default => '', -size => 20, -maxlength => 80 ) . "" . $Q->endform; d146 1 a146 1 print $Q->header(-expires => '+1s') . $out; @ 1.4 log @fix (unknown reasons) @ text @d1 1 a1 1 #!/cw/bin/perl -w d46 1 d52 2 d57 31 @ 1.3 log @First not working test version @ text @d1 1 a1 3 #!/bin/sh -- # -*- perl -*- -p eval 'exec perl -S $0 ${1+"$@@"}' if $running_under_some_shell; d35 2 a36 1 #use Averist; d41 4 a44 8 $MY->{HEADER} = ''; open(FP, "<".$MY->{PROGNAME}.".head.html"); $MY->{HEADER} .= $_ while (); close(FP); $MY->{FOOTER} = ''; open(FP, "<".$MY->{PROGNAME}.".foot.html"); $MY->{FOOTER} .= $_ while (); close(FP); a48 5 #print header(), # start_html('-title' => "Tabea Test", # '-bgcolor' => "white"), # end_html(); d50 1 a50 13 $page .= $Q->header (-expires => '+1s'); $page .= $MY->{HEADER}; $page .= $MY->{FOOTER}; #$page .= "\n"; #$page .= "\n" . # "\n" . # "\n" . # "\n" . # "
\n" . # "

Irgendein Text

" . # "
\n"; d52 3 a54 1 print STDOUT $page; @ 1.2 log @try another round @ text @d37 1 a37 1 use Averist; d39 38 @ 1.1 log @initial content for newborn OSSP tabea @ text @d2 1 a2 1 eval 'exec perl -wS $0 ${1+"$@@"}' d34 1 a34 1 @