From: Matthias Schmidt Date: Thu, 9 Jun 2016 17:01:23 +0000 (+0200) Subject: Fix property reset in ArticleAddForm::save() X-Git-Tag: 3.0.0_Beta_1~1468 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=09f0c586242009656f5b8a9d3b16beaa01576b12;p=GitHub%2FWoltLab%2FWCF.git Fix property reset in ArticleAddForm::save() --- 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 */