mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2024-11-15 15:06:38 +01:00
44 lines
1.1 KiB
Perl
Executable file
44 lines
1.1 KiB
Perl
Executable file
package Mod::FileOut;
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
|
|
#
|
|
use strict;
|
|
use warnings FATAL => 'all';
|
|
|
|
use CGI::Cookie ();
|
|
use CGI ':standard';
|
|
use Apache2::RequestUtil ();
|
|
use Apache2::RequestIO ();
|
|
use Apache2::Const -compile => qw(OK);
|
|
|
|
use File::Path qw(make_path remove_tree);
|
|
use File::Copy;
|
|
use File::Copy::Recursive qw(fcopy rcopy dircopy fmove rmove dirmove);
|
|
|
|
use Lib::Config;
|
|
|
|
|
|
sub handler {
|
|
my $r = shift;
|
|
my $q = new CGI();
|
|
my $coo = $q->cookie(-name=>'domcookie') || $q->param('sessionid') || 'zvzfcxd578';
|
|
|
|
my $cf = new Config;
|
|
my %varenv = $cf->envonline();
|
|
my $filesuff = $q->param('file');
|
|
|
|
my $dir = $varenv{data};
|
|
$dir = $varenv{pdfinvoice} if($varenv{pdfinvoice});
|
|
rcopy("$dir/$filesuff","$varenv{basedir}/cache/$coo/$filesuff");
|
|
print $q->redirect(-uri=>"$varenv{metahost}/cache/$coo/$filesuff", -type=>"application/octet-stream");
|
|
#remove_tree("$varenv{basedir}/cache/$coo");
|
|
#
|
|
#my $file = $varenv{data} . "/" . $filesuff;
|
|
#my $status = $r->sendfile($file);
|
|
|
|
return Apache2::Const::OK;
|
|
|
|
}
|
|
|
|
1;
|