summaryrefslogtreecommitdiff
path: root/includes/controller
diff options
context:
space:
mode:
Diffstat (limited to 'includes/controller')
-rw-r--r--includes/controller/angeltypes_controller.php26
-rw-r--r--includes/controller/rooms_controller.php5
-rw-r--r--includes/controller/shift_entries_controller.php2
-rw-r--r--includes/controller/shifts_controller.php36
-rw-r--r--includes/controller/shifttypes_controller.php4
-rw-r--r--includes/controller/user_angeltypes_controller.php17
-rw-r--r--includes/controller/user_driver_licenses_controller.php2
-rw-r--r--includes/controller/users_controller.php18
8 files changed, 64 insertions, 46 deletions
diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php
index 58fadd5c..8c1cbe5d 100644
--- a/includes/controller/angeltypes_controller.php
+++ b/includes/controller/angeltypes_controller.php
@@ -42,7 +42,7 @@ function angeltypes_controller()
*/
function angeltype_link($angeltype_id)
{
- return page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype_id;
+ return page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype_id]);
}
/**
@@ -127,7 +127,7 @@ function angeltype_edit_controller()
if (!$supporter_mode) {
if ($request->has('name')) {
- $result = AngelType_validate_name($request->input('name'), $angeltype);
+ $result = AngelType_validate_name($request->postData('name'), $angeltype);
$angeltype['name'] = $result->getValue();
if (!$result->isValid()) {
$valid = false;
@@ -211,17 +211,21 @@ function angeltypes_list_controller()
foreach ($angeltypes as &$angeltype) {
$actions = [
- button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _('view'), 'btn-xs')
+ button(
+ page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
+ _('view'),
+ 'btn-xs'
+ )
];
if (in_array('admin_angel_types', $privileges)) {
$actions[] = button(
- page_link_to('angeltypes') . '&action=edit&angeltype_id=' . $angeltype['id'],
+ page_link_to('angeltypes', ['action' => 'edit', 'angeltype_id' => $angeltype['id']]),
_('edit'),
'btn-xs'
);
$actions[] = button(
- page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'],
+ page_link_to('angeltypes', ['action' => 'delete', 'angeltype_id' => $angeltype['id']]),
_('delete'),
'btn-xs'
);
@@ -230,13 +234,15 @@ function angeltypes_list_controller()
$angeltype['membership'] = AngelType_render_membership($angeltype);
if ($angeltype['user_angeltype_id'] != null) {
$actions[] = button(
- page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'],
+ page_link_to('user_angeltypes',
+ ['action' => 'delete', 'user_angeltype_id' => $angeltype['user_angeltype_id']]
+ ),
_('leave'),
'btn-xs'
);
} else {
$actions[] = button(
- page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'],
+ page_link_to('user_angeltypes', ['action' => 'add', 'angeltype_id' => $angeltype['id']]),
_('join'),
'btn-xs'
);
@@ -245,7 +251,11 @@ function angeltypes_list_controller()
$angeltype['restricted'] = $angeltype['restricted'] ? glyph('lock') : '';
$angeltype['no_self_signup'] = $angeltype['no_self_signup'] ? '' : glyph('share');
- $angeltype['name'] = '<a href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'] . '">' . $angeltype['name'] . '</a>';
+ $angeltype['name'] = '<a href="'
+ . page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']])
+ . '">'
+ . $angeltype['name']
+ . '</a>';
$angeltype['actions'] = table_buttons($actions);
}
diff --git a/includes/controller/rooms_controller.php b/includes/controller/rooms_controller.php
index 6d0864ae..d6da9709 100644
--- a/includes/controller/rooms_controller.php
+++ b/includes/controller/rooms_controller.php
@@ -1,4 +1,5 @@
<?php
+
use Engelsystem\ShiftsFilter;
use Engelsystem\ShiftsFilterRenderer;
@@ -88,7 +89,7 @@ function rooms_controller()
*/
function room_link($room)
{
- return page_link_to('rooms') . '&action=view&room_id=' . $room['RID'];
+ return page_link_to('rooms', ['action' => 'view', 'room_id' => $room['RID']]);
}
/**
@@ -97,7 +98,7 @@ function room_link($room)
*/
function room_edit_link($room)
{
- return page_link_to('admin_rooms') . '&show=edit&id=' . $room['RID'];
+ return page_link_to('admin_rooms', ['show' => 'edit', 'id' => $room['RID']]);
}
/**
diff --git a/includes/controller/shift_entries_controller.php b/includes/controller/shift_entries_controller.php
index 72189869..148b19fb 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 96f12baa..c359850f 100644
--- a/includes/controller/shifts_controller.php
+++ b/includes/controller/shifts_controller.php
@@ -1,4 +1,5 @@
<?php
+
use Engelsystem\ShiftSignupState;
/**
@@ -7,7 +8,7 @@ use Engelsystem\ShiftSignupState;
*/
function shift_link($shift)
{
- $link = page_link_to('shifts') . '&action=view';
+ $link = page_link_to('shifts', ['action' => 'view']);
if (isset($shift['SID'])) {
$link .= '&shift_id=' . $shift['SID'];
}
@@ -20,7 +21,7 @@ function shift_link($shift)
*/
function shift_delete_link($shift)
{
- return page_link_to('user_shifts') . '&delete_shift=' . $shift['SID'];
+ return page_link_to('user_shifts', ['delete_shift' => $shift['SID']]);
}
/**
@@ -29,7 +30,7 @@ function shift_delete_link($shift)
*/
function shift_edit_link($shift)
{
- return page_link_to('user_shifts') . '&edit_shift=' . $shift['SID'];
+ return page_link_to('user_shifts', ['edit_shift' => $shift['SID']]);
}
/**
@@ -61,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;
@@ -116,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);
+ }
}
}
@@ -225,7 +231,9 @@ function shift_delete_controller()
date('Y-m-d H:i', $shift['start']),
date('H:i', $shift['end'])
), true),
- '<a class="button" href="?p=user_shifts&delete_shift=' . $shift_id . '&delete">' . _('delete') . '</a>'
+ '<a class="button" href="'
+ . page_link_to('user_shifts', ['delete_shift' => $shift_id, 'delete' => 1]) .
+ '">' . _('delete') . '</a>'
]);
}
diff --git a/includes/controller/shifttypes_controller.php b/includes/controller/shifttypes_controller.php
index 9cf292ee..4e7cd92c 100644
--- a/includes/controller/shifttypes_controller.php
+++ b/includes/controller/shifttypes_controller.php
@@ -6,7 +6,7 @@
*/
function shifttype_link($shifttype)
{
- return page_link_to('shifttypes') . '&action=view&shifttype_id=' . $shifttype['id'];
+ return page_link_to('shifttypes', ['action' => 'view', 'shifttype_id' => $shifttype['id']]);
}
/**
@@ -100,7 +100,7 @@ function shifttype_edit_controller()
engelsystem_log('Created shifttype ' . $name);
success(_('Created shifttype.'));
}
- redirect(page_link_to('shifttypes') . '&action=view&shifttype_id=' . $shifttype_id);
+ redirect(page_link_to('shifttypes', ['action' => 'view', 'shifttype_id' => $shifttype_id]));
}
}
diff --git a/includes/controller/user_angeltypes_controller.php b/includes/controller/user_angeltypes_controller.php
index f212716d..fa4f5777 100644
--- a/includes/controller/user_angeltypes_controller.php
+++ b/includes/controller/user_angeltypes_controller.php
@@ -17,8 +17,7 @@ function user_angeltypes_unconfirmed_hint()
$unconfirmed_links = [];
foreach ($unconfirmed_user_angeltypes as $user_angeltype) {
$unconfirmed_links[] = '<a href="'
- . page_link_to('angeltypes')
- . '&action=view&angeltype_id=' . $user_angeltype['angeltype_id']
+ . page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $user_angeltype['angeltype_id']])
. '">' . $user_angeltype['name']
. ' (+' . $user_angeltype['count'] . ')'
. '</a>';
@@ -61,7 +60,7 @@ function user_angeltypes_delete_all_controller()
engelsystem_log(sprintf('Denied all users for angeltype %s', AngelType_name_render($angeltype)));
success(sprintf(_('Denied all users for angeltype %s.'), AngelType_name_render($angeltype)));
- redirect(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id']);
+ redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
}
return [
@@ -107,7 +106,7 @@ function user_angeltypes_confirm_all_controller()
engelsystem_log(sprintf('Confirmed all users for angeltype %s', AngelType_name_render($angeltype)));
success(sprintf(_('Confirmed all users for angeltype %s.'), AngelType_name_render($angeltype)));
- redirect(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id']);
+ redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
}
return [
@@ -167,7 +166,7 @@ function user_angeltype_confirm_controller()
User_Nick_render($user_source),
AngelType_name_render($angeltype)
));
- redirect(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id']);
+ redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
}
return [
@@ -221,7 +220,7 @@ function user_angeltype_delete_controller()
engelsystem_log($success_message);
success($success_message);
- redirect(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id']);
+ redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
}
return [
@@ -287,7 +286,7 @@ function user_angeltype_update_controller()
engelsystem_log($success_message);
success($success_message);
- redirect(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id']);
+ redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
}
return [
@@ -341,7 +340,7 @@ function user_angeltype_add_controller()
AngelType_name_render($angeltype)
));
- redirect(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id']);
+ redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
}
}
@@ -383,7 +382,7 @@ function user_angeltype_join_controller($angeltype)
));
}
- redirect(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id']);
+ redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
}
return [
diff --git a/includes/controller/user_driver_licenses_controller.php b/includes/controller/user_driver_licenses_controller.php
index fef278dd..3db31eff 100644
--- a/includes/controller/user_driver_licenses_controller.php
+++ b/includes/controller/user_driver_licenses_controller.php
@@ -63,7 +63,7 @@ function user_driver_license_edit_link($user = null)
if ($user == null) {
return page_link_to('user_driver_licenses');
}
- return page_link_to('user_driver_licenses') . '&user_id=' . $user['UID'];
+ return page_link_to('user_driver_licenses', ['user_id' => $user['UID']]);
}
/**
diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php
index 832d93f0..e8cb1b27 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;
@@ -106,7 +106,7 @@ function users_link()
*/
function user_edit_link($user)
{
- return page_link_to('admin_user') . '&user_id=' . $user['UID'];
+ return page_link_to('admin_user', ['user_id' => $user['UID']]);
}
/**
@@ -115,7 +115,7 @@ function user_edit_link($user)
*/
function user_delete_link($user)
{
- return page_link_to('users') . '&action=delete&user_id=' . $user['UID'];
+ return page_link_to('users', ['action' => 'delete', 'user_id' => $user['UID']]);
}
/**
@@ -124,7 +124,7 @@ function user_delete_link($user)
*/
function user_link($user)
{
- return page_link_to('users') . '&action=view&user_id=' . $user['UID'];
+ return page_link_to('users', ['action' => 'view', 'user_id' => $user['UID']]);
}
/**
@@ -297,9 +297,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.'));
}
@@ -309,7 +309,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'));
}
@@ -353,7 +353,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.'));