Replace page_link_to() with url()

This commit is contained in:
Xu 2023-11-13 16:56:52 +01:00 committed by Igor Scheller
parent 6477e5dabd
commit b6bd3eba56
40 changed files with 227 additions and 238 deletions

View File

@ -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 = '<a href="'
. page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])
. url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])
. '">'
. $angeltype->name
. '</a>';

View File

@ -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'));
}
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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'));
}

View File

@ -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'));

View File

@ -36,7 +36,7 @@ function user_angeltypes_unconfirmed_hint()
$unconfirmed_links = [];
foreach ($unconfirmed_user_angeltypes as $user_angeltype) {
$unconfirmed_links[] = '<a href="'
. page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $user_angeltype->angel_type_id])
. url('/angeltypes', ['action' => 'view', 'angeltype_id' => $user_angeltype->angel_type_id])
. '">' . $user_angeltype->angelType->name
. ' (+' . $user_angeltype->count . ')'
. '</a>';
@ -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')),
};
}

View File

@ -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;

View File

@ -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]), '&laquo; ' . __('back')),
button(url('/admin-active', ['search' => $search]), '&laquo; ' . __('back')),
form_submit('ack', '&raquo; ' . __('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')),

View File

@ -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'),

View File

@ -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')
: '',
];
}

View File

@ -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);
}

View File

@ -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()
. '</div>';
}
$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(
'<a href="%s">%s</a>',
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();

View File

@ -50,7 +50,7 @@ function admin_user()
}
$html .= '<br /><br />';
$html .= '<form action="'
. page_link_to('admin_user', ['action' => 'save', 'id' => $user_id])
. url('/admin-user', ['action' => 'save', 'id' => $user_id])
. '" method="post">' . "\n";
$html .= form_csrf();
$html .= '<table>' . "\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:') . '<form action="'
. page_link_to('admin_user', ['action' => 'change_pw', 'id' => $user_id])
. url('/admin-user', ['action' => 'change_pw', 'id' => $user_id])
. '" method="post">' . "\n";
$html .= form_csrf();
$html .= '<table>' . "\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:') . '<form action="'
. page_link_to('admin_user', ['action' => 'save_groups', 'id' => $user_id])
. url('/admin-user', ['action' => 'save_groups', 'id' => $user_id])
. '" method="post">' . "\n";
$html .= form_csrf();
$html .= '<div>';
@ -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'),
[

View File

@ -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 '';
}

View File

@ -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)
. '<p>' . sprintf(
__('Export your own shifts. <a href="%s">iCal format</a> or <a href="%s">JSON format</a> available (please keep secret, otherwise <a href="%s">reset the api key</a>).'),
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])
)
. ' <button class="btn btn-sm btn-danger" type="button"
data-bs-toggle="collapse" data-bs-target="#collapseApiKey"

View File

