if (!empty($go)) { $title = $_POST['title']; $content = $_POST['content']; if (trim($title) == '') { throw new Exception('标题不能为空'); } 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); $ok = $bbs->newtopic($fid, $title, $content); if (!$ok) { throw new Exception('未知原因发帖失败,请重试或联系管理员'); } $tpl->assign('tid', $ok); $tpl->display('tpl:topicsuccess'); } else { throw new Exception(''); } } catch (Exception $err) { $tpl->assign('err', $err); if ($USER->islogin) { $token = new token($USER); $token->create(); $tpl->assign('token', $token);
<?php $tpl = $PAGE->start(); $USER->start($tpl); $bbs = new bbs($USER); //获取论坛id $fid = (int) $PAGE->ext[0]; if ($fid < 0) { $fid = 0; } $tpl->assign('fid', $fid); //获取帖子id $tid = (int) $PAGE->ext[1]; $tpl->assign('tid', $tid); //获取帖子页码 $p = (int) $PAGE->ext[2]; if ($p < 1) { $p = 1; } $tpl->assign('p', $p); //读取父版块信息 $fIndex = $bbs->fatherForumMeta($fid, 'id,name,parent_id,notopic'); $tpl->assign('fName', $fIndex[count($fIndex) - 1]['name']); $tpl->assign('fIndex', $fIndex); //读取帖子元信息 $tMeta = $bbs->topicMeta($tid, 'title,read_count,uid,ctime,mtime', 'WHERE id=?', $fid); if (!$tMeta) { throw new bbsException('帖子 id=' . $tid . ' 不存在!', 2404); } $tpl->assign('tMeta', $tMeta); //读取帖子内容
<?php $tpl = $PAGE->start(); $USER->start($tpl); //$tpl->force_compile=true; $bbs = new bbs($USER); $forumInfo = $bbs->plateForum(); $tpl->assign('forumInfo', $forumInfo); $newTopicC = $bbs->newTopicC(); $tpl->assign('newTopicC', $newTopicC); $tpl->display('tpl:index');
<?php $tpl = $PAGE->start(); $USER->start($tpl); $bbs = new bbs($USER); if (!$USER->islogin || $USER->uid != 1 && $USER->uid != 2) { die('403 Forbidden'); } switch ($PAGE->ext[0]) { case 'createbk': if ($_POST['yes'] && $_POST['name']) { if (!$_POST['parent_id']) { $pid = 0; } else { $pid = $_POST['parent_id']; } $ok = $bbs->createbk($_POST['name'], $pid, $_POST['bz']); if (!$ok) { throw new Exception('未知原因发帖失败,请重试或联系管理员'); } } $arr = $bbs->plate(); $array['父版块'] = 0; foreach ($arr as $v) { $array['父版块:' . $v['name']] = $v['id']; } break; case 'bk': if ($_POST['sc']) { } elseif ($_POST['xg']) { $xg = $bbs->scxg($_POST['bbid'], 'xg');
} $tpl->assign('tMeta', $tMeta); //回帖操作 $go = $_POST['go']; if (!empty($go)) { $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) {