From 2667d2b41ca17ffab65618665720de40da0caf6c Mon Sep 17 00:00:00 2001 From: Lee <42119604+Leesneaks@users.noreply.github.com> Date: Wed, 26 Dec 2018 10:32:58 +0000 Subject: [PATCH] Updates + Fixes (#66) * Updates +added account editor country list +added account editor website access flag editor. +added player blessing1-8 editor +added fav icon +added $account->setLastLogin +added $player->checkBlessings (for blessings 1-8) +bug fixes * Blessing Fix Should now detect the amount of blessings if blessings1 onwards exists. --- admin/template/template.php | 14 ++-- system/libs/pot/OTS_Account.php | 6 +- system/libs/pot/OTS_Player.php | 32 +++++++- system/pages/admin/accounts.php | 128 +++++++++++++++++-------------- system/pages/admin/logs.php | 2 +- system/pages/admin/players.php | 131 +++++++++++++++++--------------- 6 files changed, 189 insertions(+), 124 deletions(-) diff --git a/admin/template/template.php b/admin/template/template.php index f85b619e..5a1d26ba 100644 --- a/admin/template/template.php +++ b/admin/template/template.php @@ -2,12 +2,18 @@
- + + +' . $message . '
'; @@ -35,6 +38,17 @@ function verify_number($number, $name, $max_length) } $hasCoinsColumn = $db->hasColumn('accounts', 'coins'); +$hasPointsColumn = $db->hasColumn('accounts', 'premium_points'); + +if ($config['account_country']) { + $countries = array(); + foreach (array('pl', 'se', 'br', 'us', 'gb') as $c) + $countries[$c] = $config['countries'][$c]; + + $countries['--'] = '----------'; + foreach ($config['countries'] as $code => $c) + $countries[$code] = $c; +} ?> @@ -69,7 +83,6 @@ else if (isset($_REQUEST['search_name'])) { } } - if ($id > 0) { $account = new OTS_Account(); $account->load($id); @@ -79,10 +92,6 @@ if ($id > 0) { $name = $_POST['name']; $_error = ''; - - //if (!Validator::check_account_name($name)) - // echo_error(Validator::getLastError()); - $account_db = new OTS_Account(); $account_db->find($name); if ($account_db->isLoaded() && $account->getName() != $name) @@ -94,7 +103,6 @@ if ($id > 0) { //type $group = $_POST['group']; - $password = ((!empty($_POST["pass"]) ? $_POST['pass'] : null)); if (!Validator::password($password)) { $errors['password'] = Validator::getLastError(); @@ -104,20 +112,18 @@ if ($id > 0) { $secret = $_POST['secret']; //key $key = $_POST['key']; - $email = $_POST['email']; if (!Validator::email($email)) $errors['email'] = Validator::getLastError(); - // prem days - $p_days = $_POST['p_days']; - verify_number($p_days, 'Prem days', 11); - //tibia coins if ($hasCoinsColumn) { $t_coins = $_POST['t_coins']; verify_number($t_coins, 'Tibia coins', 12); } + // prem days + $p_days = $_POST['p_days']; + verify_number($p_days, 'Prem days', 11); //prem points $p_points = $_POST['p_points']; @@ -132,18 +138,20 @@ if ($id > 0) { //country $rl_country = $_POST['rl_country']; + $web_flags = $_POST['web_flags']; + verify_number($web_flags, 'Web Flags', 1); + //created $created = $_POST['created']; - verify_number($created, 'Created', 20); + verify_number($created, 'Created', 11); //last login $lastlogin = $_POST['lastlogin']; - verify_number($lastlogin, 'Last login', 20); + verify_number($lastlogin, 'Last login', 11); //web last login $web_lastlogin = $_POST['web_lastlogin']; - verify_number($web_lastlogin, 'Web Last logout', 20); - + verify_number($web_lastlogin, 'Web Last logout', 11); if (!$error) { $account->setName($name); @@ -151,18 +159,21 @@ if ($id > 0) { $account->setCustomField('secret', $secret); $account->setCustomField('key', $key); $account->setEMail($email); - $account->setPremDays($p_days); if ($hasCoinsColumn) { $account->setCustomField('coins', $t_coins); } - + $account->setPremDays($p_days); + if ($hasPointsColumn) { + $account->setCustomField('premium_points', $p_points); + } $account->setRLName($rl_name); $account->setLocation($rl_loca); $account->setCountry($rl_country); + $account->setCustomField('created', $created); + $account->setLastLogin($lastlogin); + $account->setWebFlags($web_flags); + $account->setCustomField('web_lastlogin', $web_lastlogin); - if ($db->hasColumn('accounts', 'premium_points')) { - $account->setCustomField('premium_points', $p_points); - } if (isset($password)) { $config_salt_enabled = $db->hasColumn('accounts', 'salt'); @@ -178,9 +189,6 @@ if ($id > 0) { if ($config_salt_enabled) $account->setCustomField('salt', $salt); } - - $account->setEMail($email); - //$account->setCustomField('created', time()); $account->save(); @@ -205,38 +213,22 @@ else if ($id > 0 && isset($account) && $account->isLoaded()) ?> +