From c29f352bdd909c0a682ceb0e354abb826bae09a1 Mon Sep 17 00:00:00 2001 From: flashwave Date: Mon, 28 Mar 2016 00:15:51 +0200 Subject: [PATCH] php7 only --- README.md | 6 +++--- composer.json | 2 +- libraries/Template.php | 2 ++ public/settings.php | 3 +++ sakura.php | 15 +++------------ templates/misaki/global/master.twig | 2 +- templates/misaki/main/profile.twig | 2 +- templates/misaki/settings/general.options.twig | 4 ++-- templates/yuuno/auth/login.twig | 2 +- templates/yuuno/auth/reactivate.twig | 2 +- templates/yuuno/auth/register.twig | 2 +- templates/yuuno/auth/resetpassword.twig | 2 +- templates/yuuno/elements/comment.twig | 8 ++++---- templates/yuuno/elements/comments.twig | 2 +- templates/yuuno/forum/forumMod.twig | 2 +- templates/yuuno/forum/viewforum.twig | 2 +- templates/yuuno/forum/viewtopic.twig | 2 +- templates/yuuno/global/confirm.twig | 4 ++-- templates/yuuno/global/master.twig | 12 ++++++------ templates/yuuno/main/profile.twig | 4 ++-- templates/yuuno/main/support.twig | 6 +++--- templates/yuuno/settings/account.email.twig | 4 ++-- templates/yuuno/settings/account.password.twig | 4 ++-- templates/yuuno/settings/account.ranks.twig | 4 ++-- templates/yuuno/settings/account.username.twig | 6 +++--- templates/yuuno/settings/account.usertitle.twig | 4 ++-- templates/yuuno/settings/advanced.deactivate.twig | 4 ++-- templates/yuuno/settings/advanced.sessions.twig | 8 ++++---- templates/yuuno/settings/appearance.avatar.twig | 4 ++-- .../yuuno/settings/appearance.background.twig | 4 ++-- templates/yuuno/settings/appearance.header.twig | 4 ++-- .../yuuno/settings/appearance.signature.twig | 4 ++-- templates/yuuno/settings/appearance.userpage.twig | 4 ++-- templates/yuuno/settings/friends.listing.twig | 2 +- templates/yuuno/settings/friends.requests.twig | 4 ++-- templates/yuuno/settings/general.options.twig | 4 ++-- templates/yuuno/settings/general.profile.twig | 4 ++-- 37 files changed, 75 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index ad015a4..f959d7b 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ ## Requirements -- PHP 5.5.0 or newer -- A database engine compatible with your PHP install and Laravel/Illuminate's database abstraction layer. +- PHP 7.0.0 or newer +- A database engine compatible with your PHP install and Laravel/Illuminate's database abstraction layer, MySQL 5.7 recommended. -_these will likely update in the future because i'm planning to go php 7 only_ +I will include a full list of required extensions later. ## Contributing diff --git a/composer.json b/composer.json index ba3f33a..45853f2 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "issues": "https://github.com/flashwave/sakura/issues" }, "require": { - "php": ">=5.5.0", + "php": ">=7.0.0", "ext-curl": "*", "ext-json": "*", "twig/twig": "*", diff --git a/libraries/Template.php b/libraries/Template.php index b18b222..e11d177 100644 --- a/libraries/Template.php +++ b/libraries/Template.php @@ -104,6 +104,8 @@ class Template self::$template->addFunction(new Twig_SimpleFunction('route', function ($name, $args = null) { return Router::route($name, $args); })); + + self::$template->addFunction(new Twig_SimpleFunction('session_id', 'session_id')); } /** diff --git a/public/settings.php b/public/settings.php index 4963448..3975d00 100644 --- a/public/settings.php +++ b/public/settings.php @@ -9,6 +9,9 @@ namespace Sakura; use Sakura\Perms\Site; use Sakura\Router; +// Legacy support!!!!!!!!! +$renderData = []; + // If this we're requesting notifications this page won't require templating if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications']) { define('SAKURA_NO_TPL', true); diff --git a/sakura.php b/sakura.php index f27a147..4fe1eb8 100644 --- a/sakura.php +++ b/sakura.php @@ -23,9 +23,9 @@ set_time_limit(0); // Set internal encoding method mb_internal_encoding('utf-8'); -// Stop the execution if the PHP Version is older than 5.5.0 -if (version_compare(phpversion(), '5.5.0', '<')) { - throw new \Exception('Sakura requires at least PHP 5.5.0, please upgrade to a newer PHP version.'); +// Stop the execution if the PHP Version is older than 7.0.0 +if (version_compare(phpversion(), '7.0.0', '<')) { + throw new \Exception('Sakura requires at least PHP 7.0.0, please upgrade to a newer PHP version.'); } // Check if the composer autoloader exists @@ -162,16 +162,10 @@ if (!defined('SAKURA_NO_TPL')) { 'forumTextMaxLength' => Config::get('forum_text_max'), 'forumTextMinLength' => Config::get('forum_text_min'), ], - 'php' => [ - 'sessionid' => \session_id(), - 'time' => \time(), - 'self' => $_SERVER['PHP_SELF'], - ], 'session' => array_merge([ 'checkLogin' => $authCheck, 'sessionId' => $authCheck[1], - 'userId' => $authCheck[0], ], $_SESSION), 'user' => $currentUser, @@ -183,9 +177,6 @@ if (!defined('SAKURA_NO_TPL')) { 'server' => $_SERVER, ]); - // Add the default render data - $renderData = []; - // Site closing if (Config::get('site_closed')) { // Set parse variables diff --git a/templates/misaki/global/master.twig b/templates/misaki/global/master.twig index 89e9669..daff41b 100644 --- a/templates/misaki/global/master.twig +++ b/templates/misaki/global/master.twig @@ -108,7 +108,7 @@
  • Private Messages
  • User Settings
  • Site Management
  • -
  • Logout
  • +
  • Logout
  • {% endif %} diff --git a/templates/misaki/main/profile.twig b/templates/misaki/main/profile.twig index c2a4fb2..05d62a2 100644 --- a/templates/misaki/main/profile.twig +++ b/templates/misaki/main/profile.twig @@ -95,7 +95,7 @@
  • Edit
  • Settings
  • {% else %} -
  • {% if user.checkFriends(profile.id) == 0 %}Add friend{% else %}Friends{% endif %}
  • +
  • {% if user.checkFriends(profile.id) == 0 %}Add friend{% else %}Friends{% endif %}
  • Report
  • {% endif %} diff --git a/templates/misaki/settings/general.options.twig b/templates/misaki/settings/general.options.twig index fc49832..c39a2e0 100644 --- a/templates/misaki/settings/general.options.twig +++ b/templates/misaki/settings/general.options.twig @@ -1,6 +1,6 @@
    - - + + {% for field in options.fields %}
    diff --git a/templates/yuuno/auth/login.twig b/templates/yuuno/auth/login.twig index 978e5a9..0866891 100644 --- a/templates/yuuno/auth/login.twig +++ b/templates/yuuno/auth/login.twig @@ -13,7 +13,7 @@
    - +
    diff --git a/templates/yuuno/auth/reactivate.twig b/templates/yuuno/auth/reactivate.twig index b7d7b61..8521328 100644 --- a/templates/yuuno/auth/reactivate.twig +++ b/templates/yuuno/auth/reactivate.twig @@ -12,7 +12,7 @@ Reactivate account - +
    diff --git a/templates/yuuno/auth/register.twig b/templates/yuuno/auth/register.twig index 5024ad5..1c01319 100644 --- a/templates/yuuno/auth/register.twig +++ b/templates/yuuno/auth/register.twig @@ -20,7 +20,7 @@ Register - +
    diff --git a/templates/yuuno/auth/resetpassword.twig b/templates/yuuno/auth/resetpassword.twig index b4bd14d..f35759e 100644 --- a/templates/yuuno/auth/resetpassword.twig +++ b/templates/yuuno/auth/resetpassword.twig @@ -12,7 +12,7 @@ Reset Password - + {% if get.u is defined and get.k is defined %} diff --git a/templates/yuuno/elements/comment.twig b/templates/yuuno/elements/comment.twig index 2f2ceaa..5fd1a9e 100644 --- a/templates/yuuno/elements/comment.twig +++ b/templates/yuuno/elements/comment.twig @@ -6,13 +6,13 @@
    diff --git a/templates/yuuno/elements/comments.twig b/templates/yuuno/elements/comments.twig index 1d3786b..06c2272 100644 --- a/templates/yuuno/elements/comments.twig +++ b/templates/yuuno/elements/comments.twig @@ -2,7 +2,7 @@
    {% if session.checkLogin %} - + diff --git a/templates/yuuno/forum/forumMod.twig b/templates/yuuno/forum/forumMod.twig index f5e0f2c..b26f719 100644 --- a/templates/yuuno/forum/forumMod.twig +++ b/templates/yuuno/forum/forumMod.twig @@ -1,5 +1,5 @@ - + {% if forumSticky is defined %} {% endif %} diff --git a/templates/yuuno/forum/viewforum.twig b/templates/yuuno/forum/viewforum.twig index 8c2e871..bf26401 100644 --- a/templates/yuuno/forum/viewforum.twig +++ b/templates/yuuno/forum/viewforum.twig @@ -4,7 +4,7 @@ {% set forumBackLink %}{{ route('forums.index') }}{% endset %} {% set forumNewLink %}{{ route('forums.new', forum.id) }}{% endset %} -{% set forumMarkRead %}{{ route('forums.mark', forum.id) }}?s={{ php.sessionid }}{% endset %} +{% set forumMarkRead %}{{ route('forums.mark', forum.id) }}?s={{ session_id() }}{% endset %} {% block title %}{{ title }}{% endblock %} diff --git a/templates/yuuno/forum/viewtopic.twig b/templates/yuuno/forum/viewtopic.twig index 0bdb960..d2da5ef 100644 --- a/templates/yuuno/forum/viewtopic.twig +++ b/templates/yuuno/forum/viewtopic.twig @@ -99,7 +99,7 @@ {% if user.isFriends(post.poster.id) != 0 %} {% endif %} - + {% endif %} diff --git a/templates/yuuno/global/confirm.twig b/templates/yuuno/global/confirm.twig index 1e36b21..b1533c5 100644 --- a/templates/yuuno/global/confirm.twig +++ b/templates/yuuno/global/confirm.twig @@ -9,8 +9,8 @@
    {{ message }} - - + + {% for key,value in conditions %} {% endfor %} diff --git a/templates/yuuno/global/master.twig b/templates/yuuno/global/master.twig index baff4e0..c5618a0 100644 --- a/templates/yuuno/global/master.twig +++ b/templates/yuuno/global/master.twig @@ -102,7 +102,7 @@ {% endif %} - + {% else %} {% if sakura.lockAuth %} @@ -123,8 +123,8 @@
    - - + +
    @@ -170,7 +170,7 @@ {% endif %} {% block content %} -

    {{ php.self }} is now printing!

    +

    There is nothing here!

    {% endblock %}
    {% endif %} diff --git a/templates/yuuno/main/support.twig b/templates/yuuno/main/support.twig index 42228cf..94432ed 100644 --- a/templates/yuuno/main/support.twig +++ b/templates/yuuno/main/support.twig @@ -22,7 +22,7 @@

    {% if persistentPremium %}Your rank has persistent Tenshi.{% else %}Your Tenshi tag is valid till {{ user.premiumInfo.expire|date(sakura.dateFormat) }}.{% endif %}

    - +
    {% endif %}
    @@ -112,8 +112,8 @@ {% if session.checkLogin and user.permission(constant('Sakura\\Perms\\Site::OBTAIN_PREMIUM')) %} - - + +