]>
git.p6c8.net - devedit.git/blob - modules/Command.pm
4 # Dev-Editor - Module Command
6 # Execute Dev-Editor's commands
8 # Author: Patrick Canterino <patshaping@gmx.net>
9 # Last modified: 2004-11-10
20 use POSIX qw(strftime);
28 my $script = $ENV{'SCRIPT_NAME'};
29 my $users = eval("getpwuid(0)") && eval("getgrgid(0)");
31 my %dispatch = ('show' => \
&exec_show
,
32 'beginedit' => \
&exec_beginedit
,
33 'canceledit' => \
&exec_canceledit
,
34 'endedit' => \
&exec_endedit
,
35 'mkdir' => \
&exec_mkdir
,
36 'mkfile' => \
&exec_mkfile
,
37 'upload' => \
&exec_upload
,
38 'copy' => \
&exec_copy
,
39 'rename' => \
&exec_rename
,
40 'remove' => \
&exec_remove
,
41 'chprop' => \
&exec_chprop
,
42 'unlock' => \
&exec_unlock
,
43 'about' => \
&exec_about
48 use base
qw(Exporter);
50 @EXPORT = qw(exec_command);
54 # Execute the specified command
56 # Params: 1. Command to execute
57 # 2. Reference to user input hash
58 # 3. Reference to config hash
60 # Return: Output of the command (Scalar Reference)
64 my ($command,$data,$config) = @_;
66 foreach(keys(%dispatch))
68 if(lc($_) eq lc($command))
70 my $output = &{$dispatch{$_}}($data,$config);
75 return error
($config->{'errors'}->{'cmd_unknown'},'/',{COMMAND
=> $command});
80 # View a directory or a file
82 # Params: 1. Reference to user input hash
83 # 2. Reference to config hash
85 # Return: Output of the command (Scalar Reference)
89 my ($data,$config) = @_;
90 my $physical = $data->{'physical'};
91 my $virtual = $data->{'virtual'};
92 my $uselist = $data->{'uselist'};
94 my $tpl = new Template
;
98 # Create directory listing
100 return error
($config->{'errors'}->{'no_dir_access'},upper_path
($virtual)) unless(-r
$physical && -x
$physical);
102 my $direntries = dir_read
($physical);
103 return error
($config->{'dir_read_fail'},upper_path
($virtual),{DIR
=> $virtual}) unless($direntries);
105 my $files = $direntries->{'files'};
106 my $dirs = $direntries->{'dirs'};
110 # Create the link to the upper directory
111 # (only if we are not in the root directory)
113 unless($virtual eq "/")
115 my @stat = stat($physical."/..");
117 my $udtpl = new Template
;
118 $udtpl->read_file($config->{'templates'}->{'dirlist_up'});
120 $udtpl->fillin("UPPER_DIR",encode_entities
(upper_path
($virtual)));
121 $udtpl->fillin("DATE",strftime
($config->{'timeformat'},localtime($stat[9])));
123 $dirlist .= $udtpl->get_template;
128 foreach my $dir(@
$dirs)
130 my $phys_path = $physical."/".$dir;
131 my $virt_path = encode_entities
($virtual.$dir."/");
133 my @stat = stat($phys_path);
135 my $dtpl = new Template
;
136 $dtpl->read_file($config->{'templates'}->{'dirlist_dir'});
138 $dtpl->fillin("DIR",$virt_path);
139 $dtpl->fillin("DIR_NAME",$dir);
140 $dtpl->fillin("DATE",strftime
($config->{'timeformat'},localtime($stat[9])));
141 $dtpl->fillin("URL",equal_url
($config->{'httproot'},$virt_path));
143 $dtpl->parse_if_block("readable",-r
$phys_path && -x
$phys_path);
144 $dtpl->parse_if_block("users",$users && -o
$phys_path);
146 $dirlist .= $dtpl->get_template;
151 foreach my $file(@
$files)
153 my $phys_path = $physical."/".$file;
154 my $virt_path = encode_entities
($virtual.$file);
156 my @stat = stat($phys_path);
157 my $in_use = $uselist->in_use($virtual.$file);
159 my $ftpl = new Template
;
160 $ftpl->read_file($config->{'templates'}->{'dirlist_file'});
162 $ftpl->fillin("FILE",$virt_path);
163 $ftpl->fillin("FILE_NAME",$file);
164 $ftpl->fillin("SIZE",$stat[7]);
165 $ftpl->fillin("DATE",strftime
($config->{'timeformat'},localtime($stat[9])));
166 $ftpl->fillin("URL",equal_url
($config->{'httproot'},$virt_path));
168 $ftpl->parse_if_block("not_readable",not -r
$phys_path);
169 $ftpl->parse_if_block("binary",-B
$phys_path);
170 $ftpl->parse_if_block("readonly",not -w
$phys_path);
172 $ftpl->parse_if_block("viewable",-r
$phys_path && -T
$phys_path && not ($config->{'max_file_size'} && $stat[7] > $config->{'max_file_size'}));
174 $ftpl->parse_if_block("editable",-r
$phys_path && -w
$phys_path && -T
$phys_path && not ($config->{'max_file_size'} && $stat[7] > $config->{'max_file_size'}) && not $in_use);
176 $ftpl->parse_if_block("in_use",$in_use);
177 $ftpl->parse_if_block("unused",not $in_use);
179 $ftpl->parse_if_block("too_large",$config->{'max_file_size'} && $stat[7] > $config->{'max_file_size'});
181 $ftpl->parse_if_block("users",$users && -o
$phys_path);
183 $dirlist .= $ftpl->get_template;
186 $tpl->read_file($config->{'templates'}->{'dirlist'});
188 $tpl->fillin("DIRLIST",$dirlist);
189 $tpl->fillin("DIR",$virtual);
190 $tpl->fillin("SCRIPT",$script);
191 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
197 return error
($config->{'errors'}->{'noview'},upper_path
($virtual)) unless(-r
$physical);
199 # Check on binary files
200 # We have to do it in this way, or empty files
201 # will be recognized as binary files
207 return error
($config->{'errors'}->{'binary'},upper_path
($virtual));
213 my $size = (stat($physical))[7];
215 if($config->{'max_file_size'} && $size > $config->{'max_file_size'})
217 return error
($config->{'errors'}->{'file_too_large'},upper_path
($virtual),{SIZE
=> $config->{'max_file_size'}})
221 my $content = file_read
($physical);
222 $$content =~ s/\015\012|\012|\015/\n/g;
224 $tpl->read_file($config->{'templates'}->{'viewfile'});
226 $tpl->fillin("FILE",$virtual);
227 $tpl->fillin("DIR",upper_path
($virtual));
228 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
229 $tpl->fillin("SCRIPT",$script);
231 $tpl->parse_if_block("editable",-r
$physical && -w
$physical && -T
$physical && not ($config->{'max_file_size'} && $size > $config->{'max_file_size'}) && $uselist->unused($virtual));
233 $tpl->fillin("CONTENT",encode_entities
($$content));
238 my $output = header
(-type
=> "text/html");
239 $output .= $tpl->get_template;
246 # Lock a file and display a form to edit it
248 # Params: 1. Reference to user input hash
249 # 2. Reference to config hash
251 # Return: Output of the command (Scalar Reference)
253 sub exec_beginedit
($$)
255 my ($data,$config) = @_;
256 my $physical = $data->{'physical'};
257 my $virtual = $data->{'virtual'};
258 my $uselist = $data->{'uselist'};
260 return error
($config->{'errors'}->{'editdir'},upper_path
($virtual)) if(-d
$physical);
261 return error
($config->{'errors'}->{'in_use'},upper_path
($virtual),{FILE
=> $virtual}) if($uselist->in_use($virtual));
262 return error
($config->{'errors'}->{'noedit'},upper_path
($virtual)) unless(-r
$physical && -w
$physical);
264 # Check on binary files
270 return error
($config->{'errors'}->{'binary'},upper_path
($virtual));
274 if($config->{'max_file_size'} && (stat($physical))[7] > $config->{'max_file_size'})
276 return error
($config->{'errors'}->{'file_too_large'},upper_path
($virtual),{SIZE
=> $config->{'max_file_size'}})
282 $uselist->add_file($virtual);
285 my $content = file_read
($physical);
286 $$content =~ s/\015\012|\012|\015/\n/g;
288 my $tpl = new Template
;
289 $tpl->read_file($config->{'templates'}->{'editfile'});
291 $tpl->fillin("FILE",$virtual);
292 $tpl->fillin("DIR",upper_path
($virtual));
293 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
294 $tpl->fillin("SCRIPT",$script);
295 $tpl->fillin("CONTENT",encode_entities
($$content));
297 my $output = header
(-type
=> "text/html");
298 $output .= $tpl->get_template;
309 # Params: 1. Reference to user input hash
310 # 2. Reference to config hash
312 # Return: Output of the command (Scalar Reference)
314 sub exec_canceledit
($$)
316 my ($data,$config) = @_;
317 my $virtual = $data->{'virtual'};
319 file_unlock
($data->{'uselist'},$virtual);
320 return devedit_reload
({command
=> 'show', file
=> upper_path
($virtual)});
325 # Save a file, unlock it and return to directory view
327 # Params: 1. Reference to user input hash
328 # 2. Reference to config hash
330 # Return: Output of the command (Scalar Reference)
334 my ($data,$config) = @_;
335 my $physical = $data->{'physical'};
336 my $virtual = $data->{'virtual'};
337 my $content = $data->{'cgi'}->param('filecontent');
338 my $uselist = $data->{'uselist'};
340 # We already unlock the file at the beginning of the
341 # subroutine, because if we have to abort this routine,
342 # the file keeps locked.
343 # Nobody else will access the file during this routine
344 # because of the concept of File::UseList.
346 file_unlock
($uselist,$virtual);
350 $content =~ s/\015\012|\012|\015/\n/g;
352 if($data->{'cgi'}->param('encode_iso'))
354 # Encode all ISO-8859-1 special chars
356 $content = encode_entities
($content,"\200-\377");
359 if($data->{'cgi'}->param('saveas') && $data->{'new_physical'} ne '' && $data->{'new_virtual'} ne '')
361 # Create the new filename
363 $physical = $data->{'new_physical'};
364 $virtual = $data->{'new_virtual'};
366 # Check if someone else is editing the new file
368 return error
($config->{'errors'}->{'in_use'},upper_path
($virtual),{FILE
=> $virtual}) if($uselist->in_use($virtual));
371 return error
($config->{'errors'}->{'text_to_binary'},upper_path
($virtual)) unless(-T
$physical);
372 return error
($config->{'errors'}->{'editdir'},upper_path
($virtual)) if(-d
$physical);
373 return error
($config->{'errors'}->{'noedit'}, upper_path
($virtual)) if(-e
$physical && !(-r
$physical && -w
$physical));
375 if(file_save
($physical,\
$content))
377 # Saving of the file was successful - so unlock it!
379 return devedit_reload
({command
=> 'show', file
=> upper_path
($virtual)});
383 return error
($config->{'errors'}->{'edit_failed'},upper_path
($virtual),{FILE
=> $virtual});
389 # Create a file and return to directory view
391 # Params: 1. Reference to user input hash
392 # 2. Reference to config hash
394 # Return: Output of the command (Scalar Reference)
398 my ($data,$config) = @_;
399 my $new_physical = $data->{'new_physical'};
400 my $new_virtual = $data->{'new_virtual'};
401 my $dir = upper_path
($new_virtual);
402 $new_virtual = encode_entities
($new_virtual);
406 return error
($config->{'errors'}->{'file_exists'},$dir,{FILE
=> $new_virtual}) if(-e
$new_physical);
408 file_create
($new_physical) or return error
($config->{'errors'}->{'mkfile_failed'},$dir,{FILE
=> $new_virtual});
409 return devedit_reload
({command
=> 'show', file
=> $dir});
413 my $tpl = new Template
;
414 $tpl->read_file($config->{'templates'}->{'mkfile'});
416 $tpl->fillin("DIR","/");
417 $tpl->fillin("SCRIPT",$script);
419 my $output = header
(-type
=> "text/html");
420 $output .= $tpl->get_template;
428 # Create a directory and return to directory view
430 # Params: 1. Reference to user input hash
431 # 2. Reference to config hash
433 # Return: Output of the command (Scalar Reference)
437 my ($data,$config) = @_;
438 my $new_physical = $data->{'new_physical'};
439 my $new_virtual = $data->{'new_virtual'};
440 my $dir = upper_path
($new_virtual);
441 $new_virtual = encode_entities
($new_virtual);
443 return error
($config->{'errors'}->{'file_exists'},$dir,{FILE
=> $new_virtual}) if(-e
$new_physical);
447 mkdir($new_physical,0777) or return error
($config->{'errors'}->{'mkdir_failed'},$dir,{DIR
=> $new_virtual});
448 return devedit_reload
({command
=> 'show', file
=> $dir});
452 my $tpl = new Template
;
453 $tpl->read_file($config->{'templates'}->{'mkdir'});
455 $tpl->fillin("DIR","/");
456 $tpl->fillin("SCRIPT",$script);
458 my $output = header
(-type
=> "text/html");
459 $output .= $tpl->get_template;
469 # Params: 1. Reference to user input hash
470 # 2. Reference to config hash
472 # Return: Output of the command (Scalar Reference)
476 my ($data,$config) = @_;
477 my $physical = $data->{'physical'};
478 my $virtual = $data->{'virtual'};
479 my $cgi = $data->{'cgi'};
481 if(my $uploaded_file = $cgi->param('uploaded_file'))
483 # Process file upload
485 my $filename = file_name
($uploaded_file);
486 my $file_phys = $physical."/".$filename;
487 my $file_virt = $virtual."".$filename;
489 return error
($config->{'errors'}->{'file_exists'},$virtual,{FILE
=> $file_virt}) if(-e
$file_phys && not $cgi->param('overwrite'));
491 my $ascii = $cgi->param('ascii');
492 my $handle = $cgi->upload('uploaded_file');
496 open(FILE
,">$file_phys") or return error
($config->{'errors'}->{'mkfile_failed'},$virtual,{FILE
=> $file_virt});
497 binmode(FILE
) unless($ascii);
499 # Read transferred file and write it to disk
501 read($handle, my $data, -s
$handle);
502 $data =~ s/\015\012|\012|\015/\n/g if($ascii); # Replace line separators if transferring in ASCII mode
507 return devedit_reload
({command
=> "show", file
=> $virtual});
511 my $tpl = new Template
;
512 $tpl->read_file($config->{'templates'}->{'upload'});
514 $tpl->fillin("DIR",$virtual);
515 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
516 $tpl->fillin("SCRIPT",$script);
518 my $output = header
(-type
=> "text/html");
519 $output .= $tpl->get_template;
527 # Copy a file and return to directory view
529 # Params: 1. Reference to user input hash
530 # 2. Reference to config hash
532 # Return: Output of the command (Scalar Reference)
536 my ($data,$config) = @_;
537 my $physical = $data->{'physical'};
538 my $virtual = encode_entities
($data->{'virtual'});
539 my $new_physical = $data->{'new_physical'};
541 return error
($config->{'errors'}->{'dircopy'}) if(-d
$physical);
542 return error
($config->{'errors'}->{'nocopy'}) unless(-r
$physical);
546 my $new_virtual = $data->{'new_virtual'};
547 my $dir = upper_path
($new_virtual);
548 $new_virtual = encode_entities
($new_virtual);
552 return error
($config->{'errors'}->{'exist_edited'},$dir,{FILE
=> $new_virtual}) if($data->{'uselist'}->in_use($data->{'new_virtual'}));
556 return error
($config->{'errors'}->{'dir_replace'},$dir);
558 elsif(not $data->{'cgi'}->param('confirmed'))
560 my $tpl = new Template
;
561 $tpl->read_file($config->{'templates'}->{'confirm_replace'});
563 $tpl->fillin("FILE",$virtual);
564 $tpl->fillin("NEW_FILE",$new_virtual);
565 $tpl->fillin("NEW_FILENAME",file_name
($new_virtual));
566 $tpl->fillin("NEW_DIR",$dir);
567 $tpl->fillin("DIR",upper_path
($virtual));
569 $tpl->fillin("COMMAND","copy");
570 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
571 $tpl->fillin("SCRIPT",$script);
573 my $output = header
(-type
=> "text/html");
574 $output .= $tpl->get_template;
580 copy
($physical,$new_physical) or return error
($config->{'errors'}->{'copy_failed'},upper_path
($virtual),{FILE
=> $virtual, NEW_FILE
=> $new_virtual});
581 return devedit_reload
({command
=> 'show', file
=> $dir});
585 my $tpl = new Template
;
586 $tpl->read_file($config->{'templates'}->{'copyfile'});
588 $tpl->fillin("FILE",$virtual);
589 $tpl->fillin("DIR",upper_path
($virtual));
590 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
591 $tpl->fillin("SCRIPT",$script);
593 my $output = header
(-type
=> "text/html");
594 $output .= $tpl->get_template;
602 # Rename/move a file and return to directory view
604 # Params: 1. Reference to user input hash
605 # 2. Reference to config hash
607 # Return: Output of the command (Scalar Reference)
611 my ($data,$config) = @_;
612 my $physical = $data->{'physical'};
613 my $virtual = $data->{'virtual'};
614 my $new_physical = $data->{'new_physical'};
616 return error
($config->{'errors'}->{'rename_root'},"/") if($virtual eq "/");
617 return error
($config->{'errors'}->{'in_use'},upper_path
($virtual),{FILE
=> $virtual}) if($data->{'uselist'}->in_use($virtual));
621 my $new_virtual = $data->{'new_virtual'};
622 my $dir = upper_path
($new_virtual);
623 $new_virtual = encode_entities
($new_virtual);
627 return error
($config->{'errors'}->{'exist_edited'},$dir,{FILE
=> $new_virtual}) if($data->{'uselist'}->in_use($data->{'new_virtual'}));
631 return error
($config->{'errors'}->{'dir_replace'},$dir);
633 elsif(not $data->{'cgi'}->param('confirmed'))
635 my $tpl = new Template
;
636 $tpl->read_file($config->{'templates'}->{'confirm_replace'});
638 $tpl->fillin("FILE",$virtual);
639 $tpl->fillin("NEW_FILE",$new_virtual);
640 $tpl->fillin("NEW_FILENAME",file_name
($new_virtual));
641 $tpl->fillin("NEW_DIR",$dir);
642 $tpl->fillin("DIR",upper_path
($virtual));
644 $tpl->fillin("COMMAND","rename");
645 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
646 $tpl->fillin("SCRIPT",$script);
648 my $output = header
(-type
=> "text/html");
649 $output .= $tpl->get_template;
655 rename($physical,$new_physical) or return error
($config->{'errors'}->{'rename_failed'},upper_path
($virtual),{FILE
=> $virtual, NEW_FILE
=> $new_virtual});
656 return devedit_reload
({command
=> 'show', file
=> $dir});
660 my $tpl = new Template
;
661 $tpl->read_file($config->{'templates'}->{'renamefile'});
663 $tpl->fillin("FILE",$virtual);
664 $tpl->fillin("DIR",upper_path
($virtual));
665 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
666 $tpl->fillin("SCRIPT",$script);
668 my $output = header
(-type
=> "text/html");
669 $output .= $tpl->get_template;
677 # Remove a file or a directory and return to directory view
679 # Params: 1. Reference to user input hash
680 # 2. Reference to config hash
682 # Return: Output of the command (Scalar Reference)
686 my ($data,$config) = @_;
687 my $physical = $data->{'physical'};
688 my $virtual = $data->{'virtual'};
690 return error
($config->{'errors'}->{'remove_root'},"/") if($virtual eq "/");
696 if($data->{'cgi'}->param('confirmed'))
699 return devedit_reload
({command
=> 'show', file
=> upper_path
($virtual)});
703 my $tpl = new Template
;
704 $tpl->read_file($config->{'templates'}->{'confirm_rmdir'});
706 $tpl->fillin("DIR",$virtual);
707 $tpl->fillin("UPPER_DIR",upper_path
($virtual));
708 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
709 $tpl->fillin("SCRIPT",$script);
711 my $output = header
(-type
=> "text/html");
712 $output .= $tpl->get_template;
721 return error
($config->{'errors'}->{'in_use'},upper_path
($virtual),{FILE
=> $virtual}) if($data->{'uselist'}->in_use($virtual));
723 if($data->{'cgi'}->param('confirmed'))
725 unlink($physical) or return error
($config->{'errors'}->{'delete_failed'},upper_path
($virtual),{FILE
=> $virtual});
726 return devedit_reload
({command
=> 'show', file
=> upper_path
($virtual)});
730 my $tpl = new Template
;
731 $tpl->read_file($config->{'templates'}->{'confirm_rmfile'});
733 $tpl->fillin("FILE",$virtual);
734 $tpl->fillin("DIR",upper_path
($virtual));
735 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
736 $tpl->fillin("SCRIPT",$script);
738 my $output = header
(-type
=> "text/html");
739 $output .= $tpl->get_template;
748 # Change the mode and the group of a file or a directory
750 # Params: 1. Reference to user input hash
751 # 2. Reference to config hash
753 # Return: Output of the command (Scalar Reference)
757 my ($data,$config) = @_;
758 my $physical = $data->{'physical'};
759 my $virtual = $data->{'virtual'};
760 my $dir = upper_path
($virtual);
761 my $cgi = $data->{'cgi'};
762 my $mode = $cgi->param('mode');
763 my $group = $cgi->param('group');
773 my $oct_mode = $mode;
774 $oct_mode = "0".$oct_mode if(length($oct_mode) == 3);
775 $oct_mode = oct($oct_mode);
777 chmod($oct_mode,$physical);
782 return error
($config->{'errors'}->{'invalid_group'},$dir,{GROUP
=> $group}) unless($group =~ /^[a-z0-9_]+[a-z0-9_-]*$/i);
783 system("chgrp",$group,$physical);
786 return devedit_reload
({command
=> 'show', file
=> $dir});
790 my @stat = stat($physical);
793 my $mode_oct = substr(sprintf("%04o",$mode),-4);
795 my $group = getgrgid($gid);
797 my $tpl = new Template
;
798 $tpl->read_file($config->{'templates'}->{'chprop'});
800 $tpl->fillin("MODE_OCTAL",$mode_oct);
801 $tpl->fillin("MODE_STRING",mode_string
($mode));
802 $tpl->fillin("GID",$gid);
803 $tpl->fillin("GROUP",$group);
805 $tpl->fillin("FILE",$virtual);
806 $tpl->fillin("DIR",$dir);
807 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
808 $tpl->fillin("SCRIPT",$script);
810 my $output = header
(-type
=> "text/html");
811 $output .= $tpl->get_template;
818 return error
($config->{'errors'}->{'not_owner'},$dir,{FILE
=> $virtual});
823 return error
($config->{'errors'}->{'no_users'},$dir,{FILE
=> $virtual});
829 # Remove a file from the list of used files and
830 # return to directory view
832 # Params: 1. Reference to user input hash
833 # 2. Reference to config hash
835 # Return: Output of the command (Scalar Reference)
839 my ($data,$config) = @_;
840 my $virtual = $data->{'virtual'};
841 my $uselist = $data->{'uselist'};
843 return devedit_reload
({command
=> 'show', file
=> upper_path
($virtual)}) if($uselist->unused($virtual));
845 if($data->{'cgi'}->param('confirmed'))
847 file_unlock
($uselist,$virtual);
848 return devedit_reload
({command
=> 'show', file
=> upper_path
($virtual)});
852 my $tpl = new Template
;
853 $tpl->read_file($config->{'templates'}->{'confirm_unlock'});
855 $tpl->fillin("FILE",$virtual);
856 $tpl->fillin("DIR",upper_path
($virtual));
857 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
858 $tpl->fillin("SCRIPT",$script);
860 my $output = header
(-type
=> "text/html");
861 $output .= $tpl->get_template;
869 # Display some information about Dev-Editor
871 # Params: 1. Reference to user input hash
872 # 2. Reference to config hash
874 # Return: Output of the command (Scalar Reference)
878 my ($data,$config) = @_;
880 my $tpl = new Template
;
881 $tpl->read_file($config->{'templates'}->{'about'});
883 $tpl->fillin("SCRIPT",$script);
885 # Dev-Editor's version number
887 $tpl->fillin("VERSION",$data->{'version'});
889 # Some path information
891 $tpl->fillin("SCRIPT_PHYS",$ENV{'SCRIPT_FILENAME'});
892 $tpl->fillin("CONFIG_PATH",$data->{'configfile'});
893 $tpl->fillin("FILE_ROOT",$config->{'fileroot'});
894 $tpl->fillin("HTTP_ROOT",$config->{'httproot'});
898 $tpl->fillin("PERL_PROG",$^X
);
899 $tpl->fillin("PERL_VER",sprintf("%vd",$^V
));
901 # Information about the server
903 $tpl->fillin("HTTPD",$ENV{'SERVER_SOFTWARE'});
904 $tpl->fillin("OS",$^O
);
905 $tpl->fillin("TIME",strftime
($config->{'timeformat'},localtime));
907 # Process information
909 $tpl->fillin("PID",$$);
911 # Check if the functions getpwuid() and getgrgid() are available
915 # Dev-Editor is running on a system which allows users and groups
916 # So we display the user and the group of our process
918 my $uid = POSIX
::getuid
;
919 my $gid = POSIX
::getgid
;
921 $tpl->parse_if_block("users",1);
923 # ID's of user and group
925 $tpl->fillin("UID",$uid);
926 $tpl->fillin("GID",$gid);
928 # Names of user and group
930 $tpl->fillin("USER",getpwuid($uid));
931 $tpl->fillin("GROUP",getgrgid($gid));
935 $tpl->fillin("UMASK",sprintf("%04o",umask));
939 $tpl->parse_if_block("users",0);
942 my $output = header
(-type
=> "text/html");
943 $output .= $tpl->get_template;
948 # it's true, baby ;-)
patrick-canterino.de