From ac7c42dacc50f0458d428ccb5bab0a8d4ad37272 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 31 Dec 2013 12:13:16 +0100 Subject: [PATCH] Improved editing of old polls --- .../files/lib/system/poll/PollManager.class.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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 -- 2.20.1