diff --git a/install/tools/5-database.php b/install/tools/5-database.php index e80aba70..8c57f01f 100644 --- a/install/tools/5-database.php +++ b/install/tools/5-database.php @@ -71,13 +71,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' : 'email') . "`;")) success($locale['step_database_adding_field'] . ' accounts.created...'); } @@ -246,4 +241,4 @@ if($db->hasTable('z_forum')) { success($locale['step_database_adding_field'] . ' z_forum.closed...'); } } -} \ No newline at end of file +} diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php index b59f940e..13301e2c 100644 --- a/system/libs/pot/OTS_Account.php +++ b/system/libs/pot/OTS_Account.php @@ -39,7 +39,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(); @@ -187,7 +187,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable } // SELECT query on database - $this->data = $this->db->query('SELECT `id`, ' . ($this->db->hasColumn('accounts', 'name') ? '`name`,' : '') . '`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`, ' . ($this->db->hasColumn('accounts', 'name') ? '`name`,' : '') . '`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; } @@ -282,7 +282,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']); } /** @@ -578,53 +578,6 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable $this->data['email'] = (string) $email; } -/** - * Checks if account is blocked. - * - *

- * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. - *

- * - * @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. - * - *

- * 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. - *

- */ - public function unblock() - { - $this->data['blocked'] = false; - } - -/** - * Blocks account. - * - *

- * This method only updates object state. To save changes in databaseed to use {@link OTS_Account::save() save() method} to flush changed to database. - *

- */ - public function block() - { - $this->data['blocked'] = true; - } - - - /** * Reads custom field. * @@ -1075,9 +1028,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(); @@ -1123,17 +1073,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) {