</div> <div class="preview_submit"> <?php if (isset($SubscribeBox) && !isset($ForumID) && Subscriptions::has_subscribed_comments($Document, $InputID) === false) { ?> <input id="subscribebox" type="checkbox" name="subscribe"<?php echo !empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''; ?> tabindex="2" /> <label for="subscribebox">Subscribe</label> <?php } // Forum thread logic // This might use some more abstraction if (isset($ForumID)) { if (!Subscriptions::has_subscribed($InputID)) { ?> <input id="subscribebox" type="checkbox" name="subscribe"<?php echo !empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''; ?> tabindex="2" /> <label for="subscribebox">Subscribe</label> <?php } if ($ThreadInfo['LastPostAuthorID'] == G::$LoggedUser['ID'] && (check_perms('site_forums_double_post') || in_array($ForumID, $ForumsDoublePost))) { ?> <input id="mergebox" type="checkbox" name="merge" tabindex="2" /> <label for="mergebox">Merge</label> <?php } if (!G::$LoggedUser['DisableAutoSave']) {
error('Your posting privileges have been removed.'); } $TopicID = $_POST['thread']; $ThreadInfo = Forums::get_thread_info($TopicID); if ($ThreadInfo === null) { error(404); } $ForumID = $ThreadInfo['ForumID']; $SQLTime = sqltime(); if (!Forums::check_forumperm($ForumID)) { error(403); } if (!Forums::check_forumperm($ForumID, 'Write') || $LoggedUser['DisablePosting'] || $ThreadInfo['IsLocked'] == '1' && !check_perms('site_moderate_forums')) { error(403); } if (isset($_POST['subscribe']) && Subscriptions::has_subscribed($TopicID) === false) { Subscriptions::subscribe($TopicID); } //Now lets handle the special case of merging posts, we can skip bumping the thread and all that fun if ($ThreadInfo['LastPostAuthorID'] == $LoggedUser['ID'] && (!check_perms('site_forums_double_post') && !in_array($ForumID, $ForumsDoublePost) || isset($_POST['merge']))) { //Get the id for this post in the database to append $DB->query("\n\t\tSELECT ID, Body\n\t\tFROM forums_posts\n\t\tWHERE TopicID = '{$TopicID}'\n\t\t\tAND AuthorID = '" . $LoggedUser['ID'] . "'\n\t\tORDER BY ID DESC\n\t\tLIMIT 1"); list($PostID, $OldBody) = $DB->next_record(MYSQLI_NUM, false); //Edit the post $DB->query("\n\t\tUPDATE forums_posts\n\t\tSET\n\t\t\tBody = CONCAT(Body,'\n\n" . db_string($Body) . "'),\n\t\t\tEditedUserID = '" . $LoggedUser['ID'] . "',\n\t\t\tEditedTime = '{$SQLTime}'\n\t\tWHERE ID = '{$PostID}'"); //Store edit history $DB->query("\n\t\tINSERT INTO comments_edits\n\t\t\t(Page, PostID, EditUser, EditTime, Body)\n\t\tVALUES\n\t\t\t('forums', {$PostID}, " . $LoggedUser['ID'] . ", '{$SQLTime}', '" . db_string($OldBody) . "')"); $Cache->delete_value("forums_edits_{$PostID}"); //Get the catalogue it is in $CatalogueID = floor((POSTS_PER_PAGE * ceil($ThreadInfo['Posts'] / POSTS_PER_PAGE) - POSTS_PER_PAGE) / THREAD_CATALOGUE); //Get the catalogue value for the post we're appending to