diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php index a1bf1575..beed47dd 100644 --- a/system/libs/pot/OTS_Account.php +++ b/system/libs/pot/OTS_Account.php @@ -42,6 +42,8 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable private $data = array('email' => '', 'blocked' => false, 'rlname' => '','location' => '', 'country' => '','web_flags' => 0, 'lastday' => 0, 'premdays' => 0, 'created' => 0); public static $cache = array(); + + const GRATIS_PREMIUM_DAYS = 65535; /** * Creates new account. * @@ -382,6 +384,10 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable 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; + } + $ret = ceil($this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday']))); return $ret > 0 ? $ret : 0; } diff --git a/system/pages/accountmanagement.php b/system/pages/accountmanagement.php index 5b53c40f..e3444a73 100644 --- a/system/pages/accountmanagement.php +++ b/system/pages/accountmanagement.php @@ -60,14 +60,15 @@ $errors = array(); if($action == '') { - $freePremium = isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium']); + $freePremium = isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium']) || $account_logged->getPremDays() == OTS_Account::GRATIS_PREMIUM_DAYS; + $dayOrDays = $account_logged->getPremDays() == 1 ? 'day' : 'days'; /** * @var OTS_Account $account_logged */ if(!$account_logged->isPremium()) $account_status = 'Free Account'; else - $account_status = 'Premium Account, ' . ($freePremium ? 'Unlimited' : $account_logged->getPremDays() . ' days left') . ''; + $account_status = '' . ($freePremium ? 'Gratis Premium Account' : 'Premium Account, ' . $account_logged->getPremDays() . ' '.$dayOrDays.' left') . ''; $recovery_key = $account_logged->getCustomField('key'); if(empty($recovery_key)) diff --git a/system/pages/admin/accounts.php b/system/pages/admin/accounts.php index 2e9e5da9..8ef7de58 100644 --- a/system/pages/admin/accounts.php +++ b/system/pages/admin/accounts.php @@ -167,7 +167,7 @@ else if (isset($_REQUEST['search'])) { } $lastDay = 0; - if ($p_days != 0 && $p_days != PHP_INT_MAX) { + if($p_days != 0 && $p_days != OTS_Account::GRATIS_PREMIUM_DAYS) { $lastDay = time(); } else if ($lastDay != 0) { $lastDay = 0;