Example #1
0
 /**
  * Renders the result page for the main search page
  * 
  * @param PMF_Search_Resultset $resultSet   PMF_Search_Resultset object
  * @param integer              $currentPage Current page number
  * 
  * @return string
  */
 public function renderSearchResult(PMF_Search_Resultset $resultSet, $currentPage)
 {
     $html = '';
     $confPerPage = PMF_Configuration::getInstance()->get('main.numberOfRecordsPerPage');
     $numOfResults = $resultSet->getNumberOfResults();
     $totalPages = ceil($numOfResults / $confPerPage);
     $lastPage = $currentPage * $confPerPage;
     $firstPage = $lastPage - $confPerPage;
     if ($lastPage > $numOfResults) {
         $lastPage = $numOfResults;
     }
     if (0 < $numOfResults) {
         $html .= sprintf("<p>%s</p>\n", $this->plurals->GetMsg('plmsgSearchAmount', $numOfResults));
         if (1 < $totalPages) {
             $html .= sprintf("<p><strong>%s%d %s %s</strong></p>\n", $this->translation['msgPage'], $currentPage, $this->translation['msgVoteFrom'], $this->plurals->GetMsg('plmsgPagesTotal', $totalPages));
         }
         $html .= "<ul class=\"phpmyfaq_ul\">\n";
         $counter = $displayedCounter = 0;
         foreach ($resultSet->getResultset() as $result) {
             if ($displayedCounter >= $confPerPage) {
                 continue;
             }
             $counter++;
             if ($counter <= $firstPage) {
                 continue;
             }
             $displayedCounter++;
             $categoryName = $this->categoryLayout->renderBreadcrumb(array($result->category_id));
             $question = PMF_Utils::chopString($result->question, 15);
             $answerPreview = PMF_Utils::chopString(strip_tags($result->answer), 25);
             $searchterm = str_replace(array('^', '.', '?', '*', '+', '{', '}', '(', ')', '[', ']', '"'), '', $this->searchterm);
             $searchterm = preg_quote($searchterm, '/');
             $searchItems = explode(' ', $searchterm);
             if (PMF_String::strlen($searchItems[0]) > 1) {
                 foreach ($searchItems as $item) {
                     if (PMF_String::strlen($item) > 2) {
                         $question = PMF_Utils::setHighlightedString($question, $item);
                         $answerPreview = PMF_Utils::setHighlightedString($answerPreview, $item);
                     }
                 }
             }
             // Build the link to the faq record
             $currentUrl = sprintf('%s?%saction=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s&amp;highlight=%s', PMF_Link::getSystemRelativeUri(), $this->sessionId, $result->category_id, $result->id, $result->lang, urlencode($searchterm));
             $oLink = new PMF_Link($currentUrl);
             $oLink->text = $oLink->itemTitle = $oLink->tooltip = $result->question;
             $html .= "<li>";
             $html .= sprintf("<strong>%s</strong>: %s<br />", $categoryName, $oLink->toHtmlAnchor());
             $html .= sprintf("<div class=\"searchpreview\"><strong>%s</strong> %s...</div><br />\n", $this->translation['msgSearchContent'], $answerPreview);
             $html .= "</li>";
         }
         $html .= "</ul>\n";
         if (1 < $totalPages) {
             $html .= $this->pagination->render();
         }
     } else {
         $html = $this->translation['err_noArticles'];
     }
     return $html;
 }
}
$logging = new PMF_Logging($faqConfig);
if ($user->perm->checkRight($user->getUserId(), 'adminlog') && 'adminlog' == $action) {
    $date = new PMF_Date($faqConfig);
    $perpage = 15;
    $pages = PMF_Filter::filterInput(INPUT_GET, 'pages', FILTER_VALIDATE_INT);
    $page = PMF_Filter::filterInput(INPUT_GET, 'page', FILTER_VALIDATE_INT, 1);
    if (is_null($pages)) {
        $pages = round(($logging->getNumberOfEntries() + $perpage / 3) / $perpage, 0);
    }
    $start = ($page - 1) * $perpage;
    $ende = $start + $perpage;
    $baseUrl = sprintf('%s?action=adminlog&amp;page=%d', PMF_Link::getSystemRelativeUri(), $page);
    // Pagination options
    $options = array('baseUrl' => $baseUrl, 'total' => $logging->getNumberOfEntries(), 'perPage' => $perpage, 'pageParamName' => 'page');
    $pagination = new PMF_Pagination($faqConfig, $options);
    $loggingData = $logging->getAll();
    ?>
    <header>
        <h2 class="page-header">
            <i class="fa fa-tasks"></i> <?php 
    echo $PMF_LANG["ad_menu_adminlog"];
    ?>
            <div class="pull-right">
                <a class="btn btn-danger" href="?action=deleteadminlog">
                    <i class="fa fa-trash"></i> <?php 
    echo $PMF_LANG['ad_adminlog_del_older_30d'];
    ?>
                </a>
            </div>
        </h2>
Example #3
0
 * There are meanwhile over 600 language
 * vars and we won't to show them all
 * at once, so let's paginate.
 */
$itemsPerPage = 32;
if (!isset($_SESSION['trans'])) {
    /**
     * English is our exemplary language
     */
    $_SESSION['trans']['leftVarsOnly'] = $tt->getVars(PMF_ROOT_DIR . "/lang/language_en.php");
    $_SESSION['trans']['rightVarsOnly'] = $tt->getVars(PMF_ROOT_DIR . "/lang/language_{$translateLang}.php");
}
$leftVarsOnly = array_slice($_SESSION['trans']['leftVarsOnly'], ($page - 1) * $itemsPerPage, $itemsPerPage);
$rightVarsOnly =& $_SESSION['trans']['rightVarsOnly'];
$options = array('baseUrl' => '?' . str_replace('&', '&amp;', $_SERVER['QUERY_STRING']), 'total' => count($_SESSION['trans']['leftVarsOnly']), 'perPage' => $itemsPerPage, 'linkTpl' => '<a href="javascript: go(\'{LINK_URL}\');void(0);">{LINK_TEXT}</a>', 'layoutTpl' => '<p align="center"><strong>{LAYOUT_CONTENT}</strong></p>');
$pagination = new PMF_Pagination($options);
$pageBar = $pagination->render();
/**
 * These keys always exist as they are defined when creating translation.
 * We use these values to add the correct number of input boxes.
 * Left column will always have 2 boxes, right - 1 to 6+ boxes.
 */
$leftNPlurals = (int) $_SESSION['trans']['leftVarsOnly']['PMF_LANG[nplurals]'];
$rightNPlurals = (int) $rightVarsOnly['PMF_LANG[nplurals]'];
printf('<h2>%s</h2>', $PMF_LANG['ad_menu_translations']);
printf('<font color="red">%s</font>', $PMF_LANG['msgTransToolNoteFileSaving']);
$NPluralsErrorReported = false;
?>
<form id="transDiffForm">
<table>
<tr>
Example #4
0
 }
 // show list of all users
 if ($userAction == 'listallusers' && $user->perm->checkRight($user->getUserId(), 'edituser')) {
     $templateVars = array('PMF_LANG' => $PMF_LANG, 'displayPagination' => false, 'message' => $message, 'users' => array());
     $allUsers = $user->getAllUsers();
     $numUsers = count($allUsers);
     $page = PMF_Filter::filterInput(INPUT_GET, 'page', FILTER_VALIDATE_INT, 0);
     $perPage = 10;
     $numPages = ceil($numUsers / $perPage);
     $lastPage = $page * $perPage;
     $firstPage = $lastPage - $perPage;
     $baseUrl = sprintf('%s?action=user&amp;user_action=listallusers&amp;page=%d', PMF_Link::getSystemRelativeUri(), $page);
     if ($perPage < $numUsers) {
         // Pagination options
         $options = array('baseUrl' => $baseUrl, 'total' => $numUsers, 'perPage' => $perPage, 'pageParamName' => 'page');
         $pagination = new PMF_Pagination($faqConfig, $options);
         $templateVars['displayPagination'] = true;
         $templateVars['pagination'] = $pagination->render();
     }
     $counter = $displayedCounter = 0;
     foreach ($allUsers as $userId) {
         $user->getUserById($userId);
         if ($displayedCounter >= $perPage) {
             continue;
         }
         $counter++;
         if ($counter <= $firstPage) {
             continue;
         }
         $displayedCounter++;
         $icon = '';
 * @since     2012-09-03
 */
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;
}
$page = PMF_Filter::filterInput(INPUT_GET, 'page', FILTER_VALIDATE_INT, 1);
$glossary = new PMF_Glossary($faqConfig);
$glossaryItems = $glossary->getAllGlossaryItems();
$numItems = count($glossaryItems);
$itemsPerPage = 10;
$baseUrl = sprintf('%s?action=glossary&amp;page=%d', PMF_Link::getSystemRelativeUri(), $page);
// Pagination options
$options = array('baseUrl' => $baseUrl, 'total' => count($glossaryItems), 'perPage' => $itemsPerPage, 'pageParamName' => 'page');
$pagination = new PMF_Pagination($faqConfig, $options);
if (0 < $numItems) {
    $output = array();
    $visibleItems = array_slice($glossaryItems, ($page - 1) * $itemsPerPage, $itemsPerPage);
    foreach ($visibleItems as $item) {
        $output['item'][] = $item['item'];
        $output['definition'][] = $item['definition'];
        $i++;
    }
    $tpl->parseBlock('writeContent', 'glossaryItems', array('item' => $output['item'], 'desc' => $output['definition']));
}
$tpl->parse('writeContent', array('msgGlossary' => $PMF_LANG['ad_menu_glossary'], 'msgGlossrayItem' => $PMF_LANG['ad_glossary_item'], 'msgGlossaryDescription' => $PMF_LANG['ad_glossary_definition'], 'pagination' => $pagination->render(), 'glossaryData' => ''));
$tpl->merge('writeContent', 'index');
Example #6
0
 * @copyright 2003-2011 phpMyFAQ Team
 * @license   http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1
 * @link      http://www.phpmyfaq.de
 * @since     2010-12-13
 */
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$page = PMF_Filter::filterInput(INPUT_GET, 'page', FILTER_VALIDATE_INT);
$page = 1 > $page ? 1 : $page;
$fa = new PMF_Attachment_Collection();
$itemsPerPage = 32;
$allCrumbs = $fa->getBreadcrumbs();
$crumbs = array_slice($allCrumbs, ($page - 1) * $itemsPerPage, $itemsPerPage);
$pagination = new PMF_Pagination(array('baseUrl' => PMF_Link::getSystemRelativeUri() . '?' . str_replace('&', '&amp;', $_SERVER['QUERY_STRING']), 'total' => count($allCrumbs), 'perPage' => $itemsPerPage, 'layoutTpl' => '<p align="center"><strong>{LAYOUT_CONTENT}</strong></p>'));
printf('<header><h2>%s</h2></header>', $PMF_LANG['ad_menu_attachment_admin']);
?>
        <table class="list" style="width: 100%;">
            <thead>
                <tr>
                    <th><?php 
print $PMF_LANG['msgAttachmentsFilename'];
?>
</th>
                    <th><?php 
print $PMF_LANG['msgTransToolLanguage'];
?>
</th>
                    <th><?php 
print $PMF_LANG['msgAttachmentsFilesize'];
 /**
  * This function returns all not expired records from one category
  *
  * @param integer $categoryId Category ID
  * @param string  $orderby    Order by
  * @param string  $sortby     Sorty by
  *
  * @return string
  */
 public function showAllRecords($categoryId, $orderby = 'id', $sortby = 'ASC')
 {
     global $sids;
     $numPerPage = $this->_config->get('records.numberOfRecordsPerPage');
     $page = PMF_Filter::filterInput(INPUT_GET, 'seite', FILTER_VALIDATE_INT, 1);
     $output = '';
     $title = '';
     if ($orderby == 'visits') {
         $currentTable = 'fv';
     } else {
         $currentTable = 'fd';
     }
     // If random FAQs are activated, we don't need an order
     if (true === $this->_config->get('records.randomSort')) {
         $order = '';
     } else {
         $order = sprintf("ORDER BY fd.sticky DESC, %s.%s %s", $currentTable, $this->_config->getDb()->escape($orderby), $this->_config->getDb()->escape($sortby));
     }
     $now = date('YmdHis');
     $query = sprintf("\n            SELECT\n                fd.id AS id,\n                fd.lang AS lang,\n                fd.sticky AS sticky,\n                fd.thema AS thema,\n                fcr.category_id AS category_id,\n                fv.visits AS visits\n            FROM\n                %sfaqdata AS fd\n            LEFT JOIN\n                %sfaqcategoryrelations AS fcr\n            ON\n                fd.id = fcr.record_id\n            AND\n                fd.lang = fcr.record_lang\n            LEFT JOIN\n                %sfaqvisits AS fv\n            ON\n                fd.id = fv.id\n            AND\n                fv.lang = fd.lang\n            LEFT JOIN\n                %sfaqdata_group AS fdg\n            ON\n                fd.id = fdg.record_id\n            LEFT JOIN\n                %sfaqdata_user AS fdu\n            ON\n                fd.id = fdu.record_id\n            WHERE\n                fd.date_start <= '%s'\n            AND\n                fd.date_end   >= '%s'\n            AND\n                fd.active = 'yes'\n            AND\n                fcr.category_id = %d\n            AND\n                fd.lang = '%s'\n            %s\n            %s", PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), PMF_Db::getTablePrefix(), $now, $now, $categoryId, $this->_config->getLanguage()->getLanguage(), $this->queryPermission($this->groupSupport), $order);
     $result = $this->_config->getDb()->query($query);
     $num = $this->_config->getDb()->numRows($result);
     $pages = (int) ceil($num / $numPerPage);
     if ($page == 1) {
         $first = 0;
     } else {
         $first = $page * $numPerPage - $numPerPage;
     }
     if ($num > 0) {
         if ($pages > 1) {
             $output .= sprintf('<p><strong>%s %s %s</strong></p>', $this->pmf_lang['msgPage'] . $page, $this->pmf_lang['msgVoteFrom'], $pages . $this->pmf_lang['msgPages']);
         }
         $output .= '<ul class="phpmyfaq_ul">';
         $counter = 0;
         $displayedCounter = 0;
         $renderedItems = array();
         while (($row = $this->_config->getDb()->fetchObject($result)) && $displayedCounter < $numPerPage) {
             $counter++;
             if ($counter <= $first) {
                 continue;
             }
             $displayedCounter++;
             if (empty($row->visits)) {
                 $visits = 0;
             } else {
                 $visits = $row->visits;
             }
             $title = $row->thema;
             $url = sprintf('%s?%saction=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', PMF_Link::getSystemRelativeUri(), $sids, $row->category_id, $row->id, $row->lang);
             $oLink = new PMF_Link($url, $this->_config);
             $oLink->itemTitle = $oLink->text = $oLink->tooltip = $title;
             // If random FAQs are activated, we don't need sticky FAQs
             if (true === $this->_config->get('records.randomSort')) {
                 $row->sticky = 0;
             }
             $renderedItems[$row->id] = sprintf('<li%s>%s<span id="viewsPerRecord"><br /><small>(%s)</small></span></li>', $row->sticky == 1 ? ' class="sticky-faqs"' : '', $oLink->toHtmlAnchor(), $this->plr->GetMsg('plmsgViews', $visits));
         }
         // If random FAQs are activated, shuffle the FAQs :-)
         if (true === $this->_config->get('records.randomSort')) {
             shuffle($renderedItems);
         }
         $output .= implode("\n", $renderedItems);
         $output .= '</ul><span class="totalFaqRecords hide">' . $num . '</span>';
     } else {
         return false;
     }
     if ($pages > 1) {
         // Set rewrite URL, if needed
         if ($this->_config->get('main.enableRewriteRules')) {
             $link = new PMF_Link(PMF_Link::getSystemRelativeUri('index.php'), $this->_config);
             $useRewrite = true;
             $rewriteUrl = sprintf("%scategory/%d/%%d/%s.html", PMF_Link::getSystemRelativeUri('index.php'), $categoryId, $link->getSEOItemTitle($title));
         } else {
             $useRewrite = false;
             $rewriteUrl = '';
         }
         $baseUrl = sprintf("%s?%saction=show&amp;cat=%d&amp;seite=%d", PMF_Link::getSystemRelativeUri(), empty($sids) ? '' : $sids, $categoryId, $page);
         $options = array('baseUrl' => $baseUrl, 'total' => $num, 'perPage' => $this->_config->get('records.numberOfRecordsPerPage'), 'useRewrite' => $useRewrite, 'rewriteUrl' => $rewriteUrl, 'pageParamName' => 'seite');
         $pagination = new PMF_Pagination($this->_config, $options);
         $output .= $pagination->render();
     }
     return $output;
 }
