#5 Rimosso xsendfile fixato download pdf

This commit is contained in:
2022-09-25 16:36:16 +02:00
parent c666b50dd8
commit 617a3f50eb
5 changed files with 12 additions and 17 deletions
-6
View File
@@ -19,12 +19,6 @@
RewriteRule "Giornale/all/.*" "oldArticleRedirect.php" [L,QSA]
</Directory>
<IfModule xsendfile_module>
XSendFile on
XSendFilePath "/tmp/xsend"
</IfModule>
</VirtualHost>
+6 -1
View File
@@ -13,13 +13,18 @@ class BannerModel extends HasMediaModel{
const POSITION_HEAD = 1;
const POSITION_BODY = 2;
const POSITION_LONG = 3;
const POSITION_TOP = 4;
const POSITION_BOTTOM = 5;
const GENERAL_CATEGORY = 0;
public static $BANNER_POSITIONS = array(
self::POSITION_HEAD=>array("label"=>"Testata"),
self::POSITION_BODY=>array("label"=>"Corpo"),
self::POSITION_LONG=>array("label"=>"Corpo Lungo")
self::POSITION_LONG=>array("label"=>"Corpo Lungo"),
self::POSITION_TOP=>array("label"=>"Inizio pagina"),
self::POSITION_BOTTOM=>array("label"=>"Fine pagina")
);
public function __construct($saveableObject = null){
+2
View File
@@ -196,6 +196,8 @@ try{
<option value="<?php echo BannerModel::POSITION_HEAD;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_HEAD]["label"];?></option>
<option value="<?php echo BannerModel::POSITION_BODY;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_BODY]["label"];?></option>
<option value="<?php echo BannerModel::POSITION_LONG;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_LONG]["label"];?></option>
<option value="<?php echo BannerModel::POSITION_TOP;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_TOP]["label"];?></option>
<option value="<?php echo BannerModel::POSITION_BOTTOM;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_BOTTOM]["label"];?></option>
</select>
</div>
<div>
+3 -9
View File
@@ -12,17 +12,11 @@ if (array_key_exists("id",$_GET)) {
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)){
if (!SFSManager::fileExists(GlobalVariables::get("config")->paths->xsendfile) || !is_dir(GlobalVariables::get("config")->paths->xsendfile)){
SystemController::mkdir(GlobalVariables::get("config")->paths->xsendfile);
}
SystemController::shellExec("ln",'-nFs "'.$localFilePath.'" "'.$exposedFilePath.'"');
}
header('X-Sendfile: '.$exposedFilePath.'');
header("Content-type: application/octet-stream");
header('Content-Disposition: attachment; filename="' . basename($exposedFilePath) . '"');
header('Content-Disposition: attachment; filename="' . $id.".".$pdfModel->extension . '"');
echo file_get_contents($localFilePath);
}
}
+1 -1
View File
@@ -37,4 +37,4 @@ db.notizia.ensureIndex({"about.author": "text",sottotitolo: "text",testo: "text"
db.article_stats.ensureIndex({ "notizia": 1, "time": 1, "deleted": 1 }, {name: "quick_upsert"})
db.banner_stats.ensureIndex({ "banner": 1, "time": 1, "deleted": 1 }, {name: "quick_upsert"})
db.pageview_stats.ensureIndex({ "deleted": 1, "time": 1, "page": 1 }, {name: "quick_upsert"})
db.pageview_stats.ensureIndex({ "time": 1, "page": 1, "deleted": 1, }, {name: "quick_upsert"})