From 42144ed21cbc7361857b375d719ec53b24314546 Mon Sep 17 00:00:00 2001 From: msquare Date: Tue, 4 Oct 2016 17:58:56 +0200 Subject: move static access to datetime parse function --- includes/sys_page.php | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'includes/sys_page.php') diff --git a/includes/sys_page.php b/includes/sys_page.php index e62909ab..f20a791c 100644 --- a/includes/sys_page.php +++ b/includes/sys_page.php @@ -1,5 +1,26 @@ getTimestamp(); +} + /** * Leitet den Browser an die übergebene URL weiter und hält das Script an. */ @@ -11,7 +32,8 @@ function redirect($url) { /** * Echoes given output and dies. * - * @param String $output + * @param String $output + * String to display */ function raw_output($output) { echo $output; @@ -20,7 +42,7 @@ function raw_output($output) { /** * Helper function for transforming list of entities into array for select boxes. - * + * * @param array $data * The data array * @param string $key_name @@ -81,8 +103,8 @@ function check_request_date($name, $error_message = null, $null_allowed = false) * @return ValidationResult containing the parsed date */ function check_date($input, $error_message = null, $null_allowed = false) { - if (DateTime::createFromFormat("Y-m-d", trim($input))) { - return new ValidationResult(true, DateTime::createFromFormat("Y-m-d", trim($input))->getTimestamp()); + if ($tmp = parse_date("Y-m-d", trim($input))) { + return new ValidationResult(true, $tmp); } if ($null_allowed) { return new ValidationResult(true, null); -- cgit v1.3.1