Ejemplo n.º 1
0
 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");
 }
Ejemplo n.º 2
0
 public function post($name = NULL, $c_p = 0)
 {
     $this->__lib('Post', 'PostComment');
     $post = new Post(NULL, $name);
     $info = $post->getInfo();
     if (!isset($info['post_id']) || $info['post_status'] != 1 && !(is_login() && $info['post_users_id'] == login_user()->getId() && strtolower(req()->get('preview')) == 'true')) {
         $this->__load_404();
     } else {
         $this->theme->setTitle($info['post_title'] . " - 文章");
         $this->__view("Home/header.php");
         $this->__view("Show/post.php", ['info' => $info, 'user' => $post->getPostUser(), 'CommentData' => new PostComment($info['post_id'], $c_p, $info)]);
         $this->__view("Home/footer.php");
     }
 }