From 3e61692780d4add93b7b0e9f12f7a283bd8f4b7a Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 15 Oct 2025 15:49:58 +0200 Subject: [PATCH] Fix premDays count in canary --- system/functions.php | 6 ++++++ system/libs/pot/OTS_Account.php | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/system/functions.php b/system/functions.php index 212a043e..b3f1189f 100644 --- a/system/functions.php +++ b/system/functions.php @@ -1704,6 +1704,12 @@ function getAccountIdentityColumn(): string return 'id'; } +function isCanary(): bool +{ + $vipSystemEnabled = configLua('vipSystemEnabled'); + return isset($vipSystemEnabled); +} + // validator functions require_once SYSTEM . 'compat/base.php'; diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php index 872d1c89..5cee25a4 100644 --- a/system/libs/pot/OTS_Account.php +++ b/system/libs/pot/OTS_Account.php @@ -449,6 +449,11 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable return max($ret, 0); } + if (isCanary() && isset($this->data['lastday'])) { + $ret = ceil(($this->data['lastday'] - time()) / 86400); + return $ret > 0 ? $ret : 0; + } + if($this->data['premdays'] == 0) { return 0; }