Ejemplo n.º 1
0
// HACK: (re)evaluate the Category object w/o passing the user language
//       so the result set of a Search will have the Category Path
//       for any of the multilanguage faq records and the Category list
//       on the left pane will not be affected
$tree = new Category();
$tree->transform(0);
if (isset($_GET['suchbegriff']) || isset($_GET['search'])) {
    if (isset($_GET['suchbegriff'])) {
        $suchbegriff = $db->escape_string(strip_tags($_GET['suchbegriff']));
        $searchcategory = isset($_GET['searchcategory']) ? $db->escape_string(strip_tags($_GET['searchcategory'])) : '%';
    }
    if (isset($_GET['search'])) {
        $suchbegriff = $db->escape_string(strip_tags($_GET['search']));
        $searchcategory = isset($_GET['searchcategory']) ? $db->escape_string(strip_tags($_GET['searchcategory'])) : '%';
    }
    $printResult = searchEngine($suchbegriff, $searchcategory);
} else {
    $printResult = $PMF_LANG['help_search'];
    $suchbegriff = '';
}
Tracking('fulltext_search', $suchbegriff);
$tree->buildTree();
$baseUrl = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . $_SERVER["HTTP_HOST"] . str_replace('/index.php', '', $_SERVER['PHP_SELF']);
$firefoxPluginTitle = '';
$MSIEPluginTitle = '';
if (file_exists(dirname(__FILE__) . '/' . $_SERVER['HTTP_HOST'] . '.pmfsearch.src')) {
    $firefoxPluginTitle = '<p><a class="searchplugin" href="javascript:addEngine(\'' . $baseUrl . '\', \'' . $_SERVER['HTTP_HOST'] . '.pmfsearch\', \'png\', \'Web\')">' . $PMF_LANG['ad_search_plugin_install'] . '</a></p>';
}
if (file_exists(dirname(__FILE__) . '/' . $_SERVER['HTTP_HOST'] . '.pmfsearch.xml')) {
    $MSIEPluginTitle = '<p><a class="searchplugin" href="#" onclick="window.external.AddSearchProvider(&quot;' . $baseUrl . '/' . $_SERVER['HTTP_HOST'] . '.pmfsearch.xml&quot;);">' . $PMF_LANG['ad_msiesearch_plugin_install'] . '</a></p>';
}
Ejemplo n.º 2
0
$plr = new PMF_Language_Plurals($PMF_LANG);
//
// Initalizing static string wrapper
//
PMF_String::init($LANGCODE);
//
// Get current user and group id - default: -1
//
$user = PMF_User_CurrentUser::getFromSession($faqconfig->get('main.ipCheck'));
if (isset($user) && is_object($user)) {
    $current_user = $user->getUserId();
    if ($user->perm instanceof PMF_Perm_PermMedium) {
        $current_groups = $user->perm->getUserGroups($current_user);
    } else {
        $current_groups = array(-1);
    }
    if (0 == count($current_groups)) {
        $current_groups = array(-1);
    }
} else {
    $current_user = -1;
    $current_groups = array(-1);
}
$faq = new PMF_Faq();
//
// Handle the search requests
//
if (!is_null($searchString)) {
    $result = searchEngine($db->escapeString($searchString), $categoryId, false, true, true);
    print $result;
}
Ejemplo n.º 3
0
    $tagSearch = true;
    $tagging = new PMF_Tags();
    $record_ids = $tagging->getRecordsByTagId($inputTag);
    $printResult = $faq->showAllRecordsByIds($record_ids);
}
//
// Handle the full text search stuff
//
if (!is_null($inputSearchTerm) || !is_null($search)) {
    if (!is_null($inputSearchTerm)) {
        $inputSearchTerm = $db->escapeString(strip_tags($inputSearchTerm));
    }
    if (!is_null($search)) {
        $inputSearchTerm = $db->escapeString(strip_tags($search));
    }
    $printResult = searchEngine($inputSearchTerm, $inputCategory, $allLanguages);
    $inputSearchTerm = stripslashes($inputSearchTerm);
    $faqsearch->logSearchTerm($inputSearchTerm);
}
// Change a little bit the $searchCategory value;
$inputCategory = '%' == $inputCategory ? 0 : $inputCategory;
$faqsession->userTracking('fulltext_search', $inputSearchTerm);
$openSearchLink = sprintf('<a class="searchplugin" href="#" onclick="window.external.AddSearchProvider(\'%s/opensearch.php\');">%s</a>', PMF_Link::getSystemUri('/index.php'), $PMF_LANG['opensearch_plugin_install']);
$mostPopularSearches = '';
$mostPopularSearchData = $faqsearch->getMostPopularSearches($faqconfig->get('main.numberSearchTerms'));
foreach ($mostPopularSearchData as $searchItem) {
    if (PMF_String::strlen($searchItem['searchterm']) > 0) {
        $mostPopularSearches .= sprintf('<li><a href="?search=%s&submit=Search&action=search">%s</a> (%dx)</li>', urlencode($searchItem['searchterm']), $searchItem['searchterm'], $searchItem['number']);
    }
}
$categoryLayout = new PMF_Category_Layout(new PMF_Category_Tree_Helper(new PMF_Category_Tree($categoryData)));
Ejemplo n.º 4
0
//
$user = PMF_User_CurrentUser::getFromSession($faqconfig->get('main.ipCheck'));
if (isset($user) && is_object($user)) {
    $current_user = $user->getUserId();
    if ($user->perm instanceof PMF_Perm_PermMedium) {
        $current_groups = $user->perm->getUserGroups($current_user);
    } else {
        $current_groups = array(-1);
    }
    if (0 == count($current_groups)) {
        $current_groups = array(-1);
    }
} else {
    $current_user = -1;
    $current_groups = array(-1);
}
$category = new PMF_Category($current_user, $current_groups);
$category->transform(0);
$category->buildTree();
$faq = new PMF_Faq();
//
// Handle the search requests
//
if (!is_null($searchString)) {
    $result = searchEngine($db->escape_string($searchString), '%', false, true, true);
    if (strtolower($PMF_LANG['metaCharset']) != 'utf-8') {
        print utf8_encode($result);
    } else {
        print $result;
    }
}
Ejemplo n.º 5
0
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*/
if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']));
    exit;
}
$captcha = new PMF_Captcha($db, $sids, $pmf->language, $_SERVER['HTTP_USER_AGENT'], $_SERVER['REMOTE_ADDR']);
if (isset($_POST['username']) && $_POST['username'] != '' && isset($_POST['usermail']) && checkEmail($_POST['usermail']) && isset($_POST['content']) && $_POST['content'] != '' && IPCheck($_SERVER['REMOTE_ADDR']) && checkBannedWord(htmlspecialchars(strip_tags($_POST['content']))) && checkCaptchaCode()) {
    if (isset($_POST['try_search'])) {
        $suchbegriff = strip_tags($_POST['content']);
        $printResult = searchEngine($suchbegriff, $numr);
        echo $numr;
    } else {
        $numr = 0;
    }
    if ($numr == 0) {
        $cat = new category();
        $categories = $cat->getAllCategories();
        $usermail = $db->escape_string($IDN->encode($_POST['usermail']));
        $username = $db->escape_string(strip_tags($_POST['username']));
        $selected_category = intval($_POST['rubrik']);
        list($user, $host) = explode("@", $usermail);
        if (checkEmail($usermail)) {
            $datum = date("YmdHis");
            $content = strip_tags($_POST['content']);
            $result = $db->query("INSERT INTO " . SQLPREFIX . "faqfragen (id, ask_username, ask_usermail, ask_rubrik, ask_content, ask_date) VALUES (" . $db->nextID(SQLPREFIX . "faqfragen", "id") . ", '" . $db->escape_string($username) . "', '" . $db->escape_string($usermail) . "', " . $selected_category . ", '" . $db->escape_string($content) . "', '" . $datum . "')");
Ejemplo n.º 6
0
 $post = X::request()->post(['title' => '', 'content' => '', 'access_token' => '', 'client_ip' => '', 'if_spam' => 0, 'if_duplicate_deny' => 0, 'if_spate_deny' => 0, 'test' => 0]);
 if (!$post->access_token || !$post->content) {
     apiOutput(NO, "incomplete request");
 }
 if (!($company = X::module('company')->exists($post->access_token))) {
     apiOutput(NO, "company does not exist");
 }
 //临时关闭
 if ($company['closed']) {
     apiOutput(NO, "service temporarily unavailable");
 }
 //统计请求量
 X::module('company')->statisticsRequest($company['company_id']);
 $now = time();
 require 'function/post.php';
 list($tutu, $process_time) = searchEngine(['content' => $post->title . $post->content, 'if_spam' => $post->if_spam], true);
 if (!$tutu) {
     apiOutput(NO, "search service is not available");
 }
 $tutu = toArray($tutu);
 require "function/cook.php";
 $from_address = ipToAddress($post->client_ip);
 $tutu['title'] = $post->title;
 $tutu['content'] = $post->content;
 $tutu['posts_time'] = $now;
 $tutu['company_username'] = $company['company_name'];
 $tutu['company_id'] = $company['company_id'];
 $tutu['ip_city'] = $from_address;
 $tutu['process_time'] = $process_time;
 $tutu['ip'] = $post->client_ip;
 //请求日志