diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php index 94793c71..7e02af32 100644 --- a/system/libs/pot/OTS_Account.php +++ b/system/libs/pot/OTS_Account.php @@ -432,6 +432,11 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable $this->data['lastday'] = (int) $lastlogin; } + public function setWebFlags($webflags) + { + $this->data['web_flags'] = (int) $webflags; + } + /** * Name. * @@ -882,6 +887,32 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable return 0; } + public function getAccGroupId() + { + if(isset($this->data['group_id'])) { + return $this->data['group_id']; + } + + global $db; + if($db->hasColumn('accounts', 'group_id')) { + $query = $this->db->query('SELECT `group_id` FROM `accounts` WHERE `id` = ' . (int) $this->getId())->fetch(); + // if anything was found + if(isset($query['group_id'])) { + $this->data['group_id'] = $query['group_id']; + return $query['group_id']; + } + } + if($db->hasColumn('accounts', 'type')) { + $query = $this->db->query('SELECT `type` FROM `accounts` WHERE `id` = ' . (int) $this->getId())->fetch(); + // if anything was found + if(isset($query['type'])) { + $this->data['type'] = $query['type']; + return $query['type']; + } + } + return 0; + } +/** /** * Checks highest access level of account in given guild. * diff --git a/system/pages/admin/accounts.php b/system/pages/admin/accounts.php index c2973771..a577d5de 100644 --- a/system/pages/admin/accounts.php +++ b/system/pages/admin/accounts.php @@ -39,6 +39,8 @@ function verify_number($number, $name, $max_length) $hasCoinsColumn = $db->hasColumn('accounts', 'coins'); $hasPointsColumn = $db->hasColumn('accounts', 'premium_points'); +$hasTypeColumn = $db->hasColumn('accounts', 'type'); +$hasGroupColumn = $db->hasColumn('accounts', 'group_id'); if ($config['account_country']) { $countries = array(); @@ -82,7 +84,7 @@ else if (isset($_REQUEST['search_name'])) { } } } - +$groups = new OTS_Groups_List(); if ($id > 0) { $account = new OTS_Account(); $account->load($id); @@ -101,7 +103,7 @@ if ($id > 0) { if (!$account_db->isLoaded()) echo_error('Account with this id doesn\'t exist.'); - //type + //type/group $group = $_POST['group']; $password = ((!empty($_POST["pass"]) ? $_POST['pass'] : null)); if (!Validator::password($password)) { @@ -155,7 +157,13 @@ if ($id > 0) { if (!$error) { $account->setName($name); - $account->setCustomField('type', $group); + + if ($hasTypeColumn) { + $account->setCustomField('type', $group); + } elseif ($hasGroupColumn) { + $account->setCustomField('group_id', $group); + } + $account->setCustomField('secret', $secret); $account->setCustomField('key', $key); $account->setEMail($email); @@ -174,7 +182,6 @@ if ($id > 0) { $account->setWebFlags($web_flags); $account->setCustomField('web_lastlogin', $web_lastlogin); - if (isset($password)) { $config_salt_enabled = $db->hasColumn('accounts', 'salt'); if ($config_salt_enabled) { @@ -189,7 +196,6 @@ if ($id > 0) { if ($config_salt_enabled) $account->setCustomField('salt', $salt); } - //$account->setCustomField('created', time()); $account->save(); echo_success('Account saved at: ' . date('G:i')); @@ -208,12 +214,8 @@ else if ($id > 0 && isset($account) && $account->isLoaded()) ?>
- isLoaded()) { - ?> + isLoaded()) { ?> - -
@@ -249,19 +251,36 @@ else if ($id > 0 && isset($account) && $account->isLoaded())
- -
- - -
+ getAccGroupId(); + if ($hasTypeColumn) { + $acc_type = array("Normal", "Tutor", "Senior Tutor", "Gamemaster", "God"); ?> +
+ + +
+ +
+ + +
+
diff --git a/system/pages/admin/login.php b/system/pages/admin/login.php index e0c95e02..7a04be48 100644 --- a/system/pages/admin/login.php +++ b/system/pages/admin/login.php @@ -14,19 +14,13 @@ if ($action == 'logout') { $logout = "You have been logged out!"; } -$search_errors[] = 'Character does not exist or has been deleted.'; - - if (isset($errors)) { foreach ($errors as $error) { error($error); - $twig->display('admin.error.html.twig', array('errors' => $error)); } } - $twig->display('admin.login.html.twig', array( - 'errors' => $search_errors, 'logout' => $logout, 'account' => USE_ACCOUNT_NAME ? 'Name' : 'Number', )); \ No newline at end of file diff --git a/system/pages/admin/players.php b/system/pages/admin/players.php index 37a5d235..5a7508bd 100644 --- a/system/pages/admin/players.php +++ b/system/pages/admin/players.php @@ -584,13 +584,12 @@ else if ($id > 0 && isset($player) && $player->isLoaded())
- +
'; if ($i == 0) echo ''; } - ?>
diff --git a/system/templates/admin.login.html.twig b/system/templates/admin.login.html.twig index def25013..562d9105 100644 --- a/system/templates/admin.login.html.twig +++ b/system/templates/admin.login.html.twig @@ -35,4 +35,4 @@
- + \ No newline at end of file