From 2dcb7cc2de448c664bbc9a7112f9cb13dc15c516 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Mon, 8 Oct 2018 21:15:56 +0200 Subject: Replaced some global `$user` variables --- includes/pages/user_questions.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'includes/pages/user_questions.php') 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] -- cgit v1.2.3-54-g00ecf