mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
Remove accounts.blocked
This commit is contained in:
parent
a27f601fe8
commit
6625768228
@ -73,13 +73,8 @@ else {
|
||||
success($locale['step_database_adding_field'] . ' accounts.key...');
|
||||
}
|
||||
|
||||
if(!$db->hasColumn('accounts', 'blocked')) {
|
||||
if(query("ALTER TABLE `accounts` ADD `blocked` TINYINT(1) NOT NULL DEFAULT FALSE COMMENT 'internal usage' AFTER `key`;"))
|
||||
success($locale['step_database_adding_field'] . ' accounts.blocked...');
|
||||
}
|
||||
|
||||
if(!$db->hasColumn('accounts', 'created')) {
|
||||
if(query("ALTER TABLE `accounts` ADD `created` INT(11) NOT NULL DEFAULT 0 AFTER `" . ($db->hasColumn('accounts', 'group_id') ? 'group_id' : 'blocked') . "`;"))
|
||||
if(query("ALTER TABLE `accounts` ADD `created` INT(11) NOT NULL DEFAULT 0 AFTER `" . ($db->hasColumn('accounts', 'group_id') ? 'group_id' : 'key') . "`;"))
|
||||
success($locale['step_database_adding_field'] . ' accounts.created...');
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
* @property string $password Password.
|
||||
* @property string $eMail Email address.
|
||||
* @property int $premiumEnd Timestamp of PACC end.
|
||||
* @property bool $blocked Blocked flag state.
|
||||
* @property bool $deleted Deleted flag state.
|
||||
* @property bool $warned Warned flag state.
|
||||
* @property bool $banned Ban state.
|
||||
@ -39,7 +38,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
* @var array
|
||||
* @version 0.1.5
|
||||
*/
|
||||
private $data = array('email' => '', 'blocked' => false, 'rlname' => '','location' => '', 'country' => '','web_flags' => 0, 'lastday' => 0, 'premdays' => 0, 'created' => 0);
|
||||
private $data = array('email' => '', 'rlname' => '','location' => '', 'country' => '','web_flags' => 0, 'lastday' => 0, 'premdays' => 0, 'created' => 0);
|
||||
|
||||
public static $cache = array();
|
||||
|
||||
@ -246,7 +245,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
}
|
||||
|
||||
// SELECT query on database
|
||||
$this->data = $this->db->query('SELECT `id`, ' . $nameOrNumber . '`password`, `email`, `blocked`, `rlname`, `location`, `country`, `web_flags`, ' . ($this->db->hasColumn('accounts', 'premdays') ? '`premdays`, ' : '') . ($this->db->hasColumn('accounts', 'lastday') ? '`lastday`, ' : ($this->db->hasColumn('accounts', 'premend') ? '`premend`,' : ($this->db->hasColumn('accounts', 'premium_ends_at') ? '`premium_ends_at`,' : ''))) . '`created` FROM `accounts` WHERE `id` = ' . (int) $id)->fetch();
|
||||
$this->data = $this->db->query('SELECT `id`, ' . $nameOrNumber . '`password`, `email`, `rlname`, `location`, `country`, `web_flags`, ' . ($this->db->hasColumn('accounts', 'premdays') ? '`premdays`, ' : '') . ($this->db->hasColumn('accounts', 'lastday') ? '`lastday`, ' : ($this->db->hasColumn('accounts', 'premend') ? '`premend`,' : ($this->db->hasColumn('accounts', 'premium_ends_at') ? '`premium_ends_at`,' : ''))) . '`created` FROM `accounts` WHERE `id` = ' . (int) $id)->fetch();
|
||||
self::$cache[$id] = $this->data;
|
||||
}
|
||||
|
||||
@ -346,7 +345,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
}
|
||||
|
||||
// UPDATE query on database
|
||||
$this->db->exec('UPDATE `accounts` SET ' . ($this->db->hasColumn('accounts', 'name') ? '`name` = ' . $this->db->quote($this->data['name']) . ',' : '') . '`password` = ' . $this->db->quote($this->data['password']) . ', `email` = ' . $this->db->quote($this->data['email']) . ', `blocked` = ' . (int) $this->data['blocked'] . ', `rlname` = ' . $this->db->quote($this->data['rlname']) . ', `location` = ' . $this->db->quote($this->data['location']) . ', `country` = ' . $this->db->quote($this->data['country']) . ', `web_flags` = ' . (int) $this->data['web_flags'] . ', ' . ($this->db->hasColumn('accounts', 'premdays') ? '`premdays` = ' . (int) $this->data['premdays'] . ',' : '') . '`' . $field . '` = ' . (int) $this->data[$field] . ' WHERE `id` = ' . $this->data['id']);
|
||||
$this->db->exec('UPDATE `accounts` SET ' . ($this->db->hasColumn('accounts', 'name') ? '`name` = ' . $this->db->quote($this->data['name']) . ',' : '') . '`password` = ' . $this->db->quote($this->data['password']) . ', `email` = ' . $this->db->quote($this->data['email']) . ', `rlname` = ' . $this->db->quote($this->data['rlname']) . ', `location` = ' . $this->db->quote($this->data['location']) . ', `country` = ' . $this->db->quote($this->data['country']) . ', `web_flags` = ' . (int) $this->data['web_flags'] . ', ' . ($this->db->hasColumn('accounts', 'premdays') ? '`premdays` = ' . (int) $this->data['premdays'] . ',' : '') . '`' . $field . '` = ' . (int) $this->data[$field] . ' WHERE `id` = ' . $this->data['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -651,53 +650,6 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
$this->data['email'] = (string) $email;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if account is blocked.
|
||||
*
|
||||
* <p>
|
||||
* Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING.
|
||||
* </p>
|
||||
*
|
||||
* @version 0.0.3
|
||||
* @return bool Blocked state.
|
||||
* @throws E_OTS_NotLoaded If account is not loaded.
|
||||
*/
|
||||
public function isBlocked()
|
||||
{
|
||||
if( !isset($this->data['blocked']) )
|
||||
{
|
||||
throw new E_OTS_NotLoaded();
|
||||
}
|
||||
|
||||
return $this->data['blocked'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Unblocks account.
|
||||
*
|
||||
* <p>
|
||||
* This method only updates object state. To save changes in database you need to use {@link OTS_Account::save() save() method} to flush changed to database.
|
||||
* </p>
|
||||
*/
|
||||
public function unblock()
|
||||
{
|
||||
$this->data['blocked'] = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocks account.
|
||||
*
|
||||
* <p>
|
||||
* This method only updates object state. To save changes in databaseed to use {@link OTS_Account::save() save() method} to flush changed to database.
|
||||
* </p>
|
||||
*/
|
||||
public function block()
|
||||
{
|
||||
$this->data['blocked'] = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reads custom field.
|
||||
*
|
||||
@ -1148,9 +1100,6 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
case 'playersList':
|
||||
return $this->getPlayersList();
|
||||
|
||||
case 'blocked':
|
||||
return $this->isBlocked();
|
||||
|
||||
case 'deleted':
|
||||
return $this->isDeleted();
|
||||
|
||||
@ -1196,17 +1145,6 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
|
||||
$this->setPremiumEnd($value);
|
||||
break;
|
||||
|
||||
case 'blocked':
|
||||
if($value)
|
||||
{
|
||||
$this->block();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->unblock();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'deleted':
|
||||
if($value)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user