+
-
-
- $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'] . '';
- }
- }
- ?>
-
-
-
-
-
-
-
-
-
-
+
+
-
\ 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?
';
+ $str_construct = 'Do you mean?';
+ $str_construct .= '- ' . $row['name'] . '
';
+ $str_construct .= '
';
+ 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();
- }
-}
-
?>