summaryrefslogtreecommitdiff
path: root/includes/controller
diff options
context:
space:
mode:
Diffstat (limited to 'includes/controller')
-rw-r--r--includes/controller/shift_entries_controller.php4
-rw-r--r--includes/controller/user_driver_licenses_controller.php9
-rw-r--r--includes/controller/users_controller.php4
3 files changed, 9 insertions, 8 deletions
diff --git a/includes/controller/shift_entries_controller.php b/includes/controller/shift_entries_controller.php
index 05a3a5e5..2c57f550 100644
--- a/includes/controller/shift_entries_controller.php
+++ b/includes/controller/shift_entries_controller.php
@@ -336,7 +336,7 @@ function shift_entry_load()
*/
function shift_entry_delete_controller()
{
- global $user;
+ $user = Auth()->user();
$request = request();
$shiftEntry = shift_entry_load();
@@ -354,7 +354,7 @@ function shift_entry_delete_controller()
redirect(shift_link($shift));
}
- if ($user['UID'] == $signout_user['UID']) {
+ if ($user->id == $signout_user['UID']) {
return [
ShiftEntry_delete_title(),
ShiftEntry_delete_view($shiftEntry, $shift, $angeltype, $signout_user)
diff --git a/includes/controller/user_driver_licenses_controller.php b/includes/controller/user_driver_licenses_controller.php
index 6621866d..422ad382 100644
--- a/includes/controller/user_driver_licenses_controller.php
+++ b/includes/controller/user_driver_licenses_controller.php
@@ -37,9 +37,9 @@ function user_driver_license_required_hint()
*/
function user_driver_licenses_controller()
{
- global $user;
+ $user = Auth()->user();
- if (!isset($user)) {
+ if (!$user) {
redirect(page_link_to(''));
}
@@ -94,12 +94,13 @@ function user_driver_license_load_user()
*/
function user_driver_license_edit_controller()
{
- global $privileges, $user;
+ global $privileges;
+ $user = Auth()->user();
$request = request();
$user_source = user_driver_license_load_user();
// only privilege admin_user can edit other users driver license information
- if ($user['UID'] != $user_source['UID'] && !in_array('admin_user', $privileges)) {
+ if ($user->id != $user_source['UID'] && !in_array('admin_user', $privileges)) {
redirect(user_driver_license_edit_link());
}
diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php
index d7f97c7e..13264fd1 100644
--- a/includes/controller/users_controller.php
+++ b/includes/controller/users_controller.php
@@ -11,10 +11,10 @@ use Engelsystem\ShiftsFilter;
*/
function users_controller()
{
- global $user;
+ $user = Auth()->user();
$request = request();
- if (!isset($user)) {
+ if (!$user) {
redirect(page_link_to(''));
}