@ -4,17 +4,6 @@ use Engelsystem\Models\Location;
use Engelsystem\Models\Question;
use Engelsystem\UserHintsRenderer;
/**
* @param string $page
* @param array $parameters get parameters
* @return string
*/
function page_link_to($page = '', $parameters = [])
{
$page = str_replace('_', '-', $page);
return url($page, $parameters);
}
/**
* Render the user hints
*
@ -80,7 +69,7 @@ function make_navigation()
}
$title = ((array) $options)[0];
$menu[] = toolbar_item_link(page_link_to($menu_page), '', $title, $menu_page == $page);
$menu[] = toolbar_item_link(url(str_replace('_', '-', $menu_page)), '', $title, $menu_page == $page);
}
$menu = make_location_navigation($menu);
@ -114,7 +103,7 @@ function make_navigation()
$title = ((array) $options)[0];
$admin_menu[] = toolbar_dropdown_item(
page_link_to($menu_page),
url(str_replace('_', '-', $menu_page)),
__($title),
$menu_page == $page
);
@ -162,7 +151,7 @@ function make_location_navigation($menu)
$location_menu = [];
if (auth()->can('admin_locations')) {
$location_menu[] = toolbar_dropdown_item(
page_link_to('admin/locations'),
url('/admin/locations'),
__('Manage locations'),
false,
'list'
@ -219,7 +208,7 @@ function admin_new_questions()
return null;
}
return '<a href="' . page_link_to('/admin/questions') . '">'
return '<a href="' . url('/admin/questions') . '">'
. __('There are unanswered questions!')
. '</a>';
}

View File

@ -61,13 +61,13 @@ function AngelType_render_membership(AngelType $user_angeltype)
function AngelType_delete_view(AngelType $angeltype)
{
$link = button($angeltype->id
? page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])
: page_link_to('angeltypes'), icon('chevron-left'), 'btn-sm');
? url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])
: url('/angeltypes'), icon('chevron-left'), 'btn-sm');
return page_with_title($link . ' ' . sprintf(__('Delete angeltype %s'), $angeltype->name), [
info(sprintf(__('Do you want to delete angeltype %s?'), $angeltype->name), true),
form([
buttons([
button(page_link_to('angeltypes'), icon('x-lg') . __('form.cancel')),
button(url('/angeltypes'), icon('x-lg') . __('form.cancel')),
form_submit('delete', icon('trash') . __('delete'), 'btn-danger', false),
]),
]),
@ -84,13 +84,13 @@ function AngelType_delete_view(AngelType $angeltype)
function AngelType_edit_view(AngelType $angeltype, bool $supporter_mode)
{
$link = button($angeltype->id
? page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])
: page_link_to('angeltypes'), icon('chevron-left'), 'btn-sm');
? url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id])
: url('/angeltypes'), icon('chevron-left'), 'btn-sm');
return page_with_title(
$link . ' ' . sprintf(__('Edit %s'), $angeltype->name),
[
buttons([
button(page_link_to('angeltypes'), icon('person-lines-fill') . __('angeltypes.angeltypes'), 'back'),
button(url('/angeltypes'), icon('person-lines-fill') . __('angeltypes.angeltypes'), 'back'),
]),
msg(),
form([
@ -204,7 +204,7 @@ function AngelType_view_buttons(
if (is_null($user_angeltype)) {
$buttons[] = 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'),
'add'
);
@ -228,20 +228,20 @@ function AngelType_view_buttons(
));
}
$buttons[] = button(
page_link_to('user_angeltypes', ['action' => 'delete', 'user_angeltype_id' => $user_angeltype->id]),
url('/user-angeltypes', ['action' => 'delete', 'user_angeltype_id' => $user_angeltype->id]),
icon('box-arrow-right') . __('leave')
);
}
if ($admin_angeltypes || $supporter) {
$buttons[] = button(
page_link_to('angeltypes', ['action' => 'edit', 'angeltype_id' => $angeltype->id]),
url('/angeltypes', ['action' => 'edit', 'angeltype_id' => $angeltype->id]),
icon('pencil') . __('edit')
);
}
if ($admin_angeltypes) {
$buttons[] = button(
page_link_to('angeltypes', ['action' => 'delete', 'angeltype_id' => $angeltype->id]),
url('/angeltypes', ['action' => 'delete', 'angeltype_id' => $angeltype->id]),
icon('trash') . __('delete')
);
}
@ -287,16 +287,16 @@ function AngelType_view_members(AngelType $angeltype, $members, $admin_user_ange
if ($angeltype->restricted && empty($member->pivot->confirm_user_id)) {
$member['actions'] = table_buttons([
button(
page_link_to(
'user_angeltypes',
url(
'/user-angeltypes',
['action' => 'confirm', 'user_angeltype_id' => $member->pivot->id]
),
__('confirm'),
'btn-sm'
),
button(
page_link_to(
'user_angeltypes',
url(
'/user-angeltypes',
['action' => 'delete', 'user_angeltype_id' => $member->pivot->id]
),
__('deny'),
@ -308,7 +308,7 @@ function AngelType_view_members(AngelType $angeltype, $members, $admin_user_ange
if ($admin_angeltypes) {
$member['actions'] = table_buttons([
button(
page_link_to('user_angeltypes', [
url('/user-angeltypes', [
'action' => 'update',
'user_angeltype_id' => $member->pivot->id,
'supporter' => 0,
@ -326,7 +326,7 @@ function AngelType_view_members(AngelType $angeltype, $members, $admin_user_ange
$member['actions'] = table_buttons([
$admin_angeltypes ?
button(
page_link_to('user_angeltypes', [
url('/user-angeltypes', [
'action' => 'update',
'user_angeltype_id' => $member->pivot->id,
'supporter' => 1,
@ -336,7 +336,7 @@ function AngelType_view_members(AngelType $angeltype, $members, $admin_user_ange
) :
'',
button(
page_link_to('user_angeltypes', [
url('/user-angeltypes', [
'action' => 'delete',
'user_angeltype_id' => $member->pivot->id,
]),
@ -427,7 +427,7 @@ function AngelType_view(
ShiftCalendarRenderer $shiftCalendarRenderer,
$tab
) {
$link = button(page_link_to('angeltypes'), icon('chevron-left'), 'btn-sm');
$link = button(url('/angeltypes'), icon('chevron-left'), 'btn-sm');
return page_with_title(
$link . ' ' . sprintf(__('Team %s'), $angeltype->name),
[
@ -460,7 +460,7 @@ function AngelType_view(
*/
function AngelType_view_shifts(AngelType $angeltype, $shiftsFilterRenderer, $shiftCalendarRenderer)
{
$shifts = $shiftsFilterRenderer->render(page_link_to('angeltypes', [
$shifts = $shiftsFilterRenderer->render(url('/angeltypes', [
'action' => 'view',
'angeltype_id' => $angeltype->id,
]), ['type' => $angeltype->id]);
@ -528,8 +528,8 @@ function AngelType_view_info(
if ($admin_user_angeltypes) {
$info[] = buttons([
button(
page_link_to(
'user_angeltypes',
url(
'/user-angeltypes',
['action' => 'add', 'angeltype_id' => $angeltype->id]
),
__('Add'),
@ -543,11 +543,11 @@ function AngelType_view_info(
$info[] = '<h3>' . __('Unconfirmed') . '</h3>';
$info[] = buttons([
button(
page_link_to('user_angeltypes', ['action' => 'confirm_all', 'angeltype_id' => $angeltype->id]),
url('/user-angeltypes', ['action' => 'confirm_all', 'angeltype_id' => $angeltype->id]),
icon('check-lg') . __('confirm all')
),
button(
page_link_to('user_angeltypes', ['action' => 'delete_all', 'angeltype_id' => $angeltype->id]),
url('/user-angeltypes', ['action' => 'delete_all', 'angeltype_id' => $angeltype->id]),
icon('trash') . __('deny all')
),
]);
@ -589,7 +589,7 @@ function AngelTypes_render_contact_info(AngelType $angeltype)
*/
function AngelTypes_list_view($angeltypes, bool $admin_angeltypes)
{
$link = button(page_link_to('angeltypes', ['action' => 'edit']), icon('plus-lg'), 'add');
$link = button(url('/angeltypes', ['action' => 'edit']), icon('plus-lg'), 'add');
return page_with_title(
angeltypes_title() . ' ' . ($admin_angeltypes ? $link : ''),
[

View File

@ -44,7 +44,7 @@ function location_view(Location $location, ShiftsFilterRenderer $shiftsFilterRen
}
$tabs[__('Shifts')] = div('first', [
$shiftsFilterRenderer->render(page_link_to('locations', [
$shiftsFilterRenderer->render(url('/locations', [
'action' => 'view',
'location_id' => $location->id,
]), ['locations' => [$location->id]]),
@ -57,7 +57,7 @@ function location_view(Location $location, ShiftsFilterRenderer $shiftsFilterRen
$selected_tab = count($tabs) - 1;
}
$link = button(page_link_to('admin/locations'), icon('chevron-left'), 'btn-sm');
$link = button(url('/admin/locations'), icon('chevron-left'), 'btn-sm');
return page_with_title(
(auth()->can('admin_locations') ? $link . ' ' : '') .
icon('pin-map-fill') . $location->name,
@ -65,7 +65,7 @@ function location_view(Location $location, ShiftsFilterRenderer $shiftsFilterRen
$assignNotice,
auth()->can('admin_locations') ? buttons([
button(
page_link_to('admin/locations/edit/' . $location->id),
url('/admin/locations/edit/' . $location->id),
icon('pencil') . __('edit')
),
]) : '',

View File

@ -196,7 +196,7 @@ class ShiftCalendarShiftRenderer
// Add link to join the angeltype first
: $inner_text . '<br />'
. button(
page_link_to('user_angeltypes', ['action' => 'add', 'angeltype_id' => $angeltype->id]),
url('/user-angeltypes', ['action' => 'add', 'angeltype_id' => $angeltype->id]),
sprintf(__('Become %s'), $angeltype->name),
'btn-sm'
),
@ -247,12 +247,12 @@ class ShiftCalendarShiftRenderer
if (auth()->can('admin_shifts')) {
$header_buttons = '<div class="ms-auto d-print-none">' . table_buttons([
button(
page_link_to('user_shifts', ['edit_shift' => $shift->id]),
url('/user-shifts', ['edit_shift' => $shift->id]),
icon('pencil'),
'btn-' . $class . ' btn-sm border-light text-white'
),
button(
page_link_to('user_shifts', ['delete_shift' => $shift->id]),
url('/user-shifts', ['delete_shift' => $shift->id]),
icon('trash'),
'btn-' . $class . ' btn-sm border-light text-white'
),

View File

@ -219,7 +219,7 @@ function ShiftEntry_edit_view(
}
$link = button(
page_link_to('users', ['action' => 'view', 'user_id' => $angel->id]),
url('/users', ['action' => 'view', 'user_id' => $angel->id]),
icon('chevron-left'),
'btn-sm'
);

View File

@ -25,7 +25,7 @@ function ShiftType_delete_view(ShiftType $shifttype)
info(sprintf(__('Do you want to delete shifttype %s?'), $shifttype->name), true),
form([
buttons([
button(page_link_to('shifttypes'), icon('x-lg') . __('form.cancel')),
button(url('/shifttypes'), icon('x-lg') . __('form.cancel')),
form_submit(
'delete',
icon('trash') . __('delete'),
@ -48,15 +48,15 @@ function ShiftType_edit_view($name, $description, $shifttype_id)
return page_with_title(
$shifttype_id
? (button(
page_link_to('shifttypes', ['action' => 'view', 'shifttype_id' => $shifttype_id]),
url('/shifttypes', ['action' => 'view', 'shifttype_id' => $shifttype_id]),
icon('chevron-left'),
'btn-sm'
) . ' ' . __('Edit shifttype'))
: (button(page_link_to('shifttypes'), icon('chevron-left'), 'btn-sm') . ' ' . __('Create shifttype')),
: (button(url('/shifttypes'), icon('chevron-left'), 'btn-sm') . ' ' . __('Create shifttype')),
[
msg(),
buttons([
button(page_link_to('shifttypes'), shifttypes_title(), 'back'),
button(url('/shifttypes'), shifttypes_title(), 'back'),
]),
form([
form_text('name', __('general.name'), $name),
@ -77,16 +77,16 @@ function ShiftType_view(ShiftType $shifttype)
{
$parsedown = new Parsedown();
$title = $shifttype->name;
$link = button(page_link_to('shifttypes'), icon('chevron-left'), 'btn-sm');
$link = button(url('/shifttypes'), icon('chevron-left'), 'btn-sm');
return page_with_title($link . ' ' . $title, [
msg(),
buttons([
button(
page_link_to('shifttypes', ['action' => 'edit', 'shifttype_id' => $shifttype->id]),
url('/shifttypes', ['action' => 'edit', 'shifttype_id' => $shifttype->id]),
icon('pencil') . __('edit')
),
button(
page_link_to('shifttypes', ['action' => 'delete', 'shifttype_id' => $shifttype->id]),
url('/shifttypes', ['action' => 'delete', 'shifttype_id' => $shifttype->id]),
icon('trash') . __('delete'),
),
]),
@ -103,28 +103,28 @@ function ShiftTypes_list_view($shifttypes)
{
foreach ($shifttypes as $shifttype) {
$shifttype->name = '<a href="'
. page_link_to('shifttypes', ['action' => 'view', 'shifttype_id' => $shifttype->id])
. url('/shifttypes', ['action' => 'view', 'shifttype_id' => $shifttype->id])
. '">'
. $shifttype->name
. '</a>';
$shifttype->actions = table_buttons([
button(
page_link_to(
'shifttypes',
url(
'/shifttypes',
['action' => 'edit', 'shifttype_id' => $shifttype->id]
),
icon('pencil') . __('edit'),
'btn-sm'
),
button(
page_link_to('shifttypes', ['action' => 'delete', 'shifttype_id' => $shifttype->id]),
url('/shifttypes', ['action' => 'delete', 'shifttype_id' => $shifttype->id]),
icon('trash') . __('delete'),
'btn-sm'
),
]);
}
$link = button(page_link_to('shifttypes', ['action' => 'edit']), icon('plus-lg'), 'add');
$link = button(url('/shifttypes', ['action' => 'edit']), icon('plus-lg'), 'add');
return page_with_title(
shifttypes_title() . ' ' . $link,
[

View File

@ -95,7 +95,7 @@ function Shift_signup_button_render(Shift $shift, AngelType $angeltype)
return button(shift_entry_create_link($shift, $angeltype), __('Sign up'));
} elseif (empty($user_angeltype)) {
return button(
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id]),
url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id]),
sprintf(
__('Become %s'),
$angeltype->name
@ -204,7 +204,7 @@ function Shift_view(
$start = $shift->start->format(__('Y-m-d H:i'));
$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 . ' ' . $shift->shiftType->name . ' <small title="' . $start . '" data-countdown-ts="' . $shift->start->timestamp . '">%c</small>',
$content
@ -279,7 +279,7 @@ function Shift_view_render_shift_entry(ShiftEntry $shift_entry, $user_shift_admi
$entry .= ' <div class="btn-group m-1">';
if ($user_shift_admin || $isUser) {
$entry .= button_icon(
page_link_to('user_myshifts', ['edit' => $shift_entry->id, 'id' => $shift_entry->user_id]),
url('/user-myshifts', ['edit' => $shift_entry->id, 'id' => $shift_entry->user_id]),
'pencil',
'btn-sm'
);

View File

@ -25,12 +25,12 @@ function UserAngelType_update_view(UserAngelType $user_angeltype, User $user, An
form([
buttons([
button(
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id]),
url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id]),
icon('x-lg') . __('form.cancel')
),
form_submit('submit', icon('check-lg') . __('Yes'), 'btn-primary', false),
]),
], page_link_to('user_angeltypes', [
], url('/user-angeltypes', [
'action' => 'update',
'user_angeltype_id' => $user_angeltype->id,
'supporter' => ($supporter ? '1' : '0'),
@ -50,15 +50,15 @@ function UserAngelTypes_delete_all_view(AngelType $angeltype)
form([
buttons([
button(
page_link_to(
'angeltypes',
url(
'/angeltypes',
['action' => 'view', 'angeltype_id' => $angeltype->id]
),
icon('x-lg') . __('form.cancel')
),
form_submit('deny_all', icon('check-lg') . __('Yes'), 'btn-primary', false),
]),
], page_link_to('user_angeltypes', ['action' => 'delete_all', 'angeltype_id' => $angeltype->id])),
], url('/user-angeltypes', ['action' => 'delete_all', 'angeltype_id' => $angeltype->id])),
]);
}
@ -76,7 +76,7 @@ function UserAngelTypes_confirm_all_view(AngelType $angeltype)
button(angeltype_link($angeltype->id), icon('x-lg') . __('form.cancel')),
form_submit('confirm_all', icon('check-lg') . __('Yes'), 'btn-primary', false),
]),
], page_link_to('user_angeltypes', ['action' => 'confirm_all', 'angeltype_id' => $angeltype->id])),
], url('/user-angeltypes', ['action' => 'confirm_all', 'angeltype_id' => $angeltype->id])),
]);
}
@ -100,7 +100,7 @@ function UserAngelType_confirm_view(UserAngelType $user_angeltype, User $user, A
button(angeltype_link($angeltype->id), icon('x-lg') . __('form.cancel')),
form_submit('confirm_user', icon('check-lg') . __('Yes'), 'btn-primary', false),
]),
], page_link_to('user_angeltypes', ['action' => 'confirm', 'user_angeltype_id' => $user_angeltype->id])),
], url('/user-angeltypes', ['action' => 'confirm', 'user_angeltype_id' => $user_angeltype->id])),
]);
}
@ -124,7 +124,7 @@ function UserAngelType_delete_view(UserAngelType $user_angeltype, User $user, An
button(angeltype_link($angeltype->id), icon('x-lg') . __('form.cancel')),
form_submit('delete', icon('check-lg') . __('Yes'), 'btn-primary', false),
]),
], page_link_to('user_angeltypes', ['action' => 'delete', 'user_angeltype_id' => $user_angeltype->id])),
], url('/user-angeltypes', ['action' => 'delete', 'user_angeltype_id' => $user_angeltype->id])),
], true);
}
@ -145,7 +145,7 @@ function UserAngelType_add_view(AngelType $angeltype, $users_source, $user_id)
msg(),
buttons([
button(
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id]),
url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id]),
__('back'),
'back'
),
@ -179,8 +179,8 @@ function UserAngelType_join_view($user, AngelType $angeltype)
button(angeltype_link($angeltype->id), icon('x-lg') . __('form.cancel')),
form_submit('submit', icon('check-lg') . __('form.save'), 'btn-primary', false),
]),
], page_link_to(
'user_angeltypes',
], url(
'/user-angeltypes',
['action' => 'add', 'angeltype_id' => $angeltype->id, 'user_id' => $user->id]
)),
]);

View File

@ -59,7 +59,7 @@ function User_edit_vouchers_view($user)
form_spinner('vouchers', __('Number of vouchers given out'), $user->state->got_voucher),
form_submit('submit', __('form.save')),
],
page_link_to('users', ['action' => 'edit_vouchers', 'user_id' => $user->id])
url('/users', ['action' => 'edit_vouchers', 'user_id' => $user->id])
),
]
);
@ -115,7 +115,7 @@ function Users_view(
? $user->personalData->planned_departure_date->format(__('Y-m-d')) : '';
$u['last_login_at'] = $user->last_login_at ? $user->last_login_at->format(__('m/d/Y h:i a')) : '';
$u['actions'] = table_buttons([
button_icon(page_link_to('admin_user', ['id' => $user->id]), 'pencil', 'btn-sm'),
button_icon(url('/admin-user', ['id' => $user->id]), 'pencil', 'btn-sm'),
]);
$usersList[] = $u;
}
@ -190,7 +190,7 @@ function Users_view(
function Users_table_header_link($column, $label, $order_by)
{
return '<a href="'
. page_link_to('users', ['OrderBy' => $column])
. url('/users', ['OrderBy' => $column])
. '">'
. $label . ($order_by == $column ? ' <span class="caret"></span>' : '')
. '</a>';
@ -271,7 +271,7 @@ function User_last_shift_render($user)
function User_view_shiftentries($needed_angel_type)
{
$shift_info = '<br><b><a href="'
. page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $needed_angel_type['id']])
. url('/angeltypes', ['action' => 'view', 'angeltype_id' => $needed_angel_type['id']])
. '">' . $needed_angel_type['name'] . '</a>:</b> ';
$shift_entries = [];
@ -339,7 +339,7 @@ function User_view_myshift(Shift $shift, $user_source, $its_me)
];
if ($its_me || auth()->can('user_shifts_admin')) {
$myshift['actions'][] = button(
page_link_to('user_myshifts', ['edit' => $shift->shift_entry_id, 'id' => $user_source->id]),
url('/user-myshifts', ['edit' => $shift->shift_entry_id, 'id' => $user_source->id]),
icon('pencil') . __('edit'),
'btn-sm'
);
@ -554,7 +554,7 @@ function User_view(
icon('person') . ($goodie_tshirt ? __('Shirt') : __('Goodie'))
) : '',
$admin_user_privilege ? button(
page_link_to('admin_user', ['id' => $user_source->id]),
url('/admin-user', ['id' => $user_source->id]),
icon('pencil') . __('edit')
) : '',
(($admin_user_privilege || $auth->can('admin_arrive')) && !$user_source->state->arrived) ?
@ -562,11 +562,11 @@ function User_view(
form_hidden('action', 'arrived'),
form_hidden('user', $user_source->id),
form_submit('submit', __('user.arrived'), '', false),
], page_link_to('admin_arrive'), true) : '',
], url('/admin-arrive'), true) : '',
($admin_user_privilege || $auth->can('voucher.edit')) && config('enable_voucher') ?
button(
page_link_to(
'users',
url(
'/users',
['action' => 'edit_vouchers', 'user_id' => $user_source->id]
),
icon('valentine') . __('Vouchers')
@ -579,15 +579,15 @@ function User_view(
], 'mb-2'),
$its_me ? table_buttons([
button(
page_link_to('settings/profile'),
url('/settings/profile'),
icon('person-fill-gear') . __('settings.settings')
),
$auth->can('ical') ? button(
page_link_to('ical', ['key' => $user_source->api_key]),
url('/ical', ['key' => $user_source->api_key]),
icon('calendar-week') . __('iCal Export')
) : '',
$auth->can('shifts_json_export') ? button(
page_link_to('shifts_json_export', ['key' => $user_source->api_key]),
url('/shifts-json-export', ['key' => $user_source->api_key]),
icon('braces') . __('JSON Export')
) : '',
(
@ -595,7 +595,7 @@ function User_view(
|| $auth->can('ical')
|| $auth->can('atom')
) ? button(
page_link_to('user_myshifts', ['reset' => 1]),
url('/user-myshifts', ['reset' => 1]),
icon('arrow-repeat') . __('Reset API key')
) : '',
], 'mb-2') : '',
@ -623,7 +623,7 @@ function User_view(
: '',
$auth->can('user_messages') ?
heading(
'<a href="' . page_link_to('/messages/' . $user_source->id) . '">'
'<a href="' . url('/messages/' . $user_source->id) . '">'
. icon('envelope')
. '</a>'
)
@ -647,7 +647,7 @@ function User_view(
$its_me && count($shifts) == 0
? error(sprintf(
__('Go to the <a href="%s">shifts table</a> to sign yourself up for some shifts.'),
page_link_to('user_shifts')
url('/user-shifts')
), true)
: '',
$its_me ? ical_hint() : '',
@ -878,9 +878,9 @@ function User_Pronoun_render(User $user): string
*/
function render_profile_link($text, $user_id = null, $class = '')
{
$profile_link = page_link_to('settings/profile');
$profile_link = url('/settings/profile');
if (!is_null($user_id)) {
$profile_link = page_link_to('users', ['action' => 'view', 'user_id' => $user_id]);
$profile_link = url('/users', ['action' => 'view', 'user_id' => $user_id]);
}
return sprintf(

View File

@ -52,7 +52,7 @@
<td>
<div class="d-flex ms-auto">
{{ 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')) }}
<form method="post" class="ps-1">
{{ csrf() }}

View File

@ -10,6 +10,6 @@
{% do session_set('previous_page', request.url) %}
<p>{{ __('page.403.login') }}</p>
<p>{{ m.button(__('general.login'), url('login')) }}</p>
<p>{{ m.button(__('general.login'), url('/login')) }}</p>
{% endif %}
{% endblock %}

View File

@ -17,8 +17,8 @@
{% if page() == 'meetings' -%}
{% set parameters = {'meetings': 1}|merge(parameters) -%}
{% endif %}
<link href="{{ url('atom', parameters) }}" type="application/atom+xml" rel="alternate" title="Atom Feed">
<link href="{{ url('rss', parameters) }}" type="application/rss+xml" rel="alternate" title="RSS Feed" />
<link href="{{ url('/atom', parameters) }}" type="application/atom+xml" rel="alternate" title="Atom Feed">
<link href="{{ url('/rss', parameters) }}" type="application/rss+xml" rel="alternate" title="RSS Feed" />
{%- endif %}
{% endblock %}

View File

@ -44,6 +44,6 @@
{% endfor %}
<a href="https://github.com/engelsystem/engelsystem/issues">{{ __('Bugs / Features') }}</a>
· <a href="https://github.com/engelsystem/engelsystem/">{{ __('Development Platform') }}</a>
· <a href="{{ url('credits') }}">{{ __('Credits') }}</a>
· <a href="{{ url('/credits') }}">{{ __('Credits') }}</a>
</div>
</div>

View File

@ -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 ? '<span class="badge bg-danger">' ~ user_messages ~ '</span>' : '',
url('messages'),
url('/messages'),
'messages',
'envelope'
) }}
@ -88,15 +88,15 @@
</a>
<ul class="dropdown-menu dropdown-menu-end">
{% if has_permission_to('user_myshifts') %}
{{ _self.dropdown_item(__('profile.my-shifts'), url('users', {'action': 'view'}), 'users', m.icon('calendar-range')) }}
{{ _self.dropdown_item(__('profile.my-shifts'), url('/users', {'action': 'view'}), 'users', m.icon('calendar-range')) }}
{% endif %}
{% if has_permission_to('user_settings') %}
{{ _self.dropdown_item(__('settings.settings'), url('settings/profile'), 'settings/profile', m.icon('person-fill-gear')) }}
{{ _self.dropdown_item(__('settings.settings'), url('/settings/profile'), 'settings/profile', m.icon('person-fill-gear')) }}
{% endif %}
{% if has_permission_to('logout') %}
{{ _self.dropdown_item(__('Logout'), url('logout'), 'logout', m.icon('box-arrow-left')) }}
{{ _self.dropdown_item(__('Logout'), url('/logout'), 'logout', m.icon('box-arrow-left')) }}
{% endif %}
</ul>
</li>

View File

@ -23,7 +23,7 @@
{% endmacro %}
{% macro user(user, opt) %}
<a href="{{ opt.url|default(url('users', {'action': 'view', 'user_id': user.id})) }}"
<a href="{{ opt.url|default(url('/users', {'action': 'view', 'user_id': user.id})) }}"
{%- if not user.state.arrived %} class="text-muted"{% endif -%}
>
{{ _self.angel() }} {{ user.displayName }}

View File

@ -49,7 +49,7 @@
{{ angeltype.name }}
{% if is_user() %}
<a href="{{ url('angeltypes', {'action': 'view', 'angeltype_id': angeltype.id}) }}"
<a href="{{ url('/angeltypes', {'action': 'view', 'angeltype_id': angeltype.id}) }}"
class="btn btn-secondary float-end">
{{ m.icon('arrow-right') }}
</a>

View File

@ -59,7 +59,7 @@
<ul>
{% for id,theme in themes %}
<li>
<a href="{{ url('design', {'theme': id}) }}"
<a href="{{ url('/design', {'theme': id}) }}"
{%- if id == themeId %} class="text-info"{% endif %}>
{{ theme['name'] }}
</a>

View File

@ -12,7 +12,7 @@
{{ block('title') }}
{%- if has_permission_to('faq.edit') -%}
{{ m.button(m.icon('plus-lg'), url('admin/faq'), 'secondary') }}
{{ m.button(m.icon('plus-lg'), url('/admin/faq'), 'secondary') }}
{%- endif %}
</h1>
@ -56,7 +56,7 @@
{% if has_permission_to('faq.edit') %}
<span class="ms-auto">
{{ m.button(m.icon('pencil'), url('admin/faq/' ~ item.id), 'secondary', 'sm') }}
{{ m.button(m.icon('pencil'), url('/admin/faq/' ~ item.id), 'secondary', 'sm') }}
</span>
{% endif %}
</div>

View File

@ -78,7 +78,7 @@
<div class="row">
<div class="mb-3 btn-group">
{% for name,config in config('oauth') %}
<a href="{{ url('oauth/' ~ name) }}" class="btn btn-primary btn-lg{% if config.hidden|default(false) %} d-none{% endif %}">
<a href="{{ url('/oauth/' ~ name) }}" class="btn btn-primary btn-lg{% if config.hidden|default(false) %} d-none{% endif %}">
{{ __(
'oauth.login-using-provider',
[__(config.name|default(name|capitalize))]

View File

@ -39,14 +39,14 @@
{% for c in conversations %}
<tr>
<td>
{{ 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 %}
<span class="badge bg-danger">{{ c.unread_messages }}</span>
{% endif %}
</td>
<td>
<a href="{{ url('messages/' ~ c.other_user.id ~ '#newest') }}">
<a href="{{ url('/messages/' ~ c.other_user.id ~ '#newest') }}">
{{ c.latest_message.text|length > 100 ? c.latest_message.text|slice(0, 100) ~ '…' : c.latest_message.text }}
</a>
</td>

View File

@ -9,7 +9,7 @@
<h1>
{{ 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 %}
</h1>
@ -51,7 +51,7 @@
<div class="card {% if news.is_highlighted %}bg-warning{% elseif news.is_meeting %}bg-info{% elseif theme.type =='light' %}bg-light{% else %}bg-dark{% endif %} mb-4">
{% if is_overview|default(false) %}
<div class="card-header {% if news.is_meeting and theme.type == 'dark' %}text-white{% endif %}">
<a href="{{ url('news/' ~ news.id) }}" class="text-inherit">
<a href="{{ url('/news/' ~ news.id) }}" class="text-inherit">
{% if news.is_pinned %}{{ m.icon('pin-angle') }}{% endif %}
{% if news.is_meeting %}{{ __('news.is_meeting') }}{% endif %}
{{ news.title }}
@ -62,7 +62,7 @@
<div class="card-body bg-body">
{{ 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 %}
</div>
@ -85,7 +85,7 @@
{% if show_comments_link|default(false) %}
<div>
<a href="{{ url('news/' ~ news.id) }}" class="me-1">
<a href="{{ url('/news/' ~ news.id) }}" class="me-1">
{{ m.icon('chat-left-text') }} {{ __('news.comments') }}
</a>
<span class="badge bg-primary">{{ news.comments.count() }}</span>
@ -95,7 +95,7 @@
{% if has_permission_to('admin_news') %}
<div>
{{ m.button(m.icon('pencil'), url('admin/news/' ~ news.id), 'secondary', 'sm') }}
{{ m.button(m.icon('pencil'), url('/admin/news/' ~ news.id), 'secondary', 'sm') }}
</div>
{% endif %}
</div>

View File

@ -11,7 +11,7 @@
<div class="page-header">
<h1>
{{ block('title') }}
{{ m.button(m.icon('plus-lg'), url('questions/new'), 'secondary') }}
{{ m.button(m.icon('plus-lg'), url('/questions/new'), 'secondary') }}
</h1>
</div>
@ -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') }}
</div>
{% endif %}
</div>

View File

@ -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 [];
}