Обработка статуса статьи draft

This commit is contained in:
Krivchikov Dmitry 2015-09-24 10:41:56 +03:00
parent ee6dc8cc92
commit 585312eb15
2 changed files with 5 additions and 1 deletions

View File

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

View File

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