diff options
author | Joas Schilling <coding@schilljs.com> | 2016-08-01 17:05:40 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2016-08-01 17:19:05 +0200 |
commit | ea4c6bd28568bce811c275d46478f44455cf237d (patch) | |
tree | a00a46f4ffe571d53a3682c1e8ebe33b8562bb5b /apps/workflowengine/lib/Check | |
parent | 2734ff7d4ee2f3b16a8dc3759c2c4abafe2f608c (diff) | |
download | nextcloud-server-ea4c6bd28568bce811c275d46478f44455cf237d.tar.gz nextcloud-server-ea4c6bd28568bce811c275d46478f44455cf237d.zip |
Load the timezones via select2
Diffstat (limited to 'apps/workflowengine/lib/Check')
-rw-r--r-- | apps/workflowengine/lib/Check/RequestTime.php | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/apps/workflowengine/lib/Check/RequestTime.php b/apps/workflowengine/lib/Check/RequestTime.php index 4457f9d038c..a114819d450 100644 --- a/apps/workflowengine/lib/Check/RequestTime.php +++ b/apps/workflowengine/lib/Check/RequestTime.php @@ -29,7 +29,7 @@ use OCP\WorkflowEngine\ICheck; class RequestTime implements ICheck { const REGEX_TIME = '([0-1][0-9]|2[0-3]):([0-5][0-9])'; - const REGEX_TIMEZONE = '([a-zA-Z]+(?:\\\\\\/[a-zA-Z\-\_]+)+)'; + const REGEX_TIMEZONE = '([a-zA-Z]+(?:\\/[a-zA-Z\-\_]+)+)'; /** @var bool[] */ protected $cachedResults; @@ -110,16 +110,15 @@ class RequestTime implements ICheck { throw new \UnexpectedValueException('Invalid time limits', 2); } - try { - new \DateTimeZone(stripslashes($matches[3])); - } catch(\Exception $e) { - throw new \UnexpectedValueException('Invalid timezone1', 3); + $values = json_decode($value, true); + $time1 = \DateTime::createFromFormat('H:i e', $values[0]); + if ($time1 === false) { + throw new \UnexpectedValueException('Invalid start time given', 3); } - try { - new \DateTimeZone(stripslashes($matches[6])); - } catch(\Exception $e) { - throw new \UnexpectedValueException('Invalid timezone2', 3); + $time2 = \DateTime::createFromFormat('H:i e', $values[1]); + if ($time2 === false) { + throw new \UnexpectedValueException('Invalid end time given', 3); } } } |