2021-12-30 12:05:56 +01:00
|
|
|
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');
|
|
|
|
|
2022-09-15 17:06:08 +02:00
|
|
|
rcopy("$varenv{basedir}/pdfinvoice/$filesuff","$varenv{basedir}/cache/$coo/$filesuff");
|
2021-12-30 12:05:56 +01:00
|
|
|
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;
|