case 'faq': $id = $faqid; break; } // If e-mail address is set to optional if (!PMF_Configuration::getInstance()->get('main.optionalMailAddress') && is_null($mail)) { $mail = PMF_Configuration::getInstance()->get('main.administrationMail'); } if (!is_null($username) && !empty($username) && !empty($mail) && !is_null($mail) && !is_null($comment) && !empty($comment) && checkBannedWord($comment) && !$faq->commentDisabled($id, $languageCode, $type)) { $faqsession->userTracking("save_comment", $id); $commentData = array('record_id' => $id, 'type' => $type, 'username' => $username, 'usermail' => $mail, 'comment' => nl2br($comment), 'date' => $_SERVER['REQUEST_TIME'], 'helped' => ''); if ($faq->addComment($commentData)) { $emailTo = $faqconfig->get('main.administrationMail'); $urlToContent = ''; if ('faq' == $type) { $faq->getRecord($id); if ($faq->faqRecord['email'] != '') { $emailTo = $faq->faqRecord['email']; } $_faqUrl = sprintf('?action=artikel&cat=%d&id=%d&artlang=%s', 0, $faq->faqRecord['id'], $faq->faqRecord['lang']); $oLink = new PMF_Link(PMF_Link::getSystemUri('/ajaxservice.php') . $_faqUrl); $oLink->itemTitle = $faq->faqRecord['title']; $urlToContent = $oLink->toString(); } else { $oNews = new PMF_News($db, $Language); $news = $oNews->getNewsEntry($id); if ($news['authorEmail'] != '') { $emailTo = $news['authorEmail']; } $link = sprintf('%s?action=news&newsid=%d&newslang=%s', PMF_Link::getSystemUri('/ajaxservice.php'), $news['id'], $news['lang']); $oLink = new PMF_Link($link);
break; case 'search': $search = new PMF_Search($db, $Language); $searchString = PMF_Filter::filterInput(INPUT_GET, 'q', FILTER_SANITIZE_STRIPPED); $result = $search->search($searchString, false); $url = $faqconfig->get('main.referenceURL') . '/index.php?action=artikel&cat=%d&id=%d&artlang=%s'; foreach ($result as &$data) { $data->answer = html_entity_decode(strip_tags($data->answer), ENT_COMPAT, 'utf-8'); $data->answer = PMF_Utils::makeShorterText($data->answer, 12); $data->link = sprintf($url, $data->category_id, $data->id, $data->lang); } break; case 'getCategories': $category = new PMF_Category($current_user, $current_groups, true); $result = $category->categories; break; case 'getFaqs': $faq = new PMF_Faq($current_user, $current_groups); $result = $faq->getAllRecordPerCategory($categoryId); break; case 'getFaq': $faq = new PMF_Faq($current_user, $current_groups); $faq->getRecord($recordId); $result = $faq->faqRecord; break; default: $result = 'I am completely operational, and all my circuits are functioning perfectly.'; break; } // print result as JSON print json_encode($result);
* @since 2006-11-12 */ if (!defined('IS_VALID_PHPMYFAQ')) { header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } $captcha = new PMF_Captcha($db, $Language); $captcha->setSessionId($sids); if (!is_null($showCaptcha)) { $captcha->showCaptchaImg(); exit; } $translationLanguage = PMF_Filter::filterInput(INPUT_POST, 'translation', FILTER_SANITIZE_STRIPPED, $LANGCODE); if (!PMF_Language::isASupportedLanguage($translationLanguage)) { $translationLanguage = $LANGCODE; } $faqSource['id'] = 'writeSourceFaqId'; $faqSource['lang'] = $translationLanguage; $faqSource['title'] = 'writeSourceTitle'; $faqSource['content'] = 'writeSourceContent'; $faqSource['keywords'] = 'writeSourceKeywords'; $faqsession->userTracking('new_translation_entry', 0); $id = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT); $srclang = PMF_Filter::filterInput(INPUT_GET, 'srclang', FILTER_SANITIZE_STRIPPED); if (!is_null($id) && !is_null($srclang) && PMF_Language::isASupportedLanguage($srclang)) { $oFaq = new PMF_Faq(); $oFaq->getRecord($id); $faqSource = $oFaq->faqRecord; } $tpl->processTemplate('writeContent', array('writeSourceFaqId' => $faqSource['id'], 'writeSourceTitle' => $faqSource['title'], 'writeSourceContent' => $faqSource['content'], 'writeSourceKeywords' => $faqSource['keywords'], 'msgNewTranslationHeader' => $PMF_LANG['msgNewTranslationHeader'], 'msgNewTranslationAddon' => $PMF_LANG['msgNewTranslationAddon'], 'msgNewTransSourcePane' => $PMF_LANG['msgNewTransSourcePane'], 'msgNewTranslationPane' => $PMF_LANG['msgNewTranslationPane'], 'writeSendAdress' => '?' . $sids . 'action=save', 'defaultContentName' => $user ? $user->getUserData('display_name') : '', 'defaultContentMail' => $user ? $user->getUserData('email') : '', 'msgNewTranslationName' => $PMF_LANG['msgNewTranslationName'], 'msgNewTranslationMail' => $PMF_LANG['msgNewTranslationMail'], 'msgNewTranslationKeywords' => $PMF_LANG['msgNewTranslationKeywords'], 'writeTransFaqLanguage' => $translationLanguage, 'captchaFieldset' => PMF_Helper_Captcha::getInstance()->renderFieldset($PMF_LANG['msgCaptcha'], $captcha->printCaptcha('translate')), 'msgNewTranslationSubmit' => $PMF_LANG['msgNewTranslationSubmit'], 'tinyMCELanguage' => PMF_Language::isASupportedTinyMCELanguage($LANGCODE) ? $LANGCODE : 'en')); $tpl->includeTemplate('writeContent', 'index');