Require POST for sending forms
* Ensure that the form is submitted with a post request * Replaced several links with forms Closes #494 (Security Vulnerability)
This commit is contained in:
parent
fd37c9d60e
commit
944c29b964
|
@ -86,7 +86,7 @@ function angeltype_delete_controller()
|
||||||
|
|
||||||
$angeltype = load_angeltype();
|
$angeltype = load_angeltype();
|
||||||
|
|
||||||
if (request()->has('confirmed')) {
|
if (request()->hasPostData('delete')) {
|
||||||
AngelType_delete($angeltype);
|
AngelType_delete($angeltype);
|
||||||
success(sprintf(__('Angeltype %s deleted.'), AngelType_name_render($angeltype)));
|
success(sprintf(__('Angeltype %s deleted.'), AngelType_name_render($angeltype)));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
|
@ -127,7 +127,7 @@ function angeltype_edit_controller()
|
||||||
$angeltype = AngelType_new();
|
$angeltype = AngelType_new();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
if (!$supporter_mode) {
|
if (!$supporter_mode) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ function event_config_edit_controller()
|
||||||
/** @var Carbon $teardown_end_date */
|
/** @var Carbon $teardown_end_date */
|
||||||
$teardown_end_date = $config->get('teardown_end');
|
$teardown_end_date = $config->get('teardown_end');
|
||||||
|
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
if ($request->has('event_name')) {
|
if ($request->has('event_name')) {
|
||||||
|
|
|
@ -96,7 +96,7 @@ function shift_entry_create_controller_admin($shift, $angeltype)
|
||||||
$angeltype = $angeltypes[0];
|
$angeltype = $angeltypes[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
ShiftEntry_create([
|
ShiftEntry_create([
|
||||||
'SID' => $shift['SID'],
|
'SID' => $shift['SID'],
|
||||||
'TID' => $angeltype['id'],
|
'TID' => $angeltype['id'],
|
||||||
|
@ -167,7 +167,7 @@ function shift_entry_create_controller_supporter($shift, $angeltype)
|
||||||
redirect(shift_link($shift));
|
redirect(shift_link($shift));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
ShiftEntry_create([
|
ShiftEntry_create([
|
||||||
'SID' => $shift['SID'],
|
'SID' => $shift['SID'],
|
||||||
'TID' => $angeltype['id'],
|
'TID' => $angeltype['id'],
|
||||||
|
@ -246,7 +246,7 @@ function shift_entry_create_controller_user($shift, $angeltype)
|
||||||
}
|
}
|
||||||
|
|
||||||
$comment = '';
|
$comment = '';
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
$comment = strip_request_item_nl('comment');
|
$comment = strip_request_item_nl('comment');
|
||||||
ShiftEntry_create([
|
ShiftEntry_create([
|
||||||
'SID' => $shift['SID'],
|
'SID' => $shift['SID'],
|
||||||
|
@ -346,7 +346,7 @@ function shift_entry_delete_controller()
|
||||||
redirect(user_link($signout_user->id));
|
redirect(user_link($signout_user->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('continue')) {
|
if ($request->hasPostData('delete')) {
|
||||||
ShiftEntry_delete($shiftEntry);
|
ShiftEntry_delete($shiftEntry);
|
||||||
success(__('Shift entry removed.'));
|
success(__('Shift entry removed.'));
|
||||||
redirect(shift_link($shift));
|
redirect(shift_link($shift));
|
||||||
|
@ -355,13 +355,13 @@ function shift_entry_delete_controller()
|
||||||
if ($user->id == $signout_user->id) {
|
if ($user->id == $signout_user->id) {
|
||||||
return [
|
return [
|
||||||
ShiftEntry_delete_title(),
|
ShiftEntry_delete_title(),
|
||||||
ShiftEntry_delete_view($shiftEntry, $shift, $angeltype, $signout_user->id)
|
ShiftEntry_delete_view($shift, $angeltype, $signout_user->id)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
ShiftEntry_delete_title(),
|
ShiftEntry_delete_title(),
|
||||||
ShiftEntry_delete_view_admin($shiftEntry, $shift, $angeltype, $signout_user)
|
ShiftEntry_delete_view_admin($shift, $angeltype, $signout_user)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ function shift_edit_controller()
|
||||||
$start = $shift['start'];
|
$start = $shift['start'];
|
||||||
$end = $shift['end'];
|
$end = $shift['end'];
|
||||||
|
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
// Name/Bezeichnung der Schicht, darf leer sein
|
// Name/Bezeichnung der Schicht, darf leer sein
|
||||||
$title = strip_request_item('title');
|
$title = strip_request_item('title');
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ function shift_delete_controller()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Schicht löschen bestätigt
|
// Schicht löschen bestätigt
|
||||||
if ($request->has('delete')) {
|
if ($request->hasPostData('delete')) {
|
||||||
Shift_delete($shift_id);
|
Shift_delete($shift_id);
|
||||||
|
|
||||||
engelsystem_log(
|
engelsystem_log(
|
||||||
|
@ -241,9 +241,10 @@ function shift_delete_controller()
|
||||||
date('Y-m-d H:i', $shift['start']),
|
date('Y-m-d H:i', $shift['start']),
|
||||||
date('H:i', $shift['end'])
|
date('H:i', $shift['end'])
|
||||||
), true),
|
), true),
|
||||||
'<a class="button" href="'
|
form([
|
||||||
. page_link_to('user_shifts', ['delete_shift' => $shift_id, 'delete' => 1]) .
|
form_hidden('delete_shift', $shift_id),
|
||||||
'">' . __('delete') . '</a>'
|
form_submit('delete', __('delete')),
|
||||||
|
]),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ function shifttype_delete_controller()
|
||||||
redirect(page_link_to('shifttypes'));
|
redirect(page_link_to('shifttypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('confirmed')) {
|
if ($request->hasPostData('delete')) {
|
||||||
ShiftType_delete($shifttype['id']);
|
ShiftType_delete($shifttype['id']);
|
||||||
|
|
||||||
engelsystem_log('Deleted shifttype ' . $shifttype['name']);
|
engelsystem_log('Deleted shifttype ' . $shifttype['name']);
|
||||||
|
@ -67,7 +67,7 @@ function shifttype_edit_controller()
|
||||||
$description = $shifttype['description'];
|
$description = $shifttype['description'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
if ($request->has('name') && $request->input('name') != '') {
|
if ($request->has('name') && $request->input('name') != '') {
|
||||||
|
|
|
@ -59,7 +59,7 @@ function user_angeltypes_delete_all_controller()
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('confirmed')) {
|
if ($request->hasPostData('deny_all')) {
|
||||||
UserAngelTypes_delete_all($angeltype['id']);
|
UserAngelTypes_delete_all($angeltype['id']);
|
||||||
|
|
||||||
engelsystem_log(sprintf('Denied all users for angeltype %s', AngelType_name_render($angeltype)));
|
engelsystem_log(sprintf('Denied all users for angeltype %s', AngelType_name_render($angeltype)));
|
||||||
|
@ -100,7 +100,7 @@ function user_angeltypes_confirm_all_controller()
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('confirmed')) {
|
if ($request->hasPostData('confirm_all')) {
|
||||||
UserAngelTypes_confirm_all($angeltype['id'], $user->id);
|
UserAngelTypes_confirm_all($angeltype['id'], $user->id);
|
||||||
|
|
||||||
engelsystem_log(sprintf('Confirmed all users for angeltype %s', AngelType_name_render($angeltype)));
|
engelsystem_log(sprintf('Confirmed all users for angeltype %s', AngelType_name_render($angeltype)));
|
||||||
|
@ -152,7 +152,7 @@ function user_angeltype_confirm_controller()
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('confirmed')) {
|
if ($request->hasPostData('confirm_user')) {
|
||||||
UserAngelType_confirm($user_angeltype['id'], $user->id);
|
UserAngelType_confirm($user_angeltype['id'], $user->id);
|
||||||
|
|
||||||
engelsystem_log(sprintf(
|
engelsystem_log(sprintf(
|
||||||
|
@ -212,7 +212,7 @@ function user_angeltype_delete_controller()
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('confirmed')) {
|
if ($request->hasPostData('delete')) {
|
||||||
UserAngelType_delete($user_angeltype);
|
UserAngelType_delete($user_angeltype);
|
||||||
|
|
||||||
$success_message = sprintf(__('User %s removed from %s.'), User_Nick_render($user_source), $angeltype['name']);
|
$success_message = sprintf(__('User %s removed from %s.'), User_Nick_render($user_source), $angeltype['name']);
|
||||||
|
@ -274,7 +274,7 @@ function user_angeltype_update_controller()
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('confirmed')) {
|
if ($request->hasPostData('submit')) {
|
||||||
UserAngelType_update($user_angeltype['id'], $supporter);
|
UserAngelType_update($user_angeltype['id'], $supporter);
|
||||||
|
|
||||||
$success_message = sprintf(
|
$success_message = sprintf(
|
||||||
|
@ -318,7 +318,7 @@ function user_angeltype_add_controller()
|
||||||
// Load possible users, that are not in the angeltype already
|
// Load possible users, that are not in the angeltype already
|
||||||
$users_source = Users_by_angeltype_inverted($angeltype);
|
$users_source = Users_by_angeltype_inverted($angeltype);
|
||||||
|
|
||||||
if (request()->has('submit')) {
|
if (request()->hasPostData('submit')) {
|
||||||
$user_source = load_user();
|
$user_source = load_user();
|
||||||
|
|
||||||
if (!UserAngelType_exists($user_source->id, $angeltype)) {
|
if (!UserAngelType_exists($user_source->id, $angeltype)) {
|
||||||
|
@ -369,7 +369,7 @@ function user_angeltype_join_controller($angeltype)
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request()->has('confirmed')) {
|
if (request()->hasPostData('submit')) {
|
||||||
$user_angeltype_id = UserAngelType_create($user->id, $angeltype);
|
$user_angeltype_id = UserAngelType_create($user->id, $angeltype);
|
||||||
|
|
||||||
$success_message = sprintf(__('You joined %s.'), $angeltype['name']);
|
$success_message = sprintf(__('You joined %s.'), $angeltype['name']);
|
||||||
|
|
|
@ -114,7 +114,7 @@ function user_driver_license_edit_controller()
|
||||||
$wants_to_drive = true;
|
$wants_to_drive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
$wants_to_drive = $request->has('wants_to_drive');
|
$wants_to_drive = $request->has('wants_to_drive');
|
||||||
if ($wants_to_drive) {
|
if ($wants_to_drive) {
|
||||||
$user_driver_license['has_car'] = $request->has('has_car');
|
$user_driver_license['has_car'] = $request->has('has_car');
|
||||||
|
|
|
@ -16,7 +16,7 @@ function user_worklog_delete_controller()
|
||||||
}
|
}
|
||||||
$user_source = User::find($userWorkLog['user_id']);
|
$user_source = User::find($userWorkLog['user_id']);
|
||||||
|
|
||||||
if ($request->has('confirmed')) {
|
if ($request->hasPostData('submit')) {
|
||||||
UserWorkLog_delete($userWorkLog);
|
UserWorkLog_delete($userWorkLog);
|
||||||
|
|
||||||
success(__('Work log entry deleted.'));
|
success(__('Work log entry deleted.'));
|
||||||
|
@ -25,7 +25,7 @@ function user_worklog_delete_controller()
|
||||||
|
|
||||||
return [
|
return [
|
||||||
UserWorkLog_delete_title(),
|
UserWorkLog_delete_title(),
|
||||||
UserWorkLog_delete_view($user_source, $userWorkLog)
|
UserWorkLog_delete_view($user_source)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ function user_worklog_edit_controller()
|
||||||
}
|
}
|
||||||
$user_source = User::find($userWorkLog['user_id']);
|
$user_source = User::find($userWorkLog['user_id']);
|
||||||
|
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
list ($valid, $userWorkLog) = user_worklog_from_request($userWorkLog);
|
list ($valid, $userWorkLog) = user_worklog_from_request($userWorkLog);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
@ -114,7 +114,7 @@ function user_worklog_add_controller()
|
||||||
|
|
||||||
$userWorkLog = UserWorkLog_new($user_source->id);
|
$userWorkLog = UserWorkLog_new($user_source->id);
|
||||||
|
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
list ($valid, $userWorkLog) = user_worklog_from_request($userWorkLog);
|
list ($valid, $userWorkLog) = user_worklog_from_request($userWorkLog);
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
|
@ -66,7 +66,7 @@ function user_delete_controller()
|
||||||
redirect(user_link($user->id));
|
redirect(user_link($user->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -80,6 +80,8 @@ function user_delete_controller()
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
// Load data before user deletion to prevent errors when displaying
|
||||||
|
$user_source->load(['contact', 'personalData', 'settings', 'state']);
|
||||||
$user_source->delete();
|
$user_source->delete();
|
||||||
|
|
||||||
mail_user_delete($user_source);
|
mail_user_delete($user_source);
|
||||||
|
@ -150,7 +152,7 @@ function user_edit_vouchers_controller()
|
||||||
redirect(page_link_to(''));
|
redirect(page_link_to(''));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
$vouchers = '';
|
$vouchers = '';
|
||||||
|
@ -326,7 +328,7 @@ function user_password_recovery_set_new_controller()
|
||||||
redirect(page_link_to('login'));
|
redirect(page_link_to('login'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -361,7 +363,7 @@ function user_password_recovery_set_new_controller()
|
||||||
function user_password_recovery_start_controller()
|
function user_password_recovery_start_controller()
|
||||||
{
|
{
|
||||||
$request = request();
|
$request = request();
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
$user_source = null;
|
$user_source = null;
|
||||||
|
|
|
@ -49,7 +49,7 @@ function admin_active()
|
||||||
redirect(page_link_to('admin_active'));
|
redirect(page_link_to('admin_active'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('ack')) {
|
if ($request->hasPostData('ack')) {
|
||||||
State::query()
|
State::query()
|
||||||
->where('got_shirt', '=', false)
|
->where('got_shirt', '=', false)
|
||||||
->where('got_shirt', '=', false)
|
->where('got_shirt', '=', false)
|
||||||
|
@ -94,18 +94,14 @@ function admin_active()
|
||||||
|
|
||||||
$msg = success(__('Marked angels.'), true);
|
$msg = success(__('Marked angels.'), true);
|
||||||
} else {
|
} else {
|
||||||
$set_active = '<a href="' . page_link_to('admin_active', ['search' => $search]) . '">« '
|
$set_active = form([
|
||||||
. __('back')
|
button(page_link_to('admin_active', ['search' => $search]), '« ' . __('back')),
|
||||||
. '</a> | <a href="'
|
form_submit('ack', '» ' . __('apply')),
|
||||||
. page_link_to(
|
], page_link_to('admin_active', ['search' => $search, 'count' => $count, 'set_active' => 1]));
|
||||||
'admin_active',
|
|
||||||
['search' => $search, 'count' => $count, 'set_active' => 1, 'ack' => 1]
|
|
||||||
) . '">'
|
|
||||||
. __('apply')
|
|
||||||
. '</a>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->hasPostData('submit')) {
|
||||||
if ($request->has('active') && preg_match('/^\d+$/', $request->input('active'))) {
|
if ($request->has('active') && preg_match('/^\d+$/', $request->input('active'))) {
|
||||||
$user_id = $request->input('active');
|
$user_id = $request->input('active');
|
||||||
$user_source = User::find($user_id);
|
$user_source = User::find($user_id);
|
||||||
|
@ -151,6 +147,7 @@ function admin_active()
|
||||||
$msg = error(__('Angel not found.'), true);
|
$msg = error(__('Angel not found.'), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$query = User::query()
|
$query = User::query()
|
||||||
->selectRaw(
|
->selectRaw(
|
||||||
|
@ -232,9 +229,10 @@ function admin_active()
|
||||||
if ($show_all_shifts) {
|
if ($show_all_shifts) {
|
||||||
$parameters['show_all_shifts'] = 1;
|
$parameters['show_all_shifts'] = 1;
|
||||||
}
|
}
|
||||||
$actions[] = '<a href="' . page_link_to('admin_active', $parameters) . '">'
|
$actions[] = form(
|
||||||
. __('set active')
|
[form_submit('submit', __('set active'), 'btn-xs', false)],
|
||||||
. '</a>';
|
page_link_to('admin_active', $parameters)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if ($usr->state->active) {
|
if ($usr->state->active) {
|
||||||
$parametersRemove = [
|
$parametersRemove = [
|
||||||
|
@ -244,9 +242,10 @@ function admin_active()
|
||||||
if ($show_all_shifts) {
|
if ($show_all_shifts) {
|
||||||
$parametersRemove['show_all_shifts'] = 1;
|
$parametersRemove['show_all_shifts'] = 1;
|
||||||
}
|
}
|
||||||
$actions[] = '<a href="' . page_link_to('admin_active', $parametersRemove) . '">'
|
$actions[] = form(
|
||||||
. __('remove active')
|
[form_submit('submit', __('remove active'), 'btn-xs', false)],
|
||||||
. '</a>';
|
page_link_to('admin_active', $parametersRemove)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (!$usr->state->got_shirt) {
|
if (!$usr->state->got_shirt) {
|
||||||
$parametersShirt = [
|
$parametersShirt = [
|
||||||
|
@ -256,9 +255,10 @@ function admin_active()
|
||||||
if ($show_all_shifts) {
|
if ($show_all_shifts) {
|
||||||
$parametersShirt['show_all_shifts'] = 1;
|
$parametersShirt['show_all_shifts'] = 1;
|
||||||
}
|
}
|
||||||
$actions[] = '<a href="' . page_link_to('admin_active', $parametersShirt) . '">'
|
$actions[] = form(
|
||||||
. __('got t-shirt')
|
[form_submit('submit', __('got t-shirt'), 'btn-xs', false)],
|
||||||
. '</a>';
|
page_link_to('admin_active', $parametersShirt)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if ($usr->state->got_shirt) {
|
if ($usr->state->got_shirt) {
|
||||||
$parameters = [
|
$parameters = [
|
||||||
|
@ -268,12 +268,13 @@ function admin_active()
|
||||||
if ($show_all_shifts) {
|
if ($show_all_shifts) {
|
||||||
$parameters['show_all_shifts'] = 1;
|
$parameters['show_all_shifts'] = 1;
|
||||||
}
|
}
|
||||||
$actions[] = '<a href="' . page_link_to('admin_active', $parameters) . '">'
|
$actions[] = form(
|
||||||
. __('remove t-shirt')
|
[form_submit('submit', __('remove t-shirt'), 'btn-xs', false)],
|
||||||
. '</a>';
|
page_link_to('admin_active', $parameters)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$userData['actions'] = join(' ', $actions);
|
$userData['actions'] = buttons($actions);
|
||||||
|
|
||||||
$matched_users[] = $userData;
|
$matched_users[] = $userData;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,13 @@ function admin_arrive()
|
||||||
$search = trim($search);
|
$search = trim($search);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('reset') && preg_match('/^\d+$/', $request->input('reset'))) {
|
$action = $request->get('action');
|
||||||
$user_id = $request->input('reset');
|
if (
|
||||||
|
$action == 'reset'
|
||||||
|
&& preg_match('/^\d+$/', $request->input('user'))
|
||||||
|
&& $request->hasPostData('submit')
|
||||||
|
) {
|
||||||
|
$user_id = $request->input('user');
|
||||||
$user_source = User::find($user_id);
|
$user_source = User::find($user_id);
|
||||||
if ($user_source) {
|
if ($user_source) {
|
||||||
$user_source->state->arrived = false;
|
$user_source->state->arrived = false;
|
||||||
|
@ -38,8 +43,12 @@ function admin_arrive()
|
||||||
} else {
|
} else {
|
||||||
$msg = error(__('Angel not found.'), true);
|
$msg = error(__('Angel not found.'), true);
|
||||||
}
|
}
|
||||||
} elseif ($request->has('arrived') && preg_match('/^\d+$/', $request->input('arrived'))) {
|
} elseif (
|
||||||
$user_id = $request->input('arrived');
|
$action == 'arrived'
|
||||||
|
&& preg_match('/^\d+$/', $request->input('user'))
|
||||||
|
&& $request->hasPostData('submit')
|
||||||
|
) {
|
||||||
|
$user_id = $request->input('user');
|
||||||
$user_source = User::find($user_id);
|
$user_source = User::find($user_id);
|
||||||
if ($user_source) {
|
if ($user_source) {
|
||||||
$user_source->state->arrived = true;
|
$user_source->state->arrived = true;
|
||||||
|
@ -88,15 +97,11 @@ function admin_arrive()
|
||||||
$usr['rendered_planned_arrival_date'] = $plannedArrivalDate ? $plannedArrivalDate->format('Y-m-d') : '-';
|
$usr['rendered_planned_arrival_date'] = $plannedArrivalDate ? $plannedArrivalDate->format('Y-m-d') : '-';
|
||||||
$usr['rendered_arrival_date'] = $arrivalDate ? $arrivalDate->format('Y-m-d') : '-';
|
$usr['rendered_arrival_date'] = $arrivalDate ? $arrivalDate->format('Y-m-d') : '-';
|
||||||
$usr['arrived'] = $usr->state->arrived ? __('yes') : '';
|
$usr['arrived'] = $usr->state->arrived ? __('yes') : '';
|
||||||
$usr['actions'] = $usr->state->arrived == 1
|
$usr['actions'] = form([
|
||||||
? '<a href="' . page_link_to(
|
form_hidden('action', $usr->state->arrived ? 'reset' : 'arrived'),
|
||||||
'admin_arrive',
|
form_hidden('user', $usr->id),
|
||||||
['reset' => $usr->id, 'search' => $search]
|
form_submit('submit', $usr->state->arrived ? __('reset') : __('arrived'), 'btn-xs'),
|
||||||
) . '">' . __('reset') . '</a>'
|
]);
|
||||||
: '<a href="' . page_link_to(
|
|
||||||
'admin_arrive',
|
|
||||||
['arrived' => $usr->id, 'search' => $search]
|
|
||||||
) . '">' . __('arrived') . '</a>';
|
|
||||||
|
|
||||||
if ($usr->state->arrival_date) {
|
if ($usr->state->arrival_date) {
|
||||||
$day = $usr->state->arrival_date->format('Y-m-d');
|
$day = $usr->state->arrival_date->format('Y-m-d');
|
||||||
|
@ -167,7 +172,7 @@ function admin_arrive()
|
||||||
form([
|
form([
|
||||||
form_text('search', __('Search'), $search),
|
form_text('search', __('Search'), $search),
|
||||||
form_submit('submit', __('Search'))
|
form_submit('submit', __('Search'))
|
||||||
]),
|
], page_link_to('admin_arrive')),
|
||||||
table([
|
table([
|
||||||
'name' => __('Nickname'),
|
'name' => __('Nickname'),
|
||||||
'rendered_planned_arrival_date' => __('Planned arrival'),
|
'rendered_planned_arrival_date' => __('Planned arrival'),
|
||||||
|
|
|
@ -110,7 +110,11 @@ function admin_groups()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'save':
|
case 'save':
|
||||||
if ($request->has('id') && preg_match('/^-\d{1,11}$/', $request->input('id'))) {
|
if (
|
||||||
|
$request->has('id')
|
||||||
|
&& preg_match('/^-\d{1,11}$/', $request->input('id'))
|
||||||
|
&& $request->hasPostData('submit')
|
||||||
|
) {
|
||||||
$group_id = $request->input('id');
|
$group_id = $request->input('id');
|
||||||
} else {
|
} else {
|
||||||
return error('Incomplete call, missing Groups ID.', true);
|
return error('Incomplete call, missing Groups ID.', true);
|
||||||
|
|
|
@ -54,7 +54,7 @@ function admin_import()
|
||||||
case 'input':
|
case 'input':
|
||||||
$valid = false;
|
$valid = false;
|
||||||
|
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
if ($request->has('shifttype_id') && isset($shifttypes[$request->input('shifttype_id')])) {
|
if ($request->has('shifttype_id') && isset($shifttypes[$request->input('shifttype_id')])) {
|
||||||
|
|
|
@ -56,11 +56,9 @@ function admin_questions()
|
||||||
form_textarea('answer', '', ''),
|
form_textarea('answer', '', ''),
|
||||||
form_submit('submit', __('Save'))
|
form_submit('submit', __('Save'))
|
||||||
], page_link_to('admin_questions', ['action' => 'answer', 'id' => $question['QID']])),
|
], page_link_to('admin_questions', ['action' => 'answer', 'id' => $question['QID']])),
|
||||||
'actions' => button(
|
'actions' => form([
|
||||||
page_link_to('admin_questions', ['action' => 'delete', 'id' => $question['QID']]),
|
form_submit('submit', __('delete'), 'btn-xs'),
|
||||||
__('delete'),
|
], page_link_to('admin_questions', ['action' => 'delete', 'id' => $question['QID']])),
|
||||||
'btn-xs'
|
|
||||||
)
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,11 +72,9 @@ function admin_questions()
|
||||||
'question' => str_replace("\n", '<br />', $question['Question']),
|
'question' => str_replace("\n", '<br />', $question['Question']),
|
||||||
'answered_by' => User_Nick_render($answer_user_source),
|
'answered_by' => User_Nick_render($answer_user_source),
|
||||||
'answer' => str_replace("\n", '<br />', $question['Answer']),
|
'answer' => str_replace("\n", '<br />', $question['Answer']),
|
||||||
'actions' => button(
|
'actions' => form([
|
||||||
page_link_to('admin_questions', ['action' => 'delete', 'id' => $question['QID']]),
|
form_submit('submit', __('delete'), 'btn-xs')
|
||||||
__('delete'),
|
], page_link_to('admin_questions', ['action' => 'delete', 'id' => $question['QID']]))
|
||||||
'btn-xs'
|
|
||||||
)
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +98,11 @@ function admin_questions()
|
||||||
} else {
|
} else {
|
||||||
switch ($request->input('action')) {
|
switch ($request->input('action')) {
|
||||||
case 'answer':
|
case 'answer':
|
||||||
if ($request->has('id') && preg_match('/^\d{1,11}$/', $request->input('id'))) {
|
if (
|
||||||
|
$request->has('id')
|
||||||
|
&& preg_match('/^\d{1,11}$/', $request->input('id'))
|
||||||
|
&& $request->hasPostData('submit')
|
||||||
|
) {
|
||||||
$question_id = $request->input('id');
|
$question_id = $request->input('id');
|
||||||
} else {
|
} else {
|
||||||
return error('Incomplete call, missing Question ID.', true);
|
return error('Incomplete call, missing Question ID.', true);
|
||||||
|
@ -142,7 +142,11 @@ function admin_questions()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if ($request->has('id') && preg_match('/^\d{1,11}$/', $request->input('id'))) {
|
if (
|
||||||
|
$request->has('id')
|
||||||
|
&& preg_match('/^\d{1,11}$/', $request->input('id'))
|
||||||
|
&& $request->hasPostData('submit')
|
||||||
|
) {
|
||||||
$question_id = $request->input('id');
|
$question_id = $request->input('id');
|
||||||
} else {
|
} else {
|
||||||
return error('Incomplete call, missing Question ID.', true);
|
return error('Incomplete call, missing Question ID.', true);
|
||||||
|
|
|
@ -72,7 +72,7 @@ function admin_rooms()
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->input('show') == 'edit') {
|
if ($request->input('show') == 'edit') {
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
if ($request->has('name') && strlen(strip_request_item('name')) > 0) {
|
if ($request->has('name') && strlen(strip_request_item('name')) > 0) {
|
||||||
|
@ -178,7 +178,7 @@ function admin_rooms()
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
} elseif ($request->input('show') == 'delete') {
|
} elseif ($request->input('show') == 'delete') {
|
||||||
if ($request->has('ack')) {
|
if ($request->hasPostData('ack')) {
|
||||||
Room_delete($room_id);
|
Room_delete($room_id);
|
||||||
|
|
||||||
engelsystem_log('Room deleted: ' . $name);
|
engelsystem_log('Room deleted: ' . $name);
|
||||||
|
@ -191,13 +191,9 @@ function admin_rooms()
|
||||||
button(page_link_to('admin_rooms'), __('back'), 'back')
|
button(page_link_to('admin_rooms'), __('back'), 'back')
|
||||||
]),
|
]),
|
||||||
sprintf(__('Do you want to delete room %s?'), $name),
|
sprintf(__('Do you want to delete room %s?'), $name),
|
||||||
buttons([
|
form([
|
||||||
button(
|
form_submit('ack', __('Delete'), 'delete btn-danger'),
|
||||||
page_link_to('admin_rooms', ['show' => 'delete', 'id' => $room_id, 'ack' => 1]),
|
], page_link_to('admin_rooms', ['show' => 'delete', 'id' => $room_id])),
|
||||||
__('Delete'),
|
|
||||||
'delete btn-danger'
|
|
||||||
)
|
|
||||||
])
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,7 +307,7 @@ function admin_shifts()
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
} elseif ($request->has('submit')) {
|
} elseif ($request->hasPostData('submit')) {
|
||||||
if (
|
if (
|
||||||
!is_array($session->get('admin_shifts_shifts'))
|
!is_array($session->get('admin_shifts_shifts'))
|
||||||
|| !is_array($session->get('admin_shifts_types'))
|
|| !is_array($session->get('admin_shifts_types'))
|
||||||
|
|
|
@ -79,7 +79,7 @@ function guest_register()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
if ($request->has('nick') && strlen(User_validate_Nick($request->input('nick'))) > 1) {
|
if ($request->has('nick') && strlen(User_validate_Nick($request->input('nick'))) > 1) {
|
||||||
|
@ -388,7 +388,7 @@ function guest_login()
|
||||||
|
|
||||||
$session->remove('uid');
|
$session->remove('uid');
|
||||||
|
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
if ($request->has('nick') && strlen(User_validate_Nick($request->input('nick'))) > 0) {
|
if ($request->has('nick') && strlen(User_validate_Nick($request->input('nick'))) > 0) {
|
||||||
$nick = User_validate_Nick($request->input('nick'));
|
$nick = User_validate_Nick($request->input('nick'));
|
||||||
$login_user = User::whereName($nick)->first();
|
$login_user = User::whereName($nick)->first();
|
||||||
|
|
|
@ -77,7 +77,7 @@ function user_myshifts()
|
||||||
$freeloaded = $shift['freeloaded'];
|
$freeloaded = $shift['freeloaded'];
|
||||||
$freeload_comment = $shift['freeload_comment'];
|
$freeload_comment = $shift['freeload_comment'];
|
||||||
|
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
if (in_array('user_shifts_admin', $privileges)) {
|
if (in_array('user_shifts_admin', $privileges)) {
|
||||||
$freeloaded = $request->has('freeloaded');
|
$freeloaded = $request->has('freeloaded');
|
||||||
|
|
|
@ -142,7 +142,7 @@ function user_news_comments()
|
||||||
) {
|
) {
|
||||||
$nid = $request->input('nid');
|
$nid = $request->input('nid');
|
||||||
$news = DB::selectOne('SELECT * FROM `News` WHERE `ID`=? LIMIT 1', [$nid]);
|
$news = DB::selectOne('SELECT * FROM `News` WHERE `ID`=? LIMIT 1', [$nid]);
|
||||||
if ($request->has('text')) {
|
if ($request->hasPostData('submit') && $request->has('text')) {
|
||||||
$text = preg_replace(
|
$text = preg_replace(
|
||||||
"/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui",
|
"/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui",
|
||||||
'',
|
'',
|
||||||
|
|
|
@ -43,7 +43,7 @@ function user_questions()
|
||||||
switch ($request->input('action')) {
|
switch ($request->input('action')) {
|
||||||
case 'ask':
|
case 'ask':
|
||||||
$question = strip_request_item_nl('question');
|
$question = strip_request_item_nl('question');
|
||||||
if ($question != '') {
|
if ($question != '' && $request->hasPostData('submit')) {
|
||||||
DB::insert('
|
DB::insert('
|
||||||
INSERT INTO `Questions` (`UID`, `Question`)
|
INSERT INTO `Questions` (`UID`, `Question`)
|
||||||
VALUES (?, ?)
|
VALUES (?, ?)
|
||||||
|
@ -60,7 +60,11 @@ function user_questions()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if ($request->has('id') && preg_match('/^\d{1,11}$/', $request->input('id'))) {
|
if (
|
||||||
|
$request->has('id')
|
||||||
|
&& preg_match('/^\d{1,11}$/', $request->input('id'))
|
||||||
|
&& $request->hasPostData('submit')
|
||||||
|
) {
|
||||||
$question_id = $request->input('id');
|
$question_id = $request->input('id');
|
||||||
} else {
|
} else {
|
||||||
return error(__('Incomplete call, missing Question ID.'), true);
|
return error(__('Incomplete call, missing Question ID.'), true);
|
||||||
|
|
|
@ -204,13 +204,13 @@ function user_settings()
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_source = auth()->user();
|
$user_source = auth()->user();
|
||||||
if ($request->has('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
$user_source = user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes);
|
$user_source = user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes);
|
||||||
} elseif ($request->has('submit_password')) {
|
} elseif ($request->hasPostData('submit_password')) {
|
||||||
user_settings_password($user_source);
|
user_settings_password($user_source);
|
||||||
} elseif ($request->has('submit_theme')) {
|
} elseif ($request->hasPostData('submit_theme')) {
|
||||||
$user_source = user_settings_theme($user_source, $themes);
|
$user_source = user_settings_theme($user_source, $themes);
|
||||||
} elseif ($request->has('submit_language')) {
|
} elseif ($request->hasPostData('submit_language')) {
|
||||||
$user_source = user_settings_locale($user_source, $locales);
|
$user_source = user_settings_locale($user_source, $locales);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,13 +216,23 @@ function form_info($label, $text = '')
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param string $label
|
* @param string $label
|
||||||
|
* @param string $class
|
||||||
|
* @param bool $wrapForm
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function form_submit($name, $label)
|
function form_submit($name, $label, $class = '', $wrapForm = true)
|
||||||
{
|
{
|
||||||
|
$button = '<button class="btn btn-primary' . ($class ? ' ' . $class : '') . '" type="submit" name="' . $name . '">'
|
||||||
|
. $label
|
||||||
|
. '</button>';
|
||||||
|
|
||||||
|
if (!$wrapForm) {
|
||||||
|
return $button;
|
||||||
|
}
|
||||||
|
|
||||||
return form_element(
|
return form_element(
|
||||||
'<button class="btn btn-primary" type="submit" name="' . $name . '">' . $label . '</button>',
|
null,
|
||||||
''
|
$button
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,7 +401,7 @@ function form_select($name, $label, $values, $selected, $selectText = '')
|
||||||
*/
|
*/
|
||||||
function form_element($label, $input, $for = '')
|
function form_element($label, $input, $for = '')
|
||||||
{
|
{
|
||||||
if ($label == '') {
|
if (empty($label)) {
|
||||||
return '<div class="form-group">' . $input . '</div>';
|
return '<div class="form-group">' . $input . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,17 +53,12 @@ function AngelType_delete_view($angeltype)
|
||||||
{
|
{
|
||||||
return page_with_title(sprintf(__('Delete angeltype %s'), $angeltype['name']), [
|
return page_with_title(sprintf(__('Delete angeltype %s'), $angeltype['name']), [
|
||||||
info(sprintf(__('Do you want to delete angeltype %s?'), $angeltype['name']), true),
|
info(sprintf(__('Do you want to delete angeltype %s?'), $angeltype['name']), true),
|
||||||
|
form([
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('angeltypes'), glyph('remove') . __('cancel')),
|
button(page_link_to('angeltypes'), glyph('remove') . __('cancel')),
|
||||||
button(
|
form_submit('delete', glyph('ok') . __('delete'), 'btn-danger', false),
|
||||||
page_link_to(
|
|
||||||
'angeltypes',
|
|
||||||
['action' => 'delete', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]
|
|
||||||
),
|
|
||||||
glyph('ok') . __('delete'),
|
|
||||||
'btn-danger'
|
|
||||||
)
|
|
||||||
])
|
])
|
||||||
|
]),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,22 +9,18 @@
|
||||||
function Questions_view($open_questions, $answered_questions, $ask_action)
|
function Questions_view($open_questions, $answered_questions, $ask_action)
|
||||||
{
|
{
|
||||||
foreach ($open_questions as &$question) {
|
foreach ($open_questions as &$question) {
|
||||||
$question['actions'] = '<a href="'
|
$question['actions'] = form([
|
||||||
. page_link_to('user_questions', ['action' => 'delete', 'id' => $question['QID']])
|
form_submit('submit', __('delete'), 'btn-default btn-xs')
|
||||||
. '">'
|
], page_link_to('user_questions', ['action' => 'delete', 'id' => $question['QID']]));
|
||||||
. __('delete')
|
|
||||||
. '</a>';
|
|
||||||
$question['Question'] = str_replace("\n", '<br />', $question['Question']);
|
$question['Question'] = str_replace("\n", '<br />', $question['Question']);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($answered_questions as &$question) {
|
foreach ($answered_questions as &$question) {
|
||||||
$question['Question'] = str_replace("\n", '<br />', $question['Question']);
|
$question['Question'] = str_replace("\n", '<br />', $question['Question']);
|
||||||
$question['Answer'] = str_replace("\n", '<br />', $question['Answer']);
|
$question['Answer'] = str_replace("\n", '<br />', $question['Answer']);
|
||||||
$question['actions'] = '<a href="'
|
$question['actions'] = form([
|
||||||
. page_link_to('user_questions', ['action' => 'delete', 'id' => $question['QID']])
|
form_submit('submit', __('delete'), 'btn-default btn-xs')
|
||||||
. '">'
|
], page_link_to('user_questions', ['action' => 'delete', 'id' => $question['QID']]));
|
||||||
. __('delete')
|
|
||||||
. '</a>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return page_with_title(questions_title(), [
|
return page_with_title(questions_title(), [
|
||||||
|
|
|
@ -5,14 +5,13 @@ use Engelsystem\Models\User\User;
|
||||||
/**
|
/**
|
||||||
* Sign off from an user from a shift with admin permissions, asking for ack.
|
* Sign off from an user from a shift with admin permissions, asking for ack.
|
||||||
*
|
*
|
||||||
* @param array $shiftEntry
|
|
||||||
* @param array $shift
|
* @param array $shift
|
||||||
* @param array $angeltype
|
* @param array $angeltype
|
||||||
* @param User $signoff_user
|
* @param User $signoff_user
|
||||||
*
|
*
|
||||||
* @return string HTML
|
* @return string HTML
|
||||||
*/
|
*/
|
||||||
function ShiftEntry_delete_view_admin($shiftEntry, $shift, $angeltype, $signoff_user)
|
function ShiftEntry_delete_view_admin($shift, $angeltype, $signoff_user)
|
||||||
{
|
{
|
||||||
return page_with_title(ShiftEntry_delete_title(), [
|
return page_with_title(ShiftEntry_delete_title(), [
|
||||||
info(sprintf(
|
info(sprintf(
|
||||||
|
@ -23,26 +22,25 @@ function ShiftEntry_delete_view_admin($shiftEntry, $shift, $angeltype, $signoff_
|
||||||
date('Y-m-d H:i', $shift['end']),
|
date('Y-m-d H:i', $shift['end']),
|
||||||
$angeltype['name']
|
$angeltype['name']
|
||||||
), true),
|
), true),
|
||||||
|
form([
|
||||||
buttons([
|
buttons([
|
||||||
button(user_link($signoff_user->id), glyph('remove') . __('cancel')),
|
button(user_link($signoff_user->id), glyph('remove') . __('cancel')),
|
||||||
button(shift_entry_delete_link($shiftEntry, [
|
form_submit('delete', glyph('ok') . __('delete'), 'btn-danger', false)
|
||||||
'continue' => 1
|
]),
|
||||||
]), glyph('ok') . __('delete'), 'btn-danger')
|
]),
|
||||||
])
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sign off from a shift, asking for ack.
|
* Sign off from a shift, asking for ack.
|
||||||
*
|
*
|
||||||
* @param array $shiftEntry
|
|
||||||
* @param array $shift
|
* @param array $shift
|
||||||
* @param array $angeltype
|
* @param array $angeltype
|
||||||
* @param int $signoff_user_id
|
* @param int $signoff_user_id
|
||||||
*
|
*
|
||||||
* @return string HTML
|
* @return string HTML
|
||||||
*/
|
*/
|
||||||
function ShiftEntry_delete_view($shiftEntry, $shift, $angeltype, $signoff_user_id)
|
function ShiftEntry_delete_view($shift, $angeltype, $signoff_user_id)
|
||||||
{
|
{
|
||||||
return page_with_title(ShiftEntry_delete_title(), [
|
return page_with_title(ShiftEntry_delete_title(), [
|
||||||
info(sprintf(
|
info(sprintf(
|
||||||
|
@ -52,12 +50,13 @@ function ShiftEntry_delete_view($shiftEntry, $shift, $angeltype, $signoff_user_i
|
||||||
date('Y-m-d H:i', $shift['end']),
|
date('Y-m-d H:i', $shift['end']),
|
||||||
$angeltype['name']
|
$angeltype['name']
|
||||||
), true),
|
), true),
|
||||||
|
|
||||||
|
form([
|
||||||
buttons([
|
buttons([
|
||||||
button(user_link($signoff_user_id), glyph('remove') . __('cancel')),
|
button(user_link($signoff_user_id), glyph('remove') . __('cancel')),
|
||||||
button(shift_entry_delete_link($shiftEntry, [
|
form_submit('delete', glyph('ok') . __('delete'), 'btn-danger', false),
|
||||||
'continue' => 1
|
]),
|
||||||
]), glyph('ok') . __('delete'), 'btn-danger')
|
]),
|
||||||
])
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,17 +21,17 @@ function ShiftType_delete_view($shifttype)
|
||||||
{
|
{
|
||||||
return page_with_title(sprintf(__('Delete shifttype %s'), $shifttype['name']), [
|
return page_with_title(sprintf(__('Delete shifttype %s'), $shifttype['name']), [
|
||||||
info(sprintf(__('Do you want to delete shifttype %s?'), $shifttype['name']), true),
|
info(sprintf(__('Do you want to delete shifttype %s?'), $shifttype['name']), true),
|
||||||
|
form([
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('shifttypes'), glyph('remove') . __('cancel')),
|
button(page_link_to('shifttypes'), glyph('remove') . __('cancel')),
|
||||||
button(
|
form_submit(
|
||||||
page_link_to(
|
'delete',
|
||||||
'shifttypes',
|
|
||||||
['action' => 'delete', 'shifttype_id' => $shifttype['id'], 'confirmed' => 1]
|
|
||||||
),
|
|
||||||
glyph('ok') . __('delete'),
|
glyph('ok') . __('delete'),
|
||||||
'btn-danger'
|
'btn-danger',
|
||||||
)
|
false
|
||||||
])
|
),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,22 +20,19 @@ function UserAngelType_update_view($user_angeltype, $user, $angeltype, $supporte
|
||||||
$angeltype['name'],
|
$angeltype['name'],
|
||||||
User_Nick_render($user)
|
User_Nick_render($user)
|
||||||
), true),
|
), true),
|
||||||
|
form([
|
||||||
buttons([
|
buttons([
|
||||||
button(
|
button(
|
||||||
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
|
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
|
||||||
glyph('remove') . __('cancel')
|
glyph('remove') . __('cancel')
|
||||||
),
|
),
|
||||||
button(
|
form_submit('submit', glyph('ok') . __('yes'), 'btn-primary', false),
|
||||||
page_link_to('user_angeltypes', [
|
]),
|
||||||
|
], page_link_to('user_angeltypes', [
|
||||||
'action' => 'update',
|
'action' => 'update',
|
||||||
'user_angeltype_id' => $user_angeltype['id'],
|
'user_angeltype_id' => $user_angeltype['id'],
|
||||||
'supporter' => ($supporter ? '1' : '0'),
|
'supporter' => ($supporter ? '1' : '0'),
|
||||||
'confirmed' => 1,
|
])),
|
||||||
]),
|
|
||||||
glyph('ok') . __('yes'),
|
|
||||||
'btn-primary'
|
|
||||||
)
|
|
||||||
])
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +45,7 @@ function UserAngelTypes_delete_all_view($angeltype)
|
||||||
return page_with_title(__('Deny all users'), [
|
return page_with_title(__('Deny all users'), [
|
||||||
msg(),
|
msg(),
|
||||||
info(sprintf(__('Do you really want to deny all users for %s?'), $angeltype['name']), true),
|
info(sprintf(__('Do you really want to deny all users for %s?'), $angeltype['name']), true),
|
||||||
|
form([
|
||||||
buttons([
|
buttons([
|
||||||
button(
|
button(
|
||||||
page_link_to(
|
page_link_to(
|
||||||
|
@ -56,15 +54,9 @@ function UserAngelTypes_delete_all_view($angeltype)
|
||||||
),
|
),
|
||||||
glyph('remove') . __('cancel')
|
glyph('remove') . __('cancel')
|
||||||
),
|
),
|
||||||
button(
|
form_submit('deny_all', glyph('ok') . __('yes'), 'btn-primary', false)
|
||||||
page_link_to(
|
]),
|
||||||
'user_angeltypes',
|
], page_link_to('user_angeltypes', ['action' => 'delete_all', 'angeltype_id' => $angeltype['id']])),
|
||||||
['action' => 'delete_all', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]
|
|
||||||
),
|
|
||||||
glyph('ok') . __('yes'),
|
|
||||||
'btn-primary'
|
|
||||||
)
|
|
||||||
])
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,15 +69,12 @@ function UserAngelTypes_confirm_all_view($angeltype)
|
||||||
return page_with_title(__('Confirm all users'), [
|
return page_with_title(__('Confirm all users'), [
|
||||||
msg(),
|
msg(),
|
||||||
info(sprintf(__('Do you really want to confirm all users for %s?'), $angeltype['name']), true),
|
info(sprintf(__('Do you really want to confirm all users for %s?'), $angeltype['name']), true),
|
||||||
|
form([
|
||||||
buttons([
|
buttons([
|
||||||
button(angeltype_link($angeltype['id']), glyph('remove') . __('cancel')),
|
button(angeltype_link($angeltype['id']), glyph('remove') . __('cancel')),
|
||||||
button(
|
form_submit('confirm_all', glyph('ok') . __('yes'), 'btn-primary', false),
|
||||||
page_link_to('user_angeltypes',
|
]),
|
||||||
['action' => 'confirm_all', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]),
|
], page_link_to('user_angeltypes', ['action' => 'confirm_all', 'angeltype_id' => $angeltype['id']])),
|
||||||
glyph('ok') . __('yes'),
|
|
||||||
'btn-primary'
|
|
||||||
)
|
|
||||||
])
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,17 +93,12 @@ function UserAngelType_confirm_view($user_angeltype, $user, $angeltype)
|
||||||
User_Nick_render($user),
|
User_Nick_render($user),
|
||||||
$angeltype['name']
|
$angeltype['name']
|
||||||
), true),
|
), true),
|
||||||
|
form([
|
||||||
buttons([
|
buttons([
|
||||||
button(angeltype_link($angeltype['id']), glyph('remove') . __('cancel')),
|
button(angeltype_link($angeltype['id']), glyph('remove') . __('cancel')),
|
||||||
button(
|
form_submit('confirm_user', glyph('ok') . __('yes'), 'btn-primary', false),
|
||||||
page_link_to(
|
]),
|
||||||
'user_angeltypes',
|
], page_link_to('user_angeltypes', ['action' => 'confirm', 'user_angeltype_id' => $user_angeltype['id']])),
|
||||||
['action' => 'confirm', 'user_angeltype_id' => $user_angeltype['id'], 'confirmed' => 1]
|
|
||||||
),
|
|
||||||
glyph('ok') . __('yes'),
|
|
||||||
'btn-primary'
|
|
||||||
)
|
|
||||||
])
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,15 +117,12 @@ function UserAngelType_delete_view($user_angeltype, $user, $angeltype)
|
||||||
User_Nick_render($user),
|
User_Nick_render($user),
|
||||||
$angeltype['name']
|
$angeltype['name']
|
||||||
), true),
|
), true),
|
||||||
|
form([
|
||||||
buttons([
|
buttons([
|
||||||
button(angeltype_link($angeltype['id']), glyph('remove') . __('cancel')),
|
button(angeltype_link($angeltype['id']), glyph('remove') . __('cancel')),
|
||||||
button(
|
form_submit('delete', glyph('ok') . __('yes'), 'btn-primary', false),
|
||||||
page_link_to('user_angeltypes',
|
]),
|
||||||
['action' => 'delete', 'user_angeltype_id' => $user_angeltype['id'], 'confirmed' => 1]),
|
], page_link_to('user_angeltypes', ['action' => 'delete', 'user_angeltype_id' => $user_angeltype['id']])),
|
||||||
glyph('ok') . __('yes'),
|
|
||||||
'btn-primary'
|
|
||||||
)
|
|
||||||
])
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,16 +170,14 @@ function UserAngelType_join_view($user, $angeltype)
|
||||||
User_Nick_render($user),
|
User_Nick_render($user),
|
||||||
$angeltype['name']
|
$angeltype['name']
|
||||||
), true),
|
), true),
|
||||||
|
form([
|
||||||
buttons([
|
buttons([
|
||||||
button(angeltype_link($angeltype['id']), glyph('remove') . __('cancel')),
|
button(angeltype_link($angeltype['id']), glyph('remove') . __('cancel')),
|
||||||
button(
|
form_submit('submit', glyph('ok') . __('save'), 'btn-primary', false)
|
||||||
page_link_to(
|
]),
|
||||||
|
], page_link_to(
|
||||||
'user_angeltypes',
|
'user_angeltypes',
|
||||||
['action' => 'add', 'angeltype_id' => $angeltype['id'], 'user_id' => $user->id, 'confirmed' => 1]
|
['action' => 'add', 'angeltype_id' => $angeltype['id'], 'user_id' => $user->id]
|
||||||
),
|
)),
|
||||||
glyph('ok') . __('save'),
|
|
||||||
'btn-primary'
|
|
||||||
)
|
|
||||||
])
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,22 +6,21 @@ use Engelsystem\Models\User\User;
|
||||||
* Delete work log entry.
|
* Delete work log entry.
|
||||||
*
|
*
|
||||||
* @param User $user_source
|
* @param User $user_source
|
||||||
* @param array $userWorkLog
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function UserWorkLog_delete_view($user_source, $userWorkLog)
|
function UserWorkLog_delete_view($user_source)
|
||||||
{
|
{
|
||||||
return page_with_title(UserWorkLog_delete_title(), [
|
return page_with_title(UserWorkLog_delete_title(), [
|
||||||
info(sprintf(
|
info(sprintf(
|
||||||
__('Do you want to delete the worklog entry for %s?'),
|
__('Do you want to delete the worklog entry for %s?'),
|
||||||
User_Nick_render($user_source)
|
User_Nick_render($user_source)
|
||||||
), true),
|
), true),
|
||||||
|
form([
|
||||||
buttons([
|
buttons([
|
||||||
button(user_link($user_source->id), glyph('remove') . __('cancel')),
|
button(user_link($user_source->id), glyph('remove') . __('cancel')),
|
||||||
button(user_worklog_delete_link($userWorkLog, [
|
form_submit('submit', glyph('ok') . __('delete'), 'btn-danger', false),
|
||||||
'confirmed' => 1
|
]),
|
||||||
]), glyph('ok') . __('delete'), 'btn-danger')
|
]),
|
||||||
])
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,19 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
||||||
return !is_null($value);
|
return !is_null($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the POST data exists
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function hasPostData($key)
|
||||||
|
{
|
||||||
|
$value = $this->postData($key);
|
||||||
|
|
||||||
|
return !is_null($value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the requested path
|
* Get the requested path
|
||||||
*
|
*
|
||||||
|
|
|
@ -66,6 +66,24 @@ class RequestTest extends TestCase
|
||||||
$this->assertFalse($request->has('baz'));
|
$this->assertFalse($request->has('baz'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \Engelsystem\Http\Request::hasPostData
|
||||||
|
*/
|
||||||
|
public function testHasPostData()
|
||||||
|
{
|
||||||
|
$request = new Request([
|
||||||
|
'foo' => 'bar',
|
||||||
|
], [
|
||||||
|
'lorem' => 'ipsum',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertTrue($request->has('foo'));
|
||||||
|
$this->assertFalse($request->hasPostData('foo'));
|
||||||
|
|
||||||
|
$this->assertTrue($request->has('lorem'));
|
||||||
|
$this->assertTrue($request->hasPostData('lorem'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \Engelsystem\Http\Request::path
|
* @covers \Engelsystem\Http\Request::path
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue