mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 17:59:22 +02:00
Fixed account getPremDays() function for latest TFS
This fixes account management + signature
This commit is contained in:
parent
23b44d6c8a
commit
15d381adfd
@ -365,16 +365,14 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
|
|
||||||
public function getPremDays()
|
public function getPremDays()
|
||||||
{
|
{
|
||||||
if(!isset($this->data['lastday']) && !isset($this->data['premend'])) {
|
if(!isset($this->data['lastday']) && !isset($this->data['premend']) && !isset($this->data['premium_ends_at'])) {
|
||||||
throw new E_OTS_NotLoaded();
|
throw new E_OTS_NotLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($this->data['premium_ends_at'])) {
|
if(isset($this->data['premium_ends_at']) || isset($this->data['premend'])) {
|
||||||
return round(($this->data['premium_ends_at'] - time()) / (24 * 60 * 60), 2);
|
$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;
|
||||||
if(isset($this->data['premend'])) {
|
|
||||||
return round(($this->data['premend'] - time()) / (24 * 60 * 60), 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->data['premdays'] == 0) {
|
if($this->data['premdays'] == 0) {
|
||||||
@ -382,8 +380,10 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
|||||||
}
|
}
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
if(isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium'])) return -1;
|
if(isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium'])) return -1;
|
||||||
return $this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday']));
|
|
||||||
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLastLogin()
|
public function getLastLogin()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user