29 lines
894 B
PHP
29 lines
894 B
PHP
<?php
|
|
/*
|
|
Author: Riccardo Di Dato
|
|
Creation Date: 04/mar/2016
|
|
*/
|
|
|
|
require_once(dirname(__FILE__). "/load.php");
|
|
|
|
if (array_key_exists("id",$_GET)) {
|
|
$pdfModel = GlobalVariables::get("dao")->getFirst("MediaModel",array("id"=>$_GET['id']));
|
|
$id = $_GET["id"];
|
|
if (!is_null($pdfModel)){
|
|
$localFilePath = GlobalVariables::get("config")->paths->media."/".$id.".".$pdfModel->extension;
|
|
if (SFSManager::fileExists($localFilePath)){
|
|
$exposedFilePath = GlobalVariables::get("config")->paths->xsendfile."/".$id.".".$pdfModel->extension;
|
|
if (!SFSManager::fileExists($exposedFilePath)){
|
|
SystemController::shellExec("ln",'-s "'.$localFilePath.'" "'.$exposedFilePath.'"');
|
|
}
|
|
header('X-Sendfile: '.$exposedFilePath.'');
|
|
|
|
header("Content-type: application/octet-stream");
|
|
header('Content-Disposition: attachment; filename="' . basename($exposedFilePath) . '"');
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
?>
|