예제 #1
0
 if (1 != $save) {
     $cleanQuestion = PMF_Stopwords::getInstance()->clean($question);
     $user = new PMF_User_CurrentUser();
     $faqSearch = new PMF_Search($db, $Language);
     $faqSearchResult = new PMF_Search_Resultset($user, $faq);
     $searchResult = array();
     $mergedResult = array();
     foreach ($cleanQuestion as $word) {
         $searchResult[] = $faqSearch->search($word);
     }
     foreach ($searchResult as $resultSet) {
         foreach ($resultSet as $result) {
             $mergedResult[] = $result;
         }
     }
     $faqSearchResult->reviewResultset($mergedResult);
     if (0 < $faqSearchResult->getNumberOfResults()) {
         $response = sprintf('<p>%s</p>', $plr->GetMsg('plmsgSearchAmount', $faqSearchResult->getNumberOfResults()));
         $response .= '<ul>';
         foreach ($faqSearchResult->getResultset() as $result) {
             $url = sprintf('/index.php?action=artikel&amp;cat=%d&amp;id=%d&amp;artlang=%s', $result->category_id, $result->id, $result->lang);
             $oLink = new PMF_Link(PMF_Configuration::getInstance()->get('main.referenceURL') . $url);
             $oLink->text = PMF_Utils::chopString($result->question, 15);
             $oLink->itemTitle = $result->question;
             $response .= sprintf('<li>%s<br /><div class="searchpreview">%s...</div></li>', $oLink->toHtmlAnchor(), PMF_Utils::chopString(strip_tags($result->answer), 10));
         }
         $response .= '</ul>';
         $message = array('result' => $response);
     } else {
         $questionData = array('username' => $name, 'email' => $email, 'category_id' => $ucategory, 'question' => $question, 'is_visible' => $visibility);
         $faq->addQuestion($questionData);
예제 #2
0
파일: search.php 프로젝트: atlcurling/tkt
} else {
    $searchResult = '';
}
//
// Handle the full text search stuff
//
if (!is_null($inputSearchTerm) || !is_null($search)) {
    if (!is_null($inputSearchTerm)) {
        $inputSearchTerm = $db->escape_string(strip_tags($inputSearchTerm));
    }
    if (!is_null($search)) {
        $inputSearchTerm = $db->escape_string(strip_tags($search));
    }
    $faqSearch->setCategory($inputCategory);
    $searchResults = $faqSearch->search($inputSearchTerm, $allLanguages);
    $faqSearchResult->reviewResultset($searchResults);
    $inputSearchTerm = stripslashes($inputSearchTerm);
    $faqSearch->logSearchTerm($inputSearchTerm);
}
// Change a little bit the $searchCategory value;
$inputCategory = '%' == $inputCategory ? 0 : $inputCategory;
$faqsession->userTracking('fulltext_search', $inputSearchTerm);
if (is_numeric($inputSearchTerm) && PMF_SOLUTION_ID_START_VALUE <= $inputSearchTerm && 0 < $faqSearchResult->getNumberOfResults()) {
    // Before a redirection we must force the PHP session update for preventing data loss
    session_write_close();
    if (PMF_Configuration::getInstance()->get('main.enableRewriteRules')) {
        header('Location: ' . PMF_Link::getSystemUri('/index.php') . '/solution_id_' . $inputSearchTerm . '.html');
    } else {
        header('Location: ' . PMF_Link::getSystemUri('/index.php') . '/index.php?solution_id=' . $inputSearchTerm);
    }
    exit;
예제 #3
0
파일: artikel.php 프로젝트: atlcurling/tkt
if (count($multiCategories) > 1) {
    $htmlAllCategories .= '        <div id="article_categories">';
    $htmlAllCategories .= '            <p>' . $PMF_LANG['msgArticleCategories'] . '</p>';
    $htmlAllCategories .= '            <ul>';
    foreach ($multiCategories as $multiCat) {
        $path = $category->getPath($multiCat['id'], ' &raquo; ', true);
        if ('' === trim($path)) {
            continue;
        }
        $htmlAllCategories .= sprintf("<li>%s</li>\n", $path);
    }
    $htmlAllCategories .= '            </ul>';
    $htmlAllCategories .= '    </div>';
}
// Related FAQs
$faqSearchResult->reviewResultset($faqRelation->getAllRelatedById($faq->faqRecord['id'], $faq->faqRecord['title'], $faq->faqRecord['keywords']));
$relatedFaqs = PMF_Helper_Search::getInstance()->renderRelatedFaqs($faqSearchResult, $faq->faqRecord['id']);
// Show link to edit the faq?
$editThisEntry = '';
if (isset($permission['editbt']) && $permission['editbt']) {
    $editThisEntry = sprintf('<a href="%sadmin/index.php?action=editentry&amp;id=%d&amp;lang=%s">%s</a>', PMF_Link::getSystemRelativeUri('index.php'), $faq->faqRecord['id'], $lang, $PMF_LANG['ad_entry_edit_1'] . ' ' . $PMF_LANG['ad_entry_edit_2']);
}
// Is the faq expired?
$expired = date('YmdHis') > $faq->faqRecord['dateEnd'];
// Does the user have the right to add a comment?
if ($faq->faqRecord['active'] != 'yes' || 'n' == $faq->faqRecord['comment'] || $expired) {
    $commentMessage = $PMF_LANG['msgWriteNoComment'];
} else {
    $commentMessage = sprintf("%s<a href=\"javascript:void(0);\" onclick=\"javascript:\$('#commentForm').show();\">%s</a>", $PMF_LANG['msgYouCan'], $PMF_LANG['msgWriteComment']);
}
$translationUrl = sprintf(str_replace('%', '%%', PMF_Link::getSystemRelativeUri('index.php')) . 'index.php?%saction=translate&amp;cat=%s&amp;id=%d&amp;srclang=%s', $sids, $currentCategory, $faq->faqRecord['id'], $lang);