]>
git.p6c8.net - devedit.git/blob - devedit.pl
1 #!C:/Programme/Perl/bin/perl.exe -w
6 # Dev-Editor's main program
8 # Author: Patrick Canterino <patshaping@gmx.net>
9 # Last modified: 09-22-2003
13 use CGI
:: Carp
qw(fatalsToBrowser) ;
28 fileroot
=> 'D:/Server/WWW/Root' ,
30 uselist_file
=> 'uselist' ,
31 lock_file
=> 'uselist.lock' ,
37 # Read the most important form data
41 my $command = $cgi -> param ( 'command' ) || 'show' ;
42 my $file = $cgi -> param ( 'file' ) || '/' ;
44 # This check has to be performed first, or abs_path() will be confused
46 if (- e clean_path
( $config { 'fileroot' }. "/" . $file ))
48 if ( my ( $physical , $virtual ) = check_path
( $config { 'fileroot' }, $file ))
50 # Copied from old Dev-Editor (great idea)
52 my %dispatch = ( 'show' => \
& exec_show
,
53 'beginedit' => \
& exec_beginedit
,
54 'canceledit' => \
& exec_unlock
,
55 'endedit' => \
& exec_endedit
,
56 # 'mkdir' => \&exec_mkdir,
57 # 'mkfile' => \&exec_mkfile,
58 'workwithfile' => \
& exec_workwithfile
,
59 # 'copy' => \&exec_copy,
60 # 'rename' => \&exec_rename,
61 'remove' => \
& exec_remove
,
62 'unlock' => \
& exec_unlock
65 # Create a File::UseList object and load the list
67 my $uselist = new File
:: UseList
( listfile
=> $config { 'uselist_file' },
68 lockfile
=> $config { 'lock_file' },
69 timeout
=> $config { 'lock_timeout' });
71 $uselist -> lock or abort
( "Locking failed. Try it again in a moment. If the problem persists, ask someone to recreate the lockfile ( $config {'lock_file'})." );
74 # Create a hash with data submitted by user
75 # (the CGI and the File::UseList objects will also be included)
77 my %data = ( physical
=> $physical ,
84 unless ( $dispatch { $command })
87 abort
( "Unknown command: $command " );
90 my $output = &{ $dispatch { $command }}( \
%data , \
%config ); # Execute the command...
92 $uselist -> unlock ; # ... unlock the list with used files...
93 print $ $output ; # ... and print the output of the command
97 abort
( "Accessing files and directories above the virtual root directory is forbidden." );
102 abort
( "File/directory does not exist." );
patrick-canterino.de