0) { $postInfo = post_info($postId); if(empty($postInfo)) die_ex('Post not found.', 404); if($postInfo['post_type'] != FMF_POST_TYPE_MESSAGE) die_ex('This is not a message.', 400); if(!$userInfo['user_moderator'] && $userInfo['user_id'] != $postInfo['user_id']) die_ex('You aren\'t allowed to edit this post.', 403); $categoryId = $postInfo['cat_id'] ?? 0; $topicId = $postInfo['topic_id'] ?? 0; $postId = $postInfo['post_id'] ?? 0; $postText = $postInfo['post_text'] ?? ''; } else { $postId = 0; } if($topicId > 0) { $topicInfo = topic_info($topicId); if(empty($topicInfo)) die_ex('Topic not found.', 404); $categoryId = $topicInfo['cat_id'] ?? 0; $topicId = $topicInfo['topic_id'] ?? 0; } else { $topicId = 0; } $categoryInfo = category_info($categoryId); if(empty($categoryInfo)) { die_ex('Category does not exist.', 404); } if($categoryInfo['cat_type'] != 0) { die_ex('This category cannot hold topics.'); } if(isset($topicInfo)) { if(!empty($topicInfo['topic_locked']) && !$userInfo['user_moderator']) { die_ex('You may not respond to locked topics.', 403); } } $title = isset($topicInfo) ? ((isset($postInfo) ? 'Editing reply to ' : 'Replying to ') . $topicInfo['topic_title']) : ('Creating a topic in ' . $categoryInfo['cat_name']); if(isset($_POST['text']) && CSRF::verify()) { $postTitle = isset($_POST['title']) && is_string($_POST['title']) ? $_POST['title'] : ''; $postText = trim(is_string($_POST['text']) ? $_POST['text'] : ''); $postLen = mb_strlen($postText); if($postLen < 10) { $error = 'Post content must be longer than 10 characters.'; } elseif($postLen > 50000) { $error = 'Post content may not be longer than 50000 characters.'; } else { if(!isset($topicInfo)) { $titleLen = mb_strlen($postTitle); if($titleLen < 5) { $error = 'Topic titles must be longer than 5 characters.'; } elseif($titleLen > 100) { $error = 'Topic titles may not be longer than 100 characters.'; } else { $topicId = create_topic($categoryInfo['cat_id'], current_user_id(), $postTitle); if($topicId < 1) { $error = 'Failed to create topic.'; } else { $topicInfo = topic_info($topicId); $satoriMsg = "[b]forum.flash.moe[/b]: [url=https://forum.flash.moe/user/{$userInfo['user_id']}][b]{$userInfo['user_login']}[/b][/url] created topic [url=https://forum.flash.moe/topic/{$topicId}][b]{$topicInfo['topic_title']}[/b][/url]"; } } } if(!isset($error) && !isset($message)) { if(isset($postInfo)) { post_update($postInfo['post_id'], $postText); } else { $postId = create_post($categoryInfo['cat_id'], $topicInfo['topic_id'], current_user_id(), $postText); topic_bump($topicInfo['topic_id'], $postId, !empty($topicInfo['topic_resolved'])); category_bump($categoryInfo['cat_id'], $postId, isset($titleLen)); if(!isset($satoriMsg)) $satoriMsg = "[b]forum.flash.moe[/b]: [url=https://forum.flash.moe/user/{$userInfo['user_id']}][b]{$userInfo['user_login']}[/b][/url] replied to [url=https://forum.flash.moe/post/{$postId}][b]{$topicInfo['topic_title']}[/b][/url]"; } if(defined('SATORI_SECRET') && !empty($satoriMsg)) { $sock = @fsockopen(SATORI_HOST, SATORI_PORT, $errno, $errstr, 2); if($sock) { fwrite($sock, chr(0xF) . hash_hmac('sha256', $satoriMsg, SATORI_SECRET) . $satoriMsg . chr(0xF)); fflush($sock); fclose($sock); } } $postUrl = isset($titleLen) ? "/topic/{$topicInfo['topic_id']}" : "/post/{$postId}"; header("Location: {$postUrl}"); return; } } } include FMF_LAYOUT . '/header.php'; $breadcrumbs = category_breadcrumbs($categoryInfo['cat_id'], empty($topicInfo)); echo 'forum.flash.moe » '; foreach($breadcrumbs as $breadcrumb) printf('%s » ', $breadcrumb['cat_id'], $breadcrumb['cat_name']); echo '

' . ($topicInfo['topic_title'] ?? $categoryInfo['cat_name']) . '

'; ?>
value="" name="title" class="posting-title" tabindex="1"value="Re: " class="posting-title posting-title-disabled" disabled readonly/>
Markdown supported