From 617a3f50eb72d936e126e6c705ecb54653616db0 Mon Sep 17 00:00:00 2001 From: Riccardo Di Dato Date: Sun, 25 Sep 2022 16:36:16 +0200 Subject: [PATCH] #5 Rimosso xsendfile fixato download pdf --- app/os/000-guiapi.template.conf | 6 ------ app/private/lib/dao/models/BannerModel.php | 7 ++++++- app/public/admin/newBanner.php | 2 ++ app/public/getPDF.php | 12 +++--------- docs/tech/install.memo | 2 +- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/app/os/000-guiapi.template.conf b/app/os/000-guiapi.template.conf index 55c0742..5446be0 100644 --- a/app/os/000-guiapi.template.conf +++ b/app/os/000-guiapi.template.conf @@ -19,12 +19,6 @@ RewriteRule "Giornale/all/.*" "oldArticleRedirect.php" [L,QSA] - - - XSendFile on - XSendFilePath "/tmp/xsend" - - diff --git a/app/private/lib/dao/models/BannerModel.php b/app/private/lib/dao/models/BannerModel.php index 359bda5..0652a40 100644 --- a/app/private/lib/dao/models/BannerModel.php +++ b/app/private/lib/dao/models/BannerModel.php @@ -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){ diff --git a/app/public/admin/newBanner.php b/app/public/admin/newBanner.php index dd66eec..3ea3589 100644 --- a/app/public/admin/newBanner.php +++ b/app/public/admin/newBanner.php @@ -196,6 +196,8 @@ try{ + +
diff --git a/app/public/getPDF.php b/app/public/getPDF.php index 17e780f..6a736c7 100644 --- a/app/public/getPDF.php +++ b/app/public/getPDF.php @@ -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); } } diff --git a/docs/tech/install.memo b/docs/tech/install.memo index 7ebb48e..371b19b 100644 --- a/docs/tech/install.memo +++ b/docs/tech/install.memo @@ -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"})