Renamed redirect() to throwRedirect()
This commit is contained in:
parent
72123fcd31
commit
be39c63f46
|
@ -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;
|
||||
|
|
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 = [];
|
||||
|
|
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -42,11 +42,11 @@ function admin_active()
|
|||
__('At least %s angels are forced to be active. The number has to be greater.'),
|
||||
$forced_count
|
||||
));
|
||||
redirect(page_link_to('admin_active'));
|
||||
throw_redirect(page_link_to('admin_active'));
|
||||
}
|
||||
} else {
|
||||
$msg .= error(__('Please enter a number of angels to be marked as active.'));
|
||||
redirect(page_link_to('admin_active'));
|
||||
throw_redirect(page_link_to('admin_active'));
|
||||
}
|
||||
|
||||
if ($request->hasPostData('ack')) {
|
||||
|
|
|
@ -39,7 +39,7 @@ function admin_arrive()
|
|||
|
||||
engelsystem_log('User set to not arrived: ' . User_Nick_render($user_source, true));
|
||||
success(__('Reset done. Angel has not arrived.'));
|
||||
redirect(user_link($user_source->id));
|
||||
throw_redirect(user_link($user_source->id));
|
||||
} else {
|
||||
$msg = error(__('Angel not found.'), true);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ function admin_arrive()
|
|||
|
||||
engelsystem_log('User set has arrived: ' . User_Nick_render($user_source, true));
|
||||
success(__('Angel has been marked as arrived.'));
|
||||
redirect(user_link($user_source->id));
|
||||
throw_redirect(user_link($user_source->id));
|
||||
} else {
|
||||
$msg = error(__('Angel not found.'), true);
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ function admin_groups()
|
|||
'Group privileges of group ' . $group['Name']
|
||||
. ' edited: ' . join(', ', $privilege_names)
|
||||
);
|
||||
redirect(page_link_to('admin_groups'));
|
||||
throw_redirect(page_link_to('admin_groups'));
|
||||
} else {
|
||||
return error('No Group found.', true);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ function admin_import()
|
|||
}
|
||||
|
||||
if ($valid) {
|
||||
redirect(
|
||||
throw_redirect(
|
||||
page_link_to('admin_import', [
|
||||
'step' => 'check',
|
||||
'shifttype_id' => $shifttype_id,
|
||||
|
@ -134,28 +134,28 @@ function admin_import()
|
|||
case 'check':
|
||||
if (!file_exists($import_file)) {
|
||||
error(__('Missing import file.'));
|
||||
redirect(page_link_to('admin_import'));
|
||||
throw_redirect(page_link_to('admin_import'));
|
||||
}
|
||||
|
||||
if ($request->has('shifttype_id') && isset($shifttypes[$request->input('shifttype_id')])) {
|
||||
$shifttype_id = $request->input('shifttype_id');
|
||||
} else {
|
||||
error(__('Please select a shift type.'));
|
||||
redirect(page_link_to('admin_import'));
|
||||
throw_redirect(page_link_to('admin_import'));
|
||||
}
|
||||
|
||||
if ($request->has('add_minutes_start') && is_numeric(trim($request->input('add_minutes_start')))) {
|
||||
$add_minutes_start = trim($request->input('add_minutes_start'));
|
||||
} else {
|
||||
error(__('Please enter an amount of minutes to add to a talk\'s begin.'));
|
||||
redirect(page_link_to('admin_import'));
|
||||
throw_redirect(page_link_to('admin_import'));
|
||||
}
|
||||
|
||||
if ($request->has('add_minutes_end') && is_numeric(trim($request->input(('add_minutes_end'))))) {
|
||||
$add_minutes_end = trim($request->input('add_minutes_end'));
|
||||
} else {
|
||||
error(__('Please enter an amount of minutes to add to a talk\'s end.'));
|
||||
redirect(page_link_to('admin_import'));
|
||||
throw_redirect(page_link_to('admin_import'));
|
||||
}
|
||||
|
||||
list($rooms_new, $rooms_deleted) = prepare_rooms($import_file);
|
||||
|
@ -229,32 +229,32 @@ function admin_import()
|
|||
case 'import':
|
||||
if (!file_exists($import_file)) {
|
||||
error(__('Missing import file.'));
|
||||
redirect(page_link_to('admin_import'));
|
||||
throw_redirect(page_link_to('admin_import'));
|
||||
}
|
||||
|
||||
if (!file_exists($import_file)) {
|
||||
redirect(page_link_to('admin_import'));
|
||||
throw_redirect(page_link_to('admin_import'));
|
||||
}
|
||||
|
||||
if ($request->has('shifttype_id') && isset($shifttypes[$request->input('shifttype_id')])) {
|
||||
$shifttype_id = $request->input('shifttype_id');
|
||||
} else {
|
||||
error(__('Please select a shift type.'));
|
||||
redirect(page_link_to('admin_import'));
|
||||
throw_redirect(page_link_to('admin_import'));
|
||||
}
|
||||
|
||||
if ($request->has('add_minutes_start') && is_numeric(trim($request->input('add_minutes_start')))) {
|
||||
$add_minutes_start = trim($request->input('add_minutes_start'));
|
||||
} else {
|
||||
error(__('Please enter an amount of minutes to add to a talk\'s begin.'));
|
||||
redirect(page_link_to('admin_import'));
|
||||
throw_redirect(page_link_to('admin_import'));
|
||||
}
|
||||
|
||||
if ($request->has('add_minutes_end') && is_numeric(trim($request->input('add_minutes_end')))) {
|
||||
$add_minutes_end = trim($request->input('add_minutes_end'));
|
||||
} else {
|
||||
error(__('Please enter an amount of minutes to add to a talk\'s end.'));
|
||||
redirect(page_link_to('admin_import'));
|
||||
throw_redirect(page_link_to('admin_import'));
|
||||
}
|
||||
|
||||
list($rooms_new, $rooms_deleted) = prepare_rooms($import_file);
|
||||
|
@ -297,7 +297,7 @@ function admin_import()
|
|||
]) . success(__('It\'s done!'), true);
|
||||
break;
|
||||
default:
|
||||
redirect(page_link_to('admin_import'));
|
||||
throw_redirect(page_link_to('admin_import'));
|
||||
}
|
||||
|
||||
return page_with_title(admin_import_title(), [
|
||||
|
|
|
@ -10,7 +10,7 @@ function admin_news()
|
|||
$request = request();
|
||||
|
||||
if (!$request->has('action')) {
|
||||
redirect(page_link_to('news'));
|
||||
throw_redirect(page_link_to('news'));
|
||||
}
|
||||
|
||||
$html = '<div class="col-md-12"><h1>' . __('Edit news entry') . '</h1>' . msg();
|
||||
|
@ -70,17 +70,17 @@ function admin_news()
|
|||
|
||||
engelsystem_log('News updated: ' . $request->postData('eBetreff'));
|
||||
success(__('News entry updated.'));
|
||||
redirect(page_link_to('news'));
|
||||
throw_redirect(page_link_to('news'));
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$news->delete();
|
||||
engelsystem_log('News deleted: ' . $news->title);
|
||||
success(__('News entry deleted.'));
|
||||
redirect(page_link_to('news'));
|
||||
throw_redirect(page_link_to('news'));
|
||||
break;
|
||||
default:
|
||||
redirect(page_link_to('news'));
|
||||
throw_redirect(page_link_to('news'));
|
||||
}
|
||||
return $html . '</div>';
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ function admin_questions()
|
|||
. ' answered: '
|
||||
. $answer
|
||||
);
|
||||
redirect(page_link_to('admin_questions'));
|
||||
throw_redirect(page_link_to('admin_questions'));
|
||||
} else {
|
||||
return error('Enter an answer!', true);
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ function admin_questions()
|
|||
if (!empty($question)) {
|
||||
$question->delete();
|
||||
engelsystem_log('Question deleted: ' . $question['Question']);
|
||||
redirect(page_link_to('admin_questions'));
|
||||
throw_redirect(page_link_to('admin_questions'));
|
||||
} else {
|
||||
return error('No question found.', true);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ function admin_rooms()
|
|||
if (test_request_int('id')) {
|
||||
$room = Room($request->input('id'));
|
||||
if (empty($room)) {
|
||||
redirect(page_link_to('admin_rooms'));
|
||||
throw_redirect(page_link_to('admin_rooms'));
|
||||
}
|
||||
|
||||
$room_id = $request->input('id');
|
||||
|
@ -140,7 +140,7 @@ function admin_rooms()
|
|||
. ' to: ' . join(', ', $needed_angeltype_info)
|
||||
);
|
||||
success(__('Room saved.'));
|
||||
redirect(page_link_to('admin_rooms'));
|
||||
throw_redirect(page_link_to('admin_rooms'));
|
||||
}
|
||||
}
|
||||
$angeltypes_count_form = [];
|
||||
|
@ -190,7 +190,7 @@ function admin_rooms()
|
|||
Room_delete($room_id);
|
||||
|
||||
success(sprintf(__('Room %s deleted.'), $name));
|
||||
redirect(page_link_to('admin_rooms'));
|
||||
throw_redirect(page_link_to('admin_rooms'));
|
||||
}
|
||||
|
||||
return page_with_title(admin_rooms_title(), [
|
||||
|
|
|
@ -345,7 +345,7 @@ function admin_shifts()
|
|||
!is_array($session->get('admin_shifts_shifts'))
|
||||
|| !is_array($session->get('admin_shifts_types'))
|
||||
) {
|
||||
redirect(page_link_to('admin_shifts'));
|
||||
throw_redirect(page_link_to('admin_shifts'));
|
||||
}
|
||||
|
||||
foreach ($session->get('admin_shifts_shifts', []) as $shift) {
|
||||
|
@ -389,7 +389,7 @@ function admin_shifts()
|
|||
}
|
||||
|
||||
success('Schichten angelegt.');
|
||||
redirect(page_link_to('admin_shifts'));
|
||||
throw_redirect(page_link_to('admin_shifts'));
|
||||
} else {
|
||||
$session->remove('admin_shifts_shifts');
|
||||
$session->remove('admin_shifts_types');
|
||||
|
|
|
@ -22,7 +22,7 @@ function admin_user()
|
|||
$html = '';
|
||||
|
||||
if (!$request->has('id')) {
|
||||
redirect(users_link());
|
||||
throw_redirect(users_link());
|
||||
}
|
||||
|
||||
$user_id = $request->input('id');
|
||||
|
@ -30,7 +30,7 @@ function admin_user()
|
|||
$user_source = User::find($user_id);
|
||||
if (!$user_source) {
|
||||
error(__('This user does not exist.'));
|
||||
redirect(users_link());
|
||||
throw_redirect(users_link());
|
||||
}
|
||||
|
||||
$html .= 'Hallo,<br />'
|
||||
|
|
|
@ -239,7 +239,7 @@ function guest_register()
|
|||
|
||||
// User is already logged in - that means a supporter has registered an angel. Return to register page.
|
||||
if ($authUser) {
|
||||
redirect(page_link_to('register'));
|
||||
throw_redirect(page_link_to('register'));
|
||||
}
|
||||
|
||||
// If a welcome message is present, display it on the next page
|
||||
|
@ -247,7 +247,7 @@ function guest_register()
|
|||
info((new Parsedown())->text($message));
|
||||
}
|
||||
|
||||
redirect(page_link_to('/'));
|
||||
throw_redirect(page_link_to('/'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ function user_messages()
|
|||
'UPDATE `Messages` SET `isRead`=\'Y\' WHERE `id`=? LIMIT 1',
|
||||
[$message_id]
|
||||
);
|
||||
redirect(page_link_to('user_messages'));
|
||||
throw_redirect(page_link_to('user_messages'));
|
||||
} else {
|
||||
return error(__('No Message found.'), true);
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ function user_messages()
|
|||
);
|
||||
if (!empty($message) && $message['SUID'] == $user->id) {
|
||||
DB::delete('DELETE FROM `Messages` WHERE `id`=? LIMIT 1', [$message_id]);
|
||||
redirect(page_link_to('user_messages'));
|
||||
throw_redirect(page_link_to('user_messages'));
|
||||
} else {
|
||||
return error(__('No Message found.'), true);
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ function user_messages()
|
|||
|
||||
case 'send':
|
||||
if (Message_send($request->input('to'), $request->input('text'))) {
|
||||
redirect(page_link_to('user_messages'));
|
||||
throw_redirect(page_link_to('user_messages'));
|
||||
} else {
|
||||
return error(__('Transmitting was terminated with an Error.'), true);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ function user_myshifts()
|
|||
if ($request->input('reset') == 'ack') {
|
||||
User_reset_api_key($user);
|
||||
success(__('Key changed.'));
|
||||
redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user->id]));
|
||||
throw_redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user->id]));
|
||||
}
|
||||
return page_with_title(__('Reset API key'), [
|
||||
error(
|
||||
|
@ -109,7 +109,7 @@ function user_myshifts()
|
|||
. '. Freeloaded: ' . ($freeloaded ? 'YES Comment: ' . $freeload_comment : 'NO')
|
||||
);
|
||||
success(__('Shift saved.'));
|
||||
redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user->id]));
|
||||
throw_redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user->id]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,10 +125,10 @@ function user_myshifts()
|
|||
auth()->can('user_shifts_admin')
|
||||
);
|
||||
} else {
|
||||
redirect(page_link_to('user_myshifts'));
|
||||
throw_redirect(page_link_to('user_myshifts'));
|
||||
}
|
||||
}
|
||||
|
||||
redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user->id]));
|
||||
throw_redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user->id]));
|
||||
return '';
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ function user_news()
|
|||
|
||||
engelsystem_log('Created news: ' . $news->title . ', is meeting: ' . ($news->is_meeting ? 'yes' : 'no'));
|
||||
success(__('Entry saved.'));
|
||||
redirect(page_link_to('news'));
|
||||
throw_redirect(page_link_to('news'));
|
||||
}
|
||||
|
||||
if (preg_match('/^\d{1,}$/', $request->input('page', 0))) {
|
||||
|
|
|
@ -38,7 +38,7 @@ function user_questions()
|
|||
]);
|
||||
|
||||
success(__('You question was saved.'));
|
||||
redirect(page_link_to('user_questions'));
|
||||
throw_redirect(page_link_to('user_questions'));
|
||||
} else {
|
||||
return page_with_title(questions_title(), [
|
||||
error(__('Please enter a question!'), true)
|
||||
|
@ -59,7 +59,7 @@ function user_questions()
|
|||
$question = Question::find($question_id);
|
||||
if (!empty($question) && $question->user_id == $user->id) {
|
||||
$question->delete();
|
||||
redirect(page_link_to('user_questions'));
|
||||
throw_redirect(page_link_to('user_questions'));
|
||||
} else {
|
||||
return page_with_title(questions_title(), [
|
||||
error(__('No question found.'), true)
|
||||
|
|
|
@ -91,7 +91,7 @@ function user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes)
|
|||
$user_source->settings->save();
|
||||
|
||||
success(__('Settings saved.'));
|
||||
redirect(page_link_to('user_settings'));
|
||||
throw_redirect(page_link_to('user_settings'));
|
||||
}
|
||||
|
||||
return $user_source;
|
||||
|
@ -119,7 +119,7 @@ function user_settings_password($user_source)
|
|||
$auth->setPassword($user_source, $request->postData('new_password'));
|
||||
success(__('Password saved.'));
|
||||
}
|
||||
redirect(page_link_to('user_settings'));
|
||||
throw_redirect(page_link_to('user_settings'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -144,7 +144,7 @@ function user_settings_theme($user_source, $themes)
|
|||
$user_source->settings->save();
|
||||
|
||||
success(__('Theme changed.'));
|
||||
redirect(page_link_to('user_settings'));
|
||||
throw_redirect(page_link_to('user_settings'));
|
||||
}
|
||||
|
||||
return $user_source;
|
||||
|
@ -174,7 +174,7 @@ function user_settings_locale($user_source, $locales)
|
|||
$session->set('locale', $user_source->settings->language);
|
||||
|
||||
success('Language changed.');
|
||||
redirect(page_link_to('user_settings'));
|
||||
throw_redirect(page_link_to('user_settings'));
|
||||
}
|
||||
|
||||
return $user_source;
|
||||
|
|
|
@ -25,7 +25,7 @@ function user_shifts()
|
|||
$request = request();
|
||||
|
||||
if (User_is_freeloader(auth()->user())) {
|
||||
redirect(page_link_to('user_myshifts'));
|
||||
throw_redirect(page_link_to('user_myshifts'));
|
||||
}
|
||||
|
||||
if ($request->has('edit_shift')) {
|
||||
|
@ -99,7 +99,7 @@ function load_rooms()
|
|||
);
|
||||
if (empty($rooms)) {
|
||||
error(__('The administration has not configured any rooms yet.'));
|
||||
redirect(page_link_to('/'));
|
||||
throw_redirect(page_link_to('/'));
|
||||
}
|
||||
return $rooms;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ function load_days()
|
|||
error(__('The administration has not configured any shifts yet.'));
|
||||
// Do not try to redirect to the current page
|
||||
if (config('home_site') != 'user_shifts') {
|
||||
redirect(page_link_to('/'));
|
||||
throw_redirect(page_link_to('/'));
|
||||
}
|
||||
}
|
||||
return $days;
|
||||
|
@ -135,7 +135,7 @@ function load_types()
|
|||
|
||||
if (!count(DB::select('SELECT `id`, `name` FROM `AngelTypes`'))) {
|
||||
error(__('The administration has not configured any angeltypes yet - or you are not subscribed to any angeltype.'));
|
||||
redirect(page_link_to('/'));
|
||||
throw_redirect(page_link_to('/'));
|
||||
}
|
||||
$types = DB::select('
|
||||
SELECT
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Engelsystem\Http\Exceptions\HttpTemporaryRedirect;
|
||||
use Engelsystem\ValidationResult;
|
||||
|
||||
/**
|
||||
|
@ -55,10 +56,9 @@ function parse_date($pattern, $value)
|
|||
*
|
||||
* @param string $url
|
||||
*/
|
||||
function redirect($url)
|
||||
function throw_redirect($url)
|
||||
{
|
||||
header('Location: ' . $url, true, 302);
|
||||
raw_output('');
|
||||
throw new HttpTemporaryRedirect($url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -219,7 +219,7 @@ class LegacyMiddleware implements MiddlewareInterface
|
|||
return [$title, $content];
|
||||
}
|
||||
|
||||
redirect(page_link_to('login'));
|
||||
throw_redirect(page_link_to('login'));
|
||||
|
||||
return [];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue