diff --git a/ground/controllers/ArticleController.php b/ground/controllers/ArticleController.php index c6f240b..7df73b9 100644 --- a/ground/controllers/ArticleController.php +++ b/ground/controllers/ArticleController.php @@ -92,6 +92,10 @@ class ArticleController extends Controller App::error404(); } + if (!$article->id) { + $article->status = 'draft'; + } + App::setConfig('title', 'Редактирование статьи – ' . $article->title . ' – wikipoints.ru'); self::render('articles/edit.php', array( @@ -129,6 +133,7 @@ class ArticleController extends Controller if ($id == 0) { $article->author = App::$user->id; + $article->status = 'draft'; } if (isset($_POST['save']) && $_POST['save'] == 'published') { @@ -136,14 +141,11 @@ class ArticleController extends Controller $article->pubDate = time(); } $article->status = 'published'; - } else { - $article->status = 'draft'; } $article->title = $title ? $title : 'Без названия'; $article->text = $text; $article->html = $html; - $article->status = (isset($_POST['save']) && $_POST['save'] == 'published') ? 'published' : 'draft'; $article->photoId = Helper::getFirstImg($text); $article->allowComments = $allowComments; $article->save(); diff --git a/ground/views/articles/edit.php b/ground/views/articles/edit.php index af21bff..7f749ee 100644 --- a/ground/views/articles/edit.php +++ b/ground/views/articles/edit.php @@ -22,8 +22,10 @@ выйти не сохраняя