From 4a6896b4469968b9904292734cf6c14ba5eeef14 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sat, 15 Mar 2025 22:48:59 +0100 Subject: [PATCH] getPremDays: returns -1 if freePremium --- system/libs/pot/OTS_Account.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php index 07f31c82..fe134a71 100644 --- a/system/libs/pot/OTS_Account.php +++ b/system/libs/pot/OTS_Account.php @@ -443,19 +443,19 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable throw new E_OTS_NotLoaded(); } + $configFreePremium = configLua('freePremium'); + if(isset($configFreePremium) && getBoolean($configFreePremium)) {return -1;} + if(isset($this->data['premium_ends_at']) || isset($this->data['premend'])) { $col = isset($this->data['premium_ends_at']) ? 'premium_ends_at' : 'premend'; $ret = ceil(($this->data[$col] - time()) / (24 * 60 * 60)); - return $ret > 0 ? $ret : 0; + return max($ret, 0); } if($this->data['premdays'] == 0) { return 0; } - global $config; - if(isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium'])) return -1; - if($this->data['premdays'] == self::GRATIS_PREMIUM_DAYS){ return self::GRATIS_PREMIUM_DAYS; }