Example #8
0
 /**
  * This function returns all not expired records from one category
  *
  * @param  int     $category_id Category ID
  * @param  string  $orderby     Order by
  * @param  string  $sortby      Sorty by
  * @return string
  */
 public function showAllRecords($category_id, $orderby = 'id', $sortby = 'ASC')
 {
     global $sids, $category;
     $faqconfig = PMF_Configuration::getInstance();
     $page = PMF_Filter::filterInput(INPUT_GET, 'seite', FILTER_VALIDATE_INT, 1);
     $output = '';
     if ($orderby == 'visits') {
         $current_table = 'fv';
     } else {
         $current_table = 'fd';
     }
     if ($this->groupSupport) {
         $permPart = sprintf("( fdg.group_id IN (%s)\n            OR\n                (fdu.user_id = %d AND fdg.group_id IN (%s)))", implode(', ', $this->groups), $this->user, implode(', ', $this->groups));
     } else {
         $permPart = sprintf("( fdu.user_id = %d OR fdu.user_id = -1 )", $this->user);
     }
     $now = date('YmdHis');
     $query = sprintf("\n            SELECT\n                fd.id AS id,\n                fd.lang AS lang,\n                fd.sticky AS sticky,\n                fd.thema AS thema,\n                fcr.category_id AS category_id,\n                fv.visits AS visits\n            FROM\n                %sfaqdata AS fd\n            LEFT JOIN\n                %sfaqcategoryrelations AS fcr\n            ON\n                fd.id = fcr.record_id\n            AND\n                fd.lang = fcr.record_lang\n            LEFT JOIN\n                %sfaqvisits AS fv\n            ON\n                fd.id = fv.id\n            AND\n                fv.lang = fd.lang\n            LEFT JOIN\n                %sfaqdata_group AS fdg\n            ON\n                fd.id = fdg.record_id\n            LEFT JOIN\n                %sfaqdata_user AS fdu\n            ON\n                fd.id = fdu.record_id\n            WHERE\n                fd.date_start <= '%s'\n            AND\n                fd.date_end   >= '%s'\n            AND\n                fd.active = 'yes'\n            AND\n                fcr.category_id = %d\n            AND\n                fd.lang = '%s'\n            AND\n                %s\n            ORDER BY\n                fd.sticky DESC, %s.%s %s", SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, SQLPREFIX, $now, $now, $category_id, $this->language, $permPart, $current_table, $this->db->escapeString($orderby), $this->db->escapeString($sortby));
     $result = $this->db->query($query);
     $num = $this->db->numRows($result);
     $pages = ceil($num / $faqconfig->get("main.numberOfRecordsPerPage"));
     if ($page == 1) {
         $first = 0;
     } else {
         $first = $page * $faqconfig->get("main.numberOfRecordsPerPage") - $faqconfig->get("main.numberOfRecordsPerPage");
     }
     if ($num > 0) {
         if ($pages > 1) {
             $output .= sprintf('<p><strong>%s %s %s</strong></p>', $this->pmf_lang['msgPage'] . $page, $this->pmf_lang['msgVoteFrom'], $pages . $this->pmf_lang['msgPages']);
         }
         $output .= '<ul class="phpmyfaq_ul">';
         $counter = 0;
         $displayedCounter = 0;
         while (($row = $this->db->fetchObject($result)) && $displayedCounter < $faqconfig->get("main.numberOfRecordsPerPage")) {
             $counter++;
             if ($counter <= $first) {
                 continue;
             }
             $displayedCounter++;
             if (empty($row->visits)) {
                 $visits = 0;
             } else {
                 $visits = $row->visits;
             }
             $title = $row->thema;
             $url = sprintf('%saction=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', $sids, $row->category_id, $row->id, $row->lang);
             $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . '?' . $url);
             $oLink->itemTitle = $row->thema;
             $oLink->text = $title;
             $oLink->tooltip = $title;
             $listItem = sprintf('<li>%s<span id="viewsPerRecord"><br /><span class="little">(%s)</span>%s</span></li>', $oLink->toHtmlAnchor(), $this->plr->GetMsg('plmsgViews', $visits), $row->sticky == 1 ? '<br /><br />' : '');
             $output .= $listItem;
         }
         $output .= '</ul><span id="totFaqRecords" style="display: none;">' . $num . '</span>';
     } else {
         return false;
     }
     $categoryName = 'CategoryId-' . $category_id;
     if (isset($category)) {
         $categoryName = $category->categoryName[$category_id]['name'];
     }
     if ($pages > 1) {
         $baseUrl = PMF_Link::getSystemRelativeUri() . '?' . (empty($sids) ? '' : "{$sids}&amp;") . 'action=show&amp;cat=' . $category_id . '&amp;seite=' . $page;
         $options = array('baseUrl' => $baseUrl, 'total' => $num, 'perPage' => $faqconfig->get('main.numberOfRecordsPerPage'), 'pageParamName' => 'seite', 'nextPageLinkTpl' => '<a href="{LINK_URL}">' . $this->pmf_lang['msgNext'] . '</a>', 'prevPageLinkTpl' => '<a href="{LINK_URL}">' . $this->pmf_lang['msgPrevious'] . '</a>', 'layoutTpl' => '<p align="center"><strong>{LAYOUT_CONTENT}</strong></p>');
         $pagination = new PMF_Pagination($options);
         $output .= $pagination->render();
     }
     return $output;
 }
