//inserted post successfully } else { $errorMSG = $l_antiSpam; $correctErr = $backErrorLink; $title .= $l_antiSpam; echo load_header(); echo ParseTpl(makeUp('main_warning')); return; } } else { $errorMSG = $l_forbidden; $correctErr = $backErrorLink; $title .= $l_forbidden; echo load_header(); echo ParseTpl(makeUp('main_warning')); return; } if (isset($themeDesc) and in_array($topic, $themeDesc)) { $anchor = 1; } else { $totalPosts = db_simpleSelect(0, $Tt, 'posts_count', 'topic_id', '=', $topic); $vmax = $viewmaxreplys; $anchor = $totalPosts[0]; if ($anchor > $vmax) { $anchor = $totalPosts[0] - floor($totalPosts[0] / $vmax) * $vmax; if ($anchor == 0) { $anchor = $vmax; } } } }
function user_logged_in() { if (isset($GLOBALS['cook']) and trim($GLOBALS['cook']) != '') { $c = explode('|', $GLOBALS['cook']); } elseif (isset($_SESSION['minimalistBBSession'])) { $c = explode('|', $_SESSION['minimalistBBSession']); } else { $c = getMyCookie(); } $username = $c[0]; $userpassword = $c[1]; $exptime = $c[2]; $returned = FALSE; $resetCookie = FALSE; if ($username == '') { $returned = FALSE; return; } $GLOBALS['user_usr'] = $username; $pasttime = $exptime - time(); if ($username == $GLOBALS['admin_usr'] and $userpassword == md5($GLOBALS['admin_pwd'])) { $returned = TRUE; $GLOBALS['logged_user'] = 0; $GLOBALS['logged_admin'] = 1; $GLOBALS['user_id'] = 1; if ($row = db_simpleSelect(0, $GLOBALS['Tu'], $GLOBALS['dbUserSheme']['user_sorttopics'][1] . ',' . $GLOBALS['dbUserSheme']['language'][1], $GLOBALS['dbUserId'], '=', 1)) { $GLOBALS['user_sort'] = $row[0]; } $GLOBALS['langu'] = $row[1]; if ($pasttime <= $GLOBALS['cookie_renew']) { // if expiration time of cookie is less than defined in setup, we redefine it below $resetCookie = TRUE; } } elseif ($userpassword != '' and $row = db_simpleSelect(0, $GLOBALS['Tu'], $GLOBALS['dbUserId'] . ',' . $GLOBALS['dbUserSheme']['user_sorttopics'][1] . ',' . $GLOBALS['dbUserSheme']['language'][1] . ',' . $GLOBALS['dbUserAct'], $GLOBALS['dbUserId'], '=', $GLOBALS['USER']->user_id, '', 1)) { $returned = TRUE; $GLOBALS['user_id'] = $row[0]; $GLOBALS['user_sort'] = $row[1]; $GLOBALS['logged_user'] = 1; $GLOBALS['logged_admin'] = 0; $GLOBALS['langu'] = $row[2]; $GLOBALS['user_activity'] = $row[3]; //modify based on geograph user status global $USER; if ($USER->hasPerm('admin')) { $GLOBALS['logged_user'] = 0; $GLOBALS['logged_admin'] = 1; } if ($pasttime <= $GLOBALS['cookie_renew']) { $resetCookie = TRUE; } } else { $returned = FALSE; if ($pasttime <= $GLOBALS['cookie_renew']) { $userpassword = ''; $resetCookie = TRUE; } } if ($resetCookie) { deleteMyCookie(); setMyCookie($username, $userpassword, $GLOBALS['cookieexptime']); } return $returned; }
$ordb = 'topic_id'; $ordSql = 'ASC'; } $xtr = getClForums($lPosts, 'where', '', $ordb, 'or', '='); } else { $xtr = ''; } if ($xtr != '') { if ($row = db_simpleSelect(0, $Tp, 'poster_id, poster_name, post_time, topic_id, post_text, post_id', '', '', '', 'post_id ' . $ordSql)) { do { if (!isset($pVals[$row[3]])) { $pVals[$row[3]] = array($row[0], $row[1], $row[2], $row[4], $row[5]); } else { continue; } } while ($row = db_simpleSelect(1)); } } } $list_topics = ''; unset($result); $i = 1; if (!isset($startPageModern) or !$startPageModern) { $tpl = makeUp('main_last_discuss_cell'); } else { $tpl = makeUp('main_modern_lcell'); } foreach ($colls as $cols) { $forum = $cols[5]; $numReplies = $cols[6]; if ($numReplies >= 1) {
<?php /* This file is part of miniBB. miniBB is free discussion forums/message board software, without any warranty. See COPYING file for more details. Copyright (C) 2004 Paul Puzyrev, Sergei Larionov. www.minibb.net */ if (!defined('INCLUDED776')) { die('Fatal error.'); } if ($logged_admin == 1 or $isMod == 1) { if ($res = db_simpleSelect(0, $Tt, 'topic_id', 'topic_id', '>', $topic, '', '', 'forum_id', '=', $forum)) { $h = $res[0]; } else { $h = 0; } if ($h == 0) { $return = 0; } else { $numRows = $countRes; $rP = $numRows / $viewmaxtopic; $rPInt = floor($numRows / $viewmaxtopic); $return = $rPInt; if ($rP == $rPInt) { $return -= 1; } } db_delete($Ts, 'topic_id', '=', $topic); $topicsDel = db_delete($Tt, 'topic_id', '=', $topic, 'forum_id', '=', $forum); $postsDel = db_delete($Tp, 'topic_id', '=', $topic, 'forum_id', '=', $forum); $postsDel--; db_forumReplies($forum, $Tp, $Tf); db_forumTopics($forum, $Tt, $Tf);
$post += 0; if (!isset($poster_id)) { $rww = db_simpleSelect(0, $Tp, 'poster_id', 'post_id', '=', $post); $poster_id = $rww[0]; } db_delete($Tp, 'post_id', '=', $post); if ($poster_id != 0) { db_calcAmount($Tp, 'poster_id', $poster_id, $Tu, $dbUserSheme['num_posts'][1], $dbUserId); } //} if (file_exists($pathToFiles . 'bb_plugins2.php')) { require $pathToFiles . 'bb_plugins2.php'; } } // deletion cycle if ($pp = db_simpleSelect(0, $Tp, 'post_id, post_time, poster_name', 'topic_id', '=', $topic, 'post_id DESC', 1)) { $topic_last_post_id = $pp[0]; $topic_last_post_time = $pp[1]; $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;
$login = $user_usr; } $userTitle = $l_newUserRegister; switch ($step) { case 1: if (isset($closeRegister) and $closeRegister == 1) { $_POST['passwd'] = substr(ereg_replace("[^0-9A-Za-z]", "A", md5(uniqid(rand()))), 0, 8); $_POST['passwd2'] = $_POST['passwd']; } require $pathToFiles . 'bb_func_usrdat.php'; if ($DB == 'mysql' or $DB == 'pgsql') { $case = 'lower'; } elseif ($DB == 'mssql') { $case = 'lcase'; } if (db_simpleSelect(0, $Tu, $dbUserId, $dbUserId, '=', 1) and !db_simpleSelect(0, $Tu, $dbUserId, $case . "({$dbUserSheme['username'][1]})", '=', strtolower(${$dbUserSheme['username'][1]})) and !db_simpleSelect(0, $Tu, $dbUserId, $dbUserSheme['user_email'][1], '=', ${$dbUserSheme['user_email'][1]}) and ${$dbUserSheme['username'][1]} != $admin_usr and ${$dbUserSheme['user_email'][1]} != $admin_email) { $act = 'reg'; require $pathToFiles . 'bb_func_checkusr.php'; if ($correct == 0) { ${$dbUserDate} = 'now()'; ${$dbUserSheme['user_password'][1]} = md5(${$dbUserSheme['user_password'][1]}); if (isset($registerInactiveUsers) and $registerInactiveUsers) { ${$dbUserAct} = 0; } else { ${$dbUserAct} = 1; } $ins = insertArray(array($dbUserSheme['username'][1], $dbUserDate, $dbUserSheme['user_password'][1], $dbUserSheme['user_email'][1], $dbUserSheme['user_icq'][1], $dbUserSheme['user_website'][1], $dbUserSheme['user_occ'][1], $dbUserSheme['user_from'][1], $dbUserSheme['user_interest'][1], $dbUserSheme['user_viewemail'][1], $dbUserSheme['user_sorttopics'][1], $dbUserSheme['language'][1], $dbUserAct, $dbUserSheme['user_custom1'][1], $dbUserSheme['user_custom2'][1], $dbUserSheme['user_custom3'][1]), $Tu); if ($ins == 0) { if (($emailusers == 1 or isset($closeRegister) and $closeRegister == 1) and $genEmailDisable != 1) { $emailMsg = ParseTpl(makeUp('email_user_register')); $sub = explode('SUBJECT>>', $emailMsg);
die('Fatal error.'); } if (!isset($genEmailDisable) or $genEmailDisable != 1) { $newPasswd = ''; $confirmCode = ''; $email = isset($_POST['email']) ? htmlspecialchars(trim($_POST['email']), ENT_QUOTES) : ''; if ($email == $admin_email) { $email = ''; } if ($step != 1) { $title .= $l_sub_pass; echo load_header(); echo ParseTpl(makeUp('tools_send_password')); return; } else { if (!($updId = db_simpleSelect(0, $Tu, "{$dbUserId},{$dbUserSheme['language'][1]},{$dbUserSheme['username'][1]}", $dbUserSheme['user_email'][1], '=', $email))) { $title .= $l_emailNotExists; $errorMSG = $l_emailNotExists; $correctErr = $backErrorLink; echo load_header(); echo ParseTpl(makeUp('main_warning')); return; } else { $ulang = $updId[1]; $loginName = $updId[2]; ${$dbUserNp} = substr(ereg_replace("[^0-9A-Za-z]", "A", writeUserPwd(uniqid(rand()))), 0, 8); $newPasswd = ${$dbUserNp}; ${$dbUserNk} = substr(md5(uniqid(rand())), 0, 32); $confirmCode = ${$dbUserNk}; $updArr = array($dbUserNp, $dbUserNk); $fs = updateArray($updArr, $Tu, $dbUserId, $updId[0]);
function db_searchDeSlice($lsTopics, $id) { /* Search page/anchor reconstruction */ if (isset($GLOBALS['xtr'])) { $xtrT = $GLOBALS['xtr']; $GLOBALS['xtr'] = ''; } else { $xtrT = ''; } if ($lsTopics) { $GLOBALS['user_sort'] += 0; if ($GLOBALS['user_sort'] == 1) { $i = db_simpleSelect(2, $GLOBALS['Tt'], 'count(*)', 'forum_id', '=', $GLOBALS['forum'], '', '', 'topic_id', '<=', $id); } else { $GLOBALS['xtr'] = 'AND ' . $GLOBALS['Tt'] . '.forum_id=' . $GLOBALS['forum'] . ' AND ' . $GLOBALS['Tt'] . '.topic_last_post_id>' . db_simpleSelect(2, $GLOBALS['Tt'], 'topic_last_post_id', 'topic_id', '=', $id); $i = db_simpleSelect(2, $GLOBALS['Tt'] . ',' . $GLOBALS['Tp'], 'count(*)', $GLOBALS['Tt'] . '.topic_last_post_id', '=', $GLOBALS['Tp'] . '.post_id'); } $GLOBALS['xtr'] = $xtrT; return intval(($i - 1) / $GLOBALS['viewmaxtopic']); } else { $sign = isset($GLOBALS['themeDesc']) && in_array($GLOBALS['topic'], $GLOBALS['themeDesc']) ? '>=' : '<='; $i = db_simpleSelect(2, $GLOBALS['Tp'], 'count(*)', 'topic_id', '=', $GLOBALS['topic'], '', '', 'post_id', $sign, $id); $vmax = $GLOBALS['forum'] == $CONF['forum_submittedarticles'] || $GLOBALS['forum'] == $CONF['forum_gallery'] ? 10 : $GLOBALS['viewmaxreplys']; $pageAnchor[0] = intval(($i - 1) / $vmax); $a = $i - intval($i / $vmax) * $vmax; if ($i > 0 && $a == 0) { $a = $vmax; } $pageAnchor[1] = '#' . $a; $GLOBALS['xtr'] = $xtrT; return $pageAnchor; } }
if ($step != 1 and $step != 0) { $step = 0; } if ($row[3] == 1 and !($user_id == 1 or $isMod == 1)) { $whoEdited = 2; } if (($whoEdited == 2 or $whoEdited == 3) and !($logged_admin == 1 or $isMod == 1)) { $errorMSG = $l_onlyAdminCanEdit; $correctErr = $backErrorLink; $title .= $l_onlyAdminCanEdit; echo load_header(); echo ParseTpl(makeUp('main_warning')); return; } else { /*First post?*/ if ($frt = db_simpleSelect(0, $Tp, 'post_id', 'topic_id', '=', $topic, 'post_id', 1) and $frt[0] == $post and ($logged_admin == 1 or $isMod == 1 or isset($usersEditTopicTitle) and $usersEditTopicTitle)) { $first = TRUE; } else { $first = FALSE; } if ($step == 1) { $errorMSG = ''; if (!isset($_POST['disbbcode']) or isset($_POST['disbbcode']) and $_POST['disbbcode'] == '') { $disbbcode = FALSE; } else { $disbbcode = TRUE; } $post_text = textFilter($_POST['postText'], $post_text_maxlength, $post_word_maxlength, 1, $disbbcode, 1, $logged_admin); $compareTL = strlen(trim(strip_tags($post_text))); $sce = FALSE; if (isset($simpleCodes)) {
Latest File Update: 2006-May-02 */ if (!defined('INCLUDED776')) { die('Fatal error.'); } $confirmCode = isset($_GET['confirmCode']) ? htmlspecialchars($_GET['confirmCode'], ENT_QUOTES) : ''; $confEmail = FALSE; if (substr($confirmCode, 0, 5) == 'email') { $confirmCode = substr($confirmCode, 5, strlen($confirmCode) - 1); $confEmail = TRUE; } if ($confirmCode == '') { $title .= $l_forbidden; $errorMSG = $l_forbidden; $correctErr = ''; } elseif ($curr = db_simpleSelect(0, $Tu, $dbUserNp, $dbUserNk, '=', $confirmCode)) { if ($confEmail) { ${$dbUserNk} = ''; ${$dbUserNp} = ''; ${$dbUserAct} = 1; $updArr = array($dbUserAct, $dbUserNk, $dbUserNp); $fs = updateArray($updArr, $Tu, $dbUserNk, $confirmCode); $mes = $l_emailCodeConfirm; } else { ${$dbUserSheme['user_password'][1]} = writeUserPwd($curr[0]); ${$dbUserNk} = ''; ${$dbUserNp} = ''; $updArr = array($dbUserSheme['user_password'][1], $dbUserNk, $dbUserNp); $fs = updateArray($updArr, $Tu, $dbUserNk, $confirmCode); $mes = $l_passwdUpdate; }
function getTopicTitleById($topic_id) { $tName = ''; if ($tn = db_simpleSelect(0, $GLOBALS['Tt'], 'topic_title', 'topic_id', '=', $topic_id)) { $tName = $tn[0]; } return $tName; }
This file is part of miniBB. miniBB is free discussion forums/message board software, without any warranty. See COPYING file for more details. Copyright (C) 2004 Paul Puzyrev, Sergei Larionov. www.minibb.net */ if (!defined('INCLUDED776')) { die('Fatal error.'); } if (isset($_POST['post'])) { $post = $_POST['post']; } elseif (isset($_GET['post'])) { $post = $_GET['post']; } else { $post = 0; } $first = db_simpleSelect(0, $Tp, 'post_id', 'topic_id', '=', $topic, 'post_id ASC', 1); $first = $first[0]; if (($logged_admin == 1 or $isMod == 1) and $first != $post) { if (db_delete($Tp, 'post_id', '=', $post) and $pp = db_simpleSelect(0, $Tp, 'post_id', 'topic_id', '=', $topic, 'post_id DESC', 1)) { $topic_last_post_id = $pp[0]; updateArray(array('topic_last_post_id'), $Tt, 'topic_id', $topic); db_forumReplies($forum, $Tp, $Tf); db_topicPosts($topic, $Tt, $Tp); if (isset($metaLocation)) { $meta_relocate = "{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}&page={$page}"; echo ParseTpl(makeUp($metaLocation)); exit; } else { header("Location: {$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}&page={$page}"); exit; } } else { $errorMSG = $l_itseemserror; $correctErr = $backErrorLink;
die('Fatal error.'); } if (!isset($genEmailDisable) or $genEmailDisable != 1) { $newPasswd = ''; $confirmCode = ''; $email = isset($_POST['email']) ? $_POST['email'] : ''; if ($email == $admin_email) { $email = ''; } if ($step != 1) { $title .= $l_sub_pass; echo load_header(); echo ParseTpl(makeUp('tools_send_password')); return; } else { if (!($updId = db_simpleSelect(0, $Tu, $dbUserId, $dbUserSheme['user_email'][1], '=', $email))) { $title .= $l_emailNotExists; $errorMSG = $l_emailNotExists; $correctErr = $backErrorLink; echo load_header(); echo ParseTpl(makeUp('main_warning')); return; } else { ${$dbUserNp} = substr(ereg_replace("[^0-9A-Za-z]", "A", md5(uniqid(rand()))), 0, 8); $newPasswd = ${$dbUserNp}; ${$dbUserNk} = substr(md5(uniqid(rand())), 0, 32); $confirmCode = ${$dbUserNk}; $updArr = array($dbUserNp, $dbUserNk); $fs = updateArray($updArr, $Tu, $dbUserId, $updId[0]); if ($fs > 0) { $msg = ParseTpl(makeUp('email_user_password'));
$loginError = 2; $displayFormElements = array('userData' => 1, 'topicTitle' => 1, 'postText' => 1); $antiWarn = $l_fixData; include $pathToFiles . 'bb_func_posthold.php'; } } // if this is not admin, this is anonymous or registered user; check registered first } else { if (isset($loginsCase) and $loginsCase) { $caseComp1 = $caseComp . '('; $caseComp2 = ')'; } else { $caseComp1 = ''; $caseComp2 = ''; } if ($row = db_simpleSelect(FALSE, $Tu, $dbUserSheme['username'][1] . ',' . $dbUserSheme['user_password'][1], $caseComp1 . $dbUserSheme['username'][1] . $caseComp2, '=', $user_usr, '', 1)) { // It means that username exists in database; so let's check a password $username = $row[0]; $userpassword = $row[1]; if (($user_usr == $username or isset($loginsCase) and $loginsCase and strtolower($user_usr) == strtolower($username)) and $userpassword == writeUserPwd($user_pwd)) { $logged_user = 1; $cook = $username . "|" . writeUserPwd($user_pwd) . "|" . $cookieexptime; deleteMyCookie(); setMyCookie($username, $user_pwd, $cookieexptime); setCSRFCheckCookie(); if ($action == '') { if (isset($metaLocation)) { $meta_relocate = "{$main_url}/{$indexphp}{$queryStr}"; echo ParseTpl(makeUp($metaLocation)); exit; } elseif ($queryStr2 != '') {
do { if ($cols[1]) { if (isset($preModerationType) and $preModerationType > 0 and isset($premodTopics) and in_array($cols[0], $premodTopics)) { $cols[2] = $l_topicQueued; } if (!isset($vMax)) { $vMax = $cols[1]; } $val = $cols[1]; $stats_barWidth = round(100 * ($val / $vMax)); if ($stats_barWidth > $stats_barWidthLim) { $key = '<a href="' . gen_vthread_url($cols[3], $forumNames[$cols[3]], $cols[0], $cols[2], PAGE1_OFFSET + 1) . '"' . $nof . '>' . $cols[2] . '</a>'; } else { $key2 = '<a href="' . gen_vthread_url($cols[3], $forumNames[$cols[3]], $cols[0], $cols[2], PAGE1_OFFSET + 1) . '"' . $nof . '>' . $cols[2] . '</a>'; $key = '<a href="' . gen_vthread_url($cols[3], $forumNames[$cols[3]], $cols[0], $cols[2], PAGE1_OFFSET + 1) . '"' . $nof . '>...</a>'; } $list_stats_viewed .= ParseTpl($tpl); } else { break; } } while ($cols = db_simpleSelect(1)); } unset($xtr); $numUsers = db_simpleSelect(2, $Tu, 'count(*)') - 1; $numTopics = db_simpleSelect(2, $Tf, 'SUM(topics_count)'); $numPosts = db_simpleSelect(2, $Tf, 'SUM(posts_count)') - $numTopics; $adminInf = db_simpleSelect(2, $Tu, $dbUserSheme['username'][1], $dbUserId, '=', 1); $lastRegUsr = db_simpleSelect(0, $Tu, "{$dbUserId}, {$dbUserSheme['username'][1]}", '', '', '', "{$dbUserId} DESC", 1); $title = $title . $l_stats; echo load_header(); echo ParseTpl(makeUp('stats'));
function get_forums_fast_preview() { // Get forums fast order preview in admin panel global $result; $fast = ''; if ($GLOBALS['viewTopicsIfOnlyOneForum'] == 1) { $fast = "<br />{$GLOBALS['l_topicsWillBeDisplayed']}"; } else { if ($row = db_simpleSelect(0, $GLOBALS['Tf'], 'forum_id, forum_name, forum_desc, forum_order, forum_icon, forum_group', '', '', '', 'forum_order')) { do { if ($row[5] != '') { $fast .= "<img src=\"{$GLOBALS['main_url']}/img/p.gif\" style=\"width:{$fIconWidth}px;height:{$fIconHeight}px\" alt=\"\" /> <strong>{$row[5]}</strong><br />"; } $fast .= "<img src=\"{$GLOBALS['main_url']}/img/forum_icons/{$row[4]}\" style=\"width:{$fIconWidth}px;height:{$fIconHeight}px\" alt=\"Forum icon\" /> <b><a href=\"{$GLOBALS['main_url']}/{$GLOBALS['bb_admin']}action=editforum2&forumID={$row[0]}\">{$row[1]}</a></b> [ORDER: {$row[3]}] - <span class=\"txtSm\">{$row[2]} </span> <a href=\"{$GLOBALS['main_url']}/{$GLOBALS['bb_admin']}action=move&where=1&forumID={$row[0]}\">↑</a> <a href=\"{$GLOBALS['main_url']}/{$GLOBALS['bb_admin']}action=move&where=0&forumID={$row[0]}\">↓</a><br />"; } while ($row = db_simpleSelect(1)); } } return $fast; }
<?php /* This file is part of miniBB. miniBB is free discussion forums/message board software, without any warranty. See COPYING file for more details. Copyright (C) 2004 Paul Puzyrev, Sergei Larionov. www.minibb.net */ if (!defined('INCLUDED776')) { die('Fatal error.'); } $usrid = isset($_GET['usrid']) ? $_GET['usrid'] : 0; if ($topic != 0 and $usrid != 0 and $usrid == $user_id and !($ids = db_simpleSelect(0, $Ts, 'id', 'topic_id', '=', $topic, '', '', 'user_id', '=', $user_id))) { $topicU = $topic; $user_id = $usrid; $topic_id = $topic; insertArray(array('user_id', 'topic_id'), $Ts); $errorMSG = $l_completed; $title .= $l_completed; } else { $title .= $l_accessDenied; $errorMSG = $l_accessDenied; } $correctErr = ''; echo load_header(); echo ParseTpl(makeUp('main_warning')); return;
return; } else { $TT = $_POST['topicTitle']; $topicTitle = textFilter($_POST['topicTitle'], $topic_max_length, $post_word_maxlength, 0, 1, 0, $user_id); } $poster_ip = getIP(); if (db_simpleSelect(0, $Tf, 'forum_id', 'forum_id', '=', $forum)) { if ($postRange == 0) { $antiSpam = 0; } else { if ($user_id == 0) { $fields = array('poster_ip', $poster_ip); } else { $fields = array('poster_id', $user_id); } if ($antiSpam = db_simpleSelect(0, $Tp, 'count(*)', $fields[0], '=', $fields[1], '', '', 'now()-post_time', '<', $postRange)) { $antiSpam = $antiSpam[0]; } else { $antiSpam = 1; } } if ($user_id == 1 or $antiSpam == 0) { $topic_title = $topicTitle; $topic_poster = $user_id; $topic_poster_name = $user_usr; $topic_time = 'now()'; $forum_id = $forum; $topic_status = 0; $topic_last_post_id = 0; $posts_count = 0; $dll = insertArray(array('topic_title', 'topic_poster', 'topic_poster_name', 'topic_time', 'forum_id', 'topic_status', 'topic_last_post_id', 'posts_count'), $Tt);
$user_sorttopics = $userData[11]; } $sorttopicsDown = makeValuedDropDown(array(0 => $l_newAnswers, 1 => $l_newTopics), 'user_sorttopics'); if (!isset($_POST['language'])) { $language = $userData[14]; } else { $language = $_POST['language']; } $languageDown = makeValuedDropDown($glang, 'language'); if ($step == 1) { require $pathToFiles . 'bb_func_usrdat.php'; ${$dbUserSheme['username'][1]} = $userData[1]; ${$dbUserSheme['username'][2]} = $userData[1]; $act = 'upd'; require $pathToFiles . 'bb_func_checkusr.php'; if (db_simpleSelect(0, $Tu, $dbUserId, $dbUserSheme['user_email'][1], '=', ${$dbUserSheme['user_email'][1]}, '', '', $dbUserId, '!=', $user_id) or ${$dbUserSheme['user_email'][1]} == $admin_email and $user_id != 1) { $correct = 4; } if ($correct == 'ok') { //Update db $addFieldsGen = array('user_icq', 'user_website', 'user_occ', 'user_from', 'user_interest'); $upda = array($dbUserSheme['user_email'][1], $dbUserSheme['user_viewemail'][1], $dbUserSheme['user_sorttopics'][1], $dbUserSheme['language'][1]); foreach ($addFieldsGen as $k) { if (isset($dbUserSheme[$k])) { $upda[] = $dbUserSheme[$k][1]; } } foreach ($dbUserSheme as $k => $v) { if (strstr($k, 'user_custom')) { $upda[] = $v[1]; }
} if ((int) $forum != 0) { $sql[2] = " forum_id={$forum} "; $viewtbSearchForum = 1; $navUrl .= "&forum={$forum}"; } $words = explode(' ', $phrase); if (sizeof($words) > 2) { $searchType = 2; } if ($phrase != '') { $sql[3] = db_genPhrase($phrase, $where, $searchType); } if ($posterName != '') { $posterName1 = urlencode($posterName); if ($row = db_simpleSelect(0, $Tu, $dbUserId, $caseComp . '(' . $dbUserSheme['username'][1] . ')', '=', strtolower_rus($posterName))) { $sql[4] = " {$poster_id_field}={$row[0]} "; } else { $sql[4] = " {$poster_field}='{$posterName}' "; } $navUrl .= "&posterName={$posterName1}"; } foreach ($sql as $k => $sq) { if (trim($sq) == '') { unset($sql[$k]); } else { $sql[$k] = ' (' . $sql[$k] . ') '; } } $sqlStr = implode('and', $sql); //echo "select count(*) from $table where $sqlStr";
$cT = $l_closeTopic; } else { $chstat = 0; $cT = $l_unlockTopic; } $closeTopic = "<a href=\"{$main_url}/{$indexphp}action=locktopic&forum={$forum}&topic={$topic}&chstat={$chstat}\">{$cT}</a>"; if ($topicSticky == 0) { $chstat = 1; $cT = $l_makeSticky; } else { $chstat = 0; $cT = $l_makeUnsticky; } $stickyTopic = "{$l_sepr} <a href=\"{$main_url}/{$indexphp}action=unsticky&forum={$forum}&topic={$topic}&chstat={$chstat}\">{$cT}</a>"; $extra = 1; if ($logged_admin == 1 and $cnt = db_simpleSelect(0, $Ts, 'count(*)', 'topic_id', '=', $topic) and $cnt[0] > 0) { $subsTopic = "{$l_sepr} <a href=\"{$main_url}/{$bb_admin}action=viewsubs&topic={$topic}\">{$l_subscriptions}</a>"; } else { $subsTopic = ''; } } elseif ($user_id == $topicPoster and $user_id != 0 and $user_id != 1 and $topicSticky != 1 and !$c4) { if ($topicStatus == 0 and $userUnlock != 2) { $closeTopic = "<a href=\"{$main_url}/{$indexphp}action=locktopic&forum={$forum}&topic={$topic}&chstat=1\">{$l_closeTopic}</a>"; } elseif ($topicStatus == 1 and $userUnlock == 1 and $userUnlock != 2) { $closeTopic = "<a href=\"{$main_url}/{$indexphp}action=locktopic&forum={$forum}&topic={$topic}&chstat=0\">{$l_unlockTopic}</a>"; } else { $closeTopic = ''; } } if ($page > PAGE1_OFFSET + 1) { $tpage = ' - ' . $l_page . ' ' . ($page - PAGE1_OFFSET);
function user_logged_in() { if (isset($GLOBALS['cook']) and trim($GLOBALS['cook']) != '') { $c = explode('|', $GLOBALS['cook']); } else { $c = getMyCookie(); } $username = $c[0]; $userpassword = $c[1]; $exptime = $c[2] + 0; $returned = FALSE; $resetCookie = FALSE; if ($username == '') { $returned = FALSE; return; } $GLOBALS['user_usr'] = $username; $pasttime = $exptime - time(); if (strlen($GLOBALS['admin_pwd']) == 32) { $user_pwd_cmp = $GLOBALS['admin_pwd']; } else { $user_pwd_cmp = writeUserPwd($GLOBALS['admin_pwd']); } if (isset($GLOBALS['loginsCase']) and $GLOBALS['loginsCase']) { $caseComp1 = $GLOBALS['caseComp'] . '('; $caseComp2 = ')'; $usernameSql = strtolower($username); } else { $caseComp1 = ''; $caseComp2 = ''; $usernameSql = $username; } if (($username == $GLOBALS['admin_usr'] or isset($GLOBALS['loginsCase']) and $GLOBALS['loginsCase'] and strtolower($username) == strtolower($GLOBALS['admin_usr'])) and $userpassword == $user_pwd_cmp) { //if ($username==$GLOBALS['admin_usr'] and $userpassword==$GLOBALS['admin_pwd']) { $returned = TRUE; $GLOBALS['logged_user'] = 0; $GLOBALS['logged_admin'] = 1; $GLOBALS['user_id'] = 1; if ($row = db_simpleSelect(0, $GLOBALS['Tu'], $GLOBALS['dbUserSheme']['user_sorttopics'][1] . ',' . $GLOBALS['dbUserSheme']['language'][1] . ', ' . $GLOBALS['dbUserSheme']['num_posts'][1], $GLOBALS['dbUserId'], '=', 1)) { $GLOBALS['user_sort'] = $row[0]; } $GLOBALS['langu'] = $row[1]; $GLOBALS['user_num_posts'] = $row[2]; $username = $GLOBALS['admin_usr']; if ($pasttime <= $GLOBALS['cookie_renew']) { // if expiration time of cookie is less than defined in setup, we redefine it below $resetCookie = TRUE; } } elseif ($row = db_simpleSelect(0, $GLOBALS['Tu'], $GLOBALS['dbUserId'] . ',' . $GLOBALS['dbUserSheme']['user_sorttopics'][1] . ',' . $GLOBALS['dbUserSheme']['language'][1] . ',' . $GLOBALS['dbUserAct'] . ',' . $GLOBALS['dbUserSheme']['user_password'][1] . ', ' . $GLOBALS['dbUserSheme']['username'][1] . ', ' . $GLOBALS['dbUserSheme']['num_posts'][1], $caseComp1 . $GLOBALS['dbUserSheme']['username'][1] . $caseComp2, '=', $usernameSql, '', 1)) { if ($row[4] == $userpassword) { $returned = TRUE; $GLOBALS['user_id'] = $row[0]; $GLOBALS['user_sort'] = $row[1]; $GLOBALS['logged_user'] = 1; $GLOBALS['logged_admin'] = 0; $GLOBALS['langu'] = $row[2]; $GLOBALS['user_activity'] = $row[3]; $username = $row[5]; $GLOBALS['user_num_posts'] = $row[6]; if ($pasttime <= $GLOBALS['cookie_renew']) { $resetCookie = TRUE; } } else { /* Preventing hijack */ $username = ''; $GLOBALS['user_usr'] = $username; } } else { $returned = FALSE; if ($pasttime <= $GLOBALS['cookie_renew']) { $userpassword = ''; $resetCookie = TRUE; } } if ($resetCookie) { deleteMyCookie(); setMyCookie($username, $userpassword, $GLOBALS['cookieexptime']); } return $returned; }
updateArray(array('active'), $Ts, 'topic_id', $topic); } } //email users //Email admin if allowed if ($genEmailDisable != 1 and isset($emailadmposts) and $emailadmposts == 1 and $user_id != 1) { $subS = $sub[$langOrig]; $msgS = $msg[$langOrig][0] . '1' . $msg[$langOrig][1]; sendMail($admin_email, $subS, $msgS, $reply_to_email, $reply_to_email); } unset($setTpls); $emailusers = $tmpUe; $insresOrig = $insres; //Insert user into email notifies if allowed if (isset($_POST['CheckSendMail']) and emailCheckBox() != '' and substr(emailCheckBox(), 0, 8) != '<!--U-->') { $ae = db_simpleSelect(0, $Ts, 'count(*)', 'user_id', '=', $user_id, '', '', 'topic_id', '=', $topic); $ae = $ae[0]; if ($ae == 0) { $topic_id = $topic; insertArray(array('user_id', 'topic_id'), $Ts); } } $insres = $insresOrig; } //inserted post successfully } else { $errorMSG = $l_antiSpam; $title .= $l_antiSpam; $displayFormElements = array('topicTitle' => 1, 'postText' => 1); $antiWarn = $l_antiSpamWait; $antiSpam = 1;
function emailCheckBox() { $checkEmail = ''; if ($GLOBALS['genEmailDisable'] != 1) { $isInDb = db_simpleSelect(0, $GLOBALS['Ts'], 'count(*)', 'topic_id', '=', $GLOBALS['topic'], '', '', 'user_id', '=', $GLOBALS['user_id']); if ($isInDb[0] > 0) { $isInDb = TRUE; } else { $isInDb = FALSE; } $true0 = $GLOBALS['emailusers'] == 1; $true1 = $GLOBALS['user_id'] != 0; $true2 = ($GLOBALS['action'] == 'vtopic' or $GLOBALS['action'] == 'vthread' or $GLOBALS['action'] == 'ptopic' or $GLOBALS['action'] == 'pthread'); $true3a = ($GLOBALS['user_id'] == 1 and (!isset($GLOBALS['emailadmposts']) or $GLOBALS['emailadmposts'] == 0) and !$isInDb); $true3b = ($GLOBALS['user_id'] != 1 and !$isInDb); $true3 = ($true3a or $true3b); if ($true0 and $true1 and $true2 and $true3) { $checkEmail = "<input type=\"checkbox\" id=\"CheckSendMail\" name=\"CheckSendMail\"><label for=\"CheckSendMail\">{$GLOBALS['l_emailNotify']}</label>"; if ($GLOBALS['topic']) { $checkEmail .= " <a title=\"{$GLOBALS['l_subscribe']}\" href=\"{$GLOBALS['indexphp']}action=subscribe&topic={$GLOBALS['topic']}&usrid={$GLOBALS['user_id']}\">{$GLOBALS['l_subscribe']}</a>"; } } elseif ($isInDb) { $checkEmail = "<!--U-->{$GLOBALS['l_unsubscribeinfo']}<a title=\"{$GLOBALS['l_unsubscribe']}\" href=\"{$GLOBALS['indexphp']}action=unsubscribe&topic={$GLOBALS['topic']}&usrid={$GLOBALS['user_id']}\">{$GLOBALS['l_unsubscribe']}</a>"; } } return $checkEmail; }
return; } else { $TT = str_replace(array(' ', ' '), '', $TT); $topicTitle = textFilter($TT, $topic_max_length, $post_word_maxlength, 0, 1, 0, $user_id, 255); } $poster_ip = getIP(); if (db_simpleSelect(0, $Tf, 'forum_id', 'forum_id', '=', $forum)) { if ($postRange == 0) { $antiSpam = 0; } else { if ($user_id == 0) { $fields = array('poster_ip', $poster_ip); } else { $fields = array('poster_id', $user_id); } if ($asTime = db_simpleSelect(0, $Tp, 'post_time', $fields[0], '=', $fields[1], 'post_id DESC', '1')) { $asTime = time() - strtotime($asTime[0]); if ($asTime <= $postRange) { $antiSpam = 1; } else { $antiSpam = 0; } } else { $antiSpam = 0; } } if ($user_id == 1 or $isMod == 1 or $antiSpam == 0) { $topic_title = $topicTitle; $topic_poster = $user_id; $topic_poster_name = $user_usr; $topic_time = date('Y-m-d H:i:s');
$resetUser = $_GET['user'] + 0; } else { $resetUser = $user_id; } if (!isset($activeEmailsDisable) and $genEmailDisable == 0 and $emailusers > 0 and $user_id > 0 and $sendid = db_simpleSelect(0, $Ts, 'id,active,user_id', 'user_id', '=', $resetUser, '', '', 'topic_id', '=', $topic) and $sendid[1] == 0) { $active = 1; updateArray(array('active'), $Ts, 'id', $sendid[0]); } if (isset($_GET['goPost']) and isset($_GET['user'])) { $goPost = $_GET['goPost'] + 0; if ($sendid = db_simpleSelect(0, $Ts, 'id,active', 'user_id', '=', $resetUser, '', '', 'topic_id', '=', $topic) and $sendid[1] == 0) { $active = 1; updateArray(array('active'), $Ts, 'id', $sendid[0]); } $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; }
<?php /* This file is part of miniBB. miniBB is free discussion forums/message board software, without any warranty. See COPYING file for more details. Copyright (C) 2004 Paul Puzyrev, Sergei Larionov. www.minibb.net */ if (!defined('INCLUDED776')) { die('Fatal error.'); } if (!isset($_GET['chstat'])) { die('Fatal error.'); } else { $topic_status = $_GET['chstat']; } if ($tD = db_simpleSelect(0, $Tt, 'topic_status, topic_poster, sticky', 'topic_id', '=', $topic)) { if ($tD[1] == $user_id and $tD[2] != 1 and ($topic_status == 0 and $userUnlock == 1 or $topic_status == 1) or $logged_admin == 1 or $isMod == 1) { if (updateArray(array('topic_status'), $Tt, 'topic_id', $topic) > 0) { $errorMSG = $topic_status == 1 ? $l_topicLocked : $l_topicUnLocked; } else { $errorMSG = $l_itseemserror; } $correctErr = "<a href=\"{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}\">{$l_back}</a>"; } else { $errorMSG = $l_forbidden; $correctErr = $backErrorLink; } } $title .= $errorMSG; echo load_header(); echo ParseTpl(makeUp('main_warning')); return;
if ($i > 0) { $bg = 'tbCel1'; } else { $bg = 'tbCel2'; } if (isset($mod_rewrite) and $mod_rewrite) { $urlp = "{$main_url}/{$forum}_{$topic}_"; } else { $urlp = "{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}&page="; } $pageNavCell = pageNav(0, $numReplies + 1, $urlp, $forum == $CONF['forum_submittedarticles'] || $forum == $CONF['forum_gallery'] ? 10 : $viewmaxreplys, TRUE); $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 = "{$main_url}/{$forum}_{$topic}_0.html"; } else { $linkToTopic = "{$main_url}/{$indexphp}action=vthread&forum={$forum}&topic={$topic}"; } $list_topics .= ParseTpl($tpl); $i = -$i; } while ($cols = db_simpleSelect(1)); unset($result); }
$user_sorttopics = $userData[$dbUserSheme['user_sorttopics'][0]]; } $sorttopicsDown = makeValuedDropDown(array(0 => $l_newAnswers, 1 => $l_newTopics), 'user_sorttopics'); if (!isset($_POST['language'])) { $language = $userData[$dbUserSheme['language'][0]]; } else { $language = $_POST['language']; } $languageDown = makeValuedDropDown($glang, 'language'); if ($step == 1) { require $pathToFiles . 'bb_func_usrdat.php'; ${$dbUserSheme['username'][1]} = $userData[$dbUserSheme['username'][0]]; ${$dbUserSheme['username'][2]} = $userData[$dbUserSheme['username'][0]]; $act = 'upd'; require $pathToFiles . 'bb_func_checkusr.php'; if ($rowp = db_simpleSelect(0, $Tu, $dbUserId, $caseComp . "({$dbUserSheme['user_email'][1]})", '=', strtolower(${$dbUserSheme['user_email'][1]}), '', '', $dbUserId, '!=', $user_id) or strtolower(${$dbUserSheme['user_email'][1]}) == strtolower($admin_email) and $user_id != 1) { $correct = 4; } $prevVals = array(); foreach ($dbUserSheme as $key => $val) { if (strstr($key, 'user_custom')) { $prevVals[$key] = $userData[$dbUserSheme[$key][0]]; } } if (file_exists($pluginsFile)) { include $pluginsFile; } if ($correct == 0) { //Update db $addFieldsGen = array('user_icq', 'user_website', 'user_occ', 'user_from', 'user_interest'); $upda = array($dbUserSheme['user_email'][1], $dbUserSheme['user_viewemail'][1], $dbUserSheme['user_sorttopics'][1], $dbUserSheme['language'][1]);