예제 #1
0
파일: Posts.php 프로젝트: ttym7993/Linger
 public function edit()
 {
     l_h('html_tag.php');
     $this->theme->setBreadcrumb("编辑文章");
     $this->theme->setTitle("编辑文章");
     $id = intval(req()->get('id'));
     $this->__lib('Post');
     $post = new Post($id);
     $info = $post->getInfo(login_user()->getId());
     $this->theme->header_add($this->theme->css(get_bootstrap_plugin_url("markdown/markdown.min.css")));
     $this->theme->header_add($this->theme->js(['src' => get_bootstrap_plugin_url("markdown/markdown.js")]));
     if (!isset($info['post_id']) || $info['post_id'] != $id) {
         $this->__view("User/header.php");
         $this->__view("Posts/not_found.php");
     } else {
         $this->__view("User/header.php");
         $this->__view("Posts/edit.php", ['info' => $info, 'post' => $post]);
     }
     $this->__view("User/footer.php");
 }
예제 #2
0
파일: Show.php 프로젝트: ttym7993/Linger
 public function post_list($page = 0)
 {
     $this->__lib('Post');
     $post = new Post();
     $post->setPager($page, 2);
     $list = $post->getPublicList();
     $count = $post->getCount();
     if (empty($list) || $count['page'] > $count['max']) {
         $this->__load_404();
         return;
     }
     $this->theme->setTitle("文章列表");
     $this->__view("Home/header.php");
     $this->__view("Show/post_list.php", ['list' => $list, 'count' => $count]);
     $this->__view("Home/footer.php");
 }
예제 #3
0
파일: UserApi.php 프로젝트: ttym7993/Linger
 public function post_edit()
 {
     try {
         $this->throwMsgCheck('is_post', 'power/Posts');
         $this->__lib("Post");
         $req = req();
         $post = new Post($req->post('id'));
         $post->update(strip_tags($req->post('title')), strip_tags($req->post('name')), htmlspecialchars($req->post('content'), ENT_NOQUOTES), $req->post('category'), strip_tags($req->post('keyword')), strip_tags($req->post('description')), $req->post('status'), $req->post('allow_comment'), login_user()->getId());
         $this->rt_msg['status'] = true;
     } catch (\Exception $ex) {
         $this->rt_msg['msg'] = $ex->getMessage();
         $this->rt_msg['code'] = $ex->getCode();
     }
 }