From 9469558a36a47f1f4bc6bdc4dfd10e480026a2a8 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Wed, 30 Sep 2015 23:45:27 +0300 Subject: [PATCH] =?UTF-8?q?FIX=20-=20=D0=B4=D0=B0=D1=82=D0=B0=20=D0=BF?= =?UTF-8?q?=D1=83=D0=B1=D0=BB=D0=B8=D0=BA=D0=B0=D0=B9=D0=B8=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/controllers/ArticleController.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ground/controllers/ArticleController.php b/ground/controllers/ArticleController.php index 9f5676d..8fde5fe 100644 --- a/ground/controllers/ArticleController.php +++ b/ground/controllers/ArticleController.php @@ -131,11 +131,19 @@ class ArticleController extends Controller $article->author = App::$user->id; } + if (isset($_POST['save']) && $_POST['save'] == 'published') { + if ($article->status != 'published' || $article->pubDate == 0) { + $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->pubDate = time(); $article->photoId = Helper::getFirstImg($text); $article->allowComments = $allowComments; $article->save();