public function store() { $article = Model\Article::findOrFail(set_value('article_id')); $this->form_validation->set_rules('name', 'Name', 'required'); $this->form_validation->set_rules('email', 'Email', 'required|valid_email'); $this->form_validation->set_rules('content', 'Komentar', 'required'); $this->form_validation->set_rules('article_id', 'Artikel', 'required'); if ($this->form_validation->run() == FALSE) { if ($this->request->isXmlHttpRequest()) { $response = new Response(); $response->setContent(json_encode(['status' => 'error', 'data' => $this->form_validation->error_array()])); $response->headers->set('Content-Type', 'application/json'); } else { keepValidationErrors(); redirect($article->link . '#comment-title', 'refresh'); } } else { $data = array('content' => set_value('content'), 'nama' => set_value('name'), 'email' => set_value('email'), 'artikel_id' => set_value('article_id'), 'parent' => set_value('parent', 0), 'date' => Carbon::now()); $comment = Model\Comment::create($data); if (auth()->loginCheck()) { $comment->user()->associate(auth()->user()->id); $comment->save(); } if ($this->request->isXmlHttpRequest()) { $response = new Response(); $response->setContent(json_encode(['status' => 'success', 'data' => $comment])); $response->headers->set('Content-Type', 'application/json'); } else { redirect($article->link . '#comment-' . $comment->id, 'refresh'); } } }
public function indexAction() { $category_id = Comm\Arg::post('category_id'); $title = Comm\Arg::post('title'); $content = Comm\Arg::post('content'); Model\Article::create($category_id, $title, $content); Comm\Response::json(100000, '发表成功', ['href' => Comm\View::path('manage/article/index')], false); }
public function indexAction() { $id = Comm\Arg::post('id', FILTER_VALIDATE_INT); $article = Model\Article::show($id); if (!$article) { throw new Exception\Msg('发布文章为空'); } $result = Model\Publish::article($article); Comm\Response::json(100000, 'succ', ['result' => $result], false); }
public function indexAction() { $theme = Comm\Arg::get('theme', FILTER_VALIDATE_INT, ['min_range' => 0], true); $resource = Comm\Arg::get('resource', FILTER_DEFAULT, null, true); Yaf_Registry::set('tpl_id', $theme); switch ($resource) { //预览首页 case 'home': $pager = new Comm\Pager(1000, 20, 1); $articles = Model\Article::showUserList($pager); Model\Publish::home($articles, $pager, null, false); break; //预览分类下的文章列表 //预览分类下的文章列表 case 'article-list': $pager = new Comm\Pager(1000, 20, 1); $articles = Model\Article::showUserList(new Comm\Pager(1, 1, 1)); if (!$articles) { throw new Exception\Msg(_('至少发表一篇文章才可预览')); } $article = reset($articles['result']); $category = Model\Category::show($article['category_id']); $articles = Model\Article::showUserList($pager, false, $category['id']); $articles = isset($articles['result']) ? $articles['result'] : array(); Model\Publish::categoryArticleList($category, $articles, $pager, null, false); break; //预览文章 //预览文章 case 'article': $articles = Model\Article::showUserList(new Comm\Pager(1, 1, 1)); $article = reset($articles['result']); Model\Publish::article($article, false); break; //预览导航 //预览导航 case 'sidebar': Model\Publish::sidebar(false, false); break; default: throw new \Exception\Msg('本资源不支持预览'); } }
public function indexAction() { $last_page = Comm\Arg::get('last_page', FILTER_VALIDATE_INT, ['min_range' => 1]) ?: 0; $page = Comm\Arg::get('p', FILTER_VALIDATE_INT, ['min_range' => 1]) ?: 1; $uid = Yaf_Registry::get('current_uid'); //获取总数 $total = Model\Counter\Article::get(0, $uid); //获取用户的博客配置中的分页设置 $blog = Model\Blog::show(); empty($blog['data']['page_count']) || ($this->_limit = $blog['data']['page_count']); //获取分页参数 $pager = new \Comm\Pager($total, $this->_limit); //获取数据 $articles = Model\Article::showUserList($pager); //获取分类内容 $categorys = Model\Category::showUserAll(); $categorys = Comm\Arr::hashmap($categorys, 'id'); //获取用户博客基本地址 $blog_url = 'http://' . \Model\Github::showDefaultBlogRepoName(); $this->viewDisplay(array('articles' => $articles, 'categorys' => $categorys, 'pager' => $pager, 'blog_url' => $blog_url)); }
<?php require_once "Config/Config.php"; $article = new Model\Article(); if (isset($_GET)) { if ($_GET["seo"] != NULL) { $post = $article->GetArticleElementsByReference($_GET["seo"]); } } ?> <!DOCTYPE html> <html lang="es"> <head> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta charset="UTF-8"> <title><?php echo $post["title"] . " - " . $titleWeb; ?> </title> <meta name="description" content=""> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="<?php echo $urlWeb; ?> /public/css/flexboxgrid.min.css" /> <link rel="stylesheet" href="<?php echo $urlWeb; ?> /public/css/styles.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"> <!-- Javascript -->
public function indexAction() { $id = Comm\Arg::post('id'); $result = Model\Article::destory($id); Comm\Response::json(100000, _('删除成功'), null, false); }
?> "><?php echo $article->title; ?> </a></h4> </div> </div> </div> </div> <?php } ?> </div> <div class="tab-pane fade" id="latest-post" role="tabpanel" aria-labelledby="latest-post-tab" aria-expanded="false"> <?php foreach (Model\Article::latest('date')->limit(5)->get() as $article) { ?> <div class="box-articles-widget"> <div class="row"> <div class="col-sm-4 col-xs-6"> <div class="box-articles-widget-img"> <a href="<?php echo $article->link; ?> "><img src="<?php echo $article->featured_image; ?> " alt=""></a> </div> </div> <div class="col-sm-8 col-xs-6">