error(404); } } else { error(404); } } else { $ThreadID = $_GET['threadid']; } if (isset($LoggedUser['PostsPerPage'])) { $PerPage = $LoggedUser['PostsPerPage']; } else { $PerPage = POSTS_PER_PAGE; } //---------- Get some data to start processing // Thread information, constant across all pages $ThreadInfo = Forums::get_thread_info($ThreadID, true, true); if ($ThreadInfo === null) { error(404); } $ForumID = $ThreadInfo['ForumID']; $IsDonorForum = $ForumID == DONOR_FORUM ? true : false; // Make sure they're allowed to look at the page if (!Forums::check_forumperm($ForumID)) { error(403); } //Escape strings for later display $ThreadTitle = display_str($ThreadInfo['Title']); $ForumName = display_str($Forums[$ForumID]['Name']); //Post links utilize the catalogue & key params to prevent issues with custom posts per page if ($ThreadInfo['Posts'] > $PerPage) { if (isset($_GET['post']) && is_number($_GET['post'])) {
?> <div class="linkbox"> <a href="forums.php?action=edit_rules&forumid=<?php echo $ForumID; ?> " class="brackets">Change specific rules</a> </div> <?php } if (!empty($Forums[$ForumID]['SpecificRules'])) { ?> <div class="linkbox"> <strong>Forum Specific Rules</strong> <?php foreach ($Forums[$ForumID]['SpecificRules'] as $ThreadIDs) { $Thread = Forums::get_thread_info($ThreadIDs); if ($Thread === null) { error(404); } ?> <br /> <a href="forums.php?action=viewthread&threadid=<?php echo $ThreadIDs; ?> " class="brackets"><?php echo display_str($Thread['Title']); ?> </a> <?php } ?>
} $DB->query("\n\tINSERT INTO users_warnings_forums\n\t\t(UserID, Comment)\n\tVALUES\n\t\t('{$UserID}', '" . db_string($AdminComment) . "')\n\tON DUPLICATE KEY UPDATE\n\t\tComment = CONCAT('" . db_string($AdminComment) . "', Comment)"); Misc::send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage); //edit the post $DB->query("\n\tSELECT\n\t\tp.Body,\n\t\tp.AuthorID,\n\t\tp.TopicID,\n\t\tt.ForumID,\n\t\tCEIL(\n\t\t\t(\n\t\t\t\tSELECT COUNT(p2.ID)\n\t\t\t\tFROM forums_posts AS p2\n\t\t\t\tWHERE p2.TopicID = p.TopicID\n\t\t\t\t\tAND p2.ID <= '{$PostID}'\n\t\t\t) / " . POSTS_PER_PAGE . "\n\t\t) AS Page\n\tFROM forums_posts AS p\n\t\tJOIN forums_topics AS t ON p.TopicID = t.ID\n\t\tJOIN forums AS f ON t.ForumID = f.ID\n\tWHERE p.ID = '{$PostID}'"); list($OldBody, $AuthorID, $TopicID, $ForumID, $Page) = $DB->next_record(); // Perform the update $DB->query("\n\tUPDATE forums_posts\n\tSET Body = '" . db_string($Body) . "',\n\t\tEditedUserID = '{$UserID}',\n\t\tEditedTime = '{$SQLTime}'\n\tWHERE ID = '{$PostID}'"); $CatalogueID = floor((POSTS_PER_PAGE * $Page - POSTS_PER_PAGE) / THREAD_CATALOGUE); $Cache->begin_transaction("thread_{$TopicID}" . "_catalogue_{$CatalogueID}"); if ($Cache->MemcacheDBArray[$Key]['ID'] != $PostID) { $Cache->cancel_transaction(); $Cache->delete_value("thread_{$TopicID}" . "_catalogue_{$CatalogueID}"); //just clear the cache for would be cache-screwer-uppers } else { $Cache->update_row($Key, array('ID' => $Cache->MemcacheDBArray[$Key]['ID'], 'AuthorID' => $Cache->MemcacheDBArray[$Key]['AuthorID'], 'AddedTime' => $Cache->MemcacheDBArray[$Key]['AddedTime'], 'Body' => $Body, 'EditedUserID' => $LoggedUser['ID'], 'EditedTime' => $SQLTime, 'Username' => $LoggedUser['Username'])); $Cache->commit_transaction(3600 * 24 * 5); } $ThreadInfo = Forums::get_thread_info($TopicID); if ($ThreadInfo === null) { error(404); } if ($ThreadInfo['StickyPostID'] == $PostID) { $ThreadInfo['StickyPost']['Body'] = $Body; $ThreadInfo['StickyPost']['EditedUserID'] = $LoggedUser['ID']; $ThreadInfo['StickyPost']['EditedTime'] = $SQLTime; $Cache->cache_value("thread_{$TopicID}" . '_info', $ThreadInfo, 0); } $DB->query("\n\tINSERT INTO comments_edits\n\t\t(Page, PostID, EditUser, EditTime, Body)\n\tVALUES\n\t\t('forums', {$PostID}, {$UserID}, '{$SQLTime}', '" . db_string($OldBody) . "')"); $Cache->delete_value("forums_edits_{$PostID}"); header("Location: forums.php?action=viewthread&postid={$PostID}#post{$PostID}");