summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2016-09-29 12:08:12 +0200
committermsquare <msquare@notrademark.de>2016-09-29 12:08:12 +0200
commitf05f1a3cd4cc3a9fa6021d2c5feedd7e734973ba (patch)
treed1c2404dc56f6d1d0a3ed402d0a3880e77b70a17 /includes
parent81e5a6482c340d3013c9fce54c10ef1a72a5a930 (diff)
rename to
Diffstat (limited to 'includes')
-rw-r--r--includes/controller/angeltypes_controller.php6
-rw-r--r--includes/controller/event_config_controller.php20
-rw-r--r--includes/controller/shifttypes_controller.php6
-rw-r--r--includes/controller/user_angeltypes_controller.php6
-rw-r--r--includes/controller/user_driver_licenses_controller.php6
-rw-r--r--includes/controller/users_controller.php30
-rw-r--r--includes/pages/admin_active.php6
-rw-r--r--includes/pages/admin_import.php18
-rw-r--r--includes/pages/admin_rooms.php12
-rw-r--r--includes/pages/admin_shifts.php32
-rw-r--r--includes/pages/guest_login.php34
-rw-r--r--includes/pages/user_myshifts.php6
-rw-r--r--includes/pages/user_settings.php30
-rw-r--r--includes/pages/user_shifts.php16
-rw-r--r--includes/sys_page.php8
15 files changed, 118 insertions, 118 deletions
diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php
index eeb42d75..92d1d8ee 100644
--- a/includes/controller/angeltypes_controller.php
+++ b/includes/controller/angeltypes_controller.php
@@ -133,13 +133,13 @@ function angeltype_edit_controller() {
$coordinator_mode = ! in_array('admin_angel_types', $privileges);
if (isset($_REQUEST['submit'])) {
- $ok = true;
+ $valid = true;
if (! $coordinator_mode) {
if (isset($_REQUEST['name'])) {
list($valid, $name) = AngelType_validate_name($_REQUEST['name'], $angeltype);
if (! $valid) {
- $ok = false;
+ $valid = false;
error(_("Please check the name. Maybe it already exists."));
}
}
@@ -152,7 +152,7 @@ function angeltype_edit_controller() {
$description = strip_request_item_nl('description');
}
- if ($ok) {
+ if ($valid) {
if (isset($angeltype)) {
$result = AngelType_update($angeltype['id'], $name, $restricted, $description, $requires_driver_license);
if ($result === false) {
diff --git a/includes/controller/event_config_controller.php b/includes/controller/event_config_controller.php
index dc789ca6..2e5175e9 100644
--- a/includes/controller/event_config_controller.php
+++ b/includes/controller/event_config_controller.php
@@ -32,7 +32,7 @@ function event_config_edit_controller() {
}
if (isset($_REQUEST['submit'])) {
- $ok = true;
+ $valid = true;
if (isset($_REQUEST['event_name'])) {
$event_name = strip_request_item('event_name');
@@ -50,41 +50,41 @@ function event_config_edit_controller() {
$result = check_request_date('buildup_start_date', _("Please enter buildup start date."), true);
$buildup_start_date = $result->getValue();
- $ok &= $result->isOk();
+ $valid &= $result->isOk();
$result = check_request_date('event_start_date', _("Please enter event start date."), true);
$event_start_date = $result->getValue();
- $ok &= $result->isOk();
+ $valid &= $result->isOk();
$result = check_request_date('event_end_date', _("Please enter event end date."), true);
$event_end_date = $result->getValue();
- $ok &= $result->isOk();
+ $valid &= $result->isOk();
$result = check_request_date('teardown_end_date', _("Please enter teardown end date."), true);
$teardown_end_date = $result->getValue();
- $ok &= $result->isOk();
+ $valid &= $result->isOk();
if ($buildup_start_date != null && $event_start_date != null && $buildup_start_date > $event_start_date) {
- $ok = false;
+ $valid = false;
error(_("The buildup start date has to be before the event start date."));
}
if ($event_start_date != null && $event_end_date != null && $event_start_date > $event_end_date) {
- $ok = false;
+ $valid = false;
error(_("The event start date has to be before the event end date."));
}
if ($event_end_date != null && $teardown_end_date != null && $event_end_date > $teardown_end_date) {
- $ok = false;
+ $valid = false;
error(_("The event end date has to be before the teardown end date."));
}
if ($buildup_start_date != null && $teardown_end_date != null && $buildup_start_date > $teardown_end_date) {
- $ok = false;
+ $valid = false;
error(_("The buildup start date has to be before the teardown end date."));
}
- if ($ok) {
+ if ($valid) {
$result = EventConfig_update($event_name, $buildup_start_date, $event_start_date, $event_end_date, $teardown_end_date, $event_welcome_msg);
if ($result === false) {
diff --git a/includes/controller/shifttypes_controller.php b/includes/controller/shifttypes_controller.php
index 5380389e..88feffed 100644
--- a/includes/controller/shifttypes_controller.php
+++ b/includes/controller/shifttypes_controller.php
@@ -68,12 +68,12 @@ function shifttype_edit_controller() {
}
if (isset($_REQUEST['submit'])) {
- $ok = true;
+ $valid = true;
if (isset($_REQUEST['name']) && $_REQUEST['name'] != '') {
$name = strip_request_item('name');
} else {
- $ok = false;
+ $valid = false;
error(_('Please enter a name.'));
}
@@ -87,7 +87,7 @@ function shifttype_edit_controller() {
$description = strip_request_item_nl('description');
}
- if ($ok) {
+ if ($valid) {
if ($shifttype_id) {
$result = ShiftType_update($shifttype_id, $name, $angeltype_id, $description);
if ($result === false) {
diff --git a/includes/controller/user_angeltypes_controller.php b/includes/controller/user_angeltypes_controller.php
index e0c0b38f..cdd6f951 100644
--- a/includes/controller/user_angeltypes_controller.php
+++ b/includes/controller/user_angeltypes_controller.php
@@ -336,18 +336,18 @@ function user_angeltype_add_controller() {
}
if (isset($_REQUEST['submit'])) {
- $ok = true;
+ $valid = true;
if (isset($_REQUEST['user_id']) && in_array($_REQUEST['user_id'], array_map(function ($user) {
return $user['UID'];
}, $users_source))) {
$user_id = $_REQUEST['user_id'];
} else {
- $ok = false;
+ $valid = false;
error(_("Please select a user."));
}
- if ($ok) {
+ if ($valid) {
foreach ($users_source as $user_source) {
if ($user_source['UID'] == $user_id) {
$user_angeltype_id = UserAngelType_create($user_source, $angeltype);
diff --git a/includes/controller/user_driver_licenses_controller.php b/includes/controller/user_driver_licenses_controller.php
index 62e491f1..d1c770ba 100644
--- a/includes/controller/user_driver_licenses_controller.php
+++ b/includes/controller/user_driver_licenses_controller.php
@@ -109,7 +109,7 @@ function user_driver_license_edit_controller() {
}
if (isset($_REQUEST['submit'])) {
- $ok = true;
+ $valid = true;
$wants_to_drive = isset($_REQUEST['wants_to_drive']);
$has_car = isset($_REQUEST['has_car']);
$has_license_car = isset($_REQUEST['has_license_car']);
@@ -119,11 +119,11 @@ function user_driver_license_edit_controller() {
$has_license_forklift = isset($_REQUEST['has_license_forklift']);
if ($wants_to_drive && ! $has_license_car && ! $has_license_3_5t_transporter && ! $has_license_7_5t_truck && ! $has_license_12_5t_truck && ! $has_license_forklift) {
- $ok = false;
+ $valid = false;
error(_("Please select at least one driving license."));
}
- if ($ok) {
+ if ($valid) {
if (! $wants_to_drive && $user_driver_license != null) {
$result = UserDriverLicenses_delete($user_source['UID']);
if ($result === false) {
diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php
index 512a5723..ca1b8c8d 100644
--- a/includes/controller/users_controller.php
+++ b/includes/controller/users_controller.php
@@ -52,14 +52,14 @@ function user_delete_controller() {
}
if (isset($_REQUEST['submit'])) {
- $ok = true;
+ $valid = true;
if (! (isset($_REQUEST['password']) && verify_password($_REQUEST['password'], $user['Passwort'], $user['UID']))) {
- $ok = false;
+ $valid = false;
error(_("Your password is incorrect. Please try it again."));
}
- if ($ok) {
+ if ($valid) {
$result = User_delete($user_source['UID']);
if ($result === false) {
engelsystem_error('Unable to delete user.');
@@ -109,16 +109,16 @@ function user_edit_vouchers_controller() {
}
if (isset($_REQUEST['submit'])) {
- $ok = true;
+ $valid = true;
if (isset($_REQUEST['vouchers']) && test_request_int('vouchers') && trim($_REQUEST['vouchers']) >= 0) {
$vouchers = trim($_REQUEST['vouchers']);
} else {
- $ok = false;
+ $valid = false;
error(_("Please enter a valid number of vouchers."));
}
- if ($ok) {
+ if ($valid) {
$user_source['got_voucher'] = $vouchers;
$result = User_update($user_source);
@@ -225,19 +225,19 @@ function user_password_recovery_controller() {
}
if (isset($_REQUEST['submit'])) {
- $ok = true;
+ $valid = true;
if (isset($_REQUEST['password']) && strlen($_REQUEST['password']) >= MIN_PASSWORD_LENGTH) {
if ($_REQUEST['password'] != $_REQUEST['password2']) {
- $ok = false;
+ $valid = false;
error(_("Your passwords don't match."));
}
} else {
- $ok = false;
+ $valid = false;
error(_("Your password is to short (please use at least 6 characters)."));
}
- if ($ok) {
+ if ($valid) {
$result = set_password($user_source['UID'], $_REQUEST['password']);
if ($result === false) {
engelsystem_error(_("Password could not be updated."));
@@ -251,7 +251,7 @@ function user_password_recovery_controller() {
return User_password_set_view();
} else {
if (isset($_REQUEST['submit'])) {
- $ok = true;
+ $valid = true;
if (isset($_REQUEST['email']) && strlen(strip_request_item('email')) > 0) {
$email = strip_request_item('email');
@@ -261,19 +261,19 @@ function user_password_recovery_controller() {
engelsystem_error("Unable to load user.");
}
if ($user_source == null) {
- $ok = false;
+ $valid = false;
error(_("E-mail address is not correct."));
}
} else {
- $ok = false;
+ $valid = false;
error(_("E-mail address is not correct."));
}
} else {
- $ok = false;
+ $valid = false;
error(_("Please enter your e-mail."));
}
- if ($ok) {
+ if ($valid) {
$token = User_generate_password_recovery_token($user_source);
if ($token === false) {
engelsystem_error("Unable to generate password recovery token.");
diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php
index b672fddb..83f99d5a 100644
--- a/includes/pages/admin_active.php
+++ b/includes/pages/admin_active.php
@@ -21,7 +21,7 @@ function admin_active() {
$show_all_shifts = isset($_REQUEST['show_all_shifts']);
if (isset($_REQUEST['set_active'])) {
- $ok = true;
+ $valid = true;
if (isset($_REQUEST['count']) && preg_match("/^[0-9]+$/", $_REQUEST['count'])) {
$count = strip_request_item('count');
@@ -30,11 +30,11 @@ function admin_active() {
redirect(page_link_to('admin_active'));
}
} else {
- $ok = false;
+ $valid = false;
$msg .= error(_("Please enter a number of angels to be marked as active."), true);
}
- if ($ok) {
+ if ($valid) {
$limit = " LIMIT " . $count;
}
if (isset($_REQUEST['ack'])) {
diff --git a/includes/pages/admin_import.php b/includes/pages/admin_import.php
index e533819f..8643dc55 100644
--- a/includes/pages/admin_import.php
+++ b/includes/pages/admin_import.php
@@ -41,29 +41,29 @@ function admin_import() {
switch ($step) {
case 'input':
- $ok = false;
+ $valid = false;
if (isset($_REQUEST['submit'])) {
- $ok = true;
+ $valid = true;
if (isset($_REQUEST['shifttype_id']) && isset($shifttypes[$_REQUEST['shifttype_id']])) {
$shifttype_id = $_REQUEST['shifttype_id'];
} else {
- $ok = false;
+ $valid = false;
error(_('Please select a shift type.'));
}
if (isset($_REQUEST['add_minutes_start']) && is_numeric(trim($_REQUEST['add_minutes_start']))) {
$add_minutes_start = trim($_REQUEST['add_minutes_start']);
} else {
- $ok = false;
+ $valid = false;
error(_("Please enter an amount of minutes to add to a talk's begin."));
}
if (isset($_REQUEST['add_minutes_end']) && is_numeric(trim($_REQUEST['add_minutes_end']))) {
$add_minutes_end = trim($_REQUEST['add_minutes_end']);
} else {
- $ok = false;
+ $valid = false;
error(_("Please enter an amount of minutes to add to a talk's end."));
}
@@ -71,21 +71,21 @@ function admin_import() {
if (move_uploaded_file($_FILES['xcal_file']['tmp_name'], $import_file)) {
libxml_use_internal_errors(true);
if (simplexml_load_file($import_file) === false) {
- $ok = false;
+ $valid = false;
error(_('No valid xml/xcal file provided.'));
unlink($import_file);
}
} else {
- $ok = false;
+ $valid = false;
error(_('File upload went wrong.'));
}
} else {
- $ok = false;
+ $valid = false;
error(_('Please provide some data.'));
}
}
- if ($ok) {
+ if ($valid) {
redirect(page_link_to('admin_import') . "&step=check&shifttype_id=" . $shifttype_id . "&add_minutes_end=" . $add_minutes_end . "&add_minutes_start=" . $add_minutes_start);
} else {
$html .= div('well well-sm text-center', [
diff --git a/includes/pages/admin_rooms.php b/includes/pages/admin_rooms.php
index 631a7e0b..3c26048a 100644
--- a/includes/pages/admin_rooms.php
+++ b/includes/pages/admin_rooms.php
@@ -54,16 +54,16 @@ function admin_rooms() {
if ($_REQUEST['show'] == 'edit') {
if (isset($_REQUEST['submit'])) {
- $ok = true;
+ $valid = true;
if (isset($_REQUEST['name']) && strlen(strip_request_item('name')) > 0) {
$name = strip_request_item('name');
if (isset($room) && sql_num_query("SELECT * FROM `Room` WHERE `Name`='" . sql_escape($name) . "' AND NOT `RID`=" . sql_escape($id)) > 0) {
- $ok = false;
+ $valid = false;
$msg .= error(_("This name is already in use."), true);
}
} else {
- $ok = false;
+ $valid = false;
$msg .= error(_("Please enter a name."), true);
}
@@ -82,19 +82,19 @@ function admin_rooms() {
if (isset($_REQUEST['number'])) {
$number = strip_request_item('number');
} else {
- $ok = false;
+ $valid = false;
}
foreach ($angeltypes as $angeltype_id => $angeltype) {
if (isset($_REQUEST['angeltype_count_' . $angeltype_id]) && preg_match("/^[0-9]{1,4}$/", $_REQUEST['angeltype_count_' . $angeltype_id])) {
$angeltypes_count[$angeltype_id] = $_REQUEST['angeltype_count_' . $angeltype_id];
} else {
- $ok = false;
+ $valid = false;
$msg .= error(sprintf(_("Please enter needed angels for type %s.", $angeltype)), true);
}
}
- if ($ok) {
+ if ($valid) {
if (isset($id)) {
sql_query("UPDATE `Room` SET `Name`='" . sql_escape($name) . "', `FromPentabarf`='" . sql_escape($from_pentabarf) . "', `show`='" . sql_escape($public) . "', `Number`='" . sql_escape($number) . "' WHERE `RID`='" . sql_escape($id) . "' LIMIT 1");
engelsystem_log("Room updated: " . $name . ", pentabarf import: " . $from_pentabarf . ", public: " . $public . ", number: " . $number);
diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php
index 3682b38c..3dd22f3a 100644
--- a/includes/pages/admin_shifts.php
+++ b/includes/pages/admin_shifts.php
@@ -6,7 +6,7 @@ function admin_shifts_title() {
// Assistent zum Anlegen mehrerer neuer Schichten
function admin_shifts() {
- $ok = true;
+ $valid = true;
$rid = 0;
$start = DateTime::createFromFormat("Y-m-d H:i", date("Y-m-d") . " 00:00")->getTimestamp();
@@ -49,13 +49,13 @@ function admin_shifts() {
engelsystem_error('Unable to load shift type.');
}
if ($shifttype == null) {
- $ok = false;
+ $valid = false;
error(_('Please select a shift type.'));
} else {
$shifttype_id = $_REQUEST['shifttype_id'];
}
} else {
- $ok = false;
+ $valid = false;
error(_('Please select a shift type.'));
}
@@ -66,7 +66,7 @@ function admin_shifts() {
if (isset($_REQUEST['rid']) && preg_match("/^[0-9]+$/", $_REQUEST['rid']) && isset($room_array[$_REQUEST['rid']])) {
$rid = $_REQUEST['rid'];
} else {
- $ok = false;
+ $valid = false;
$rid = $rooms[0]['RID'];
error(_('Please select a location.'));
}
@@ -74,19 +74,19 @@ function admin_shifts() {
if (isset($_REQUEST['start']) && $tmp = DateTime::createFromFormat("Y-m-d H:i", trim($_REQUEST['start']))) {
$start = $tmp->getTimestamp();
} else {
- $ok = false;
+ $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();
} else {
- $ok = false;
+ $valid = false;
error(_('Please select an end time.'));
}
if ($start >= $end) {
- $ok = false;
+ $valid = false;
error(_('The shifts end has to be after its start.'));
}
@@ -98,7 +98,7 @@ function admin_shifts() {
$mode = 'multi';
$length = trim($_REQUEST['length']);
} else {
- $ok = false;
+ $valid = false;
error(_('Please enter a shift duration in minutes.'));
}
} elseif ($_REQUEST['mode'] == 'variable') {
@@ -106,12 +106,12 @@ function admin_shifts() {
$mode = 'variable';
$change_hours = array_map('trim', explode(",", $_REQUEST['change_hours']));
} else {
- $ok = false;
+ $valid = false;
error(_('Please split the shift-change hours by colons.'));
}
}
} else {
- $ok = false;
+ $valid = false;
error(_('Please select a mode.'));
}
@@ -124,30 +124,30 @@ function admin_shifts() {
if (isset($_REQUEST['type_' . $type['id']]) && preg_match("/^[0-9]+$/", trim($_REQUEST['type_' . $type['id']]))) {
$needed_angel_types[$type['id']] = trim($_REQUEST['type_' . $type['id']]);
} else {
- $ok = false;
+ $valid = false;
error(sprintf(_('Please check the needed angels for team %s.'), $type['name']));
}
}
if (array_sum($needed_angel_types) == 0) {
- $ok = false;
+ $valid = false;
error(_('There are 0 angels needed. Please enter the amounts of needed angels.'));
}
} else {
- $ok = false;
+ $valid = false;
error(_('Please select a mode for needed angels.'));
}
} else {
- $ok = false;
+ $valid = false;
error(_('Please select needed angels.'));
}
// Beim Zurück-Knopf das Formular zeigen
if (isset($_REQUEST['back'])) {
- $ok = false;
+ $valid = false;
}
// Alle Eingaben in Ordnung
- if ($ok) {
+ if ($valid) {
if ($angelmode == 'location') {
$needed_angel_types = [];
$needed_angel_types_location = sql_select("SELECT * FROM `NeededAngelTypes` WHERE `room_id`='" . sql_escape($rid) . "'");
diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php
index aeaed182..1f1b7ab2 100644
--- a/includes/pages/guest_login.php
+++ b/includes/pages/guest_login.php
@@ -49,27 +49,27 @@ function guest_register() {
}
if (isset($_REQUEST['submit'])) {
- $ok = true;
+ $valid = true;
if (isset($_REQUEST['nick']) && strlen(User_validate_Nick($_REQUEST['nick'])) > 1) {
$nick = User_validate_Nick($_REQUEST['nick']);
if (sql_num_query("SELECT * FROM `User` WHERE `Nick`='" . sql_escape($nick) . "' LIMIT 1") > 0) {
- $ok = false;
+ $valid = false;
$msg .= error(sprintf(_("Your nick &quot;%s&quot; already exists."), $nick), true);
}
} else {
- $ok = false;
+ $valid = false;
$msg .= error(sprintf(_("Your nick &quot;%s&quot; is too short (min. 2 characters)."), User_validate_Nick($_REQUEST['nick'])), true);
}
if (isset($_REQUEST['mail']) && strlen(strip_request_item('mail')) > 0) {
$mail = strip_request_item('mail');
if (! check_email($mail)) {
- $ok = false;
+ $valid = false;
$msg .= error(_("E-mail address is not correct."), true);
}
} else {
- $ok = false;
+ $valid = false;
$msg .= error(_("Please enter your e-mail."), true);
}
@@ -80,7 +80,7 @@ function guest_register() {
if (isset($_REQUEST['jabber']) && strlen(strip_request_item('jabber')) > 0) {
$jabber = strip_request_item('jabber');
if (! check_email($jabber)) {
- $ok = false;
+ $valid = false;
$msg .= error(_("Please check your jabber account information."), true);
}
}
@@ -89,25 +89,25 @@ function guest_register() {
if (isset($_REQUEST['tshirt_size']) && isset($tshirt_sizes[$_REQUEST['tshirt_size']]) && $_REQUEST['tshirt_size'] != '') {
$tshirt_size = $_REQUEST['tshirt_size'];
} else {
- $ok = false;
+ $valid = false;
$msg .= error(_("Please select your shirt size."), true);
}
}
if (isset($_REQUEST['password']) && strlen($_REQUEST['password']) >= MIN_PASSWORD_LENGTH) {
if ($_REQUEST['password'] != $_REQUEST['password2']) {
- $ok = false;
+ $valid = false;
$msg .= error(_("Your passwords don't match."), true);
}
} else {
- $ok = false;
+ $valid = false;
$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();
} else {
- $ok = false;
+ $valid = false;
$msg .= error(_("Please enter your planned date of arrival."), true);
}
@@ -144,7 +144,7 @@ function guest_register() {
$comment = strip_request_item_nl('comment');
}
- if ($ok) {
+ if ($valid) {
sql_query("
INSERT INTO `User` SET
`color`='" . sql_escape($default_theme) . "',
@@ -284,7 +284,7 @@ function guest_login() {
unset($_SESSION['uid']);
if (isset($_REQUEST['submit'])) {
- $ok = true;
+ $valid = true;
if (isset($_REQUEST['nick']) && strlen(User_validate_Nick($_REQUEST['nick'])) > 0) {
$nick = User_validate_Nick($_REQUEST['nick']);
@@ -293,23 +293,23 @@ function guest_login() {
$login_user = $login_user[0];
if (isset($_REQUEST['password'])) {
if (! verify_password($_REQUEST['password'], $login_user['Passwort'], $login_user['UID'])) {
- $ok = false;
+ $valid = false;
error(_("Your password is incorrect. Please try it again."));
}
} else {
- $ok = false;
+ $valid = false;
error(_("Please enter a password."));
}
} else {
- $ok = false;
+ $valid = false;
error(_("No user was found with that Nickname. Please try again. If you are still having problems, ask an Dispatcher."));
}
} else {
- $ok = false;
+ $valid = false;
error(_("Please enter a nickname."));
}
- if ($ok) {
+ if ($valid) {
$_SESSION['uid'] = $login_user['UID'];
$_SESSION['locale'] = $login_user['Sprache'];
diff --git a/includes/pages/user_myshifts.php b/includes/pages/user_myshifts.php
index 3040c8c3..f50711a7 100644
--- a/includes/pages/user_myshifts.php
+++ b/includes/pages/user_myshifts.php
@@ -51,12 +51,12 @@ function user_myshifts() {
$freeload_comment = $shift['freeload_comment'];
if (isset($_REQUEST['submit'])) {
- $ok = true;
+ $valid = true;
if (in_array("user_shifts_admin", $privileges)) {
$freeloaded = isset($_REQUEST['freeloaded']);
$freeload_comment = strip_request_item_nl('freeload_comment');
if ($freeloaded && $freeload_comment == '') {
- $ok = false;
+ $valid = false;
error(_("Please enter a freeload comment!"));
}
}
@@ -64,7 +64,7 @@ function user_myshifts() {
$comment = strip_request_item_nl('comment');
$user_source = User($shift['UID']);
- if ($ok) {
+ if ($valid) {
$result = ShiftEntry_update([
'id' => $id,
'Comment' => $comment,
diff --git a/includes/pages/user_settings.php b/includes/pages/user_settings.php
index 779349a5..b2ea5752 100644
--- a/includes/pages/user_settings.php
+++ b/includes/pages/user_settings.php
@@ -27,16 +27,16 @@ function user_settings() {
$planned_departure_date = $user['planned_departure_date'];
if (isset($_REQUEST['submit'])) {
- $ok = true;
+ $valid = true;
if (isset($_REQUEST['mail']) && strlen(strip_request_item('mail')) > 0) {
$mail = strip_request_item('mail');
if (! check_email($mail)) {
- $ok = false;
+ $valid = false;
$msg .= error(_("E-mail address is not correct."), true);
}
} else {
- $ok = false;
+ $valid = false;
$msg .= error(_("Please enter your e-mail."), true);
}
@@ -45,7 +45,7 @@ function user_settings() {
if (isset($_REQUEST['jabber']) && strlen(strip_request_item('jabber')) > 0) {
$jabber = strip_request_item('jabber');
if (! check_email($jabber)) {
- $ok = false;
+ $valid = false;
$msg .= error(_("Please check your jabber account information."), true);
}
}
@@ -53,13 +53,13 @@ function user_settings() {
if (isset($_REQUEST['tshirt_size']) && isset($tshirt_sizes[$_REQUEST['tshirt_size']])) {
$tshirt_size = $_REQUEST['tshirt_size'];
} elseif ($enable_tshirt_size) {
- $ok = false;
+ $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();
} else {
- $ok = false;
+ $valid = false;
$msg .= error(_("Please enter your planned date of arrival."), true);
}
@@ -67,7 +67,7 @@ function user_settings() {
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;
+ $valid = false;
$msg .= error(_("Please enter your planned date of departure."), true);
}
} else {
@@ -97,7 +97,7 @@ function user_settings() {
$hometown = strip_request_item('hometown');
}
- if ($ok) {
+ if ($valid) {
sql_query("
UPDATE `User` SET
`Nick`='" . sql_escape($nick) . "',
@@ -120,7 +120,7 @@ function user_settings() {
redirect(page_link_to('user_settings'));
}
} elseif (isset($_REQUEST['submit_password'])) {
- $ok = true;
+ $valid = true;
if (! isset($_REQUEST['password']) || ! verify_password($_REQUEST['password'], $user['Passwort'], $user['UID'])) {
$msg .= error(_("-> not OK. Please try again."), true);
@@ -135,30 +135,30 @@ function user_settings() {
}
redirect(page_link_to('user_settings'));
} elseif (isset($_REQUEST['submit_theme'])) {
- $ok = true;
+ $valid = true;
if (isset($_REQUEST['theme']) && isset($themes[$_REQUEST['theme']])) {
$selected_theme = $_REQUEST['theme'];
} else {
- $ok = false;
+ $valid = false;
}
- if ($ok) {
+ if ($valid) {
sql_query("UPDATE `User` SET `color`='" . sql_escape($selected_theme) . "' WHERE `UID`='" . sql_escape($user['UID']) . "'");
success(_("Theme changed."));
redirect(page_link_to('user_settings'));
}
} elseif (isset($_REQUEST['submit_language'])) {
- $ok = true;
+ $valid = true;
if (isset($_REQUEST['language']) && isset($locales[$_REQUEST['language']])) {
$selected_language = $_REQUEST['language'];
} else {
- $ok = false;
+ $valid = false;
}
- if ($ok) {
+ if ($valid) {
sql_query("UPDATE `User` SET `Sprache`='" . sql_escape($selected_language) . "' WHERE `UID`='" . sql_escape($user['UID']) . "'");
$_SESSION['locale'] = $selected_language;
diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php
index 90be0c6c..b6a3c9f5 100644
--- a/includes/pages/user_shifts.php
+++ b/includes/pages/user_shifts.php
@@ -52,7 +52,7 @@ function user_shifts() {
} elseif (isset($_REQUEST['edit_shift']) && in_array('admin_shifts', $privileges)) {
// Schicht bearbeiten
$msg = "";
- $ok = true;
+ $valid = true;
if (isset($_REQUEST['edit_shift']) && test_request_int('edit_shift')) {
$shift_id = $_REQUEST['edit_shift'];
@@ -115,7 +115,7 @@ function user_shifts() {
if (isset($_REQUEST['rid']) && preg_match("/^[0-9]+$/", $_REQUEST['rid']) && isset($room_array[$_REQUEST['rid']])) {
$rid = $_REQUEST['rid'];
} else {
- $ok = false;
+ $valid = false;
$rid = $rooms[0]['RID'];
$msg .= error(_("Please select a room."), true);
}
@@ -123,26 +123,26 @@ function user_shifts() {
if (isset($_REQUEST['shifttype_id']) && isset($shifttypes[$_REQUEST['shifttype_id']])) {
$shifttype_id = $_REQUEST['shifttype_id'];
} else {
- $ok = false;
+ $valid = false;
$msg .= error(_('Please select a shifttype.'), true);
}
if (isset($_REQUEST['start']) && $tmp = DateTime::createFromFormat("Y-m-d H:i", trim($_REQUEST['start']))) {
$start = $tmp->getTimestamp();
} else {
- $ok = false;
+ $valid = false;
$msg .= error(_("Please enter a valid starting time for the shifts."), true);
}
if (isset($_REQUEST['end']) && $tmp = DateTime::createFromFormat("Y-m-d H:i", trim($_REQUEST['end']))) {
$end = $tmp->getTimestamp();
} else {
- $ok = false;
+ $valid = false;
$msg .= error(_("Please enter a valid ending time for the shifts."), true);
}
if ($start >= $end) {
- $ok = false;
+ $valid = false;
$msg .= error(_("The ending time has to be after the starting time."), true);
}
@@ -150,12 +150,12 @@ function user_shifts() {
if (isset($_REQUEST['type_' . $type['id']]) && preg_match("/^[0-9]+$/", trim($_REQUEST['type_' . $type['id']]))) {
$needed_angel_types[$type['id']] = trim($_REQUEST['type_' . $type['id']]);
} else {
- $ok = false;
+ $valid = false;
$msg .= error(sprintf(_("Please check your input for needed angels of type %s."), $type['name']), true);
}
}
- if ($ok) {
+ if ($valid) {
$shift['shifttype_id'] = $shifttype_id;
$shift['title'] = $title;
$shift['RID'] = $rid;
diff --git a/includes/sys_page.php b/includes/sys_page.php
index 6b71eb15..78972448 100644
--- a/includes/sys_page.php
+++ b/includes/sys_page.php
@@ -102,20 +102,20 @@ function check_email($email) {
class ValidationResult {
- private $ok;
+ private $valid;
private $value;
/**
* Constructor.
*
- * @param boolean $ok
+ * @param boolean $valid
* Is the value valid?
* @param * $value
* The validated value
*/
- public function ValidationResult($ok, $value) {
- $this->ok = $ok;
+ public function ValidationResult($valid, $value) {
+ $this->ok = $valid;
$this->value = $value;
}