$page = pageChk($page, $numRows, $viewmaxreplys); } elseif ($page == -1 and $topicDesc == 1) { $page = PAGE1_OFFSET + 1; } if (isset($mod_rewrite) and $mod_rewrite) { $urlp = genTopicURL($main_url, $forum, $forumName, $topic, $topicData[0]); $urlType = 'Topic'; } else { $urlp = "{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}"; $urlType = 'Gen'; } $pageNav = pageNav($page, $numRows, $urlp, $viewmaxreplys, FALSE, $urlType); if ($pageNav != '') { $mbpn = 'mb'; } $makeLim = makeLim($page, $numRows, $viewmaxreplys); $anchor = 1; if ($page == PAGE1_OFFSET + 1) { $anchor2 = 1; } else { $anchor2 = ($page - PAGE1_OFFSET - 1) * $viewmaxreplys + 1; } $i = 1; $ii = 0; if (isset($themeDesc) and in_array($topic, $themeDesc)) { $srt = 'DESC'; } else { $srt = 'ASC'; } /* User info in posts */ if (isset($GLOBALS['userInfoInPosts']) and is_array($GLOBALS['userInfoInPosts'])) {
if ($row = db_searchSelect(0, $table, 'count(*)', $sqlStr)) { $numRows = $row[0]; } else { $numRows = 0; } if ($numRows == 0) { $warning = '<span class="warning">' . $l_searchFailed . '</span>'; } else { $warning = $l_recordsFound . ' ' . $numRows; /* Finally! We get all topics/messages list */ $phrase1 = urlencode($phrase); if ($phrase1 != '') { $navUrl .= "&phrase={$phrase1}"; } $pageNav = pageNav($page, $numRows, "{$main_url}/{$indexphp}action=search{$navUrl}&searchGo=1", $viewmaxsearch, FALSE, 'Gen'); $makeLim = makeLim($page, $numRows, $viewmaxsearch); $searchResults = ''; if ($where == 0) { /* If we search by messages, first select the messages, then their topic titles. 2 requests */ $searchTopics = array(); $searchData = array(); $i = 0; if ($row = db_searchSelect(0, $Tp, 'post_id, forum_id, topic_id, post_time, post_text', $sqlStr, $makeLim, 'post_id desc')) { do { if (!in_array($row[2], $searchTopics)) { $searchTopics[] = $row[2]; } $txt = highlightText($row[4], $phrase, $searchType); $searchData[$i] = array('post_id' => $row[0], 'forum_id' => $row[1], 'forum_name' => isset($forums[$row[1]]) ? $forums[$row[1]] : 'N/A', 'topic_id' => $row[2], 'datetime' => $row[3], 'text' => $txt); $i++; } while ($row = db_searchSelect(1));
} header("HTTP/1.1 301 Moved Permanently"); if (isset($metaLocation)) { $meta_relocate = "{$urlp}"; echo ParseTpl(makeUp($metaLocation)); exit; } else { header("Location: {$urlp}"); exit; } } $pageNav = pageNav($page, $numRows, $urlp, $viewmaxtopic, FALSE, $urlType); if ($pageNav != '') { $mbpn = 'mb'; } $makeLim = makeLim($page, $numRows, $viewmaxtopic); if (isset($customTopicSort) and is_array($customTopicSort) and isset($customTopicSort[$forum])) { $defaultSorting = "<br /><a href=\"{$main_url}/{$indexphp}action=vtopic&forum={$forum}&sortBy=2\">{$l_sortBy} {$customTopicSort[$forum][1]}</a>"; } if ((!isset($_GET['sortBy']) or $sortBy == 2) and isset($customTopicSort) and is_array($customTopicSort) and isset($customTopicSort[$forum])) { $orderBy = $customTopicSort[$forum][0]; $sortedByT = $customTopicSort[$forum][1]; $defaultSorting = ''; } elseif ($user_sort == 1) { $orderBy = 'sticky DESC,topic_id DESC'; } else { $orderBy = 'sticky DESC,topic_last_post_id DESC'; } $colls = array(); if ($cols = db_simpleSelect(0, $Tt, 'topic_id, topic_title, topic_poster, topic_poster_name, topic_time, topic_status, posts_count, sticky, topic_views, topic_last_post_id, topic_last_post_time, topic_last_poster', 'forum_id', '=', $forum, $orderBy, $makeLim)) { do {