mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 01:09:21 +02:00
Bug Fixes
-fix for getSkillTries as reported by whiteblXK -fix for login and account type as reported by vG-
This commit is contained in:
parent
8c83eb805b
commit
1859867039
@ -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.
|
||||
*
|
||||
|
@ -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())
|
||||
|
||||
?>
|
||||
<div class="row">
|
||||
<?php
|
||||
if (isset($account) && $account->isLoaded()) {
|
||||
?>
|
||||
<?php if (isset($account) && $account->isLoaded()) { ?>
|
||||
|
||||
<?php $acc_type = array("Normal", "Tutor", "Senior Tutor", "Gamemaster", "God"); ?>
|
||||
<?php $web_acc = array("None", "Admin", "Super Admin", "(Admin + Super Admin)"); ?>
|
||||
<form action="<?php echo $base . ((isset($id) && $id > 0) ? '&id=' . $id : ''); ?>" method="post"
|
||||
class="form-horizontal">
|
||||
<div class="col-md-8">
|
||||
@ -249,19 +251,36 @@ else if ($id > 0 && isset($account) && $account->isLoaded())
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-xs-6">
|
||||
<label for="group" class="control-label">Account Type:</label>
|
||||
<select name="group" id="group" class="form-control">
|
||||
<?php foreach ($acc_type as $id => $a_type): ?>
|
||||
<option value="<?php echo($id + 1); ?>" <?php echo($account->getCustomField('type') == ($id + 1) ? 'selected' : ''); ?>><?php echo $a_type; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<?php
|
||||
$acc_group = $account->getAccGroupId();
|
||||
if ($hasTypeColumn) {
|
||||
$acc_type = array("Normal", "Tutor", "Senior Tutor", "Gamemaster", "God"); ?>
|
||||
<div class="col-xs-6">
|
||||
<label for="group" class="control-label">Account Type:</label>
|
||||
<select name="group" id="group" class="form-control">
|
||||
<?php foreach ($acc_type as $id => $a_type): ?>
|
||||
<option value="<?php echo($id + 1); ?>" <?php echo($acc_group == ($id + 1) ? 'selected' : ''); ?>><?php echo $a_type; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<?php
|
||||
} elseif ($hasGroupColumn) {
|
||||
?>
|
||||
<div class="col-xs-6">
|
||||
<label for="group" class="control-label">Account Type:</label>
|
||||
<select name="group" id="group" class="form-control">
|
||||
<?php
|
||||
foreach ($groups->getGroups() as $id => $group): ?>
|
||||
<option value="<?php echo $id; ?>" <?php echo($acc_group == $id ? 'selected' : ''); ?>><?php echo $group->getName(); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="col-xs-6">
|
||||
<label for="web_flags" class="control-label">Website Access:</label>
|
||||
<select name="web_flags" id="web_flags" class="form-control">
|
||||
<?php foreach ($web_acc as $id => $a_type): ?>
|
||||
<?php $web_acc = array("None", "Admin", "Super Admin", "(Admin + Super Admin)");
|
||||
foreach ($web_acc as $id => $a_type): ?>
|
||||
<option value="<?php echo($id); ?>" <?php echo($account->getWebFlags() == ($id) ? 'selected' : ''); ?>><?php echo $a_type; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
@ -14,19 +14,13 @@ if ($action == 'logout') {
|
||||
$logout = "You have been logged out!";
|
||||
}
|
||||
|
||||
$search_errors[] = 'Character <b></b> 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',
|
||||
));
|
@ -584,13 +584,12 @@ else if ($id > 0 && isset($player) && $player->isLoaded())
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<label for="skills_tries[' . $id . ']" class="control-label">' . $info[0] . ' tries</label>
|
||||
<input type="text" class="form-control" id="skills_tries[' . $id . ']" name="skills_tries[' . $id . ']" maxlength="10" autocomplete="off" style="cursor: auto;" value="' . $player->getSkill($id) . '"/>
|
||||
<input type="text" class="form-control" id="skills_tries[' . $id . ']" name="skills_tries[' . $id . ']" maxlength="10" autocomplete="off" style="cursor: auto;" value="' . $player->getSkillTries($id) . '"/>
|
||||
</div>
|
||||
</div>';
|
||||
if ($i == 0)
|
||||
echo '';
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
<div class="tab-pane" id="tab_4">
|
||||
|
@ -35,4 +35,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
Loading…
x
Reference in New Issue
Block a user