$id = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT); $getAll = PMF_Filter::filterInput(INPUT_GET, 'getAll', FILTER_VALIDATE_BOOLEAN, false); $faq = new PMF_Faq($faqConfig); $faq->setUser($current_user); $faq->setGroups($current_groups); $category = new PMF_Category($faqConfig, $current_groups, true); $category->setUser($current_user); $pdf = new PMF_Export_Pdf($faq, $category, $faqConfig); if (true === $getAll) { $category->buildTree(); } $tags = new PMF_Tags($faqConfig); session_cache_limiter('private'); if (true === $getAll && $user->perm->checkRight($user->getUserId(), 'export')) { $filename = 'FAQs.pdf'; $pdfFile = $pdf->generate(0, true, $lang); } elseif (is_null($currentCategory) || is_null($id)) { Response::create('Wrong HTTP GET parameters values.', 403)->send(); exit; } else { if (is_null($currentCategory) || is_null($id)) { $http->redirect($faqConfig->get('main.referenceURL')); exit; } $faq->getRecord($id); $faq->faqRecord['category_id'] = $currentCategory; $filename = 'FAQ-' . $id . '-' . $lang . '.pdf'; $pdfFile = $pdf->generateFile($faq->faqRecord, $filename); } $response = Response::create($pdfFile); $response->headers->set('Pragma', 'public');