diff --git a/_sakura/changelog.json b/_sakura/changelog.json index 6648efb..8787f9a 100644 --- a/_sakura/changelog.json +++ b/_sakura/changelog.json @@ -59,7 +59,8 @@ "20150903", "20150904", "20150905", - "20150906" + "20150906", + "20150907" ] @@ -2548,6 +2549,46 @@ "user": "Flashwave" } + ], + + "20150907": [ + + { + "type": "FIX", + "change": "Fixed cookie notification reappearing after accepting.", + "user": "Flashwave" + }, + { + "type": "FIX", + "change": "Fixed infopage templates not using the new blocks method.", + "user": "Flashwave" + }, + { + "type": "UPD", + "change": "Removed the _developer_data folder, split the SQL structure and data up into two files respectively and moved the Sock Chat auth script to a new directory.", + "user": "Flashwave" + }, + { + "type": "UPD", + "change": "Updated the CloudFlare IPs list.", + "user": "Flashwave" + }, + { + "type": "FIX", + "change": "Fixed newline causing an error in CloudFlare check.", + "user": "Flashwave" + }, + { + "type": "UPD", + "change": "Moved document title setting to templates instead of in the PHP file.", + "user": "Flashwave" + }, + { + "type": "FIX", + "change": "Restyle explosive notifications and make them not explosive.", + "user": "Flashwave" + } + ] } diff --git a/_sakura/components/Main.php b/_sakura/components/Main.php index 71e164e..823b4dc 100644 --- a/_sakura/components/Main.php +++ b/_sakura/components/Main.php @@ -522,6 +522,13 @@ $errorPage .= ' // Check if IP is in a CloudFlare subnet foreach($cfhosts as $subnet) { + // Check if the subnet isn't empty (git newline prevention) + if(strlen($subnet) < 1) { + + continue; + + } + // Return true if found if(self::matchSubnet($ip, $subnet)) { diff --git a/_sakura/config/cloudflare.ipv4 b/_sakura/config/cloudflare.ipv4 index 12fa8bb..081a71e 100644 --- a/_sakura/config/cloudflare.ipv4 +++ b/_sakura/config/cloudflare.ipv4 @@ -1,14 +1,14 @@ -199.27.128.0/21 -173.245.48.0/20 103.21.244.0/22 103.22.200.0/22 103.31.4.0/22 -141.101.64.0/18 +104.16.0.0/12 108.162.192.0/18 -190.93.240.0/20 +141.101.64.0/18 +162.158.0.0/15 +172.64.0.0/13 +173.245.48.0/20 188.114.96.0/20 +190.93.240.0/20 197.234.240.0/22 198.41.128.0/17 -162.158.0.0/15 -104.16.0.0/12 -172.64.0.0/13 \ No newline at end of file +199.27.128.0/21 diff --git a/_sakura/config/cloudflare.ipv6 b/_sakura/config/cloudflare.ipv6 index b23db83..aa98c77 100644 --- a/_sakura/config/cloudflare.ipv6 +++ b/_sakura/config/cloudflare.ipv6 @@ -1,5 +1,5 @@ 2400:cb00::/32 +2405:8100::/32 +2405:b500::/32 2606:4700::/32 2803:f800::/32 -2405:b500::/32 -2405:8100::/32 \ No newline at end of file diff --git a/_sakura/sakura.php b/_sakura/sakura.php index ae8ffa3..b822dc7 100644 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -8,7 +8,7 @@ namespace Sakura; // Define Sakura version -define('SAKURA_VERSION', '20150906'); +define('SAKURA_VERSION', '20150907'); define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_COLOUR', '#6C3082'); define('SAKURA_STABLE', false); @@ -173,15 +173,14 @@ if(!defined('SAKURA_NO_TPL')) { // Additional render data $renderData = array_merge($renderData, [ + 'ban' => [ 'reason' => $ban['reason'], 'issued' => $ban['issued'], 'expires' => $ban['expires'], 'issuer' => Users::getUser($ban['issuer']) - ], - 'page' => [ - 'title' => 'You are banned!' ] + ]); Users::logout(); diff --git a/_sakura/templates/yuuno/elements/restricted.tpl b/_sakura/templates/yuuno/elements/restricted.tpl deleted file mode 100644 index e69de29..0000000 diff --git a/_sakura/templates/yuuno/forum/index.tpl b/_sakura/templates/yuuno/forum/index.tpl index 62d272b..a7a3700 100644 --- a/_sakura/templates/yuuno/forum/index.tpl +++ b/_sakura/templates/yuuno/forum/index.tpl @@ -1,5 +1,7 @@ {% extends 'global/master.tpl' %} +{% block title %}Forum Listing{% endblock %} + {% block content %}
diff --git a/_sakura/templates/yuuno/forum/posting.tpl b/_sakura/templates/yuuno/forum/posting.tpl index 0c3e784..b8665ec 100644 --- a/_sakura/templates/yuuno/forum/posting.tpl +++ b/_sakura/templates/yuuno/forum/posting.tpl @@ -1,5 +1,7 @@ {% extends 'global/master.tpl' %} +{% block title %}Posting{% endblock %} + {% block content %}
diff --git a/_sakura/templates/yuuno/forum/viewforum.tpl b/_sakura/templates/yuuno/forum/viewforum.tpl index 40799e9..92ac921 100644 --- a/_sakura/templates/yuuno/forum/viewforum.tpl +++ b/_sakura/templates/yuuno/forum/viewforum.tpl @@ -1,5 +1,7 @@ {% extends 'global/master.tpl' %} +{% block title %}Forums / {{ board.forums[0].forum.forum_name }}{% endblock %} + {% block content %}
diff --git a/_sakura/templates/yuuno/forum/viewtopic.tpl b/_sakura/templates/yuuno/forum/viewtopic.tpl index 4f0d7a2..e4cecdd 100644 --- a/_sakura/templates/yuuno/forum/viewtopic.tpl +++ b/_sakura/templates/yuuno/forum/viewtopic.tpl @@ -1,5 +1,7 @@ {% extends 'global/master.tpl' %} +{% block title %}{{ topic.topic_title }}{% endblock %} + {% block content %}
diff --git a/_sakura/templates/yuuno/global/information.tpl b/_sakura/templates/yuuno/global/information.tpl index ac462b8..40d720d 100644 --- a/_sakura/templates/yuuno/global/information.tpl +++ b/_sakura/templates/yuuno/global/information.tpl @@ -1,5 +1,7 @@ {% extends 'global/master.tpl' %} +{% block title %}Information{% endblock %} + {% block content %}
diff --git a/_sakura/templates/yuuno/global/master.tpl b/_sakura/templates/yuuno/global/master.tpl index 52c356b..ed3e107 100644 --- a/_sakura/templates/yuuno/global/master.tpl +++ b/_sakura/templates/yuuno/global/master.tpl @@ -3,7 +3,7 @@ - {{ page.title }} + {% block title %}{{ sakura.siteName }}{% endblock %} @@ -11,7 +11,7 @@ {% if page.redirect %} - + {% endif %} @@ -157,7 +157,7 @@ "title": sakuraVars.siteName + " uses cookies!", "text": "Click this if you're OK with that and want to hide this message.", "img": "FONT:fa-asterisk", - "link": "javascript:cookieData('set', '"+ sakuraVars.cookie.prefix +"accept_cookies', 'true');notifyClose(this.parentNode.id);" + "link": "javascript:cookieData('set', '"+ sakuraVars.cookie.prefix +"accept_cookies', 'true; expires="+ (new Date(2147483647000)).toUTCString() +"');notifyClose(this.parentNode.id);" }); } diff --git a/_sakura/templates/yuuno/global/restricted.tpl b/_sakura/templates/yuuno/global/restricted.tpl index 1724a26..b01da5e 100644 --- a/_sakura/templates/yuuno/global/restricted.tpl +++ b/_sakura/templates/yuuno/global/restricted.tpl @@ -1,5 +1,7 @@ {% extends 'global/master.tpl' %} +{% block title %}Restricted{% endblock %} + {% block content %}
diff --git a/_sakura/templates/yuuno/main/authenticate.tpl b/_sakura/templates/yuuno/main/authenticate.tpl index 400dc88..5836bd9 100644 --- a/_sakura/templates/yuuno/main/authenticate.tpl +++ b/_sakura/templates/yuuno/main/authenticate.tpl @@ -1,5 +1,7 @@ {% extends 'global/master.tpl' %} +{% block title %}Authentication{% endblock %} + {% block content %} {% if sakura.lockAuth %}

Authentication is currently disallowed, try again later.

diff --git a/_sakura/templates/yuuno/main/banned.tpl b/_sakura/templates/yuuno/main/banned.tpl index b6ec147..7e63715 100644 --- a/_sakura/templates/yuuno/main/banned.tpl +++ b/_sakura/templates/yuuno/main/banned.tpl @@ -1,5 +1,7 @@ {% extends 'global/master.tpl' %} +{% block title %}You are banned!{% endblock %} + {% block content %}
diff --git a/_sakura/templates/yuuno/main/faq.tpl b/_sakura/templates/yuuno/main/faq.tpl index c20cb00..c4df39f 100644 --- a/_sakura/templates/yuuno/main/faq.tpl +++ b/_sakura/templates/yuuno/main/faq.tpl @@ -1,5 +1,7 @@ {% extends 'global/master.tpl' %} +{% block title %}Frequently Asked Questions{% endblock %} + {% block content %}
diff --git a/_sakura/templates/yuuno/main/forgotpassword.tpl b/_sakura/templates/yuuno/main/forgotpassword.tpl index d4f5620..0910638 100644 --- a/_sakura/templates/yuuno/main/forgotpassword.tpl +++ b/_sakura/templates/yuuno/main/forgotpassword.tpl @@ -1,5 +1,7 @@ {% extends 'global/master.tpl' %} +{% block title %}Forgot Password{% endblock %} + {% block content %}
Forgot Password
diff --git a/_sakura/templates/yuuno/main/infopage.tpl b/_sakura/templates/yuuno/main/infopage.tpl index c401a3e..80bc478 100644 --- a/_sakura/templates/yuuno/main/infopage.tpl +++ b/_sakura/templates/yuuno/main/infopage.tpl @@ -1,7 +1,11 @@ -{% include 'global/header.tpl' %} +{% extends 'global/master.tpl' %} + +{% block title %}{% if page.title %}{{ page.title }}{% else %}Not found!{% endif %}{% endblock %} + +{% block content %}
{{ page.content|raw }}
-{% include 'global/footer.tpl' %} +{% endblock %} diff --git a/_sakura/templates/yuuno/main/memberlist.tpl b/_sakura/templates/yuuno/main/memberlist.tpl index 4fd42f5..7228f18 100644 --- a/_sakura/templates/yuuno/main/memberlist.tpl +++ b/_sakura/templates/yuuno/main/memberlist.tpl @@ -1,10 +1,19 @@ {% extends 'global/master.tpl' %} +{% set rankTitle %} +{% if page.notfound %}Not found{% else %}{% if not page.active %}All members{% else %}{{ page.ranks[page.active].name }}{% if page.ranks[page.active].multi %}s{% endif %}{% endif %}{% endif %} +{% endset %} + +{% set rankDescription %} +{% if page.notfound %}The requested rank could not be found!{% else %}{% if not page.active %}The entire user list.{% else %}{{ page.ranks[page.active].description }}{% endif %}{% endif %} +{% endset %} + +{% block title %}{{ rankTitle }}{% endblock %} + {% block content %} - {% if session.checkLogin %} -
-