Example #9
0
/**
 * The main search function for the full text search
 *
 * TODO: add filter for (X)HTML tag names and attributes!
 *
 * @param   string  Text/Number (solution id)
 * @param   string  '%' to avoid any category filtering
 * @param   boolean true to search over all languages
 * @param   boolean true to disable the results paging
 * @param   boolean true to use it for Instant Response
 * @return  string
 * @access  public
 * @author  Thorsten Rinne <*****@*****.**>
 * @author  Matteo Scaramuccia <*****@*****.**>
 * @author  Adrianna Musiol <*****@*****.**>
 * @since   2002-09-16
 */
function searchEngine($searchterm, $cat = '%', $allLanguages = true, $hasMore = false, $instantRespnse = false)
{
    global $sids, $PMF_LANG, $plr, $LANGCODE, $faq, $current_user, $current_groups, $categoryLayout;
    $_searchterm = PMF_htmlentities(stripslashes($searchterm), ENT_QUOTES, 'utf-8');
    $seite = 1;
    $output = '';
    $num = 0;
    $searchItems = array();
    $langs = true == $allLanguages ? '&amp;langs=all' : '';
    $seite = PMF_Filter::filterInput(INPUT_GET, 'seite', FILTER_VALIDATE_INT, 1);
    $db = PMF_Db::getInstance();
    $faqconfig = PMF_Configuration::getInstance();
    $result = getSearchData(htmlentities($searchterm, ENT_COMPAT, 'utf-8'), true, $cat, $allLanguages);
    $num = $db->numRows($result);
    if (0 == $num) {
        $output = $PMF_LANG['err_noArticles'];
    }
    $confPerPage = $faqconfig->get('main.numberOfRecordsPerPage');
    $pages = ceil($num / $confPerPage);
    $last = $seite * $confPerPage;
    $first = $last - $confPerPage;
    if ($last > $num) {
        $last = $num;
    }
    if ($num > 0) {
        $output .= '<p>' . $plr->GetMsg('plmsgSearchAmount', $num);
        if ($hasMore && $pages > 1) {
            $output .= sprintf($PMF_LANG['msgInstantResponseMaxRecords'], $confPerPage);
        }
        $output .= "</p>\n";
        if (!$hasMore && $pages > 1) {
            $output .= "<p><strong>" . $PMF_LANG["msgPage"] . $seite . " " . $PMF_LANG["msgVoteFrom"] . " " . $plr->GetMsg('plmsgPagesTotal', $pages) . "</strong></p>";
        }
        $output .= "<ul class=\"phpmyfaq_ul\">\n";
        $faqUser = new PMF_Faq_User();
        $faqGroup = new PMF_Faq_Group();
        $counter = $displayedCounter = 0;
        while (($row = $db->fetchObject($result)) && $displayedCounter < $confPerPage) {
            $counter++;
            if ($counter <= $first) {
                continue;
            }
            $displayedCounter++;
            $b_permission = false;
            //Groups Permission Check
            if ($faqconfig->get('main.permLevel') == 'medium') {
                $perm_group = $faqGroup->fetch($row->id);
                foreach ($current_groups as $value) {
                    if ($value == $perm_group->group_id) {
                        $b_permission = true;
                    }
                }
            }
            if ($faqconfig->get('main.permLevel') == 'basic' || $b_permission) {
                $perm_user = $faqUser->fetch($row->id);
                foreach ($perm_user as $value) {
                    if ($value == -1) {
                        $b_permission = true;
                        break;
                    } elseif ((int) $value == $current_user) {
                        $b_permission = true;
                        break;
                    } else {
                        $b_permission = false;
                    }
                }
            }
            if ($b_permission) {
                $rubriktext = $categoryLayout->renderBreadcrumb(array($row->category_id));
                $thema = chopString($row->thema, 15);
                $content = chopString(strip_tags($row->content), 25);
                $searchterm = str_replace(array('^', '.', '?', '*', '+', '{', '}', '(', ')', '[', ']', '"'), '', $searchterm);
                $searchterm = preg_quote($searchterm, '/');
                $searchItems = explode(' ', $searchterm);
                if (PMF_String::strlen($searchItems[0]) > 1) {
                    foreach ($searchItems as $item) {
                        if (PMF_String::strlen($item) > 2) {
                            $thema = PMF_String::preg_replace_callback('/' . '(' . $item . '="[^"]*")|' . '((href|src|title|alt|class|style|id|name|dir|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup)="[^"]*' . $item . '[^"]*")|' . '(' . $item . ')' . '/mis', "highlight_no_links", $thema);
                            $content = PMF_String::preg_replace_callback('/' . '(' . $item . '="[^"]*")|' . '((href|src|title|alt|class|style|id|name|dir|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup)="[^"]*' . $item . '[^"]*")|' . '(' . $item . ')' . '/mis', "highlight_no_links", $content);
                        }
                    }
                }
                // Print the link to the faq record
                $url = sprintf('?%saction=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s&amp;highlight=%s', $sids, $row->category_id, $row->id, $row->lang, urlencode($_searchterm));
                if ($instantRespnse) {
                    $currentUrl = PMF_Link::getSystemRelativeUri('ajaxresponse.php') . 'index.php';
                } else {
                    $currentUrl = PMF_Link::getSystemRelativeUri();
                }
                $oLink = new PMF_Link($currentUrl . $url);
                $oLink->itemTitle = $row->thema;
                $oLink->text = $thema;
                $oLink->tooltip = $row->thema;
                $output .= '<li><strong>' . $rubriktext . '</strong>: ' . $oLink->toHtmlAnchor() . '<br />' . '<div class="searchpreview"><strong>' . $PMF_LANG['msgSearchContent'] . '</strong> ' . $content . '...</div>' . '<br /></li>' . "\n";
            }
        }
        $output .= "</ul>\n";
    } else {
        $output = $PMF_LANG["err_noArticles"];
    }
    if (!$hasMore && $num > $confPerPage) {
        if ($faqconfig->get('main.enableRewriteRules')) {
            $baseUrl = sprintf("search.html?search=%s&amp;seite=%d%s&amp;searchcategory=%d", urlencode($_searchterm), $seite, $langs, $cat);
        } else {
            $baseUrl = PMF_Link::getSystemRelativeUri() . '?' . (empty($sids) ? '' : "{$sids}&amp;") . 'action=search&amp;search=' . urlencode($_searchterm) . '&amp;seite=' . $seite . $langs . "&amp;searchcategory=" . $cat;
        }
        $options = array('baseUrl' => $baseUrl, 'total' => $num, 'perPage' => $confPerPage, 'pageParamName' => 'seite', 'nextPageLinkTpl' => '<a href="{LINK_URL}">' . $PMF_LANG["msgNext"] . '</a>', 'prevPageLinkTpl' => '<a href="{LINK_URL}">' . $PMF_LANG["msgPrevious"] . '</a>', 'layoutTpl' => '<p align="center"><strong>{LAYOUT_CONTENT}</strong></p>');
        $pagination = new PMF_Pagination($options);
        $output .= $pagination->render();
    }
    return $output;
}