r20151017

Signed-off-by: Flashwave <me@flash.moe>
This commit is contained in:
flash 2015-10-17 22:58:51 +02:00
parent a26e4f813b
commit f77933dd86
11 changed files with 233 additions and 42 deletions

View file

@ -66,7 +66,7 @@ class Session
// Check if we actually got something in return
if (!count($session)) {
return false;
return 0;
}
$session = $session[0];
@ -77,7 +77,7 @@ class Session
self::deleteSession($session['session_id']);
// ...and return false
return false;
return 0;
}
// Origin checking
@ -94,14 +94,14 @@ class Session
// 000.xxx.xxx.xxx
case 3:
if ($userIP[3] !== $sessionIP[3]) {
return false;
return 0;
}
// xxx.000.xxx.xxx
case 2:
case 3:
if ($userIP[2] !== $sessionIP[2]) {
return false;
return 0;
}
// xxx.xxx.000.xxx
@ -109,7 +109,7 @@ class Session
case 2:
case 3:
if ($userIP[1] !== $sessionIP[1]) {
return false;
return 0;
}
// xxx.xxx.xxx.000
@ -118,7 +118,7 @@ class Session
case 2:
case 3:
if ($userIP[0] !== $sessionIP[0]) {
return false;
return 0;
}
}
}

View file

