/** * Returns all relevant articles for a FAQ record with the same language * * @param integer $recordId FAQ ID * @param string $question FAQ title * @param string $keywords FAQ keywords * * @return array */ public function getAllRelatedById($recordId, $question, $keywords) { $terms = str_replace('-', ' ', $question) . $keywords; $search = PMF_Search_Factory::create($this->language, array('database' => PMF_Db::getType())); $search->setDatabaseHandle($this->db)->setTable(SQLPREFIX . 'faqdata AS fd')->setResultColumns(array('fd.id AS id', 'fd.lang AS lang', 'fcr.category_id AS category_id', 'fd.thema AS question', 'fd.content AS answer'))->setJoinedTable(SQLPREFIX . 'faqcategoryrelations AS fcr')->setJoinedColumns(array('fd.id = fcr.record_id', 'fd.lang = fcr.record_lang'))->setConditions(array('fd.active' => "'yes'", 'fd.lang' => "'" . $this->language->getLanguage() . "'"))->setMatchingColumns(array('fd.thema', 'fd.content', 'fd.keywords')); $result = $search->search($terms); return $this->db->fetchAll($result); }
/** * Returns all relevant articles for a FAQ record with the same language * * @param integer $record_id FAQ ID * @param string $thema FAQ title * * @return string */ public function getAllRelatedById($record_id, $article_name, $keywords) { global $sids; $relevantslisting = ''; $begriffe = str_replace('-', ' ', $article_name) . $keywords; $search = PMF_Search_Factory::create($this->language, array('database' => PMF_Db::getType())); $i = $last_id = 0; $search->setDatabaseHandle($this->db)->setTable(SQLPREFIX . 'faqdata AS fd')->setResultColumns(array('fd.id AS id', 'fd.lang AS lang', 'fcr.category_id AS category_id', 'fd.thema AS thema', 'fd.content AS content'))->setJoinedTable(SQLPREFIX . 'faqcategoryrelations AS fcr')->setJoinedColumns(array('fd.id = fcr.record_id', 'fd.lang = fcr.record_lang'))->setConditions(array('fd.active' => "'yes'", 'fd.lang' => "'" . $this->language->getLanguage() . "'"))->setMatchingColumns(array('fd.thema', 'fd.content', 'fd.keywords')); $result = $search->search($begriffe); while (($row = $this->db->fetchObject($result)) && $i < PMF_Configuration::getInstance()->get('records.numberOfRelatedArticles')) { if ($row->id == $record_id || $row->id == $last_id) { continue; } $relevantslisting .= '' == $relevantslisting ? '<ul>' : ''; $relevantslisting .= '<li>'; $url = sprintf('%saction=artikel&cat=%d&id=%d&artlang=%s', $sids, $row->category_id, $row->id, $row->lang); $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url); $oLink->itemTitle = $row->thema; $oLink->text = $row->thema; $oLink->tooltip = $row->thema; $relevantslisting .= $oLink->toHtmlAnchor() . '</li>'; $i++; $last_id = $row->id; } $relevantslisting .= $i > 0 ? '</ul>' : ''; return '' == $relevantslisting ? '-' : $relevantslisting; }
/** * Deletes a news entry identified by its ID * * @param integer $id News ID * * @return boolean */ function deleteNews($id) { $query = sprintf("\n DELETE FROM\n %sfaqnews\n WHERE\n id = %d\n AND\n lang = '%s'", SQLPREFIX, $id, $this->language->getLanguage()); if (!$this->db->query($query)) { return false; } return true; }
/** * Logging of search terms for improvements * * @param string $searchterm Search term * @return void */ public function logSearchTerm($searchterm) { if (PMF_String::strlen($searchterm) == 0) { return; } $date = new DateTime(); $query = sprintf("\n INSERT INTO\n %s\n (id, lang, searchterm, searchdate)\n VALUES\n (%d, '%s', '%s', '%s')", $this->_table, $this->db->nextID($this->_table, 'id'), $this->language->getLanguage(), $this->db->escape_string($searchterm), $date->format('Y-m-d H:i:s')); $this->db->query($query); }
/** * Create and return an instance * * @param string $language * * @return PMF_String_Basic */ public static function getInstance($encoding = null, $language = 'en') { if (!self::$instance) { self::$instance = new self(); self::$instance->encoding = self::DEFAULT_ENCODING; self::$instance->language = PMF_Language::isASupportedLanguage($language) ? $language : self::DEFAULT_LANGUAGE; } return self::$instance; }
/** * @param mixed $key * @param string $type * * @return void */ function renderInputForm($key, $type) { global $PMF_LANG, $faqConfig; switch ($type) { case 'area': printf('<textarea name="edit[%s]" rows="4" class="form-control">%s</textarea>', $key, str_replace('<', '<', str_replace('>', '>', $faqConfig->get($key)))); printf("</div>\n"); break; case 'input': if ('' == $faqConfig->get($key) && 'socialnetworks.twitterAccessTokenKey' == $key && isset($_SESSION['access_token'])) { $value = $_SESSION['access_token']['oauth_token']; } elseif ('' == $faqConfig->get($key) && 'socialnetworks.twitterAccessTokenSecret' == $key && isset($_SESSION['access_token'])) { $value = $_SESSION['access_token']['oauth_token_secret']; } else { $value = str_replace('"', '"', $faqConfig->get($key)); } printf('<input class="form-control" type="%s" name="edit[%s]" value="%s" step="1" min="0">', is_numeric($value) ? 'number' : 'text', $key, $value); echo "</div>\n"; break; case 'select': printf('<select name="edit[%s]" size="1" class="form-control">', $key); switch ($key) { case 'main.language': $languages = PMF_Language::getAvailableLanguages(); if (count($languages) > 0) { echo PMF_Language::languageOptions(str_replace(array('language_', '.php'), '', $faqConfig->get('main.language')), false, true); } else { echo '<option value="language_en.php">English</option>'; } break; case 'records.orderby': echo PMF_Configuration::sortingOptions($faqConfig->get($key)); break; case 'records.sortby': printf('<option value="DESC"%s>%s</option>', 'DESC' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['ad_conf_desc']); printf('<option value="ASC"%s>%s</option>', 'ASC' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['ad_conf_asc']); break; case 'security.permLevel': echo PMF_Perm::permOptions($faqConfig->get($key)); break; case 'main.templateSet': $faqSystem = new PMF_System(); $templates = $faqSystem->getAvailableTemplates(); foreach ($templates as $template => $selected) { printf("<option%s>%s</option>", $selected === true ? ' selected' : '', $template); } break; case "records.attachmentsStorageType": foreach ($PMF_LANG['att_storage_type'] as $i => $item) { $selected = $faqConfig->get($key) == $i ? ' selected' : ''; printf('<option value="%d"%s>%s</option>', $i, $selected, $item); } break; case "records.orderingPopularFaqs": printf('<option value="visits"%s>%s</option>', 'visits' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['records.orderingPopularFaqs.visits']); printf('<option value="voting"%s>%s</option>', 'voting' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['records.orderingPopularFaqs.voting']); break; case "search.relevance": printf('<option value="thema,content,keywords"%s>%s</option>', 'thema,content,keywords' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.thema-content-keywords']); printf('<option value="thema,keywords,content"%s>%s</option>', 'thema,keywords,content' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.thema-keywords-content']); printf('<option value="content,thema,keywords"%s>%s</option>', 'content,thema,keywords' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.content-thema-keywords']); printf('<option value="content,keywords,thema"%s>%s</option>', 'content,keywords,thema' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.content-keywords-thema']); printf('<option value="keywords,content,thema"%s>%s</option>', 'keywords,content,thema' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.keywords-content-thema']); printf('<option value="keywords,thema,content"%s>%s</option>', 'keywords,thema,content' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.keywords-thema-content']); break; } echo "</select>\n</div>\n"; break; case 'checkbox': printf('<div class="checkbox"><input type="checkbox" name="edit[%s]" value="true"', $key); if ($faqConfig->get($key)) { echo ' checked'; } if ('security.ldapSupport' === $key && !extension_loaded('ldap')) { echo ' disabled'; } if ('security.useSslOnly' === $key && empty($_SERVER['HTTPS'])) { echo ' disabled'; } if ('security.ssoSupport' === $key && empty($_SERVER['REMOTE_USER'])) { echo ' disabled'; } echo ">\n</div></div>\n"; break; case 'print': printf('<input type="text" readonly name="edit[%s]" class="form-control" value="%s"></div>', $key, str_replace('"', '"', $faqConfig->get($key)), $faqConfig->get($key)); break; } }
function printInputFieldByType($key, $type) { global $PMF_LANG; $faqconfig = PMF_Configuration::getInstance(); switch ($type) { case 'area': printf('<textarea name="edit[%s]" cols="60" rows="6" style="width: 500px;">%s</textarea>', $key, str_replace('<', '<', str_replace('>', '>', $faqconfig->get($key)))); printf("<br />\n"); break; case 'input': printf('<input type="text" name="edit[%s]" size="75" value="%s" style="width: 500px;" />', $key, str_replace('"', '"', $faqconfig->get($key))); printf("<br />\n"); break; case 'select': printf('<select name="edit[%s]" size="1" style="width: 500px;">', $key); switch ($key) { case 'main.language': $languages = PMF_Language::getAvailableLanguages(); if (count($languages) > 0) { print PMF_Language::languageOptions(str_replace(array("language_", ".php"), "", $faqconfig->get('main.language')), false, true); } else { print '<option value="language_en.php">English</option>'; } break; case 'records.orderby': print sortingOptions($faqconfig->get($key)); break; case 'records.sortby': printf('<option value="DESC"%s>%s</option>', 'DESC' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['ad_conf_desc']); printf('<option value="ASC"%s>%s</option>', 'ASC' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['ad_conf_asc']); break; case 'main.permLevel': print PMF_Perm::permOptions($faqconfig->get($key)); break; case "main.templateSet": /** * TODO: do get availiable template sets in the PMF_Template */ foreach (new DirectoryIterator('../template') as $item) { if (!$item->isDot() && $item->isDir()) { $selected = PMF_Template::getTplSetName() == $item ? ' selected="selected"' : ''; printf("<option%s>%s</option>", $selected, $item); } } break; case "main.attachmentsStorageType": foreach ($PMF_LANG['att_storage_type'] as $i => $item) { $selected = $faqconfig->get($key) == $i ? ' selected="selected"' : ''; printf('<option value="%d"%s>%s</option>', $i, $selected, $item); } break; } print "</select>\n<br />\n"; break; case 'checkbox': printf('<input type="checkbox" name="edit[%s]" value="true"', $key); if ($faqconfig->get($key)) { print ' checked="checked"'; } print " /><br />\n"; break; case 'print': printf('<input type="hidden" name="edit[%s]" size="80" value="%s" />%s<br />', $key, str_replace('"', '"', $faqconfig->get($key)), $faqconfig->get($key)); break; } }
?> </h3> </header> <div id="editTranslations"> <?php if ($faqconfig->get('main.googleTranslationKey') == '') { print $PMF_LANG["msgNoGoogleApiKeyFound"]; } else { ?> <p> <label for="langTo"><?php print $PMF_LANG["ad_entry_locale"]; ?> :</label> <?php print PMF_Language::selectLanguages($LANGCODE, false, array(), 'langTo'); ?> </p> <input type="hidden" name="used_translated_languages" id="used_translated_languages" value="" /> <div id="getedTranslations"> </div> <?php } ?> </div> <?php } ?> <p> <input class="submit" type="submit" name="submit" value="<?php print $PMF_LANG["ad_categ_add"];
"> <div id="container"> <header id="header"> <?php if (isset($auth) && is_null($action)) { ?> <div id="loginBox"> <div id="languageSelection"> <form action="index.php<?php print isset($action) ? '?action=' . $action : ''; ?> " method="post"> <?php print PMF_Language::selectLanguages($LANGCODE, true); ?> </form> </div> </div> <?php } ?> <h1><a class="mainpage" href="../"><?php print $faqconfig->get('main.titleFAQ'); ?> </a></h1> <?php if (isset($auth)) { ?>
$minVisits = $_r['visits']; } if ($maxVisits < $_r['visits']) { $maxVisits = $_r['visits']; } if ($record_id == $_r['id'] && $lang == $_r['lang']) { $currVisits = $_r['visits']; } } if ($maxVisits - $minVisits > 0) { $percentage = 100 * ($currVisits - $minVisits) / ($maxVisits - $minVisits); } $faqPopularity = $currVisits . '/' . (int) $percentage . '%'; $translationForm = ''; if (count($arrLanguage) < count(PMF_Language::getAvailableLanguages())) { $translationUrl = sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=translate&cat=%s&id=%d&srclang=%s', $sids, $currentCategory, $record_id, $lang); $translationForm = ' <form action="' . $translationUrl . '" method="post" style="display: inline;"> <img src="images/translate.gif" alt="' . $PMF_LANG['msgTranslate'] . '" title="' . $PMF_LANG['msgTranslate'] . '" width="16" height="16" border="0" /> ' . $PMF_LANG['msgTranslate'] . ' ' . PMF_Language::selectLanguages($LANGCODE, false, $arrLanguage, 'translation') . ' <input class="submit" type="submit" name="submit" value="' . $PMF_LANG['msgTranslateSubmit'] . '" /> </form>'; } // Get rating $recordRating = $faqrating->fetch($record_id); if (!is_null($recordRating)) { $printVoting = sprintf(' %s (%s)', round($recordRating->sumVotings / $recordRating->numVotings, 2), $plr->GetMsg('plmsgVotes', $recordRating->numVotings)); } else { $printVoting = sprintf('0 (%s)', $plr->GetMsg('plmsgVotes', 0)); } // Set the template variables $tpl->processTemplate("writeContent", array('writeRubrik' => $categoryName . '<br />', 'solution_id' => $faq->faqRecord['solution_id'], 'writeThema' => $thema, 'writeArticleCategoryHeader' => $PMF_LANG['msgArticleCategories'], 'writeArticleCategories' => $writeMultiCategories, 'writeContent' => $content, 'writeTagHeader' => $PMF_LANG['msg_tags'] . ': ', 'writeArticleTags' => $tagging->getAllLinkTagsById($record_id), 'writeRelatedArticlesHeader' => $PMF_LANG['msg_related_articles'] . ': ', 'writeRelatedArticles' => $relevant->getAllRelatedById($record_id, $faq->faqRecord['title'], $faq->faqRecord['keywords']), 'writePopularity' => $faqPopularity, 'writeDateMsg' => $PMF_LANG['msgLastUpdateArticle'] . $faq->faqRecord['date'], 'writeRevision' => $PMF_LANG['ad_entry_revision'] . ': 1.' . $faq->faqRecord['revision_id'], 'writeAuthor' => $PMF_LANG['msgAuthor'] . ': ' . $faq->faqRecord['author'], 'editThisEntry' => $editThisEntry, 'writeDiggMsgTag' => 'Digg it!', 'link_digg' => sprintf('http://digg.com/submit?phase=2&url=%s', urlencode($diggItUrl)), 'writeFacebookMsgTag' => 'Share on Facebook', 'link_facebook' => sprintf('http://www.facebook.com/sharer.php?u=%s', urlencode($facebookUrl)), 'link_email' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=send2friend&cat=%d&id=%d&artlang=%s', $sids, $currentCategory, $record_id, $lang), 'link_pdf' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'pdf.php?cat=%d&id=%d&artlang=%s', $currentCategory, $record_id, $lang), 'writePDFTag' => $PMF_LANG['msgPDF'], 'writePrintMsgTag' => $PMF_LANG['msgPrintArticle'], 'writeSend2FriendMsgTag' => $PMF_LANG['msgSend2Friend'], 'translationForm' => $translationForm, 'saveVotingPATH' => sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=savevoting', $sids), 'saveVotingID' => $record_id, 'saveVotingIP' => $_SERVER['REMOTE_ADDR'], 'msgAverageVote' => $PMF_LANG['msgAverageVote'], 'printVotings' => $printVoting, 'switchLanguage' => $switchLanguage, 'msgVoteUseability' => $PMF_LANG['msgVoteUseability'], 'msgVoteBad' => $PMF_LANG['msgVoteBad'], 'msgVoteGood' => $PMF_LANG['msgVoteGood'], 'msgVoteSubmit' => $PMF_LANG['msgVoteSubmit'], 'writeCommentMsg' => $commentMessage, 'msgWriteComment' => $PMF_LANG['msgWriteComment'], 'writeSendAdress' => '?' . $sids . 'action=savecomment', 'id' => $record_id, 'lang' => $lang, 'msgCommentHeader' => $PMF_LANG['msgCommentHeader'], 'msgNewContentName' => $PMF_LANG['msgNewContentName'], 'msgNewContentMail' => $PMF_LANG['msgNewContentMail'], 'defaultContentMail' => $user instanceof PMF_User_CurrentUser ? $user->getUserData('email') : '', 'defaultContentName' => $user instanceof PMF_User_CurrentUser ? $user->getUserData('display_name') : '', 'msgYourComment' => $PMF_LANG['msgYourComment'], 'msgNewContentSubmit' => $PMF_LANG['msgNewContentSubmit'], 'captchaFieldset' => PMF_Helper_Captcha::getInstance()->renderFieldset($PMF_LANG['msgCaptcha'], $captcha->printCaptcha('writecomment')), 'writeComments' => $comment->getComments($record_id, PMF_Comment::COMMENT_TYPE_FAQ))); $tpl->includeTemplate('writeContent', 'index');
// // Define the named constant used as a check by any included PHP file // define('IS_VALID_PHPMYFAQ', null); // // Bootstrapping // require PMF_ROOT_DIR . '/inc/Bootstrap.php'; /** * Initialize attachment factory */ PMF_Attachment_Factory::init($faqConfig->get('records.attachmentsStorageType'), $faqConfig->get('records.defaultAttachmentEncKey'), $faqConfig->get('records.enableAttachmentEncryption')); $currentSave = PMF_Filter::filterInput(INPUT_POST, 'save', FILTER_SANITIZE_STRING); $currentAction = PMF_Filter::filterInput(INPUT_GET, 'action', FILTER_SANITIZE_STRING); $currentToken = PMF_Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING); $Language = new PMF_Language($faqConfig); $LANGCODE = $Language->setLanguage($faqConfig->get('main.languageDetection'), $faqConfig->get('main.language')); require_once PMF_ROOT_DIR . '/lang/language_en.php'; if (isset($LANGCODE) && PMF_Language::isASupportedLanguage($LANGCODE)) { require_once PMF_ROOT_DIR . '/lang/language_' . $LANGCODE . '.php'; } else { $LANGCODE = 'en'; } $auth = false; $user = PMF_User_CurrentUser::getFromSession($faqConfig); if ($user) { $auth = true; } else { $error = $PMF_LANG['ad_auth_sess']; $user = null; unset($user);
$thema = PMF_Filter::filterInput(INPUT_POST, 'thema', FILTER_SANITIZE_STRIPPED); $content = PMF_Filter::filterInput(INPUT_POST, 'content', FILTER_SANITIZE_STRIPPED); $tr_content = PMF_Filter::filterInput(INPUT_POST, 'translated_content', FILTER_SANITIZE_STRING); $contentlink = PMF_Filter::filterInput(INPUT_POST, 'contentlink', FILTER_VALIDATE_URL); $keywords = PMF_Filter::filterInput(INPUT_POST, 'keywords', FILTER_SANITIZE_STRIPPED); $code = PMF_Filter::filterInput(INPUT_POST, 'captcha', FILTER_SANITIZE_STRING); $categories = PMF_Filter::filterInputArray(INPUT_POST, array('rubrik' => array('filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_ARRAY))); // If e-mail address is set to optional if (!PMF_Configuration::getInstance()->get('main.optionalMailAddress') && is_null($usermail)) { $usermail = PMF_Configuration::getInstance()->get('main.administrationMail'); } // Check on translation if (is_null($content) && !is_null($tr_content)) { $content = $tr_content; } if (!is_null($username) && !is_null($usermail) && !is_null($thema) && !is_null($content) && IPCheck($_SERVER['REMOTE_ADDR']) && checkBannedWord(PMF_String::htmlspecialchars($thema)) && checkBannedWord(PMF_String::htmlspecialchars($content)) && $captcha->checkCaptchaCode($code) && (is_null($faqid) && !is_null($categories) || !is_null($faqid) && !is_null($faqlanguage) && PMF_Language::isASupportedLanguage($faqlanguage))) { $isNew = true; if (!is_null($faqid)) { $isNew = false; $faqsession->userTracking('save_new_translation_entry', 0); } else { $faqsession->userTracking('save_new_entry', 0); } $isTranslation = false; if (!is_null($faqlanguage)) { $isTranslation = true; $newLanguage = $faqlanguage; } if (PMF_String::substr($contentlink, 7) != "") { $content = $content . "<br />" . $PMF_LANG["msgInfo"] . "<a href=\"http://" . PMF_String::substr($contentlink, 7) . "\" target=\"_blank\">" . $contentlink . "</a>"; }
*/ define('PMF_ROOT_DIR', dirname(dirname(__DIR__))); define('IS_VALID_PHPMYFAQ', null); // // Bootstrapping // require PMF_ROOT_DIR . '/inc/Bootstrap.php'; // // get language (default: english) // $Language = new PMF_Language($faqConfig); $LANGCODE = $Language->setLanguage($faqConfig->get('main.languageDetection'), $faqConfig->get('main.language')); // Preload English strings require_once PMF_ROOT_DIR . '/lang/language_en.php'; $faqConfig->setLanguage($Language); if (isset($LANGCODE) && PMF_Language::isASupportedLanguage($LANGCODE)) { // Overwrite English strings with the ones we have in the current language require_once PMF_ROOT_DIR . '/lang/language_' . $LANGCODE . '.php'; } else { $LANGCODE = 'en'; } // // Initalizing static string wrapper // PMF_String::init($LANGCODE); $faq = new PMF_Faq($faqConfig); $rssData = $faq->getAllOpenQuestions(false); $num = count($rssData); $rss = new XMLWriter(); $rss->openMemory(); $rss->setIndent(true);
/** * Create all languagess which can be used for translation as <option> * * @param integer $categoryId Category id * @param string $selectedLanguage Selected language * @return string */ public function renderLanguages($categoryId, $selectedLanguage) { $existingLanguages = PMF_Utils::languageAvailable($categoryId, 'faqcategories'); $options = ''; foreach (PMF_Language::getAvailableLanguages() as $lang => $langname) { if (!in_array(strtolower($lang), $existingLanguages)) { $options .= sprintf("\t<option value=\"%s\"%s>%s</option>\n", strtolower($lang), $lang == $selectedLanguage ? ' selected="selected"' : '', $langname); } } return $options; }
/** * Create all languagess which can be used for translation as <option> * * @param integer $category_id Category id * @param string $selected_lang Selected language * * @return string */ public function getCategoryLanguagesToTranslate($category_id, $selected_lang) { $output = ''; $existcatlang = $this->_config->getLanguage()->languageAvailable($category_id, 'faqcategories'); foreach (PMF_Language::getAvailableLanguages() as $lang => $langname) { if (!in_array(strtolower($lang), $existcatlang)) { $output .= "\t<option value=\"" . strtolower($lang) . "\""; if ($lang == $selected_lang) { $output .= " selected=\"selected\""; } $output .= ">" . $langname . "</option>\n"; } } return $output; }
} if (isset($_SESSION['trans'])) { unset($_SESSION['trans']); } printf('<header><h2>%s</h2></header>', $PMF_LANG['ad_menu_translations']); ?> <form id="newTranslationForm"> <table class="list" style="width: 100%"> <tr> <td><?php print $PMF_LANG['msgLanguage']; ?> </td> <td><select name="translang" id="translang"> <?php $avaliableLanguages = array_keys(PMF_Language::getAvailableLanguages()); foreach ($languageCodes as $langCode => $langName) { if (!in_array(strtolower($langCode), $avaliableLanguages)) { ?> <option value="<?php print $langCode; ?> "><?php print $langName; ?> </option> <?php } } ?> </select></td>
* @since 2007-03-27 */ use Symfony\Component\HttpFoundation\Response; define('IS_VALID_PHPMYFAQ', null); // // Prepend and start the PHP session // require 'inc/Bootstrap.php'; $searchString = PMF_Filter::filterInput(INPUT_POST, 'search', FILTER_SANITIZE_STRIPPED); $ajaxLanguage = PMF_Filter::filterInput(INPUT_POST, 'ajaxlanguage', FILTER_SANITIZE_STRING, 'en'); $categoryId = PMF_Filter::filterInput(INPUT_GET, 'searchcategory', FILTER_VALIDATE_INT, '%'); $language = new PMF_Language($faqConfig); $languageCode = $language->setLanguage($faqConfig->get('main.languageDetection'), $faqConfig->get('main.language')); $faqConfig->setLanguage($language); require_once 'lang/language_en.php'; if (PMF_Language::isASupportedLanguage($ajaxLanguage)) { $languageCode = trim($ajaxLanguage); require_once 'lang/language_' . $languageCode . '.php'; } else { $languageCode = 'en'; require_once 'lang/language_en.php'; } //Load plurals support for selected language $plr = new PMF_Language_Plurals($PMF_LANG); // // Initalizing static string wrapper // PMF_String::init($languageCode); // // Get current user and group id - default: -1 //
echo $faqData['content']; ?> </textarea> </div> </div> </fieldset> <fieldset class="form-horizontal"> <!-- Meta data --> <div class="control-group"> <label class="control-label" for="lang"><?php echo $PMF_LANG["ad_entry_locale"]; ?> :</label> <div class="controls"> <?php echo PMF_Language::selectLanguages($faqData['lang'], false, array(), 'lang'); ?> </div> </div> </fieldset> <fieldset class="form-horizontal"> <!-- Attachments --> <?php if ($permission['addattachment']) { ?> <div class="control-group"> <label class="control-label"><?php echo $PMF_LANG['ad_menu_attachments']; ?> :</label> <div class="controls">
$newsHeader[$key]['date'] = $date->format($newsItem['date']); } $twig->loadTemplate('news/list.twig')->display(array('PMF_LANG' => $PMF_LANG, 'newsHeader' => $newsHeader)); unset($date, $newsHeader, $key, $newsItem); } elseif ('editnews' == $action && $user->perm->checkRight($user->getUserId(), 'editnews')) { $id = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT); $newsData = $news->getNewsEntry($id, true); $dateStart = $newsData['dateStart'] != '00000000000000' ? PMF_Date::createIsoDate($newsData['dateStart'], 'Y-m-d') : ''; $dateEnd = $newsData['dateEnd'] != '99991231235959' ? PMF_Date::createIsoDate($newsData['dateEnd'], 'Y-m-d') : ''; $newsId = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT); $oComment = new PMF_Comment($faqConfig); $comments = $oComment->getCommentsData($newsId, PMF_Comment::COMMENT_TYPE_NEWS); foreach ($comments as $item) { $item['date'] = PMF_Date::createIsoDate($item['date'], 'Y-m-d H:i', false); } $twig->loadTemplate('news/edit.twig')->display(array('PMF_LANG' => $PMF_LANG, 'comments' => $comments, 'commentType' => PMF_Comment::COMMENT_TYPE_NEWS, 'dateEnd' => $dateEnd, 'dateStart' => $dateStart, 'languageSelector' => PMF_Language::selectLanguages($newsData['lang'], false, array(), 'langTo'), 'newsData' => $newsData)); } elseif ('savenews' == $action && $user->perm->checkRight($user->getUserId(), "addnews")) { $dateStart = PMF_Filter::filterInput(INPUT_POST, 'dateStart', FILTER_SANITIZE_STRING); $dateEnd = PMF_Filter::filterInput(INPUT_POST, 'dateEnd', FILTER_SANITIZE_STRING); $header = PMF_Filter::filterInput(INPUT_POST, 'newsheader', FILTER_SANITIZE_STRIPPED); $content = PMF_Filter::filterInput(INPUT_POST, 'news', FILTER_SANITIZE_SPECIAL_CHARS); $author = PMF_Filter::filterInput(INPUT_POST, 'authorName', FILTER_SANITIZE_STRIPPED); $email = PMF_Filter::filterInput(INPUT_POST, 'authorEmail', FILTER_VALIDATE_EMAIL); $active = PMF_Filter::filterInput(INPUT_POST, 'active', FILTER_SANITIZE_STRING); $comment = PMF_Filter::filterInput(INPUT_POST, 'comment', FILTER_SANITIZE_STRING); $link = PMF_Filter::filterInput(INPUT_POST, 'link', FILTER_VALIDATE_URL); $linktitle = PMF_Filter::filterInput(INPUT_POST, 'linkTitle', FILTER_SANITIZE_STRIPPED); $newslang = PMF_Filter::filterInput(INPUT_POST, 'langTo', FILTER_SANITIZE_STRING); $target = PMF_Filter::filterInput(INPUT_POST, 'target', FILTER_SANITIZE_STRIPPED); $newsData = array('lang' => $newslang, 'header' => $header, 'content' => html_entity_decode($content), 'authorName' => $author, 'authorEmail' => $email, 'active' => is_null($active) ? 'n' : 'y', 'comment' => is_null($comment) ? 'n' : 'y', 'dateStart' => empty($dateStart) ? '00000000000000' : str_replace('-', '', $dateStart) . '000000', 'dateEnd' => empty($dateEnd) ? '99991231235959' : str_replace('-', '', $dateEnd) . '235959', 'link' => $link, 'linkTitle' => $linktitle, 'date' => date('YmdHis'), 'target' => is_null($target) ? '' : $target); $success = $news->addNewsEntry($newsData);
*/ define('PMF_ROOT_DIR', dirname(__DIR__)); // // Define the named constant used as a check by any included PHP file // define('IS_VALID_PHPMYFAQ', null); // // Bootstrapping // require PMF_ROOT_DIR . '/inc/Bootstrap.php'; require PMF_ROOT_DIR . '/lang/language_en.php'; // // Get language (default: english) // $language = PMF_Filter::filterInput(INPUT_GET, 'lang', FILTER_SANITIZE_STRING); if (!is_null($language) && PMF_Language::isASupportedLanguage($language)) { require PMF_ROOT_DIR . '/lang/language_' . $language . '.php'; } // // Initalizing static string wrapper // PMF_String::init($language); $user = PMF_User_CurrentUser::getFromSession($faqConfig); $refreshTime = (PMF_SESSION_ID_EXPIRES - PMF_SESSION_ID_REFRESH) * 60; ?> <!DOCTYPE html> <html lang="<?php print $PMF_LANG['metaLanguage']; ?> " class="no-js"> <head>
print $PMF_LANG["ad_menu_translations"]; ?> </legend> <div id="editTranslations"> <?php if ($faqconfig->get('main.googleTranslationKey') == '') { print $PMF_LANG["msgNoGoogleApiKeyFound"]; } else { ?> <label class="left" for="langTo"><?php print $PMF_LANG["ad_entry_locale"]; ?> :</label> <?php print PMF_Language::selectLanguages($faqData['lang'], false, array(), 'langTo'); ?> <br /> <input type="hidden" name="used_translated_languages" id="used_translated_languages" value="" /> <div id="getedTranslations"> </div> <?php } ?> </div> </fieldset> <?php } ?> <input class="submit" style="margin-left: 190px;" type="submit" name="submit" value="<?php print $PMF_LANG["ad_categ_add"];
/** * Sets the current language for phpMyFAQ user session * * @param bool $configDetection Configuration detection * @param string $configLanguage Language from configuration * * @return string */ public function setLanguage($configDetection, $configLanguage) { $_lang = []; self::_getUserAgentLanguage(); // Get language from: _POST, _GET, _COOKIE, phpMyFAQ configuration and the automatic language detection $_lang['post'] = PMF_Filter::filterInput(INPUT_POST, 'language', FILTER_SANITIZE_STRING); if (!is_null($_lang['post']) && !self::isASupportedLanguage($_lang['post'])) { $_lang['post'] = null; } // Get the user language $_lang['get'] = PMF_Filter::filterInput(INPUT_GET, 'lang', FILTER_SANITIZE_STRING); if (!is_null($_lang['get']) && !self::isASupportedLanguage($_lang['get'])) { $_lang['get'] = null; } // Get the faq record language $_lang['artget'] = PMF_Filter::filterInput(INPUT_GET, 'artlang', FILTER_SANITIZE_STRING); if (!is_null($_lang['artget']) && !self::isASupportedLanguage($_lang['artget'])) { $_lang['artget'] = null; } // Get the language from the session if (isset($_SESSION['pmf_lang']) && self::isASupportedLanguage($_SESSION['pmf_lang'])) { $_lang['session'] = trim($_SESSION['pmf_lang']); } // Get the language from the config if (isset($configLanguage)) { $confLangCode = str_replace(array("language_", ".php"), "", $configLanguage); if (self::isASupportedLanguage($confLangCode)) { $_lang['config'] = $confLangCode; } } // Detect the browser's language if (true === $configDetection && self::isASupportedLanguage($this->acceptedLanguage)) { $_lang['detection'] = strtolower($this->acceptedLanguage); } // Select the language if (isset($_lang['post'])) { self::$language = $_lang['post']; $_lang = null; unset($_lang); } elseif (isset($_lang['get'])) { self::$language = $_lang['get']; } elseif (isset($_lang['session'])) { self::$language = $_lang['session']; $_lang = null; unset($_lang); } elseif (isset($_lang['detection'])) { self::$language = $_lang['detection']; $_lang = null; unset($_lang); } elseif (isset($_lang['config'])) { self::$language = $_lang['config']; $_lang = null; unset($_lang); } else { self::$language = 'en'; // just a fallback } return $_SESSION['pmf_lang'] = self::$language; }
print $LANGCODE; ?> " style="border: none;" width="0" height="0"></iframe> <?php if (isset($auth) && ('takequestion' == $action || 'editentry' == $action || 'editpreview' == $action || 'addnews' == $action || 'editnews' == $action || 'copyentry' == $action)) { if ($faqconfig->get('main.enableWysiwygEditor') == true) { ?> <!-- tinyMCE --> <script type="text/javascript"> /*<![CDATA[*/ //<!-- tinyMCE.init({ // General options mode : "exact", language : "<?php print PMF_Language::isASupportedTinyMCELanguage($LANGCODE) ? $LANGCODE : 'en'; ?> ", elements : "content", width : "720", height : "480", theme : "advanced", plugins : "spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,syntaxhl,phpmyfaq", theme_advanced_blockformats : "p,div,h1,h2,h3,h4,h5,h6,blockquote,dt,dd,code,samp", // Theme options theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,phpmyfaq,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,code,syntaxhl,|,insertdate,inserttime,preview,|,forecolor,backcolor", theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen,help", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left",
/** * Save the Captcha * * @return boolean */ private function saveCaptcha() { $select = sprintf("\n SELECT \n id \n FROM \n %sfaqcaptcha \n WHERE \n id = '%s'", SQLPREFIX, $this->code); $result = $this->db->query($select); if ($result) { $num = $this->db->numRows($result); if ($num > 0) { return false; } else { $insert = sprintf("\n INSERT INTO \n %sfaqcaptcha \n (id, useragent, language, ip, captcha_time) \n VALUES \n ('%s', '%s', '%s', '%s', %d)", SQLPREFIX, $this->code, $this->userAgent, $this->language->getLanguage(), $this->ip, $this->timestamp); $this->db->query($insert); return true; } } return false; }
PMF_Init::cleanRequest(); session_name(PMF_COOKIE_NAME_AUTH . trim($faqconfig->get('main.phpMyFAQToken'))); session_start(); // Send headers $http = PMF_Helper_Http::getInstance(); $http->setContentType('application/json'); $http->addHeader(); // Set user permissions $current_user = -1; $current_groups = array(-1); $action = PMF_Filter::filterInput(INPUT_GET, 'action', FILTER_SANITIZE_STRING); $language = PMF_Filter::filterInput(INPUT_GET, 'lang', FILTER_SANITIZE_STRING, 'en'); $categoryId = PMF_Filter::filterInput(INPUT_GET, 'categoryId', FILTER_VALIDATE_INT); $recordId = PMF_Filter::filterInput(INPUT_GET, 'recordId', FILTER_VALIDATE_INT); // Get language (default: english) $Language = new PMF_Language(); $language = $Language->setLanguage($faqconfig->get('main.languageDetection'), $faqconfig->get('main.language')); // Set language if (PMF_Language::isASupportedLanguage($language)) { require 'lang/language_' . $language . '.php'; } else { require 'lang/language_en.php'; } $plr = new PMF_Language_Plurals($PMF_LANG); PMF_String::init($language); // Set empty result $result = array(); // Handle actions switch ($action) { case 'getVersion': $result = array('version' => $faqconfig->get('main.currentVersion'));
$output = ''; $isCronRequest = false; $isRequestedByCLI = isset($_SERVER['argv']) && isset($_SERVER['argv'][0]); $isRequestedByWebLocalhost = isset($_SERVER['REMOTE_ADDR']) && '127.0.0.1' == $_SERVER['REMOTE_ADDR']; $isCronRequest = $isRequestedByCLI || $isRequestedByWebLocalhost; if ($isCronRequest && file_exists(PMF_ROOT_DIR . '/config/database.php')) { // Hack: set dummy values for those entries evaluated during a Web request but not during a CLI request if ($isRequestedByCLI) { $_SERVER['HTTP_HOST'] = ''; $_SERVER['HTTP_USER_AGENT'] = ''; } define('IS_VALID_PHPMYFAQ', null); require PMF_ROOT_DIR . '/inc/Bootstrap.php'; // Preload English strings require_once PMF_ROOT_DIR . '/lang/language_en.php'; if (LANGCODE != 'en' && PMF_Language::isASupportedLanguage(LANGCODE)) { // Overwrite English strings with the ones we have in the current language require_once PMF_ROOT_DIR . '/lang/language_' . LANGCODE . '.php'; } //Load plurals support for selected language $plr = new PMF_Language_Plurals(LANGCODE); // // Initalizing static string wrapper // PMF_String::init(LANGCODE); $oLnk = new PMF_Linkverifier($faqConfig); $faq = new PMF_Faq($faqConfig); $totStart = microtime(true); // Read the data directly from the faqdata table (all faq records in all languages) $start = microtime(true); $output .= $isRequestedByWebLocalhost ? '' : "\n";
if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) { header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); exit; } $ajax_action = PMF_Filter::filterInput(INPUT_GET, 'ajaxaction', FILTER_SANITIZE_STRING); if ('save_sticky_records' == $ajax_action && $permission['editbt']) { /** * Expected is an array of the structure: * array( 0 => array((int)id, (string)langugage, (int) checked)), * 1 => ..... * ) */ $items = isset($_GET['items']) && is_array($_GET['items']) ? $_GET['items'] : array(); $faq = new PMF_Faq(); foreach ($items as $item) { if (is_array($item) && count($item) == 3 && PMF_Language::isASupportedLanguage($item[1])) { print $faq->updateRecordSticky((int) $item[0], addslashes($item[1]), (int) $item[2]); } } } if ('delete_record' == $ajax_action && $permission['delbt']) { $record_id = PMF_Filter::filterInput(INPUT_POST, 'record_id', FILTER_VALIDATE_INT); $record_lang = PMF_Filter::filterInput(INPUT_POST, 'record_lang', FILTER_SANITIZE_STRING); adminlog('Beitragdel, ' . $record_id); $path = PMF_ROOT_DIR . '/attachments/' . $record_id . '/'; if (@is_dir($path)) { $do = dir($path); while ($dat = $do->read()) { if ($dat != "." && $dat != "..") { unlink($path . $dat); }
/** * @param $key * @param $type * @return void */ function printInputFieldByType($key, $type) { global $PMF_LANG; $faqconfig = PMF_Configuration::getInstance(); switch ($type) { case 'area': printf('<textarea name="edit[%s]" cols="60" rows="6" style="width: 300px;">%s</textarea>', $key, str_replace('<', '<', str_replace('>', '>', $faqconfig->get($key)))); printf("</p>\n"); break; case 'input': if ('' == $faqconfig->get($key) && 'socialnetworks.twitterAccessTokenKey' == $key) { $value = $_SESSION['access_token']['oauth_token']; } elseif ('' == $faqconfig->get($key) && 'socialnetworks.twitterAccessTokenSecret' == $key) { $value = $_SESSION['access_token']['oauth_token_secret']; } else { $value = str_replace('"', '"', $faqconfig->get($key)); } printf('<input type="text" name="edit[%s]" size="75" value="%s" style="width: 300px;" />', $key, $value); printf("</p>\n"); break; case 'select': printf('<select name="edit[%s]" size="1" style="width: 300px;">', $key); switch ($key) { case 'main.language': $languages = PMF_Language::getAvailableLanguages(); if (count($languages) > 0) { print PMF_Language::languageOptions(str_replace(array('language_', '.php'), '', $faqconfig->get('main.language')), false, true); } else { print '<option value="language_en.php">English</option>'; } break; case 'records.orderby': print sortingOptions($faqconfig->get($key)); break; case 'records.sortby': printf('<option value="DESC"%s>%s</option>', 'DESC' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['ad_conf_desc']); printf('<option value="ASC"%s>%s</option>', 'ASC' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['ad_conf_asc']); break; case 'security.permLevel': print PMF_Perm::permOptions($faqconfig->get($key)); break; case "main.templateSet": /** * TODO: do get available template sets in the PMF_Template */ foreach (new DirectoryIterator('../template') as $item) { if (!$item->isDot() && $item->isDir()) { $selected = PMF_Template::getTplSetName() == $item ? ' selected="selected"' : ''; printf("<option%s>%s</option>", $selected, $item); } } break; case "records.attachmentsStorageType": foreach ($PMF_LANG['att_storage_type'] as $i => $item) { $selected = $faqconfig->get($key) == $i ? ' selected="selected"' : ''; printf('<option value="%d"%s>%s</option>', $i, $selected, $item); } break; case "records.orderingPopularFaqs": printf('<option value="visits"%s>%s</option>', 'visits' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['records.orderingPopularFaqs.visits']); printf('<option value="voting"%s>%s</option>', 'voting' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['records.orderingPopularFaqs.voting']); break; case "search.relevance": printf('<option value="thema,content,keywords"%s>%s</option>', 'thema,content,keywords' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['search.relevance.thema-content-keywords']); printf('<option value="thema,keywords,content"%s>%s</option>', 'thema,keywords,content' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['search.relevance.thema-keywords-content']); printf('<option value="content,thema,keywords"%s>%s</option>', 'content,thema,keywords' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['search.relevance.content-thema-keywords']); printf('<option value="content,keywords,thema"%s>%s</option>', 'content,keywords,thema' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['search.relevance.content-keywords-thema']); printf('<option value="keywords,content,thema"%s>%s</option>', 'keywords,content,thema' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['search.relevance.keywords-content-thema']); printf('<option value="keywords,thema,content"%s>%s</option>', 'keywords,thema,content' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['search.relevance.keywords-thema-content']); break; } print "</select>\n</p>\n"; break; case 'checkbox': printf('<input type="checkbox" name="edit[%s]" value="true"', $key); if ($faqconfig->get($key)) { print ' checked="checked"'; } print " /></p>\n"; break; case 'print': printf('<input type="hidden" name="edit[%s]" size="80" value="%s" />%s</p>', $key, str_replace('"', '"', $faqconfig->get($key)), $faqconfig->get($key)); break; } }
$stopword = PMF_Filter::filterInput(INPUT_GET, 'stopword', FILTER_SANITIZE_STRING); $stopwords_lang = PMF_Filter::filterInput(INPUT_GET, 'stopwords_lang', FILTER_SANITIZE_STRING); switch ($ajax_action) { case 'load_stop_words_by_lang': if (PMF_Language::isASupportedLanguage($stopwords_lang)) { $stop_words_list = PMF_Stopwords::getInstance()->getByLang($stopwords_lang); header('Content-Type: application/json'); print json_encode($stop_words_list); } break; case 'delete_stop_word': if (null != $stopword_id && PMF_Language::isASupportedLanguage($stopwords_lang)) { $pmf_sw = PMF_Stopwords::getInstance(); $pmf_sw->setLanguage($stopwords_lang); $pmf_sw->remove($stopword_id); } break; case 'save_stop_word': if (null != $stopword && PMF_Language::isASupportedLanguage($stopwords_lang)) { $pmf_sw = PMF_Stopwords::getInstance(); $pmf_sw->setLanguage($stopwords_lang); if (null !== $stopword_id && -1 < $stopword_id) { $pmf_sw->update($stopword_id, $stopword); } else { if (!$pmf_sw->match($stopword)) { $pmf_sw->add($stopword); } } } break; }
$faqSystem = new PMF_System(); $categoryHelper = new PMF_Helper_Category(); $categoryHelper->setCategory($category); $categoryHelper->setConfiguration($faqConfig); $keywordsArray = array_merge(explode(',', $keywords), explode(',', $faqConfig->get('main.metaKeywords'))); $keywordsArray = array_filter($keywordsArray, 'strlen'); shuffle($keywordsArray); $keywords = implode(',', $keywordsArray); $faqLink = new PMF_Link($faqSystem->getSystemUri($faqConfig), $faqConfig); $currentPageUrl = $faqLink->getCurrentUrl(); if (is_null($error)) { $loginMessage = '<p>' . $PMF_LANG['ad_auth_insert'] . '</p>'; } else { $loginMessage = '<p class="error">' . $error . '</p>'; } $tplMainPage = array('msgLoginUser' => $PMF_LANG['msgLoginUser'], 'title' => $faqConfig->get('main.titleFAQ') . $title, 'baseHref' => $faqSystem->getSystemUri($faqConfig), 'version' => $faqConfig->get('main.currentVersion'), 'header' => str_replace('"', '', $faqConfig->get('main.titleFAQ')), 'metaTitle' => str_replace('"', '', $faqConfig->get('main.titleFAQ') . $title), 'metaDescription' => $metaDescription, 'metaKeywords' => $keywords, 'metaPublisher' => $faqConfig->get('main.metaPublisher'), 'metaLanguage' => $PMF_LANG['metaLanguage'], 'metaCharset' => 'utf-8', 'phpmyfaqversion' => $faqConfig->get('main.currentVersion'), 'stylesheet' => $PMF_LANG['dir'] == 'rtl' ? 'style.rtl' : 'style', 'currentPageUrl' => $currentPageUrl, 'action' => $action, 'dir' => $PMF_LANG['dir'], 'headerCategories' => $PMF_LANG['msgFullCategories'], 'msgCategory' => $PMF_LANG['msgCategory'], 'msgExportAllFaqs' => $PMF_LANG['msgExportAllFaqs'], 'languageBox' => $PMF_LANG['msgLangaugeSubmit'], 'writeLangAdress' => $writeLangAdress, 'switchLanguages' => PMF_Language::selectLanguages($LANGCODE, true), 'userOnline' => $usersOnline, 'copyright' => 'powered by <a href="http://www.phpmyfaq.de" target="_blank">phpMyFAQ</a> ' . $faqConfig->get('main.currentVersion'), 'registerUser' => '<a href="?action=register">' . $PMF_LANG['msgRegistration'] . '</a>', 'sendPassword' => '<a href="?action=password">' . $PMF_LANG['lostPassword'] . '</a>', 'loginHeader' => $PMF_LANG['msgLoginUser'], 'loginMessage' => $loginMessage, 'writeLoginPath' => $faqSystem->getSystemUri($faqConfig) . '?' . PMF_Filter::getFilteredQueryString(), 'faqloginaction' => $action, 'login' => $PMF_LANG['ad_auth_ok'], 'username' => $PMF_LANG['ad_auth_user'], 'password' => $PMF_LANG['ad_auth_passwd'], 'rememberMe' => $PMF_LANG['rememberMe'], 'headerChangePassword' => $PMF_LANG['ad_passwd_cop'], 'msgUsername' => $PMF_LANG['ad_auth_user'], 'msgEmail' => $PMF_LANG['ad_entry_email'], 'msgSubmit' => $PMF_LANG['msgNewContentSubmit']); $tpl->parseBlock('index', 'categoryListSection', array('showCategories' => $categoryHelper->renderNavigation($cat), 'categoryDropDown' => $categoryHelper->renderCategoryDropDown($cat))); if ('main' == $action || 'show' == $action) { if ('main' == $action && $faqConfig->get('search.useAjaxSearchOnStartpage')) { $tpl->parseBlock('index', 'globalSuggestBox', array('ajaxlanguage' => $LANGCODE, 'msgDescriptionInstantResponse' => $PMF_LANG['msgDescriptionInstantResponse'], 'msgSearch' => sprintf('<a class="help" href="%sindex.php?action=search">%s</a>', $faqSystem->getSystemUri($faqConfig), $PMF_LANG["msgAdvancedSearch"]))); } else { $tpl->parseBlock('index', 'globalSearchBox', array('writeSendAdress' => '?' . $sids . 'action=search', 'searchBox' => $PMF_LANG['msgSearch'], 'categoryId' => $cat === 0 ? '%' : (int) $cat, 'msgSearch' => sprintf('<a class="help" href="%sindex.php?action=search">%s</a>', $faqSystem->getSystemUri($faqConfig), $PMF_LANG["msgAdvancedSearch"]))); } } $stickyRecordsParams = $faq->getStickyRecords(); if (!isset($stickyRecordsParams['error'])) { $tpl->parseBlock('index', 'stickyFaqs', array('stickyRecordsHeader' => $PMF_LANG['stickyRecordsHeader'], 'stickyRecordsList' => $stickyRecordsParams['html'])); } if ($faqConfig->get('main.enableRewriteRules')) { $tplNavigation = array("msgSearch" => '<a href="' . $faqSystem->getSystemUri($faqConfig) . 'search.html">' . $PMF_LANG["msgAdvancedSearch"] . '</a>', 'msgAddContent' => '<a href="' . $faqSystem->getSystemUri($faqConfig) . 'addcontent.html">' . $PMF_LANG["msgAddContent"] . '</a>', "msgQuestion" => '<a href="' . $faqSystem->getSystemUri($faqConfig) . 'ask.html">' . $PMF_LANG["msgQuestion"] . '</a>', "msgOpenQuestions" => '<a href="' . $faqSystem->getSystemUri($faqConfig) . 'open.html">' . $PMF_LANG["msgOpenQuestions"] . '</a>', 'msgHelp' => '<a href="' . $faqSystem->getSystemUri($faqConfig) . 'help.html">' . $PMF_LANG["msgHelp"] . '</a>', "msgContact" => '<a href="' . $faqSystem->getSystemUri($faqConfig) . 'contact.html">' . $PMF_LANG["msgContact"] . '</a>', 'msgGlossary' => '<a href="' . $faqSystem->getSystemUri($faqConfig) . 'glossary.html">' . $PMF_LANG['ad_menu_glossary'] . '</a>', "backToHome" => '<a href="' . $faqSystem->getSystemUri($faqConfig) . 'index.html">' . $PMF_LANG["msgHome"] . '</a>', "allCategories" => '<a href="' . $faqSystem->getSystemUri($faqConfig) . 'showcat.html">' . $PMF_LANG["msgShowAllCategories"] . '</a>', 'showInstantResponse' => '<a href="' . $faqSystem->getSystemUri($faqConfig) . 'instantresponse.html">' . $PMF_LANG['msgInstantResponse'] . '</a>', 'showSitemap' => '<a href="' . $faqSystem->getSystemUri($faqConfig) . 'sitemap/A/' . $LANGCODE . '.html">' . $PMF_LANG['msgSitemap'] . '</a>', 'opensearch' => $faqSystem->getSystemUri($faqConfig) . 'opensearch.html'); } else {