Inserito intval in add multimedia sul tipo

This commit is contained in:
Riccardo Di Dato
2016-03-31 14:11:41 +02:00
parent fd8c01af93
commit 05d926d582
2 changed files with 10 additions and 8 deletions
+1 -1
View File
@@ -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));
+9 -7
View File
@@ -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) . '"');
}
}