function create() { if (!empty($_POST)) { $_tree = model('WikiTree'); $in['text'] = $_POST['title']; $id = intval($_GET['id']); if ($id == 0) { $in['pid'] = 0; $in['project_id'] = $_COOKIE['wiki_project_id']; } else { $cnode = $_tree->get($id)->get(); //作为父页面 if (isset($_GET['parent'])) { $in['pid'] = $id; } else { $in['pid'] = empty($cnode) ? 0 : $cnode['pid']; } if (!empty($_POST['link'])) { $in['link'] = trim($_POST['link']); } $in['project_id'] = $cnode['project_id']; } $_POST['id'] = $_tree->put($in); App\Content::newPage($_POST); $this->reflushPage('增加成功'); } else { $this->isUseEditor(); $form['comment'] = Swoole\Form::radio('close_comment', array('0' => '开启', '1' => '关闭'), 0, false, null, 'radio-inline'); $form['order_by_time'] = Swoole\Form::radio('order_by_time', array('0' => '手工排序', '1' => '按添加时间自动排序'), 0, false, null, 'radio-inline'); $this->assign("page", array()); $this->assign("form", $form); $this->display("wiki/create.php"); } }