summaryrefslogtreecommitdiff
path: root/includes/controller
diff options
context:
space:
mode:
Diffstat (limited to 'includes/controller')
-rw-r--r--includes/controller/angeltypes_controller.php18
-rw-r--r--includes/controller/event_config_controller.php4
-rw-r--r--includes/controller/rooms_controller.php8
-rw-r--r--includes/controller/shift_entries_controller.php34
-rw-r--r--includes/controller/shifts_controller.php30
-rw-r--r--includes/controller/shifttypes_controller.php14
-rw-r--r--includes/controller/user_angeltypes_controller.php64
-rw-r--r--includes/controller/user_driver_licenses_controller.php10
-rw-r--r--includes/controller/user_worklog_controller.php16
-rw-r--r--includes/controller/users_controller.php20
10 files changed, 109 insertions, 109 deletions
diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php
index 63bf53bd..b06a258c 100644
--- a/includes/controller/angeltypes_controller.php
+++ b/includes/controller/angeltypes_controller.php
@@ -79,7 +79,7 @@ function angeltypes_about_controller()
function angeltype_delete_controller()
{
if (!auth()->can('admin_angel_types')) {
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
$angeltype = load_angeltype();
@@ -87,7 +87,7 @@ function angeltype_delete_controller()
if (request()->hasPostData('delete')) {
AngelType_delete($angeltype);
success(sprintf(__('Angeltype %s deleted.'), AngelType_name_render($angeltype)));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
return [
@@ -112,13 +112,13 @@ function angeltype_edit_controller()
$angeltype = load_angeltype();
if (!User_is_AngelType_supporter(auth()->user(), $angeltype)) {
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
} else {
// New angeltype
if ($supporter_mode) {
// Supporters aren't allowed to create new angeltypes.
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
$angeltype = AngelType_new();
}
@@ -157,7 +157,7 @@ function angeltype_edit_controller()
}
success('Angel type saved.');
- redirect(angeltype_link($angeltype['id']));
+ throw_redirect(angeltype_link($angeltype['id']));
}
}
@@ -177,7 +177,7 @@ function angeltype_controller()
$user = auth()->user();
if (!auth()->can('angeltypes')) {
- redirect(page_link_to('/'));
+ throw_redirect(page_link_to('/'));
}
$angeltype = load_angeltype();
@@ -275,7 +275,7 @@ function angeltypes_list_controller()
$user = auth()->user();
if (!auth()->can('angeltypes')) {
- redirect(page_link_to('/'));
+ throw_redirect(page_link_to('/'));
}
$angeltypes = AngelTypes_with_user($user->id);
@@ -346,13 +346,13 @@ function load_angeltype()
{
$request = request();
if (!$request->has('angeltype_id')) {
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
$angeltype = AngelType($request->input('angeltype_id'));
if (empty($angeltype)) {
error(__('Angeltype doesn\'t exist . '));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
return $angeltype;
diff --git a/includes/controller/event_config_controller.php b/includes/controller/event_config_controller.php
index ff68c3ea..55071848 100644
--- a/includes/controller/event_config_controller.php
+++ b/includes/controller/event_config_controller.php
@@ -17,7 +17,7 @@ function event_config_title()
function event_config_edit_controller()
{
if (!auth()->can('admin_event_config')) {
- redirect(page_link_to('/'));
+ throw_redirect(page_link_to('/'));
}
$request = request();
@@ -118,7 +118,7 @@ function event_config_edit_controller()
)
);
success(__('Settings saved.'));
- redirect(page_link_to('admin_event_config'));
+ throw_redirect(page_link_to('admin_event_config'));
}
}
diff --git a/includes/controller/rooms_controller.php b/includes/controller/rooms_controller.php
index 01d4fd37..f0449439 100644
--- a/includes/controller/rooms_controller.php
+++ b/includes/controller/rooms_controller.php
@@ -15,7 +15,7 @@ use Engelsystem\ShiftsFilterRenderer;
function room_controller()
{
if (!auth()->can('view_rooms')) {
- redirect(page_link_to());
+ throw_redirect(page_link_to());
}
$request = request();
@@ -74,7 +74,7 @@ function rooms_controller()
return room_controller();
case 'list':
default:
- redirect(page_link_to('admin_rooms'));
+ throw_redirect(page_link_to('admin_rooms'));
}
}
@@ -104,12 +104,12 @@ function room_edit_link($room)
function load_room()
{
if (!test_request_int('room_id')) {
- redirect(page_link_to());
+ throw_redirect(page_link_to());
}
$room = Room(request()->input('room_id'));
if (empty($room)) {
- redirect(page_link_to());
+ throw_redirect(page_link_to());
}
return $room;
diff --git a/includes/controller/shift_entries_controller.php b/includes/controller/shift_entries_controller.php
index 5547c183..065f09cb 100644
--- a/includes/controller/shift_entries_controller.php
+++ b/includes/controller/shift_entries_controller.php
@@ -13,12 +13,12 @@ function shift_entries_controller()
{
$user = auth()->user();
if (!$user) {
- redirect(page_link_to('login'));
+ throw_redirect(page_link_to('login'));
}
$action = strip_request_item('action');
if (empty($action)) {
- redirect(user_link($user->id));
+ throw_redirect(user_link($user->id));
}
switch ($action) {
@@ -40,12 +40,12 @@ function shift_entry_create_controller()
$request = request();
if (User_is_freeloader($user)) {
- redirect(page_link_to('user_myshifts'));
+ throw_redirect(page_link_to('user_myshifts'));
}
$shift = Shift($request->input('shift_id'));
if (empty($shift)) {
- redirect(user_link($user->id));
+ throw_redirect(user_link($user->id));
}
$angeltype = AngelType($request->input('angeltype_id'));
@@ -55,7 +55,7 @@ function shift_entry_create_controller()
}
if (empty($angeltype)) {
- redirect(user_link($user->id));
+ throw_redirect(user_link($user->id));
}
if (User_is_AngelType_supporter($user, $angeltype)) {
@@ -82,7 +82,7 @@ function shift_entry_create_controller_admin($shift, $angeltype)
$signup_user = User::find($request->input('user_id'));
}
if (!$signup_user) {
- redirect(shift_link($shift));
+ throw_redirect(shift_link($shift));
}
$angeltypes = AngelTypes();
@@ -91,7 +91,7 @@ function shift_entry_create_controller_admin($shift, $angeltype)
}
if (empty($angeltype)) {
if (count($angeltypes) == 0) {
- redirect(shift_link($shift));
+ throw_redirect(shift_link($shift));
}
$angeltype = $angeltypes[0];
}
@@ -107,7 +107,7 @@ function shift_entry_create_controller_admin($shift, $angeltype)
]);
success(sprintf(__('%s has been subscribed to the shift.'), User_Nick_render($signup_user)));
- redirect(shift_link($shift));
+ throw_redirect(shift_link($shift));
}
/** @var User[]|Collection $users */
@@ -147,7 +147,7 @@ function shift_entry_create_controller_supporter($shift, $angeltype)
}
if (!UserAngelType_exists($signup_user->id, $angeltype)) {
error(__('User is not in angeltype.'));
- redirect(shift_link($shift));
+ throw_redirect(shift_link($shift));
}
$needed_angeltype = NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype);
@@ -165,7 +165,7 @@ function shift_entry_create_controller_supporter($shift, $angeltype)
if ($shift_signup_state->getState() == ShiftSignupState::OCCUPIED) {
error(__('This shift is already occupied.'));
}
- redirect(shift_link($shift));
+ throw_redirect(shift_link($shift));
}
if ($request->hasPostData('submit')) {
@@ -179,7 +179,7 @@ function shift_entry_create_controller_supporter($shift, $angeltype)
]);
success(sprintf(__('%s has been subscribed to the shift.'), User_Nick_render($signup_user)));
- redirect(shift_link($shift));
+ throw_redirect(shift_link($shift));
}
$users = Users_by_angeltype($angeltype);
@@ -245,7 +245,7 @@ function shift_entry_create_controller_user($shift, $angeltype)
);
if (!$shift_signup_state->isSignupAllowed()) {
shift_entry_error_message($shift_signup_state);
- redirect(shift_link($shift));
+ throw_redirect(shift_link($shift));
}
$comment = '';
@@ -265,7 +265,7 @@ function shift_entry_create_controller_user($shift, $angeltype)
}
success(__('You are subscribed. Thank you!'));
- redirect(shift_link($shift));
+ throw_redirect(shift_link($shift));
}
$room = Room($shift['RID']);
@@ -319,12 +319,12 @@ function shift_entry_load()
$request = request();
if (!$request->has('shift_entry_id') || !test_request_int('shift_entry_id')) {
- redirect(page_link_to('user_shifts'));
+ throw_redirect(page_link_to('user_shifts'));
}
$shiftEntry = ShiftEntry($request->input('shift_entry_id'));
if (empty($shiftEntry)) {
error(__('Shift entry not found.'));
- redirect(page_link_to('user_shifts'));
+ throw_redirect(page_link_to('user_shifts'));
}
return $shiftEntry;
@@ -346,13 +346,13 @@ function shift_entry_delete_controller()
$signout_user = User::find($shiftEntry['UID']);
if (!Shift_signout_allowed($shift, $angeltype, $signout_user->id)) {
error(__('You are not allowed to remove this shift entry. If necessary, ask your supporter or heaven to do so.'));
- redirect(user_link($signout_user->id));
+ throw_redirect(user_link($signout_user->id));
}
if ($request->hasPostData('delete')) {
ShiftEntry_delete($shiftEntry);
success(__('Shift entry removed.'));
- redirect(shift_link($shift));
+ throw_redirect(shift_link($shift));
}
if ($user->id == $signout_user->id) {
diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php
index 15f92a9d..1cfc1107 100644
--- a/includes/controller/shifts_controller.php
+++ b/includes/controller/shifts_controller.php
@@ -49,11 +49,11 @@ function shift_edit_controller()
$request = request();
if (!auth()->can('admin_shifts')) {
- redirect(page_link_to('user_shifts'));
+ throw_redirect(page_link_to('user_shifts'));
}
if (!$request->has('edit_shift') || !test_request_int('edit_shift')) {
- redirect(page_link_to('user_shifts'));
+ throw_redirect(page_link_to('user_shifts'));
}
$shift_id = $request->input('edit_shift');
@@ -164,7 +164,7 @@ function shift_edit_controller()
);
success(__('Shift updated.'));
- redirect(shift_link([
+ throw_redirect(shift_link([
'SID' => $shift_id
]));
}
@@ -205,18 +205,18 @@ function shift_delete_controller()
$request = request();
if (!auth()->can('user_shifts_admin')) {
- redirect(page_link_to('user_shifts'));
+ throw_redirect(page_link_to('user_shifts'));
}
// Schicht komplett löschen (nur für admins/user mit user_shifts_admin privileg)
if (!$request->has('delete_shift') || !preg_match('/^\d+$/', $request->input('delete_shift'))) {
- redirect(page_link_to('user_shifts'));
+ throw_redirect(page_link_to('user_shifts'));
}
$shift_id = $request->input('delete_shift');
$shift = Shift($shift_id);
if (empty($shift)) {
- redirect(page_link_to('user_shifts'));
+ throw_redirect(page_link_to('user_shifts'));
}
// Schicht löschen bestätigt
@@ -230,7 +230,7 @@ function shift_delete_controller()
. ' to ' . date('Y-m-d H:i', $shift['end'])
);
success(__('Shift deleted.'));
- redirect(page_link_to('user_shifts'));
+ throw_redirect(page_link_to('user_shifts'));
}
return page_with_title(shifts_title(), [
@@ -256,17 +256,17 @@ function shift_controller()
$request = request();
if (!auth()->can('user_shifts')) {
- redirect(page_link_to('/'));
+ throw_redirect(page_link_to('/'));
}
if (!$request->has('shift_id')) {
- redirect(page_link_to('user_shifts'));
+ throw_redirect(page_link_to('user_shifts'));
}
$shift = Shift($request->input('shift_id'));
if (empty($shift)) {
error(__('Shift could not be found.'));
- redirect(page_link_to('user_shifts'));
+ throw_redirect(page_link_to('user_shifts'));
}
$shifttype = ShiftType($shift['shifttype_id']);
@@ -309,7 +309,7 @@ function shifts_controller()
{
$request = request();
if (!$request->has('action')) {
- redirect(page_link_to('user_shifts'));
+ throw_redirect(page_link_to('user_shifts'));
}
switch ($request->input('action')) {
@@ -319,7 +319,7 @@ function shifts_controller()
case 'next':
shift_next_controller();
default:
- redirect(page_link_to('/'));
+ throw_redirect(page_link_to('/'));
}
return false;
@@ -331,16 +331,16 @@ function shifts_controller()
function shift_next_controller()
{
if (!auth()->can('user_shifts')) {
- redirect(page_link_to('/'));
+ throw_redirect(page_link_to('/'));
}
$upcoming_shifts = ShiftEntries_upcoming_for_user(auth()->user()->id);
if (!empty($upcoming_shifts)) {
- redirect(shift_link($upcoming_shifts[0]));
+ throw_redirect(shift_link($upcoming_shifts[0]));
}
- redirect(page_link_to('user_shifts'));
+ throw_redirect(page_link_to('user_shifts'));
}
/**
diff --git a/includes/controller/shifttypes_controller.php b/includes/controller/shifttypes_controller.php
index 3c825d0c..ede360b8 100644
--- a/includes/controller/shifttypes_controller.php
+++ b/includes/controller/shifttypes_controller.php
@@ -18,12 +18,12 @@ function shifttype_delete_controller()
{
$request = request();
if (!$request->has('shifttype_id')) {
- redirect(page_link_to('shifttypes'));
+ throw_redirect(page_link_to('shifttypes'));
}
$shifttype = ShiftType($request->input('shifttype_id'));
if (empty($shifttype)) {
- redirect(page_link_to('shifttypes'));
+ throw_redirect(page_link_to('shifttypes'));
}
if ($request->hasPostData('delete')) {
@@ -31,7 +31,7 @@ function shifttype_delete_controller()
engelsystem_log('Deleted shifttype ' . $shifttype['name']);
success(sprintf(__('Shifttype %s deleted.'), $shifttype['name']));
- redirect(page_link_to('shifttypes'));
+ throw_redirect(page_link_to('shifttypes'));
}
return [
@@ -59,7 +59,7 @@ function shifttype_edit_controller()
$shifttype = ShiftType($request->input('shifttype_id'));
if (empty($shifttype)) {
error(__('Shifttype not found.'));
- redirect(page_link_to('shifttypes'));
+ throw_redirect(page_link_to('shifttypes'));
}
$shifttype_id = $shifttype['id'];
$name = $shifttype['name'];
@@ -99,7 +99,7 @@ function shifttype_edit_controller()
engelsystem_log('Created shifttype ' . $name);
success(__('Created shifttype.'));
}
- redirect(page_link_to('shifttypes', ['action' => 'view', 'shifttype_id' => $shifttype_id]));
+ throw_redirect(page_link_to('shifttypes', ['action' => 'view', 'shifttype_id' => $shifttype_id]));
}
}
@@ -116,11 +116,11 @@ function shifttype_controller()
{
$request = request();
if (!$request->has('shifttype_id')) {
- redirect(page_link_to('shifttypes'));
+ throw_redirect(page_link_to('shifttypes'));
}
$shifttype = ShiftType($request->input('shifttype_id'));
if (empty($shifttype)) {
- redirect(page_link_to('shifttypes'));
+ throw_redirect(page_link_to('shifttypes'));
}
$angeltype = [];
diff --git a/includes/controller/user_angeltypes_controller.php b/includes/controller/user_angeltypes_controller.php
index 6c64cb27..038d919e 100644
--- a/includes/controller/user_angeltypes_controller.php
+++ b/includes/controller/user_angeltypes_controller.php
@@ -45,18 +45,18 @@ function user_angeltypes_delete_all_controller()
if (!$request->has('angeltype_id')) {
error(__('Angeltype doesn\'t exist.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
$angeltype = AngelType($request->input('angeltype_id'));
if (empty($angeltype)) {
error(__('Angeltype doesn\'t exist.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
if (!User_is_AngelType_supporter(auth()->user(), $angeltype)) {
error(__('You are not allowed to delete all users for this angeltype.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
if ($request->hasPostData('deny_all')) {
@@ -64,7 +64,7 @@ function user_angeltypes_delete_all_controller()
engelsystem_log(sprintf('Denied all users for angeltype %s', AngelType_name_render($angeltype, true)));
success(sprintf(__('Denied all users for angeltype %s.'), AngelType_name_render($angeltype)));
- redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
+ throw_redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
}
return [
@@ -85,18 +85,18 @@ function user_angeltypes_confirm_all_controller()
if (!$request->has('angeltype_id')) {
error(__('Angeltype doesn\'t exist.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
$angeltype = AngelType($request->input('angeltype_id'));
if (empty($angeltype)) {
error(__('Angeltype doesn\'t exist.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
if (!auth()->can('admin_user_angeltypes') && !User_is_AngelType_supporter($user, $angeltype)) {
error(__('You are not allowed to confirm all users for this angeltype.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
if ($request->hasPostData('confirm_all')) {
@@ -104,7 +104,7 @@ function user_angeltypes_confirm_all_controller()
engelsystem_log(sprintf('Confirmed all users for angeltype %s', AngelType_name_render($angeltype, true)));
success(sprintf(__('Confirmed all users for angeltype %s.'), AngelType_name_render($angeltype)));
- redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
+ throw_redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
}
return [
@@ -125,30 +125,30 @@ function user_angeltype_confirm_controller()
if (!$request->has('user_angeltype_id')) {
error(__('User angeltype doesn\'t exist.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
$user_angeltype = UserAngelType($request->input('user_angeltype_id'));
if (empty($user_angeltype)) {
error(__('User angeltype doesn\'t exist.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
$angeltype = AngelType($user_angeltype['angeltype_id']);
if (empty($angeltype)) {
error(__('Angeltype doesn\'t exist.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
if (!User_is_AngelType_supporter($user, $angeltype)) {
error(__('You are not allowed to confirm this users angeltype.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
$user_source = User::find($user_angeltype['user_id']);
if (!$user_source) {
error(__('User doesn\'t exist.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
if ($request->hasPostData('confirm_user')) {
@@ -164,7 +164,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']]));
+ throw_redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
}
return [
@@ -185,30 +185,30 @@ function user_angeltype_delete_controller()
if (!$request->has('user_angeltype_id')) {
error(__('User angeltype doesn\'t exist.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
$user_angeltype = UserAngelType($request->input('user_angeltype_id'));
if (empty($user_angeltype)) {
error(__('User angeltype doesn\'t exist.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
$angeltype = AngelType($user_angeltype['angeltype_id']);
if (empty($angeltype)) {
error(__('Angeltype doesn\'t exist.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
$user_source = User::find($user_angeltype['user_id']);
if (!$user_source) {
error(__('User doesn\'t exist.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
if ($user->id != $user_angeltype['user_id'] && !User_is_AngelType_supporter($user, $angeltype)) {
error(__('You are not allowed to delete this users angeltype.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
if ($request->hasPostData('delete')) {
@@ -217,7 +217,7 @@ function user_angeltype_delete_controller()
engelsystem_log(sprintf('User %s removed from %s.', User_Nick_render($user_source, true), $angeltype['name']));
success(sprintf(__('User %s removed from %s.'), User_Nick_render($user_source), $angeltype['name']));
- redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
+ throw_redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
}
return [
@@ -238,37 +238,37 @@ function user_angeltype_update_controller()
if (!auth()->can('admin_angel_types')) {
error(__('You are not allowed to set supporter rights.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
if (!$request->has('user_angeltype_id')) {
error(__('User angeltype doesn\'t exist.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
if ($request->has('supporter') && preg_match('/^[01]$/', $request->input('supporter'))) {
$supporter = $request->input('supporter') == '1';
} else {
error(__('No supporter update given.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
$user_angeltype = UserAngelType($request->input('user_angeltype_id'));
if (empty($user_angeltype)) {
error(__('User angeltype doesn\'t exist.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
$angeltype = AngelType($user_angeltype['angeltype_id']);
if (empty($angeltype)) {
error(__('Angeltype doesn\'t exist.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
$user_source = User::find($user_angeltype['user_id']);
if (!$user_source) {
error(__('User doesn\'t exist.'));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
if ($request->hasPostData('submit')) {
@@ -288,7 +288,7 @@ function user_angeltype_update_controller()
User_Nick_render($user_source)
));
- redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
+ throw_redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
}
return [
@@ -343,7 +343,7 @@ function user_angeltype_add_controller()
AngelType_name_render($angeltype, true)
));
- redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
+ throw_redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
}
}
@@ -366,7 +366,7 @@ function user_angeltype_join_controller($angeltype)
$user_angeltype = UserAngelType_by_User_and_AngelType($user->id, $angeltype);
if (!empty($user_angeltype)) {
error(sprintf(__('You are already a %s.'), $angeltype['name']));
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
if (request()->hasPostData('submit')) {
@@ -389,7 +389,7 @@ function user_angeltype_join_controller($angeltype)
));
}
- redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
+ throw_redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
}
return [
@@ -407,7 +407,7 @@ function user_angeltypes_controller()
{
$request = request();
if (!$request->has('action')) {
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
switch ($request->input('action')) {
@@ -424,6 +424,6 @@ function user_angeltypes_controller()
case 'add':
return user_angeltype_add_controller();
default:
- redirect(page_link_to('angeltypes'));
+ throw_redirect(page_link_to('angeltypes'));
}
}
diff --git a/includes/controller/user_driver_licenses_controller.php b/includes/controller/user_driver_licenses_controller.php
index 9dc15f15..e6924182 100644
--- a/includes/controller/user_driver_licenses_controller.php
+++ b/includes/controller/user_driver_licenses_controller.php
@@ -42,7 +42,7 @@ function user_driver_licenses_controller()
$user = auth()->user();
if (!$user) {
- redirect(page_link_to(''));
+ throw_redirect(page_link_to(''));
}
$action = strip_request_item('action', 'edit');
@@ -82,7 +82,7 @@ function user_driver_license_load_user()
if ($request->has('user_id')) {
$user_source = User::find($request->input('user_id'));
if (empty($user_source)) {
- redirect(user_driver_license_edit_link());
+ throw_redirect(user_driver_license_edit_link());
}
}
@@ -102,7 +102,7 @@ function user_driver_license_edit_controller()
// only privilege admin_user can edit other users driver license information
if ($user->id != $user_source->id && !auth()->can('admin_user')) {
- redirect(user_driver_license_edit_link());
+ throw_redirect(user_driver_license_edit_link());
}
$user_driver_license = UserDriverLicense($user_source->id);
@@ -131,7 +131,7 @@ function user_driver_license_edit_controller()
}
engelsystem_log('Driver license information updated.');
success(__('Your driver license information has been saved.'));
- redirect(user_link($user_source->id));
+ throw_redirect(user_link($user_source->id));
} else {
error(__('Please select at least one driving license.'));
}
@@ -139,7 +139,7 @@ function user_driver_license_edit_controller()
UserDriverLicenses_delete($user_source->id);
engelsystem_log('Driver license information removed.');
success(__('Your driver license information has been removed.'));
- redirect(user_link($user_source->id));
+ throw_redirect(user_link($user_source->id));
}
}
diff --git a/includes/controller/user_worklog_controller.php b/includes/controller/user_worklog_controller.php
index 7cedea92..6b100338 100644
--- a/includes/controller/user_worklog_controller.php
+++ b/includes/controller/user_worklog_controller.php
@@ -12,7 +12,7 @@ function user_worklog_delete_controller()
$request = request();
$userWorkLog = UserWorkLog($request->input('user_worklog_id'));
if (empty($userWorkLog)) {
- redirect(user_link(auth()->user()->id));
+ throw_redirect(user_link(auth()->user()->id));
}
$user_source = User::find($userWorkLog['user_id']);
@@ -20,7 +20,7 @@ function user_worklog_delete_controller()
UserWorkLog_delete($userWorkLog);
success(__('Work log entry deleted.'));
- redirect(user_link($user_source->id));
+ throw_redirect(user_link($user_source->id));
}
return [
@@ -39,7 +39,7 @@ function user_worklog_edit_controller()
$request = request();
$userWorkLog = UserWorkLog($request->input('user_worklog_id'));
if (empty($userWorkLog)) {
- redirect(user_link(auth()->user()->id));
+ throw_redirect(user_link(auth()->user()->id));
}
$user_source = User::find($userWorkLog['user_id']);
@@ -50,7 +50,7 @@ function user_worklog_edit_controller()
UserWorkLog_update($userWorkLog);
success(__('Work log entry updated.'));
- redirect(user_link($user_source->id));
+ throw_redirect(user_link($user_source->id));
}
}
@@ -109,7 +109,7 @@ function user_worklog_add_controller()
$request = request();
$user_source = User::find($request->input('user_id'));
if (!$user_source) {
- redirect(user_link(auth()->user()->id));
+ throw_redirect(user_link(auth()->user()->id));
}
$userWorkLog = UserWorkLog_new($user_source->id);
@@ -121,7 +121,7 @@ function user_worklog_add_controller()
UserWorkLog_create($userWorkLog);
success(__('Work log entry created.'));
- redirect(user_link($user_source->id));
+ throw_redirect(user_link($user_source->id));
}
}
@@ -185,13 +185,13 @@ function user_worklog_controller()
$user = auth()->user();
if (!auth()->can('admin_user_worklog')) {
- redirect(user_link($user->id));
+ throw_redirect(user_link($user->id));
}
$request = request();
$action = $request->input('action');
if (!$request->has('action')) {
- redirect(user_link($user->id));
+ throw_redirect(user_link($user->id));
}
switch ($action) {
diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php
index 3ad2ffd9..da8a9339 100644
--- a/includes/controller/users_controller.php
+++ b/includes/controller/users_controller.php
@@ -17,7 +17,7 @@ function users_controller()
$request = request();
if (!$user) {
- redirect(page_link_to(''));
+ throw_redirect(page_link_to(''));
}
$action = 'list';
@@ -56,13 +56,13 @@ function user_delete_controller()
}
if (!auth()->can('admin_user')) {
- redirect(page_link_to(''));
+ throw_redirect(page_link_to(''));
}
// You cannot delete yourself
if ($user->id == $user_source->id) {
error(__('You cannot delete yourself.'));
- redirect(user_link($user->id));
+ throw_redirect(user_link($user->id));
}
if ($request->hasPostData('submit')) {
@@ -85,7 +85,7 @@ function user_delete_controller()
success(__('User deleted.'));
engelsystem_log(sprintf('Deleted %s', User_Nick_render($user_source, true)));
- redirect(users_link());
+ throw_redirect(users_link());
}
}
@@ -145,7 +145,7 @@ function user_edit_vouchers_controller()
}
if (!auth()->can('admin_user')) {
- redirect(page_link_to(''));
+ throw_redirect(page_link_to(''));
}
if ($request->hasPostData('submit')) {
@@ -171,7 +171,7 @@ function user_edit_vouchers_controller()
engelsystem_log(User_Nick_render($user_source, true) . ': ' . sprintf('Got %s vouchers',
$user_source->state->got_voucher));
- redirect(user_link($user_source->id));
+ throw_redirect(user_link($user_source->id));
}
}
@@ -194,7 +194,7 @@ function user_controller()
$user_source = User::find($request->input('user_id'));
if (!$user_source) {
error(__('User not found.'));
- redirect(page_link_to('/'));
+ throw_redirect(page_link_to('/'));
}
}
@@ -261,7 +261,7 @@ function users_list_controller()
$request = request();
if (!auth()->can('admin_user')) {
- redirect(page_link_to(''));
+ throw_redirect(page_link_to(''));
}
$order_by = 'name';
@@ -319,13 +319,13 @@ function load_user()
{
$request = request();
if (!$request->has('user_id')) {
- redirect(page_link_to());
+ throw_redirect(page_link_to());
}
$user = User::find($request->input('user_id'));
if (!$user) {
error(__('User doesn\'t exist.'));
- redirect(page_link_to());
+ throw_redirect(page_link_to());
}
return $user;