Пример #1
0
$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 {
    $tplNavigation = array("msgSearch" => '<a href="index.php?' . $sids . 'action=search">' . $PMF_LANG["msgAdvancedSearch"] . '</a>', "msgAddContent" => '<a href="index.php?' . $sids . 'action=add&cat=' . $cat . '">' . $PMF_LANG["msgAddContent"] . '</a>', "msgQuestion" => '<a href="index.php?' . $sids . 'action=ask&category_id=' . $cat . '">' . $PMF_LANG["msgQuestion"] . '</a>', "msgOpenQuestions" => '<a href="index.php?' . $sids . 'action=open">' . $PMF_LANG["msgOpenQuestions"] . '</a>', "msgHelp" => '<a href="index.php?' . $sids . 'action=help">' . $PMF_LANG["msgHelp"] . '</a>', "msgContact" => '<a href="index.php?' . $sids . 'action=contact">' . $PMF_LANG["msgContact"] . '</a>', 'msgGlossary' => '<a href="index.php?' . $sids . 'action=glossary">' . $PMF_LANG['ad_menu_glossary'] . '</a>', "allCategories" => '<a href="index.php?' . $sids . 'action=show">' . $PMF_LANG["msgShowAllCategories"] . '</a>', "backToHome" => '<a href="index.php?' . $sids . '">' . $PMF_LANG["msgHome"] . '</a>', 'showInstantResponse' => '<a href="index.php?' . $sids . 'action=instantresponse">' . $PMF_LANG['msgInstantResponse'] . '</a>', 'showSitemap' => '<a href="index.php?' . $sids . 'action=sitemap&amp;lang=' . $LANGCODE . '">' . $PMF_LANG['msgSitemap'] . '</a>', 'opensearch' => $faqSystem->getSystemUri($faqConfig) . 'opensearch.php');
}
$faqSystem = new PMF_System();
$categoryHelper = new PMF_Helper_Category();
$categoryHelper->setCategory($category);
$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' => preg_match('/(\\S+\\/content\\/\\S+.html)\\?\\S*/', $currentPageUrl, $canonical) === 1 ? $canonical[1] : $currentPageUrl, 'action' => $action, 'dir' => $PMF_LANG['dir'], 'msgCategory' => $PMF_LANG['msgCategory'], 'showCategories' => $categoryHelper->renderNavigation($cat), 'topCategories' => $categoryHelper->renderMainCategories(), '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']);
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 {
    $tplNavigation = array("msgSearch" => '<a href="index.php?' . $sids . 'action=search">' . $PMF_LANG["msgAdvancedSearch"] . '</a>', "msgAddContent" => '<a href="index.php?' . $sids . 'action=add&cat=' . $cat . '">' . $PMF_LANG["msgAddContent"] . '</a>', "msgQuestion" => '<a href="index.php?' . $sids . 'action=ask&category_id=' . $cat . '">' . $PMF_LANG["msgQuestion"] . '</a>', "msgOpenQuestions" => '<a href="index.php?' . $sids . 'action=open">' . $PMF_LANG["msgOpenQuestions"] . '</a>', "msgHelp" => '<a href="index.php?' . $sids . 'action=help">' . $PMF_LANG["msgHelp"] . '</a>', "msgContact" => '<a href="index.php?' . $sids . 'action=contact">' . $PMF_LANG["msgContact"] . '</a>', 'msgGlossary' => '<a href="index.php?' . $sids . 'action=glossary">' . $PMF_LANG['ad_menu_glossary'] . '</a>', "allCategories" => '<a href="index.php?' . $sids . 'action=show">' . $PMF_LANG["msgShowAllCategories"] . '</a>', "backToHome" => '<a href="index.php?' . $sids . '">' . $PMF_LANG["msgHome"] . '</a>', 'showInstantResponse' => '<a href="index.php?' . $sids . 'action=instantresponse">' . $PMF_LANG['msgInstantResponse'] . '</a>', 'showSitemap' => '<a href="index.php?' . $sids . 'action=sitemap&amp;lang=' . $LANGCODE . '">' . $PMF_LANG['msgSitemap'] . '</a>', 'opensearch' => $faqSystem->getSystemUri($faqConfig) . 'opensearch.php');