diff options
Diffstat (limited to 'includes/pages')
-rw-r--r-- | includes/pages/admin_import.php | 4 | ||||
-rw-r--r-- | includes/pages/admin_shifts.php | 14 | ||||
-rw-r--r-- | includes/pages/guest_login.php | 4 | ||||
-rw-r--r-- | includes/pages/user_settings.php | 8 | ||||
-rw-r--r-- | includes/pages/user_shifts.php | 7 |
5 files changed, 17 insertions, 20 deletions
diff --git a/includes/pages/admin_import.php b/includes/pages/admin_import.php index 2c36e681..4af09dca 100644 --- a/includes/pages/admin_import.php +++ b/includes/pages/admin_import.php @@ -312,8 +312,8 @@ function prepare_events($file, $shifttype_id, $add_minutes_start, $add_minutes_e 'event-id' }); $shifts_pb[$event_id] = [ 'shifttype_id' => $shifttype_id, - 'start' => DateTime::createFromFormat("Ymd\THis", $event->dtstart)->getTimestamp() - $add_minutes_start * 60, - 'end' => DateTime::createFromFormat("Ymd\THis", $event->dtend)->getTimestamp() + $add_minutes_end * 60, + 'start' => parse_date("Ymd\THis", $event->dtstart) - $add_minutes_start * 60, + 'end' => parse_date("Ymd\THis", $event->dtend) + $add_minutes_end * 60, 'RID' => $rooms_import[trim($event->location)], 'title' => trim($event->summary), 'URL' => trim($event->url), diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php index 3dd22f3a..42a8c682 100644 --- a/includes/pages/admin_shifts.php +++ b/includes/pages/admin_shifts.php @@ -9,7 +9,7 @@ function admin_shifts() { $valid = true; $rid = 0; - $start = DateTime::createFromFormat("Y-m-d H:i", date("Y-m-d") . " 00:00")->getTimestamp(); + $start = parse_date("Y-m-d H:i", date("Y-m-d") . " 00:00"); $end = $start; $mode = 'single'; $angelmode = 'manually'; @@ -71,15 +71,15 @@ function admin_shifts() { error(_('Please select a location.')); } - if (isset($_REQUEST['start']) && $tmp = DateTime::createFromFormat("Y-m-d H:i", trim($_REQUEST['start']))) { - $start = $tmp->getTimestamp(); + if (isset($_REQUEST['start']) && $tmp = parse_date("Y-m-d H:i", $_REQUEST['start'])) { + $start = $tmp; } else { $valid = false; error(_('Please select a start time.')); } - if (isset($_REQUEST['end']) && $tmp = DateTime::createFromFormat("Y-m-d H:i", trim($_REQUEST['end']))) { - $end = $tmp->getTimestamp(); + if (isset($_REQUEST['end']) && $tmp = parse_date("Y-m-d H:i", $_REQUEST['end'])) { + $end = $tmp; } else { $valid = false; error(_('Please select an end time.')); @@ -188,7 +188,7 @@ function admin_shifts() { } while ($shift_end < $end); } elseif ($mode == 'variable') { rsort($change_hours); - $day = DateTime::createFromFormat("Y-m-d H:i", date("Y-m-d", $start) . " 00:00")->getTimestamp(); + $day = parse_date("Y-m-d H:i", date("Y-m-d", $start) . " 00:00"); $change_index = 0; // Ersten/nächsten passenden Schichtwechsel suchen foreach ($change_hours as $i => $change_hour) { @@ -205,7 +205,7 @@ function admin_shifts() { $shift_start = $start; do { - $day = DateTime::createFromFormat("Y-m-d H:i", date("Y-m-d", $shift_start) . " 00:00")->getTimestamp(); + $day = parse_date("Y-m-d H:i", date("Y-m-d", $shift_start) . " 00:00"); $shift_end = $day + $change_hours[$change_index] * 60 * 60; if ($shift_end > $end) { diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php index 1f1b7ab2..9f688321 100644 --- a/includes/pages/guest_login.php +++ b/includes/pages/guest_login.php @@ -104,8 +104,8 @@ function guest_register() { $msg .= error(sprintf(_("Your password is too short (please use at least %s characters)."), MIN_PASSWORD_LENGTH), true); } - if (isset($_REQUEST['planned_arrival_date']) && DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_arrival_date']))) { - $planned_arrival_date = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_arrival_date']))->getTimestamp(); + if (isset($_REQUEST['planned_arrival_date']) && $tmp = parse_date("Y-m-d", $_REQUEST['planned_arrival_date'])) { + $planned_arrival_date = $tmp; } else { $valid = false; $msg .= error(_("Please enter your planned date of arrival."), true); diff --git a/includes/pages/user_settings.php b/includes/pages/user_settings.php index b2ea5752..22ead68b 100644 --- a/includes/pages/user_settings.php +++ b/includes/pages/user_settings.php @@ -56,16 +56,16 @@ function user_settings() { $valid = false; } - if (isset($_REQUEST['planned_arrival_date']) && DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_arrival_date']))) { - $planned_arrival_date = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_arrival_date']))->getTimestamp(); + if (isset($_REQUEST['planned_arrival_date']) && $tmp = parse_date("Y-m-d", $_REQUEST['planned_arrival_date'])) { + $planned_arrival_date = $tmp; } else { $valid = false; $msg .= error(_("Please enter your planned date of arrival."), true); } if (isset($_REQUEST['planned_departure_date']) && $_REQUEST['planned_departure_date'] != '') { - if (DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_departure_date']))) { - $planned_departure_date = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['planned_departure_date']))->getTimestamp(); + if ($tmp = parse_date("Y-m-d", $_REQUEST['planned_departure_date'])) { + $planned_departure_date = $tmp; } else { $valid = false; $msg .= error(_("Please enter your planned date of departure."), true); diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index ad211181..8b6dd1fc 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -75,11 +75,8 @@ function update_ShiftsFilter(ShiftsFilter $shiftsFilter, $user_shifts_admin, $da $end_time = "23:59"; } - $startdatetime = DateTime::createFromFormat("Y-m-d H:i", $start_day . " " . $start_time); - $shiftsFilter->setStartTime($startdatetime->getTimestamp()); - - $enddatetime = DateTime::createFromFormat("Y-m-d H:i", $end_day . " " . $end_time); - $shiftsFilter->setEndTime($enddatetime->getTimestamp()); + $shiftsFilter->setStartTime(parse_date("Y-m-d H:i", $start_day . " " . $start_time)); + $shiftsFilter->setEndTime(parse_date("Y-m-d H:i", $end_day . " " . $end_time)); } return $shiftsFilter; |