From 09f0c586242009656f5b8a9d3b16beaa01576b12 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 9 Jun 2016 19:01:23 +0200 Subject: [PATCH] Fix property reset in ArticleAddForm::save() --- .../lib/acp/form/ArticleAddForm.class.php | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/ArticleAddForm.class.php b/wcfsetup/install/files/lib/acp/form/ArticleAddForm.class.php index 383eea3277..4df62712a2 100644 --- a/wcfsetup/install/files/lib/acp/form/ArticleAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/ArticleAddForm.class.php @@ -351,10 +351,12 @@ class ArticleAddForm extends AbstractForm { WCF::getTPL()->assign('success', true); // reset variables - $this->username = $this->publicationDate = ''; + $this->publicationDate = ''; $this->categoryID = 0; $this->publicationStatus = $this->enableComments = 1; $this->title = $this->teaser = $this->content = $this->images = $this->imageID = $this->tags = []; + + $this->setDefaultValues(); } /** @@ -364,13 +366,20 @@ class ArticleAddForm extends AbstractForm { parent::readData(); if (empty($_POST)) { - $this->username = WCF::getUser()->username; - $dateTime = DateUtil::getDateTimeByTimestamp(TIME_NOW); - $dateTime->setTimezone(WCF::getUser()->getTimeZone()); - $this->time = $dateTime->format('c'); + $this->setDefaultValues(); } - } - + } + + /** + * Sets the default values of properties. + */ + protected function setDefaultValues() { + $this->username = WCF::getUser()->username; + $dateTime = DateUtil::getDateTimeByTimestamp(TIME_NOW); + $dateTime->setTimezone(WCF::getUser()->getTimeZone()); + $this->time = $dateTime->format('c'); + } + /** * @inheritDoc */ -- 2.20.1