{% if not page.active %}All members{% else %}{{ page.ranks[page.active].name }}{% if page.ranks[page.active].multi %}s{% endif %}{% endif %}

-

{% if not page.active %}The entire user list.{% else %}{{ page.ranks[page.active].description }}{% endif %}

+
+

{{ rankTitle }}

+

{{ rankDescription }}

- {% if page.notfound %} -

The requested rank was not found!

- {% else %} -
- {% if page.sort == page.sorts[2] %} - - - - - - - - - - - - - - - - - - - - - - {% for count,user in page.users[page.page] %} - - - - - - - - - - - {% endfor %} -
No.UsernameRegisteredLast onlineUser titleCountry
No.UsernameRegisteredLast onlineUser titleCountry
- #{{ page.active ? count + 1 : count }} - - {{ user.username }} - - {{ user.regdate|date(sakura.dateFormat) }} - - {% if user.lastdate == 0 %}Never logged in.{% else %}{{ user.lastdate|date(sakura.dateFormat) }}{% endif %} - - {% if not user.usertitle %}{{ page.ranks[user.rank_main].title }}{% else %}{{ user.usertitle }}{% endif %} - - {% if user.country|lower == 'eu' %}?{% else %}{{ user.country }}{% endif %} -
- {% else %} - {% for user in page.users[page.page] %} - {# These comment tags are here to prevent the link extending too far - #}
{# - #}{{ user.username }}{# - #}{# - #}{{ user.username }}{# - #}{# - #}
{# - #}
- {% endfor %} - {% endif %} -
+ {% if not page.users|length %} +

This rank has no members!

+ {% elseif not page.notfound %} +
+ {% if page.sort == page.sorts[2] %} + + + + + + + + + + + + + + + + + + + + + + {% for count,user in page.users[page.page] %} + + + + + + + + + + + {% endfor %} +
No.UsernameRegisteredLast onlineUser titleCountry
No.UsernameRegisteredLast onlineUser titleCountry
+ #{{ page.active ? count + 1 : count }} + + {{ user.username }} + + {{ user.regdate|date(sakura.dateFormat) }} + + {% if user.lastdate == 0 %}Never logged in.{% else %}{{ user.lastdate|date(sakura.dateFormat) }}{% endif %} + + {% if not user.usertitle %}{{ page.ranks[user.rank_main].title }}{% else %}{{ user.usertitle }}{% endif %} + + {% if user.country|lower == 'eu' %}?{% else %}{{ user.country }}{% endif %} +
+ {% else %} + {% for user in page.users[page.page] %} + {# These comment tags are here to prevent the link extending too far + #}
{# + #}{{ user.username }}{# + #}{# + #}{{ user.username }}{# + #}{# + #}
{# + #}
+ {% endfor %} + {% endif %} +
{% endif %} {% if page.users|length > 1 %} - + {% endif %}
- {% else %} - {% include 'elements/restricted.tpl' %} - {% endif %} {% endblock %} diff --git a/_sakura/templates/yuuno/main/news.tpl b/_sakura/templates/yuuno/main/news.tpl index cc3a348..4d1f5c8 100644 --- a/_sakura/templates/yuuno/main/news.tpl +++ b/_sakura/templates/yuuno/main/news.tpl @@ -1,5 +1,7 @@ {% extends 'global/master.tpl' %} +{% block title %}{% if page.view_post %}{{ newsPosts[0].title }}{% elseif newsPosts|length < 1 %}Post does not exist!{% else %}News{% endif %}{% endblock %} + {% block content %}
diff --git a/_sakura/templates/yuuno/main/premiumcomplete.tpl b/_sakura/templates/yuuno/main/premiumcomplete.tpl index c857cee..a83ecc3 100644 --- a/_sakura/templates/yuuno/main/premiumcomplete.tpl +++ b/_sakura/templates/yuuno/main/premiumcomplete.tpl @@ -1,5 +1,7 @@ {% extends 'global/master.tpl' %} +{% block title %}Purchase complete!{% endblock %} + {% block content %}

Thank you for your contribution!

diff --git a/_sakura/templates/yuuno/main/search.tpl b/_sakura/templates/yuuno/main/search.tpl index 03361b5..50e37ab 100644 --- a/_sakura/templates/yuuno/main/search.tpl +++ b/_sakura/templates/yuuno/main/search.tpl @@ -1,5 +1,7 @@ {% extends 'global/master.tpl' %} +{% block title %}Search{% endblock %} + {% block content %}
diff --git a/_sakura/templates/yuuno/main/settings.tpl b/_sakura/templates/yuuno/main/settings.tpl index 3cffde6..6eaffc7 100644 --- a/_sakura/templates/yuuno/main/settings.tpl +++ b/_sakura/templates/yuuno/main/settings.tpl @@ -1,5 +1,7 @@ {% extends 'global/master.tpl' %} +{% block title %}{{ page.category }} / {{ page.mode }}{% endblock %} + {% block content %}
@@ -7,7 +9,7 @@
- {{ page.title }} + {{ page.category }} / {{ page.mode }}
{% for descline in page.description %} diff --git a/_sakura/templates/yuuno/main/support.tpl b/_sakura/templates/yuuno/main/support.tpl index e32c60a..4f8770a 100644 --- a/_sakura/templates/yuuno/main/support.tpl +++ b/_sakura/templates/yuuno/main/support.tpl @@ -1,5 +1,7 @@ {% extends 'global/master.tpl' %} +{% block title %}Support {{ sakura.siteName }}{% endblock %} + {% block content %} {% if page.fail %}
diff --git a/_sakura/templates/yuuno/main/supporttracker.tpl b/_sakura/templates/yuuno/main/supporttracker.tpl index 24ef559..02ae8ed 100644 --- a/_sakura/templates/yuuno/main/supporttracker.tpl +++ b/_sakura/templates/yuuno/main/supporttracker.tpl @@ -1,5 +1,7 @@ {% extends 'global/master.tpl' %} +{% block title %}Donation Tracker{% endblock %} + {% block content %}
Donation Tracker
diff --git a/_sakura/templates/yuuno/profile/index.tpl b/_sakura/templates/yuuno/profile/index.tpl index 9ce7cbc..a694b9e 100644 --- a/_sakura/templates/yuuno/profile/index.tpl +++ b/_sakura/templates/yuuno/profile/index.tpl @@ -1,7 +1,11 @@ {% extends 'global/master.tpl' %} +{% set profileHidden = profile.checkPermission('SITE', 'DEACTIVATED') or profile.data.password_algo == 'nologin' or (profile.checkPermission('SITE', 'RESTRICTED') and (user.data.id != profile.data.id and not user.checkPermission('MANAGE', 'USE_MANAGE'))) %} + +{% block title %}{% if profileHidden %}User not found!{% else %}Profile of {{ profile.data.username }}{% endif %}{% endblock %} + {% block content %} - {% if profile.checkPermission('SITE', 'DEACTIVATED') or profile.data.password_algo == 'nologin' or (profile.checkPermission('SITE', 'RESTRICTED') and (user.data.id != profile.data.id and not user.checkPermission('MANAGE', 'USE_MANAGE'))) %} + {% if profileHidden %}

The requested user does not exist!

There are a few possible reasons for this: diff --git a/database/data.sql b/database/data.sql new file mode 100644 index 0000000..78b04b3 --- /dev/null +++ b/database/data.sql @@ -0,0 +1,182 @@ +-- Adminer 4.2.2 MySQL dump + +SET NAMES utf8; +SET time_zone = '+00:00'; +SET foreign_key_checks = 0; +SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; + +USE `sakura-development`; + +TRUNCATE `sakura_bbcodes`; +INSERT INTO `sakura_bbcodes` (`id`, `regex`, `replace`, `title`, `description`, `on_posting`) VALUES +(1, '/\\[b\\](.*?)\\[\\/b\\]/is', '$1', 'Bold', 'Make text bold. Usage: [b]text[/b].', 1), +(2, '/\\[i\\](.*?)\\[\\/i\\]/is', '$1', 'Italics', 'Make text italic. Usage: [i]text[/i].', 1), +(3, '/\\[u\\](.*?)\\[\\/u\\]/is', '$1', 'Underline', 'Make text underlined. Usage: [u]text[/u].', 1), +(4, '/\\[s\\](.*?)\\[\\/s\\]/is', '$1', 'Strikethrough', 'Put a line through text. Usage: [s]text[/s].', 1), +(5, '/\\[img\\]([a-zA-Z0-9\\.\\$\\-\\_\\.\\+\\*\\!\\\'\\(\\)\\/\\:\\#]+)\\[\\/img\\]/is', '\"Image\"', 'Image', 'Embed an image. Usage: [img]url[/img]', 1), +(6, '/\\[url=([a-zA-Z0-9\\.\\$\\-\\_\\.\\+\\*\\!\\\'\\(\\)\\/\\:\\#]+)\\](.*?)\\[\\/url\\]/is', '$2', 'Link', 'Embed a URL. Usage: [url=http://google.com]Link to google![/url]', 0), +(7, '/\\[url\\]([a-zA-Z0-9\\.\\$\\-\\_\\.\\+\\*\\!\\\'\\(\\)\\/\\:\\#]+)\\[\\/url\\]/is', '$1', 'Link', 'Make a link clickable (if the automatic algorithm doesn\'t do it already). Usage: [url]http://google.com[/url]', 1), +(8, '/\\[quote\\=\\\"(.+)\\\"\\](.+)\\[\\/quote]/is', '
$1 wrote:
$2
', 'Quote', 'Quote a user\'s post. Usage: [quote=Flashwave]nookls is pretty[/quote]', 0), +(9, '/\\[quote\\](.+)\\[\\/quote]/is', '
Quote:
$1
', 'Quote', 'Quote a user\'s post. Usage: [quote]nookls is pretty[/quote]', 1); + +TRUNCATE `sakura_config`; +INSERT INTO `sakura_config` (`config_name`, `config_value`) VALUES +('recaptcha_public', ''), +('recaptcha_private', ''), +('charset', 'utf-8'), +('cookie_prefix', 'sakura_'), +('cookie_domain', 'sakura.dev'), +('cookie_path', '/'), +('site_style', 'yuuno'), +('manage_style', 'broomcloset'), +('smtp_server', ''), +('smtp_auth', ''), +('smtp_secure', ''), +('smtp_port', ''), +('smtp_username', ''), +('smtp_password', ''), +('smtp_replyto_mail', ''), +('smtp_replyto_name', ''), +('smtp_from_email', ''), +('smtp_from_name', ''), +('sitename', 'Sakura'), +('recaptcha', '0'), +('require_activation', '0'), +('require_registration_code', '0'), +('disable_registration', '0'), +('max_reg_keys', '5'), +('mail_signature', ''), +('lock_authentication', '0'), +('min_entropy', '1'), +('sitedesc', ''), +('sitetags', '[]'), +('username_min_length', '3'), +('username_max_length', '16'), +('lock_site', '0'), +('lock_site_reason', ''), +('use_gzip', '0'), +('enable_tpl_cache', '0'), +('paypal_client_id', ''), +('paypal_secret', ''), +('premium_price_per_month', '1.49'), +('premium_rank_id', '8'), +('premium_amount_max', '24'), +('alumni_rank_id', '9'), +('url_main', 'flashii.test'), +('front_page_news_posts', '3'), +('date_format', 'D Y-m-d H:i:s T'), +('news_posts_per_page', '3'), +('avatar_min_width', '20'), +('avatar_min_height', '20'), +('avatar_max_height', '512'), +('avatar_max_width', '512'), +('avatar_max_fsize', '2097152'), +('url_api', 'api.sakura.dev'), +('content_path', '/content'), +('user_uploads', 'uploads'), +('no_background_img', 'main/content/pixel.png'), +('no_header_img', 'main/content/images/triangles.png'), +('pixel_img', 'main/content/pixel.png'), +('background_max_fsize', '5242880'), +('background_max_width', '2560'), +('background_max_height', '1440'), +('background_min_height', '16'), +('background_min_width', '16'), +('max_online_time', '500'), +('no_avatar_img', 'main/content/data/{{ TPL }}/images/no-av.png'), +('deactivated_avatar_img', 'main/content/data/{{ TPL }}/images/deactivated-av.png'), +('banned_avatar_img', 'main/content/data/{{ TPL }}/images/banned-av.png'), +('session_check', '2'), +('url_rewrite', '1'), +('members_per_page', '30'), +('admin_email', ''); + +TRUNCATE `sakura_emoticons`; +INSERT INTO `sakura_emoticons` (`emote_string`, `emote_path`) VALUES +(':amu:', '/content/images/emoticons/amu.png'), +(':angrier:', '/content/images/emoticons/angrier.png'), +(':angriest:', '/content/images/emoticons/angriest.png'), +(':angry:', '/content/images/emoticons/angry.gif'), +(':blank:', '/content/images/emoticons/blank.png'), +(':childish:', '/content/images/emoticons/childish.png'), +(':congrats:', '/content/images/emoticons/congrats.png'), +(':crying:', '/content/images/emoticons/crying.gif'), +(':dizzy:', '/content/images/emoticons/dizzy.gif'), +(':eat:', '/content/images/emoticons/eat.gif'), +(':evil:', '/content/images/emoticons/evil.png'), +(':extreme:', '/content/images/emoticons/extreme.png'), +(':glare:', '/content/images/emoticons/glare.gif'), +(':happy:', '/content/images/emoticons/happy.gif'), +(':horror:', '/content/images/emoticons/horror.gif'), +(':huh:', '/content/images/emoticons/huh.png'), +(':idea:', '/content/images/emoticons/idea.png'), +(':jew:', '/content/images/emoticons/jew.png'), +(':kiss:', '/content/images/emoticons/kiss.gif'), +(':lmao:', '/content/images/emoticons/lmao.gif'), +(':lol:', '/content/images/emoticons/lol.gif'), +(':love:', '/content/images/emoticons/love.png'), +(':meow:', '/content/images/emoticons/meow.png'), +(':omg:', '/content/images/emoticons/omg.gif'), +(':ouch:', '/content/images/emoticons/ouch.gif'), +(':puke:', '/content/images/emoticons/puke.gif'), +(':ruse:', '/content/images/emoticons/ruse.png'), +(':sad:', '/content/images/emoticons/sad.png'), +(':sigh:', '/content/images/emoticons/sigh.gif'), +(':suspicious:', '/content/images/emoticons/suspicious.gif'), +(':sweat:', '/content/images/emoticons/sweat.gif'), +(':tired:', '/content/images/emoticons/tired.gif'), +(':yay:', '/content/images/emoticons/vhappy.gif'), +(':winxp:', '/content/images/emoticons/winxp.png'), +(':wtf:', '/content/images/emoticons/wtf.gif'), +(':sleep:', '/content/images/emoticons/zzz.gif'), +(':what:', '/content/images/emoticons/what.png'), +(':smug:', '/content/images/emoticons/smug.png'); + +TRUNCATE `sakura_optionfields`; +INSERT INTO `sakura_optionfields` (`id`, `name`, `description`, `formtype`, `require_perm`) VALUES +('disableProfileParallax', 'Disable Parallaxing', 'This will stop your background from responding to your mouse movement, this will only affect your background.', 'checkbox', 'CHANGE_BACKGROUND'), +('profileBackgroundSiteWide', 'Display profile background site wide', 'This will make the profile background you set on your profile appear on the entire site (except on other profiles).', 'checkbox', 'CREATE_BACKGROUND'), +('useMisaki', 'Use the testing style', 'This will make the site use the new Misaki style instead of Yuuno.', 'checkbox', 'ALTER_PROFILE'); + +TRUNCATE `sakura_permissions`; +INSERT INTO `sakura_permissions` (`rid`, `uid`, `siteperms`, `manageperms`, `forumperms`, `rankinherit`) VALUES +(1, 0, '0000000000000000000000000001', '00', '0', '000'), +(2, 0, '0000111111111100111101101100', '00', '1', '000'), +(3, 0, '0001111111111111111111111100', '11', '1', '000'), +(4, 0, '1111111111111111111111111100', '11', '1', '000'), +(5, 0, '0001111111111111111111111100', '11', '1', '000'), +(6, 0, '0000111111111100111101101100', '00', '0', '000'), +(7, 0, '0001111111111111111111111100', '01', '1', '000'), +(8, 0, '0001111111111111111111111100', '00', '1', '000'), +(9, 0, '0001111111111111111111111100', '00', '1', '000'), +(10, 0, '0000000011010100101000100010', '00', '0', '000'); + +TRUNCATE `sakura_profilefields`; +INSERT INTO `sakura_profilefields` (`id`, `name`, `formtype`, `islink`, `linkformat`, `description`, `additional`) VALUES +(1, 'Website', 'url', 1, '{{ VAL }}', 'URL to your website', ''), +(2, 'Twitter', 'text', 1, 'https://twitter.com/{{ VAL }}', 'Your @twitter Username', ''), +(3, 'BitBucket', 'text', 1, 'https://bitbucket.org/{{ VAL }}', 'Your BitBucket Username', ''), +(4, 'Skype', 'text', 1, 'skype:{{ VAL }}?userinfo', 'Your Skype Username', ''), +(5, 'YouTube', 'text', 0, '', 'ID or Username excluding http://youtube.com/*/', '{\"youtubetype\": [\"checkbox\", \"I do not have a Channel Username (url looks like https://www.youtube.com/channel/UCXZcw5hw5C7Neto-T_nRXBQ).\"]}'), +(6, 'SoundCloud', 'text', 1, 'https://soundcloud.com/{{ VAL }}', 'Your SoundCloud username', ''), +(7, 'Steam', 'text', 1, 'https://steamcommunity.com/id/{{ VAL }}', 'Your Steam Community Username (may differ from login username)', ''), +(8, 'osu!', 'text', 1, 'https://osu.ppy.sh/u/{{ VAL }}', 'Your osu! Username', ''), +(9, 'Origin', 'text', 0, '', 'Your Origin User ID', ''), +(10, 'Xbox Live', 'text', 1, 'https://account.xbox.com/en-GB/Profile?Gamertag={{ VAL }}', 'Your Xbox User ID', ''), +(11, 'PSN', 'text', 1, 'http://psnprofiles.com/{{ VAL }}', 'Your PSN User ID', ''), +(12, 'Last.fm', 'text', 1, 'http://last.fm/user/{{ VAL }}', 'Your Last.fm username', ''); + +TRUNCATE `sakura_ranks`; +INSERT INTO `sakura_ranks` (`id`, `name`, `multi`, `hidden`, `colour`, `description`, `title`) VALUES +(1, 'Deactivated', 0, 1, '#555', 'Users that are yet to be activated or that deactivated their own account.', 'Deactivated'), +(2, 'Regular user', 1, 0, 'inherit', 'Regular users with regular permissions.', 'Regular user'), +(3, 'Site moderator', 1, 0, '#0A0', 'Users with special permissions like being able to ban and modify users if needed.', 'Staff'), +(4, 'Administrator', 1, 0, '#C00', 'Users that manage the server and everything around that.', 'Administrator'), +(5, 'Developer', 1, 0, '#824CA0', 'Users that either create or test new features of the site.', 'Staff'), +(6, 'Bot', 1, 1, '#9E8DA7', 'Reserved user accounts for services.', 'Bot'), +(7, 'Chat moderator', 1, 0, '#09F', 'Moderators of the chat room.', 'Staff'), +(8, 'Tenshi', 0, 0, '#EE9400', 'Users that bought premium to help us keep the site and its services alive!', 'Tenshi'), +(9, 'Alumnii', 0, 0, '#FF69B4', 'People who have contributed to the community but have moved on or resigned.', 'Alumnii'), +(10, 'Restricted', 0, 1, '#333', 'Users that are restricted.', 'Restricted'); + +-- 2015-09-06 14:19:12 diff --git a/_developer_data/structure.sql b/database/structure.sql similarity index 66% rename from _developer_data/structure.sql rename to database/structure.sql index 46d77f5..b46a441 100644 --- a/_developer_data/structure.sql +++ b/database/structure.sql @@ -1,10 +1,10 @@ --- Adminer 4.2.1 MySQL dump +-- Adminer 4.2.2 MySQL dump SET NAMES utf8; SET time_zone = '+00:00'; -SET foreign_key_checks = 0; -SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; +DROP DATABASE IF EXISTS `sakura-development`; +CREATE DATABASE `sakura-development` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin */; USE `sakura-development`; DROP TABLE IF EXISTS `sakura_actioncodes`; @@ -15,7 +15,7 @@ CREATE TABLE `sakura_actioncodes` ( `actkey` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'The URL key for using this code.', `instruction` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Things the backend should do upon using this code', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; DROP TABLE IF EXISTS `sakura_apikeys`; @@ -52,18 +52,8 @@ CREATE TABLE `sakura_bbcodes` ( `description` varchar(512) COLLATE utf8_bin NOT NULL COMMENT 'Description of what this does.', `on_posting` tinyint(1) unsigned NOT NULL COMMENT 'Set if this bbcode is displayed on the posting page.', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -INSERT INTO `sakura_bbcodes` (`id`, `regex`, `replace`, `title`, `description`, `on_posting`) VALUES -(1, '/\\[b\\](.*?)\\[\\/b\\]/is', '$1', 'Bold', 'Make text bold. Usage: [b]text[/b].', 1), -(2, '/\\[i\\](.*?)\\[\\/i\\]/is', '$1', 'Italics', 'Make text italic. Usage: [i]text[/i].', 1), -(3, '/\\[u\\](.*?)\\[\\/u\\]/is', '$1', 'Underline', 'Make text underlined. Usage: [u]text[/u].', 1), -(4, '/\\[s\\](.*?)\\[\\/s\\]/is', '$1', 'Strikethrough', 'Put a line through text. Usage: [s]text[/s].', 1), -(5, '/\\[img\\]([a-zA-Z0-9\\.\\$\\-\\_\\.\\+\\*\\!\\\'\\(\\)\\/\\:\\#]+)\\[\\/img\\]/is', '\"Image\"', 'Image', 'Embed an image. Usage: [img]url[/img]', 1), -(6, '/\\[url=([a-zA-Z0-9\\.\\$\\-\\_\\.\\+\\*\\!\\\'\\(\\)\\/\\:\\#]+)\\](.*?)\\[\\/url\\]/is', '$2', 'Link', 'Embed a URL. Usage: [url=http://google.com]Link to google![/url]', 0), -(7, '/\\[url\\]([a-zA-Z0-9\\.\\$\\-\\_\\.\\+\\*\\!\\\'\\(\\)\\/\\:\\#]+)\\[\\/url\\]/is', '$1', 'Link', 'Make a link clickable (if the automatic algorithm doesn\'t do it already). Usage: [url]http://google.com[/url]', 1), -(8, '/\\[quote\\=\\\"(.+)\\\"\\](.+)\\[\\/quote]/is', '
$1 wrote:
$2
', 'Quote', 'Quote a user\'s post. Usage: [quote=Flashwave]nookls is pretty[/quote]', 0), -(9, '/\\[quote\\](.+)\\[\\/quote]/is', '
Quote:
$1
', 'Quote', 'Quote a user\'s post. Usage: [quote]nookls is pretty[/quote]', 1); DROP TABLE IF EXISTS `sakura_config`; CREATE TABLE `sakura_config` ( @@ -71,75 +61,6 @@ CREATE TABLE `sakura_config` ( `config_value` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'The value, obviously.' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -INSERT INTO `sakura_config` (`config_name`, `config_value`) VALUES -('recaptcha_public', ''), -('recaptcha_private', ''), -('charset', 'utf-8'), -('cookie_prefix', 'fii_'), -('cookie_domain', 'flashii.test'), -('cookie_path', '/'), -('site_style', 'yuuno'), -('manage_style', 'broomcloset'), -('smtp_server', ''), -('smtp_auth', ''), -('smtp_secure', ''), -('smtp_port', ''), -('smtp_username', ''), -('smtp_password', ''), -('smtp_replyto_mail', 'admin@flashii.net'), -('smtp_replyto_name', 'Flashwave'), -('smtp_from_email', ''), -('smtp_from_name', 'Flashii Noreply'), -('sitename', 'Cutting Edgii'), -('recaptcha', '0'), -('require_activation', '0'), -('require_registration_code', '0'), -('disable_registration', '0'), -('max_reg_keys', '5'), -('mail_signature', 'Team Flashii'), -('lock_authentication', '0'), -('min_entropy', '1'), -('sitedesc', 'Live development environment for the script that powers Flashii.net called Sakura.'), -('sitetags', '[\"Flashii\",\"Media\",\"Flashwave\",\"Circle\",\"Zeniea\",\"MalwareUp\",\"Cybernetics\",\"Saibateku\",\"Community\",\"osu!\",\"osu\"]'), -('username_min_length', '3'), -('username_max_length', '16'), -('lock_site', '1'), -('lock_site_reason', 'meow'), -('use_gzip', '0'), -('enable_tpl_cache', '0'), -('paypal_client_id', ''), -('paypal_secret', ''), -('premium_price_per_month', '1.49'), -('premium_rank_id', '8'), -('premium_amount_max', '24'), -('alumni_rank_id', '9'), -('url_main', 'flashii.test'), -('front_page_news_posts', '3'), -('date_format', 'D Y-m-d H:i:s T'), -('news_posts_per_page', '3'), -('avatar_min_width', '20'), -('avatar_min_height', '20'), -('avatar_max_height', '512'), -('avatar_max_width', '512'), -('avatar_max_fsize', '2097152'), -('url_api', 'api.flashii.test'), -('content_path', '/content'), -('user_uploads', 'uploads'), -('no_background_img', 'main/content/pixel.png'), -('no_header_img', 'main/content/images/triangles.png'), -('pixel_img', 'main/content/pixel.png'), -('background_max_fsize', '5242880'), -('background_max_width', '2560'), -('background_max_height', '1440'), -('background_min_height', '16'), -('background_min_width', '16'), -('max_online_time', '500'), -('no_avatar_img', 'main/content/data/{{ TPL }}/images/no-av.png'), -('deactivated_avatar_img', 'main/content/data/{{ TPL }}/images/deactivated-av.png'), -('banned_avatar_img', 'main/content/data/{{ TPL }}/images/banned-av.png'), -('session_check', '2'), -('url_rewrite', '1'), -('members_per_page', '30'); DROP TABLE IF EXISTS `sakura_emoticons`; CREATE TABLE `sakura_emoticons` ( @@ -147,56 +68,16 @@ CREATE TABLE `sakura_emoticons` ( `emote_path` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Path to the image file relative to the content domain.' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -INSERT INTO `sakura_emoticons` (`emote_string`, `emote_path`) VALUES -(':amu:', '/content/images/emoticons/amu.png'), -(':angrier:', '/content/images/emoticons/angrier.png'), -(':angriest:', '/content/images/emoticons/angriest.png'), -(':angry:', '/content/images/emoticons/angry.gif'), -(':blank:', '/content/images/emoticons/blank.png'), -(':childish:', '/content/images/emoticons/childish.png'), -(':congrats:', '/content/images/emoticons/congrats.png'), -(':crying:', '/content/images/emoticons/crying.gif'), -(':dizzy:', '/content/images/emoticons/dizzy.gif'), -(':eat:', '/content/images/emoticons/eat.gif'), -(':evil:', '/content/images/emoticons/evil.png'), -(':extreme:', '/content/images/emoticons/extreme.png'), -(':glare:', '/content/images/emoticons/glare.gif'), -(':happy:', '/content/images/emoticons/happy.gif'), -(':horror:', '/content/images/emoticons/horror.gif'), -(':huh:', '/content/images/emoticons/huh.png'), -(':idea:', '/content/images/emoticons/idea.png'), -(':jew:', '/content/images/emoticons/jew.png'), -(':kiss:', '/content/images/emoticons/kiss.gif'), -(':lmao:', '/content/images/emoticons/lmao.gif'), -(':lol:', '/content/images/emoticons/lol.gif'), -(':love:', '/content/images/emoticons/love.png'), -(':meow:', '/content/images/emoticons/meow.png'), -(':omg:', '/content/images/emoticons/omg.gif'), -(':ouch:', '/content/images/emoticons/ouch.gif'), -(':puke:', '/content/images/emoticons/puke.gif'), -(':ruse:', '/content/images/emoticons/ruse.png'), -(':sad:', '/content/images/emoticons/sad.png'), -(':sigh:', '/content/images/emoticons/sigh.gif'), -(':suspicious:', '/content/images/emoticons/suspicious.gif'), -(':sweat:', '/content/images/emoticons/sweat.gif'), -(':tired:', '/content/images/emoticons/tired.gif'), -(':yay:', '/content/images/emoticons/vhappy.gif'), -(':winxp:', '/content/images/emoticons/winxp.png'), -(':wtf:', '/content/images/emoticons/wtf.gif'), -(':sleep:', '/content/images/emoticons/zzz.gif'), -(':what:', '/content/images/emoticons/what.png'), -(':smug:', '/content/images/emoticons/smug.png'); - DROP TABLE IF EXISTS `sakura_error_log`; CREATE TABLE `sakura_error_log` ( - `id` varchar(32) COLLATE utf8_bin NOT NULL, - `timestamp` varchar(128) COLLATE utf8_bin NOT NULL, - `error_type` int(16) unsigned NOT NULL, - `error_line` int(32) unsigned NOT NULL, - `error_string` varchar(512) COLLATE utf8_bin NOT NULL, - `error_file` varchar(512) COLLATE utf8_bin NOT NULL, - `backtrace` text COLLATE utf8_bin NOT NULL + `id` varchar(32) COLLATE utf8_bin NOT NULL COMMENT 'An ID that is created when an error occurs.', + `timestamp` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'A datestring from when the error occurred.', + `error_type` int(16) unsigned NOT NULL COMMENT 'The PHP error type of this error.', + `error_line` int(32) unsigned NOT NULL COMMENT 'The line that caused this error.', + `error_string` varchar(512) COLLATE utf8_bin NOT NULL COMMENT 'PHP''s description of this error.', + `error_file` varchar(512) COLLATE utf8_bin NOT NULL COMMENT 'The file in which this error occurred.', + `backtrace` text COLLATE utf8_bin NOT NULL COMMENT 'A full base64 and json encoded backtrace containing all environment data.' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; @@ -207,7 +88,7 @@ CREATE TABLE `sakura_faq` ( `question` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'The question.', `answer` text COLLATE utf8_bin NOT NULL COMMENT 'The answer.', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; DROP TABLE IF EXISTS `sakura_forums`; @@ -220,7 +101,7 @@ CREATE TABLE `sakura_forums` ( `forum_type` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT 'Forum type, 0 for regular board, 1 for category and 2 for link.', `forum_icon` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Display icon for the forum.', PRIMARY KEY (`forum_id`) -) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; DROP TABLE IF EXISTS `sakura_friends`; @@ -273,7 +154,7 @@ CREATE TABLE `sakura_messages` ( `subject` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Title of the message', `content` text COLLATE utf8_bin NOT NULL COMMENT 'Contents of the message.', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; DROP TABLE IF EXISTS `sakura_news`; @@ -285,7 +166,7 @@ CREATE TABLE `sakura_news` ( `title` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Title of the post.', `content` text COLLATE utf8_bin NOT NULL COMMENT 'Contents of the post', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; DROP TABLE IF EXISTS `sakura_notifications`; @@ -303,7 +184,7 @@ CREATE TABLE `sakura_notifications` ( PRIMARY KEY (`id`), KEY `uid` (`uid`), CONSTRAINT `sakura_notifications_ibfk_1` FOREIGN KEY (`uid`) REFERENCES `sakura_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; DROP TABLE IF EXISTS `sakura_optionfields`; @@ -316,10 +197,6 @@ CREATE TABLE `sakura_optionfields` ( UNIQUE KEY `id` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -INSERT INTO `sakura_optionfields` (`id`, `name`, `description`, `formtype`, `require_perm`) VALUES -('disableProfileParallax', 'Disable Parallaxing', 'This will stop your background from responding to your mouse movement, this will only affect your background.', 'checkbox', 'CHANGE_BACKGROUND'), -('profileBackgroundSiteWide', 'Display profile background site wide', 'This will make the profile background you set on your profile appear on the entire site (except on other profiles).', 'checkbox', 'CREATE_BACKGROUND'), -('useMisaki', 'Use the testing style', 'This will make the site use the new Misaki style instead of Yuuno.', 'checkbox', 'ALTER_PROFILE'); DROP TABLE IF EXISTS `sakura_permissions`; CREATE TABLE `sakura_permissions` ( @@ -331,17 +208,6 @@ CREATE TABLE `sakura_permissions` ( `rankinherit` varchar(4) COLLATE utf8_bin NOT NULL DEFAULT '000' COMMENT 'Rank inheritance, only used when user specific.' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -INSERT INTO `sakura_permissions` (`rid`, `uid`, `siteperms`, `manageperms`, `forumperms`, `rankinherit`) VALUES -(1, 0, '0000000000000000000000000001', '00', '0', '000'), -(2, 0, '0000111111111100111101101100', '00', '1', '000'), -(3, 0, '0001111111111111111111111100', '11', '1', '000'), -(4, 0, '1111111111111111111111111100', '11', '1', '000'), -(5, 0, '0001111111111111111111111100', '11', '1', '000'), -(6, 0, '0000111111111100111101101100', '00', '0', '000'), -(7, 0, '0001111111111111111111111100', '01', '1', '000'), -(8, 0, '0001111111111111111111111100', '00', '1', '000'), -(9, 0, '0001111111111111111111111100', '00', '1', '000'), -(10, 0, '0000000011010100101000100010', '00', '0', '000'); DROP TABLE IF EXISTS `sakura_posts`; CREATE TABLE `sakura_posts` ( @@ -365,7 +231,7 @@ CREATE TABLE `sakura_posts` ( KEY `poster_id` (`poster_id`), CONSTRAINT `sakura_posts_ibfk_1` FOREIGN KEY (`topic_id`) REFERENCES `sakura_topics` (`topic_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `sakura_posts_ibfk_2` FOREIGN KEY (`forum_id`) REFERENCES `sakura_forums` (`forum_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; DROP TABLE IF EXISTS `sakura_premium`; @@ -386,7 +252,7 @@ CREATE TABLE `sakura_premium_log` ( `date` int(11) unsigned NOT NULL COMMENT 'Date when the purchase was made.', `comment` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'A short description of the action taken.', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=143 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; DROP TABLE IF EXISTS `sakura_profilefields`; @@ -399,21 +265,8 @@ CREATE TABLE `sakura_profilefields` ( `description` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Description of the field displayed in the control panel.', `additional` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Undocumented JSON array containing special options if needed (probably only going to be used for the YouTube field).', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -INSERT INTO `sakura_profilefields` (`id`, `name`, `formtype`, `islink`, `linkformat`, `description`, `additional`) VALUES -(1, 'Website', 'url', 1, '{{ VAL }}', 'URL to your website', ''), -(2, 'Twitter', 'text', 1, 'https://twitter.com/{{ VAL }}', 'Your @twitter Username', ''), -(3, 'BitBucket', 'text', 1, 'https://bitbucket.org/{{ VAL }}', 'Your BitBucket Username', ''), -(4, 'Skype', 'text', 1, 'skype:{{ VAL }}?userinfo', 'Your Skype Username', ''), -(5, 'YouTube', 'text', 0, '', 'ID or Username excluding http://youtube.com/*/', '{\"youtubetype\": [\"checkbox\", \"I do not have a Channel Username (url looks like https://www.youtube.com/channel/UCXZcw5hw5C7Neto-T_nRXBQ).\"]}'), -(6, 'SoundCloud', 'text', 1, 'https://soundcloud.com/{{ VAL }}', 'Your SoundCloud username', ''), -(7, 'Steam', 'text', 1, 'https://steamcommunity.com/id/{{ VAL }}', 'Your Steam Community Username (may differ from login username)', ''), -(8, 'osu!', 'text', 1, 'https://osu.ppy.sh/u/{{ VAL }}', 'Your osu! Username', ''), -(9, 'Origin', 'text', 0, '', 'Your Origin User ID', ''), -(10, 'Xbox Live', 'text', 1, 'https://account.xbox.com/en-GB/Profile?Gamertag={{ VAL }}', 'Your Xbox User ID', ''), -(11, 'PSN', 'text', 1, 'http://psnprofiles.com/{{ VAL }}', 'Your PSN User ID', ''), -(12, 'Last.fm', 'text', 1, 'http://last.fm/user/{{ VAL }}', 'Your Last.fm username', ''); DROP TABLE IF EXISTS `sakura_ranks`; CREATE TABLE `sakura_ranks` ( @@ -425,19 +278,8 @@ CREATE TABLE `sakura_ranks` ( `description` text COLLATE utf8_bin NOT NULL COMMENT 'A description of what a user of this rank can do/is supposed to do.', `title` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Default user title if user has none set.', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -INSERT INTO `sakura_ranks` (`id`, `name`, `multi`, `hidden`, `colour`, `description`, `title`) VALUES -(1, 'Deactivated', 0, 1, '#555', 'Users that are yet to be activated or that deactivated their own account.', 'Deactivated'), -(2, 'Regular user', 1, 0, 'inherit', 'Regular users with regular permissions.', 'Regular user'), -(3, 'Site moderator', 1, 0, '#0A0', 'Users with special permissions like being able to ban and modify users if needed.', 'Staff'), -(4, 'Administrator', 1, 0, '#C00', 'Users that manage the server and everything around that.', 'Administrator'), -(5, 'Developer', 1, 0, '#824CA0', 'Users that either create or test new features of the site.', 'Staff'), -(6, 'Bot', 1, 1, '#9E8DA7', 'Reserved user accounts for services.', 'Bot'), -(7, 'Chat moderator', 1, 0, '#09F', 'Moderators of the chat room.', 'Staff'), -(8, 'Tenshi', 0, 0, '#EE9400', 'Users that bought premium to help us keep the site and its services alive!', 'Tenshi'), -(9, 'Alumnii', 0, 0, '#FF69B4', 'People who have contributed to the community but have moved on or resigned.', 'Alumnii'), -(10, 'Restricted', 0, 1, '#333', 'Users that are restricted.', 'Restricted'); DROP TABLE IF EXISTS `sakura_regcodes`; CREATE TABLE `sakura_regcodes` ( @@ -478,7 +320,7 @@ CREATE TABLE `sakura_sessions` ( PRIMARY KEY (`id`), KEY `userid` (`userid`), CONSTRAINT `sakura_sessions_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `sakura_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=165 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; DROP TABLE IF EXISTS `sakura_topics`; @@ -497,7 +339,7 @@ CREATE TABLE `sakura_topics` ( PRIMARY KEY (`topic_id`), KEY `forum_id` (`forum_id`), CONSTRAINT `sakura_topics_ibfk_1` FOREIGN KEY (`forum_id`) REFERENCES `sakura_forums` (`forum_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; DROP TABLE IF EXISTS `sakura_users`; @@ -515,8 +357,8 @@ CREATE TABLE `sakura_users` ( `rank_main` mediumint(4) unsigned NOT NULL DEFAULT '0' COMMENT 'Main rank of the user.', `ranks` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '[0]' COMMENT 'Array containing the ranks the user is part of.', `name_colour` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT 'Additional name colour, when empty colour defaults to group colour.', - `register_ip` varchar(16) COLLATE utf8_bin NOT NULL COMMENT 'IP used for the creation of this account.', - `last_ip` varchar(16) COLLATE utf8_bin NOT NULL COMMENT 'Last IP that was used to log into this account.', + `register_ip` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'IP used for the creation of this account.', + `last_ip` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Last IP that was used to log into this account.', `usertitle` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT 'Custom user title of the user, when empty reverts to their derault group name.', `regdate` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Timestamp of account creation.', `lastdate` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Last time anything was done on this account.', @@ -526,7 +368,7 @@ CREATE TABLE `sakura_users` ( `userData` text COLLATE utf8_bin COMMENT 'All additional profile data.', PRIMARY KEY (`id`), UNIQUE KEY `username_clean` (`username_clean`) -) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; DROP TABLE IF EXISTS `sakura_warnings`; @@ -545,4 +387,4 @@ CREATE TABLE `sakura_warnings` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; --- 2015-09-05 16:08:34 +-- 2015-09-06 14:14:33 diff --git a/_developer_data/Sockura.php b/integrations/SockChat.php similarity index 92% rename from _developer_data/Sockura.php rename to integrations/SockChat.php index 625ea5a..4067e53 100644 --- a/_developer_data/Sockura.php +++ b/integrations/SockChat.php @@ -7,6 +7,9 @@ // Filesystem path to the _sakura folder WITHOUT an ending / // This can also be set before an include of this file in case // you're using git to keep in sync and don't want conflicts +// You can also create a PHP file including this SockChat.php +// file so it's always up-to-date! Don't forget to include the +// variable below in the file __BEFORE__ the include! if(!isset($sockSakuraPath)) { $sockSakuraPath = ''; diff --git a/main/authenticate.php b/main/authenticate.php index ceb0265..4971234 100644 --- a/main/authenticate.php +++ b/main/authenticate.php @@ -22,10 +22,11 @@ if(isset($_REQUEST['mode'])) { if(!isset($_REQUEST['time']) || $_REQUEST['time'] < time() - 1000) { $renderData['page'] = [ - 'title' => 'Action failed', + 'redirect' => $urls->format('AUTH_ACTION'), 'message' => 'Timestamps differ too much, refresh the page and try again.', 'success' => 0 + ]; // Prevent @@ -37,10 +38,11 @@ if(isset($_REQUEST['mode'])) { if(!isset($_REQUEST['session']) || $_REQUEST['session'] != session_id()) { $renderData['page'] = [ - 'title' => 'Action failed', + 'redirect' => $urls->format('AUTH_ACTION'), 'message' => 'Invalid session, please try again.', 'success' => 0 + ]; // Prevent @@ -58,10 +60,11 @@ if(isset($_REQUEST['mode'])) { // Add page specific things $renderData['page'] = [ - 'title' => 'Authentication', + 'redirect' => $urls->format('SITE_HOME'), 'message' => 'You are already authenticated. Redirecting...', 'success' => 1 + ]; } @@ -78,10 +81,11 @@ if(isset($_REQUEST['mode'])) { // Add page specific data $renderData['page'] = [ - 'title' => 'Logout', + 'redirect' => ($logout ? $_REQUEST['redirect'] : $urls->format('SITE_LOGIN')), 'message' => $logout ? 'You are now logged out.' : 'An unknown error occurred.', 'success' => $logout ? 1 : 0 + ]; break; @@ -93,6 +97,7 @@ if(isset($_REQUEST['mode'])) { // Array containing "human understandable" messages $messages = [ + 'INVALID_VERK' => 'The verification key supplied was invalid!', 'INVALID_CODE' => 'Invalid verification key, if you think this is an error contact the administrator.', 'INVALID_USER' => 'The used verification key is not designated for this user.', @@ -100,14 +105,16 @@ if(isset($_REQUEST['mode'])) { 'PASS_TOO_SHIT' => 'Your password is too weak, try adding some special characters.', 'PASS_NOT_MATCH' => 'Passwords do not match.', 'SUCCESS' => 'Successfully changed your password, you may now log in.' + ]; // Add page specific things $renderData['page'] = [ - 'title' => 'Forgot Password', + 'redirect' => ($passforget[0] ? $urls->format('SITE_LOGIN') : $_SERVER['PHP_SELF'] .'?pw=true&uid='. $_REQUEST['uid'] .'&verk='. $_REQUEST['verk']), 'message' => $messages[$passforget[1]], 'success' => $passforget[0] + ]; break; @@ -120,19 +127,22 @@ if(isset($_REQUEST['mode'])) { // Array containing "human understandable" messages $messages = [ + 'USER_NOT_EXIST' => 'The user you tried to activate does not exist.', 'USER_ALREADY_ACTIVE' => 'The user you tried to activate is already active.', 'INVALID_CODE' => 'Invalid activation code, if you think this is an error contact the administrator.', 'INVALID_USER' => 'The used activation code is not designated for this user.', 'SUCCESS' => 'Successfully activated your account, you may now log in.' + ]; // Add page specific things $renderData['page'] = [ - 'title' => 'Activate account', + 'redirect' => $urls->format('SITE_LOGIN'), 'message' => $messages[$activate[1]], 'success' => $activate[0] + ]; break; @@ -145,18 +155,21 @@ if(isset($_REQUEST['mode'])) { // Array containing "human understandable" messages $messages = [ + 'AUTH_LOCKED' => 'Authentication is currently not allowed, try again later.', 'USER_NOT_EXIST' => 'The user you tried to activate does not exist (confirm the username/email combination).', 'USER_ALREADY_ACTIVE' => 'The user you tried to activate is already active.', 'SUCCESS' => 'The activation e-mail has been sent to the address associated with your account.' + ]; // Add page specific things $renderData['page'] = [ - 'title' => 'Resend Activation', + 'redirect' => $urls->format('SITE_HOME'), 'message' => $messages[$resend[1]], 'success' => $resend[0] + ]; break; @@ -169,20 +182,23 @@ if(isset($_REQUEST['mode'])) { // Array containing "human understandable" messages $messages = [ + 'AUTH_LOCKED' => 'Authentication is currently not allowed, try again later.', 'USER_NOT_EXIST' => 'The user you tried to log into does not exist.', 'INCORRECT_PASSWORD' => 'The password you entered was invalid.', 'NOT_ALLOWED' => 'Your account does not have the required permissions to log in.', 'NO_LOGIN' => 'Logging into this account is disabled.', 'LOGIN_SUCESS' => 'Login successful!' + ]; // Add page specific things $renderData['page'] = [ - 'title' => 'Login', + 'redirect' => $login[0] ? $_REQUEST['redirect'] : $urls->format('SITE_LOGIN'), 'message' => $messages[$login[1]], 'success' => $login[0] + ]; break; @@ -211,6 +227,7 @@ if(isset($_REQUEST['mode'])) { // Array containing "human understandable" messages $messages = [ + 'AUTH_LOCKED' => 'Authentication is currently not allowed, try again later.', 'DISABLED' => 'Registration is currently disabled.', 'INVALID_REG_KEY' => 'The given registration code was invalid.', @@ -225,14 +242,16 @@ if(isset($_REQUEST['mode'])) { 'INVALID_MX' => 'No valid MX-Record found on the e-mail address you supplied.', 'EMAILSENT' => 'Your registration went through! An activation e-mail has been sent.', 'SUCCESS' => 'Your registration went through! Welcome to '. Configuration::getConfig('sitename') .'!' + ]; // Add page specific things $renderData['page'] = [ - 'title' => 'Register', + 'redirect' => ($register[0] ? $urls->format('SITE_LOGIN') : $urls->format('SITE_REGISTER')), 'message' => $messages[$register[1]], 'success' => $register[0] + ]; break; @@ -245,18 +264,21 @@ if(isset($_REQUEST['mode'])) { // Array containing "human understandable" messages $messages = [ + 'AUTH_LOCKED' => 'Authentication is currently not allowed, try again later.', 'USER_NOT_EXIST' => 'The requested user does not exist (confirm the username/email combination).', 'NOT_ALLOWED' => 'Your account does not have the required permissions to change your password.', 'SUCCESS' => 'The password reset e-mail has been sent to the address associated with your account.' + ]; // Add page specific things $renderData['page'] = [ - 'title' => 'Lost Password', + 'redirect' => $urls->format('SITE_FORGOT_PASSWORD'), 'message' => $messages[$passforgot[1]], 'success' => $passforgot[0] + ]; break; @@ -268,13 +290,9 @@ if(isset($_REQUEST['mode'])) { // Print page contents or if the AJAX request is set only display the render data print isset($_REQUEST['ajax']) ? ( - $renderData['page']['title'] - . '|' - . $renderData['page']['message'] - . '|' - . $renderData['page']['success'] - . '|' - . $renderData['page']['redirect'] + $renderData['page']['message'] .'|'. + $renderData['page']['success'] .'|'. + $renderData['page']['redirect'] ) : Templates::render('global/information.tpl', $renderData); exit; @@ -282,9 +300,6 @@ if(isset($_REQUEST['mode'])) { } // Add page specific things -$renderData['page'] = [ - 'title' => 'Authentication' -]; $renderData['auth'] = [ 'redirect' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $urls->format('SITE_HOME'), @@ -301,9 +316,10 @@ if(Users::checkLogin()) { // Add page specific things $renderData['page'] = [ - 'title' => 'Authentication', + 'redirect' => $urls->format('SITE_HOME'), 'message' => 'You are already logged in, log out to access this page.' + ]; print Templates::render('global/information.tpl', $renderData); @@ -315,8 +331,10 @@ if(Users::checkLogin()) { if(count($regUserIP = Users::getUsersByIP(Main::getRemoteIP()))) { $renderData['auth']['blockRegister'] = [ + 'do' => true, 'username' => $regUserIP[array_rand($regUserIP)]['username'] + ]; } @@ -324,7 +342,6 @@ if(count($regUserIP = Users::getUsersByIP(Main::getRemoteIP()))) { // If password forgot things are set display password forget thing if(isset($_REQUEST['pw']) && $_REQUEST['pw']) { - $renderData['page']['title'] = 'Resetting Password'; $renderData['auth']['changingPass'] = true; $renderData['auth']['userId'] = $_REQUEST['uid']; diff --git a/main/content/data/yuuno/css/yuuno.css b/main/content/data/yuuno/css/yuuno.css index 74e10d6..1635c3d 100644 --- a/main/content/data/yuuno/css/yuuno.css +++ b/main/content/data/yuuno/css/yuuno.css @@ -937,8 +937,9 @@ a#gotop.exit { #notifications > div { cursor: pointer; text-align: left; - display: inline-block; - height: 80px; + display: flex; + align-items: stretch; + min-height: 80px; background: rgba(113, 74, 150, .9); border: 1px solid #507; border-right-width: 5px; @@ -959,12 +960,17 @@ a#gotop.exit { } #notifications > div > .notification-icon { - float: left; - width: 80px; height: 80px; - text-align: center; + width: 80px; + vertical-align: middle; background: rgba(0, 0, 0, .5); - display: block; + flex-shrink: 0; + display: flex; + align-items: center; +} + +#notifications > div > .notification-icon > * { + margin: 0 auto; } #notifications > div > .notification-icon > img { @@ -972,49 +978,58 @@ a#gotop.exit { max-width: 80px; } -#notifications > div > .notification-icon > .font-icon { - margin: .34em 0; -} - #notifications > div > .notification-content { - float: left; min-width: 350px; max-width: 450px; padding-right: 6px; - border-left: 1px solid rgb(85, 0, 119); - height: 80px; + border-left: 1px solid #507; margin-left: 2px; - padding-left: 8px; + flex-grow: 2; + display: flex; + align-content: center; + justify-content: center; + flex-direction: column; } #notifications > div > .notification-content > .notification-title { font-weight: 300; font-size: 1.7em; - margin-top: 1em; + line-height: 1.5em; + padding-left: 4px; + border-bottom: 1px solid #507; } -#notifications > div > .notification-close:before { - font-family: FontAwesome; - content: "\f00d"; +#notifications > div > .notification-content > .notification-text { + padding-left: 4px; } #notifications > div > .notification-close { font-size: 2em; - float: right; - height: 80px; width: 20px; + line-height: 100%; background: #507; margin-top: -3px; - padding-bottom: 6px; + margin-bottom: -3px; padding-left: 2px; + padding-bottom: 3px; border-left: 3px solid #507; - line-height: 3.4em; text-align: center; - display: none; + visibility: hidden; + display: flex; + align-items: center; +} + +#notifications > div > .notification-close > div { + margin: 0 auto; } #notifications > div:hover > .notification-close { - display: block; + visibility: visible; +} + +#notifications > div > .notification-close > div:before { + font-family: FontAwesome; + content: "\f00d"; } @media (max-width: 600px) { @@ -1030,19 +1045,17 @@ a#gotop.exit { } #notifications > div { - height: 40px; + min-height: 40px; width: 100%; background: rgba(113, 74, 150, 1); border: 0; margin: 0 !important; - box-shadow: 0 0 0; - float: left; } #notifications > div > .notification-icon { width: 40px; height: 40px; - text-align: center; + flex-shrink: 0; } #notifications > div > .notification-icon > img { @@ -1051,7 +1064,6 @@ a#gotop.exit { } #notifications > div > .notification-icon > .font-icon { - margin: .34em 0; font-size: 2em; } @@ -1060,16 +1072,21 @@ a#gotop.exit { min-width: 0; width: auto; border-left: 0; - height: 40px; margin: 0; padding-left: 4px; - display: inline-block; + flex-grow: 2; } #notifications > div > .notification-content > .notification-title { font-weight: 700; font-size: 1em; margin: 0; + padding: 0; + } + + #notifications > div > .notification-content > .notification-text { + margin: 0; + padding: 0; } #notifications > div > .notification-close { @@ -1078,15 +1095,13 @@ a#gotop.exit { margin: 0; padding: 0; border: 0; - line-height: 1.5em; - text-align: center; margin-right: 4px; - display: block; + visibility: visible; + flex-shrink: 0; } - #notifications > div > .notification-close:after { - clear: both !important; - float: none; + #notifications > div > .notification-close > div { + margin-top: -1px; } } diff --git a/main/content/data/yuuno/js/yuuno.js b/main/content/data/yuuno/js/yuuno.js index b388fae..28aa023 100644 --- a/main/content/data/yuuno/js/yuuno.js +++ b/main/content/data/yuuno/js/yuuno.js @@ -11,7 +11,7 @@ function cookieData(action, name, data) { return (result = new RegExp('(^|; )' + encodeURIComponent(name) + '=([^;]*)').exec(document.cookie)) ? result[2] : ''; case 'set': - document.cookie = name + '=' + data; + document.cookie = name + '=' + data + '; path=/'; return null; default: @@ -42,6 +42,7 @@ function notifyUI(content) { var notifTitle = document.createElement('div'); var notifText = document.createElement('div'); var notifClose = document.createElement('div'); + var notifCloseIcon = document.createElement('div'); var notifClear = document.createElement('div'); var iconCont; @@ -87,6 +88,7 @@ function notifyUI(content) { // Add close button notifClose .className = 'notification-close'; notifClose .setAttribute('onclick', 'notifyClose(this.parentNode.id);'); + notifClose .appendChild(notifCloseIcon); notif .appendChild(notifClose); // Add .clear @@ -543,29 +545,31 @@ function submitPost(action, requestParts, busyView, msg, resetCaptchaOnFailure) // If using the busy view thing update the text displayed to the return of the request if(busyView) { - ajaxBusyView(true, request[1], (request[2] == '1' ? 'ok' : 'fail')); + ajaxBusyView(true, request[0], (request[1] == '1' ? 'ok' : 'fail')); } // If request reset the recaptcha on failure - if(resetCaptchaOnFailure && request[2] != '1' && sakuraVars.recpatchaEnabled) { + if(resetCaptchaOnFailure && request[1] != '1' && sakuraVars.recpatchaEnabled) { grecaptcha.reset(); } setTimeout(function(){ + if(busyView) { ajaxBusyView(false); } - if(request[2] == '1') { + if(request[1] == '1') { - window.location = request[3]; + window.location = request[2]; } + }, 2000); return; diff --git a/main/index.php b/main/index.php index 7753a96..70567a5 100644 --- a/main/index.php +++ b/main/index.php @@ -14,8 +14,9 @@ if(isset($_GET['p'])) { // Set default variables $renderData['page'] = [ - 'title' => 'Info pages', + 'content' => Main::mdParse("# Unable to load the requested info page.\r\n\r\nCheck the URL and try again.") + ]; // Set page id @@ -48,8 +49,7 @@ $forumMode = isset($_GET['forum']) ? ($_GET['forum'] == true) : false; $renderData['newsPosts'] = ($forumMode ? null : Main::getNewsPosts(Configuration::getConfig('front_page_news_posts'))); $renderData['page'] = [ - 'title' => ($forumMode ? 'Forum Listing' : Configuration::getConfig('sitename')), - 'friend_req' => Users::getPendingFriends() + 'friend_req' => Users::getPendingFriends() ]; $renderData['board'] = [ diff --git a/main/members.php b/main/members.php index 1eefbec..44468a4 100644 --- a/main/members.php +++ b/main/members.php @@ -9,19 +9,28 @@ namespace Sakura; // Include components require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php'; -// Add page specific things -$renderData['page'] = [ +// CHeck if the user is logged in +if(Users::checkLogin()) { - 'ranks' => ($_MEMBERLIST_RANKS = Users::getAllRanks()), - 'active' => ($_MEMBERLIST_ACTIVE = (isset($_GET['rank']) && $_GET['rank'] && array_key_exists($_GET['rank'], $_MEMBERLIST_RANKS) ? $_GET['rank'] : 0)), - 'notfound' => ($_MEMBERLIST_NFOUND = (isset($_GET['rank']) && !array_key_exists($_GET['rank'], $_MEMBERLIST_RANKS) && $_GET['rank'] != 0)), - 'sorts' => ($_MEMBERLIST_SORTS = ['boxes', 'rectangles', 'list']), - 'sort' => isset($_GET['sort']) && $_GET['sort'] && in_array($_GET['sort'], $_MEMBERLIST_SORTS) ? $_GET['sort'] : $_MEMBERLIST_SORTS[0], - 'title' => isset($_GET['rank']) && $_GET['rank'] && !$_MEMBERLIST_NFOUND ? 'Viewing '. $_MEMBERLIST_RANKS[$_GET['rank']]['name'] . ($_MEMBERLIST_RANKS[$_GET['rank']]['multi'] ? 's' : '') : 'Member List', - 'page' => isset($_GET['page']) && ($_GET['page'] - 1) >= 0 ? $_GET['page'] - 1 : 0, - 'users' => array_chunk($_MEMBERLIST_ACTIVE && !$_MEMBERLIST_NFOUND ? Users::getUsersInRank($_MEMBERLIST_ACTIVE, null, true, true) : Users::getAllUsers(), Configuration::getConfig('members_per_page'), true) + // Add page specific things + $renderData['page'] = [ -]; + 'ranks' => ($_MEMBERLIST_RANKS = Users::getAllRanks()), + 'active' => ($_MEMBERLIST_ACTIVE = (isset($_GET['rank']) && $_GET['rank'] && array_key_exists($_GET['rank'], $_MEMBERLIST_RANKS) ? $_GET['rank'] : 0)), + 'notfound' => ($_MEMBERLIST_NFOUND = (isset($_GET['rank']) && !array_key_exists($_GET['rank'], $_MEMBERLIST_RANKS) && $_GET['rank'] != 0)), + 'sorts' => ($_MEMBERLIST_SORTS = ['boxes', 'rectangles', 'list']), + 'sort' => isset($_GET['sort']) && $_GET['sort'] && in_array($_GET['sort'], $_MEMBERLIST_SORTS) ? $_GET['sort'] : $_MEMBERLIST_SORTS[0], + 'page' => isset($_GET['page']) && ($_GET['page'] - 1) >= 0 ? $_GET['page'] - 1 : 0, + 'users' => array_chunk($_MEMBERLIST_ACTIVE && !$_MEMBERLIST_NFOUND ? Users::getUsersInRank($_MEMBERLIST_ACTIVE, null, true, true) : Users::getAllUsers(), Configuration::getConfig('members_per_page'), true) -// Print page contents -print Templates::render('main/memberlist.tpl', $renderData); + ]; + + // Print page contents + print Templates::render('main/memberlist.tpl', $renderData); + +} else { + + // Else return the restricted page + print Templates::render('global/restricted.tpl', $renderData); + +} diff --git a/main/news.php b/main/news.php index 42ea66c..f8fe7c5 100644 --- a/main/news.php +++ b/main/news.php @@ -17,7 +17,6 @@ $renderData['newsPosts'] = Main::getNewsPosts((isset($_GET['id']) && !isset($_GE $renderData['page'] = [ - 'title' => (isset($_GET['id']) ? (count($renderData['newsPosts']) ? $renderData['newsPosts'][0]['title'] : 'Post does not exist!') : 'News'), 'view_post' => isset($_GET['id']) && count($renderData['newsPosts']), 'currentPage' => 0 @@ -28,23 +27,27 @@ if(isset($_GET['xml'])) { // Meta data attributes $metaData = [ + 'title' => ($_FEED_TITLE = Configuration::getConfig('sitename')) .' News', 'link' => ($_FEED_URL = 'http://'. Configuration::getConfig('url_main')), 'description' => 'News about '. $_FEED_TITLE, 'language' => 'en-gb', 'webMaster' => (new User(1))->data['email'] .' ('. $_FEED_TITLE .' Webmaster)', 'pubDate' => ($_FEED_DATE = date('r', $renderData['newsPosts'][0]['date'])), - 'lastBuildDate' => $_FEED_DATE, + 'lastBuildDate' => $_FEED_DATE + ]; // Item attributes $itemData = [ + 'title' => ['text' => '{EVAL}', 'eval' => '$newsPost["title"]'], 'link' => ['text' => $_FEED_URL .'/news/{EVAL}', 'eval' => '$newsPost["id"]'], 'guid' => ['text' => $_FEED_URL .'/news/{EVAL}', 'eval' => '$newsPost["id"]'], 'pubDate' => ['text' => '{EVAL}', 'eval' => 'date("D, d M Y G:i:s O", $newsPost["date"])'], 'dc:publisher' => ['text' => '{EVAL}', 'eval' => '$newsPost["udata"]["username"]'], - 'description' => ['cdata' => '{EVAL}', 'eval' => '$newsPost["parsed"]'], + 'description' => ['cdata' => '{EVAL}', 'eval' => '$newsPost["parsed"]'] + ]; // Create a new DOM document diff --git a/main/profile.php b/main/profile.php index acfb444..5f757d3 100644 --- a/main/profile.php +++ b/main/profile.php @@ -16,14 +16,5 @@ $profile = new User(isset($_GET['u']) ? $_GET['u'] : 0); // Assign the object to a renderData variable $renderData['profile'] = $profile; -// Set proper page title -$renderData['page']['title'] = ( - - $profile->checkPermission('SITE', 'DEACTIVATED') || $profile->data['password_algo'] == 'nologin' || ($profile->checkPermission('SITE', 'RESTRICTED') && ($profile->data['id'] != $currentUser->data['id'] && !$currentUser->checkPermission('MANAGE', 'USE_MANAGE'))) - ? 'User not found!' - : 'Profile of '. $profile->data['username'] - -); - // Print page contents print Templates::render('profile/index.tpl', $renderData); diff --git a/main/settings.php b/main/settings.php index 8683c08..c206b19 100644 --- a/main/settings.php +++ b/main/settings.php @@ -76,7 +76,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications $renderData['page'] = [ - 'title' => 'Action failed', 'redirect' => $redirect, 'message' => 'One of the required operators isn\'t set.', 'success' => 0 @@ -93,7 +92,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications $renderData['page'] = [ - 'title' => 'Action failed', 'redirect' => $redirect, 'message' => 'You can\'t be friends with yourself, stop trying to bend reality.', 'success' => 0 @@ -110,7 +108,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications $renderData['page'] = [ - 'title' => 'Action failed', 'redirect' => $redirect, 'message' => 'Timestamps differ too much, refresh the page and try again.', 'success' => 0 @@ -127,7 +124,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications $renderData['page'] = [ - 'title' => 'Action failed', 'redirect' => $redirect, 'message' => 'Invalid session, please try again.', 'success' => 0 @@ -169,7 +165,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Add page specific things $renderData['page'] = [ - 'title' => 'Managing Friends', 'redirect' => $redirect, 'message' => $messages[$action[1]], 'success' => $action[0] @@ -199,13 +194,9 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Print page contents or if the AJAX request is set only display the render data print isset($_REQUEST['ajax']) ? ( - $renderData['page']['title'] - . '|' - . $renderData['page']['message'] - . '|' - . $renderData['page']['success'] - . '|' - . $renderData['page']['redirect'] + $renderData['page']['message'] .'|'. + $renderData['page']['success'] .'|'. + $renderData['page']['redirect'] ) : Templates::render('global/information.tpl', $renderData); exit; @@ -222,7 +213,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications $renderData['page'] = [ - 'title' => 'Settings', 'redirect' => '/authenticate', 'message' => 'You must be logged in to edit your settings.', 'success' => 0 @@ -238,7 +228,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications $renderData['page'] = [ - 'title' => 'Session expired', 'redirect' => $redirect, 'message' => 'Your session has expired, please refresh the page and try again.', 'success' => 0 @@ -285,7 +274,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Set render data $renderData['page'] = [ - 'title' => $msgTitle, 'redirect' => $redirect, 'message' => 'You are not allowed to alter your '. strtolower($msgTitle) .'.', 'success' => 0 @@ -307,7 +295,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Set render data $renderData['page'] = [ - 'title' => $msgTitle, 'redirect' => $redirect, 'message' => 'No file was uploaded.', 'success' => 0 @@ -348,7 +335,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Set render data $renderData['page'] = [ - 'title' => $msgTitle, 'redirect' => $redirect, 'message' => $msg, 'success' => 0 @@ -371,7 +357,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Set render data $renderData['page'] = [ - 'title' => $msgTitle, 'redirect' => $redirect, 'message' => 'Uploaded file is not an image.', 'success' => 0 @@ -388,7 +373,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Set render data $renderData['page'] = [ - 'title' => $msgTitle, 'redirect' => $redirect, 'message' => 'This filetype is not allowed.', 'success' => 0 @@ -405,7 +389,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Set render data $renderData['page'] = [ - 'title' => $msgTitle, 'redirect' => $redirect, 'message' => 'The resolution of this picture is too big.', 'success' => 0 @@ -422,7 +405,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Set render data $renderData['page'] = [ - 'title' => $msgTitle, 'redirect' => $redirect, 'message' => 'The resolution of this picture is too small.', 'success' => 0 @@ -439,7 +421,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Set render data $renderData['page'] = [ - 'title' => $msgTitle, 'redirect' => $redirect, 'message' => 'The filesize of this file is too large.', 'success' => 0 @@ -469,7 +450,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Set render data $renderData['page'] = [ - 'title' => $msgTitle, 'redirect' => $redirect, 'message' => 'Something went wrong, please try again.', 'success' => 0 @@ -494,7 +474,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Set render data $renderData['page'] = [ - 'title' => $msgTitle, 'redirect' => $redirect, 'message' => 'Updated your '. strtolower($msgTitle) .'!', 'success' => 1 @@ -551,7 +530,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Set render data $renderData['page'] = [ - 'title' => 'Profile update', 'redirect' => $redirect, 'message' => 'Your profile has been updated!', 'success' => 1 @@ -588,7 +566,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Set render data $renderData['page'] = [ - 'title' => 'Options change', 'redirect' => $redirect, 'message' => 'Changed your options!', 'success' => 1 @@ -609,7 +586,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Set render data $renderData['page'] = [ - 'title' => 'Userpage', 'redirect' => $redirect, 'message' => 'Your userpage has been updated!', 'success' => 1 @@ -624,7 +600,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Set render data $renderData['page'] = [ - 'title' => 'Unknown action', 'redirect' => $redirect, 'message' => 'The requested method does not exist.', 'success' => 0 @@ -640,13 +615,9 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications // Print page contents or if the AJAX request is set only display the render data print isset($_REQUEST['ajax']) ? ( - $renderData['page']['title'] - . '|' - . $renderData['page']['message'] - . '|' - . $renderData['page']['success'] - . '|' - . $renderData['page']['redirect'] + $renderData['page']['message'] .'|'. + $renderData['page']['success'] .'|'. + $renderData['page']['redirect'] ) : Templates::render('global/information.tpl', $renderData); exit; @@ -1031,7 +1002,8 @@ if(Users::checkLogin()) { // Page data $renderData['page'] = [ - 'title' => $pages[$category]['title'] .' / '. $pages[$category]['modes'][$mode]['title'], + 'category' => $pages[$category]['title'], + 'mode' => $pages[$category]['modes'][$mode]['title'], 'currentPage' => isset($_GET['page']) && ($_GET['page'] - 1) >= 0 ? $_GET['page'] - 1 : 0, 'description' => $pages[$category]['modes'][$mode]['description'] @@ -1115,8 +1087,7 @@ if(Users::checkLogin()) { } else { - $renderData['page']['title'] = 'Restricted!'; - + // If not allowed print the restricted page print Templates::render('global/restricted.tpl', $renderData); } diff --git a/main/support.php b/main/support.php index ff7f204..5b1d179 100644 --- a/main/support.php +++ b/main/support.php @@ -105,10 +105,13 @@ if(isset($_REQUEST['mode']) && Users::checkLogin() && Permissions::check('SITE', case 'complete': print Templates::render('main/premiumcomplete.tpl', array_merge([ + 'page' => [ - 'title' => 'Premium purchase complete!', + 'expiration' => ($prem = Users::checkUserPremium(Session::$userId)[2]) !== null ? $prem : 0 + ] + ], $renderData)); break; @@ -129,7 +132,6 @@ if(isset($_GET['tracker'])) { $renderData['page'] = [ - 'title' => 'Donation Tracker', 'currentPage' => isset($_GET['page']) && ($_GET['page'] - 1) >= 0 ? $_GET['page'] - 1 : 0, 'premiumData' => ($_PREMIUM = Main::getPremiumTrackerData()), 'premiumTable' => array_chunk($_PREMIUM['table'], 20, true) @@ -144,7 +146,6 @@ if(isset($_GET['tracker'])) { // Set default variables $renderData['page'] = [ - 'title' => 'Support '. Configuration::getConfig('sitename'), 'fail' => isset($_GET['fail']), 'price' => Configuration::getConfig('premium_price_per_month'), 'current' => $currentUser->checkPremium(), diff --git a/main/viewforum.php b/main/viewforum.php index 75aaa15..4d94eda 100644 --- a/main/viewforum.php +++ b/main/viewforum.php @@ -47,12 +47,6 @@ if($forum['forum']['forum_type'] === 2) { } -$renderData['page'] = [ - - 'title' => 'Forums / '. $forum['forum']['forum_name'] - -]; - $renderData['board'] = [ 'forums' => [ diff --git a/main/viewtopic.php b/main/viewtopic.php index 5d69249..b5efe04 100644 --- a/main/viewtopic.php +++ b/main/viewtopic.php @@ -18,7 +18,6 @@ if(!$topic) { // Set render data $renderData['page'] = [ - 'title' => 'Information', 'message' => 'The topic you tried to access does not exist.' ]; @@ -37,11 +36,6 @@ $renderData = array_merge($renderData, $topic, [ 'viewforum' => false, 'viewtopic' => true, - ], - 'page' => [ - - 'title' => $topic['topic']['topic_title'] - ] ]);