From b5334b27a0e704f4d02dab0ff89c67b9f6866ab8 Mon Sep 17 00:00:00 2001 From: flashwave Date: Thu, 31 Dec 2015 15:51:01 +0100 Subject: [PATCH] r20151231, happy new year to whoever reads this! --- LICENSE | 2 +- libraries/User.php | 6 +++--- libraries/Users.php | 18 ++++++------------ sakura.php | 4 ++-- templates/misaki/global/master.tpl | 2 +- templates/misaki/main/profile.tpl | 6 ++++-- templates/yuuno/global/master.tpl | 8 +++++--- templates/yuuno/main/profile.tpl | 22 ++++++++++++---------- 8 files changed, 34 insertions(+), 34 deletions(-) diff --git a/LICENSE b/LICENSE index 9425f3b..9046387 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2015 Flashwave + Copyright 2016 Julian van de Groep Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/libraries/User.php b/libraries/User.php index 9542da3..2c0e246 100644 --- a/libraries/User.php +++ b/libraries/User.php @@ -21,7 +21,7 @@ class User 'username_clean' => 'user', 'password_hash' => '', 'password_salt' => '', - 'password_algo' => 'nologin', + 'password_algo' => 'disabled', 'password_iter' => 0, 'password_chan' => 0, 'email' => 'sakura@localhost', @@ -818,8 +818,8 @@ class User { // Validate password switch ($this->data['password_algo']) { - // Abyssing - case 'nologin': + // Disabled account + case 'disabled': return [0, 'NO_LOGIN']; // Default hashing method diff --git a/libraries/Users.php b/libraries/Users.php index 7686fe1..2ed2fd8 100644 --- a/libraries/Users.php +++ b/libraries/Users.php @@ -123,8 +123,8 @@ class Users // Validate password switch ($user->password()['password_algo']) { - // Abyssing - case 'nologin': + // Disabled + case 'disabled': return [0, 'NO_LOGIN']; // Default hashing method @@ -137,7 +137,6 @@ class Users ])) { return [0, 'INCORRECT_PASSWORD', $user->id(), $user->password()['password_chan']]; } - } // Check if the user has the required privs to log in @@ -759,6 +758,7 @@ class Users { // Get the ID for the premium user rank from the database $premiumRank = Config::get('premium_rank_id'); + $excepted = Config::get('restricted_rank_id'); // Create user object $user = User::construct($id); @@ -767,7 +767,7 @@ class Users $check = $user->isPremium(); // Check if the user has premium - if ($check[0]) { + if ($check[0] && !in_array($excepted, $user->ranks())) { // If so add the rank to them $user->addRanks([$premiumRank]); @@ -816,8 +816,7 @@ class Users // Go over all users and check if they have the rank id foreach ($users as $user) { // If so store the user's row in the array - if ($user->hasRanks([$rankId], $user->id()) - && ($excludeAbyss ? $user->password()['password_algo'] != 'nologin' : true)) { + if ($user->hasRanks([$rankId], $user->id())) { $rank[] = $user; } } @@ -837,11 +836,6 @@ class Users // Reorder shit foreach ($getUsers as $user) { - // Skip abyss - if (!$includeAbyss && $user['password_algo'] == 'nologin') { - continue; - } - $user = User::construct($user['user_id']); // Skip if inactive and not include deactivated users @@ -947,6 +941,6 @@ class Users // Get the ID of the newest user public static function getNewestUserId() { - return Database::fetch('users', false, ['password_algo' => ['nologin', '!=']], ['user_id', true], ['1'])['user_id']; + return Database::fetch('users', false, ['rank_main' => [Config::get('restricted_rank_id'), '!=']], ['user_id', true], ['1'])['user_id']; } } diff --git a/sakura.php b/sakura.php index 07d7bae..ca70bac 100644 --- a/sakura.php +++ b/sakura.php @@ -1,14 +1,14 @@ + * (c) 2013-2016 Flashwave */ // Declare namespace namespace Sakura; // Define Sakura version -define('SAKURA_VERSION', '20151229'); +define('SAKURA_VERSION', '20151231'); define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_COLOUR', '#6C3082'); diff --git a/templates/misaki/global/master.tpl b/templates/misaki/global/master.tpl index 3ed293e..a789803 100644 --- a/templates/misaki/global/master.tpl +++ b/templates/misaki/global/master.tpl @@ -133,7 +133,7 @@
-
Powered by Sakura, Flashwave 2013-2015
+
Powered by Sakura, Flashwave 2013-2016
diff --git a/templates/misaki/main/profile.tpl b/templates/misaki/main/profile.tpl index d824131..0e42426 100644 --- a/templates/misaki/main/profile.tpl +++ b/templates/misaki/main/profile.tpl @@ -1,6 +1,6 @@ {% extends 'global/master.tpl' %} -{% set profileHidden = profile.permission(constant('Sakura\\Perms\\Site::DEACTIVATED')) or profile.password.password_algo == 'nologin' or (profile.permission(constant('Sakura\\Perms\\Site::RESTRICTED')) and (user.id != profile.id and not user.permission(constant('Sakura\\Perms\\Manage::USE_MANAGE'), constant('Sakura\\Perms::MANAGE')))) %} +{% set profileHidden = profile.permission(constant('Sakura\\Perms\\Site::DEACTIVATED')) or (profile.permission(constant('Sakura\\Perms\\Site::RESTRICTED')) and (user.id != profile.id and not user.permission(constant('Sakura\\Perms\\Manage::USE_MANAGE'), constant('Sakura\\Perms::MANAGE')))) %} {% set noUserpage = profile.userPage|length < 1 %} @@ -146,7 +146,9 @@ {% if profileHidden %}
Unknown
{% elseif profile.checkBan %} -

Banned

+

Banned

+ {% elseif profile.permission(constant('Sakura\\Perms\\Site::RESTRICTED')) %} +

Restricted

{% else %} {% if profile.getWarnings %}
Bad
diff --git a/templates/yuuno/global/master.tpl b/templates/yuuno/global/master.tpl index ca6f99c..0500d71 100644 --- a/templates/yuuno/global/master.tpl +++ b/templates/yuuno/global/master.tpl @@ -167,7 +167,9 @@ {% if session.checkLogin %} - + {% if user.permission(constant('Sakura\\Perms\\Manage::USE_MANAGE'), constant('Sakura\\Perms::MANAGE')) %} + + {% endif %} {% else %} @@ -232,7 +234,7 @@ {% block content %}

{{ php.self }} is now printing!

{% endblock %} - + {#