diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php index f239649e..49bced64 100644 --- a/includes/controller/angeltypes_controller.php +++ b/includes/controller/angeltypes_controller.php @@ -48,7 +48,7 @@ function angeltypes_controller() function angeltype_link($angeltype_id, $params = []) { $params = array_merge(['action' => 'view', 'angeltype_id' => $angeltype_id], $params); - return page_link_to('angeltypes', $params); + return url('/angeltypes', $params); } /** @@ -59,7 +59,7 @@ function angeltype_link($angeltype_id, $params = []) function angeltype_delete_controller() { if (!auth()->can('admin_angel_types')) { - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } $angeltype = AngelType::findOrFail(request()->input('angeltype_id')); @@ -68,7 +68,7 @@ function angeltype_delete_controller() $angeltype->delete(); engelsystem_log('Deleted angeltype: ' . AngelType_name_render($angeltype, true)); success(sprintf(__('Angeltype %s deleted.'), $angeltype->name)); - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } return [ @@ -93,13 +93,13 @@ function angeltype_edit_controller() $angeltype = AngelType::findOrFail($request->input('angeltype_id')); if (!auth()->user()?->isAngelTypeSupporter($angeltype) && !auth()->can('admin_user_angeltypes')) { - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } } else { // New angeltype if ($supporter_mode) { // Supporters aren't allowed to create new angeltypes. - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } $angeltype = new AngelType(); } @@ -169,7 +169,7 @@ function angeltype_controller() $user = auth()->user(); if (!auth()->can('angeltypes')) { - throw_redirect(page_link_to('/')); + throw_redirect(url('/')); } $angeltype = AngelType::findOrFail(request()->input('angeltype_id')); @@ -275,14 +275,14 @@ function angeltypes_list_controller() $user = auth()->user(); if (!auth()->can('angeltypes')) { - throw_redirect(page_link_to('/')); + throw_redirect(url('/')); } $angeltypes = AngelTypes_with_user($user->id); foreach ($angeltypes as $angeltype) { $actions = [ button( - page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id]), + url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id]), icon('eye') . __('view'), 'btn-sm' ), @@ -290,12 +290,12 @@ function angeltypes_list_controller() if (auth()->can('admin_angel_types')) { $actions[] = button( - page_link_to('angeltypes', ['action' => 'edit', 'angeltype_id' => $angeltype->id]), + url('/angeltypes', ['action' => 'edit', 'angeltype_id' => $angeltype->id]), icon('pencil') . __('edit'), 'btn-sm' ); $actions[] = button( - page_link_to('angeltypes', ['action' => 'delete', 'angeltype_id' => $angeltype->id]), + url('/angeltypes', ['action' => 'delete', 'angeltype_id' => $angeltype->id]), icon('trash') . __('delete'), 'btn-sm' ); @@ -304,8 +304,8 @@ function angeltypes_list_controller() $angeltype->membership = AngelType_render_membership($angeltype); if (!empty($angeltype->user_angel_type_id)) { $actions[] = button( - page_link_to( - 'user_angeltypes', + url( + '/user-angeltypes', ['action' => 'delete', 'user_angeltype_id' => $angeltype->user_angel_type_id] ), icon('box-arrow-right') . __('leave'), @@ -313,7 +313,7 @@ function angeltypes_list_controller() ); } else { $actions[] = button( - page_link_to('user_angeltypes', ['action' => 'add', 'angeltype_id' => $angeltype->id]), + url('/user_angeltypes', ['action' => 'add', 'angeltype_id' => $angeltype->id]), icon('box-arrow-in-right') . __('join'), 'btn-sm' ); @@ -323,7 +323,7 @@ function angeltypes_list_controller() $angeltype->shift_self_signup_allowed = $angeltype->shift_self_signup ? icon('pencil-square') : ''; $angeltype->name = '' . $angeltype->name . ''; diff --git a/includes/controller/event_config_controller.php b/includes/controller/event_config_controller.php index 53c54673..16322acf 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')) { - throw_redirect(page_link_to('/')); + throw_redirect(url('/')); } $request = request(); @@ -118,7 +118,7 @@ function event_config_edit_controller() ) ); success(__('settings.success')); - throw_redirect(page_link_to('admin_event_config')); + throw_redirect(url('/admin_event_config')); } } diff --git a/includes/controller/locations_controller.php b/includes/controller/locations_controller.php index 9dff1cf4..b1d0bff1 100644 --- a/includes/controller/locations_controller.php +++ b/includes/controller/locations_controller.php @@ -17,7 +17,7 @@ use Engelsystem\ShiftsFilterRenderer; function location_controller(): array { if (!auth()->can('view_locations')) { - throw_redirect(page_link_to()); + throw_redirect(url('/')); } $request = request(); @@ -73,8 +73,8 @@ function locations_controller(): array return match ($action) { 'view' => location_controller(), - 'list' => throw_redirect(page_link_to('admin/locations')), - default => throw_redirect(page_link_to('admin/locations')), + 'list' => throw_redirect(url('/admin/locations')), + default => throw_redirect(url('/admin/locations')), }; } @@ -84,7 +84,7 @@ function locations_controller(): array */ function location_link(Location $location) { - return page_link_to('locations', ['action' => 'view', 'location_id' => $location->id]); + return url('/locations', ['action' => 'view', 'location_id' => $location->id]); } /** @@ -95,12 +95,12 @@ function location_link(Location $location) function load_location() { if (!test_request_int('location_id')) { - throw_redirect(page_link_to()); + throw_redirect(url('/')); } $location = Location::find(request()->input('location_id')); if (!$location) { - throw_redirect(page_link_to()); + throw_redirect(url('/')); } return $location; diff --git a/includes/controller/public_dashboard_controller.php b/includes/controller/public_dashboard_controller.php index 04fefbb6..22370577 100644 --- a/includes/controller/public_dashboard_controller.php +++ b/includes/controller/public_dashboard_controller.php @@ -136,5 +136,5 @@ function public_dashboard_needed_angels($needed_angels, ShiftsFilter $filter = n */ function public_dashboard_link(array $parameters = []): string { - return page_link_to('public-dashboard', $parameters); + return url('/public-dashboard', $parameters); } diff --git a/includes/controller/shift_entries_controller.php b/includes/controller/shift_entries_controller.php index 2fd08d68..66d97c63 100644 --- a/includes/controller/shift_entries_controller.php +++ b/includes/controller/shift_entries_controller.php @@ -18,7 +18,7 @@ function shift_entries_controller(): array { $user = auth()->user(); if (!$user) { - throw_redirect(page_link_to('login')); + throw_redirect(url('/login')); } $action = strip_request_item('action'); @@ -44,7 +44,7 @@ function shift_entry_create_controller(): array $request = request(); if ($user->isFreeloader()) { - throw_redirect(page_link_to('user_myshifts')); + throw_redirect(url('/user_myshifts')); } $shift = Shift($request->input('shift_id')); @@ -272,7 +272,7 @@ function shift_entry_create_link(Shift $shift, AngelType $angeltype, $params = [ 'shift_id' => $shift->id, 'angeltype_id' => $angeltype->id, ], $params); - return page_link_to('shift_entries', $params); + return url('/shift-entries', $params); } /** @@ -288,7 +288,7 @@ function shift_entry_create_link_admin(Shift $shift, $params = []) 'action' => 'create', 'shift_id' => $shift->id, ], $params); - return page_link_to('shift_entries', $params); + return url('/shift-entries', $params); } /** @@ -301,7 +301,7 @@ function shift_entry_load() $request = request(); if (!$request->has('shift_entry_id') || !test_request_int('shift_entry_id')) { - throw_redirect(page_link_to('user_shifts')); + throw_redirect(url('/user-shifts')); } $shiftEntry = ShiftEntry::findOrFail($request->input('shift_entry_id')); @@ -362,5 +362,5 @@ function shift_entry_delete_link($shiftEntry, $params = []) 'action' => 'delete', 'shift_entry_id' => $shiftEntry['shift_entry_id'] ?? $shiftEntry['id'], ], $params); - return page_link_to('shift_entries', $params); + return url('/shift-entries', $params); } diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php index 4a6e8781..8d7c1bed 100644 --- a/includes/controller/shifts_controller.php +++ b/includes/controller/shifts_controller.php @@ -20,7 +20,7 @@ function shift_link($shift) $parameters['shift_id'] = $shift['shift_id'] ?? $shift['id']; } - return page_link_to('shifts', $parameters); + return url('/shifts', $parameters); } /** @@ -29,7 +29,7 @@ function shift_link($shift) */ function shift_delete_link(Shift $shift) { - return page_link_to('user_shifts', ['delete_shift' => $shift->id]); + return url('/user-shifts', ['delete_shift' => $shift->id]); } /** @@ -38,7 +38,7 @@ function shift_delete_link(Shift $shift) */ function shift_edit_link(Shift $shift) { - return page_link_to('user_shifts', ['edit_shift' => $shift->id]); + return url('/user-shifts', ['edit_shift' => $shift->id]); } /** @@ -52,11 +52,11 @@ function shift_edit_controller() $request = request(); if (!auth()->can('admin_shifts')) { - throw_redirect(page_link_to('user_shifts')); + throw_redirect(url('/user-shifts')); } if (!$request->has('edit_shift') || !test_request_int('edit_shift')) { - throw_redirect(page_link_to('user_shifts')); + throw_redirect(url('/user-shifts')); } $shift_id = $request->input('edit_shift'); @@ -201,7 +201,7 @@ function shift_edit_controller() ); } - $link = button(page_link_to('shifts', ['action' => 'view', 'shift_id' => $shift_id]), icon('chevron-left'), 'btn-sm'); + $link = button(url('/shifts', ['action' => 'view', 'shift_id' => $shift_id]), icon('chevron-left'), 'btn-sm'); return page_with_title( $link . ' ' . shifts_title(), [ @@ -233,18 +233,18 @@ function shift_delete_controller() $request = request(); if (!auth()->can('user_shifts_admin')) { - throw_redirect(page_link_to('user_shifts')); + throw_redirect(url('/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'))) { - throw_redirect(page_link_to('user_shifts')); + throw_redirect(url('/user-shifts')); } $shift_id = $request->input('delete_shift'); $shift = Shift($shift_id); if (empty($shift)) { - throw_redirect(page_link_to('user_shifts')); + throw_redirect(url('/user-shifts')); } // Schicht löschen bestätigt @@ -270,10 +270,10 @@ function shift_delete_controller() . ' to ' . $shift->end->format('Y-m-d H:i') ); success(__('Shift deleted.')); - throw_redirect(page_link_to('user_shifts')); + throw_redirect(url('/user-shifts')); } - $link = button(page_link_to('shifts', ['action' => 'view', 'shift_id' => $shift_id]), icon('chevron-left'), 'btn-sm'); + $link = button(url('/shifts', ['action' => 'view', 'shift_id' => $shift_id]), icon('chevron-left'), 'btn-sm'); return page_with_title( $link . ' ' . shifts_title(), [ @@ -300,17 +300,17 @@ function shift_controller() $request = request(); if (!auth()->can('user_shifts')) { - throw_redirect(page_link_to('/')); + throw_redirect(url('/')); } if (!$request->has('shift_id')) { - throw_redirect(page_link_to('user_shifts')); + throw_redirect(url('/user-shifts')); } $shift = Shift($request->input('shift_id')); if (empty($shift)) { error(__('Shift could not be found.')); - throw_redirect(page_link_to('user_shifts')); + throw_redirect(url('/user-shifts')); } $shifttype = $shift->shiftType; @@ -357,13 +357,13 @@ function shifts_controller() { $request = request(); if (!$request->has('action')) { - throw_redirect(page_link_to('user_shifts')); + throw_redirect(url('/user-shifts')); } return match ($request->input('action')) { 'view' => shift_controller(), 'next' => shift_next_controller(), // throws redirect - default => throw_redirect(page_link_to('/')), + default => throw_redirect(url('/')), }; } @@ -373,7 +373,7 @@ function shifts_controller() function shift_next_controller() { if (!auth()->can('user_shifts')) { - throw_redirect(page_link_to('/')); + throw_redirect(url('/')); } $upcoming_shifts = ShiftEntries_upcoming_for_user(auth()->user()); @@ -382,5 +382,5 @@ function shift_next_controller() throw_redirect(shift_link($upcoming_shifts[0]->shift)); } - throw_redirect(page_link_to('user_shifts')); + throw_redirect(url('/user-shifts')); } diff --git a/includes/controller/shifttypes_controller.php b/includes/controller/shifttypes_controller.php index 0f1cdfe4..3ade5864 100644 --- a/includes/controller/shifttypes_controller.php +++ b/includes/controller/shifttypes_controller.php @@ -8,7 +8,7 @@ use Engelsystem\Models\Shifts\ShiftType; */ function shifttype_link(ShiftType $shifttype) { - return page_link_to('shifttypes', ['action' => 'view', 'shifttype_id' => $shifttype->id]); + return url('/shifttypes', ['action' => 'view', 'shifttype_id' => $shifttype->id]); } /** @@ -20,7 +20,7 @@ function shifttype_delete_controller() { $request = request(); if (!$request->has('shifttype_id')) { - throw_redirect(page_link_to('shifttypes')); + throw_redirect(url('/shifttypes')); } $shifttype = ShiftType::findOrFail($request->input('shifttype_id')); @@ -29,7 +29,7 @@ function shifttype_delete_controller() success(sprintf(__('Shifttype %s deleted.'), $shifttype->name)); $shifttype->delete(); - throw_redirect(page_link_to('shifttypes')); + throw_redirect(url('/shifttypes')); } return [ @@ -88,7 +88,7 @@ function shifttype_edit_controller() success(__('Created shifttype.')); } - throw_redirect(page_link_to('shifttypes', ['action' => 'view', 'shifttype_id' => $shifttype_id])); + throw_redirect(url('/shifttypes', ['action' => 'view', 'shifttype_id' => $shifttype_id])); } } @@ -105,7 +105,7 @@ function shifttype_controller() { $request = request(); if (!$request->has('shifttype_id')) { - throw_redirect(page_link_to('shifttypes')); + throw_redirect(url('/shifttypes')); } $shifttype = ShiftType::findOrFail($request->input('shifttype_id')); diff --git a/includes/controller/user_angeltypes_controller.php b/includes/controller/user_angeltypes_controller.php index 7b77a739..7eb06efc 100644 --- a/includes/controller/user_angeltypes_controller.php +++ b/includes/controller/user_angeltypes_controller.php @@ -36,7 +36,7 @@ function user_angeltypes_unconfirmed_hint() $unconfirmed_links = []; foreach ($unconfirmed_user_angeltypes as $user_angeltype) { $unconfirmed_links[] = '' . $user_angeltype->angelType->name . ' (+' . $user_angeltype->count . ')' . ''; @@ -65,13 +65,13 @@ function user_angeltypes_delete_all_controller(): array if (!$request->has('angeltype_id')) { error(__('Angeltype doesn\'t exist.')); - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } $angeltype = AngelType::findOrFail($request->input('angeltype_id')); if (!auth()->user()->isAngelTypeSupporter($angeltype) && !auth()->can('admin_user_angeltypes')) { error(__('You are not allowed to delete all users for this angeltype.')); - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } if ($request->hasPostData('deny_all')) { @@ -81,7 +81,7 @@ function user_angeltypes_delete_all_controller(): array engelsystem_log(sprintf('Denied all users for angeltype %s', AngelType_name_render($angeltype, true))); success(sprintf(__('Denied all users for angeltype %s.'), $angeltype->name)); - throw_redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])); + throw_redirect(url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])); } return [ @@ -102,13 +102,13 @@ function user_angeltypes_confirm_all_controller(): array if (!$request->has('angeltype_id')) { error(__('Angeltype doesn\'t exist.')); - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } $angeltype = AngelType::findOrFail($request->input('angeltype_id')); if (!auth()->can('admin_user_angeltypes') && !$user->isAngelTypeSupporter($angeltype)) { error(__('You are not allowed to confirm all users for this angeltype.')); - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } if ($request->hasPostData('confirm_all')) { @@ -125,7 +125,7 @@ function user_angeltypes_confirm_all_controller(): array user_angeltype_confirm_email($user, $angeltype); } - throw_redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])); + throw_redirect(url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])); } return [ @@ -146,7 +146,7 @@ function user_angeltype_confirm_controller(): array if (!$request->has('user_angeltype_id')) { error(__('User angeltype doesn\'t exist.')); - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } /** @var UserAngelType $user_angeltype */ @@ -154,7 +154,7 @@ function user_angeltype_confirm_controller(): array $angeltype = $user_angeltype->angelType; if (!$user->isAngelTypeSupporter($angeltype) && !auth()->can('admin_user_angeltypes')) { error(__('You are not allowed to confirm this users angeltype.')); - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } $user_source = $user_angeltype->user; @@ -171,7 +171,7 @@ function user_angeltype_confirm_controller(): array user_angeltype_confirm_email($user_source, $angeltype); - throw_redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])); + throw_redirect(url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])); } return [ @@ -224,7 +224,7 @@ function user_angeltype_delete_controller(): array if (!$request->has('user_angeltype_id')) { error(__('User angeltype doesn\'t exist.')); - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } /** @var UserAngelType $user_angeltype */ @@ -237,7 +237,7 @@ function user_angeltype_delete_controller(): array && !auth()->can('admin_user_angeltypes') ) { error(__('You are not allowed to delete this users angeltype.')); - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } if ($request->hasPostData('delete')) { @@ -246,7 +246,7 @@ function user_angeltype_delete_controller(): array engelsystem_log(sprintf('User %s removed from %s.', User_Nick_render($user_source, true), $angeltype->name)); success(sprintf(__('User %s removed from %s.'), $user_source->displayName, $angeltype->name)); - throw_redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])); + throw_redirect(url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])); } return [ @@ -267,19 +267,19 @@ function user_angeltype_update_controller(): array if (!auth()->can('admin_angel_types')) { error(__('You are not allowed to set supporter rights.')); - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } if (!$request->has('user_angeltype_id')) { error(__('User angeltype doesn\'t exist.')); - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } if ($request->has('supporter') && preg_match('/^[01]$/', $request->input('supporter'))) { $supporter = $request->input('supporter') == '1'; } else { error(__('No supporter update given.')); - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } /** @var UserAngelType $user_angeltype */ @@ -301,7 +301,7 @@ function user_angeltype_update_controller(): array )); success(sprintf($msg, $angeltype->name, $user_source->displayName)); - throw_redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])); + throw_redirect(url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])); } return [ @@ -362,7 +362,7 @@ function user_angeltype_add_controller(): array user_angeltype_add_email($user_source, $angeltype); - throw_redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])); + throw_redirect(url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])); } } @@ -386,7 +386,7 @@ function user_angeltype_join_controller(AngelType $angeltype) $user_angeltype = UserAngelType::whereUserId($user->id)->where('angel_type_id', $angeltype->id)->first(); if (!empty($user_angeltype)) { error(sprintf(__('You are already a %s.'), $angeltype->name)); - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } $request = request(); @@ -414,7 +414,7 @@ function user_angeltype_join_controller(AngelType $angeltype) )); } - throw_redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])); + throw_redirect(url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])); } return [ @@ -432,7 +432,7 @@ function user_angeltypes_controller(): array { $request = request(); if (!$request->has('action')) { - throw_redirect(page_link_to('angeltypes')); + throw_redirect(url('/angeltypes')); } return match ($request->input('action')) { @@ -442,6 +442,6 @@ function user_angeltypes_controller(): array 'delete' => user_angeltype_delete_controller(), 'update' => user_angeltype_update_controller(), 'add' => user_angeltype_add_controller(), - default => throw_redirect(page_link_to('angeltyps')), + default => throw_redirect(url('/angeltyps')), }; } diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php index 295e2b78..7662b424 100644 --- a/includes/controller/users_controller.php +++ b/includes/controller/users_controller.php @@ -20,7 +20,7 @@ function users_controller() $request = request(); if (!$user) { - throw_redirect(page_link_to()); + throw_redirect(url('/')); } $action = 'list'; @@ -55,7 +55,7 @@ function user_delete_controller() } if (!auth()->can('admin_user')) { - throw_redirect(page_link_to()); + throw_redirect(url('/')); } // You cannot delete yourself @@ -101,7 +101,7 @@ function user_delete_controller() */ function users_link() { - return page_link_to('users'); + return url('/users'); } /** @@ -110,7 +110,7 @@ function users_link() */ function user_edit_link($userId) { - return page_link_to('admin_user', ['user_id' => $userId]); + return url('/admin-user', ['user_id' => $userId]); } /** @@ -119,7 +119,7 @@ function user_edit_link($userId) */ function user_delete_link($userId) { - return page_link_to('users', ['action' => 'delete', 'user_id' => $userId]); + return url('/users', ['action' => 'delete', 'user_id' => $userId]); } /** @@ -128,7 +128,7 @@ function user_delete_link($userId) */ function user_link($userId) { - return page_link_to('users', ['action' => 'view', 'user_id' => $userId]); + return url('/users', ['action' => 'view', 'user_id' => $userId]); } /** @@ -149,7 +149,7 @@ function user_edit_vouchers_controller() (!auth()->can('admin_user') && !auth()->can('voucher.edit')) || !config('enable_voucher') ) { - throw_redirect(page_link_to()); + throw_redirect(url('/')); } if ($request->hasPostData('submit')) { @@ -200,7 +200,7 @@ function user_controller() $user_source = User::find($request->input('user_id')); if (!$user_source) { error(__('User not found.')); - throw_redirect(page_link_to('/')); + throw_redirect(url('/')); } } @@ -271,7 +271,7 @@ function users_list_controller() $request = request(); if (!auth()->can('admin_user')) { - throw_redirect(page_link_to()); + throw_redirect(url('/')); } $order_by = 'name'; @@ -343,13 +343,13 @@ function load_user() { $request = request(); if (!$request->has('user_id')) { - throw_redirect(page_link_to()); + throw_redirect(url('/')); } $user = User::find($request->input('user_id')); if (!$user) { error(__('User doesn\'t exist.')); - throw_redirect(page_link_to()); + throw_redirect(url('/')); } return $user; diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php index 4b4ac744..f2f3bbad 100644 --- a/includes/pages/admin_active.php +++ b/includes/pages/admin_active.php @@ -47,11 +47,11 @@ function admin_active() __('At least %s angels are forced to be active. The number has to be greater.'), $forced_count )); - throw_redirect(page_link_to('admin_active')); + throw_redirect(url('/admin-active')); } } else { $msg .= error(__('Please enter a number of angels to be marked as active.')); - throw_redirect(page_link_to('admin_active')); + throw_redirect(url('/admin-active')); } if ($request->hasPostData('ack')) { @@ -97,9 +97,9 @@ function admin_active() $msg = success(__('Marked angels.'), true); } else { $set_active = form([ - button(page_link_to('admin_active', ['search' => $search]), '« ' . __('back')), + button(url('/admin-active', ['search' => $search]), '« ' . __('back')), form_submit('ack', '» ' . __('apply')), - ], page_link_to('admin_active', ['search' => $search, 'count' => $count, 'set_active' => 1])); + ], url('/admin-active', ['search' => $search, 'count' => $count, 'set_active' => 1])); } } @@ -237,7 +237,7 @@ function admin_active() } $actions[] = form( [form_submit('submit', __('set active'), 'btn-sm', false, 'secondary')], - page_link_to('admin_active', $parameters), + url('/admin-active', $parameters), false, true ); @@ -252,7 +252,7 @@ function admin_active() } $actions[] = form( [form_submit('submit', __('remove active'), 'btn-sm', false, 'secondary')], - page_link_to('admin_active', $parametersRemove), + url('/admin-active', $parametersRemove), false, true ); @@ -269,7 +269,7 @@ function admin_active() if ($goodie_enabled) { $actions[] = form( [form_submit('submit', ($goodie_tshirt ? __('got t-shirt') : __('got goodie')), 'btn-sm', false, 'secondary')], - page_link_to('admin_active', $parametersShirt), + url('/admin-active', $parametersShirt), false, true ); @@ -287,7 +287,7 @@ function admin_active() if ($goodie_enabled) { $actions[] = form( [form_submit('submit', ($goodie_tshirt ? __('remove t-shirt') : __('remove goodie')), 'btn-sm', false, 'secondary')], - page_link_to('admin_active', $parameters), + url('/admin-active', $parameters), false, true ); @@ -329,7 +329,7 @@ function admin_active() form_text('search', __('Search angel:'), $search), form_checkbox('show_all_shifts', __('Show all shifts'), $show_all_shifts), form_submit('submit', __('form.search')), - ], page_link_to('admin_active')), + ], url('/admin-active')), $set_active == '' ? form([ form_text('count', __('How much angels should be active?'), $count ?: $forced_count), form_submit('set_active', __('form.preview')), diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php index 574f885b..02edfedf 100644 --- a/includes/pages/admin_arrive.php +++ b/includes/pages/admin_arrive.php @@ -198,7 +198,7 @@ function admin_arrive() form([ form_text('search', __('form.search'), $search), form_submit('submit', __('form.search')), - ], page_link_to('admin_arrive')), + ], url('/admin-arrive')), table([ 'name' => __('general.name'), 'rendered_planned_arrival_date' => __('Planned arrival'), diff --git a/includes/pages/admin_free.php b/includes/pages/admin_free.php index 76c91d97..6109df5f 100644 --- a/includes/pages/admin_free.php +++ b/includes/pages/admin_free.php @@ -106,7 +106,7 @@ function admin_free() : icon('eye-slash'), 'actions' => auth()->can('admin_user') - ? button(page_link_to('admin_user', ['id' => $usr->id]), icon('pencil') . __('edit'), 'btn-sm') + ? button(url('/admin-user', ['id' => $usr->id]), icon('pencil') . __('edit'), 'btn-sm') : '', ]; } diff --git a/includes/pages/admin_groups.php b/includes/pages/admin_groups.php index 94c0363f..f8c58c97 100644 --- a/includes/pages/admin_groups.php +++ b/includes/pages/admin_groups.php @@ -38,8 +38,8 @@ function admin_groups() 'name' => $group->name, 'privileges' => join(', ', $privileges_html), 'actions' => button( - page_link_to( - 'admin_groups', + url( + '/admin-groups', ['action' => 'edit', 'id' => $group->id] ), icon('pencil') . __('edit'), @@ -83,7 +83,7 @@ function admin_groups() $html .= page_with_title(__('Edit group') . ' ' . $group->name, [ form( $privileges_form, - page_link_to('admin_groups', ['action' => 'save', 'id' => $group->id]) + url('/admin-groups', ['action' => 'save', 'id' => $group->id]) ), ]); } else { @@ -118,7 +118,7 @@ function admin_groups() 'Group privileges of group ' . $group->name . ' edited: ' . join(', ', $privilege_names) ); - throw_redirect(page_link_to('admin_groups')); + throw_redirect(url('/admin-groups')); } else { return error('No Group found.', true); } diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php index 0c5cebf1..2e6d0cfb 100644 --- a/includes/pages/admin_shifts.php +++ b/includes/pages/admin_shifts.php @@ -391,7 +391,7 @@ function admin_shifts() !is_array($session->get('admin_shifts_shifts')) || !is_array($session->get('admin_shifts_types')) ) { - throw_redirect(page_link_to('admin_shifts')); + throw_redirect(url('/admin-shifts')); } $transactionId = Str::uuid(); @@ -428,7 +428,7 @@ function admin_shifts() } success('Shifts created.'); - throw_redirect(page_link_to('admin_shifts')); + throw_redirect(url('/admin-shifts')); } else { $session->remove('admin_shifts_shifts'); $session->remove('admin_shifts_types'); @@ -453,11 +453,11 @@ function admin_shifts() . ''; } - $link = button(page_link_to('user-shifts'), icon('chevron-left'), 'btn-sm'); + $link = button(url('/user-shifts'), icon('chevron-left'), 'btn-sm'); return page_with_title( $link . ' ' . admin_shifts_title() . ' ' . sprintf( '%s', - page_link_to('admin_shifts_history'), + url('/admin-shifts-history'), icon('clock-history') ), [ @@ -614,7 +614,7 @@ function admin_shifts_history(): string } success(sprintf(__('%s shifts deleted.'), count($shifts))); - throw_redirect(page_link_to('admin_shifts_history')); + throw_redirect(url('/admin-shifts-history')); } $schedules = Schedule::all()->pluck('name', 'id')->toArray(); diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index 38a89886..ce281878 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -50,7 +50,7 @@ function admin_user() } $html .= '

