# Author: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
#
+BEGIN { ($ENV{PERLINIT}||'') =~ /(.+)/s and eval $1 }
+
use Fcntl qw(:flock :seek :mode);
-use CGI qw(:standard);
-use CGI::Carp qw(fatalsToBrowser);
-use Fcntl qw(:flock);
use Digest::MD5 qw(md5_hex);
# add fex lib
(our $FEXLIB) = $ENV{FEXLIB} =~ /(.+)/;
die "$0: no $FEXLIB\n" unless -d $FEXLIB;
-our ($keep_default,$dkeydir,$akeydir,$mdomain,$logdir,$fra);
+our ($keep_default,$dkeydir,$akeydir,$mdomain,@logdir,$fra);
our $akey = '';
# load common code, local config : $HOME/lib/fex.ph
chdir $spooldir or die "$spooldir - $!\n";
-my $log = "$logdir/rup.log";
-
$from = $id = $oto = $nto = $file = '';
# look for CGI parameters
-foreach my $v (param) {
- $vv = param($v);
+our %PARAM;
+&parse_parameters;
+foreach my $v (keys %PARAM) {
+ my $vv = $PARAM{$v};
$vv =~ s/[<>\'\`\"\000-\037]//g;
if ($v =~ /^akey$/i and $vv =~ /^(\w+)$/) {
$akey = $1;
unlink "$nto/$from/$fkey/notify";
unlink "$nto/$from/$fkey/error";
unlink "$nto/$from/$fkey/download";
- if (slurp("$oto/$from/$fkey/$comment") =~ 'NOMAIL') {
+ if (slurp("$oto/$from/$fkey/comment")||'' =~ /NOMAIL/) {
unlink "$nto/$from/$fkey/comment";
}
$dkey = randstring(8);
$msg =~ s/\n/ /g;
$msg =~ s/\s+$//;
-
- if (open $log,'>>',$log) {
- flock $log,LOCK_EX;
- seek $log,0,SEEK_END;
- printf {$log} "%s [%s_%s] (%s) %s\n",
- isodate(time),$$,$ENV{REQUESTCOUNT},$fra,$msg;
- close $log;
+ $msg = sprintf "%s [%s_%s] (%s) %s\n",
+ isodate(time),$$,$ENV{REQUESTCOUNT},$fra,$msg;
+
+ foreach my $log (@logdir) {
+ if (open $log,'>>',"$log/rup.log") {
+ flock $log,LOCK_EX;
+ seek $log,0,SEEK_END;
+ printf {$log} $msg;
+ close $log;
+ }
}
}