From d059fcb90b79d00b6998184c13dbca50ae78e526 Mon Sep 17 00:00:00 2001 From: flashwave Date: Thu, 30 Jul 2015 19:07:23 +0200 Subject: [PATCH] fix --- _sakura/changelog.json | 32 +++++++++++++++- _sakura/components/Bans.php | 36 +++++++++++++++--- _sakura/sakura.php | 4 +- _sakura/templates/yuuno/elements/newsPost.tpl | 2 +- _sakura/templates/yuuno/errors/banned.tpl | 8 +++- .../yuuno/errors/premiumComplete.tpl | 2 +- _sakura/templates/yuuno/forum/topicEntry.tpl | 2 +- _sakura/templates/yuuno/forum/viewtopic.tpl | 2 +- _sakura/templates/yuuno/main/credits.tpl | 2 +- _sakura/templates/yuuno/main/memberlist.tpl | 4 +- _sakura/templates/yuuno/main/messages.tpl | 2 +- _sakura/templates/yuuno/main/profile.tpl | 4 +- _sakura/templates/yuuno/main/search.tpl | 2 +- _sakura/templates/yuuno/main/support.tpl | 4 +- content/images/emoticons/huh.png | Bin 0 -> 1785 bytes main/changelog.php | 3 ++ main/support.php | 6 +-- 17 files changed, 88 insertions(+), 27 deletions(-) create mode 100644 content/images/emoticons/huh.png diff --git a/_sakura/changelog.json b/_sakura/changelog.json index a40579f..e339904 100644 --- a/_sakura/changelog.json +++ b/_sakura/changelog.json @@ -35,7 +35,8 @@ "20150706", "20150707", "20150725", - "20150728" + "20150728", + "20150730" ] @@ -1535,6 +1536,35 @@ "change": "(Temporarily) removed chat online user count." } + ], + + "20150730": [ + + { + "type": "FIX", + "change": "Use the same date() formatting everywhere." + }, + { + "type": "ADD", + "change": "Added user banning backend." + }, + { + "type": "FIX", + "change": "Replaced money_format function with number_format due to incompatibility with certain platforms." + }, + { + "type": "FIX", + "change": "Fixed calculation of remaining premium tag." + }, + { + "type": "FIX", + "change": "Fixed &expire=<timestamp> still being in the url when purchasing premium." + }, + { + "type": "FIX", + "change": "Fixed background colours on the search page looking slightly mentally challenged." + } + ] } diff --git a/_sakura/components/Bans.php b/_sakura/components/Bans.php index be9e47e..d2b1c91 100644 --- a/_sakura/components/Bans.php +++ b/_sakura/components/Bans.php @@ -10,16 +10,40 @@ class Bans { // Check if a user is banned public static function checkBan($id) { - if($id == 1) { + // Attempt to get a ban from this user + $bans = Database::fetch('bans', true, ['uid' => [$id, '=']]); + + // Reverse the array so new bans are listed first + $bans = array_reverse($bans); + + // Go over each ban + foreach($bans as $ban) { + + // Check if it hasn't expired + if($ban['ban_end'] != 0 && $ban['ban_end'] < time()) { + + // If it has delete the entry and continue + Database::delete('bans', ['id' => [$ban['id'], '=']]); + continue; + + } + + // Return the ban if all checks were passed return [ - 'user' => 1, - 'issuer' => 2, - 'issued' => 246, - 'expires' => time(), - 'reason' => 'meow' + + 'user' => $ban['uid'], + 'issuer' => $ban['mod_id'], + 'issued' => $ban['ban_begin'], + 'expires' => $ban['ban_end'], + 'reason' => $ban['ban_reason'] + ]; + } + // Else just return false + return false; + } } diff --git a/_sakura/sakura.php b/_sakura/sakura.php index f2a003f..d6a164a 100644 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -8,7 +8,7 @@ namespace Sakura; // Define Sakura version -define('SAKURA_VERSION', '20150728'); +define('SAKURA_VERSION', '20150730'); define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_STABLE', false); define('SAKURA_COLOUR', '#6C3082'); @@ -136,7 +136,7 @@ if(!defined('SAKURA_NO_TPL')) { ] ]); - //Users::logout(); + Users::logout(); print Templates::render('errors/banned.tpl', $renderData); exit; diff --git a/_sakura/templates/yuuno/elements/newsPost.tpl b/_sakura/templates/yuuno/elements/newsPost.tpl index 06899f1..809bbd2 100644 --- a/_sakura/templates/yuuno/elements/newsPost.tpl +++ b/_sakura/templates/yuuno/elements/newsPost.tpl @@ -12,5 +12,5 @@
- Posted on {{ newsPost.date|date("D Y-m-d H:i:s T") }}{% if newsPosts|length > 1 %} View comments{% endif %} + Posted on {{ newsPost.date|date(sakura.date_format) }}{% if newsPosts|length > 1 %} View comments{% endif %}
diff --git a/_sakura/templates/yuuno/errors/banned.tpl b/_sakura/templates/yuuno/errors/banned.tpl index ce8de41..f0985c1 100644 --- a/_sakura/templates/yuuno/errors/banned.tpl +++ b/_sakura/templates/yuuno/errors/banned.tpl @@ -3,15 +3,19 @@

You are banned!

+ {% if ban.reason %}

The following reason was supplied:

- {{ ban.reason }} + {{ ban.reason|raw }}

+ {% else %} +

No reason was supplied.

+ {% endif %}

Additional information

  • You were banned on {{ ban.issued|date(sakura.date_format) }}.
  • -
  • {% if ban.expires %}This ban expires on {{ ban.expire|date(sakura.date_format) }}.{% else %}You are permanently banned.{% endif %}
  • +
  • {% if ban.expires %}This ban expires on {{ ban.expires|date(sakura.date_format) }}.{% else %}You are permanently banned.{% endif %}
  • {% if ban.expires %}
  • You were banned by {{ ban.issuer.username }}.
  • {% endif %} diff --git a/_sakura/templates/yuuno/errors/premiumComplete.tpl b/_sakura/templates/yuuno/errors/premiumComplete.tpl index 607c71e..4c65164 100644 --- a/_sakura/templates/yuuno/errors/premiumComplete.tpl +++ b/_sakura/templates/yuuno/errors/premiumComplete.tpl @@ -2,6 +2,6 @@

    Thank you for your contribution!

    -

    Your Tenshi will expire on {{ page.expiration|date("l \\t\\h\\e jS \\o\\f F o") }}.

    +

    Your Tenshi will expire on {{ page.expiration|date(sakura.date_format) }}.

    {% include 'global/footer.tpl' %} diff --git a/_sakura/templates/yuuno/forum/topicEntry.tpl b/_sakura/templates/yuuno/forum/topicEntry.tpl index f2a86ac..944b891 100644 --- a/_sakura/templates/yuuno/forum/topicEntry.tpl +++ b/_sakura/templates/yuuno/forum/topicEntry.tpl @@ -22,6 +22,6 @@ {% else %} [deleted user] {% endif %}
    - {{ topic.last_poster.elap }} + {{ topic.last_poster.elap }} diff --git a/_sakura/templates/yuuno/forum/viewtopic.tpl b/_sakura/templates/yuuno/forum/viewtopic.tpl index 4881c5d..5b935ae 100644 --- a/_sakura/templates/yuuno/forum/viewtopic.tpl +++ b/_sakura/templates/yuuno/forum/viewtopic.tpl @@ -35,7 +35,7 @@ {{ post.post_subject }}
diff --git a/_sakura/templates/yuuno/main/credits.tpl b/_sakura/templates/yuuno/main/credits.tpl index a120e91..2871acf 100644 --- a/_sakura/templates/yuuno/main/credits.tpl +++ b/_sakura/templates/yuuno/main/credits.tpl @@ -1,7 +1,7 @@ {% include 'global/header.tpl' %}

Credits

-

This is the Flashii Sakura contributor list.

+

This is the Sakura contributor list.

People

diff --git a/_sakura/templates/yuuno/main/memberlist.tpl b/_sakura/templates/yuuno/main/memberlist.tpl index 9dac97e..6b76c56 100644 --- a/_sakura/templates/yuuno/main/memberlist.tpl +++ b/_sakura/templates/yuuno/main/memberlist.tpl @@ -54,10 +54,10 @@ {{ user.username }} - + {% endfor %} diff --git a/_sakura/templates/yuuno/main/profile.tpl b/_sakura/templates/yuuno/main/profile.tpl index 17919e4..29d05cc 100644 --- a/_sakura/templates/yuuno/main/profile.tpl +++ b/_sakura/templates/yuuno/main/profile.tpl @@ -32,11 +32,11 @@ {% endif %}
- Joined {{ profile.user.regdate|date("l Y-m-d H:i T") }}
+ Joined {{ profile.user.regdate|date(sakura.date_format) }}
{% if profile.user.lastdate == 0 %} {{ profile.user.username }} hasn't logged in yet. {% else %} - Last Seen on {{ profile.user.lastdate|date("l Y-m-d H:i T") }} + Last Seen on {{ profile.user.lastdate|date(sakura.date_format) }} {% endif %}
{{ profile.user.username }} has {% if not profile.forum_stats.posts %}no{% else %}{{ profile.forum_stats.posts }}{% endif %} forum post{% if profile.forum_stats.posts != 1 %}s{% endif %}. {% if profile.fields is not null %} diff --git a/_sakura/templates/yuuno/main/search.tpl b/_sakura/templates/yuuno/main/search.tpl index a94b5c3..a33e579 100644 --- a/_sakura/templates/yuuno/main/search.tpl +++ b/_sakura/templates/yuuno/main/search.tpl @@ -1,5 +1,5 @@ {% include 'global/header.tpl' %} -
+
Search
- {{ user.regdate|date("l Y-m-d H:i T") }} + {{ user.regdate|date(sakura.date_format) }} - {% if user.lastdate == 0 %}Never logged in.{% else %}{{ user.lastdate|date("l Y-m-d H:i T") }}{% endif %} + {% if user.lastdate == 0 %}Never logged in.{% else %}{{ user.lastdate|date(sakura.date_format) }}{% endif %} {% if not user.usertitle %}{{ page.ranks[user.rank_main].title }}{% else %}{{ user.usertitle }}{% endif %} diff --git a/_sakura/templates/yuuno/main/messages.tpl b/_sakura/templates/yuuno/main/messages.tpl index a3de6c3..b243222 100644 --- a/_sakura/templates/yuuno/main/messages.tpl +++ b/_sakura/templates/yuuno/main/messages.tpl @@ -21,7 +21,7 @@
{{ message.data.from.user.username }} {{ message.subject }}{{ message.time|date("l Y-m-d H:i T") }}{{ message.time|date(sakura.date_format) }}