From 85083f5979529e43c89c36c4a6b2be135a04ef45 Mon Sep 17 00:00:00 2001 From: slawkens1 Date: Mon, 8 Jan 2018 00:08:17 +0100 Subject: [PATCH] * fixed displaying premium account days * function OTS_Account:getPremDays will now return -1 if there's freePremium configurable enabled on the server --- system/libs/pot/OTS_Account.php | 2 ++ system/templates/account.management.html.twig | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php index 22b63b2c..ce0fd656 100644 --- a/system/libs/pot/OTS_Account.php +++ b/system/libs/pot/OTS_Account.php @@ -358,6 +358,8 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable return round(($this->data['premend'] - time()) / (24 * 60 * 60), 2); } + global $config; + if(isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium'])) return -1; return $this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday'])); } diff --git a/system/templates/account.management.html.twig b/system/templates/account.management.html.twig index bc47fa97..5a67727f 100644 --- a/system/templates/account.management.html.twig +++ b/system/templates/account.management.html.twig @@ -51,7 +51,12 @@

My account

Welcome to your account page, {{ account }}
- You have {{ account_logged.getPremDays() }} days remaining premium account.

+ {% if config.lua.freePremium %} + You have unlimited premium account. + {% else %} + You have {{ account_logged.getPremDays() }} days remaining premium account. + {% endif %} +

{# if account dont have recovery key show hint #} {% if recovery_key is empty %}