@ -410,10 +410,48 @@ class User
{
// Do the database query
$warnings = Database::fetch('warnings', true, [
$getWarnings = Database::fetch('warnings', true, [
'user_id' => [$this->data['user_id'], '='],
]);
// Storage array
$warnings = [];
// Add special stuff
foreach ($getWarnings as $warning) {
// Check if it hasn't expired
if ($warning['warning_expires'] < time()) {
Database::delete('warnings', ['warning_id' => [$warning['warning_id'], '=']]);
continue;
}
// Text action
switch ($warning['warning_action']) {
default:
case '0':
$warning['warning_action_text'] = 'Warning';
break;
case '1':
$warning['warning_action_text'] = 'Silence';
break;
case '2':
$warning['warning_action_text'] = 'Restriction';
break;
case '3':
$warning['warning_action_text'] = 'Ban';
break;
case '4':
$warning['warning_action_text'] = 'Abyss';
break;
}
// Text expiration
$warning['warning_length'] = round(($warning['warning_expires'] - $warning['warning_issued']) / 60);
// Add to array
$warnings[$warning['warning_id']] = $warning;
}
// Return all the warnings
return $warnings;

View file

@ -45,31 +45,22 @@ class Users
];
// Check if a user is logged in
public static function checkLogin($uid = null, $sid = null, $bypassCookies = false)
public static function checkLogin($uid = null, $sid = null)
{
// Set $uid and $sid if they're null
if ($uid == null) {
$uid = Session::$userId;
}
// Assign $uid and $sid
$uid = $uid ? $uid : (isset($_COOKIE[Configuration::getConfig('cookie_prefix') . 'id'])
? $_COOKIE[Configuration::getConfig('cookie_prefix') . 'id']
: 0);
$sid = $sid ? $sid : (isset($_COOKIE[Configuration::getConfig('cookie_prefix') . 'session'])
? $_COOKIE[Configuration::getConfig('cookie_prefix') . 'session']
: 0);
// ^
if ($sid == null) {
$sid = Session::$sessionId;
}
// Check if cookie bypass is false
if (!$bypassCookies) {
// Check if the cookies are set
if (!isset($_COOKIE[Configuration::getConfig('cookie_prefix') . 'id']) ||
!isset($_COOKIE[Configuration::getConfig('cookie_prefix') . 'session'])) {
return false;
}
}
// Get session
$session = Session::checkSession($uid, $sid);
// Check if the session exists and check if the user is activated
if (!$session = Session::checkSession($uid, $sid)
|| Permissions::check('SITE', 'DEACTIVATED', $uid, 1)) {
if ($session == 0 || Permissions::check('SITE', 'DEACTIVATED', $uid, 1)) {
// Unset User ID
setcookie(
Configuration::getConfig('cookie_prefix') . 'id',
@ -92,7 +83,7 @@ class Users
}
// Extend the cookie times if the remember flag is set
if ($session == 2 && !$bypassCookies) {
if ($session == 2) {
// User ID cookie
setcookie(
Configuration::getConfig('cookie_prefix') . 'id',

View file

@ -8,7 +8,7 @@
namespace Sakura;
// Define Sakura version
define('SAKURA_VERSION', '20151016');
define('SAKURA_VERSION', '20151017');
define('SAKURA_VLABEL', 'Eminence');
define('SAKURA_COLOUR', '#6C3082');
define('SAKURA_STABLE', false);

View file

View file

@ -302,8 +302,7 @@
// Create changelog table
var changelogTable = document.createElement('table');
changelogTable.style.fontSize = '.8em';
changelogTable.style.lineHeight = '1.5em';
changelogTable.className = 'panelTable';
// Create and append all changelog entries
for (var i in changelog) {
@ -314,8 +313,6 @@
// Set data
changelogColumnAction.appendChild(document.createTextNode(changelog[i]['change_action']['action_name']));
changelogColumnAction.style.textAlign = 'center';
changelogColumnAction.style.padding = '0 2px';
changelogColumnAction.style.background = changelogColours[changelog[i]['change_action']['action_id']];
changelogColumnMessage.appendChild(document.createTextNode(changelog[i]['change_message']));

View file

@ -102,13 +102,26 @@
<h2 style="color: #222; text-shadow: 0 0 7px #222; margin-top: 0;">Banned</h2>
{% elseif profile.checkPermission('SITE', 'RESTRICTED') %}
<h2 style="color: #800; text-shadow: 0 0 7px #800; margin-top: 0;">Restricted</h2>
{% elseif profile.getWarnings %}
<h2 style="color: #A00; text-shadow: 0 0 7px #A00; margin-top: 0;">Bad</h2>
{% else %}
{% if profile.getWarnings %}
<h2 style="color: #A00; text-shadow: 0 0 7px #A00; margin-top: 0;">Bad</h2>
<span style="font-size: 10px; line-height: 10px;">This user has <b>{{ profile.getWarnings|length }} warning{% if profile.getWarnings|length != 1 %}s{% endif %}</b>.<br />After 5 to 10 warnings (depending on what they are for) this user may be permanently banned.</span>
{% else %}
<h2 style="color: #080; text-shadow: 0 0 7px #080; margin-top: 0;">Good</h2>
{% endif %}
<h2 style="color: #080; text-shadow: 0 0 7px #080; margin-top: 0;">Good</h2>
{% endif %}
{% if profile.getWarnings %}
<table class="panelTable">
<tr>
<th>Action</th>
<th>Duration</th>
<th>Reason</th>
</tr>
{% for warning in profile.getWarnings %}
<tr class="{{ warning.warning_action_text|lower }}">
<td>{{ warning.warning_action_text }}</td>
<td>{{ warning.warning_length }} minute{% if warning.warning_length != 1 %}s{% endif %}</td>
<td>{{ warning.warning_reason }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
</div>
</div>

View file

@ -22,6 +22,18 @@
*/
@import url('markdown.css');
/*
* Keyframe definitions
*/
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/*
* Reset margin and padding
*/
@ -200,6 +212,12 @@ a:active {
margin: auto;
}
#header .logo.loading {
transform-origin: 50% 50.5%;
animation: spin 2s infinite linear;
background-image: url('../images/spinner.svg');
}
#header .social {
z-index: 1;
font-size: 2.5em;
@ -273,6 +291,7 @@ a:active {
margin-bottom: 5px;
position: relative;
z-index: 900;
max-width: 1018px;
}
#content > #navigation > ul > li {
@ -281,7 +300,8 @@ a:active {
}
#content > #navigation > ul > li > a:not(.ignore) {
min-width: 80px;
height: 30px;
line-height: 30px;
display: inline-block;
text-align: center;
color: inherit;

View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="1024px" height="1024px" viewBox="0 0 1024 1024" enable-background="new 0 0 1024 1024" xml:space="preserve">
<g>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="368.6167" y1="307.6597" x2="1393.6826" y2="307.6597" gradientTransform="matrix(0.9686 -0.2487 0.2487 0.9686 -110.877 143.6445)">
<stop offset="0" style="stop-color:#662D91"/>
<stop offset="1" style="stop-color:#9B8579"/>
</linearGradient>
<polygon fill="url(#SVGID_1_)" points="539.247,444.171 484.89,444.123 485.139,158.44 539.495,158.488 "/>
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="190.1802" y1="449.8481" x2="1212.8848" y2="449.8481" gradientTransform="matrix(0.5821 -0.8131 0.8131 0.5821 -249.8516 448.1367)">
<stop offset="0" style="stop-color:#662D91"/>
<stop offset="1" style="stop-color:#9B8579"/>
</linearGradient>
<polygon fill="url(#SVGID_2_)" points="485.139,443.553 443.469,478.458 260.026,259.452 301.697,224.549 "/>
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="-8.8989" y1="487.3521" x2="1017.359" y2="487.3521" gradientTransform="matrix(-0.0767 -0.9971 0.9971 -0.0767 -162.9487 835.7334)">
<stop offset="0" style="stop-color:#662D91"/>
<stop offset="1" style="stop-color:#9B8579"/>
</linearGradient>
<polygon fill="url(#SVGID_3_)" points="443.859,478.094 434.373,531.617 153.074,481.763 162.561,428.24 "/>
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="19.4063" y1="415.5278" x2="1042.7773" y2="415.5278" gradientTransform="matrix(-0.6997 -0.7145 0.7145 -0.6997 327.4824 1223.6914)">
<stop offset="0" style="stop-color:#662D91"/>
<stop offset="1" style="stop-color:#9B8579"/>
</linearGradient>
<polygon fill="url(#SVGID_4_)" points="434.713,531.902 461.852,579.002 214.318,721.628 187.181,674.528 "/>
<linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="57.9751" y1="337.5098" x2="1079.688" y2="337.5098" gradientTransform="matrix(-0.9952 -0.0976 0.0976 -0.9952 964.8691 1112.8604)">
<stop offset="0" style="stop-color:#662D91"/>
<stop offset="1" style="stop-color:#9B8579"/>
</linearGradient>
<polygon fill="url(#SVGID_5_)" points="461.299,578.557 512.362,597.191 414.42,865.561 363.356,846.924 "/>
<linearGradient id="SVGID_6_" gradientUnits="userSpaceOnUse" x1="142.6909" y1="341.7607" x2="1166.2224" y2="341.7607" gradientTransform="matrix(-0.8251 0.565 -0.565 -0.8251 1396.1484 581.625)">
<stop offset="0" style="stop-color:#662D91"/>
<stop offset="1" style="stop-color:#9B8579"/>
</linearGradient>
<polygon fill="url(#SVGID_6_)" points="512.132,596.864 563.228,578.317 660.703,846.856 609.606,865.403 "/>
<linearGradient id="SVGID_7_" gradientUnits="userSpaceOnUse" x1="126.5542" y1="501.042" x2="1150.0634" y2="501.042" gradientTransform="matrix(-0.2689 0.9632 -0.9632 -0.2689 1403.0156 -27.5205)">
<stop offset="0" style="stop-color:#662D91"/>
<stop offset="1" style="stop-color:#9B8579"/>
</linearGradient>
<polygon fill="url(#SVGID_7_)" points="562.971,578.427 590.19,531.375 837.475,674.432 810.255,721.484 "/>
<linearGradient id="SVGID_8_" gradientUnits="userSpaceOnUse" x1="-84.0576" y1="639.9004" x2="940.2671" y2="639.9004" gradientTransform="matrix(0.4131 0.9107 -0.9107 0.4131 1025.9099 -406.9004)">
<stop offset="0" style="stop-color:#662D91"/>
<stop offset="1" style="stop-color:#9B8579"/>
</linearGradient>
<polygon fill="url(#SVGID_8_)" points="589.539,531.381 580.147,477.84 861.533,428.476 870.927,482.018 "/>
<linearGradient id="SVGID_9_" gradientUnits="userSpaceOnUse" x1="-333.6509" y1="564.4238" x2="691.8616" y2="564.4238" gradientTransform="matrix(0.9028 0.43 -0.43 0.9028 446.634 -371.2861)">
<stop offset="0" style="stop-color:#662D91"/>
<stop offset="1" style="stop-color:#9B8579"/>
</linearGradient>
<polygon fill="url(#SVGID_9_)" points="580.649,478.458 538.96,443.579 722.286,224.475 763.976,259.358 "/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

@ -73,9 +73,26 @@ function convertParallaxPositionValue(pos, dir, neg) {
}
// Subtract another 2.5 to make the element not go all over the place
position = position - 2.5;
position = position - 2.5;
// Return the proper position value
return position;
}
// Menu bar
window.addEventListener("scroll", function(e) {
if(e.pageY > 123) {
var content = document.getElementById('content');
var navigation = document.getElementById('navigation');
navigation.style.position = 'fixed';
navigation.style.top = '0';
content.style.paddingTop = '37px';
} else {
var content = document.getElementById('content');
var navigation = document.getElementById('navigation');
navigation.style.position = null;
navigation.style.top = null;
content.style.paddingTop = null;
}
});

View file

@ -1237,6 +1237,50 @@ a.default:active {
}
/*
* Panel table
*/
.panelTable {
width: 100%;
font-size: .8em;
line-height: 1.5em;
border-spacing: 1px;
}
.panelTable th {
background: #9475B2;
color: #306;
}
.panelTable td:first-child {
padding: 0 2px;
text-align: center;
}
.panelTable .warning td {
background: #A22;
color: #FFF;
}
.panelTable .silence td {
background: #A22;
color: #FFF;
}
.panelTable .restriction td {
background: #822;
color: #FFF;
}
.panelTable .ban td {
background: #444;
color: #FFF;
}
.panelTable .abyss td {
background: #888;
}
/*
* User Background
*/
@ -1509,7 +1553,7 @@ a.default:active {
color: #503170;
}
@media (min-width: 840px) {
@media (min-width: 1024px) {
.support .featureBox.final {
width: 818px;
@ -1523,10 +1567,19 @@ a.default:active {
@media (max-width: 840px) {
.support .featureBox,
.support .featureBox.final {
width: 380px;
}
.support .featureBox.final .featureBoxDesc {
line-height: 25px;
}
.support .featureBox .right {
display: none;
}
}
.support .featureBoxIcon.right {