'; $html .= '
' . "\n"; $html .= form_csrf(); $html .= '' . "\n"; @@ -129,7 +129,7 @@ function admin_user() $html .= form_info('', __('Please visit the angeltypes page or the users profile to manage the users angeltypes.')); $html .= ' ' . __('Here you can reset the password of this angel:') . '' . "\n"; $html .= form_csrf(); $html .= '
' . "\n"; @@ -158,7 +158,7 @@ function admin_user() && ($my_highest_group >= $angel_highest_group || is_null($angel_highest_group)) ) { $html .= __('Here you can define the user groups of the angel:') . '' . "\n"; $html .= form_csrf(); $html .= '
'; @@ -303,7 +303,7 @@ function admin_user() } } - $link = button(page_link_to('users', ['action' => 'view', 'user_id' => $user_id]), icon('chevron-left'), 'btn-sm'); + $link = button(url('/users', ['action' => 'view', 'user_id' => $user_id]), icon('chevron-left'), 'btn-sm'); return page_with_title( $link . ' ' . __('Edit user'), [ diff --git a/includes/pages/user_myshifts.php b/includes/pages/user_myshifts.php index 67751795..4c807657 100644 --- a/includes/pages/user_myshifts.php +++ b/includes/pages/user_myshifts.php @@ -37,14 +37,14 @@ function user_myshifts() if ($request->input('reset') == 'ack') { User_reset_api_key($user); success(__('Key changed.')); - throw_redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user->id])); + throw_redirect(url('/users', ['action' => 'view', 'user_id' => $shifts_user->id])); } return page_with_title(__('Reset API key'), [ error( __('If you reset the key, the url to your iCal- and JSON-export and your atom/rss feed changes! You have to update it in every application using one of these exports.'), true ), - button(page_link_to('user_myshifts', ['reset' => 'ack']), __('Continue'), 'btn-danger'), + button(url('/user-myshifts', ['reset' => 'ack']), __('Continue'), 'btn-danger'), ]); } elseif ($request->has('edit') && preg_match('/^\d+$/', $request->input('edit'))) { $shift_entry_id = $request->input('edit'); @@ -90,7 +90,7 @@ function user_myshifts() . '. Freeloaded: ' . ($freeloaded ? 'YES Comment: ' . $freeloaded_comment : 'NO') ); success(__('Shift saved.')); - throw_redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user->id])); + throw_redirect(url('/users', ['action' => 'view', 'user_id' => $shifts_user->id])); } } @@ -106,10 +106,10 @@ function user_myshifts() auth()->can('user_shifts_admin') ); } else { - throw_redirect(page_link_to('user_myshifts')); + throw_redirect(url('/user-myshifts')); } } - throw_redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user->id])); + throw_redirect(url('/users', ['action' => 'view', 'user_id' => $shifts_user->id])); return ''; } diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 0755dd68..d805ea22 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -34,7 +34,7 @@ function user_shifts() $request = request(); if (auth()->user()->isFreeloader()) { - throw_redirect(page_link_to('user_myshifts')); + throw_redirect(url('/user-myshifts')); } if ($request->has('edit_shift')) { @@ -137,7 +137,7 @@ function load_locations(bool $onlyWithActiveShifts = false) if ($locations->isEmpty()) { error(__('The administration has not configured any locations yet.')); - throw_redirect(page_link_to('/')); + throw_redirect(url('/')); } return $locations; @@ -162,7 +162,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') { - throw_redirect(page_link_to('/')); + throw_redirect(url('/')); } } return $days; @@ -178,7 +178,7 @@ function load_types() if (!AngelType::count()) { error(__('The administration has not configured any angeltypes yet - or you are not subscribed to any angeltype.')); - throw_redirect(page_link_to('/')); + throw_redirect(url('/')); } $types = Db::select( @@ -289,7 +289,7 @@ function view_user_shifts() return Carbon::make($value)->format(__('Y-m-d')); })->toArray(); - $link = button(page_link_to('admin-shifts'), icon('plus-lg'), 'add'); + $link = button(url('/admin-shifts'), icon('plus-lg'), 'add'); return page([ div('col-md-12', [ @@ -371,9 +371,9 @@ function ical_hint() return heading(__('iCal export and API') . ' ' . button_help('user/ical'), 2) . '

' . sprintf( __('Export your own shifts. iCal format or JSON format available (please keep secret, otherwise reset the api key).'), - page_link_to('ical', ['key' => $user->api_key]), - page_link_to('shifts_json_export', ['key' => $user->api_key]), - page_link_to('user_myshifts', ['reset' => 1]) + url('/ical', ['key' => $user->api_key]), + url('/shifts-json-export', ['key' => $user->api_key]), + url('/user-myshifts', ['reset' => 1]) ) . '

diff --git a/resources/views/pages/news/overview.twig b/resources/views/pages/news/overview.twig index 7fea140f..1081a649 100644 --- a/resources/views/pages/news/overview.twig +++ b/resources/views/pages/news/overview.twig @@ -9,7 +9,7 @@

{{ block('title') }} {%- if has_permission_to('admin_news') and is_overview|default(false) -%} - {{ m.button(m.icon('plus-lg'), url('admin/news', only_meetings ? {'meeting': 1} : {}), 'secondary') }} + {{ m.button(m.icon('plus-lg'), url('/admin/news', only_meetings ? {'meeting': 1} : {}), 'secondary') }} {%- endif %}

@@ -51,7 +51,7 @@
{% if is_overview|default(false) %}
- + {% if news.is_pinned %}{{ m.icon('pin-angle') }}{% endif %} {% if news.is_meeting %}{{ __('news.is_meeting') }}{% endif %} {{ news.title }} @@ -62,7 +62,7 @@
{{ news.text(not is_overview)|markdown }} {% if is_overview and news.text != news.text(false) %} - {{ m.button(__('news.read_more'), url('news/' ~ news.id), null, 'sm', null, null, 'chevron-double-right') }} + {{ m.button(__('news.read_more'), url('/news/' ~ news.id), null, 'sm', null, null, 'chevron-double-right') }} {% endif %}
@@ -85,7 +85,7 @@ {% if show_comments_link|default(false) %}
- + {{ m.icon('chat-left-text') }} {{ __('news.comments') }} {{ news.comments.count() }} @@ -95,7 +95,7 @@ {% if has_permission_to('admin_news') %}
- {{ m.button(m.icon('pencil'), url('admin/news/' ~ news.id), 'secondary', 'sm') }} + {{ m.button(m.icon('pencil'), url('/admin/news/' ~ news.id), 'secondary', 'sm') }}
{% endif %}
diff --git a/resources/views/pages/questions/overview.twig b/resources/views/pages/questions/overview.twig index f6ef47f1..e01e8cec 100644 --- a/resources/views/pages/questions/overview.twig +++ b/resources/views/pages/questions/overview.twig @@ -11,7 +11,7 @@ @@ -59,7 +59,7 @@ {% endif %} {% if has_permission_to('question.edit') %} - {{ m.button(m.icon('pencil'), url('admin/questions/' ~ question.id), null, 'sm') }} + {{ m.button(m.icon('pencil'), url('/admin/questions/' ~ question.id), null, 'sm') }}
{% endif %}
diff --git a/src/Middleware/LegacyMiddleware.php b/src/Middleware/LegacyMiddleware.php index 374b9f0e..68d2afda 100644 --- a/src/Middleware/LegacyMiddleware.php +++ b/src/Middleware/LegacyMiddleware.php @@ -133,7 +133,7 @@ class LegacyMiddleware implements MiddlewareInterface return [admin_shifts_history_title(), admin_shifts_history()]; } - throw_redirect(page_link_to('login')); + throw_redirect(url('/login')); return []; }
- {{ m.button(m.icon('pencil'), url('admin/locations/edit/' ~ location.id), null, 'sm', __('form.edit')) }} + {{ m.button(m.icon('pencil'), url('/admin/locations/edit/' ~ location.id), null, 'sm', __('form.edit')) }} {{ csrf() }} diff --git a/resources/views/errors/403.twig b/resources/views/errors/403.twig index d18efe90..4c838fae 100644 --- a/resources/views/errors/403.twig +++ b/resources/views/errors/403.twig @@ -10,6 +10,6 @@ {% do session_set('previous_page', request.url) %}

{{ __('page.403.login') }}

-

{{ m.button(__('general.login'), url('login')) }}

+

{{ m.button(__('general.login'), url('/login')) }}

{% endif %} {% endblock %} diff --git a/resources/views/layouts/app.twig b/resources/views/layouts/app.twig index 975c02ac..fa07f01e 100644 --- a/resources/views/layouts/app.twig +++ b/resources/views/layouts/app.twig @@ -17,8 +17,8 @@ {% if page() == 'meetings' -%} {% set parameters = {'meetings': 1}|merge(parameters) -%} {% endif %} - - + + {%- endif %} {% endblock %} diff --git a/resources/views/layouts/parts/footer.twig b/resources/views/layouts/parts/footer.twig index 571266e4..33fd7dba 100644 --- a/resources/views/layouts/parts/footer.twig +++ b/resources/views/layouts/parts/footer.twig @@ -44,6 +44,6 @@ {% endfor %} {{ __('Bugs / Features') }} · {{ __('Development Platform') }} - · {{ __('Credits') }} + · {{ __('Credits') }}
diff --git a/resources/views/layouts/parts/navbar.twig b/resources/views/layouts/parts/navbar.twig index 7e3a9957..55ab2325 100644 --- a/resources/views/layouts/parts/navbar.twig +++ b/resources/views/layouts/parts/navbar.twig @@ -63,17 +63,17 @@ {% endif %} {% if has_permission_to('login') %} - {{ _self.toolbar_item(__('general.login'), url('login'), 'login', 'box-arrow-in-right') }} + {{ _self.toolbar_item(__('general.login'), url('/login'), 'login', 'box-arrow-in-right') }} {% endif %} {% endif %} {% if is_user() %} - {{ _self.toolbar_item(menuUserShiftState(user), url('shifts', {'action': 'next'}), '', 'clock', __('Next shift')) }} + {{ _self.toolbar_item(menuUserShiftState(user), url('/shifts', {'action': 'next'}), '', 'clock', __('Next shift')) }} {% if has_permission_to('user_messages') %} {{ _self.toolbar_item( user_messages ? '' ~ user_messages ~ '' : '', - url('messages'), + url('/messages'), 'messages', 'envelope' ) }} @@ -88,15 +88,15 @@ diff --git a/resources/views/macros/base.twig b/resources/views/macros/base.twig index 528beddb..11553cfd 100644 --- a/resources/views/macros/base.twig +++ b/resources/views/macros/base.twig @@ -23,7 +23,7 @@ {% endmacro %} {% macro user(user, opt) %} - {{ _self.angel() }} {{ user.displayName }} diff --git a/resources/views/pages/angeltypes/about.twig b/resources/views/pages/angeltypes/about.twig index 46af30a1..8eb1aeae 100644 --- a/resources/views/pages/angeltypes/about.twig +++ b/resources/views/pages/angeltypes/about.twig @@ -49,7 +49,7 @@ {{ angeltype.name }} {% if is_user() %} - {{ m.icon('arrow-right') }} diff --git a/resources/views/pages/design.twig b/resources/views/pages/design.twig index a4772913..1ecbaef9 100644 --- a/resources/views/pages/design.twig +++ b/resources/views/pages/design.twig @@ -59,7 +59,7 @@
- {{ m.user(c.other_user, {'pronoun': true, 'url': url('messages/' ~ c.other_user.id ~ '#newest')}) }} + {{ m.user(c.other_user, {'pronoun': true, 'url': url('/messages/' ~ c.other_user.id ~ '#newest')}) }} {% if c.unread_messages > 0 %} {{ c.unread_messages }} {% endif %} - + {{ c.latest_message.text|length > 100 ? c.latest_message.text|slice(0, 100) ~ '…' : c.latest_message.text }}