Пример #1
0
 /**
  * Returns the single instance
  *
  * @access static
  * @return PMF_Helper_Category
  */
 public static function getInstance()
 {
     if (null == self::$instance) {
         $className = __CLASS__;
         self::$instance = new $className();
     }
     return self::$instance;
 }
Пример #2
0
//
// Check in any tags with at leat one entry exist
$hasTags = $oTag->existTagRelations();
if ($hasTags && ($action == 'artikel' || $action == 'show')) {
    $right_tpl = $action == 'artikel' ? 'catandtag.tpl' : 'tagcloud.tpl';
} else {
    $right_tpl = 'startpage.tpl';
}
//
// Load template files and set template variables
//
$tpl = new PMF_Template(array('index' => 'index.tpl', 'loginBox' => $login_tpl, 'rightBox' => $right_tpl, 'writeContent' => $inc_tpl), $faqconfig->get('main.templateSet'));
$usersOnLine = getUsersOnline();
$totUsersOnLine = $usersOnLine[0] + $usersOnLine[1];
$systemUri = PMF_Link::getSystemUri('index.php');
$helper = PMF_Helper_Category::getInstance();
$helper->setCategory($category);
$main_template_vars = array('title' => $faqconfig->get('main.titleFAQ') . $title, 'baseHref' => $systemUri, 'version' => $faqconfig->get('main.currentVersion'), 'header' => str_replace('"', '', $faqconfig->get('main.titleFAQ')), 'metaTitle' => str_replace('"', '', $faqconfig->get('main.titleFAQ')), 'metaDescription' => $faqconfig->get('main.metaDescription'), 'metaKeywords' => $faqconfig->get('main.metaKeywords') . $keywords, 'metaPublisher' => $faqconfig->get('main.metaPublisher'), 'metaLanguage' => $PMF_LANG['metaLanguage'], 'metaCharset' => $PMF_LANG['metaCharset'], 'phpmyfaqversion' => $faqconfig->get('main.currentVersion'), 'stylesheet' => $PMF_LANG['dir'] == 'rtl' ? 'style.rtl' : 'style', 'action' => $action, 'dir' => $PMF_LANG['dir'], 'msgCategory' => $PMF_LANG['msgCategory'], 'showCategories' => $helper->renderCategoryNavigation($cat), 'searchBox' => $PMF_LANG['msgSearch'], 'languageBox' => $PMF_LANG['msgLangaugeSubmit'], 'writeLangAdress' => $writeLangAdress, 'switchLanguages' => PMF_Language::selectLanguages($LANGCODE, true), 'userOnline' => $plr->getMsg('plmsgUserOnline', $totUsersOnLine) . $plr->getMsg('plmsgGuestOnline', $usersOnLine[0]) . $plr->getMsg('plmsgRegisteredOnline', $usersOnLine[1]), 'stickyRecordsHeader' => $PMF_LANG['stickyRecordsHeader'], 'copyright' => 'powered by <a href="http://www.phpmyfaq.de" target="_blank">phpMyFAQ</a> ' . $faqconfig->get('main.currentVersion'));
$stickyRecordsParams = $faq->getStickyRecords();
if (!isset($stickyRecordsParams['error'])) {
    $tpl->processBlock('index', 'stickyRecordsList', array('stickyRecordsUrl' => $stickyRecordsParams['url'], 'stickyRecordsTitle' => $stickyRecordsParams['title']));
}
if ($faqconfig->get('main.enableRewriteRules')) {
    $links_template_vars = array("faqHome" => $_SERVER['PHP_SELF'], "msgSearch" => '<a href="' . $systemUri . 'search.html">' . $PMF_LANG["msgAdvancedSearch"] . '</a>', 'msgAddContent' => '<a href="' . $systemUri . 'addcontent.html">' . $PMF_LANG["msgAddContent"] . '</a>', "msgQuestion" => '<a href="' . $systemUri . 'ask.html">' . $PMF_LANG["msgQuestion"] . '</a>', "msgOpenQuestions" => '<a href="' . $systemUri . 'open.html">' . $PMF_LANG["msgOpenQuestions"] . '</a>', 'msgHelp' => '<a href="' . $systemUri . 'help.html">' . $PMF_LANG["msgHelp"] . '</a>', "msgContact" => '<a href="' . $systemUri . 'contact.html">' . $PMF_LANG["msgContact"] . '</a>', "backToHome" => '<a href="' . $systemUri . 'index.html">' . $PMF_LANG["msgHome"] . '</a>', "allCategories" => '<a href="' . $systemUri . 'showcat.html">' . $PMF_LANG["msgShowAllCategories"] . '</a>', "writeSendAdress" => $systemUri . 'search.html', 'showInstantResponse' => '<a href="' . $systemUri . 'instantresponse.html">' . $PMF_LANG['msgInstantResponse'] . '</a>', 'showSitemap' => getLinkHtmlAnchor($_SERVER['PHP_SELF'] . '?' . $sids . 'action=sitemap&amp;lang=' . $LANGCODE, $PMF_LANG['msgSitemap']), 'opensearch' => $systemUri . 'search.html');
} else {
    $links_template_vars = array("faqHome" => $_SERVER['PHP_SELF'], "msgSearch" => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=search">' . $PMF_LANG["msgAdvancedSearch"] . '</a>', "msgAddContent" => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=add">' . $PMF_LANG["msgAddContent"] . '</a>', "msgQuestion" => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=ask">' . $PMF_LANG["msgQuestion"] . '</a>', "msgOpenQuestions" => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=open">' . $PMF_LANG["msgOpenQuestions"] . '</a>', "msgHelp" => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=help">' . $PMF_LANG["msgHelp"] . '</a>', "msgContact" => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=contact">' . $PMF_LANG["msgContact"] . '</a>', "allCategories" => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=show">' . $PMF_LANG["msgShowAllCategories"] . '</a>', "backToHome" => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . '">' . $PMF_LANG["msgHome"] . '</a>', "writeSendAdress" => $_SERVER['PHP_SELF'] . '?' . $sids . 'action=search', 'showInstantResponse' => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=instantresponse">' . $PMF_LANG['msgInstantResponse'] . '</a>', 'showSitemap' => '<a href="' . $_SERVER['PHP_SELF'] . '?' . $sids . 'action=sitemap&amp;lang=' . $LANGCODE . '">' . $PMF_LANG['msgSitemap'] . '</a>', 'opensearch' => $_SERVER['PHP_SELF'] . '?' . $sids . 'action=search');
}
//
// Send headers and print template
//
header("Expires: Thu, 07 Apr 1977 14:47:00 GMT");
Пример #3
0
if ($faqConfig->get('main.maintenanceMode')) {
    $indexSet = 'indexMaintenance.tpl';
}
//
// Load template files and set template variables
//
$tpl = new PMF_Template(array('index' => $indexSet, 'rightBox' => $rightSidebarTemplate, 'writeContent' => $includeTemplate), $faqConfig->get('main.templateSet'));
if ($faqConfig->get('main.enableUserTracking')) {
    $users = $faqsession->getUsersOnline();
    $totUsers = $users[0] + $users[1];
    $usersOnline = $plr->getMsg('plmsgUserOnline', $totUsers) . ' | ' . $plr->getMsg('plmsgGuestOnline', $users[0]) . $plr->getMsg('plmsgRegisteredOnline', $users[1]);
} else {
    $usersOnline = '';
}
$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)));
Пример #4
0
            </div>
        <header>


        <div class="row">
            <div class="col-lg-12">
