From faa864b88d0e82bb2e911a0391f9fdcf12fa5224 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Sat, 26 Apr 2014 13:22:40 +0200 Subject: [PATCH] Fixed time zone issue --- com.woltlab.wcf/templates/__messageFormPoll.tpl | 2 +- .../install/files/lib/system/poll/PollManager.class.php | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/com.woltlab.wcf/templates/__messageFormPoll.tpl b/com.woltlab.wcf/templates/__messageFormPoll.tpl index 943ea4d425..d3aca6a9f0 100644 --- a/com.woltlab.wcf/templates/__messageFormPoll.tpl +++ b/com.woltlab.wcf/templates/__messageFormPoll.tpl @@ -40,7 +40,7 @@
- + {if $errorField == 'pollEndTime'} {lang}wcf.poll.endTime.error.{@$errorType}{/lang} diff --git a/wcfsetup/install/files/lib/system/poll/PollManager.class.php b/wcfsetup/install/files/lib/system/poll/PollManager.class.php index d86a6db3d9..a52be2dfa4 100644 --- a/wcfsetup/install/files/lib/system/poll/PollManager.class.php +++ b/wcfsetup/install/files/lib/system/poll/PollManager.class.php @@ -161,10 +161,8 @@ class PollManager extends SingletonFactory { // poll data if (isset($_POST['pollEndTime'])) { - $endTime = StringUtil::trim($_POST['pollEndTime']); - $endTime = (!empty($endTime)) ? @strtotime($endTime . ':00') : ''; - - $this->pollData['endTime'] = ($endTime) ?: 0; + $d = \DateTime::createFromFormat('Y-m-d H:i', $_POST['pollEndTime'], WCF::getUser()->getTimeZone()); + $this->pollData['endTime'] = ($d !== false) ? $d->getTimestamp() : 0; } if (isset($_POST['pollMaxVotes'])) $this->pollData['maxVotes'] = max(intval($_POST['pollMaxVotes']), 1); // force a minimum of 1 -- 2.20.1