FIX - дата публикайии поста

This commit is contained in:
Krivchikov Dmitry 2015-09-30 23:45:27 +03:00
parent ab17fd7452
commit 9469558a36
1 changed files with 9 additions and 1 deletions

View File

@ -131,11 +131,19 @@ class ArticleController extends Controller
$article->author = App::$user->id; $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->title = $title ? $title : 'Без названия';
$article->text = $text; $article->text = $text;
$article->html = $html; $article->html = $html;
$article->status = (isset($_POST['save']) && $_POST['save'] == 'published') ? 'published' : 'draft'; $article->status = (isset($_POST['save']) && $_POST['save'] == 'published') ? 'published' : 'draft';
$article->pubDate = time();
$article->photoId = Helper::getFirstImg($text); $article->photoId = Helper::getFirstImg($text);
$article->allowComments = $allowComments; $article->allowComments = $allowComments;
$article->save(); $article->save();