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); } }
} else { require $pathToFiles . 'bb_func_vtopic.php'; } } elseif ($action == 'ptopic') { $page = PAGE1_OFFSET + 1; if (file_exists($pathToFiles . 'bb_plugins2.php')) { require_once $pathToFiles . 'bb_plugins2.php'; } if (!isset($errorMSG)) { if (isset($metaLocation)) { $meta_relocate = "{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}"; echo ParseTpl(makeUp($metaLocation)); exit; } else { if (isset($mod_rewrite) and $mod_rewrite) { $furl = addTopicURLPage(genTopicURL($main_url, $forum, '#GET#', $topic, '#GET#'), PAGE1_OFFSET + 1); } else { $furl = "{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}"; } header("Refresh: 0; url={$furl}"); exit; } } } elseif ($action == 'search') { if ($reqTxt != 1) { require $pathToFiles . 'bb_func_txt.php'; } require $pathToFiles . 'bb_func_search.php'; } elseif ($action == 'deltopic') { require $pathToFiles . 'bb_func_deltopic.php'; } elseif ($action == 'locktopic') {
if (isset($mod_rewrite) and $mod_rewrite) { $urlp = genTopicURL($main_url, $forum, $fTitle[$forum], $topic, $topic_title); $urlForum = addForumURLPage(genForumURL($main_url, $forum, $fTitle[$forum]), PAGE1_OFFSET + 1); $urlType = 'Topic'; } else { $urlp = "{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}"; $urlForum = "{$main_url}/{$indexphp}action=vtopic&forum={$forum}"; $urlType = 'Gen'; } $pageNavCell = pageNav(PAGE1_OFFSET + 1, $numReplies + 1, $urlp, $viewmaxreplys, TRUE, $urlType); $whenPosted = convert_date($cols[4]); if (trim($cols[1]) == '') { $cols[1] = $l_emptyTopic; } //Forum icon if (isset($fIcon[$forum])) { $forumIcon = $fIcon[$forum]; } else { $forumIcon = 'default.gif'; } if (isset($mod_rewrite) and $mod_rewrite) { $linkToTopic = addTopicURLPage(genTopicURL($main_url, $forum, $fTitle[$forum], $topic, $topic_title), PAGE1_OFFSET + 1); } else { $linkToTopic = "{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}"; } if (function_exists('parseTopic')) { parseTopic(); } $list_topics .= ParseTpl($tpl); $i = -$i; }
if ($closedForums != 'n') { $xtr = getClForums($closedForums, 'AND', '', 'forum_id', 'AND', '!='); } else { $xtr = ''; } $topicAll = array(); if ($lastT = db_simpleSelect(0, $Tt, 'topic_id, forum_id, topic_title', 'topic_poster', '=', $user, 'topic_id desc', $viewmaxtopic)) { $what = $l_userLastTopics; $whatValue = '<ul class="limbb">'; do { $topicAll[] = $lastT[0]; if (isset($preModerationType) and $preModerationType > 0 and isset($premodTopics) and in_array($lastT[0], $premodTopics)) { $lastT[2] = $l_topicQueued; } if (isset($mod_rewrite) and $mod_rewrite) { $urlp = addTopicURLPage(genTopicURL($main_url, $lastT[1], $forumNames[$lastT[1]], $lastT[0], $lastT[2]), PAGE1_OFFSET + 1); } else { $urlp = "{$main_url}/{$indexphp}action=vthread&forum={$lastT[1]}&topic={$lastT[0]}"; } $whatValue .= "<li><a href=\"{$urlp}\"{$nof}>{$lastT[2]}</a></li>"; } while ($lastT = db_simpleSelect(1)); $whatValue .= '</ul>'; $USERINFO .= ParseTpl($usrCell); } } /* Latest posts */ if (!defined('NOT_SHOW_LATEST_REPLIES')) { if (sizeof($topicAll) > 0) { $xtr2 = getClForums($topicAll, 'AND', '', 'topic_id', 'AND', '!='); $xtr = $xtr . ' ' . $xtr2; }
out; } } } elseif ($where == 1) { /* Simply search by topic titles. 1 request */ if ($row = db_searchSelect(0, $Tt, 'topic_id, forum_id, topic_title, topic_time', $sqlStr, $makeLim, 'topic_id desc')) { $num = 1 + $page * $viewmaxsearch - (PAGE1_OFFSET + 1) * $viewmaxsearch; do { $txt = highlightText($row[2], $phrase, $searchType); $datetime = convert_date($row[3]); $forum_name = isset($forums[$row[1]]) ? $forums[$row[1]] : 'N/A'; if (isset($preModerationType) and $preModerationType > 0 and isset($premodTopics) and in_array($row[0], $premodTopics)) { $txt = $l_topicQueued; } if (isset($mod_rewrite) and $mod_rewrite) { $furl = addTopicURLPage(genTopicURL($main_url, $row[1], $forum_name, $row[0], $row[2]), PAGE1_OFFSET + 1); } else { $furl = "{$main_url}/{$indexphp}action=vthread&forum={$row[1]}&topic={$row[0]}"; } $searchResults .= <<<out <table class="tbTransparent" style="width:100%"><tr><td class="tbTransparentCell">{$num}. <span class="txtSm"><strong>{$l_posted}</strong>: {$datetime} - <strong>{$forum_name}</strong></span> / <a href="{$furl}">{$txt}</a> </td></tr></table><br /> out; $num++; } while ($row = db_searchSelect(1)); } } //where topics } //numRows>0 } else {
$topic_last_poster = $pp[2]; updateArray(array('topic_last_post_id', 'topic_last_post_time', 'topic_last_poster'), $Tt, 'topic_id', $topic); db_calcAmount($Tp, 'forum_id', $forum, $Tf, 'posts_count'); db_calcAmount($Tp, 'topic_id', $topic, $Tt, 'posts_count'); if (defined('DELETE_PREMOD')) { return; } //CSRF cookie delete setcookie($cookiename . 'csrf', '', time() - 2592000, $cookiepath, $cookiedomain, $cookiesecure); if (isset($metaLocation)) { $meta_relocate = "{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}&page={$page}"; echo ParseTpl(makeUp($metaLocation)); exit; } else { if (isset($mod_rewrite) and $mod_rewrite) { $urlp = addTopicURLPage(genTopicURL($main_url, $forum, '#GET#', $topic, $topicData[0]), $page); } else { $urlp = "{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}&page={$page}"; } header("Location: {$urlp}"); exit; } } else { //it would mean we have deleted all messages and there is no topic left define('DELETE_PREMOD', 1); include $pathToFiles . 'bb_func_deltopic.php'; $errorMSG = $l_completed; $correctErr = $backErrorLink; } } else { $errorMSG = $l_forbidden;
} else { $user_pwd = ''; } $queryStr = rawurldecode($queryStr); if (strstr($queryStr, 'vtopic')) { $queryStr .= '#newtopic'; } elseif (strstr($queryStr, 'vthread')) { $queryStr .= '#newreply'; } if ($action == 'pthread' and isset($_POST['postText']) and $_POST['postText'] == '' or $action == 'ptopic' and isset($_POST['postText']) and $_POST['postText'] == '') { $action = ''; } /* */ $urlp = "{$indexphp}{$queryStr}"; if (isset($mod_rewrite) and $mod_rewrite) { $urlp = preg_replace("@" . str_replace('?', '\\?', $indexphp) . "action=vthread&forum=([0-9]+)&topic=([0-9]+)&page=([-0-9]+)&mdrw=on(#newreply)?@", addTopicURLPage(genTopicURL($main_url, "\\1", '#GET#', "\\2", '#GET#'), "\\3") . "\\4", $urlp); $urlp = preg_replace("@" . str_replace('?', '\\?', $indexphp) . "action=vtopic&forum=([0-9]+)&page=([-0-9]+)&mdrw=on(#newtopic)?@", addForumURLPage(genForumURL($main_url, "\\1", '#GET#'), "\\2") . "\\3", $urlp); $urlp = preg_replace("@" . str_replace('?', '\\?', $indexphp) . "mdrw=on@", $main_url . '/' . $startIndex, $urlp); } if ($urlp == $indexphp) { $urlp = $main_url . '/' . $startIndex; } /* */ if (strlen($admin_pwd) == 32) { $user_pwd_cmp = writeUserPwd($user_pwd); } else { $user_pwd_cmp = $user_pwd; } if ($user_usr == $admin_usr or isset($loginsCase) and $loginsCase and strtolower($user_usr) == strtolower($admin_usr)) { if ($user_pwd_cmp == $admin_pwd) { $logged_admin = 1;
exit; } } $topicDesc = 0; $topic_reverse = ''; if (isset($themeDesc) and in_array($topic, $themeDesc)) { $topicDesc = 1; $topic_reverse = "<img src=\"{$main_url}/img/topic_reverse.gif\" align=\"middle\" border=\"0\" alt=\"\" /> "; } if ($page == -1 and $topicDesc == 0) { $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;
if ($u1 > 0 and $u2 > 0) { /* If moving to closed forum, remove all forbidden subscribers */ if (in_array($forum_id, $clForums)) { if ($row = db_simpleSelect(0, $Ts, 'user_id', 'topic_id', '=', $topic)) { $delstr = '('; do { if (!isset($clForumsUsers[$forum_id]) or isset($clForumsUsers[$forum_id]) and !in_array($row[0], $clForumsUsers[$forum_id])) { db_delete($Ts, 'user_id', '=', $row[0], 'topic_id', '=', $topic); } } while ($row = db_simpleSelect(1)); } } $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; }
$pageNavCell = pageNav(PAGE1_OFFSET + 1, $numReplies + 1, $urlp, $viewmaxreplys, TRUE, $urlType); if ($cols[7] == 1 and $cols[5] == 1) { $tpcIcon = 'stlock'; } elseif ($cols[7] == 1) { $tpcIcon = 'sticky'; } elseif ($cols[5] == 1) { $tpcIcon = 'locked'; } elseif ($numReplies <= 0) { $tpcIcon = 'empty'; } elseif ($numReplies >= $viewmaxreplys) { $tpcIcon = 'hot'; } else { $tpcIcon = 'default'; } if (isset($mod_rewrite) and $mod_rewrite) { $linkToTopic = addTopicURLPage(genTopicURL($main_url, $forum, $forumName, $topic, $topicTitle), PAGE1_OFFSET + 1); } else { $linkToTopic = "{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}"; } if (function_exists('parseTopic')) { parseTopic(); } $list_topics .= ParseTpl($tpl); $i = -$i; } } //request ok $newTopicLink = '<a href="' . $main_url . '/' . $indexphp . 'action=vtopic&forum=' . $forum . '&showSep=1">' . $l_new_topic . '</a>'; } //if not showsep $l_messageABC = $l_message;
} } else { $post_status = 1; } $fif = updateArray(array('post_text', 'post_status'), $Tp, 'post_id', $post); 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;