' . user_news_comments_title() . '
';
@@ -158,7 +157,7 @@ function user_news_comments()
$nid,
date('Y-m-d H:i:s'),
$text,
- $user["UID"],
+ $user->id,
]
);
engelsystem_log('Created news_comment: ' . $text);
@@ -200,7 +199,8 @@ function user_news_comments()
*/
function user_news()
{
- global $privileges, $user;
+ global $privileges;
+ $user = Auth()->user();
$display_news = config('display_news');
$request = request();
@@ -225,7 +225,7 @@ function user_news()
time(),
strip_tags($request->postData('betreff')),
$text,
- $user['UID'],
+ $user->id,
$isMeeting,
]
);
diff --git a/includes/pages/user_questions.php b/includes/pages/user_questions.php
index ea255a3d..94922141 100644
--- a/includes/pages/user_questions.php
+++ b/includes/pages/user_questions.php
@@ -15,18 +15,18 @@ function questions_title()
*/
function user_questions()
{
- global $user;
+ $user = Auth()->user();
$request = request();
if (!$request->has('action')) {
$open_questions = DB::select(
'SELECT * FROM `Questions` WHERE `AID` IS NULL AND `UID`=?',
- [$user['UID']]
+ [$user->id]
);
$answered_questions = DB::select(
'SELECT * FROM `Questions` WHERE NOT `AID` IS NULL AND `UID`=?',
- [$user['UID']]
+ [$user->id]
);
foreach ($answered_questions as &$question) {
$answer_user_source = User($question['AID']);
@@ -47,7 +47,7 @@ function user_questions()
INSERT INTO `Questions` (`UID`, `Question`)
VALUES (?, ?)
',
- [$user['UID'], $question]
+ [$user->id, $question]
);
success(__('You question was saved.'));
@@ -69,7 +69,7 @@ function user_questions()
'SELECT `UID` FROM `Questions` WHERE `QID`=? LIMIT 1',
[$question_id]
);
- if (!empty($question) && $question['UID'] == $user['UID']) {
+ if (!empty($question) && $question['UID'] == $user->id) {
DB::delete(
'DELETE FROM `Questions` WHERE `QID`=? LIMIT 1',
[$question_id]
diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php
index 6754292e..dc33d078 100644
--- a/includes/pages/user_shifts.php
+++ b/includes/pages/user_shifts.php
@@ -129,7 +129,7 @@ function load_days()
*/
function load_types()
{
- global $user;
+ $user = Auth()->user();
if (!count(DB::select('SELECT `id`, `name` FROM `AngelTypes` WHERE `restricted` = 0'))) {
error(__('The administration has not configured any angeltypes yet - or you are not subscribed to any angeltype.'));
@@ -155,7 +155,7 @@ function load_types()
ORDER BY `AngelTypes`.`name`
',
[
- $user['UID'],
+ $user->id,
]
);
if (empty($types)) {
@@ -284,13 +284,13 @@ function view_user_shifts()
*/
function ical_hint()
{
- global $user;
+ $user = Auth()->user();
return heading(__('iCal export'), 2)
. '
' . sprintf(
__('Export your own shifts. iCal format or JSON format available (please keep secret, otherwise reset the api key).'),
- page_link_to('ical', ['key' => $user['api_key']]),
- page_link_to('shifts_json_export', ['key' => $user['api_key']]),
+ 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])
) . '
';
}
--
cgit v1.2.3-70-g09d2