#!C:/Programme/Perl/bin/perl.exe -w
#
-# Dev-Editor 1.2
+# Dev-Editor 2.0 (CVS)
#
# Dev-Editor's main program
#
# Author: Patrick Canterino <patshaping@gmx.net>
-# Last modified: 2004-02-23
+# Last modified: 2004-03-06
#
use strict;
use CGI::Carp qw(fatalsToBrowser);
+use vars qw($VERSION);
use lib 'modules';
use CGI;
use Output;
use Tool;
+$VERSION = '2.0 (CVS)';
+
use constant CONFIGFILE => 'devedit.dat';
# Read the configuration file
$uselist->load;
# Create a hash with data submitted by user
- # (the CGI and the File::UseList object will also be included)
+ # (some other necessary information will also be included)
my %data = (physical => $physical,
virtual => $virtual,
new_physical => $new_physical,
new_virtual => $new_virtual,
uselist => $uselist,
- cgi => $cgi);
+ cgi => $cgi,
+ version => $VERSION,
+ configfile => CONFIGFILE);
my $output = exec_command($command,\%data,$config); # Execute the command...
# Execute Dev-Editor's commands
#
# Author: Patrick Canterino <patshaping@gmx.net>
-# Last modified: 2004-03-04
+# Last modified: 2004-03-09
#
use strict;
'copy' => \&exec_copy,
'rename' => \&exec_rename,
'remove' => \&exec_remove,
- 'unlock' => \&exec_unlock
+ 'unlock' => \&exec_unlock,
+ 'about' => \&exec_about
);
### Export ###
# Check if someone else is editing the new file
- return error_in_use($virtual) if($uselist->in_use($virtual));
+ return error($config->{'err_in_use'},upper_path($virtual),{FILE => $virtual}) if($uselist->in_use($virtual));
}
return error($config->{'err_editdir'},upper_path($virtual)) if(-d $physical);
$tpl->fillin("NEW_FILENAME",file_name($new_virtual));
$tpl->fillin("NEW_DIR",$dir);
$tpl->fillin("DIR",upper_path($virtual));
+
$tpl->fillin("COMMAND","copy");
$tpl->fillin("URL",equal_url($config->{'httproot'},$virtual));
$tpl->fillin("SCRIPT",$script);
$tpl->fillin("NEW_FILENAME",file_name($new_virtual));
$tpl->fillin("NEW_DIR",$dir);
$tpl->fillin("DIR",upper_path($virtual));
+
$tpl->fillin("COMMAND","rename");
$tpl->fillin("URL",equal_url($config->{'httproot'},$virtual));
$tpl->fillin("SCRIPT",$script);
}
}
+# exec_about()
+#
+# Display some information about Dev-Editor
+#
+# Params: 1. Reference to user input hash
+# 2. Reference to config hash
+#
+# Return: Output of the command (Scalar Reference)
+
+sub exec_about($$)
+{
+ my ($data,$config) = @_;
+
+ my $tpl = new Template;
+ $tpl->read_file($config->{'tpl_about'});
+
+ $tpl->fillin("SCRIPT",$script);
+
+ # Dev-Editor's version number
+
+ $tpl->fillin("VERSION",$data->{'version'});
+
+ # Some path information
+
+ $tpl->fillin("SCRIPT_PHYS",$ENV{'SCRIPT_FILENAME'});
+ $tpl->fillin("CONFIG_PATH",$data->{'configfile'});
+ $tpl->fillin("FILE_ROOT",$config->{'fileroot'});
+ $tpl->fillin("HTTP_ROOT",$config->{'httproot'});
+
+ # Perl
+
+ $tpl->fillin("PERL_PROG",$^X);
+ $tpl->fillin("PERL_VER",sprintf("%vd",$^V));
+
+ # Information about the server
+
+ $tpl->fillin("HTTPD",$ENV{'SERVER_SOFTWARE'});
+ $tpl->fillin("OS",$^O);
+ $tpl->fillin("TIME",strftime($config->{'timeformat'},localtime));
+
+ # Process information
+
+ $tpl->fillin("PID",$$);
+
+ # Check if the functions getpwuid() and getgrgid() are available
+
+ if(eval("getpwuid(0)") && eval("getgrgid(0)"))
+ {
+ # Dev-Editor is running on a system which allows users and groups
+ # So we display the user and the group of our process
+
+ $tpl->parse_if_block("users",1);
+
+ # ID's of user and group
+
+ $tpl->fillin("UID",$<);
+ $tpl->fillin("GID",$();
+
+ # Names of user and group
+
+ $tpl->fillin("USER",getpwuid($<));
+ $tpl->fillin("GROUP",getgrgid($());
+ }
+ else
+ {
+ $tpl->parse_if_block("users",0);
+ }
+
+ my $output = header(-type => "text/html");
+ $output .= $tpl->get_template;
+
+ return \$output;
+}
+
# it's true, baby ;-)
1;
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+<title>About Dev-Editor</title>
+<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+</head>
+<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
+
+<h1>About Dev-Editor</h1>
+
+<p>Dev-Editor {VERSION}</p>
+
+<p>© 1999-2000 Roland Blüthgen, <a href="http://www.defined.de/" target="_blank">Frank Schönmann</a><br />
+© 2003-2004 <a href="http://www.patshaping.de/" target="_blank">Patrick Canterino</a></p>
+
+<p><a href="http://devedit.sourceforge.net/artistic.txt" target="_blank">View license</a> (needs an active internet connection)</p>
+
+<p><a href="http://devedit.sourceforge.net/" target="_blank">http://devedit.sourceforge.net/</a></p>
+
+<hr>
+
+<table border="0">
+
+<tr>
+<td><b>Physical script path:</b></td>
+<td>{SCRIPT_PHYS}</td>
+</tr>
+
+<tr>
+<td><b>Path to configuration file:</b></td>
+<td>{CONFIG_PATH}</td>
+</tr>
+
+<tr>
+<td><b>Physical root directory:</b></td>
+<td>{FILE_ROOT}</td>
+</tr>
+
+<tr>
+<td><b>HTTP root:</b></td>
+<td>{HTTP_ROOT}</td>
+</tr>
+
+<tr>
+<td><b>Perl executable:</b></td>
+<td>{PERL_PROG}</td>
+</tr>
+
+<tr>
+<td><b>Perl version:</b></td>
+<td>{PERL_VER}</td>
+</tr>
+
+<tr>
+<td><b>HTTP server software:</b></td>
+<td>{HTTPD}</td>
+</tr>
+
+<tr>
+<td><b>Server operating system:</b></td>
+<td>{OS}</td>
+</tr>
+
+<tr>
+<td><b>Server time:</b></td>
+<td>{TIME}</td>
+</tr>
+
+<tr>
+<td><b>Process ID:</b></td>
+<td>{PID}</td>
+</tr>
+{IF users}
+<tr>
+<td><b>User:</b></td>
+<td>{USER} (UID: {UID})</td>
+</tr>
+
+<tr>
+<td><b>Group:</b></td>
+<td>{GROUP} (GID: {GID})</td>
+</tr>
+{ENDIF}
+</table>
+
+<hr>
+
+</body>
+</html>
\ No newline at end of file