diff options
Diffstat (limited to 'includes/pages/user_settings.php')
-rw-r--r-- | includes/pages/user_settings.php | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/includes/pages/user_settings.php b/includes/pages/user_settings.php index 20ed3468..466d3c3e 100644 --- a/includes/pages/user_settings.php +++ b/includes/pages/user_settings.php @@ -24,6 +24,8 @@ function user_settings() { $password_hash = ""; $selected_theme = $user['color']; $selected_language = $user['Sprache']; + $planned_arrival_date = $user['planned_arrival_date']; + $planned_departure_date = $user['planned_departure_date']; if (isset($_REQUEST['submit'])) { $ok = true; @@ -54,6 +56,23 @@ function user_settings() { elseif ($enable_tshirt_size) { $ok = 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(); + } else { + $ok = 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(); + } else { + $ok = false; + $msg .= error(_("Please enter your planned date of departure."), true); + } + } else + $planned_departure_date = null; // Trivia if (isset($_REQUEST['lastname'])) @@ -82,10 +101,12 @@ function user_settings() { `DECT`='" . sql_escape($dect) . "', `Handy`='" . sql_escape($mobile) . "', `email`='" . sql_escape($mail) . "', - `email_shiftinfo`='" . sql_escape($email_shiftinfo ? 'TRUE' : 'FALSE') . "', + `email_shiftinfo`=" . sql_bool($email_shiftinfo) . ", `jabber`='" . sql_escape($jabber) . "', `Size`='" . sql_escape($tshirt_size) . "', - `Hometown`='" . sql_escape($hometown) . "' + `Hometown`='" . sql_escape($hometown) . "', + `planned_arrival_date`='" . sql_escape($planned_arrival_date) . "', + `planned_departure_date`=" . sql_null($planned_departure_date) . " WHERE `UID`='" . sql_escape($user['UID']) . "'"); success(_("Settings saved.")); @@ -144,9 +165,11 @@ function user_settings() { form(array( form_info('', _("Here you can change your user details.")), form_info(entry_required() . ' = ' . _("Entry required!")), - form_text('nick', _("Nick") . ' ' . entry_required(), $nick, true), + form_text('nick', _("Nick"), $nick, true), form_text('lastname', _("Last name"), $lastname), form_text('prename', _("First name"), $prename), + form_date('planned_arrival_date', _("Planned date of arrival") . ' ' . entry_required(), $planned_arrival_date, time()), + form_date('planned_departure_date', _("Planned date of departure"), $planned_departure_date, time()), form_text('age', _("Age"), $age), form_text('tel', _("Phone"), $tel), form_text('dect', _("DECT"), $dect), |