diff --git a/model/VacationHandler.php b/model/VacationHandler.php index 6126daf3..b3c69676 100644 --- a/model/VacationHandler.php +++ b/model/VacationHandler.php @@ -218,9 +218,15 @@ class VacationHandler extends PFAHandler { public function set_away($subject, $body, $interval_time, $activeFrom, $activeUntil) { $this->remove(); // clean out any notifications that might already have been sent. - $E_username = escape_string($this->username); - $activeFrom = date("Y-m-d 00:00:00", strtotime($activeFrom)); # TODO check if result looks like a valid date - $activeUntil = date("Y-m-d 23:59:59", strtotime($activeUntil)); # TODO check if result looks like a valid date + if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $activeFrom)) { + $activeFrom .= ' 00:00:00'; + } + if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $activeUntil)) { + $activeUntil .= ' 23:59:59'; + } + + $activeFrom = date("Y-m-d H:i", strtotime($activeFrom)); # TODO check if result looks like a valid date + $activeUntil = date("Y-m-d H:i", strtotime($activeUntil)); # TODO check if result looks like a valid date list(/*NULL*/, $domain) = explode('@', $this->username); $vacation_data = array( diff --git a/public/vacation.php b/public/vacation.php index 36558c01..59b662b0 100644 --- a/public/vacation.php +++ b/public/vacation.php @@ -154,7 +154,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { if ($action == 'fChange') { - ## check if ActiveUnitl is not back in time, + ## check if ActiveUntil is not back in time, ## because vacation.pl will report SMTP recipient $smtp_recipient which resolves to $email does not have an active vacation (rv: $rv, email: $email)" ## and will not send message