From: Alexander Ebert Date: Tue, 31 Dec 2013 11:13:16 +0000 (+0100) Subject: Improved editing of old polls X-Git-Tag: 2.0.1~13^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ac7c42dacc50f0458d428ccb5bab0a8d4ad37272;p=GitHub%2FWoltLab%2FWCF.git Improved editing of old polls --- diff --git a/wcfsetup/install/files/lib/system/poll/PollManager.class.php b/wcfsetup/install/files/lib/system/poll/PollManager.class.php index 1f6b8c305f..a72d31ff7e 100644 --- a/wcfsetup/install/files/lib/system/poll/PollManager.class.php +++ b/wcfsetup/install/files/lib/system/poll/PollManager.class.php @@ -204,9 +204,18 @@ class PollManager extends SingletonFactory { return; } - // end time is in the past - if ($this->pollData['endTime'] != 0 && $this->pollData['endTime'] <= TIME_NOW && ($this->poll === null || $this->poll->endTime != $this->pollData['endTime'])) { - throw new UserInputException('pollEndTime', 'notValid'); + if ($this->pollData['endTime'] && $this->pollData['endTime'] <= TIME_NOW) { + if ($this->poll === null) { + // end time is in the past + throw new UserInputException('pollEndTime', 'notValid'); + } + else { + // check if the difference to the stored time is less than 60 minutes (editing an old poll) + $difference = abs($this->poll->endTime - $this->pollData['endTime']); + if ($difference > 3599) { + throw new UserInputException('pollEndTime', 'notValid'); + } + } } // no options given