From eaa11c68f30c8cfea41064a6a7d3de00c2232651 Mon Sep 17 00:00:00 2001 From: Lee <42119604+Leesneaks@users.noreply.github.com> Date: Tue, 31 Mar 2020 02:03:16 +0100 Subject: [PATCH] Admin Panel Updates - Updated Admin Panel to Bootstrap 4. - Code cleanup - Rewrote menu generation code - Added top 10 coins, top 10 premium points, last 10 logins to modules page. - Added full account list to Account editor - Added load outfits from XML to player editor and lists all enabled outfits in editor (will default to textbox if array of outfits do not exist) - Added tabs to account editor - account, characters,store history, bans(this is based off the bans.php page so will not work on TFS 0.2/1.0) - Updated datepickers to display the actual date rather than unix time. - Added last 10 posts to player editor --- admin/template/style.css | 44 - admin/template/template.php | 367 +- system/functions.php | 159 + system/pages/admin/accounts.php | 918 ++-- system/pages/admin/dashboard.php | 40 +- system/pages/admin/logs.php | 55 +- system/pages/admin/menus.php | 101 +- system/pages/admin/modules/balance.php | 6 + system/pages/admin/modules/coins.php | 9 +- system/pages/admin/modules/created.php | 6 + system/pages/admin/modules/lastlogin.php | 10 +- system/pages/admin/modules/points.php | 8 +- .../admin/modules/templates/balance.html.twig | 31 + .../admin/modules/templates/coins.html.twig | 24 +- .../admin/modules/templates/created.html.twig | 31 + .../modules/templates/lastlogin.html.twig | 22 +- .../admin/modules/templates/points.html.twig | 24 +- system/pages/admin/phpinfo.php | 2 +- system/pages/admin/players.php | 1131 ++-- system/pages/admin/reports.php | 43 +- system/pages/bans.php | 113 - system/templates/admin.dashboard.html.twig | 121 +- system/templates/admin.items.html.twig | 4 +- system/templates/admin.login.html.twig | 67 +- system/templates/admin.logs.html.twig | 57 +- system/templates/admin.logs.view.html.twig | 16 +- system/templates/admin.mailer.html.twig | 57 +- system/templates/admin.menus.form.html.twig | 48 +- system/templates/admin.news.form.html.twig | 242 +- system/templates/admin.news.html.twig | 295 +- system/templates/admin.notepad.html.twig | 37 +- system/templates/admin.pages.form.html.twig | 133 +- system/templates/admin.pages.html.twig | 86 +- system/templates/admin.plugins.form.html.twig | 39 +- system/templates/admin.plugins.html.twig | 82 +- system/templates/admin.reports.html.twig | 67 +- system/templates/admin.statistics.html.twig | 27 +- system/templates/admin.visitors.html.twig | 54 +- tools/css/AdminLTE.min.css | 19 +- tools/css/adminlte.min.css.map | 141 +- tools/css/bootstrap.min.css | 7 +- tools/css/bootstrap.min.css.map | 1 - tools/css/font-awesome.min.css | 7 +- tools/css/ionicons.min.css | 11 - tools/css/jquery-ui.min.css | 8 +- tools/css/jquery.dataTables.min.css | 1 - tools/css/skins/skin-blue.css | 142 - tools/css/skins/skin-blue.min.css | 1 - tools/fonts/FontAwesome.otf | Bin 134808 -> 0 bytes tools/fonts/fontawesome-webfont.eot | Bin 165742 -> 0 bytes tools/fonts/fontawesome-webfont.svg | 2671 ---------- tools/fonts/fontawesome-webfont.ttf | Bin 165548 -> 0 bytes tools/fonts/fontawesome-webfont.woff | Bin 98024 -> 0 bytes tools/fonts/fontawesome-webfont.woff2 | Bin 77160 -> 0 bytes tools/fonts/glyphicons-halflings-regular.eot | Bin 20127 -> 0 bytes tools/fonts/glyphicons-halflings-regular.svg | 288 - tools/fonts/glyphicons-halflings-regular.ttf | Bin 45404 -> 0 bytes tools/fonts/glyphicons-halflings-regular.woff | Bin 23424 -> 0 bytes .../fonts/glyphicons-halflings-regular.woff2 | Bin 18028 -> 0 bytes tools/fonts/ionicons.eot | Bin 120724 -> 0 bytes tools/fonts/ionicons.svg | 2230 -------- tools/fonts/ionicons.ttf | Bin 188508 -> 0 bytes tools/fonts/ionicons.woff | Bin 67904 -> 0 bytes tools/js/adminlte.min.js | 21 +- tools/js/adminlte.min.js.map | 1 + tools/js/bootstrap.bundle.min.js | 7 + tools/js/bootstrap.bundle.min.js.map | 1 + tools/js/bootstrap.min.js | 7 - tools/js/jquery-ui.min.js | 22 +- tools/js/jquery.dataTables.min.js | 166 - tools/js/jquery.min.js | 4 +- tools/js/jquery.min.map | 2 +- tools/webfonts/fa-brands-400.eot | Bin 0 -> 130906 bytes tools/webfonts/fa-brands-400.svg | 3496 ++++++++++++ tools/webfonts/fa-brands-400.ttf | Bin 0 -> 130600 bytes tools/webfonts/fa-brands-400.woff | Bin 0 -> 88428 bytes tools/webfonts/fa-brands-400.woff2 | Bin 0 -> 75336 bytes tools/webfonts/fa-regular-400.eot | Bin 0 -> 34394 bytes tools/webfonts/fa-regular-400.svg | 803 +++ tools/webfonts/fa-regular-400.ttf | Bin 0 -> 34096 bytes tools/webfonts/fa-regular-400.woff | Bin 0 -> 16804 bytes tools/webfonts/fa-regular-400.woff2 | Bin 0 -> 13584 bytes tools/webfonts/fa-solid-900.eot | Bin 0 -> 192758 bytes tools/webfonts/fa-solid-900.svg | 4667 +++++++++++++++++ tools/webfonts/fa-solid-900.ttf | Bin 0 -> 192472 bytes tools/webfonts/fa-solid-900.woff | Bin 0 -> 98384 bytes tools/webfonts/fa-solid-900.woff2 | Bin 0 -> 75728 bytes tools/{fonts => webfonts}/index.html | 0 88 files changed, 11220 insertions(+), 8080 deletions(-) create mode 100644 system/pages/admin/modules/balance.php create mode 100644 system/pages/admin/modules/created.php create mode 100644 system/pages/admin/modules/templates/balance.html.twig create mode 100644 system/pages/admin/modules/templates/created.html.twig delete mode 100644 tools/css/bootstrap.min.css.map delete mode 100644 tools/css/ionicons.min.css delete mode 100644 tools/css/jquery.dataTables.min.css delete mode 100644 tools/css/skins/skin-blue.css delete mode 100644 tools/css/skins/skin-blue.min.css delete mode 100644 tools/fonts/FontAwesome.otf delete mode 100644 tools/fonts/fontawesome-webfont.eot delete mode 100644 tools/fonts/fontawesome-webfont.svg delete mode 100644 tools/fonts/fontawesome-webfont.ttf delete mode 100644 tools/fonts/fontawesome-webfont.woff delete mode 100644 tools/fonts/fontawesome-webfont.woff2 delete mode 100644 tools/fonts/glyphicons-halflings-regular.eot delete mode 100644 tools/fonts/glyphicons-halflings-regular.svg delete mode 100644 tools/fonts/glyphicons-halflings-regular.ttf delete mode 100644 tools/fonts/glyphicons-halflings-regular.woff delete mode 100644 tools/fonts/glyphicons-halflings-regular.woff2 delete mode 100644 tools/fonts/ionicons.eot delete mode 100644 tools/fonts/ionicons.svg delete mode 100644 tools/fonts/ionicons.ttf delete mode 100644 tools/fonts/ionicons.woff create mode 100644 tools/js/adminlte.min.js.map create mode 100644 tools/js/bootstrap.bundle.min.js create mode 100644 tools/js/bootstrap.bundle.min.js.map delete mode 100644 tools/js/bootstrap.min.js delete mode 100644 tools/js/jquery.dataTables.min.js create mode 100644 tools/webfonts/fa-brands-400.eot create mode 100644 tools/webfonts/fa-brands-400.svg create mode 100644 tools/webfonts/fa-brands-400.ttf create mode 100644 tools/webfonts/fa-brands-400.woff create mode 100644 tools/webfonts/fa-brands-400.woff2 create mode 100644 tools/webfonts/fa-regular-400.eot create mode 100644 tools/webfonts/fa-regular-400.svg create mode 100644 tools/webfonts/fa-regular-400.ttf create mode 100644 tools/webfonts/fa-regular-400.woff create mode 100644 tools/webfonts/fa-regular-400.woff2 create mode 100644 tools/webfonts/fa-solid-900.eot create mode 100644 tools/webfonts/fa-solid-900.svg create mode 100644 tools/webfonts/fa-solid-900.ttf create mode 100644 tools/webfonts/fa-solid-900.woff create mode 100644 tools/webfonts/fa-solid-900.woff2 rename tools/{fonts => webfonts}/index.html (100%) diff --git a/admin/template/style.css b/admin/template/style.css index c94f27c9..e69de29b 100644 --- a/admin/template/style.css +++ b/admin/template/style.css @@ -1,44 +0,0 @@ -.slidecontainer { - width: 100%; -} - -.slider { - -webkit-appearance: none; - width: 100%; - - outline: none; - opacity: 0.7; - -webkit-transition: .2s; - transition: opacity .2s; -} - -.slider:hover { - opacity: 1; -} - -.slider::-webkit-slider-thumb { - -webkit-appearance: none; - appearance: none; - width: 15px; - height: 25px; - background: #3c8dbc; - cursor: pointer; -} - -.slider::-moz-range-thumb { - width: 25px; - height: 25px; - background: #3c8dbc; - cursor: pointer; -} - -td.details-control { - text-align: center; - color: forestgreen; - cursor: pointer; -} - -tr.shown td.details-control { - text-align: center; - color: red; -} \ No newline at end of file diff --git a/admin/template/template.php b/admin/template/template.php index c25d90d9..db8df386 100644 --- a/admin/template/template.php +++ b/admin/template/template.php @@ -1,229 +1,206 @@ - + - <?php echo $title_full ?> - - - - - - + + - - + - + - -
- -
- - -
- - $query = $db->query('SELECT `name`, `page`, `flags` FROM `' . TABLE_PREFIX . 'admin_menu` ORDER BY `ordering`'); - $menu_db = $query->fetchAll(); - foreach ($menu_db as $item) { - if ($item['flags'] == 0 || hasFlag($item['flags'])) { - echo '
  • "; - echo ' ' . $item['name'] . '
  • '; - } - } - ?> - - - - -
    -
    -

    - - Admin Panel -
    - +
    +
    +
    +
    +
    +

    - Admin Panel

    +
    +
    +
    + +
    +
    +
    -

    -
    -
    - -
    +
    +
    +
    + +
    +
    +
    + + + + - - - -
    - - - - - + + - \ No newline at end of file + diff --git a/system/functions.php b/system/functions.php index 334ce385..e14b5aab 100644 --- a/system/functions.php +++ b/system/functions.php @@ -1221,6 +1221,165 @@ function getCustomPage($page, &$success) return $content; } +function getBanReason($reasonId) +{ + switch($reasonId) + { + case 0: + return "Offensive Name"; + case 1: + return "Invalid Name Format"; + case 2: + return "Unsuitable Name"; + case 3: + return "Name Inciting Rule Violation"; + case 4: + return "Offensive Statement"; + case 5: + return "Spamming"; + case 6: + return "Illegal Advertising"; + case 7: + return "Off-Topic Public Statement"; + case 8: + return "Non-English Public Statement"; + case 9: + return "Inciting Rule Violation"; + case 10: + return "Bug Abuse"; + case 11: + return "Game Weakness Abuse"; + case 12: + return "Using Unofficial Software to Play"; + case 13: + return "Hacking"; + case 14: + return "Multi-Clienting"; + case 15: + return "Account Trading or Sharing"; + case 16: + return "Threatening Gamemaster"; + case 17: + return "Pretending to Have Influence on Rule Enforcement"; + case 18: + return "False Report to Gamemaster"; + case 19: + return "Destructive Behaviour"; + case 20: + return "Excessive Unjustified Player Killing"; + case 21: + return "Invalid Payment"; + case 22: + return "Spoiling Auction"; + } + + return "Unknown Reason"; +} + +function getBanType($typeId) +{ + switch($typeId) + { + case 1: + return "IP Banishment"; + case 2: + return "Namelock"; + case 3: + return "Banishment"; + case 4: + return "Notation"; + case 5: + return "Deletion"; + } + + return "Unknown Type"; +} + +function getPlayerNameByAccount($id) +{ + global $vowels, $ots, $db; + if(is_numeric($id)) + { + $player = new OTS_Player(); + $player->load($id); + if($player->isLoaded()) + return $player->getName(); + else + { + $playerQuery = $db->query('SELECT `id` FROM `players` WHERE `account_id` = ' . $id . ' ORDER BY `lastlogin` DESC LIMIT 1;')->fetch(); + + $tmp = "*Error*"; + /* + $acco = new OTS_Account(); + $acco->load($id); + if(!$acco->isLoaded()) + return "Unknown name"; + + foreach($acco->getPlayersList() as $p) + { + $player= new OTS_Player(); + $player->find($p);*/ + $player->load($playerQuery['id']); + //echo 'id gracza = ' . $p . '
    '; + if($player->isLoaded()) + $tmp = $player->getName(); + // break; + //} + + return $tmp; + } + } + + return ''; +} +function echo_success($message) +{ + echo '
    ' . $message . '
    '; +} + +function echo_error($message) +{ + global $error; + echo '
    ' . $message . '
    '; + $error = true; +} + +function verify_number($number, $name, $max_length) +{ + if (!Validator::number($number)) + echo_error($name . ' can contain only numbers.'); + + $number_length = strlen($number); + if ($number_length <= 0 || $number_length > $max_length) + echo_error($name . ' cannot be longer than ' . $max_length . ' digits.'); +} + +function Outfits_loadfromXML() +{ + global $config; + $file_path = $config['data_path'] . 'XML/outfits.xml'; + if (!file_exists($file_path)) { return null; } + + $xml = new DOMDocument; + $xml->load($file_path); + + $outfits = null; + foreach ($xml->getElementsByTagName('outfit') as $outfit) { + $outfits[] = Outfit_parseNode($outfit); + } + return $outfits; +} + + function Outfit_parseNode($node) { + $looktype = (int)$node->getAttribute('looktype'); + $type = (int)$node->getAttribute('type'); + $lookname = $node->getAttribute('name'); + $premium = $node->getAttribute('premium'); + $unlocked = $node->getAttribute('unlocked'); + $enabled = $node->getAttribute('enabled'); + return array('id' => $looktype, 'type' => $type, 'name' => $lookname, 'premium' => $premium, 'unlocked' => $unlocked, 'enabled' => $enabled); +} + // validator functions require_once LIBS . 'validator.php'; require_once SYSTEM . 'compat.php'; diff --git a/system/pages/admin/accounts.php b/system/pages/admin/accounts.php index 28835768..f0b09dc4 100644 --- a/system/pages/admin/accounts.php +++ b/system/pages/admin/accounts.php @@ -4,39 +4,17 @@ * * @package MyAAC * @author Lee - * @copyright 2019 MyAAC + * @copyright 2020 MyAAC * @link https://my-aac.org */ defined('MYAAC') or die('Direct access not allowed!'); $title = 'Account editor'; -$base = BASE_URL . 'admin/?p=accounts'; +$admin_base = BASE_URL . 'admin/?p=accounts'; if ($config['account_country']) require SYSTEM . 'countries.conf.php'; -function echo_success($message) -{ - echo '

    ' . $message . '

    '; -} - -function echo_error($message) -{ - global $error; - echo '

    ' . $message . '

    '; - $error = true; -} - -function verify_number($number, $name, $max_length) -{ - if (!Validator::number($number)) - echo_error($name . ' can contain only numbers.'); - - $number_length = strlen($number); - if ($number_length <= 0 || $number_length > $max_length) - echo_error($name . ' cannot be longer than ' . $max_length . ' digits.'); -} - $hasSecretColumn = $db->hasColumn('accounts', 'secret'); $hasCoinsColumn = $db->hasColumn('accounts', 'coins'); $hasPointsColumn = $db->hasColumn('accounts', 'premium_points'); @@ -52,6 +30,8 @@ if ($config['account_country']) { foreach ($config['countries'] as $code => $c) $countries[$code] = $c; } +$web_acc = array("None", "Admin", "Super Admin", "(Admin + Super Admin)"); +$acc_type = array("Normal", "Tutor", "Senior Tutor", "Gamemaster", "God"); ?> @@ -59,426 +39,536 @@ if ($config['account_country']) { query('SELECT `id` FROM `accounts` WHERE `name` = ' . $db->quote($_REQUEST['search_name'])); + $query = $db->query('SELECT `id` FROM `accounts` WHERE `name` = ' . $db->quote($search_account)); if ($query->rowCount() == 1) { $query = $query->fetch(); - $id = $query['id']; + $id = (int)$query['id']; } else { - $query = $db->query('SELECT `id`, `name` FROM `accounts` WHERE `name` LIKE ' . $db->quote('%' . $_REQUEST['search_name'] . '%')); + $query = $db->query('SELECT `id`, `name` FROM `accounts` WHERE `name` LIKE ' . $db->quote('%' . $search_account . '%')); if ($query->rowCount() > 0 && $query->rowCount() <= 10) { - echo 'Do you mean?'; + echo_error($str_construct); } else if ($query->rowCount() > 10) - echo 'Specified name resulted with too many accounts.'; + echo_error('Specified name resulted with too many accounts.'); + else + echo_error('No entries found.'); } } } } -$groups = new OTS_Groups_List(); -if ($id > 0) { - $account = new OTS_Account(); - $account->load($id); - - if (isset($account, $_POST['save']) && $account->isLoaded()) {// we want to save - $error = false; - - $_error = ''; - $account_db = new OTS_Account(); - if(USE_ACCOUNT_NAME) { - $name = $_POST['name']; - - $account_db->find($name); - if ($account_db->isLoaded() && $account->getName() != $name) - echo_error('This name is already used. Please choose another name!'); - } - - $account_db->load($id); - if (!$account_db->isLoaded()) - echo_error('Account with this id doesn\'t exist.'); - - //type/group - if($hasTypeColumn || $hasGroupColumn) { - $group = $_POST['group']; - } - - $password = ((!empty($_POST["pass"]) ? $_POST['pass'] : null)); - if (!Validator::password($password)) { - $errors['password'] = Validator::getLastError(); - } - - //secret - if($hasSecretColumn) { - $secret = $_POST['secret']; - } - - //key - $key = $_POST['key']; - $email = $_POST['email']; - if (!Validator::email($email)) - $errors['email'] = Validator::getLastError(); - - //tibia coins - if ($hasCoinsColumn) { - $t_coins = $_POST['t_coins']; - verify_number($t_coins, 'Tibia coins', 12); - } - // prem days - $p_days = (int)$_POST['p_days']; - verify_number($p_days, 'Prem days', 11); - - //prem points - $p_points = $_POST['p_points']; - verify_number($p_points, 'Prem Points', 11); - - //rl name - $rl_name = $_POST['rl_name']; - - //location - $rl_loca = $_POST['rl_loca']; - - //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', 11); - - //web last login - $web_lastlogin = $_POST['web_lastlogin']; - verify_number($web_lastlogin, 'Web Last logout', 11); - - if (!$error) { - if(USE_ACCOUNT_NAME) { - $account->setName($name); - } - - if ($hasTypeColumn) { - $account->setCustomField('type', $group); - } elseif ($hasGroupColumn) { - $account->setCustomField('group_id', $group); - } - - if($hasSecretColumn) { - $account->setCustomField('secret', $secret); - } - $account->setCustomField('key', $key); - $account->setEMail($email); - if ($hasCoinsColumn) { - $account->setCustomField('coins', $t_coins); - } - - $lastDay = 0; - if($p_days != 0 && $p_days != PHP_INT_MAX ) { - $lastDay = time(); - } else if ($lastDay != 0) { - $lastDay = 0; - } - - $account->setPremDays($p_days); - $account->setLastLogin($lastDay); - 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->setWebFlags($web_flags); - $account->setCustomField('web_lastlogin', $web_lastlogin); - - if (isset($password)) { - $config_salt_enabled = $db->hasColumn('accounts', 'salt'); - if ($config_salt_enabled) { - $salt = generateRandomString(10, false, true, true); - $password = $salt . $password; - $account_logged->setCustomField('salt', $salt); - } - - $password = encrypt($password); - $account->setPassword($password); - - if ($config_salt_enabled) - $account->setCustomField('salt', $salt); - } - - $account->save(); - echo_success('Account saved at: ' . date('G:i')); - } - } -} - -$search_account = ''; -if (isset($_REQUEST['search_name'])) - $search_account = $_REQUEST['search_name']; -else if (isset($_REQUEST['search_account'])) - $search_account = $_REQUEST['search_account']; -else if ($id > 0 && isset($account) && $account->isLoaded()) { - if(USE_ACCOUNT_NAME) { - $search_account = $account->getName(); - } - else { - $search_account = $account->getId(); - } -} - ?>
    - isLoaded()) { ?> - -
    -
    -
    -
    -
    - -
    - - -
    - -
    - -
    - - - - -
    -
    -
    - - -
    -
    -
    - getAccGroupId(); - if ($hasTypeColumn) { - $acc_type = array("Normal", "Tutor", "Senior Tutor", "Gamemaster", "God"); ?> -
    - - -
    - -
    - - -
    - -
    - - -
    -
    -
    - -
    - - -
    - -
    - - -
    -
    -
    -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    -
    -
    - - -
    -
    - - -
    -
    - - - - -
    -
    - -
    - -
    -
    -
    -

    Search Account:

    -
    - -
    -
    - -
    -
    -
    - - - - -
    -
    -
    -
    isLoaded()) { - $account_players = array(); - $query = $db->query('SELECT `name`,`level`,`vocation` FROM `players` WHERE `account_id` = ' . $account->getId() . ' ORDER BY `name`')->fetchAll(); - if (isset($query)) { - ?> -
    -
    -

    Character List:

    + $groups = new OTS_Groups_List(); + if ($id > 0) { + $account = new OTS_Account(); + $account->load($id); + + if (isset($account, $_POST['save']) && $account->isLoaded()) { + $error = false; + + $_error = ''; + $account_db = new OTS_Account(); + if (USE_ACCOUNT_NAME) { + $name = $_POST['name']; + + $account_db->find($name); + if ($account_db->isLoaded() && $account->getName() != $name) + echo_error('This name is already used. Please choose another name!'); + } + + $account_db->load($id); + if (!$account_db->isLoaded()) + echo_error('Account with this id doesn\'t exist.'); + + //type/group + if ($hasTypeColumn || $hasGroupColumn) { + $group = $_POST['group']; + } + + $password = ((!empty($_POST["pass"]) ? $_POST['pass'] : null)); + if (!Validator::password($password)) { + $errors['password'] = Validator::getLastError(); + } + + //secret + if ($hasSecretColumn) { + $secret = $_POST['secret']; + } + + //key + $key = $_POST['key']; + $email = $_POST['email']; + if (!Validator::email($email)) + $errors['email'] = Validator::getLastError(); + + //tibia coins + if ($hasCoinsColumn) { + $t_coins = $_POST['t_coins']; + verify_number($t_coins, 'Tibia coins', 12); + } + // prem days + $p_days = (int)$_POST['p_days']; + verify_number($p_days, 'Prem days', 11); + + //prem points + $p_points = $_POST['p_points']; + verify_number($p_points, 'Prem Points', 11); + + //rl name + $rl_name = $_POST['rl_name']; + + //location + $rl_loca = $_POST['rl_loca']; + + //country + $rl_country = $_POST['rl_country']; + + $web_flags = $_POST['web_flags']; + verify_number($web_flags, 'Web Flags', 1); + + //created + $created = strtotime($_POST['created']); + verify_number($created, 'Created', 11); + + //web last login + $web_lastlogin = strtotime($_POST['web_lastlogin']); + verify_number($web_lastlogin, 'Web Last login', 11); + + if (!$error) { + if (USE_ACCOUNT_NAME) { + $account->setName($name); + } + + if ($hasTypeColumn) { + $account->setCustomField('type', $group); + } elseif ($hasGroupColumn) { + $account->setCustomField('group_id', $group); + } + + if ($hasSecretColumn) { + $account->setCustomField('secret', $secret); + } + $account->setCustomField('key', $key); + $account->setEMail($email); + if ($hasCoinsColumn) { + $account->setCustomField('coins', $t_coins); + } + + $lastDay = 0; + if ($p_days != 0 && $p_days != PHP_INT_MAX) { + $lastDay = time(); + } else if ($lastDay != 0) { + $lastDay = 0; + } + + $account->setPremDays($p_days); + $account->setLastLogin($lastDay); + 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->setWebFlags($web_flags); + $account->setCustomField('web_lastlogin', $web_lastlogin); + + if (isset($password)) { + $config_salt_enabled = $db->hasColumn('accounts', 'salt'); + if ($config_salt_enabled) { + $salt = generateRandomString(10, false, true, true); + $password = $salt . $password; + $account->setCustomField('salt', $salt); + } + + $password = encrypt($password); + $account->setPassword($password); + + if ($config_salt_enabled) + $account->setCustomField('salt', $salt); + } + + $account->save(); + echo_success('Account saved at: ' . date('G:i')); + } + } + } else if ($id == 0) { + $accounts_db = $db->query('SELECT `id`, `name`,`type` FROM `accounts` ORDER BY `id` DESC LIMIT 10;'); + ?> +
    +
    +
    +
    Accounts
    -
    - - +
    +
    + - + - + - - - - - - '; - $i++; - } ?> + + + + + + + + + +
    #ID NameLevelPosition Edit
    ' . $i . '.' . $p['name'] . '' . $p['level'] . '
    + + +
    +
    + - isLoaded()) { ?> +
    +
    +
    + +
    +
    +
    +
    +
    +
    + +
    + + +
    + +
    +
    + + +
    +
    + +
    +
    +
    + + +
    +
    +
    + getAccGroupId(); + if ($hasTypeColumn) { + ?> +
    + + +
    + +
    + + +
    + +
    + + +
    +
    +
    + +
    + + +
    + +
    + + +
    +
    +
    +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    +
    + + getCustomField('created')); ?>"/> +
    +
    + + getCustomField('web_lastlogin')); ?>"/> +
    +
    + + + + + Cancel +
    +
    +
    +
    + isLoaded()) { + $account_players = $account->getPlayersList(); + $account_players->orderBy('id'); + if (isset($account_players)) { ?> + + + + + + + + + + + + $player): + $player_vocation = $player->getVocation(); + $player_promotion = $player->getPromotion(); + if (isset($player_promotion)) { + if ((int)$player_promotion > 0) + $player_vocation += ($player_promotion * $config['vocations_amount']); + } + + if (isset($config['vocations'][$player_vocation])) { + $vocation_name = $config['vocations'][$player_vocation]; + } ?> + + + + + + + + + +
    #NameLevelVocationEdit
    getName(); ?>getLevel(); ?>
    + +
    +
    + +
    + query('SELECT * FROM ' . $db->tableName('bans') . ' WHERE ' . $db->fieldName('active') . ' = 1 AND ' . $db->fieldName('id') . ' = ' . $account->getId() . ' ORDER BY ' . $db->fieldName('added') . ' DESC'); + if ($bans->rowCount()) { + ?> + + + + + + + + + + + + + 100) { + $next_page = true; + break; + } + ?> + + + + + + + + + + +
    NickTypeExpiresReasonCommentAdded by:
    ' . $pName . ''; ?> + + ' . date("d M Y", $ban['expires']); + ?> + + ' . $aName . ''; + echo '
    ' . date("d.m.Y", $ban['added']); + ?> +
    + +
    + hasTable('store_history')) { ?> +
    + query('SELECT * FROM `store_history` WHERE `account_id` = "' . $account->getId() . '" ORDER BY `time` DESC')->fetchAll(); ?> + + + + + + + + + + + + + + + + + +
    DescriptionCoinsDate
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    Search Accounts
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    - - diff --git a/system/pages/admin/dashboard.php b/system/pages/admin/dashboard.php index 45965cfe..85925ae7 100644 --- a/system/pages/admin/dashboard.php +++ b/system/pages/admin/dashboard.php @@ -19,8 +19,10 @@ if (isset($_GET['clear_cache'])) { } if (isset($_GET['maintenance'])) { - $_status = (int)$_POST['status']; - $message = $_POST['message']; + $message = (!empty($_POST['message']) ? $_POST['message'] : null); + $_status = (isset($_POST['status']) && $_POST['status'] == 'true'); + $_status = ($_status ? '0' : '1'); + if (empty($message)) { error('Message cannot be empty.'); } else if (strlen($message) > 255) { @@ -45,29 +47,17 @@ $tmp = ''; if (fetchDatabaseConfig('site_closed_message', $tmp)) $closed_message = $tmp; -$query = $db->query('SELECT count(*) as `how_much` FROM `accounts`;'); -$query = $query->fetch(); -$total_accounts = $query['how_much']; - -$query = $db->query('SELECT count(*) as `how_much` FROM `players`;'); -$query = $query->fetch(); -$total_players = $query['how_much']; - -$query = $db->query('SELECT count(*) as `how_much` FROM `guilds`;'); -$query = $query->fetch(); -$total_guilds = $query['how_much']; - -$query = $db->query('SELECT count(*) as `how_much` FROM `houses`;'); -$query = $query->fetch(); -$total_houses = $query['how_much']; +$query_count = $db->query('SELECT + (SELECT COUNT(*) FROM accounts) as total_accounts, + (SELECT COUNT(*) FROM players) as total_players, + (SELECT COUNT(*) FROM guilds) as total_guilds, + (SELECT COUNT(*) FROM houses) as total_houses;')->fetch(); $twig->display('admin.statistics.html.twig', array( - 'total_accounts' => $total_accounts, - 'total_players' => $total_players, - 'total_guilds' => $total_guilds, - 'total_houses' => $total_houses + 'count' => $query_count, )); +echo '
    '; $twig->display('admin.dashboard.html.twig', array( 'is_closed' => $is_closed, 'closed_message' => $closed_message, @@ -75,16 +65,14 @@ $twig->display('admin.dashboard.html.twig', array( 'account_type' => USE_ACCOUNT_NAME ? 'name' : 'number' )); -echo '
    '; - $configAdminPanelModules = config('admin_panel_modules'); -if(isset($configAdminPanelModules)) +if (isset($configAdminPanelModules)) $configAdminPanelModules = explode(',', $configAdminPanelModules); $twig_loader->prependPath(__DIR__ . '/modules/templates'); -foreach($configAdminPanelModules as $box) { +foreach ($configAdminPanelModules as $box) { $file = __DIR__ . '/modules/' . $box . '.php'; - if(file_exists($file)) { + if (file_exists($file)) { include($file); } } diff --git a/system/pages/admin/logs.php b/system/pages/admin/logs.php index f7c0e6d8..10869306 100644 --- a/system/pages/admin/logs.php +++ b/system/pages/admin/logs.php @@ -4,7 +4,7 @@ * * @package MyAAC * @author Slawkens - * @copyright 2019 MyAAC + * @copyright 2020 MyAAC * @link https://my-aac.org */ defined('MYAAC') or die('Direct access not allowed!'); @@ -13,47 +13,46 @@ $title = 'Logs Viewer'; $files = array(); $aac_path_logs = BASE . 'system/logs/'; foreach (scandir($aac_path_logs, SCANDIR_SORT_ASCENDING) as $f) { - if ($f[0] === '.' || is_dir($aac_path_logs . $f)) { - continue; - } + if ($f[0] === '.' || is_dir($aac_path_logs . $f)) { + continue; + } - $files[] = array($f, $aac_path_logs); + $files[] = array($f, $aac_path_logs); } $server_path_logs = $config['server_path'] . 'logs/'; if (!file_exists($server_path_logs)) { - $server_path_logs = $config['data_path'] . 'logs/'; + $server_path_logs = $config['data_path'] . 'logs/'; } if (file_exists($server_path_logs)) { - foreach (scandir($server_path_logs, SCANDIR_SORT_ASCENDING) as $f) { - if ($f[0] === '.') { - continue; - } + foreach (scandir($server_path_logs, SCANDIR_SORT_ASCENDING) as $f) { + if ($f[0] === '.') { + continue; + } - if (is_dir($server_path_logs . $f)) { - foreach (scandir($server_path_logs . $f, SCANDIR_SORT_ASCENDING) as $f2) { - if ($f2[0] === '.') { - continue; - } + if (is_dir($server_path_logs . $f)) { + foreach (scandir($server_path_logs . $f, SCANDIR_SORT_ASCENDING) as $f2) { + if ($f2[0] === '.') { + continue; + } - $files[] = array($f . '/' . $f2, $server_path_logs); - } + $files[] = array($f . '/' . $f2, $server_path_logs); + } - continue; - } + continue; + } - $files[] = array($f, $server_path_logs); - } + $files[] = array($f, $server_path_logs); + } } foreach ($files as &$f) { - $f['mtime'] = filemtime($f[1] . $f[0]); - $f['name'] = $f[0]; + $f['mtime'] = filemtime($f[1] . $f[0]); + $f['name'] = $f[0]; } unset($f); -$twig->display('admin.logs.html.twig', array('files' => $files)); define('EXIST_NONE', 0); define('EXIST_SERVER_LOG', 1); @@ -72,10 +71,12 @@ if (!empty($file)) { } if ($exist !== EXIST_NONE) { - $content = nl2br(file_get_contents(($exist === EXIST_SERVER_LOG ? $server_path_logs : $aac_path_logs) . $file)); - $twig->display('admin.logs.view.html.twig', array('file' => $file, 'content' => $content)); + $file_content = nl2br(file_get_contents(($exist === EXIST_SERVER_LOG ? $server_path_logs : $aac_path_logs) . $file)); + $twig->display('admin.logs.view.html.twig', array('file' => $file, 'content' => $file_content)); } } else { echo 'Invalid file name specified.'; } -} \ No newline at end of file +} + +$twig->display('admin.logs.html.twig', array('files' => $files)); diff --git a/system/pages/admin/menus.php b/system/pages/admin/menus.php index 7562d20f..511d991d 100644 --- a/system/pages/admin/menus.php +++ b/system/pages/admin/menus.php @@ -46,7 +46,6 @@ if (isset($_REQUEST['template'])) { if ($cache->enabled()) { $cache->delete('template_menus'); } - success('Saved at ' . date('H:i')); } @@ -57,70 +56,70 @@ if (isset($_REQUEST['template'])) { echo 'Cannot find template config.php file.'; return; } - if (!isset($config['menu_categories'])) { echo "No menu categories set in template config.php.
    This template doesn't support dynamic menus."; return; } - - echo 'Hint: You can drag menu items.
    - Hint: Add links to external sites using: http:// or https:// prefix.
    - Not all templates support blank and colorful links.

    -
    '; + ?> +
    +

    Hint: You can drag menu items.
    + Hint: Add links to external sites using: http:// or https:// prefix.
    + Not all templates support blank and colorful links. +

    +
    + query('SELECT `name`, `link`, `blank`, `color`, `category`, `ordering` FROM `' . TABLE_PREFIX . 'menu` WHERE `enabled` = 1 AND `template` = ' . $db->quote($template) . ' ORDER BY `ordering` ASC;')->fetchAll(); foreach ($menus_db as $menu) { $menus[$menu['category']][] = array('name' => $menu['name'], 'link' => $menu['link'], 'blank' => $menu['blank'], 'color' => $menu['color'], 'ordering' => $menu['ordering']); } - $last_id = array(); - echo '
    '; - echo ''; - echo ''; - echo '
    '; - echo ''; - + ?> + + display('admin.menus.js.html.twig', array( 'menus' => $menus, 'last_id' => $last_id )); ?> - query('SELECT `template` FROM `' . TABLE_PREFIX . 'menu` GROUP BY `template`;')->fetchAll(); @@ -134,4 +133,4 @@ if (isset($_REQUEST['template'])) { $twig->display('admin.menus.form.html.twig', array( 'templates' => $templates )); -} \ No newline at end of file +} diff --git a/system/pages/admin/modules/balance.php b/system/pages/admin/modules/balance.php new file mode 100644 index 00000000..5a2700a1 --- /dev/null +++ b/system/pages/admin/modules/balance.php @@ -0,0 +1,6 @@ +hasColumn('players', 'balance') ? $db->query('SELECT `balance`, `id`, `name`,`level` FROM `players` ORDER BY `balance` DESC LIMIT 10;') : 0); + +$twig->display('balance.html.twig', array( + 'balance' => $balance +)); diff --git a/system/pages/admin/modules/coins.php b/system/pages/admin/modules/coins.php index 3dbc19c8..3bb0bc61 100644 --- a/system/pages/admin/modules/coins.php +++ b/system/pages/admin/modules/coins.php @@ -1,11 +1,6 @@ hasColumn('accounts', 'coins')) { - $coins = $db->query('SELECT `coins`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `coins` DESC LIMIT 10;'); -} else { - $coins = 0; -} +$coins = ($db->hasColumn('accounts', 'coins') ? $db->query('SELECT `coins`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `coins` DESC LIMIT 10;') : 0); $twig->display('coins.html.twig', array( 'coins' => $coins -)); \ No newline at end of file +)); diff --git a/system/pages/admin/modules/created.php b/system/pages/admin/modules/created.php new file mode 100644 index 00000000..8a375c3a --- /dev/null +++ b/system/pages/admin/modules/created.php @@ -0,0 +1,6 @@ +hasColumn('accounts', 'created') ? $db->query('SELECT `created`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `created` DESC LIMIT 10;') : 0); + +$twig->display('created.html.twig', array( + 'players' => $players, +)); diff --git a/system/pages/admin/modules/lastlogin.php b/system/pages/admin/modules/lastlogin.php index e31fe243..d7a3f43f 100644 --- a/system/pages/admin/modules/lastlogin.php +++ b/system/pages/admin/modules/lastlogin.php @@ -1,11 +1,5 @@ hasColumn('players', 'lastlogin')) { - $players = $db->query('SELECT name, level, lastlogin FROM players ORDER BY lastlogin DESC LIMIT 10;'); -} else { - $players = 0; -} - +$players = ($db->hasColumn('players', 'lastlogin') ? $db->query('SELECT name, level, lastlogin FROM players ORDER BY lastlogin DESC LIMIT 10;') : 0); $twig->display('lastlogin.html.twig', array( 'players' => $players, -)); \ No newline at end of file +)); diff --git a/system/pages/admin/modules/points.php b/system/pages/admin/modules/points.php index e5040f53..d1c4b0f3 100644 --- a/system/pages/admin/modules/points.php +++ b/system/pages/admin/modules/points.php @@ -1,10 +1,6 @@ hasColumn('accounts', 'premium_points')) { - $points = $db->query('SELECT `premium_points`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `premium_points` DESC LIMIT 10;'); -} else { - $points = 0; -} +$points = ($db->hasColumn('accounts', 'premium_points') ? $db->query('SELECT `premium_points`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `premium_points` DESC LIMIT 10;') : 0); $twig->display('points.html.twig', array( 'points' => $points, -)); \ No newline at end of file +)); diff --git a/system/pages/admin/modules/templates/balance.html.twig b/system/pages/admin/modules/templates/balance.html.twig new file mode 100644 index 00000000..70f0dc62 --- /dev/null +++ b/system/pages/admin/modules/templates/balance.html.twig @@ -0,0 +1,31 @@ +{% if balance is iterable %} +
    +
    +
    +
    Top 10 - Balance
    +
    +
    + + + + + + + + + + {% set i = 0 %} + {% for result in balance %} + {% set i = i + 1 %} + + + + + + {% endfor %} + +
    #PlayerBalance
    {{ i }}{{ result.name }}{{ result.balance }}
    +
    +
    +
    +{% endif %} diff --git a/system/pages/admin/modules/templates/coins.html.twig b/system/pages/admin/modules/templates/coins.html.twig index e5183443..a822dfd5 100644 --- a/system/pages/admin/modules/templates/coins.html.twig +++ b/system/pages/admin/modules/templates/coins.html.twig @@ -1,23 +1,25 @@ {% if coins is iterable %} -
    -
    -
    -

    Top 10 - Most coins

    +
    +
    +
    +
    Top 10 - Most coins
    -
    - - +
    +
    + - + + + {% set i = 0 %} {% for result in coins %} {% set i = i + 1 %} - - + + {% endfor %} @@ -26,4 +28,4 @@ -{% endif %} \ No newline at end of file +{% endif %} diff --git a/system/pages/admin/modules/templates/created.html.twig b/system/pages/admin/modules/templates/created.html.twig new file mode 100644 index 00000000..352b3f52 --- /dev/null +++ b/system/pages/admin/modules/templates/created.html.twig @@ -0,0 +1,31 @@ +{% if players is iterable %} +
    +
    +
    +
    Last 10 created
    +
    +
    +
    #Account {{ account_type }}Account Tibia coins
    {{ i }}{{ result.name }}{{ i }}{{ result.name }} {{ result.coins }}
    + + + + + + + + + {% set i = 0 %} + {% for result in players %} + {% set i = i + 1 %} + + + + + + {% endfor %} + +
    #AccountCreation Date
    {{ i }}{{ result.name }}{{ result.created|date("M d Y, H:i:s") }}
    +
    +
    +
    +{% endif %} diff --git a/system/pages/admin/modules/templates/lastlogin.html.twig b/system/pages/admin/modules/templates/lastlogin.html.twig index 62d6fbc5..4127671d 100644 --- a/system/pages/admin/modules/templates/lastlogin.html.twig +++ b/system/pages/admin/modules/templates/lastlogin.html.twig @@ -1,23 +1,25 @@ {% if players is iterable %} -
    -
    -
    -

    Last 10 Logins

    +
    +
    +
    +
    Last 10 logins
    -
    - - +
    +
    + + + {% set i = 0 %} {% for result in players %} {% set i = i + 1 %} - - + + {% endfor %} @@ -26,4 +28,4 @@ -{% endif %} \ No newline at end of file +{% endif %} diff --git a/system/pages/admin/modules/templates/points.html.twig b/system/pages/admin/modules/templates/points.html.twig index acdcd390..019a9964 100644 --- a/system/pages/admin/modules/templates/points.html.twig +++ b/system/pages/admin/modules/templates/points.html.twig @@ -1,23 +1,25 @@ {% if points is iterable %} -
    -
    -
    -

    Top 10 - Most premium points

    +
    +
    +
    +
    Top 10 - Most premium points
    -
    -
    # Player Login Date
    {{ i }}{{ result.name }}{{ i }}{{ result.name }} {{ result.lastlogin|date("M d Y, H:i:s") }}
    - +
    +
    + - + + + {% set i = 0 %} {% for result in points %} {% set i = i + 1 %} - - + + {% endfor %} @@ -26,4 +28,4 @@ -{% endif %} \ No newline at end of file +{% endif %} diff --git a/system/pages/admin/phpinfo.php b/system/pages/admin/phpinfo.php index e7fedad0..bc747a2d 100644 --- a/system/pages/admin/phpinfo.php +++ b/system/pages/admin/phpinfo.php @@ -16,4 +16,4 @@ if (!function_exists('phpinfo')) { ?> - diff --git a/system/pages/admin/players.php b/system/pages/admin/players.php index 826d749f..812f1065 100644 --- a/system/pages/admin/players.php +++ b/system/pages/admin/players.php @@ -10,29 +10,9 @@ defined('MYAAC') or die('Direct access not allowed!'); $title = 'Player editor'; -$base = BASE_URL . 'admin/?p=players'; +$player_base = BASE_URL . 'admin/?p=players'; -function echo_success($message) -{ - echo '

    ' . $message . '

    '; -} - -function echo_error($message) -{ - global $error; - echo '

    ' . $message . '

    '; - $error = true; -} - -function verify_number($number, $name, $max_length) -{ - if (!Validator::number($number)) - echo_error($name . ' can contain only numbers.'); - - $number_length = strlen($number); - if ($number_length <= 0 || $number_length > $max_length) - echo_error($name . ' cannot be longer than ' . $max_length . ' digits.'); -} +require_once LIBS . 'forum.php'; $skills = array( POT::SKILL_FIST => array('Fist fighting', 'fist'), @@ -44,10 +24,11 @@ $skills = array( POT::SKILL_FISH => array('Fishing', 'fish') ); - $hasBlessingsColumn = $db->hasColumn('players', 'blessings'); $hasBlessingColumn = $db->hasColumn('players', 'blessings1'); $hasLookAddons = $db->hasColumn('players', 'lookaddons'); + +$skull_type = array("None", "Yellow", "Green", "White", "Red", "Black", "Orange"); ?> @@ -55,28 +36,33 @@ $hasLookAddons = $db->hasColumn('players', 'lookaddons'); query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote($_REQUEST['search_name'])); + $query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote($search_player)); if ($query->rowCount() == 1) { $query = $query->fetch(); - $id = $query['id']; + $id = (int)$query['id']; } else { - $query = $db->query('SELECT `id`, `name` FROM `players` WHERE `name` LIKE ' . $db->quote('%' . $_REQUEST['search_name'] . '%')); + $query = $db->query('SELECT `id`, `name` FROM `players` WHERE `name` LIKE ' . $db->quote('%' . $search_player . '%')); if ($query->rowCount() > 0 && $query->rowCount() <= 10) { - echo 'Do you mean?'; + echo_error($str_construct); } else if ($query->rowCount() > 10) - echo 'Specified name resulted with too many players.'; + echo_error('Specified name resulted with too many players.'); + else + echo_error('No entries found.'); } } } @@ -173,6 +159,7 @@ if ($id > 0) { $soul = $_POST['soul']; verify_number($soul, 'Soul', 10); + $town = $_POST['town']; verify_number($town, 'Town', 11); @@ -181,9 +168,9 @@ if ($id > 0) { $sex = $_POST['sex']; verify_number($sex, 'Sex', 1); - $lastlogin = $_POST['lastlogin']; + $lastlogin = strtotime($_POST['lastlogin']); verify_number($lastlogin, 'Last login', 20); - $lastlogout = $_POST['lastlogout']; + $lastlogout = strtotime($_POST['lastlogout']); verify_number($lastlogout, 'Last logout', 20); $skull = $_POST['skull']; @@ -223,7 +210,7 @@ if ($id > 0) { $deleted = (isset($_POST['deleted']) && $_POST['deleted'] == 'true'); $hidden = (isset($_POST['hidden']) && $_POST['hidden'] == 'true'); - $created = $_POST['created']; + $created = strtotime($_POST['created']); verify_number($created, 'Created', 11); $comment = isset($_POST['comment']) ? htmlspecialchars(stripslashes(substr($_POST['comment'], 0, 2000))) : NULL; @@ -234,7 +221,7 @@ if ($id > 0) { verify_number($value, $skills[$skill][0] . ' tries', 10); if ($hasBlessingColumn) { - $bless_count = $_POST['blesscount']; + $bless_count = $_POST['blesscount']; for ($i = 1; $i <= $bless_count; $i++) { $a = 'blessing' . $i; ${'blessing' . $i} = (isset($_POST[$a]) && $_POST[$a] == 'true'); @@ -311,589 +298,547 @@ if ($id > 0) { } $player->save(); echo_success('Player saved at: ' . date('G:i')); + $player->load($id); } } } - -$search_name = ''; -if (isset($_REQUEST['search_name'])) - $search_name = $_REQUEST['search_name']; -else if ($id > 0 && isset($player) && $player->isLoaded()) - $search_name = $player->getName(); - ?>
    - isLoaded()) { $account = $player->getAccount(); ?> - -
    -
    -
    -
    -
    -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    -
    -
    - - -
    - -
    - - -
    - -
    - -
    -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - hasColumn('players', 'loss_experience')): ?> -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - - -
    +
    + countBlessings(); + $bless = $player->checkBlessings($bless_count); ?> + +
    +
    + + +
    -
    -
    - - - [max. - length: 2000 chars, 50 lines (ENTERs)] - + +
    + + +
    + +
    + + +
    +
    +
    +
    +
    + getCustomField($db->hasColumn('players', 'deletion') ? 'deletion' : 'deleted') == '1' ? ' checked' : ''); ?>> + +
    +
    +
    +
    + isHidden() ? ' checked' : ''); ?>> +
    -
    -
    - - -
    - - - -
    -
    -
    -

    Search Player:

    -
    - -
    -
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    + + +
    +
    + + +
    + hasColumn('players', 'stamina')): ?> +
    + + +
    + + hasColumn('players', 'offlinetraining_time')): ?> +
    + + +
    + +
    +
    +
    + $info) { + ?> +
    +
    + ' . $info[0] . ' + '; ?> +
    +
    + ' . $info[0] . ' tries + '; ?> +
    +
    + +
    +
    + getLookType() . ($hasLookAddons ? '&addons=' . $player->getLookAddons() : '') . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet(); ?> +
    + player outfit +
    +
    +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    +
    + + + + + + +
    + +
    + + +
    + +
    + +
    +
    +
    + + getCustomField('created')); ?>"/> +
    +
    + + getLastLogin()); ?>"/> +
    +
    + + getLastLogout()); ?>"/> +
    +
    + + +
    +
    + hasColumn('players', 'loss_experience')): ?> +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + +
    +
    + + + [max. length: 2000 chars, 50 lines (ENTERs)] +
    +
    +
    +
    +
    #Account {{ account_type }}Account Premium points
    {{ i }}{{ result.name }}{{ i }}{{ result.name }} {{ result.premium_points }}
    Position:Look:Position:Look:
    + + + + + + + + query('SELECT `author_guid`,`section`,`first_post`,`post_text`,`post_date`, `post_topic`,`post_html`,`post_smile`,`' . TABLE_PREFIX . 'forum_boards`.`name` AS `forum_Name` FROM `' . + TABLE_PREFIX . 'forum` LEFT JOIN `' . TABLE_PREFIX . 'forum_boards` ON `' . + TABLE_PREFIX . 'forum`.section = `' . TABLE_PREFIX . 'forum_boards`.id WHERE `author_guid` = "' . $player->getId() . '" ORDER BY `post_date` DESC LIMIT 10'); + if ($posts->rowCount() > 0) { + $posts = $posts->fetchAll(); + foreach ($posts as $post) { + $text = ($post['post_html'] > 0 ? $post['post_text'] : htmlspecialchars($post['post_text'])); + $post['content'] = ($post['post_html'] > 0 ? $text : Forum::parseBBCode(nl2br($text), $post['post_smile'] == 0)); + ?> + + + + + '; + }; ?> + +
    TopicContent


    + Topic: Link
    + Forum:
    This user has no posts
    +
    +
    +
    + isLoaded()) { + $account_players = $account->getPlayersList(); + $account_players->orderBy('id'); + if (isset($account_players)) { ?> + + + + + + + + + + + + $player): + $player_vocation = $player->getVocation(); + $player_promotion = $player->getPromotion(); + if (isset($player_promotion)) { + if ((int)$player_promotion > 0) + $player_vocation += ($player_promotion * $config['vocations_amount']); + } -
    -
    -
    - - - - + if (isset($config['vocations'][$player_vocation])) { + $vocation_name = $config['vocations'][$player_vocation]; + } ?> +
    + + + + + + + + +
    #NameLevelVocationEdit
    getName(); ?>getLevel(); ?>
    + +
    +
    +
    +
    +
    - isLoaded()) { - $account_players = array(); - $query = $db->query('SELECT `name`,`level`,`vocation` FROM `players` WHERE `account_id` = ' . $account->getId() . ' ORDER BY `name`')->fetchAll(); - if (isset($query)) { - ?> -
    -
    -

    Character List:

    + + + +
    +
    +
    +
    Search Player
    +
    +
    +
    +
    + + + +
    -
    - - - - - - - - - - - - - - '; - $i++; - } ?> - -
    #NameLevelEdit
    ' . $i . '.' . $p['name'] . '' . $p['level'] . '
    -
    -
    - + +
    +
    - - - \ No newline at end of file +
    diff --git a/system/pages/admin/reports.php b/system/pages/admin/reports.php index 821656b2..3c5f466e 100644 --- a/system/pages/admin/reports.php +++ b/system/pages/admin/reports.php @@ -4,7 +4,7 @@ * * @package MyAAC * @author Lee - * @copyright 2019 MyAAC + * @copyright 2020 MyAAC * @link https://my-aac.org */ defined('MYAAC') or die('Direct access not allowed!'); @@ -14,25 +14,25 @@ $files = array(); $server_path_reports = $config['data_path'] . 'reports/'; if (file_exists($server_path_reports)) { - foreach (scandir($server_path_reports, SCANDIR_SORT_ASCENDING) as $f) { - if ($f[0] === '.') { - continue; - } + foreach (scandir($server_path_reports, SCANDIR_SORT_ASCENDING) as $f) { + if ($f[0] === '.') { + continue; + } - if (is_dir($server_path_reports . $f)) { - foreach (scandir($server_path_reports . $f, SCANDIR_SORT_ASCENDING) as $f2) { - if ($f2[0] === '.') { - continue; - } + if (is_dir($server_path_reports . $f)) { + foreach (scandir($server_path_reports . $f, SCANDIR_SORT_ASCENDING) as $f2) { + if ($f2[0] === '.') { + continue; + } - $files[] = array($f . '/' . $f2, $server_path_reports); - } + $files[] = array($f . '/' . $f2, $server_path_reports); + } - continue; - } + continue; + } - $files[] = array($f, $server_path_reports); - } + $files[] = array($f, $server_path_reports); + } } foreach ($files as &$f) { @@ -42,20 +42,19 @@ foreach ($files as &$f) { unset($f); -$twig->display('admin.reports.html.twig', array('files' => $files)); - - $file = isset($_GET['file']) ? $_GET['file'] : NULL; if (!empty($file)) { if (!preg_match('/[^A-z0-9\' _\/\-\.]/', $file)) { if (file_exists($server_path_reports . $file)) { - $content = nl2br(file_get_contents($server_path_reports . $file)); + $file_content = nl2br(file_get_contents($server_path_reports . $file)); - $twig->display('admin.logs.view.html.twig', array('file' => $file, 'content' => $content)); + $twig->display('admin.logs.view.html.twig', array('file' => $file, 'content' => $file_content)); } else { echo 'Specified file does not exist.'; } } else { echo 'Invalid file name specified.'; } -} \ No newline at end of file +} + +$twig->display('admin.reports.html.twig', array('files' => $files)); diff --git a/system/pages/bans.php b/system/pages/bans.php index d35c639e..c08fdc2f 100644 --- a/system/pages/bans.php +++ b/system/pages/bans.php @@ -90,116 +90,3 @@ if($next_page) echo 'Next Page'; ?> -load($id); - if($player->isLoaded()) - return $player->getName(); - else - { - $playerQuery = $db->query('SELECT `id` FROM `players` WHERE `account_id` = ' . $id . ' ORDER BY `lastlogin` DESC LIMIT 1;')->fetch(); - - $tmp = "*Error*"; - /* - $acco = new OTS_Account(); - $acco->load($id); - if(!$acco->isLoaded()) - return "Unknown name"; - - foreach($acco->getPlayersList() as $p) - { - $player= new OTS_Player(); - $player->find($p);*/ - $player->load($playerQuery['id']); - //echo 'id gracza = ' . $p . '
    '; - if($player->isLoaded()) - $tmp = $player->getName(); - // break; - //} - - return $tmp; - } - } - - return ''; -} -?> diff --git a/system/templates/admin.dashboard.html.twig b/system/templates/admin.dashboard.html.twig index 243732b3..81b4284c 100644 --- a/system/templates/admin.dashboard.html.twig +++ b/system/templates/admin.dashboard.html.twig @@ -1,102 +1,27 @@ -
    -
    -
    -
    -

    Maintenance

    -
    - +
    +
    +
    +
    +
    Website Status +
    + + +
    +
    +
    +
    +
    + + + (only visible if closed)
    -
    - -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - - + -
    +
    - {% if points is iterable %} -
    -
    -
    -

    Top 10 - Most premium points

    -
    -
    - - - - - - - - {% set i = 0 %} - {% for result in points %} - {% set i = i + 1 %} - - - - - - {% endfor %} - -
    #Account {{ account_type }}Premium points
    {{ i }}{{ result.name }}{{ result.premium_points }}
    -
    -
    -
    - {% endif %} - {% if coins is iterable %} -
    -
    -
    -

    Top 10 - Most coins

    -
    -
    - - - - - - - - {% set i = 0 %} - {% for result in coins %} - {% set i = i + 1 %} - - - - - - {% endfor %} - -
    #Account {{ account_type }}Tibia coins
    {{ i }}{{ result.name }}{{ result.coins }}
    -
    -
    -
    - {% endif %} -
    \ No newline at end of file +
    diff --git a/system/templates/admin.items.html.twig b/system/templates/admin.items.html.twig index 1a0c7e01..812c31b9 100644 --- a/system/templates/admin.items.html.twig +++ b/system/templates/admin.items.html.twig @@ -1,4 +1,4 @@
    - -
    \ No newline at end of file +
    (it may take some time to finish) + diff --git a/system/templates/admin.login.html.twig b/system/templates/admin.login.html.twig index aa6c9cfa..99001127 100644 --- a/system/templates/admin.login.html.twig +++ b/system/templates/admin.login.html.twig @@ -1,38 +1,47 @@ -