From 585312eb15ea6b5b892c0a49af7ac120c9a04234 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Thu, 24 Sep 2015 10:41:56 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=81=D1=82=D0=B0=D1=82=D1=83=D1=81=D0=B0=20?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D1=82=D1=8C=D0=B8=20draft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/controllers/ArticleController.php | 4 ++++ ground/controllers/IndexController.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ground/controllers/ArticleController.php b/ground/controllers/ArticleController.php index 6bbb75c..77dda91 100644 --- a/ground/controllers/ArticleController.php +++ b/ground/controllers/ArticleController.php @@ -27,6 +27,10 @@ class ArticleController extends Controller App::error404(); } + if ($article->status == 'draft' && (!App::$user || App::$user->id != $article->author)) { + App::error404(); + } + App::setConfig('title', $article->title . ' – wikipoints.ru'); $article->html = Helper::replaceLinks($article->html, 'html'); $article->html = Helper::replaceImgs($article->html, 'html'); diff --git a/ground/controllers/IndexController.php b/ground/controllers/IndexController.php index 07daac7..6303b9d 100644 --- a/ground/controllers/IndexController.php +++ b/ground/controllers/IndexController.php @@ -154,7 +154,7 @@ class IndexController extends Controller $url->addChild('changefreq', "daily"); $url->addChild('priority', "0.9"); - $articles = Article::model()->getAll(array('where'=>'`author` != 0', 'order' => 'ID DESC', 'asArray' => true)); + $articles = Article::model()->getAll(array('where'=>'`author` != 0 AND (`status` = "published" OR `status` = "system") ', 'order' => 'ID DESC', 'asArray' => true)); foreach ($articles as $article) { $url = $xml->addChild('url'); $url->addChild('loc', 'http://wikipoints.ru/article/' . $article['id']);