function gen_vthread_url($forum, $forum_title, $topic, $topic_title, $page) { if (isset($GLOBALS['mod_rewrite']) and $GLOBALS['mod_rewrite']) { return addTopicURLPage(genTopicURL($GLOBALS['main_url'], $forum, $forum_title, $topic, $topic_title), $page); } else { return addGenURLPage($GLOBALS['main_url'] . '/' . $GLOBALS['indexphp'] . 'action=vthread&forum=' . $forum . '&topic=' . $topic, $page); } }
$anchor = '#msg' . $goPost; if ($row = db_simpleSelect(0, $Tp, 'count(*)', 'post_id', '<=', $goPost, '', '', 'topic_id', '=', $topic)) { $totalPosts = $row[0]; } else { $totalPosts = 0; } $page = getPage($topic, $totalPosts); if (isset($metaLocation)) { $meta_relocate = "{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}&page={$page}{$anchor}"; echo ParseTpl(makeUp($metaLocation)); exit; } else { if (isset($mod_rewrite) and $mod_rewrite) { $furl = addTopicURLPage(genTopicURL($main_url, $forum, '#GET#', $topic, '#GET#'), $page) . $anchor; } else { $furl = addGenURLPage("{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}", $page, '&') . $anchor; } } header("Refresh: 0; url={$furl}"); exit; } require $pathToFiles . 'bb_func_vthread.php'; } elseif ($action == 'vtopic') { if (isset($redthread) and is_array($redthread) and isset($redthread[$forum])) { if (isset($metaLocation)) { $meta_relocate = "{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$redthread[$forum]}"; echo ParseTpl(makeUp($metaLocation)); exit; } else { if (isset($mod_rewrite) and $mod_rewrite) { $furl = addTopicURLPage(genTopicURL($main_url, $forum, '#GET#', $redthread[$forum], '#GET#'), PAGE1_OFFSET + 1);
} $forumName = $forumsArray[$forum][0]; $forumIcon = $forumsArray[$forum][1]; $forum_desc = $forumsArray[$forum][2]; $description = substr(strip_tags($forum_desc), 0, 400); if ($user_sort == '') { $user_sort = $sortingTopics; } /* Sort messages default by last answer (0) desc OR 1 - by last new topics */ /* Redirect to the proper URL if needed */ if (!isset($_GET['showSep']) || $_GET['showSep'] == 2 and $user_sort == 0 and !isset($_GET['sortBy'])) { $requestUrl = parseRequestForumURL($main_url); if (isset($mod_rewrite) and $mod_rewrite) { $origUrl = addForumURLPage(genForumURL($main_url, $forum, $forumName), $page); } else { $origUrl = addGenURLPage("{$main_url}/{$indexphp}action=vtopic&forum={$forum}", $page, '&'); } if ($requestUrl != $origUrl) { header("HTTP/1.1 301 Moved Permanently"); if (isset($metaLocation)) { $meta_relocate = "{$origUrl}"; echo ParseTpl(makeUp($metaLocation)); exit; } else { header("Location: {$origUrl}"); exit; } } } /* --Redirect... */ $warn = '';
} $title .= $l_topicMoved; $errorMSG = $l_topicMoved; if (isset($mod_rewrite) and $mod_rewrite) { $urlp = addTopicURLPage(genTopicURL($main_url, $forum_id, $rowf[1], $topic, $rt[0]), PAGE1_OFFSET + 1); } else { $urlp = "{$main_url}/{$indexphp}action=vthread&forum={$forum_id}&topic={$topic}"; } $correctErr = "<a href=\"{$urlp}\">{$l_goTopic}</a>"; echo load_header(); echo ParseTpl(makeUp('main_warning')); return; } else { $title = $l_itseemserror; $errorMSG = $l_itseemserror; $correctErr = "<a href=\"" . addGenURLPage("{$main_url}/{$indexphp}action=vthread&topic={$topic}&forum={$forum}", $page) . "\">{$l_back}</a>"; echo load_header(); echo ParseTpl(makeUp('main_warning')); return; } } else { $title = $l_forbidden; $errorMSG = $l_forbidden; $correctErr = $backErrorLink; echo load_header(); echo ParseTpl(makeUp('main_warning')); return; } } else { $title .= $l_moveTopic; $frm = $forum;
if ($fif != 0) { $errorMSG .= $l_topicTextUpdated . "<br />"; } $title .= $l_editPost; if (isset($mod_rewrite) and $mod_rewrite) { if (isset($topic_title)) { $tt = $topic_title; } else { $tt = '#GET#'; } $furl = $furlCl = addTopicURLPage(genTopicURL($main_url, $forum, '#GET#', $topic, $tt), $page) . "#msg{$anchor}"; $topicsLink = "<a href=\"" . addTopicURLPage(genForumURL($main_url, $forum, '#GET#'), PAGE1_OFFSET + 1) . "\">{$l_returntotopics}</a><br />"; } else { $furl = addGenURLPage("{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}", $page) . "#msg{$anchor}"; $furlCl = addGenURLPage("{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}", $page, '&') . "#msg{$anchor}"; $topicsLink = "<a href=\"" . addGenURLPage("{$main_url}/{$indexphp}action=vtopic&forum={$forum}", PAGE1_OFFSET + 1) . "\">{$l_returntotopics}</a><br />"; } $correctErr = "<a href=\"{$furl}\">{$l_back}</a>"; } if (isset($editMsgReloc)) { header("Refresh: 0; url={$furlCl}"); exit; } else { echo load_header(); echo ParseTpl(makeUp('main_warning')); return; } } else { //default edit require $pathToFiles . 'bb_codes.php'; $postText = deCodeBB($row[0]);