]>
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-10-05
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 my $direntries = dir_read
($physical);
101 return error
($config->{'dir_read_failed'},upper_path
($virtual),{DIR
=> '$virtual'}) unless($direntries);
103 my $files = $direntries->{'files'};
104 my $dirs = $direntries->{'dirs'};
108 # Create the link to the upper directory
109 # (only if we are not in the root directory)
111 unless($virtual eq "/")
113 my @stat = stat($physical."/..");
115 my $udtpl = new Template
;
116 $udtpl->read_file($config->{'templates'}->{'dirlist_up'});
118 $udtpl->fillin("UPPER_DIR",encode_entities
(upper_path
($virtual)));
119 $udtpl->fillin("DATE",strftime
($config->{'timeformat'},localtime($stat[9])));
121 $dirlist .= $udtpl->get_template;
126 foreach my $dir(@
$dirs)
128 my @stat = stat($physical."/".$dir);
129 my $virt_path = encode_entities
($virtual.$dir."/");
131 my $dtpl = new Template
;
132 $dtpl->read_file($config->{'templates'}->{'dirlist_dir'});
134 $dtpl->fillin("DIR",$virt_path);
135 $dtpl->fillin("DIR_NAME",$dir);
136 $dtpl->fillin("DATE",strftime
($config->{'timeformat'},localtime($stat[9])));
137 $dtpl->fillin("URL",equal_url
($config->{'httproot'},$virt_path));
139 $dtpl->parse_if_block("users",$users && -o
$physical."/".$dir);
141 $dirlist .= $dtpl->get_template;
146 foreach my $file(@
$files)
148 my $phys_path = $physical."/".$file;
149 my $virt_path = encode_entities
($virtual.$file);
151 my @stat = stat($phys_path);
152 my $in_use = $uselist->in_use($virtual.$file);
154 my $ftpl = new Template
;
155 $ftpl->read_file($config->{'templates'}->{'dirlist_file'});
157 $ftpl->fillin("FILE",$virt_path);
158 $ftpl->fillin("FILE_NAME",$file);
159 $ftpl->fillin("SIZE",$stat[7]);
160 $ftpl->fillin("DATE",strftime
($config->{'timeformat'},localtime($stat[9])));
161 $ftpl->fillin("URL",equal_url
($config->{'httproot'},$virt_path));
163 $ftpl->parse_if_block("not_readable",not -r
$phys_path);
164 $ftpl->parse_if_block("binary",-B
$phys_path);
165 $ftpl->parse_if_block("readonly",not -w
$phys_path);
167 $ftpl->parse_if_block("viewable",-r
$phys_path && -T
$phys_path && not ($config->{'max_file_size'} && $stat[7] > $config->{'max_file_size'}));
169 $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);
171 $ftpl->parse_if_block("in_use",$in_use);
172 $ftpl->parse_if_block("unused",not $in_use);
174 $ftpl->parse_if_block("too_large",$config->{'max_file_size'} && $stat[7] > $config->{'max_file_size'});
176 $ftpl->parse_if_block("users",$users && -o
$phys_path);
178 $dirlist .= $ftpl->get_template;
181 $tpl->read_file($config->{'templates'}->{'dirlist'});
183 $tpl->fillin("DIRLIST",$dirlist);
184 $tpl->fillin("DIR",$virtual);
185 $tpl->fillin("SCRIPT",$script);
186 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
192 return error
($config->{'errors'}->{'noview'},upper_path
($virtual)) unless(-r
$physical);
194 # Check on binary files
195 # We have to do it in this way, or empty files
196 # will be recognized as binary files
202 return error
($config->{'errors'}->{'binary'},upper_path
($virtual));
208 my $size = (stat($physical))[7];
210 if($config->{'max_file_size'} && $size > $config->{'max_file_size'})
212 return error
($config->{'errors'}->{'file_too_large'},upper_path
($virtual),{SIZE
=> $config->{'max_file_size'}})
216 my $content = file_read
($physical);
217 $$content =~ s/\015\012|\012|\015/\n/g;
219 $tpl->read_file($config->{'templates'}->{'viewfile'});
221 $tpl->fillin("FILE",$virtual);
222 $tpl->fillin("DIR",upper_path
($virtual));
223 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
224 $tpl->fillin("SCRIPT",$script);
225 $tpl->fillin("CONTENT",encode_entities
($$content));
227 $tpl->parse_if_block("editable",-r
$physical && -w
$physical && -T
$physical && not ($config->{'max_file_size'} && $size > $config->{'max_file_size'}) && $uselist->unused($virtual));
232 my $output = header
(-type
=> "text/html");
233 $output .= $tpl->get_template;
240 # Lock a file and display a form to edit it
242 # Params: 1. Reference to user input hash
243 # 2. Reference to config hash
245 # Return: Output of the command (Scalar Reference)
247 sub exec_beginedit
($$)
249 my ($data,$config) = @_;
250 my $physical = $data->{'physical'};
251 my $virtual = $data->{'virtual'};
252 my $uselist = $data->{'uselist'};
254 return error
($config->{'errors'}->{'editdir'},upper_path
($virtual)) if(-d
$physical);
255 return error
($config->{'errors'}->{'in_use'},upper_path
($virtual),{FILE
=> $virtual}) if($uselist->in_use($virtual));
256 return error
($config->{'errors'}->{'noedit'},upper_path
($virtual)) unless(-r
$physical && -w
$physical);
258 # Check on binary files
264 return error
($config->{'errors'}->{'binary'},upper_path
($virtual));
268 if($config->{'max_file_size'} && (stat($physical))[7] > $config->{'max_file_size'})
270 return error
($config->{'errors'}->{'file_too_large'},upper_path
($virtual),{SIZE
=> $config->{'max_file_size'}})
276 $uselist->add_file($virtual);
279 my $content = file_read
($physical);
280 $$content =~ s/\015\012|\012|\015/\n/g;
282 my $tpl = new Template
;
283 $tpl->read_file($config->{'templates'}->{'editfile'});
285 $tpl->fillin("FILE",$virtual);
286 $tpl->fillin("DIR",upper_path
($virtual));
287 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
288 $tpl->fillin("SCRIPT",$script);
289 $tpl->fillin("CONTENT",encode_entities
($$content));
291 my $output = header
(-type
=> "text/html");
292 $output .= $tpl->get_template;
303 # Params: 1. Reference to user input hash
304 # 2. Reference to config hash
306 # Return: Output of the command (Scalar Reference)
308 sub exec_canceledit
($$)
310 my ($data,$config) = @_;
311 my $virtual = $data->{'virtual'};
313 file_unlock
($data->{'uselist'},$virtual);
314 return devedit_reload
({command
=> 'show', file
=> upper_path
($virtual)});
319 # Save a file, unlock it and return to directory view
321 # Params: 1. Reference to user input hash
322 # 2. Reference to config hash
324 # Return: Output of the command (Scalar Reference)
328 my ($data,$config) = @_;
329 my $physical = $data->{'physical'};
330 my $virtual = $data->{'virtual'};
331 my $content = $data->{'cgi'}->param('filecontent');
332 my $uselist = $data->{'uselist'};
336 $content =~ s/\015\012|\012|\015/\n/g;
338 if($data->{'cgi'}->param('encode_iso'))
340 # Encode all ISO-8859-1 special chars
342 $content = encode_entities
($content,"\200-\377");
345 if($data->{'cgi'}->param('saveas') && $data->{'new_physical'} ne '' && $data->{'new_virtual'} ne '')
347 # Create the new filename
349 $physical = $data->{'new_physical'};
350 $virtual = $data->{'new_virtual'};
352 # Check if someone else is editing the new file
354 return error
($config->{'errors'}->{'in_use'},upper_path
($virtual),{FILE
=> $virtual}) if($uselist->in_use($virtual));
357 return error
($config->{'errors'}->{'text_to_binary'},upper_path
($virtual)) unless(-T
$physical);
358 return error
($config->{'errors'}->{'editdir'},upper_path
($virtual)) if(-d
$physical);
359 return error
($config->{'errors'}->{'noedit'}, upper_path
($virtual)) if(-e
$physical && !(-r
$physical && -w
$physical));
361 if(file_save
($physical,\
$content))
363 # Saving of the file was successful - so unlock it!
365 file_unlock
($uselist,$data->{'virtual'});
367 # Maybe the user saved the file using another filename...
368 # But we have to unlock the original file!
370 return devedit_reload
({command
=> 'show', file
=> upper_path
($virtual)});
374 return error
($config->{'errors'}->{'edit_failed'},upper_path
($virtual),{FILE
=> $virtual});
380 # Create a file and return to directory view
382 # Params: 1. Reference to user input hash
383 # 2. Reference to config hash
385 # Return: Output of the command (Scalar Reference)
389 my ($data,$config) = @_;
390 my $new_physical = $data->{'new_physical'};
391 my $new_virtual = $data->{'new_virtual'};
392 my $dir = upper_path
($new_virtual);
393 $new_virtual = encode_entities
($new_virtual);
397 return error
($config->{'errors'}->{'file_exists'},$dir,{FILE
=> $new_virtual}) if(-e
$new_physical);
399 file_create
($new_physical) or return error
($config->{'errors'}->{'mkfile_failed'},$dir,{FILE
=> $new_virtual});
400 return devedit_reload
({command
=> 'show', file
=> $dir});
404 my $tpl = new Template
;
405 $tpl->read_file($config->{'templates'}->{'mkfile'});
407 $tpl->fillin("DIR","/");
408 $tpl->fillin("SCRIPT",$script);
410 my $output = header
(-type
=> "text/html");
411 $output .= $tpl->get_template;
419 # Create a directory and return to directory view
421 # Params: 1. Reference to user input hash
422 # 2. Reference to config hash
424 # Return: Output of the command (Scalar Reference)
428 my ($data,$config) = @_;
429 my $new_physical = $data->{'new_physical'};
430 my $new_virtual = $data->{'new_virtual'};
431 my $dir = upper_path
($new_virtual);
432 $new_virtual = encode_entities
($new_virtual);
434 return error
($config->{'errors'}->{'file_exists'},$dir,{FILE
=> $new_virtual}) if(-e
$new_physical);
438 mkdir($new_physical,0777) or return error
($config->{'errors'}->{'mkdir_failed'},$dir,{DIR
=> $new_virtual});
439 return devedit_reload
({command
=> 'show', file
=> $dir});
443 my $tpl = new Template
;
444 $tpl->read_file($config->{'templates'}->{'mkdir'});
446 $tpl->fillin("DIR","/");
447 $tpl->fillin("SCRIPT",$script);
449 my $output = header
(-type
=> "text/html");
450 $output .= $tpl->get_template;
460 # Params: 1. Reference to user input hash
461 # 2. Reference to config hash
463 # Return: Output of the command (Scalar Reference)
467 my ($data,$config) = @_;
468 my $physical = $data->{'physical'};
469 my $virtual = $data->{'virtual'};
470 my $cgi = $data->{'cgi'};
472 if(my $uploaded_file = $cgi->param('uploaded_file'))
474 # Process file upload
476 my $filename = file_name
($uploaded_file);
477 my $file_phys = $physical."/".$filename;
478 my $file_virt = $virtual."".$filename;
480 return error
($config->{'errors'}->{'file_exists'},$virtual,{FILE
=> $file_virt}) if(-e
$file_phys && not $cgi->param('overwrite'));
482 my $ascii = $cgi->param('ascii');
483 my $handle = $cgi->upload('uploaded_file');
487 open(FILE
,">$file_phys") or return error
($config->{'errors'}->{'mkfile_failed'},$virtual,{FILE
=> $file_virt});
488 binmode(FILE
) unless($ascii);
490 # Read transferred file and write it to disk
492 read($handle, my $data, -s
$handle);
493 $data =~ s/\015\012|\012|\015/\n/g if($ascii); # Replace line separators if transferring in ASCII mode
498 return devedit_reload
({command
=> "show", file
=> $virtual});
502 my $tpl = new Template
;
503 $tpl->read_file($config->{'templates'}->{'upload'});
505 $tpl->fillin("DIR",$virtual);
506 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
507 $tpl->fillin("SCRIPT",$script);
509 my $output = header
(-type
=> "text/html");
510 $output .= $tpl->get_template;
518 # Copy a file and return to directory view
520 # Params: 1. Reference to user input hash
521 # 2. Reference to config hash
523 # Return: Output of the command (Scalar Reference)
527 my ($data,$config) = @_;
528 my $physical = $data->{'physical'};
529 my $virtual = encode_entities
($data->{'virtual'});
530 my $new_physical = $data->{'new_physical'};
532 return error
($config->{'errors'}->{'dircopy'}) if(-d
$physical);
533 return error
($config->{'errors'}->{'nocopy'}) unless(-r
$physical);
537 my $new_virtual = $data->{'new_virtual'};
538 my $dir = upper_path
($new_virtual);
539 $new_virtual = encode_entities
($new_virtual);
543 return error
($config->{'errors'}->{'exist_edited'},$dir,{FILE
=> $new_virtual}) if($data->{'uselist'}->in_use($data->{'new_virtual'}));
547 return error
($config->{'errors'}->{'dir_replace'},$dir);
549 elsif(not $data->{'cgi'}->param('confirmed'))
551 my $tpl = new Template
;
552 $tpl->read_file($config->{'templates'}->{'confirm_replace'});
554 $tpl->fillin("FILE",$virtual);
555 $tpl->fillin("NEW_FILE",$new_virtual);
556 $tpl->fillin("NEW_FILENAME",file_name
($new_virtual));
557 $tpl->fillin("NEW_DIR",$dir);
558 $tpl->fillin("DIR",upper_path
($virtual));
560 $tpl->fillin("COMMAND","copy");
561 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
562 $tpl->fillin("SCRIPT",$script);
564 my $output = header
(-type
=> "text/html");
565 $output .= $tpl->get_template;
571 copy
($physical,$new_physical) or return error
($config->{'errors'}->{'copy_failed'},upper_path
($virtual),{FILE
=> $virtual, NEW_FILE
=> $new_virtual});
572 return devedit_reload
({command
=> 'show', file
=> $dir});
576 my $tpl = new Template
;
577 $tpl->read_file($config->{'templates'}->{'copyfile'});
579 $tpl->fillin("FILE",$virtual);
580 $tpl->fillin("DIR",upper_path
($virtual));
581 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
582 $tpl->fillin("SCRIPT",$script);
584 my $output = header
(-type
=> "text/html");
585 $output .= $tpl->get_template;
593 # Rename/move a file and return to directory view
595 # Params: 1. Reference to user input hash
596 # 2. Reference to config hash
598 # Return: Output of the command (Scalar Reference)
602 my ($data,$config) = @_;
603 my $physical = $data->{'physical'};
604 my $virtual = $data->{'virtual'};
605 my $new_physical = $data->{'new_physical'};
607 return error
($config->{'errors'}->{'rename_root'},"/") if($virtual eq "/");
608 return error
($config->{'errors'}->{'in_use'},upper_path
($virtual),{FILE
=> $virtual}) if($data->{'uselist'}->in_use($virtual));
612 my $new_virtual = $data->{'new_virtual'};
613 my $dir = upper_path
($new_virtual);
614 $new_virtual = encode_entities
($new_virtual);
618 return error
($config->{'errors'}->{'exist_edited'},$dir,{FILE
=> $new_virtual}) if($data->{'uselist'}->in_use($data->{'new_virtual'}));
622 return error
($config->{'errors'}->{'dir_replace'},$dir);
624 elsif(not $data->{'cgi'}->param('confirmed'))
626 my $tpl = new Template
;
627 $tpl->read_file($config->{'templates'}->{'confirm_replace'});
629 $tpl->fillin("FILE",$virtual);
630 $tpl->fillin("NEW_FILE",$new_virtual);
631 $tpl->fillin("NEW_FILENAME",file_name
($new_virtual));
632 $tpl->fillin("NEW_DIR",$dir);
633 $tpl->fillin("DIR",upper_path
($virtual));
635 $tpl->fillin("COMMAND","rename");
636 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
637 $tpl->fillin("SCRIPT",$script);
639 my $output = header
(-type
=> "text/html");
640 $output .= $tpl->get_template;
646 rename($physical,$new_physical) or return error
($config->{'errors'}->{'rename_failed'},upper_path
($virtual),{FILE
=> $virtual, NEW_FILE
=> $new_virtual});
647 return devedit_reload
({command
=> 'show', file
=> $dir});
651 my $tpl = new Template
;
652 $tpl->read_file($config->{'templates'}->{'renamefile'});
654 $tpl->fillin("FILE",$virtual);
655 $tpl->fillin("DIR",upper_path
($virtual));
656 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
657 $tpl->fillin("SCRIPT",$script);
659 my $output = header
(-type
=> "text/html");
660 $output .= $tpl->get_template;
668 # Remove a file or a directory and return to directory view
670 # Params: 1. Reference to user input hash
671 # 2. Reference to config hash
673 # Return: Output of the command (Scalar Reference)
677 my ($data,$config) = @_;
678 my $physical = $data->{'physical'};
679 my $virtual = $data->{'virtual'};
681 return error
($config->{'errors'}->{'remove_root'},"/") if($virtual eq "/");
687 if($data->{'cgi'}->param('confirmed'))
690 return devedit_reload
({command
=> 'show', file
=> upper_path
($virtual)});
694 my $tpl = new Template
;
695 $tpl->read_file($config->{'templates'}->{'confirm_rmdir'});
697 $tpl->fillin("DIR",$virtual);
698 $tpl->fillin("UPPER_DIR",upper_path
($virtual));
699 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
700 $tpl->fillin("SCRIPT",$script);
702 my $output = header
(-type
=> "text/html");
703 $output .= $tpl->get_template;
712 return error
($config->{'errors'}->{'in_use'},upper_path
($virtual),{FILE
=> $virtual}) if($data->{'uselist'}->in_use($virtual));
714 if($data->{'cgi'}->param('confirmed'))
716 unlink($physical) or return error
($config->{'errors'}->{'delete_failed'},upper_path
($virtual),{FILE
=> $virtual});
717 return devedit_reload
({command
=> 'show', file
=> upper_path
($virtual)});
721 my $tpl = new Template
;
722 $tpl->read_file($config->{'templates'}->{'confirm_rmfile'});
724 $tpl->fillin("FILE",$virtual);
725 $tpl->fillin("DIR",upper_path
($virtual));
726 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
727 $tpl->fillin("SCRIPT",$script);
729 my $output = header
(-type
=> "text/html");
730 $output .= $tpl->get_template;
739 # Change the mode and the group of a file or a directory
741 # Params: 1. Reference to user input hash
742 # 2. Reference to config hash
744 # Return: Output of the command (Scalar Reference)
748 my ($data,$config) = @_;
749 my $physical = $data->{'physical'};
750 my $virtual = $data->{'virtual'};
751 my $dir = upper_path
($virtual);
752 my $cgi = $data->{'cgi'};
753 my $mode = $cgi->param('mode');
754 my $group = $cgi->param('group');
764 my $oct_mode = $mode;
765 $oct_mode = "0".$oct_mode if(length($oct_mode) == 3);
766 $oct_mode = oct($oct_mode);
768 chmod($oct_mode,$physical);
771 chgrp
($group,$physical) if($group);
773 return devedit_reload
({command
=> 'show', file
=> $dir});
777 my @stat = stat($physical);
780 my $mode_oct = substr(sprintf("%04o",$mode),-4);
782 my $group = getgrgid($gid);
784 my $tpl = new Template
;
785 $tpl->read_file($config->{'templates'}->{'chprop'});
787 $tpl->fillin("MODE_OCTAL",$mode_oct);
788 $tpl->fillin("MODE_STRING",mode_string
($mode));
789 $tpl->fillin("GID",$gid);
790 $tpl->fillin("GROUP",$group);
792 $tpl->fillin("FILE",$virtual);
793 $tpl->fillin("DIR",$dir);
794 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
795 $tpl->fillin("SCRIPT",$script);
797 my $output = header
(-type
=> "text/html");
798 $output .= $tpl->get_template;
805 return error
($config->{'errors'}->{'not_owner'},$dir,{FILE
=> $virtual});
810 return error
($config->{'errors'}->{'no_users'},$dir,{FILE
=> $virtual});
816 # Remove a file from the list of used files and
817 # return to directory view
819 # Params: 1. Reference to user input hash
820 # 2. Reference to config hash
822 # Return: Output of the command (Scalar Reference)
826 my ($data,$config) = @_;
827 my $virtual = $data->{'virtual'};
828 my $uselist = $data->{'uselist'};
830 return devedit_reload
({command
=> 'show', file
=> upper_path
($virtual)}) if($uselist->unused($virtual));
832 if($data->{'cgi'}->param('confirmed'))
834 file_unlock
($uselist,$virtual);
835 return devedit_reload
({command
=> 'show', file
=> upper_path
($virtual)});
839 my $tpl = new Template
;
840 $tpl->read_file($config->{'templates'}->{'confirm_unlock'});
842 $tpl->fillin("FILE",$virtual);
843 $tpl->fillin("DIR",upper_path
($virtual));
844 $tpl->fillin("URL",equal_url
($config->{'httproot'},$virtual));
845 $tpl->fillin("SCRIPT",$script);
847 my $output = header
(-type
=> "text/html");
848 $output .= $tpl->get_template;
856 # Display some information about Dev-Editor
858 # Params: 1. Reference to user input hash
859 # 2. Reference to config hash
861 # Return: Output of the command (Scalar Reference)
865 my ($data,$config) = @_;
867 my $tpl = new Template
;
868 $tpl->read_file($config->{'templates'}->{'about'});
870 $tpl->fillin("SCRIPT",$script);
872 # Dev-Editor's version number
874 $tpl->fillin("VERSION",$data->{'version'});
876 # Some path information
878 $tpl->fillin("SCRIPT_PHYS",$ENV{'SCRIPT_FILENAME'});
879 $tpl->fillin("CONFIG_PATH",$data->{'configfile'});
880 $tpl->fillin("FILE_ROOT",$config->{'fileroot'});
881 $tpl->fillin("HTTP_ROOT",$config->{'httproot'});
885 $tpl->fillin("PERL_PROG",$^X
);
886 $tpl->fillin("PERL_VER",sprintf("%vd",$^V
));
888 # Information about the server
890 $tpl->fillin("HTTPD",$ENV{'SERVER_SOFTWARE'});
891 $tpl->fillin("OS",$^O
);
892 $tpl->fillin("TIME",strftime
($config->{'timeformat'},localtime));
894 # Process information
896 $tpl->fillin("PID",$$);
898 # Check if the functions getpwuid() and getgrgid() are available
902 # Dev-Editor is running on a system which allows users and groups
903 # So we display the user and the group of our process
905 $tpl->parse_if_block("users",1);
907 # ID's of user and group
909 $tpl->fillin("UID",$<);
910 $tpl->fillin("GID",$();
912 # Names of user and group
914 $tpl->fillin("USER",getpwuid($<));
915 $tpl->fillin("GROUP",getgrgid($());
919 $tpl->parse_if_block("users",0);
922 my $output = header
(-type
=> "text/html");
923 $output .= $tpl->get_template;
928 # it's true, baby ;-)
patrick-canterino.de