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)){ 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) . '"'); } } } ?>