/** * Generates the export * * @param integer $categoryId Category Id * @param boolean $downwards If true, downwards, otherwise upward ordering * @param string $language Language * * @return string */ public function generate($categoryId = 0, $downwards = true, $language = '') { global $PMF_LANG; // Set PDF options $this->pdf->enableBookmarks = true; $this->pdf->isFullExport = true; $filename = 'FAQs.pdf'; // Initialize categories $this->category->transform($categoryId); $this->pdf->setCategory($categoryId); $this->pdf->setCategories($this->category->categoryName); $this->pdf->SetCreator($this->_config->get('main.titleFAQ') . ' - powered by phpMyFAQ ' . $this->_config->get('main.currentVersion')); $faqdata = $this->faq->get(FAQ_QUERY_TYPE_EXPORT_XML, $categoryId, $downwards, $language); $categories = $this->category->catTree; $categoryGroup = 0; $this->pdf->AddPage(); foreach ($categories as $category) { if ($category['id'] !== $categoryGroup) { $this->pdf->Bookmark(html_entity_decode($this->category->categoryName[$category['id']]['name'], ENT_QUOTES, 'utf-8'), $category['level'], 0); $categoryGroup = $category['id']; } foreach ($faqdata as $faq) { if ($faq['category_id'] === $category['id']) { $this->pdf->AddPage(); $this->pdf->setCategory($category['id']); $this->pdf->Bookmark(html_entity_decode($faq['topic'], ENT_QUOTES, 'utf-8'), $category['level'] + 1, 0); if ($this->tags instanceof PMF_Tags) { $tags = $this->tags->getAllTagsById($faq['id']); } $this->pdf->WriteHTML('<h2 align="center">' . $faq['topic'] . '</h2>', true); $this->pdf->Ln(10); $this->pdf->SetFont($this->pdf->getCurrentFont(), '', 12); $this->pdf->WriteHTML(trim($faq['content'])); $this->pdf->Ln(10); if (!empty($faq['keywords'])) { $this->pdf->Ln(); $this->pdf->Write(5, $PMF_LANG['msgNewContentKeywords'] . ' ' . $faq['keywords']); } if (isset($tags) && 0 !== count($tags)) { $this->pdf->Ln(); $this->pdf->Write(5, $PMF_LANG['ad_entry_tags'] . ': ' . implode(', ', $tags)); } $this->pdf->Ln(); $this->pdf->Ln(); $this->pdf->Write(5, $PMF_LANG['msgLastUpdateArticle'] . PMF_Date::createIsoDate($faq['lastmodified'])); } } } // remove default header/footer $this->pdf->setPrintHeader(false); $this->pdf->addFaqToc(); return $this->pdf->Output($filename); }
$sticky = PMF_Filter::filterInput(INPUT_POST, 'sticky', FILTER_SANITIZE_STRING); $content = PMF_Filter::filterInput(INPUT_POST, 'answer', FILTER_SANITIZE_SPECIAL_CHARS); $keywords = PMF_Filter::filterInput(INPUT_POST, 'keywords', FILTER_SANITIZE_STRING); $author = PMF_Filter::filterInput(INPUT_POST, 'author', FILTER_SANITIZE_STRING); $email = PMF_Filter::filterInput(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL); $comment = PMF_Filter::filterInput(INPUT_POST, 'comment', FILTER_SANITIZE_STRING); $record_id = PMF_Filter::filterInput(INPUT_POST, 'record_id', FILTER_VALIDATE_INT); $solution_id = PMF_Filter::filterInput(INPUT_POST, 'solution_id', FILTER_VALIDATE_INT); $revision_id = PMF_Filter::filterInput(INPUT_POST, 'revision_id', FILTER_VALIDATE_INT); $changed = PMF_Filter::filterInput(INPUT_POST, 'changed', FILTER_SANITIZE_STRING); $user_permission = PMF_Filter::filterInput(INPUT_POST, 'userpermission', FILTER_SANITIZE_STRING); $restricted_users = 'all' == $user_permission ? -1 : PMF_Filter::filterInput(INPUT_POST, 'restricted_users', FILTER_VALIDATE_INT); $group_permission = PMF_Filter::filterInput(INPUT_POST, 'grouppermission', FILTER_SANITIZE_STRING); $restricted_groups = 'all' == $group_permission ? -1 : PMF_Filter::filterInput(INPUT_POST, 'restricted_groups', FILTER_VALIDATE_INT); if (!is_null($question) && !is_null($categories)) { $tagging = new PMF_Tags($faqConfig); $category = new PMF_Category($faqConfig, [], false); $category->setUser($currentAdminUser); $category->setGroups($currentAdminGroups); if (!isset($categories['rubrik'])) { $categories['rubrik'] = []; } $recordData = array('id' => $record_id, 'lang' => $record_lang, 'revision_id' => $revision_id, 'active' => $active, 'sticky' => !is_null($sticky) ? 1 : 0, 'thema' => html_entity_decode($question), 'content' => html_entity_decode($content), 'keywords' => $keywords, 'author' => $author, 'email' => $email, 'comment' => !is_null($comment) ? 'y' : 'n', 'date' => empty($date) ? date('YmdHis') : str_replace(array('-', ':', ' '), '', $date), 'dateStart' => empty($dateStart) ? '00000000000000' : str_replace('-', '', $dateStart) . '000000', 'dateEnd' => empty($dateEnd) ? '99991231235959' : str_replace('-', '', $dateEnd) . '235959', 'linkState' => '', 'linkDateCheck' => 0); if ('saveentry' == $do || $record_id) { /* Create a revision anyway, it's autosaving */ $faq->addNewRevision($record_id, $record_lang); $revision_id++; $faq->createChangeEntry($record_id, $user->getUserId(), nl2br($changed), $record_lang, $revision_id); $visits = new PMF_Visits($faqConfig); $visits->add($record_id); if ($faq->isAlreadyTranslated($record_id, $record_lang)) {
$lang = PMF_Filter::filterInput(INPUT_POST, 'artlang', FILTER_SANITIZE_STRING); if (is_null($lang) && !PMF_Language::isASupportedLanguage($lang)) { $lang = $LANGCODE; } // // Create a new FAQ object // $faq = new PMF_Faq($current_user, $current_groups); // // Create a new Category object // $category = new PMF_Category($current_user, $current_groups); // // Create a new Tags object // $oTag = new PMF_Tags(); // // Found a record ID? // $id = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT); if (!is_null($id)) { $title = ' - ' . $faq->getRecordTitle($id); $keywords = ' ' . $faq->getRecordKeywords($id); } else { $id = ''; $title = ' - powered by phpMyFAQ ' . $faqconfig->get('main.currentVersion'); $keywords = ''; } // // found a solution ID? //
* @link http://www.phpmyfaq.de * @since 2005-12-15 */ if (!defined('IS_VALID_PHPMYFAQ')) { $protocol = 'http'; if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') { $protocol = 'https'; } header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } // Send headers $http = new PMF_Helper_Http(); $http->setContentType('application/json'); $http->addHeader(); $oTag = new PMF_Tags($faqConfig); $autoCompleteValue = PMF_Filter::filterInput(INPUT_GET, 'q', FILTER_SANITIZE_STRIPPED); if (!is_null($autoCompleteValue)) { if (strpos($autoCompleteValue, ',')) { $arrayOfValues = explode(',', $autoCompleteValue); $autoCompleteValue = end($arrayOfValues); } $tags = $oTag->getAllTags(strtolower($autoCompleteValue), PMF_TAGS_CLOUD_RESULT_SET_SIZE, true); } else { $tags = $oTag->getAllTags(); } if ($permission['editbt']) { $i = 0; $tagNames = array(); foreach ($tags as $tagName) { $i++;
* @package Frontend * @author Thorsten Rinne <*****@*****.**> * @author Lars Tiedemann <*****@*****.**> * @copyright 2002-2010 phpMyFAQ Team * @license http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1 * @link http://www.phpmyfaq.de * @since 2002-08-27 */ if (!defined('IS_VALID_PHPMYFAQ')) { header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } $captcha = new PMF_Captcha($sids); $oGlossary = new PMF_Glossary(); $oLnk = new PMF_Linkverifier(); $tagging = new PMF_Tags(); $relevant = new PMF_Relation(); $faqrating = new PMF_Rating(); $comment = new PMF_Comment(); if (!is_null($showCaptcha)) { $captcha->showCaptchaImg(); exit; } $currentCategory = $cat; $record_id = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT); $solution_id = PMF_Filter::filterInput(INPUT_GET, 'solution_id', FILTER_VALIDATE_INT); $highlight = PMF_Filter::filterInput(INPUT_GET, 'highlight', FILTER_SANITIZE_STRIPPED); $faqsession->userTracking('article_view', $record_id); // Get all data from the FAQ record if (0 == $solution_id) { $faq->getRecord($record_id);
if ($allLanguages) { $category = new PMF_Category(); $category->transform(0); } if (is_null($user)) { $user = new PMF_User_CurrentUser(); } $faqSearch = new PMF_Search($db, $Language); $faqSearchResult = new PMF_Search_Resultset($user, $faq); $tagSearch = false; // // Handle the Tagging ID // if (!is_null($inputTag)) { $tagSearch = true; $tagging = new PMF_Tags($db, $Language); $recordIds = $tagging->getRecordsByTagId($inputTag); $searchResult = $faq->showAllRecordsByIds($recordIds); } else { $searchResult = ''; } // // Handle the full text search stuff // if (!is_null($inputSearchTerm) || !is_null($search)) { if (!is_null($inputSearchTerm)) { $inputSearchTerm = $db->escape_string(strip_tags($inputSearchTerm)); } if (!is_null($search)) { $inputSearchTerm = $db->escape_string(strip_tags($search)); }
// Add new record and get that ID $faqRecord = new PMF_Faq_Record(); $faqChangelog = new PMF_Faq_Changelog(); if ($faqRecord->create($recordData)) { $recordId = $faqRecord->getRecordId(); // Create ChangeLog entry $changelogData = array('record_id' => $recordId, 'record_lang' => $recordData['lang'], 'revision_id' => 0, 'user_id' => $user->getUserId(), 'date' => $_SERVER['REQUEST_TIME'], 'changelog' => nl2br($changed)); $faqChangelog->create($changelogData); // Create the visit entry $visits = PMF_Visits::getInstance(); $visits->add($recordId, $recordData['lang']); // Insert the new category relations $categoryRelations = new PMF_Category_Relations(); // Insert the tags if ($tags != '') { $tagging = new PMF_Tags(); $tagging->saveTags($recordId, explode(',', $tags)); } // Set record permissions $faqUser = new PMF_Faq_User(); $faqUser->create(array('record_id' => $recordId, 'user_id' => $restricted_users)); if ($groupSupport) { $faqGroup = new PMF_Faq_Group(); $faqGroup->create(array('record_id' => $recordId, 'group_id' => $restricted_groups)); } // Loop the categories $categoryUser = new PMF_Category_User(); $categoryGroup = new PMF_Category_Group(); $categoryRelations = new PMF_Category_Relations(); $categoryRelations->setLanguage($recordData['lang']); foreach ($categories['rubrik'] as $categoryId) {
*/ if (!defined('IS_VALID_PHPMYFAQ')) { header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } // Re-evaluate $user $user = PMF_User_CurrentUser::getFromSession($faqconfig->get('security.ipCheck')); if (($permission['editbt'] || $permission['addbt']) && !PMF_Db::checkOnEmptyTable('faqcategories')) { $category = new PMF_Category($current_admin_user, $current_admin_groups, false); $category->buildTree(); $helper = PMF_Helper_Category::getInstance(); $helper->setCategory($category); $selectedCategory = ''; $categories = array(); $faqData = array('id' => 0, 'lang' => $LANGCODE, 'revision_id' => 0, 'title' => '', 'dateStart' => '', 'dateEnd' => ''); $tagging = new PMF_Tags($db, $Language); if ($action == 'takequestion') { $questionId = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT); $question = $faq->getQuestion($questionId); $selectedCategory = $question['category_id']; $faqData['title'] = $question['question']; $categories = array('category_id' => $selectedCategory, 'category_lang' => $faqData['lang']); } if ($action == 'editpreview') { $faqData['id'] = PMF_Filter::filterInput(INPUT_POST, 'id', FILTER_VALIDATE_INT); if (!is_null($faqData['id'])) { $queryString = 'saveentry&id=' . $faqData['id']; } else { $queryString = 'insertentry'; } $faqData['lang'] = PMF_Filter::filterInput(INPUT_POST, 'lang', FILTER_SANITIZE_STRING);
* @copyright 2005-2010 phpMyFAQ Team * @license http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1 * @link http://www.phpmyfaq.de * @since 2005-12-15 */ if (!defined('IS_VALID_PHPMYFAQ')) { header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header("Vary: Negotiate,Accept"); $oTag = new PMF_Tags(); $autoCompleteValue = PMF_Filter::filterInput(INPUT_GET, 'q', FILTER_SANITIZE_STRIPPED); if (!is_null($autoCompleteValue)) { $tags = $oTag->getAllTags($autoCompleteValue); } else { $tags = $oTag->getAllTags(); } if (count(ob_list_handlers()) > 0) { ob_clean(); } if ($permission['editbt']) { $i = 0; foreach ($tags as $tagName) { $i++; if ($i <= PMF_TAGS_AUTOCOMPLETE_RESULT_SET_SIZE) { print $tagName . "\n";
if ('all' === PMF_Filter::filterInput(INPUT_POST, 'userpermission', FILTER_SANITIZE_STRING)) { $permissions += array('restricted_user' => array(-1)); } else { $permissions += array('restricted_user' => array(PMF_Filter::filterInput(INPUT_POST, 'restricted_users', FILTER_VALIDATE_INT))); } if ('all' === PMF_Filter::filterInput(INPUT_POST, 'grouppermission', FILTER_SANITIZE_STRING)) { $permissions += array('restricted_groups' => array(-1)); } else { $permissions += PMF_Filter::filterInputArray(INPUT_POST, array('restricted_groups' => array('filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_ARRAY))); } if (!is_null($question) && !is_null($categories)) { // Save entry $logging = new PMF_Logging($faqConfig); $logging->logAdmin($user, 'Beitragsave ' . $recordId); printf('<header><h2><i class="icon-pencil"></i> %s</h2></header>', $PMF_LANG['ad_entry_aor']); $tagging = new PMF_Tags($faqConfig); if ('yes' == $revision) { // Add current version into revision table $faq->addNewRevision($recordId, $recordLang); $revisionId++; } $recordData = array('id' => $recordId, 'lang' => $recordLang, 'revision_id' => $revisionId, 'active' => $active, 'sticky' => !is_null($sticky) ? 1 : 0, 'thema' => html_entity_decode($question), 'content' => html_entity_decode($content), 'keywords' => $keywords, 'author' => $author, 'email' => $email, 'comment' => !is_null($comment) ? 'y' : 'n', 'date' => empty($date) ? date('YmdHis') : str_replace(array('-', ':', ' '), '', $date), 'dateStart' => empty($dateStart) ? '00000000000000' : str_replace('-', '', $dateStart) . '000000', 'dateEnd' => empty($dateEnd) ? '99991231235959' : str_replace('-', '', $dateEnd) . '235959', 'linkState' => '', 'linkDateCheck' => 0); // Create ChangeLog entry $faq->createChangeEntry($recordId, $user->getUserId(), nl2br($changed), $recordLang, $revisionId); // Create the visit entry $visits = new PMF_Visits($faqConfig); $visits->add($recordId); // save or update the FAQ record if ($faq->isAlreadyTranslated($recordId, $recordLang)) { $faq->updateRecord($recordData); } else {
$languages = ''; } // HACK: (re)evaluate the Category object w/o passing the user language // so the result set of a Search will have the Category Path // for any of the multilanguage faq records and the Category list // on the left pane will not be affected if ($allLanguages) { $category = new PMF_Category($faqConfig); $category->transform(0); } if (is_null($user)) { $user = new PMF_User_CurrentUser($faqConfig); } $faqSearch = new PMF_Search($faqConfig); $faqSearchResult = new PMF_Search_Resultset($user, $faq, $faqConfig); $tagging = new PMF_Tags($faqConfig); $tagHelper = new PMF_Helper_Tags(); $tagSearch = false; // // Handle the Tagging ID // if (!is_null($inputTag) && '' !== $inputTag) { $tagSearch = true; $tags = []; $tagIds = explode(',', $inputTag); $tagHelper->setTaggingIds($tagIds); foreach ($tagIds as $tagId) { if (!isset($tags[$tagId])) { $tags[$tagId] = $tagging->getTagNameById($tagId); } }
* @package Frontend * @author Thorsten Rinne <*****@*****.**> * @author Lars Tiedemann <*****@*****.**> * @copyright 2002-2012 phpMyFAQ Team * @license http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1 * @link http://www.phpmyfaq.de * @since 2002-08-27 */ if (!defined('IS_VALID_PHPMYFAQ')) { header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } $captcha = new PMF_Captcha($db, $Language); $oGlossary = new PMF_Glossary(); $oLnk = new PMF_Linkverifier(); $faqTagging = new PMF_Tags($db, $Language); $faqRelation = new PMF_Relation($db, $Language); $faqRating = new PMF_Rating(); $faqComment = new PMF_Comment(); if (is_null($user)) { $user = new PMF_User_CurrentUser(); } $faqSearchResult = new PMF_Search_Resultset($user, $faq); $captcha->setSessionId($sids); if (!is_null($showCaptcha)) { $captcha->showCaptchaImg(); exit; } $currentCategory = $cat; $recordId = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT); $solutionId = PMF_Filter::filterInput(INPUT_GET, 'solution_id', FILTER_VALIDATE_INT);
* @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 * @link http://www.phpmyfaq.de * @since 2002-08-27 */ if (!defined('IS_VALID_PHPMYFAQ')) { $protocol = 'http'; if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') { $protocol = 'https'; } header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } $captcha = new PMF_Captcha($faqConfig); $oGlossary = new PMF_Glossary($faqConfig); $oLnk = new PMF_Linkverifier($faqConfig); $faqTagging = new PMF_Tags($faqConfig); $faqRelation = new PMF_Relation($faqConfig); $faqRating = new PMF_Rating($faqConfig); $faqComment = new PMF_Comment($faqConfig); if (is_null($user)) { $user = new PMF_User_CurrentUser($faqConfig); } $faqSearchResult = new PMF_Search_Resultset($user, $faq, $faqConfig); $captcha->setSessionId($sids); if (!is_null($showCaptcha)) { $captcha->showCaptchaImg(); exit; } $currentCategory = $cat; $recordId = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT); $solutionId = PMF_Filter::filterInput(INPUT_GET, 'solution_id', FILTER_VALIDATE_INT);