} } if ($user_id == 1 or $antiSpam == 0) { $forum_id = $forum; $topic_id = $topic; $poster_id = $user_id; $poster_name = $user_usr; $post_text = $postText; $post_time = 'now()'; $post_status = 0; $inss = insertArray(array('forum_id', 'topic_id', 'poster_id', 'poster_name', 'post_text', 'post_time', 'poster_ip', 'post_status'), $Tp); if ($inss == 0) { $topic_last_post_id = $insres; if (updateArray(array('topic_last_post_id'), $Tt, 'topic_id', $topic) > 0) { db_forumReplies($forum, $Tp, $Tf); db_topicPosts($topic, $Tt, $Tp); //fire an event require_once 'geograph/event.class.php'; new Event(EVENT_NEWREPLY, $topic_last_post_id); } if ($emailusers == 1 or isset($emailadmposts) and $emailadmposts == 1) { $topicTitle = db_simpleSelect(0, $Tt, 'topic_title', 'topic_id', '=', $topic); $topicTitle = $topicTitle[0]; $postTextSmall = strip_tags(substr(str_replace(array('<br>', ''', '"', '&', '$'), array("\r\n", "'", '"', '&', '$'), $postText), 0, 200)) . '...'; $msg = ParseTpl(makeUp('email_reply_notify')); $sub = explode('SUBJECT>>', $msg); $sub = explode('<<', $sub[1]); $msg = trim($sub[1]); $sub = $sub[0]; } //Email all users about this reply if allowed
/*Deleting user messages from posts and topics table. Topics - delete also all associated posts*/ if ($rrr = db_simpleSelect(0, $Tt, 'topic_id', 'topic_poster', '=', $userID)) { $ord = ''; do { $ord .= "topic_id={$rrr[0]} or "; } while ($rrr = db_simpleSelect(1)); $ord = substr($ord, 0, strlen($ord) - 4); $aff += db_delete($Tp, $ord, '', ''); $aff += db_delete($Tt, $ord, '', ''); } /* Posts only */ if ($rrr = db_simpleSelect(0, $Tp, 'DISTINCT topic_id', 'poster_id', '=', $userID)) { do { $topic_id = $rrr[0]; $aff += db_delete($Tp, 'topic_id', '=', $topic_id, 'poster_id', '=', $userID); db_topicPosts($topic_id, $Tt, $Tp); $RES1 = $result; $CNT1 = $countRes; if ($lp = db_simpleSelect(0, $Tp, 'post_id', 'topic_id', '=', $topic_id, 'post_id DESC', 1)) { $topic_last_post_id = $lp[0]; $fs = updateArray(array('topic_last_post_id'), $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_forumReplies($res[0], $Tp, $Tf);