$downwards = PMF_Filter::filterInput(INPUT_POST, 'downwards', FILTER_VALIDATE_BOOLEAN, false); $inlineDisposition = PMF_Filter::filterInput(INPUT_POST, 'dispos', FILTER_VALIDATE_BOOLEAN, false); $type = PMF_Filter::filterInput(INPUT_POST, 'type', FILTER_SANITIZE_STRING, EXPORT_TYPE_NONE); // Prepare the file content to be streamed switch ($type) { case EXPORT_TYPE_DOCBOOK: $content = PMF_Export::getDocBookExport($catid, $downwards); break; case EXPORT_TYPE_PDF: $content = PMF_Export::getPDFExport($catid, $downwards); break; case EXPORT_TYPE_XHTML: $content = PMF_Export::getXHTMLExport($catid, $downwards); break; case EXPORT_TYPE_XML: $content = PMF_Export::getXMLExport($catid, $downwards); break; // In this case no default statement is required: // the one above is just for clean coding style // In this case no default statement is required: // the one above is just for clean coding style default: break; } // Stream the file content $oHttpStreamer = new PMF_HttpStreamer($type, $content); if ($inlineDisposition) { $oHttpStreamer->send(PMF_HttpStreamer::HTTP_CONTENT_DISPOSITION_INLINE); } else { $oHttpStreamer->send(PMF_HttpStreamer::HTTP_CONTENT_DISPOSITION_ATTACHMENT); }