From be39c63f46562eea173747d80cd91ac81e0b8e09 Mon Sep 17 00:00:00 2001 From: Bot Date: Sun, 8 Sep 2019 02:25:49 +0200 Subject: Renamed redirect() to throwRedirect() --- includes/pages/admin_active.php | 4 ++-- includes/pages/admin_arrive.php | 4 ++-- includes/pages/admin_groups.php | 2 +- includes/pages/admin_import.php | 22 +++++++++++----------- includes/pages/admin_news.php | 8 ++++---- includes/pages/admin_questions.php | 4 ++-- includes/pages/admin_rooms.php | 6 +++--- includes/pages/admin_shifts.php | 4 ++-- includes/pages/admin_user.php | 4 ++-- includes/pages/guest_login.php | 4 ++-- includes/pages/user_messages.php | 6 +++--- includes/pages/user_myshifts.php | 8 ++++---- includes/pages/user_news.php | 2 +- includes/pages/user_questions.php | 4 ++-- includes/pages/user_settings.php | 8 ++++---- includes/pages/user_shifts.php | 8 ++++---- 16 files changed, 49 insertions(+), 49 deletions(-) (limited to 'includes/pages') diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php index 508f3d81..71d6914a 100644 --- a/includes/pages/admin_active.php +++ b/includes/pages/admin_active.php @@ -42,11 +42,11 @@ function admin_active() __('At least %s angels are forced to be active. The number has to be greater.'), $forced_count )); - redirect(page_link_to('admin_active')); + throw_redirect(page_link_to('admin_active')); } } else { $msg .= error(__('Please enter a number of angels to be marked as active.')); - redirect(page_link_to('admin_active')); + throw_redirect(page_link_to('admin_active')); } if ($request->hasPostData('ack')) { diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php index 7a11f3ab..312fd6dc 100644 --- a/includes/pages/admin_arrive.php +++ b/includes/pages/admin_arrive.php @@ -39,7 +39,7 @@ function admin_arrive() engelsystem_log('User set to not arrived: ' . User_Nick_render($user_source, true)); success(__('Reset done. Angel has not arrived.')); - redirect(user_link($user_source->id)); + throw_redirect(user_link($user_source->id)); } else { $msg = error(__('Angel not found.'), true); } @@ -57,7 +57,7 @@ function admin_arrive() engelsystem_log('User set has arrived: ' . User_Nick_render($user_source, true)); success(__('Angel has been marked as arrived.')); - redirect(user_link($user_source->id)); + throw_redirect(user_link($user_source->id)); } else { $msg = error(__('Angel not found.'), true); } diff --git a/includes/pages/admin_groups.php b/includes/pages/admin_groups.php index 6ba2ceaf..1d4a9e03 100644 --- a/includes/pages/admin_groups.php +++ b/includes/pages/admin_groups.php @@ -148,7 +148,7 @@ function admin_groups() 'Group privileges of group ' . $group['Name'] . ' edited: ' . join(', ', $privilege_names) ); - redirect(page_link_to('admin_groups')); + throw_redirect(page_link_to('admin_groups')); } else { return error('No Group found.', true); } diff --git a/includes/pages/admin_import.php b/includes/pages/admin_import.php index 11c9729a..1dbd742b 100644 --- a/includes/pages/admin_import.php +++ b/includes/pages/admin_import.php @@ -98,7 +98,7 @@ function admin_import() } if ($valid) { - redirect( + throw_redirect( page_link_to('admin_import', [ 'step' => 'check', 'shifttype_id' => $shifttype_id, @@ -134,28 +134,28 @@ function admin_import() case 'check': if (!file_exists($import_file)) { error(__('Missing import file.')); - redirect(page_link_to('admin_import')); + throw_redirect(page_link_to('admin_import')); } if ($request->has('shifttype_id') && isset($shifttypes[$request->input('shifttype_id')])) { $shifttype_id = $request->input('shifttype_id'); } else { error(__('Please select a shift type.')); - redirect(page_link_to('admin_import')); + throw_redirect(page_link_to('admin_import')); } if ($request->has('add_minutes_start') && is_numeric(trim($request->input('add_minutes_start')))) { $add_minutes_start = trim($request->input('add_minutes_start')); } else { error(__('Please enter an amount of minutes to add to a talk\'s begin.')); - redirect(page_link_to('admin_import')); + throw_redirect(page_link_to('admin_import')); } if ($request->has('add_minutes_end') && is_numeric(trim($request->input(('add_minutes_end'))))) { $add_minutes_end = trim($request->input('add_minutes_end')); } else { error(__('Please enter an amount of minutes to add to a talk\'s end.')); - redirect(page_link_to('admin_import')); + throw_redirect(page_link_to('admin_import')); } list($rooms_new, $rooms_deleted) = prepare_rooms($import_file); @@ -229,32 +229,32 @@ function admin_import() case 'import': if (!file_exists($import_file)) { error(__('Missing import file.')); - redirect(page_link_to('admin_import')); + throw_redirect(page_link_to('admin_import')); } if (!file_exists($import_file)) { - redirect(page_link_to('admin_import')); + throw_redirect(page_link_to('admin_import')); } if ($request->has('shifttype_id') && isset($shifttypes[$request->input('shifttype_id')])) { $shifttype_id = $request->input('shifttype_id'); } else { error(__('Please select a shift type.')); - redirect(page_link_to('admin_import')); + throw_redirect(page_link_to('admin_import')); } if ($request->has('add_minutes_start') && is_numeric(trim($request->input('add_minutes_start')))) { $add_minutes_start = trim($request->input('add_minutes_start')); } else { error(__('Please enter an amount of minutes to add to a talk\'s begin.')); - redirect(page_link_to('admin_import')); + throw_redirect(page_link_to('admin_import')); } if ($request->has('add_minutes_end') && is_numeric(trim($request->input('add_minutes_end')))) { $add_minutes_end = trim($request->input('add_minutes_end')); } else { error(__('Please enter an amount of minutes to add to a talk\'s end.')); - redirect(page_link_to('admin_import')); + throw_redirect(page_link_to('admin_import')); } list($rooms_new, $rooms_deleted) = prepare_rooms($import_file); @@ -297,7 +297,7 @@ function admin_import() ]) . success(__('It\'s done!'), true); break; default: - redirect(page_link_to('admin_import')); + throw_redirect(page_link_to('admin_import')); } return page_with_title(admin_import_title(), [ diff --git a/includes/pages/admin_news.php b/includes/pages/admin_news.php index 1d49af80..19d3c7ed 100644 --- a/includes/pages/admin_news.php +++ b/includes/pages/admin_news.php @@ -10,7 +10,7 @@ function admin_news() $request = request(); if (!$request->has('action')) { - redirect(page_link_to('news')); + throw_redirect(page_link_to('news')); } $html = '

' . __('Edit news entry') . '

' . msg(); @@ -70,17 +70,17 @@ function admin_news() engelsystem_log('News updated: ' . $request->postData('eBetreff')); success(__('News entry updated.')); - redirect(page_link_to('news')); + throw_redirect(page_link_to('news')); break; case 'delete': $news->delete(); engelsystem_log('News deleted: ' . $news->title); success(__('News entry deleted.')); - redirect(page_link_to('news')); + throw_redirect(page_link_to('news')); break; default: - redirect(page_link_to('news')); + throw_redirect(page_link_to('news')); } return $html . '
'; } diff --git a/includes/pages/admin_questions.php b/includes/pages/admin_questions.php index 54d5509b..8a63f8db 100644 --- a/includes/pages/admin_questions.php +++ b/includes/pages/admin_questions.php @@ -122,7 +122,7 @@ function admin_questions() . ' answered: ' . $answer ); - redirect(page_link_to('admin_questions')); + throw_redirect(page_link_to('admin_questions')); } else { return error('Enter an answer!', true); } @@ -145,7 +145,7 @@ function admin_questions() if (!empty($question)) { $question->delete(); engelsystem_log('Question deleted: ' . $question['Question']); - redirect(page_link_to('admin_questions')); + throw_redirect(page_link_to('admin_questions')); } else { return error('No question found.', true); } diff --git a/includes/pages/admin_rooms.php b/includes/pages/admin_rooms.php index c55eb227..74c0fbe3 100644 --- a/includes/pages/admin_rooms.php +++ b/includes/pages/admin_rooms.php @@ -56,7 +56,7 @@ function admin_rooms() if (test_request_int('id')) { $room = Room($request->input('id')); if (empty($room)) { - redirect(page_link_to('admin_rooms')); + throw_redirect(page_link_to('admin_rooms')); } $room_id = $request->input('id'); @@ -140,7 +140,7 @@ function admin_rooms() . ' to: ' . join(', ', $needed_angeltype_info) ); success(__('Room saved.')); - redirect(page_link_to('admin_rooms')); + throw_redirect(page_link_to('admin_rooms')); } } $angeltypes_count_form = []; @@ -190,7 +190,7 @@ function admin_rooms() Room_delete($room_id); success(sprintf(__('Room %s deleted.'), $name)); - redirect(page_link_to('admin_rooms')); + throw_redirect(page_link_to('admin_rooms')); } return page_with_title(admin_rooms_title(), [ diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php index c62ff995..dc61392f 100644 --- a/includes/pages/admin_shifts.php +++ b/includes/pages/admin_shifts.php @@ -345,7 +345,7 @@ function admin_shifts() !is_array($session->get('admin_shifts_shifts')) || !is_array($session->get('admin_shifts_types')) ) { - redirect(page_link_to('admin_shifts')); + throw_redirect(page_link_to('admin_shifts')); } foreach ($session->get('admin_shifts_shifts', []) as $shift) { @@ -389,7 +389,7 @@ function admin_shifts() } success('Schichten angelegt.'); - redirect(page_link_to('admin_shifts')); + throw_redirect(page_link_to('admin_shifts')); } else { $session->remove('admin_shifts_shifts'); $session->remove('admin_shifts_types'); diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index 1c40586f..3fc4c694 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -22,7 +22,7 @@ function admin_user() $html = ''; if (!$request->has('id')) { - redirect(users_link()); + throw_redirect(users_link()); } $user_id = $request->input('id'); @@ -30,7 +30,7 @@ function admin_user() $user_source = User::find($user_id); if (!$user_source) { error(__('This user does not exist.')); - redirect(users_link()); + throw_redirect(users_link()); } $html .= 'Hallo,
' diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php index 170572e4..820c84ea 100644 --- a/includes/pages/guest_login.php +++ b/includes/pages/guest_login.php @@ -239,7 +239,7 @@ function guest_register() // User is already logged in - that means a supporter has registered an angel. Return to register page. if ($authUser) { - redirect(page_link_to('register')); + throw_redirect(page_link_to('register')); } // If a welcome message is present, display it on the next page @@ -247,7 +247,7 @@ function guest_register() info((new Parsedown())->text($message)); } - redirect(page_link_to('/')); + throw_redirect(page_link_to('/')); } } diff --git a/includes/pages/user_messages.php b/includes/pages/user_messages.php index ce496132..72bb9ae2 100644 --- a/includes/pages/user_messages.php +++ b/includes/pages/user_messages.php @@ -141,7 +141,7 @@ function user_messages() 'UPDATE `Messages` SET `isRead`=\'Y\' WHERE `id`=? LIMIT 1', [$message_id] ); - redirect(page_link_to('user_messages')); + throw_redirect(page_link_to('user_messages')); } else { return error(__('No Message found.'), true); } @@ -160,7 +160,7 @@ function user_messages() ); if (!empty($message) && $message['SUID'] == $user->id) { DB::delete('DELETE FROM `Messages` WHERE `id`=? LIMIT 1', [$message_id]); - redirect(page_link_to('user_messages')); + throw_redirect(page_link_to('user_messages')); } else { return error(__('No Message found.'), true); } @@ -168,7 +168,7 @@ function user_messages() case 'send': if (Message_send($request->input('to'), $request->input('text'))) { - redirect(page_link_to('user_messages')); + throw_redirect(page_link_to('user_messages')); } else { return error(__('Transmitting was terminated with an Error.'), true); } diff --git a/includes/pages/user_myshifts.php b/includes/pages/user_myshifts.php index f962225e..ca6762f7 100644 --- a/includes/pages/user_myshifts.php +++ b/includes/pages/user_myshifts.php @@ -37,7 +37,7 @@ function user_myshifts() if ($request->input('reset') == 'ack') { User_reset_api_key($user); success(__('Key changed.')); - redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user->id])); + throw_redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user->id])); } return page_with_title(__('Reset API key'), [ error( @@ -109,7 +109,7 @@ function user_myshifts() . '. Freeloaded: ' . ($freeloaded ? 'YES Comment: ' . $freeload_comment : 'NO') ); success(__('Shift saved.')); - redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user->id])); + throw_redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user->id])); } } @@ -125,10 +125,10 @@ function user_myshifts() auth()->can('user_shifts_admin') ); } else { - redirect(page_link_to('user_myshifts')); + throw_redirect(page_link_to('user_myshifts')); } } - redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user->id])); + throw_redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user->id])); return ''; } diff --git a/includes/pages/user_news.php b/includes/pages/user_news.php index 4eb8f0ce..8b9c21ad 100644 --- a/includes/pages/user_news.php +++ b/includes/pages/user_news.php @@ -197,7 +197,7 @@ function user_news() engelsystem_log('Created news: ' . $news->title . ', is meeting: ' . ($news->is_meeting ? 'yes' : 'no')); success(__('Entry saved.')); - redirect(page_link_to('news')); + throw_redirect(page_link_to('news')); } if (preg_match('/^\d{1,}$/', $request->input('page', 0))) { diff --git a/includes/pages/user_questions.php b/includes/pages/user_questions.php index 13f58b10..7654d540 100644 --- a/includes/pages/user_questions.php +++ b/includes/pages/user_questions.php @@ -38,7 +38,7 @@ function user_questions() ]); success(__('You question was saved.')); - redirect(page_link_to('user_questions')); + throw_redirect(page_link_to('user_questions')); } else { return page_with_title(questions_title(), [ error(__('Please enter a question!'), true) @@ -59,7 +59,7 @@ function user_questions() $question = Question::find($question_id); if (!empty($question) && $question->user_id == $user->id) { $question->delete(); - redirect(page_link_to('user_questions')); + throw_redirect(page_link_to('user_questions')); } else { return page_with_title(questions_title(), [ error(__('No question found.'), true) diff --git a/includes/pages/user_settings.php b/includes/pages/user_settings.php index e398e3a8..5646b27f 100644 --- a/includes/pages/user_settings.php +++ b/includes/pages/user_settings.php @@ -91,7 +91,7 @@ function user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes) $user_source->settings->save(); success(__('Settings saved.')); - redirect(page_link_to('user_settings')); + throw_redirect(page_link_to('user_settings')); } return $user_source; @@ -119,7 +119,7 @@ function user_settings_password($user_source) $auth->setPassword($user_source, $request->postData('new_password')); success(__('Password saved.')); } - redirect(page_link_to('user_settings')); + throw_redirect(page_link_to('user_settings')); } /** @@ -144,7 +144,7 @@ function user_settings_theme($user_source, $themes) $user_source->settings->save(); success(__('Theme changed.')); - redirect(page_link_to('user_settings')); + throw_redirect(page_link_to('user_settings')); } return $user_source; @@ -174,7 +174,7 @@ function user_settings_locale($user_source, $locales) $session->set('locale', $user_source->settings->language); success('Language changed.'); - redirect(page_link_to('user_settings')); + throw_redirect(page_link_to('user_settings')); } return $user_source; diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 8e3c8ded..20bcca86 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -25,7 +25,7 @@ function user_shifts() $request = request(); if (User_is_freeloader(auth()->user())) { - redirect(page_link_to('user_myshifts')); + throw_redirect(page_link_to('user_myshifts')); } if ($request->has('edit_shift')) { @@ -99,7 +99,7 @@ function load_rooms() ); if (empty($rooms)) { error(__('The administration has not configured any rooms yet.')); - redirect(page_link_to('/')); + throw_redirect(page_link_to('/')); } return $rooms; } @@ -120,7 +120,7 @@ function load_days() error(__('The administration has not configured any shifts yet.')); // Do not try to redirect to the current page if (config('home_site') != 'user_shifts') { - redirect(page_link_to('/')); + throw_redirect(page_link_to('/')); } } return $days; @@ -135,7 +135,7 @@ function load_types() if (!count(DB::select('SELECT `id`, `name` FROM `AngelTypes`'))) { error(__('The administration has not configured any angeltypes yet - or you are not subscribed to any angeltype.')); - redirect(page_link_to('/')); + throw_redirect(page_link_to('/')); } $types = DB::select(' SELECT -- cgit v1.2.3-54-g00ecf