From 05d926d582de0cd270d8a73cad2794c40e964564 Mon Sep 17 00:00:00 2001 From: Riccardo Di Dato Date: Thu, 31 Mar 2016 14:11:41 +0200 Subject: [PATCH] Inserito intval in add multimedia sul tipo --- public/admin/addMultimedia.php | 2 +- public/getPDF.php | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/public/admin/addMultimedia.php b/public/admin/addMultimedia.php index 88bb145..7ceaab1 100644 --- a/public/admin/addMultimedia.php +++ b/public/admin/addMultimedia.php @@ -21,7 +21,7 @@ try{ throw new CoreException("Trying to add a media to an invalid model with id '".$notiziaId. "'"); } else{ - $mediaTypeSaved = PostHandler::get("mediaType"); + $mediaTypeSaved = intval(PostHandler::get("mediaType")); if(array_key_exists("action", $_POST) && strcmp(PostHandler::get("action"), "save")==0){ $notizia = GlobalVariables::get("dao")->getFirst("NotiziaModel",array("id"=>$notiziaId)); diff --git a/public/getPDF.php b/public/getPDF.php index e1bf0c1..5ab897a 100644 --- a/public/getPDF.php +++ b/public/getPDF.php @@ -11,14 +11,16 @@ if (array_key_exists("id",$_GET)) { $id = $_GET["id"]; if (!is_null($pdfModel)){ $localFilePath = GlobalVariables::get("config")->paths->media."/".$id.".pdf"; - $exposedFilePath = GlobalVariables::get("config")->paths->xsendfile."/".$id.".pdf"; - if (!SFSManager::fileExists($exposedFilePath)){ - SystemController::shellExec("ln",'-s "'.$localFilePath.'" "'.$exposedFilePath.'"'); + if (SFSManager::fileExists($localFilePath)){ + $exposedFilePath = GlobalVariables::get("config")->paths->xsendfile."/".$id.".pdf"; + 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) . '"'); } - header('X-Sendfile: '.$exposedFilePath.''); - - header("Content-type: application/octet-stream"); - header('Content-Disposition: attachment; filename="' . basename($exposedFilePath) . '"'); } }