function searchstring_to_array($text) { //Codes entfernen $text = clear_codes($text); //Wörter trennen $words = extract_words($text); $words = array_unique($words); //Stopwörter löschen include 'lib/stopwords.php'; $filteredwords = array_diff($words, $stopwords); $ignored = array_intersect($words, $stopwords); //Wörter filtern foreach ($filteredwords as $key => $word) { $word = trim($word); if (!$word || strlen($word) < 3 || strlen($word) > 50) { if ($word) { $ignored[] = $word; } unset($filteredwords[$key]); } } $filteredwords = array_map('strtolower', $filteredwords); //Kleinschreibung für Suchbegriffe return array(array_unique($filteredwords), array_unique($ignored)); }
list($count) = $db->first("SELECT count(postid) FROM " . PRE . "_forum_posts WHERE ( del=0 AND threadid='" . $threadinfo['threadid'] . "' )"); $pages = ceil($count / ($user->info['forum_ppp'] * 2)); if ($_REQUEST['p'] < 1) { $_REQUEST['p'] = 1; } if ($_REQUEST['p'] > $pages) { $_REQUEST['p'] = $pages; } //Beiträge auflisten $inlist = array(); $data = $db->fetch("SELECT postid,username,text,time FROM " . PRE . "_forum_posts WHERE ( del=0 AND threadid='" . $threadinfo['threadid'] . "' ) ORDER BY time DESC LIMIT " . $user->info['forum_ppp'] * 2 * ($_REQUEST['p'] - 1) . ',' . $user->info['forum_ppp'] * 2); if (count($data)) { foreach ($data as $res) { ++$i; //Text $text = clear_codes($res['text']); $text = replace($text, 1); $postdata[$i]['ID'] = $res['postid']; $postdata[$i]['USERNAME'] = replace($res['username']); $postdata[$i]['TEXT'] = $text; $postdata[$i]['TIME'] = $res['time']; $postdata[$i]['SELECTED'] = iif(in_array($res['postid'], $_POST['post']), 1, 0); $inlist[] = $res['postid']; } } //Alle IDs, die nicht aufgelistet wurden $notinlist = array_diff($_POST['post'], $inlist); foreach ($notinlist as $id) { $seldata[]['ID'] = $id; } $apx->tmpl->assign('FORUM', $forumdata);
$foruminfo[$res['forumid']] = $res; $foruminfo[$res['forumid']]['link'] = mkrellink('forum.php?id=' . $res['forumid'], 'forum,' . $res['forumid'] . ',1' . urlformat($res['title']) . '.html'); } } //Beiträge auflisten if (count($data)) { foreach ($data as $res) { ++$i; $thisthread = $threadinfo[$res['threadid']]; $thisforumid = $threadinfo[$res['threadid']]['forumid']; //Lastvisit bestimmen $lastview = max(array($user->info['forum_lastonline'], thread_readtime($thisthread), forum_readtime($thisforumid))); //Text + Titel $title = replace($res['title']); $text = $res['text']; $text = clear_codes($text); $text = replace($text, 1); //Highlight if ($_REQUEST['highlight']) { $title = text_highlight($title); $text = text_highlight($text); } $postdata[$i]['ID'] = $res['postid']; $postdata[$i]['TITLE'] = $title; $postdata[$i]['TEXT'] = $text; $postdata[$i]['TIME'] = $res['time']; $postdata[$i]['USERNAME'] = replace($res['username']); $postdata[$i]['USERID'] = $res['userid']; $postdata[$i]['NEW'] = iif($res['time'] > $lastview, 1, 0); //Thread $postdata[$i]['THREAD_ID'] = $res['threadid'];