<?php 
if ($user->perm->checkRight($user->getUserId(), 'editbt') || $user->perm->checkRight($user->getUserId(), 'delbt')) {
    $searchcat = PMF_Filter::filterInput(INPUT_POST, 'searchcat', FILTER_VALIDATE_INT);
    $searchterm = PMF_Filter::filterInput(INPUT_POST, 'searchterm', FILTER_SANITIZE_STRIPPED);
    $category = new PMF_Category($faqConfig, [], false);
    $category->setUser($currentAdminUser);
    $category->setGroups($currentAdminGroups);
    $category->transform(0);
    // Set the Category for the helper class
    $categoryHelper = new PMF_Helper_Category();
    $categoryHelper->setCategory($category);
    $category->buildTree();
    $linkVerifier = new PMF_Linkverifier($faqConfig, $user->getLogin());
    ?>

                <form action="?action=view" method="post" class="form-horizontal" accept-charset="utf-8">

                    <div class="form-group">
                        <label class="col-lg-2 control-label"><?php 
    print $PMF_LANG["msgSearchWord"];
    ?>
:</label>
                        <div class="col-lg-4">
                            <input class="form-control" type="search" name="searchterm" autofocus
                                   value="<?php 
if ($faqConfig->get('main.maintenanceMode')) {
    $indexSet = 'indexMaintenance.tpl';
}
//
// Load template files and set template variables
//
$tpl = new PMF_Template(array('index' => $indexSet, 'rightBox' => $rightSidebarTemplate, 'writeContent' => $includeTemplate), $faqConfig->get('main.templateSet'));
if ($faqConfig->get('main.enableUserTracking')) {
    $users = $faqsession->getUsersOnline();
    $totUsers = $users[0] + $users[1];
    $usersOnline = $plr->getMsg('plmsgUserOnline', $totUsers) . ' | ' . $plr->getMsg('plmsgGuestOnline', $users[0]) . $plr->getMsg('plmsgRegisteredOnline', $users[1]);
} else {
    $usersOnline = '';
}
$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')) {
Пример #6
0
$captcha->setSessionId($sids);
if (!is_null($showCaptcha)) {
    $captcha->showCaptchaImg();
    exit;
}
try {
    $faqsession->userTracking('new_entry', 0);
} catch (PMF_Exception $e) {
    // @todo handle the exception
}
// Get possible user input
$selectedQuestion = PMF_Filter::filterInput(INPUT_GET, 'question', FILTER_VALIDATE_INT);
$selectedCategory = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT);
$question = $readonly = '';
if (!is_null($selectedQuestion)) {
    $oQuestion = $faq->getQuestion($selectedQuestion);
    $question = $oQuestion['question'];
    if (PMF_String::strlen($question)) {
        $readonly = ' readonly';
    }
}
$category->buildTree();
$categoryHelper = new PMF_Helper_Category();
$categoryHelper->setCategory($category);
$captchaHelper = new PMF_Helper_Captcha($faqConfig);
// Enable/Disable WYSIWYG editor
if ($faqConfig->get('main.enableWysiwygEditorFrontend')) {
    $tpl->parseBlock('writeContent', 'enableWysiwygEditor', array('currentTimestamp' => $_SERVER['REQUEST_TIME']));
}
$tpl->parse('writeContent', array('msgNewContentHeader' => $PMF_LANG['msgNewContentHeader'], 'msgNewContentAddon' => $PMF_LANG['msgNewContentAddon'], 'lang' => $Language->getLanguage(), 'openQuestionID' => $selectedQuestion, 'defaultContentMail' => $user instanceof PMF_User_CurrentUser ? $user->getUserData('email') : '', 'defaultContentName' => $user instanceof PMF_User_CurrentUser ? $user->getUserData('display_name') : '', 'msgNewContentName' => $PMF_LANG['msgNewContentName'], 'msgNewContentMail' => $PMF_LANG['msgNewContentMail'], 'msgNewContentCategory' => $PMF_LANG['msgNewContentCategory'], 'printCategoryOptions' => $categoryHelper->renderOptions($selectedCategory), 'msgNewContentTheme' => $PMF_LANG['msgNewContentTheme'], 'readonly' => $readonly, 'printQuestion' => $question, 'msgNewContentArticle' => $PMF_LANG['msgNewContentArticle'], 'msgNewContentKeywords' => $PMF_LANG['msgNewContentKeywords'], 'msgNewContentLink' => $PMF_LANG['msgNewContentLink'], 'captchaFieldset' => $captchaHelper->renderCaptcha($captcha, 'add', $PMF_LANG['msgCaptcha'], $auth), 'msgNewContentSubmit' => $PMF_LANG['msgNewContentSubmit']));
$tpl->merge('writeContent', 'index');
    if ($faqConfig->get('main.enableRewriteRules')) {
        header('Location: ' . $faqConfig->get('main.referenceURL') . '/solution_id_' . $inputSearchTerm . '.html');
    } else {
        header('Location: ' . $faqConfig->get('main.referenceURL') . '/index.php?solution_id=' . $inputSearchTerm);
    }
    exit;
}
$category->buildTree();
$mostPopularSearchData = $faqSearch->getMostPopularSearches($faqConfig->get('search.numberSearchTerms'));
// Set base URL scheme
if ($faqConfig->get('main.enableRewriteRules')) {
    $baseUrl = sprintf("%ssearch.html?search=%s&amp;seite=%d%s&amp;searchcategory=%d", PMF_Link::getSystemRelativeUri('index.php'), urlencode($inputSearchTerm), $page, $languages, $inputCategory);
} else {
    $baseUrl = sprintf('%s?%saction=search&amp;search=%s&amp;seite=%d%s&amp;searchcategory=%d', PMF_Link::getSystemRelativeUri(), empty($sids) ? '' : 'sids=' . $sids . '&amp;', urlencode($inputSearchTerm), $page, $languages, $inputCategory);
}
// Pagination options
$options = array('baseUrl' => $baseUrl, 'total' => $faqSearchResult->getNumberOfResults(), 'perPage' => $faqConfig->get('records.numberOfRecordsPerPage'), 'pageParamName' => 'seite', 'layoutTpl' => '<div class="pagination text-center"><ul>{LAYOUT_CONTENT}</ul></div>');
$faqPagination = new PMF_Pagination($faqConfig, $options);
$categoryHelper = new PMF_Helper_Category();
$categoryHelper->setCategory($category);
$searchHelper = new PMF_Helper_Search($faqConfig);
$searchHelper->setSearchterm($inputSearchTerm);
$searchHelper->setCategory($category);
$searchHelper->setPagination($faqPagination);
$searchHelper->setPlurals($plr);
$searchHelper->setSessionId($sids);
if ('' == $searchResult && !is_null($inputSearchTerm)) {
    $searchResult = $searchHelper->renderSearchResult($faqSearchResult, $page);
}
$tpl->parse('writeContent', array('msgAdvancedSearch' => $tagSearch ? $PMF_LANG['msgTagSearch'] : $PMF_LANG['msgAdvancedSearch'], 'msgSearch' => $PMF_LANG['msgSearch'], 'searchString' => PMF_String::htmlspecialchars($inputSearchTerm, ENT_QUOTES, 'utf-8'), 'searchOnAllLanguages' => $PMF_LANG['msgSearchOnAllLanguages'], 'checkedAllLanguages' => $allLanguages ? ' checked="checked"' : '', 'selectCategories' => $PMF_LANG['msgSelectCategories'], 'allCategories' => $PMF_LANG['msgAllCategories'], 'printCategoryOptions' => $categoryHelper->renderOptions($inputCategory), 'writeSendAdress' => '?' . $sids . 'action=search', 'msgSearchWord' => $PMF_LANG['msgSearchWord'], 'printResult' => $searchResult, 'openSearchLink' => $searchHelper->renderOpenSearchLink(), 'msgMostPopularSearches' => $PMF_LANG['msgMostPopularSearches'], 'printMostPopularSearches' => $searchHelper->renderMostPopularSearches($mostPopularSearchData)));
$tpl->merge('writeContent', 'index');
 * @since     2003-02-23
 */
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;
}
if (($permission['editbt'] || $permission['addbt']) && !PMF_Db::checkOnEmptyTable('faqcategories')) {
    $category = new PMF_Category($faqConfig, array(), false);
    $category->setUser($currentAdminUser);
    $category->setGroups($currentAdminGroups);
    $category->buildTree();
    $categoryHelper = new PMF_Helper_Category();
    $categoryHelper->setCategory($category);
    $selectedCategory = '';
    $categories = array();
    $faqData = array('id' => 0, 'lang' => $LANGCODE, 'revision_id' => 0, 'title' => '', 'dateStart' => '', 'dateEnd' => '');
    $tagging = new PMF_Tags($faqConfig);
    $date = new PMF_Date($faqConfig);
    if ('takequestion' === $action) {
        $questionId = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
        $question = $faq->getQuestion($questionId);
        $selectedCategory = $question['category_id'];
        $faqData['title'] = $question['question'];
        $notifyUser = $question['username'];
        $notifyEmail = $question['email'];
        $categories = array('category_id' => $selectedCategory, 'category_lang' => $faqData['lang']);
    } else {
Пример #9
0
    }
    RedirectResponse::create($location)->send();
    exit;
}
$category->buildTree();
$mostPopularSearchData = $faqSearch->getMostPopularSearches($faqConfig->get('search.numberSearchTerms'));
// Set base URL scheme
if ($faqConfig->get('main.enableRewriteRules')) {
    $baseUrl = sprintf("%ssearch.html?search=%s&amp;seite=%d%s&amp;searchcategory=%d", PMF_Link::getSystemRelativeUri('index.php'), urlencode($inputSearchTerm), $page, $languages, $inputCategory);
} else {
    $baseUrl = sprintf('%s?%saction=search&amp;search=%s&amp;seite=%d%s&amp;searchcategory=%d', PMF_Link::getSystemRelativeUri(), empty($sids) ? '' : 'sids=' . $sids . '&amp;', urlencode($inputSearchTerm), $page, $languages, $inputCategory);
}
// Pagination options
$options = array('baseUrl' => $baseUrl, 'total' => $faqSearchResult->getNumberOfResults(), 'perPage' => $faqConfig->get('records.numberOfRecordsPerPage'), 'pageParamName' => 'seite', 'layoutTpl' => '<div class="text-center"><ul class="pagination">{LAYOUT_CONTENT}</ul></div>');
$faqPagination = new PMF_Pagination($faqConfig, $options);
$categoryHelper = new PMF_Helper_Category();
$categoryHelper->setCategory($category);
$searchHelper = new PMF_Helper_Search($faqConfig);
$searchHelper->setSearchterm($inputSearchTerm);
$searchHelper->setCategory($category);
$searchHelper->setPagination($faqPagination);
$searchHelper->setPlurals($plr);
$searchHelper->setSessionId($sids);
if ('' == $searchResult && !is_null($inputSearchTerm)) {
    $searchResult = $searchHelper->renderSearchResult($faqSearchResult, $page);
}
if ($tagSearch) {
    $tpl->parseBlock('writeContent', 'searchTagsSection', array('searchTags' => $tagHelper->renderTagList($tags)));
    $tpl->parseBlock('writeContent', 'relatedTags', array('relatedTagsHeader' => $PMF_LANG['msgRelatedTags'], 'relatedTags' => $relTags));
} else {
    if ('' === $search) {
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;
}
printf('<header><h2><i class="icon-pencil"></i> %s</h2><header>', $PMF_LANG['ad_entry_aor']);
if ($permission['editbt'] || $permission['delbt']) {
    $category = new PMF_Category($faqConfig, array(), false);
    $category->setUser($currentAdminUser);
    $category->setGroups($currentAdminGroups);
    $category->transform(0);
    // Set the Category for the helper class
    $categoryHelper = new PMF_Helper_Category();
    $categoryHelper->setCategory($category);
    $category->buildTree();
    $linkverifier = new PMF_Linkverifier($faqConfig, $user->getLogin());
    if ($linkverifier->isReady()) {
        ?>
    <script type="text/javascript">
        <!--
        function getImageElement(id, lang)
        {
            return $('#imgurl_' + lang + '_' + id);
        }

        function getSpanElement(id, lang)
        {
            return $('#spanurl_' + lang + '_' + id);
 *
 * @category  phpMyFAQ
 * @package   Frontend
 * @author    Thorsten Rinne <*****@*****.**>
 * @copyright 2002-2015 phpMyFAQ Team
 * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
 * @link      http://www.phpmyfaq.de
 * @since     2002-09-17
 */
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);
$captcha->setSessionId($sids);
if (!is_null($showCaptcha)) {
    $captcha->showCaptchaImg();
    exit;
}
$faqsession->userTracking('ask_question', 0);
$category->buildTree();
$categoryId = PMF_Filter::filterInput(INPUT_GET, 'category_id', FILTER_VALIDATE_INT, 0);
$categoryHelper = new PMF_Helper_Category();
$categoryHelper->setCategory($category);
$captchaHelper = new PMF_Helper_Captcha($faqConfig);
$tpl->parse('writeContent', array('msgQuestion' => $PMF_LANG['msgQuestion'], 'msgNewQuestion' => $PMF_LANG['msgNewQuestion'], 'lang' => $Language->getLanguage(), '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') : '', 'msgAskCategory' => $PMF_LANG['msgAskCategory'], 'printCategoryOptions' => $categoryHelper->renderOptions($categoryId), 'msgAskYourQuestion' => $PMF_LANG['msgAskYourQuestion'], 'captchaFieldset' => $captchaHelper->renderCaptcha($captcha, 'ask', $PMF_LANG['msgCaptcha'], $auth), 'msgNewContentSubmit' => $PMF_LANG['msgNewContentSubmit']));
$tpl->merge('writeContent', 'index');