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']);