}
 if (file_exists($pathToFiles . 'bb_plugins2.php')) {
     require $pathToFiles . 'bb_plugins2.php';
 }
 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_calcAmount($Tp, 'forum_id', $forum, $Tf, 'posts_count');
 db_calcAmount($Tt, 'forum_id', $forum, $Tf, 'topics_count');
 $i = 0;
 foreach ($pUsers as $val) {
     if ($i == 0) {
         db_calcAmount($Tt, 'topic_poster', $val, $Tu, $dbUserSheme['num_topics'][1], $dbUserId);
     }
     db_calcAmount($Tp, 'poster_id', $val, $Tu, $dbUserSheme['num_posts'][1], $dbUserId);
     $i++;
 }
 if (defined('DELETE_PREMOD')) {
     return;
 }
 //CSRF cookie delete
 setcookie($cookiename . 'csrf', '', time() - 2592000, $cookiepath, $cookiedomain, $cookiesecure);
 if ($user_sort == 1) {
     if (isset($metaLocation)) {
         $meta_relocate = "{$main_url}/{$indexphp}action=vtopic&forum={$forum}&page={$return}&h={$h}";
         echo ParseTpl(makeUp($metaLocation));
         exit;
     } else {
         header("Location: {$main_url}/{$indexphp}action=vtopic&forum={$forum}&page={$return}&h={$h}");
         exit;
     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;
     } 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}";
         }
     $topic_poster = $user_id;
     $topic_poster_name = $user_usr;
     $topic_time = date('Y-m-d H:i:s');
     if (!defined('TOPIC_TIME')) {
         define('TOPIC_TIME', $topic_time);
     }
     $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);
     if ($dll == 0) {
         $topic = $insres;
         db_calcAmount($Tt, 'forum_id', $forum, $Tf, 'topics_count');
         if ($user_id != 0) {
             db_calcAmount($Tt, 'topic_poster', $user_id, $Tu, $dbUserSheme['num_topics'][1], $dbUserId);
         }
         require $pathToFiles . 'bb_func_pthread.php';
     } else {
         $errorMSG = $l_mysql_error;
         $correctErr = $backErrorLink;
         $title .= $l_mysql_error;
         $loginError = 1;
         echo load_header();
         echo ParseTpl(makeUp('main_warning'));
         return;
     }
 } else {
     $errorMSG = $l_antiSpam;
     //$correctErr=$backErrorLink;
     $title .= $l_antiSpam;
Exemple #4
0
             if ($lp = db_simpleSelect(0, $Tp, 'post_id, post_time, poster_name', 'topic_id', '=', $topic_id, 'post_id DESC', 1)) {
                 $topic_last_post_id = $lp[0];
                 $topic_last_post_time = $lp[1];
                 $topic_last_poster = $lp[2];
                 $fs = updateArray(array('topic_last_post_id', 'topic_last_post_time', 'topic_last_poster'), $Tt, 'topic_id', $topic_id);
                 $aff += $fs;
             }
             $result = $RES1;
             $countRes = $CNT1;
         } while ($rrr = db_simpleSelect(1));
     }
     /* Update forums posts, topics amount */
     if ($res = db_simpleSelect(0, $Tf, 'forum_id')) {
         do {
             db_calcAmount($Tp, 'forum_id', $res[0], $Tf, 'posts_count');
             db_calcAmount($Tt, 'forum_id', $res[0], $Tf, 'topics_count');
         } while ($res = db_simpleSelect(1));
     }
     if ($aff > 0) {
         $warning .= "<br />" . $l_userMsgsDeleted;
     } else {
         $warning .= "<br />" . $l_userMsgsNotDeleted;
     }
 } else {
     /*Make user posts as anonymous*/
     $aff = 0;
     $poster_id = 0;
     $topic_poster = 0;
     $aff += updateArray(array('poster_id'), $Tp, 'poster_id', $userID);
     $aff += updateArray(array('topic_poster'), $Tt, 'topic_poster', $userID);
     if ($aff > 0) {
}
//0 - 1st step, 1-edit concrete
if ($topic != 0 and ($logged_admin == 1 or $isMod == 1) and $rt = db_simpleSelect(0, $Tt, 'topic_title', 'topic_id', '=', $topic) and $rf = db_simpleSelect(0, $Tf, 'count(*)') and $rf[0] > 0 and $rowf = db_simpleSelect(0, $Tf, 'forum_id, forum_name', '', '', '', 'forum_order')) {
    if ($step == 1) {
        if (isset($_POST['forumWhere'])) {
            $forum_id = $_POST['forumWhere'] + 0;
        } else {
            $forum_id = 0;
        }
        if ($forum_id != 0 and $ff = db_simpleSelect(0, $Tf, 'forum_id', 'forum_id', '=', $forum_id)) {
            $u1 = updateArray(array('forum_id'), $Tt, 'topic_id', $topic);
            $u2 = updateArray(array('forum_id'), $Tp, 'topic_id', $topic);
            db_calcAmount($Tp, 'forum_id', $forum_id, $Tf, 'posts_count');
            db_calcAmount($Tp, 'forum_id', $forum, $Tf, 'posts_count');
            db_calcAmount($Tt, 'forum_id', $forum_id, $Tf, 'topics_count');
            db_calcAmount($Tt, 'forum_id', $forum, $Tf, 'topics_count');
            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) {