Merge pull request #4 from flashwave/analysis-Xl3OO8

i guess i need to adjust VS a bit better
This commit is contained in:
flash 2015-11-08 23:32:13 +01:00
commit bbab143b5e
3 changed files with 36 additions and 35 deletions

View file

@ -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(), '='],
],
]);
}
}
}

View file

@ -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) {

View file

@ -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'] = [