diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php index 5cee25a4..a5007e3b 100644 --- a/system/libs/pot/OTS_Account.php +++ b/system/libs/pot/OTS_Account.php @@ -443,15 +443,16 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable throw new E_OTS_NotLoaded(); } - 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 max($ret, 0); + if(isset($this->data['premium_ends_at']) || isset($this->data['premend']) || + (isCanary() && isset($this->data['lastday']))) { + $col = (isset($this->premium_ends_at) ? 'premium_ends_at' : (isset($this->data['lastday']) ? 'lastday' : 'premend')); + $ret = ceil(($this->data[$col] - time()) / (24 * 60 * 60)); + return max($ret, 0); } if (isCanary() && isset($this->data['lastday'])) { $ret = ceil(($this->data['lastday'] - time()) / 86400); - return $ret > 0 ? $ret : 0; + return max($ret, 0); } if($this->data['premdays'] == 0) { diff --git a/system/src/Models/Account.php b/system/src/Models/Account.php index f0bd435f..fdd7d540 100644 --- a/system/src/Models/Account.php +++ b/system/src/Models/Account.php @@ -33,10 +33,11 @@ class Account extends Model { public function getPremiumDaysAttribute() { - if(isset($this->premium_ends_at) || isset($this->premend)) { - $col = isset($this->premium_ends_at) ? 'premium_ends_at' : 'premend'; - $ret = ceil(($this->{$col}- time()) / (24 * 60 * 60)); - return $ret > 0 ? $ret : 0; + if(isset($this->premium_ends_at) || isset($this->premend) || + (isCanary() && isset($this->data['lastday']))) { + $col = (isset($this->premium_ends_at) ? 'premium_ends_at' : (isset($this->data['lastday']) ? 'lastday' : 'premend')); + $ret = ceil(($this->{$col}- time()) / (24 * 60 * 60)); + return max($ret, 0); } if($this->premdays == 0) {