Exemple #1
0
}
//
// Initalizing static string wrapper
//
PMF_String::init($PMF_LANG["metaCharset"], $LANGCODE);
$category = new PMF_Category();
$currentCategory = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT);
$id = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
if (is_null($currentCategory) || is_null($id)) {
    header('HTTP/1.1 403 Forbidden');
    print 'Wrong HTTP GET parameters values.';
    exit;
}
$faq = new PMF_Faq();
$faq->getRecord($id);
$pdfFile = $faq->buildPDFFile($currentCategory);
// Sanity check: stop here if no PDF has been created
if (empty($pdfFile) || !file_exists($pdfFile)) {
    header('HTTP/1.1 404 Not Found');
    print 'PDF not available.';
    exit;
}
$file = basename($pdfFile);
$size = filesize($pdfFile);
session_cache_limiter('private');
header("Pragma: public");
header("Expires: 0");
// set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
if (preg_match("/MSIE/i", $_SERVER["HTTP_USER_AGENT"])) {
    header("Content-type: application/pdf");
Exemple #2
0
 }
 // Sanity check
 if (is_null($cat) || is_null($id) || is_null($artlang)) {
     header('HTTP/1.1 403 Forbidden');
     print 'Invalid FAQ link.';
     exit;
 }
 // Load categories
 $category = new PMF_Category();
 // Load the required faq
 $faq = new PMF_Faq();
 $faq->getRecord($id);
 // Get the HTML content
 $html = @PMF_Utils::getHTTPContent($link);
 // Try to attach the PDF content
 $pdfFile = $faq->buildPDFFile($cat);
 foreach ($mailto['mailto'] as $recipient) {
     $recipient = trim(strip_tags($recipient));
     if (!empty($recipient)) {
         $mail = new PMF_Mail();
         $mail->unsetFrom();
         $mail->setFrom($mailfrom, $name);
         $mail->addTo($recipient);
         $mail->subject = $PMF_LANG["msgS2FMailSubject"] . $name;
         $mail->message = $faqconfig->get("main.send2friendText") . "\r\n\r\n" . $PMF_LANG["msgS2FText2"] . "\r\n" . $link . "\r\n\r\n" . $attached;
         if ($html !== false) {
             $mail->messageAlt = $faqconfig->get("main.send2friendText") . "\r\n\r\n" . $PMF_LANG["msgS2FText2"] . "\r\n" . $link . "\r\n\r\n" . $attached;
             $mail->setHTMLMessage($html);
         }
         if (!empty($pdfFile) && file_exists($pdfFile)) {
             $mail->addAttachment($pdfFile, basename($pdfFile), 'application/pdf');