From 218e78a309a37b44428aa51053fbfd282bd14bd6 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 8 Nov 2015 17:31:52 -0500 Subject: [PATCH] Applied fixes from StyleCI --- _sakura/components/User.php | 65 ++++++++++++++++++------------------ _sakura/components/Users.php | 2 +- public/settings.php | 4 +-- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/_sakura/components/User.php b/_sakura/components/User.php index 0e73d7d..ae8cd58 100755 --- a/_sakura/components/User.php +++ b/_sakura/components/User.php @@ -191,31 +191,31 @@ class User return $times; } - // Set the main rank of this user - public function setMainRank($rank) - { - // Only allow this if this rank is actually present in their set of ranks - if (!in_array($rank, $this->ranks())) { - return false; - } + // Set the main rank of this user + public function setMainRank($rank) + { + // Only allow this if this rank is actually present in their set of ranks + if (!in_array($rank, $this->ranks())) { + return false; + } - // If it does exist update their row - Database::update('user', [ - [ - 'rank_main' => $rank, - ], - [ - 'user_id' => [$this->id(), '='], - ], - ]); + // If it does exist update their row + Database::update('user', [ + [ + 'rank_main' => $rank, + ], + [ + 'user_id' => [$this->id(), '='], + ], + ]); // Return true if everything was successful - return true; - } + return true; + } - // Check if this user has the specified ranks - public function hasRanks($ranks) - { + // Check if this user has the specified ranks + public function hasRanks($ranks) + { // Check if the main rank is the specified rank if (in_array($this->mainRank->id(), $ranks)) { return true; @@ -231,12 +231,12 @@ class User // If all fails return false return false; - } + } // For compatibility, too lazy to update the references right now! public function checkIfUserHasRanks($ranks) { - return $this->hasRanks($ranks); + return $this->hasRanks($ranks); } // Add a new friend @@ -721,16 +721,17 @@ class User return [1, 'SUCCESS']; } - // Update a user's userData - public function setUserData($data) { - // Merge the arrays - $data = array_merge($this->userData(), $data); + // Update a user's userData + public function setUserData($data) + { + // Merge the arrays + $data = array_merge($this->userData(), $data); - // Encode it - $data = json_encode($data); + // Encode it + $data = json_encode($data); - // Save it in the database - Database::update('users', [ + // Save it in the database + Database::update('users', [ [ 'user_data' => $data, ], @@ -738,5 +739,5 @@ class User 'user_id' => [$this->id(), '='], ], ]); - } + } } diff --git a/_sakura/components/Users.php b/_sakura/components/Users.php index f71c68e..c3b4f83 100755 --- a/_sakura/components/Users.php +++ b/_sakura/components/Users.php @@ -710,7 +710,7 @@ class Users // Get the specified user $user = new User($uid); - $current = $user->ranks(); + $current = $user->ranks(); // Check the current ranks for ranks in the set array foreach ($current as $key => $rank) { diff --git a/public/settings.php b/public/settings.php index bb20498..cc45b0e 100755 --- a/public/settings.php +++ b/public/settings.php @@ -939,7 +939,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification $userPage = base64_encode($_POST['userpage']); // Update database - $currentUser->setUserData(['userPage' => $userPage]); + $currentUser->setUserData(['userPage' => $userPage]); // Set render data $renderData['page'] = [ @@ -957,7 +957,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification $signature = base64_encode($_POST['signature']); // Update database - $currentUser->setUserData(['signature' => $signature]); + $currentUser->setUserData(['signature' => $signature]); // Set render data $renderData['page'] = [