X-Git-Url: http://git.treefish.org/fex.git/blobdiff_plain/97b87610331f53e756d032ad21db786037f921a1..20160919:/cgi-bin/fup?ds=sidebyside
diff --git a/cgi-bin/fup b/cgi-bin/fup
index 87cedaf..9ba0ef2 100755
--- a/cgi-bin/fup
+++ b/cgi-bin/fup
@@ -10,6 +10,7 @@
BEGIN { ($ENV{PERLINIT}||'') =~ /(.+)/s and eval $1 }
+use utf8;
use Encode;
use Fcntl qw':flock :seek :mode';
use IO::Handle;
@@ -57,7 +58,8 @@ my @header; # HTTP entity header
my $fileid; # file ID
my $captive;
my $muser; # main user fur sub or group user
-
+my %specific; # upload specific KEEP and AUTODELETE parameters
+
# load common code, local config: $FEXLIB/fex.ph
require "$FEXLIB/fex.pp";
@@ -66,7 +68,7 @@ our ($info_1,$info_2,$info_login);
$locale = $ENV{LOCALE} || 'english';
foreach (
- "/var/lib/fex/locale/$locale/lib/fup.pl",
+ "/var/lib/fex/locale/$locale/lib/fup.pl",
"$FEXLIB/fup.pl",
) {
if (-f) {
@@ -108,7 +110,8 @@ if ($addto) {
my %to;
foreach $to (@to) { $to{$to} = 1 }
push @to,$addto unless $to{$addto};
- if ($submit and @to == 1) { $addto = '' }
+ # user has submitted with [select from your address book] ?
+ # if ($submit and @to == 1) { $addto = '' }
}
$to = join(',',@to);
@@ -129,7 +132,7 @@ if ($from and $id_forgotten and $mail_authid and not ($fop_auth or $nomail)) {
# public recipients? (needs no auth-ID for sender)
if ($to and $id and $id eq 'PUBLIC' and @public_recipients) {
-
+
unless ($from) {
http_die("missing sender e-mail address");
}
@@ -146,12 +149,12 @@ if ($to and $id and $id eq 'PUBLIC' and @public_recipients) {
}
# anonymous upload from enabled IP?
-if ($from =~ /^anonymous@/ and
+if ($from =~ /^anonymous@/ and
@anonymous_upload and ipin($ra,@anonymous_upload)) {
$id = $rid = $anonymous = 'anonymous';
if ($to =~ /^anonymous/) {
@to = ($to);
- $autodelete{$to} = $autodelete = 'NO';
+ $autodelete{$to} = $autodelete = $specific{'autodelete'}||'NO';
}
$nomail = $anonymous;
}
@@ -161,7 +164,7 @@ $comment = 'NOMAIL' if $nomail and not $comment;
# one time token
if ($okey) {
$to = "@to" or http_die("no recipient specified");
- $from = readlink "$to/\@OKEY/$okey"
+ $from = readlink "$to/\@OKEY/$okey"
or http_die("no upload key \"$okey
\" - ".
"request another one from $to
");
$from = untaint($from);
@@ -199,10 +202,9 @@ if ($from and $id and not ($gkey or $skey or $public or $okey)) {
# set akey link for HTTP sessions
# (need original id for consistant non-moving akey)
if (-d $akeydir and open $idf,'<',"$from/@" and my $id = getline($idf)) {
- $akey = untaint(md5_hex("$from:$id"));
- mksymlink("$akeydir/$akey","../$from");
- # show URL from fexsend
- if ($from eq $to and $comment eq '*') {
+ # akey for webbrowser or fexsend special
+ if (not $sid or ($from eq $to and ($comment eq '*')) or $command) {
+ $akey = untaint(md5_hex("$from:$id"));
mksymlink("$akeydir/$akey","../$from");
}
}
@@ -252,12 +254,12 @@ if ($akey and $dkey and $command eq 'COPY') {
http_die("File not found");
}
if (-e "$to/$to/$file/data") {
- http_die("File $file already exists in your outgoing spool")
- if (readlink("$to/$to/$file/id")||$to) ne
+ http_die("File $file already exists in your outgoing spool")
+ if (readlink("$to/$to/$file/id")||$to) ne
(readlink("$to/$from/$file/id")||$from);
} else {
mkdirp("$to/$to/$file");
- link "$to/$from/$file/data","$to/$to/$file/data"
+ link "$to/$from/$file/data","$to/$to/$file/data"
or http_die("cannot link to $to/$to/$file/data - $!\n");
copy("$to/$from/$file/filename","$to/$to/$file/filename");
copy("$to/$from/$file/id","$to/$to/$file/id");
@@ -302,7 +304,7 @@ if ($akey and $dkey and $command eq 'DELETE') {
""
);
&reexec;
- } else {
+ } else {
my $s = $!;
http_header('404 Not Found');
print html_header($head);
@@ -315,7 +317,7 @@ if ($akey and $dkey and $command eq 'DELETE') {
# special commands
if (($from and $id and $rid eq $id or $gkey or $skey) and $command) {
-
+
if ($command eq 'CHECKQUOTA') {
http_die("illegal command \"$command\"") if $public or $anonymous;
nvt_print('HTTP/1.1 204 OK');
@@ -390,9 +392,9 @@ if (($from and $id and $rid eq $id or $gkey or $skey) and $command) {
$filename = <$file>;
close $file;
}
- if ($filename and length $filename) {
+ if ($filename and length $filename) {
$filename = html_quote($filename);
- } else {
+ } else {
$filename = '???';
}
if (open $file,'<',"$file/comment") {
@@ -401,22 +403,22 @@ if (($from and $id and $rid eq $id or $gkey or $skey) and $command) {
}
my $rkeep = untaint(readlink "$file/keep"||$keep_default)
- int((time-mtime("$file/filename"))/$DS);
- if ($comment =~ /NOMAIL/ or
+ if ($comment =~ /NOMAIL/ or
(readlink "$to/\@NOTIFICATION"||'') =~ /^no/i) {
- printf "%8s MB [%s d] %s/%s/%s\n",
+ printf "%8s MB (%2s d) %s/%s/%s\n",
$size,
$rkeep,
$durl,
$dkey,
urlencode(basename($file));
} else {
- printf "%8s MB [%s d] %s%s %s\n",
+ printf "%8s MB (%2s d) %s%s %s\n",
$size,
$rkeep,
untaint("/fup?akey=$akey&dkey=$dkey&command=RENOTIFY"),
$filename,
$comment ? qq' "$comment"' : '',
- $file eq $nfile ?
+ $file eq $nfile ?
" → notification e-mail has been resent" :
"";
}
@@ -428,7 +430,7 @@ if (($from and $id and $rid eq $id or $gkey or $skey) and $command) {
'