A few urgent bug fixes.
This commit is contained in:
parent
4039201e7a
commit
5e13f91f3f
9 changed files with 98 additions and 21 deletions
|
@ -8,7 +8,8 @@
|
|||
|
||||
"builds": [
|
||||
|
||||
"20150427"
|
||||
"20150427",
|
||||
"20150427.1"
|
||||
|
||||
]
|
||||
|
||||
|
@ -672,6 +673,35 @@
|
|||
"change": "Fix chat redirect."
|
||||
}
|
||||
|
||||
],
|
||||
|
||||
"20150427.1": [
|
||||
|
||||
{
|
||||
"type": "FIX",
|
||||
"change": "Fixed bug in registration process causing a PDO Exception."
|
||||
},
|
||||
{
|
||||
"type": "FIX",
|
||||
"change": "Fixed bug in rank checking (e.g. system saying that you're activated and deactivated at the same time)."
|
||||
},
|
||||
{
|
||||
"type": "FIX",
|
||||
"change": "Fixed the enter substitute not working on some forms."
|
||||
},
|
||||
{
|
||||
"type": "FIX",
|
||||
"change": "Fixed activation system assigning incorrect rank after clicking the link."
|
||||
},
|
||||
{
|
||||
"type": "FIX",
|
||||
"change": "Fixed off-site account links being displayed to guests."
|
||||
},
|
||||
{
|
||||
"type": "FIX",
|
||||
"change": "Fixed /u/[username] not working."
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
}
|
||||
|
|
12
_sakura/components/SockChat.php
Normal file
12
_sakura/components/SockChat.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
/*
|
||||
* Sock Chat extensions
|
||||
*/
|
||||
|
||||
namespace Sakura;
|
||||
|
||||
class SockChat {
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -33,7 +33,7 @@ class Users {
|
|||
'lastunamechange' => 0,
|
||||
'birthday' => '',
|
||||
'country' => 'EU',
|
||||
'profile_data' => ''
|
||||
'profile_data' => '[]'
|
||||
];
|
||||
|
||||
// Empty rank template
|
||||
|
@ -127,7 +127,7 @@ class Users {
|
|||
}
|
||||
|
||||
// Check if the user is deactivated
|
||||
if(in_array(1, json_decode($userData['ranks'], true)) || in_array(0, json_decode($userData['ranks'], true)) || $userData['rank_main'] < 2)
|
||||
if(self::checkIfUserHasRanks([0, 1], $user, true))
|
||||
return [0, 'DEACTIVATED'];
|
||||
|
||||
// Create a new session
|
||||
|
@ -247,7 +247,7 @@ class Users {
|
|||
'lastdate' => 0,
|
||||
'lastunamechange' => time(),
|
||||
'country' => Main::getCountryCode(),
|
||||
'profile_data' => ''
|
||||
'profile_data' => '[]'
|
||||
]);
|
||||
|
||||
// Get userid of the new user
|
||||
|
@ -296,7 +296,7 @@ class Users {
|
|||
return [0, 'USER_NOT_EXIST'];
|
||||
|
||||
// Check if the user is deactivated
|
||||
if(in_array(1, json_decode($user['ranks'], true)) || in_array(0, json_decode($user['ranks'], true)) || $user['rank_main'] < 2)
|
||||
if(self::checkIfUserHasRanks([0, 1], $user, true))
|
||||
return [0, 'DEACTIVATED'];
|
||||
|
||||
// Generate the verification key
|
||||
|
@ -338,7 +338,7 @@ class Users {
|
|||
$user = Users::getUser(Session::$userId);
|
||||
|
||||
// Check if the user is deactivated
|
||||
if(in_array(1, json_decode($user['ranks'], true)) || in_array(0, json_decode($user['ranks'], true)) || $user['rank_main'] < 2)
|
||||
if(self::checkIfUserHasRanks([0, 1], $user, true))
|
||||
return [0, 'DEACTIVATED'];
|
||||
|
||||
// Check if the account is disabled
|
||||
|
@ -447,7 +447,7 @@ class Users {
|
|||
return [0, 'USER_NOT_EXIST'];
|
||||
|
||||
// Check if a user is activated
|
||||
if(!in_array(1, json_decode($user['ranks'], true)) || !in_array(0, json_decode($user['ranks'], true)) || $user['rank_main'] > 1)
|
||||
if(!self::checkIfUserHasRanks([0, 1], $user, true))
|
||||
return [0, 'USER_ALREADY_ACTIVE'];
|
||||
|
||||
// Send activation e-mail
|
||||
|
@ -465,14 +465,14 @@ class Users {
|
|||
$user = Database::fetch('users', false, ['id' => [$uid, '=']]);
|
||||
|
||||
// User is already activated or doesn't even exist
|
||||
if(count($user) < 2 || (!in_array(1, json_decode($user['ranks'], true)) || !in_array(0, json_decode($user['ranks'], true))) || $user['rank_main'] > 1)
|
||||
if(count($user) < 2 || !self::checkIfUserHasRanks([0, 1], $user, true))
|
||||
return false;
|
||||
|
||||
// Generate activation key
|
||||
$activate = ($customKey ? $customKey : Main::newActionCode('ACTIVATE', $uid, [
|
||||
'user' => [
|
||||
'rank_main' => 1,
|
||||
'ranks' => json_encode([1])
|
||||
'rank_main' => 2,
|
||||
'ranks' => json_encode([2])
|
||||
]
|
||||
]));
|
||||
|
||||
|
@ -509,7 +509,7 @@ class Users {
|
|||
return [0, 'USER_NOT_EXIST'];
|
||||
|
||||
// Check if user is already activated
|
||||
if(!in_array(1, json_decode($user['ranks'], true)) || !in_array(0, json_decode($user['ranks'], true)) || $user['rank_main'] > 1)
|
||||
if(!self::checkIfUserHasRanks([0, 1], $user, true))
|
||||
return [0, 'USER_ALREADY_ACTIVE'];
|
||||
|
||||
// Set default values for activation
|
||||
|
@ -560,14 +560,14 @@ class Users {
|
|||
return [0, 'USER_NOT_EXIST'];
|
||||
|
||||
// Check if user is already deactivated
|
||||
if(!$user['rank_main'])
|
||||
if(self::checkIfUserHasRanks([0, 1], $user, true))
|
||||
return [0, 'USER_ALREADY_DEACTIVE'];
|
||||
|
||||
// Deactivate the account
|
||||
Database::update('users', [
|
||||
[
|
||||
'rank_main' => 1,
|
||||
'ranks' => json_encode([1])
|
||||
'rank_main' => 2,
|
||||
'ranks' => json_encode([2])
|
||||
],
|
||||
[
|
||||
'id' => [$uid, '=']
|
||||
|
@ -640,6 +640,30 @@ class Users {
|
|||
|
||||
}
|
||||
|
||||
// Check if a user has these ranks
|
||||
public static function checkIfUserHasRanks($ranks, $userid, $userIdIsUserData = false) {
|
||||
|
||||
// Get the specified user
|
||||
$user = $userIdIsUserData ? $userid : self::getUser($userid);
|
||||
|
||||
// Check if the main rank is the specified rank
|
||||
if(in_array($user['rank_main'], $ranks))
|
||||
return true;
|
||||
|
||||
// If not go over all ranks and check if the user has them
|
||||
foreach($ranks as $rank) {
|
||||
|
||||
// We check if $rank is in $user['ranks'] and if yes return true
|
||||
if(in_array($rank, $user['ranks']))
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
// If all fails return false
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
// Check if a user exists
|
||||
public static function userExists($user, $id = true) {
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ $sakuraConf['db']['database'] = 'sakura'; // Database name
|
|||
$sakuraConf['db']['prefix'] = 'sakura_'; // Table Prefix
|
||||
|
||||
// URLs (for modularity)
|
||||
$sakuraConf['urls'] = array();
|
||||
$sakuraConf['urls']['main'] = 'flashii.net'; // Main site url
|
||||
$sakuraConf['urls']['api'] = 'api.flashii.net'; // API url
|
||||
$sakuraConf['urls']['content'] = 'cdn.flashii.net'; // Content directory url
|
||||
|
@ -21,6 +22,12 @@ $sakuraConf['urls']['chat'] = 'chat.flashii.net'; // Chat url
|
|||
$sakuraConf['urls']['manage'] = 'manage.flashii.net'; // Moderator panel url
|
||||
|
||||
// Errata
|
||||
$sakuraConf['etc'] = array();
|
||||
$sakuraConf['etc']['cfhosts'] = ROOT .'_sakura/config/cloudflare.hosts'; // Cloudflare IP subnets file
|
||||
$sakuraConf['etc']['whoisservers'] = ROOT .'_sakura/config/whois.json'; // JSON with Whois servers
|
||||
$sakuraConf['etc']['iso3166'] = ROOT .'_sakura/config/iso3166.json'; // JSON with country codes
|
||||
|
||||
// Sock Chat extensions
|
||||
$sakuraConf['sock'] = array();
|
||||
$sakuraConf['sock']['enable'] = true; // Ability to disable the extension in case you're using Sakura without Sock Chat, mind that this extension only works when using the same database
|
||||
$sakuraConf['sock']['sqlpref'] = 'sock_'; // Sock Chat table prefixes
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
</div>
|
||||
<div class="footer">
|
||||
<div class="ftsections">
|
||||
<div class="copycentre">Copyright © 2013-2015 <a href="//flash.moe/" target="_blank">Flashwave</a>, <a href="//{{ sakura.urls.main }}/credits">et al</a></div>
|
||||
<div class="copycentre">Copyright © 2013-2015 <a href="//flash.moe/" target="_blank">Flashwave</a>, <a href="//{{ sakura.urls.main }}/credits">et al</a>.</div>
|
||||
<ul class="ftsection">
|
||||
<li class="fthead">General</li>
|
||||
<li><a href="//{{ sakura.urls.main }}/" title="Flashii Frontpage">Home</a></li>
|
||||
|
|
|
@ -91,12 +91,12 @@
|
|||
var form = document.getElementById(i);
|
||||
var submit = form.querySelector('[type="submit"]');
|
||||
|
||||
form.setAttribute('onkeydown', 'formEnterCatch(event, \''+ submit.id +'\');');
|
||||
|
||||
submit.setAttribute('href', 'javascript:void(0);');
|
||||
submit.setAttribute('onclick', 'submitPost(\''+ i +'\', true, \''+ forms[i] +'\');');
|
||||
submit.setAttribute('type', 'button');
|
||||
|
||||
form.setAttribute('onkeydown', 'formEnterCatch(event, \''+ submit.id +'\');');
|
||||
|
||||
var createInput = document.createElement('input');
|
||||
createInput.setAttribute('name', 'ajax');
|
||||
createInput.setAttribute('value', 'true');
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
<input class="inputStyling" type="text" id="forgotEmail" name="email" />
|
||||
</div>
|
||||
<div class="centreAlign">
|
||||
<input class="inputStyling" type="submit" name="submit" value="Request Password" />
|
||||
<input class="inputStyling" type="submit" name="submit" value="Request Password" id="requestPassBtn" />
|
||||
</div>
|
||||
<div class="subLinks centreAlign">
|
||||
If you lost access to the e-mail address you registered with then there's not much we can do, it's your own responsibility to keep track of it and attaching a working one to your account.
|
||||
|
@ -130,7 +130,7 @@
|
|||
<input class="inputStyling" name="tos" type="checkbox" class="ignore-css" id="registerToS" /><label for="registerToS">I agree to the <a class="default" href="/r/terms" target="_blank">Terms of Service</a>.
|
||||
</div>
|
||||
<div class="centreAlign">
|
||||
<input class="inputStyling" type="submit" name="submit" value="Register" />
|
||||
<input class="inputStyling" type="submit" name="submit" value="Register" id="registerAccBtn" />
|
||||
</div>
|
||||
</form>
|
||||
{% if auth.blockRegister.do %}
|
||||
|
@ -179,7 +179,7 @@
|
|||
<input class="inputStyling" type="text" id="activeEmail" name="email" />
|
||||
</div>
|
||||
<div class="centreAlign">
|
||||
<input class="inputStyling" type="submit" name="submit" value="Request Activation" />
|
||||
<input class="inputStyling" type="submit" name="submit" value="Request Activation" id="requestActiveBtn" />
|
||||
</div>
|
||||
<div class="subLinks centreAlign">
|
||||
Read the footnote on the Lost Password form.
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<b>Last Seen on</b> {{ profile.user.lastdate|date("l Y-m-d H:i T") }}
|
||||
{% if profile.data is not null %}
|
||||
<hr class="default" />
|
||||
{% if user.loggedin %}
|
||||
<table style="width: 100%;">
|
||||
{% for name,field in profile.data %}
|
||||
<tr>
|
||||
|
@ -45,6 +46,9 @@
|
|||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
<b>Log in to view the full profile!</b>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<hr class="default" />
|
||||
<b>Account Standing</b>
|
||||
|
|
|
@ -26,7 +26,7 @@ if(isset($_GET['u'])) {
|
|||
|
||||
$renderData['profile'] = [
|
||||
'notset' => false,
|
||||
'user' => ($_PROFILE_USER_DATA = Users::getUser($_GET['u'])),
|
||||
'user' => ($_PROFILE_USER_DATA = Users::getUser(($_USER_USERNAME_ID = Users::userExists($_GET['u'], false)) ? $_USER_USERNAME_ID : $_GET['u'])),
|
||||
'rank' => ($_PROFILE_RANK_DATA = Users::getRank($_PROFILE_USER_DATA['rank_main'])),
|
||||
'colour' => ($_PROFILE_USER_DATA['name_colour'] == null ? $_PROFILE_RANK_DATA['colour'] : $_PROFILE_USER_DATA['name_colour']),
|
||||
'ranktitle' => ($_PROFILE_USER_DATA['usertitle'] == null ? $_PROFILE_RANK_DATA['title'] : $_PROFILE_USER_DATA['usertitle']),
|
||||
|
|
Reference in a new issue