summaryrefslogtreecommitdiff
path: root/includes/controller
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2017-08-29 16:21:25 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2017-08-29 21:52:07 +0200
commitcc01c906ba63b3797bf2b9ef92a6854fe2ddbefb (patch)
treeea819678100f6a50d67f1f8516e82fdef8a9196b /includes/controller
parent73175e2b64c85c7a8c528c76452cd82ffa99f925 (diff)
#336: Integration of symfony/http-foundation request
Diffstat (limited to 'includes/controller')
-rw-r--r--includes/controller/angeltypes_controller.php2
-rw-r--r--includes/controller/shift_entries_controller.php2
-rw-r--r--includes/controller/shifts_controller.php25
-rw-r--r--includes/controller/users_controller.php12
4 files changed, 23 insertions, 18 deletions
diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php
index d60b6fc7..8c1cbe5d 100644
--- a/includes/controller/angeltypes_controller.php
+++ b/includes/controller/angeltypes_controller.php
@@ -127,7 +127,7 @@ function angeltype_edit_controller()
if (!$supporter_mode) {
if ($request->has('name')) {
- $result = AngelType_validate_name($request->get('name'), $angeltype);
+ $result = AngelType_validate_name($request->postData('name'), $angeltype);
$angeltype['name'] = $result->getValue();
if (!$result->isValid()) {
$valid = false;
diff --git a/includes/controller/shift_entries_controller.php b/includes/controller/shift_entries_controller.php
index 38aad5bb..3890241d 100644
--- a/includes/controller/shift_entries_controller.php
+++ b/includes/controller/shift_entries_controller.php
@@ -27,10 +27,10 @@ function shift_entry_add_controller()
}
$shift = Shift($shift_id);
- $shift['Name'] = $room_array[$shift['RID']];
if ($shift == null) {
redirect(page_link_to('user_shifts'));
}
+ $shift['Name'] = $room_array[$shift['RID']];
$type_id = 0;
if ($request->has('type_id') && preg_match('/^\d*$/', $request->input('type_id'))) {
diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php
index f4f3f119..f68f64fe 100644
--- a/includes/controller/shifts_controller.php
+++ b/includes/controller/shifts_controller.php
@@ -62,7 +62,7 @@ function shift_edit_controller()
$angeltypes = select_array(AngelTypes(), 'id', 'name');
$shifttypes = select_array(ShiftTypes(), 'id', 'name');
- $needed_angel_types = select_array(NeededAngelTypes_by_shift($shift_id), 'id', 'count');
+ $needed_angel_types = select_array(NeededAngelTypes_by_shift($shift_id), 'angel_type_id', 'count');
foreach (array_keys($angeltypes) as $angeltype_id) {
if (!isset($needed_angel_types[$angeltype_id])) {
$needed_angel_types[$angeltype_id] = 0;
@@ -117,15 +117,20 @@ function shift_edit_controller()
$msg .= error(_('The ending time has to be after the starting time.'), true);
}
- foreach ($needed_angel_types as $needed_angeltype_id => $needed_angeltype_name) {
- if ($request->has('type_' . $needed_angeltype_id) && test_request_int('type_' . $needed_angeltype_id)) {
- $needed_angel_types[$needed_angeltype_id] = trim($request->input('type_' . $needed_angeltype_id));
- } else {
- $valid = false;
- $msg .= error(sprintf(
- _('Please check your input for needed angels of type %s.'),
- $needed_angeltype_name
- ), true);
+ foreach ($needed_angel_types as $needed_angeltype_id => $count) {
+ $needed_angel_types[$needed_angeltype_id] = 0;
+
+ $queryKey = 'type_' . $needed_angeltype_id;
+ if ($request->has($queryKey)) {
+ if (test_request_int($queryKey)) {
+ $needed_angel_types[$needed_angeltype_id] = trim($request->input($queryKey));
+ } else {
+ $valid = false;
+ $msg .= error(sprintf(
+ _('Please check your input for needed angels of type %s.'),
+ $angeltypes[$needed_angeltype_id]
+ ), true);
+ }
}
}
diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php
index 6dc74d68..b8a1fdbd 100644
--- a/includes/controller/users_controller.php
+++ b/includes/controller/users_controller.php
@@ -47,7 +47,7 @@ function user_delete_controller()
$request = request();
if ($request->has('user_id')) {
- $user_source = User($request->get('user_id'));
+ $user_source = User($request->query->get('user_id'));
} else {
$user_source = $user;
}
@@ -68,7 +68,7 @@ function user_delete_controller()
if (
!(
$request->has('password')
- && verify_password($request->post('password'), $user['Passwort'], $user['UID'])
+ && verify_password($request->postData('password'), $user['Passwort'], $user['UID'])
)
) {
$valid = false;
@@ -307,9 +307,9 @@ function user_password_recovery_set_new_controller()
if (
$request->has('password')
- && strlen($request->post('password')) >= config('min_password_length')
+ && strlen($request->postData('password')) >= config('min_password_length')
) {
- if ($request->post('password') != $request->post('password2')) {
+ if ($request->postData('password') != $request->postData('password2')) {
$valid = false;
error(_('Your passwords don\'t match.'));
}
@@ -319,7 +319,7 @@ function user_password_recovery_set_new_controller()
}
if ($valid) {
- set_password($user_source['UID'], $request->post('password'));
+ set_password($user_source['UID'], $request->postData('password'));
success(_('Password saved.'));
redirect(page_link_to('login'));
}
@@ -363,7 +363,7 @@ function user_password_recovery_start_controller()
_('Password recovery'),
sprintf(
_('Please visit %s to recover your password.'),
- page_link_to_absolute('user_password_recovery', ['token' => $token])
+ page_link_to('user_password_recovery', ['token' => $token])
)
);
success(_('We sent an email containing your password recovery link.'));