mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-13 17:24:54 +02:00
Gratis premium account (#156)
* skip premdays and lastdays calculation when premdays = 65535 (gratis premium in TFS) * TFS consider 65535 as gratis premium account and PHP_INT_MAX does not assume this value * adds condition of premdays=65535 and standardize the label "gratis premium account" with tibia client * adjust the label "days" when there is only one day of premium account * adjusted premium account status * Some small adjustment * Sorry, typo. Co-authored-by: slawkens <slawkens@gmail.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user