diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-10-08 21:15:56 +0200 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2018-10-31 13:43:23 +0100 |
commit | 2dcb7cc2de448c664bbc9a7112f9cb13dc15c516 (patch) | |
tree | e409cf77e97c91ff27b0e61f2a982519fdfdf76f /includes/model | |
parent | d15946df2dfb0ae2f0ca9371e5c8071df91ab45a (diff) |
Replaced some global `$user` variables
Diffstat (limited to 'includes/model')
-rw-r--r-- | includes/model/Message_model.php | 8 | ||||
-rw-r--r-- | includes/model/Shifts_model.php | 4 | ||||
-rw-r--r-- | includes/model/UserWorkLog_model.php | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/includes/model/Message_model.php b/includes/model/Message_model.php index 3f66f74a..4f8a3972 100644 --- a/includes/model/Message_model.php +++ b/includes/model/Message_model.php @@ -27,7 +27,7 @@ function Message($message_id) /** * TODO: use validation functions, return new message id - * TODO: global $user con not be used in model! + * TODO: global $user can't be used in model! * send message * * @param int $receiver_user_id User ID of Receiver @@ -36,7 +36,7 @@ function Message($message_id) */ function Message_send($receiver_user_id, $text) { - global $user; + $user = Auth()->user(); $text = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($text)); $receiver_user_id = preg_replace('/([^\d]{1,})/ui', '', strip_tags($receiver_user_id)); @@ -49,7 +49,7 @@ function Message_send($receiver_user_id, $text) WHERE `UID` = ? AND NOT `UID` = ? LIMIT 1 - ', [$receiver_user_id, $user['UID']])) > 0 + ', [$receiver_user_id, $user->id])) > 0 ) { return DB::insert(' INSERT INTO `Messages` (`Datum`, `SUID`, `RUID`, `Text`) @@ -57,7 +57,7 @@ function Message_send($receiver_user_id, $text) ', [ time(), - $user['UID'], + $user->id, $receiver_user_id, $text ] diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index 74facc0a..30ce5a97 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -518,7 +518,7 @@ function Shift_delete($shift_id) */ function Shift_update($shift) { - global $user; + $user = Auth()->user(); $shift['name'] = ShiftType($shift['shifttype_id'])['name']; mail_shift_change(Shift($shift['SID']), $shift); @@ -543,7 +543,7 @@ function Shift_update($shift) $shift['title'], $shift['URL'], $shift['PSID'], - $user['UID'], + $user->id, time(), $shift['SID'] ] diff --git a/includes/model/UserWorkLog_model.php b/includes/model/UserWorkLog_model.php index dd4b2574..46ab891e 100644 --- a/includes/model/UserWorkLog_model.php +++ b/includes/model/UserWorkLog_model.php @@ -93,7 +93,7 @@ function UserWorkLog_update($userWorkLog) */ function UserWorkLog_create($userWorkLog) { - global $user; + $user = Auth()->user(); $user_source = User($userWorkLog['user_id']); @@ -110,7 +110,7 @@ function UserWorkLog_create($userWorkLog) $userWorkLog['work_timestamp'], $userWorkLog['work_hours'], $userWorkLog['comment'], - $user['UID'], + $user->id, time() ]); |