$content = $_POST['content']; if (trim($content) == '') { throw new Exception('回复内容不能为空'); } $token = new token($USER); $ok = $token->check($_POST['token']); if (!$ok) { throw new EXception('会话已过期,请重新发布'); } $token->delete(); $bbs = new bbs($USER); $topic = $bbs->topicMeta($tid, 'content_id'); if (!topic) { throw new Exception('帖子不存在或已删除'); } $ok = $bbs->newreply($topic['content_id'], $content); if (!$ok) { throw new Exception('未知原因回复失败,请重试或联系管理员'); } $tpl->display('tpl:replysuccess'); } else { throw new Exception(''); } } catch (Exception $err) { $tpl->assign('err', $err); if ($USER->islogin) { $token = new token($USER); $token->create(); $tpl->assign('token', $token); } $tpl->display('tpl:replyform');