From 5dcd2804a56b4b3555646fdce24ff07a5d63fd2a Mon Sep 17 00:00:00 2001 From: flashwave Date: Mon, 4 May 2015 20:08:53 +0000 Subject: [PATCH] daily bread --- _sakura/changelog.json | 26 +++++++++++++++++++++- _sakura/components/Users.php | 13 +++++++++++ _sakura/sakura.php | 2 +- _sakura/templates/yuuno/global/header.tpl | 2 +- _sakura/templates/yuuno/main/profile.tpl | 10 +++++++-- content/images/no-bg.png | Bin 0 -> 11029 bytes main/imageserve.php | 6 ----- main/profile.php | 13 ++++++++--- 8 files changed, 58 insertions(+), 14 deletions(-) create mode 100644 content/images/no-bg.png diff --git a/_sakura/changelog.json b/_sakura/changelog.json index ded72df..a4acdd6 100644 --- a/_sakura/changelog.json +++ b/_sakura/changelog.json @@ -23,7 +23,9 @@ "20150501", "20150502", "20150503", - "20150503.1" + "20150503.1", + "20150504", + "20150504.1" ] @@ -890,6 +892,28 @@ "change": "Added profile backgrounds." } + ], + + "20150504": [ + + { + "type": "REM", + "change": "Removed blank background for inactive users (will make the backend handle removal)." + } + + ], + + "20150504.1": [ + + { + "type": "UPD", + "change": "Changed profile background handling." + }, + { + "type": "ADD", + "change": "Add beginning parts of the warning systems." + } + ] } diff --git a/_sakura/components/Users.php b/_sakura/components/Users.php index 5cce653..132d564 100644 --- a/_sakura/components/Users.php +++ b/_sakura/components/Users.php @@ -918,4 +918,17 @@ class Users { } + // Get all warnings issued to a user (or all warnings a user issued) + public static function getWarnings($uid, $iid = false) { + + // Do the database query + $warnings = Database::fetch('warnings', true, [ + ($iid ? 'iid' : 'uid') => [$uid, '='] + ]); + + // Return all the warnings + return $warnings; + + } + } diff --git a/_sakura/sakura.php b/_sakura/sakura.php index 76a9fdf..c47d24c 100644 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -8,7 +8,7 @@ namespace Sakura; // Define Sakura version -define('SAKURA_VERSION', '20150503.1'); +define('SAKURA_VERSION', '20150504'); define('SAKURA_VLABEL', 'Heliotrope'); define('SAKURA_VTYPE', 'Development'); define('SAKURA_COLOUR', '#DF73FF'); diff --git a/_sakura/templates/yuuno/global/header.tpl b/_sakura/templates/yuuno/global/header.tpl index 1531cd3..7646ef3 100644 --- a/_sakura/templates/yuuno/global/header.tpl +++ b/_sakura/templates/yuuno/global/header.tpl @@ -119,7 +119,7 @@ }; - +
{% else %} -
+
+
{{ profile.user.username }}'s Avatar @@ -61,7 +62,12 @@ {% if profile.user.rank_main < 2 %}

Deactivated

{% else %} -

Good

+ {% if profile.warnings %} +

Bad

+ This user has {{ profile.warnings|length }} warning{% if profile.warnings|length != 1 %}s{% endif %}.
After 5 to 10 more warnings (depending on what they are for) this user may be permanently banned.
+ {% else %} +

Good

+ {% endif %} {% endif %}
diff --git a/content/images/no-bg.png b/content/images/no-bg.png new file mode 100644 index 0000000000000000000000000000000000000000..8e52f7c92ca8147d012e5592be65911bc2017a6f GIT binary patch literal 11029 zcmeAS@N?(olHy`uVBq!ia0y~yU~gbxV6os}1B$%3e9#$4u@pObhHwBu4M$1`kk47* z5n0T@z%2yAjF;}#{Q(Nfl(C#5R5WfrBD=NDxcD>w(6z1Xv< z2dGXAq|Ui0HL)Z!KTjbfGdGpNz*OJBSl`gpTyfEJ1_lKNPZ!6KiaBrY2Cj?<LEC~=s0|zyfl|B2)2{Df$W&_P_Bj4>w>2dR+?mWQCP1PVE-%;42=iBV->QILk z9AqLYB0J_@7l&y%M4T3?#69s&y#^0)HaLqaP9QSuiFYZH2A0Le!%`C`b$vv2r^0Bp7+J!yw zfjU4=rD3R2+ebM8|Z8R5}uyMF-ra#0LG~F7Dx#N5@>!%TpqQU_g`&@@jVI zg*)-Z?7-ArNM*<%uVu+`Dam<=jHW(3O=4?E5+D6UI&}y&2x#Xcs)s6(PDLmqI-T4& zFPs2rZ#S?|cZdORxNM(bq1M_cdIlDT;5d(oE=N|ma-lxXX=(y^@|3qP6SRxI1 zk~1Fo?f0{J8=q#pZS_1>aUX1QHe+B~E<}%XCe<=RE7A)IFcy`A4R3NiQb)5)xAF5Y*burOG1=KzJx7Ou zfh!TT7Jz{Pe;`oZ*+V|{B4*X^NYxsxuSDj65j%tRh+U44SN`YUwq2kE<>~6@vd$@?2>`rf B)C>Rs literal 0 HcmV?d00001 diff --git a/main/imageserve.php b/main/imageserve.php index 4173348..0b4828f 100644 --- a/main/imageserve.php +++ b/main/imageserve.php @@ -69,12 +69,6 @@ if(isset($_GET['m'])) { // Get user data $user = Users::getUser($_GET['u']); - // If user is deactivated don't display background - if(Users::checkIfUserHasRanks([0, 1], $user, true)) { - $serveImage = $noBackground; - break; - } - // Check if user has an avatar set if(empty($user['background_url']) || !file_exists($bgDirPath . $user['background_url'])) { $serveImage = $noAvatar; diff --git a/main/profile.php b/main/profile.php index 9d705a4..3a03e69 100644 --- a/main/profile.php +++ b/main/profile.php @@ -34,13 +34,20 @@ if(isset($_GET['u'])) { 'istenshi' => Users::checkUserTenshi($_PROFILE_USER_DATA['id']), 'online' => Users::checkUserOnline($_PROFILE_USER_DATA['id']), 'profpage' => Main::mdParse(base64_decode($_PROFILE_USER_DATA['profile_md'])), - 'data' => Users::getUserProfileData($_PROFILE_USER_DATA['id']) + 'data' => Users::getUserProfileData($_PROFILE_USER_DATA['id']), + 'warnings' => Users::getWarnings($_PROFILE_USER_DATA['id']) ]; $renderData['page'] = [ 'title' => ($_PROFILE_USER_DATA['id'] < 1 || $_PROFILE_USER_DATA['password_algo'] == 'nologin' ? 'User not found!' : 'Profile of '. $_PROFILE_USER_DATA['username']), 'style' => ($_PROFILE_USER_DATA['background_url'] ? [ - 'body' => [ - 'background' => 'url("/bg/'. $_PROFILE_USER_DATA['id'] .'") no-repeat fixed center center / cover transparent !important' + '.userBackground' => [ + 'background' => 'url("/bg/'. $_PROFILE_USER_DATA['id'] .'") no-repeat fixed center center / cover transparent !important', + 'position' => 'fixed', + 'top' => '0', + 'bottom' => '0', + 'right' => '0', + 'left' => '0', + 'z-index' => '-1' ], '.profile' => [ 'background' => 'rgba(211, 191, 255, .8) !important'