mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 09:44:55 +02:00
Code clean up + datatables (#64)
* Reformat Code Reformat Code - spaces + tabs * Code cleanup removed duplicated datatables code * Datatables replace spells, monsters tables with JavaScript Sortable Tables (DataTables?)
This commit is contained in:
@@ -14,24 +14,24 @@ $base = BASE_URL . 'admin/?p=accounts';
|
||||
|
||||
function echo_success($message)
|
||||
{
|
||||
echo '<p class="success">' . $message . '</p>';
|
||||
echo '<p class="success">' . $message . '</p>';
|
||||
}
|
||||
|
||||
function echo_error($message)
|
||||
{
|
||||
global $error;
|
||||
echo '<p class="error">' . $message . '</p>';
|
||||
$error = true;
|
||||
global $error;
|
||||
echo '<p class="error">' . $message . '</p>';
|
||||
$error = true;
|
||||
}
|
||||
|
||||
function verify_number($number, $name, $max_length)
|
||||
{
|
||||
if (!Validator::number($number))
|
||||
echo_error($name . ' can contain only numbers.');
|
||||
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.');
|
||||
$number_length = strlen($number);
|
||||
if ($number_length <= 0 || $number_length > $max_length)
|
||||
echo_error($name . ' cannot be longer than ' . $max_length . ' digits.');
|
||||
}
|
||||
|
||||
$hasCoinsColumn = $db->hasColumn('accounts', 'coins');
|
||||
@@ -43,383 +43,385 @@ $hasCoinsColumn = $db->hasColumn('accounts', 'coins');
|
||||
<?php
|
||||
$id = 0;
|
||||
if (isset($_REQUEST['id']))
|
||||
$id = (int)$_REQUEST['id'];
|
||||
$id = (int)$_REQUEST['id'];
|
||||
else if (isset($_REQUEST['search_name'])) {
|
||||
if (strlen($_REQUEST['search_name']) < 3 && !Validator::number($_REQUEST['search_name'])) {
|
||||
echo 'Player name is too short.';
|
||||
} else {
|
||||
if (Validator::number($_REQUEST['search_name']))
|
||||
$id = $_REQUEST['search_name'];
|
||||
else {
|
||||
$query = $db->query('SELECT `id` FROM `accounts` WHERE `name` = ' . $db->quote($_REQUEST['search_name']));
|
||||
if ($query->rowCount() == 1) {
|
||||
$query = $query->fetch();
|
||||
$id = $query['id'];
|
||||
} else {
|
||||
$query = $db->query('SELECT `id`, `name` FROM `accounts` WHERE `name` LIKE ' . $db->quote('%' . $_REQUEST['search_name'] . '%'));
|
||||
if ($query->rowCount() > 0 && $query->rowCount() <= 10) {
|
||||
echo 'Do you mean?<ul>';
|
||||
foreach ($query as $row)
|
||||
echo '<li><a href="' . $base . '&id=' . $row['id'] . '">' . $row['name'] . '</a></li>';
|
||||
echo '</ul>';
|
||||
} else if ($query->rowCount() > 10)
|
||||
echo 'Specified name resulted with too many accounts.';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (strlen($_REQUEST['search_name']) < 3 && !Validator::number($_REQUEST['search_name'])) {
|
||||
echo 'Player name is too short.';
|
||||
} else {
|
||||
if (Validator::number($_REQUEST['search_name']))
|
||||
$id = $_REQUEST['search_name'];
|
||||
else {
|
||||
$query = $db->query('SELECT `id` FROM `accounts` WHERE `name` = ' . $db->quote($_REQUEST['search_name']));
|
||||
if ($query->rowCount() == 1) {
|
||||
$query = $query->fetch();
|
||||
$id = $query['id'];
|
||||
} else {
|
||||
$query = $db->query('SELECT `id`, `name` FROM `accounts` WHERE `name` LIKE ' . $db->quote('%' . $_REQUEST['search_name'] . '%'));
|
||||
if ($query->rowCount() > 0 && $query->rowCount() <= 10) {
|
||||
echo 'Do you mean?<ul>';
|
||||
foreach ($query as $row)
|
||||
echo '<li><a href="' . $base . '&id=' . $row['id'] . '">' . $row['name'] . '</a></li>';
|
||||
echo '</ul>';
|
||||
} else if ($query->rowCount() > 10)
|
||||
echo 'Specified name resulted with too many accounts.';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($id > 0) {
|
||||
$account = new OTS_Account();
|
||||
$account->load($id);
|
||||
$account = new OTS_Account();
|
||||
$account->load($id);
|
||||
|
||||
if (isset($account) && $account->isLoaded() && isset($_POST['save'])) {// we want to save
|
||||
$error = false;
|
||||
if (isset($account) && $account->isLoaded() && isset($_POST['save'])) {// we want to save
|
||||
$error = false;
|
||||
|
||||
$name = $_POST['name'];
|
||||
$_error = '';
|
||||
$name = $_POST['name'];
|
||||
$_error = '';
|
||||
|
||||
//if (!Validator::check_account_name($name))
|
||||
// echo_error(Validator::getLastError());
|
||||
//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)
|
||||
echo_error('This name is already used. Please choose another name!');
|
||||
$account_db = new OTS_Account();
|
||||
$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.');
|
||||
$account_db->load($id);
|
||||
if (!$account_db->isLoaded())
|
||||
echo_error('Account with this id doesn\'t exist.');
|
||||
|
||||
//type
|
||||
$group = $_POST['group'];
|
||||
//type
|
||||
$group = $_POST['group'];
|
||||
|
||||
$password = ((!empty($_POST["pass"]) ? $_POST['pass'] : null));
|
||||
if(!Validator::password($password)) {
|
||||
$errors['password'] = Validator::getLastError();
|
||||
}
|
||||
$password = ((!empty($_POST["pass"]) ? $_POST['pass'] : null));
|
||||
if (!Validator::password($password)) {
|
||||
$errors['password'] = Validator::getLastError();
|
||||
}
|
||||
|
||||
//secret
|
||||
$secret = $_POST['secret'];
|
||||
//key
|
||||
$key = $_POST['key'];
|
||||
//secret
|
||||
$secret = $_POST['secret'];
|
||||
//key
|
||||
$key = $_POST['key'];
|
||||
|
||||
$email = $_POST['email'];
|
||||
if(!Validator::email($email))
|
||||
$errors['email'] = Validator::getLastError();
|
||||
$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);
|
||||
// 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);
|
||||
}
|
||||
//tibia coins
|
||||
if ($hasCoinsColumn) {
|
||||
$t_coins = $_POST['t_coins'];
|
||||
verify_number($t_coins, 'Tibia coins', 12);
|
||||
}
|
||||
|
||||
//prem points
|
||||
$p_points = $_POST['p_points'];
|
||||
verify_number($p_points, 'Prem Points', 11);
|
||||
//prem points
|
||||
$p_points = $_POST['p_points'];
|
||||
verify_number($p_points, 'Prem Points', 11);
|
||||
|
||||
//rl name
|
||||
$rl_name = $_POST['rl_name'];
|
||||
//rl name
|
||||
$rl_name = $_POST['rl_name'];
|
||||
|
||||
//location
|
||||
$rl_loca = $_POST['rl_loca'];
|
||||
//location
|
||||
$rl_loca = $_POST['rl_loca'];
|
||||
|
||||
//country
|
||||
$rl_country = $_POST['rl_country'];
|
||||
//country
|
||||
$rl_country = $_POST['rl_country'];
|
||||
|
||||
//created
|
||||
$created = $_POST['created'];
|
||||
verify_number($created, 'Created', 20);
|
||||
//created
|
||||
$created = $_POST['created'];
|
||||
verify_number($created, 'Created', 20);
|
||||
|
||||
//last login
|
||||
$lastlogin = $_POST['lastlogin'];
|
||||
verify_number($lastlogin, 'Last login', 20);
|
||||
//last login
|
||||
$lastlogin = $_POST['lastlogin'];
|
||||
verify_number($lastlogin, 'Last login', 20);
|
||||
|
||||
//web last login
|
||||
$web_lastlogin = $_POST['web_lastlogin'];
|
||||
verify_number($web_lastlogin, 'Web Last logout', 20);
|
||||
//web last login
|
||||
$web_lastlogin = $_POST['web_lastlogin'];
|
||||
verify_number($web_lastlogin, 'Web Last logout', 20);
|
||||
|
||||
|
||||
if (!$error) {
|
||||
$account->setName($name);
|
||||
$account->setCustomField('type', $group);
|
||||
$account->setCustomField('secret', $secret);
|
||||
$account->setCustomField('key', $key);
|
||||
$account->setEMail($email);
|
||||
$account->setPremDays($p_days);
|
||||
if($hasCoinsColumn) {
|
||||
$account->setCustomField('coins', $t_coins);
|
||||
}
|
||||
if (!$error) {
|
||||
$account->setName($name);
|
||||
$account->setCustomField('type', $group);
|
||||
$account->setCustomField('secret', $secret);
|
||||
$account->setCustomField('key', $key);
|
||||
$account->setEMail($email);
|
||||
$account->setPremDays($p_days);
|
||||
if ($hasCoinsColumn) {
|
||||
$account->setCustomField('coins', $t_coins);
|
||||
}
|
||||
|
||||
$account->setRLName($rl_name);
|
||||
$account->setLocation($rl_loca);
|
||||
$account->setCountry($rl_country);
|
||||
$account->setRLName($rl_name);
|
||||
$account->setLocation($rl_loca);
|
||||
$account->setCountry($rl_country);
|
||||
|
||||
if ($db->hasColumn('accounts', 'premium_points')){
|
||||
$account->setCustomField('premium_points', $p_points);}
|
||||
if ($db->hasColumn('accounts', 'premium_points')) {
|
||||
$account->setCustomField('premium_points', $p_points);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
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);
|
||||
$password = encrypt($password);
|
||||
$account->setPassword($password);
|
||||
|
||||
if ($config_salt_enabled)
|
||||
$account->setCustomField('salt', $salt);
|
||||
}
|
||||
if ($config_salt_enabled)
|
||||
$account->setCustomField('salt', $salt);
|
||||
}
|
||||
|
||||
$account->setEMail($email);
|
||||
$account->setEMail($email);
|
||||
|
||||
//$account->setCustomField('created', time());
|
||||
//$account->setCustomField('created', time());
|
||||
|
||||
$account->save();
|
||||
echo_success('Account saved at: ' . date('G:i'));
|
||||
}
|
||||
}
|
||||
$account->save();
|
||||
echo_success('Account saved at: ' . date('G:i'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$search_name = '';
|
||||
$search_account = '';
|
||||
if (isset($_REQUEST['search_name']))
|
||||
$search_name = $_REQUEST['search_name'];
|
||||
$search_name = $_REQUEST['search_name'];
|
||||
else if (isset($_REQUEST['search_account']))
|
||||
$search_account = $_REQUEST['search_account'];
|
||||
$search_account = $_REQUEST['search_account'];
|
||||
else if ($id > 0 && isset($account) && $account->isLoaded())
|
||||
$search_name = $account->getName();
|
||||
$search_name = $account->getName();
|
||||
|
||||
?>
|
||||
<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"); ?>
|
||||
<form action="<?php echo $base . ((isset($id) && $id > 0) ? '&id=' . $id : ''); ?>" method="post" class="form-horizontal">
|
||||
<div class="col-md-8">
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<label for="name" class="control-label">Account Name</label>
|
||||
<input type="text" class="form-control" id="name" name="name"
|
||||
autocomplete="off" style="cursor: auto;"
|
||||
value="<?php echo $account->getName(); ?>"/>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<label for="account_id" class="control-label">Account id:</label>
|
||||
<input type="text" class="form-control" id="account_id" name="account_id"
|
||||
autocomplete="off" style="cursor: auto;" size="8" maxlength="11" disabled
|
||||
value="<?php echo $account->getId(); ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<label for="group" class="control-label">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>
|
||||
<div class="col-xs-6">
|
||||
<label for="c_pass" class="control-label">Password: (check to change)</label>
|
||||
<div class="input-group">
|
||||
<?php $acc_type = array("Normal", "Tutor", "Senior Tutor", "Gamemaster", "God"); ?>
|
||||
<form action="<?php echo $base . ((isset($id) && $id > 0) ? '&id=' . $id : ''); ?>" method="post"
|
||||
class="form-horizontal">
|
||||
<div class="col-md-8">
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<label for="name" class="control-label">Account Name</label>
|
||||
<input type="text" class="form-control" id="name" name="name"
|
||||
autocomplete="off" style="cursor: auto;"
|
||||
value="<?php echo $account->getName(); ?>"/>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<label for="account_id" class="control-label">Account id:</label>
|
||||
<input type="text" class="form-control" id="account_id" name="account_id"
|
||||
autocomplete="off" style="cursor: auto;" size="8" maxlength="11" disabled
|
||||
value="<?php echo $account->getId(); ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<label for="group" class="control-label">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>
|
||||
<div class="col-xs-6">
|
||||
<label for="c_pass" class="control-label">Password: (check to change)</label>
|
||||
<div class="input-group">
|
||||
|
||||
<span class="input-group-addon">
|
||||
<input type="checkbox"
|
||||
name="c_pass"
|
||||
id="c_pass"
|
||||
value="false"
|
||||
class="input_control"/>
|
||||
name="c_pass"
|
||||
id="c_pass"
|
||||
value="false"
|
||||
class="input_control"/>
|
||||
</span>
|
||||
<input type="text" class="form-control" id="pass" name="pass"
|
||||
autocomplete="off" maxlength="20"
|
||||
value=""/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<label for="secret" class="control-label">Secret:</label>
|
||||
<input type="text" class="form-control" id="secret" name="secret"
|
||||
autocomplete="off" style="cursor: auto;" size="8" maxlength="11"
|
||||
value="<?php echo $account->getCustomField('secret'); ?>"/>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<label for="key" class="control-label">Key:</label>
|
||||
<input type="text" class="form-control" id="key" name="key"
|
||||
autocomplete="off" style="cursor: auto;" size="8" maxlength="11"
|
||||
value="<?php echo $account->getCustomField('key'); ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<label for="email" class="control-label">Email:</label>
|
||||
<input type="text" class="form-control" id="email" name="email"
|
||||
autocomplete="off" maxlength="20"
|
||||
value="<?php echo $account->getEMail(); ?>"/>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<label for="p_days" class="control-label">Prem Days:</label>
|
||||
<input type="text" class="form-control" id="p_days" name="p_days"
|
||||
autocomplete="off" maxlength="11"
|
||||
value="<?php echo $account->getPremDays(); ?>"/>
|
||||
</div>
|
||||
<?php if($hasCoinsColumn): ?>
|
||||
<div class="col-xs-6">
|
||||
<label for="t_coins" class="control-label">Tibia Coins:</label>
|
||||
<input type="text" class="form-control" id="t_coins" name="t_coins"
|
||||
autocomplete="off" maxlength="8"
|
||||
value="<?php echo $account->getCustomField('coins') ?>"/>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($db->hasColumn('players', 'blessings')): ?>
|
||||
<div class="col-xs-6">
|
||||
<label for="p_points" class="control-label">Prem Points:</label>
|
||||
<input type="text" class="form-control" id="p_points" name="p_points"
|
||||
autocomplete="off" maxlength="8"
|
||||
value="<?php echo $account->getCustomField('premium_points') ?>"/>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<label for="rl_name" class="control-label">RL Name:</label>
|
||||
<input type="text" class="form-control" id="rl_name" name="rl_name"
|
||||
autocomplete="off" maxlength="20"
|
||||
value="<?php echo $account->getRLName(); ?>"/>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<label for="rl_loca" class="control-label">Location:</label>
|
||||
<input type="text" class="form-control" id="rl_loca" name="rl_loca"
|
||||
autocomplete="off" maxlength="20"
|
||||
value="<?php echo $account->getLocation(); ?>"/>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<label for="rl_country" class="control-label">Country:</label>
|
||||
<input type="text" class="form-control" id="rl_country" name="rl_country"
|
||||
autocomplete="off" maxlength="8"
|
||||
value="<?php echo $account->getCountry(); ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="pass" name="pass"
|
||||
autocomplete="off" maxlength="20"
|
||||
value=""/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<label for="secret" class="control-label">Secret:</label>
|
||||
<input type="text" class="form-control" id="secret" name="secret"
|
||||
autocomplete="off" style="cursor: auto;" size="8" maxlength="11"
|
||||
value="<?php echo $account->getCustomField('secret'); ?>"/>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<label for="key" class="control-label">Key:</label>
|
||||
<input type="text" class="form-control" id="key" name="key"
|
||||
autocomplete="off" style="cursor: auto;" size="8" maxlength="11"
|
||||
value="<?php echo $account->getCustomField('key'); ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<label for="email" class="control-label">Email:</label>
|
||||
<input type="text" class="form-control" id="email" name="email"
|
||||
autocomplete="off" maxlength="20"
|
||||
value="<?php echo $account->getEMail(); ?>"/>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<label for="p_days" class="control-label">Prem Days:</label>
|
||||
<input type="text" class="form-control" id="p_days" name="p_days"
|
||||
autocomplete="off" maxlength="11"
|
||||
value="<?php echo $account->getPremDays(); ?>"/>
|
||||
</div>
|
||||
<?php if ($hasCoinsColumn): ?>
|
||||
<div class="col-xs-6">
|
||||
<label for="t_coins" class="control-label">Tibia Coins:</label>
|
||||
<input type="text" class="form-control" id="t_coins" name="t_coins"
|
||||
autocomplete="off" maxlength="8"
|
||||
value="<?php echo $account->getCustomField('coins') ?>"/>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($db->hasColumn('players', 'blessings')): ?>
|
||||
<div class="col-xs-6">
|
||||
<label for="p_points" class="control-label">Prem Points:</label>
|
||||
<input type="text" class="form-control" id="p_points" name="p_points"
|
||||
autocomplete="off" maxlength="8"
|
||||
value="<?php echo $account->getCustomField('premium_points') ?>"/>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<label for="rl_name" class="control-label">RL Name:</label>
|
||||
<input type="text" class="form-control" id="rl_name" name="rl_name"
|
||||
autocomplete="off" maxlength="20"
|
||||
value="<?php echo $account->getRLName(); ?>"/>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<label for="rl_loca" class="control-label">Location:</label>
|
||||
<input type="text" class="form-control" id="rl_loca" name="rl_loca"
|
||||
autocomplete="off" maxlength="20"
|
||||
value="<?php echo $account->getLocation(); ?>"/>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<label for="rl_country" class="control-label">Country:</label>
|
||||
<input type="text" class="form-control" id="rl_country" name="rl_country"
|
||||
autocomplete="off" maxlength="8"
|
||||
value="<?php echo $account->getCountry(); ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<label for="created" class="control-label">Created:</label>
|
||||
<input type="text" class="form-control" id="created" name="created"
|
||||
autocomplete="off" maxlength="20"
|
||||
value="<?php echo $account->getCustomField('created'); ?>"/>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<label for="lastlogin" class="control-label">Last Login:</label>
|
||||
<input type="text" class="form-control" id="lastlogin" name="lastlogin"
|
||||
autocomplete="off" maxlength="20"
|
||||
value="<?php echo $account->getLastLogin(); ?>"/>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<label for="web_lastlogin" class="control-label">Web Last Login:</label>
|
||||
<input type="text" class="form-control" id="web_lastlogin" name="web_lastlogin"
|
||||
autocomplete="off" maxlength="20"
|
||||
value="<?php echo $account->getCustomField('web_lastlogin'); ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<label for="created" class="control-label">Created:</label>
|
||||
<input type="text" class="form-control" id="created" name="created"
|
||||
autocomplete="off" maxlength="20"
|
||||
value="<?php echo $account->getCustomField('created'); ?>"/>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<label for="lastlogin" class="control-label">Last Login:</label>
|
||||
<input type="text" class="form-control" id="lastlogin" name="lastlogin"
|
||||
autocomplete="off" maxlength="20"
|
||||
value="<?php echo $account->getLastLogin(); ?>"/>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<label for="web_lastlogin" class="control-label">Web Last Login:</label>
|
||||
<input type="text" class="form-control" id="web_lastlogin" name="web_lastlogin"
|
||||
autocomplete="off" maxlength="20"
|
||||
value="<?php echo $account->getCustomField('web_lastlogin'); ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="save" value="yes"/>
|
||||
<div class="box-footer">
|
||||
<a href="<?php echo ADMIN_URL; ?>?p=accounts"><span class="btn btn-danger">Cancel</span></a>
|
||||
<div class="pull-right">
|
||||
<input type="submit" class="btn btn-primary" value="Update">
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="save" value="yes"/>
|
||||
<div class="box-footer">
|
||||
<a href="<?php echo ADMIN_URL; ?>?p=accounts"><span class="btn btn-danger">Cancel</span></a>
|
||||
<div class="pull-right">
|
||||
<input type="submit" class="btn btn-primary" value="Update">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="col-md-4">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Search Account:</h3>
|
||||
<div class="box-tools pull-right">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Search Account:</h3>
|
||||
<div class="box-tools pull-right">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<form action="<?php echo $base; ?>" method="post">
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control" name="search_name" value="<?php echo $search_name; ?>"
|
||||
maxlength="32" size="32">
|
||||
<span class="input-group-btn">
|
||||
<div class="box-body">
|
||||
<form action="<?php echo $base; ?>" method="post">
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control" name="search_name" value="<?php echo $search_name; ?>"
|
||||
maxlength="32" size="32">
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" type="button" class="btn btn-info btn-flat">Search</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if (isset($account) && $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)) {
|
||||
?>
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">Character List:</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<table class="table table-striped">
|
||||
<tbody><tr>
|
||||
<th style="width: 10px">#</th>
|
||||
<th>Name</th>
|
||||
<th>Level</th>
|
||||
<th style="width: 40px">Edit</th>
|
||||
</tr>
|
||||
<?php
|
||||
$i = 1;
|
||||
foreach ($query as $p) {
|
||||
$account_players[] = $p;
|
||||
echo '<tr>
|
||||
<td>'.$i.'.</td>
|
||||
<td>'.$p['name'] . '</td>
|
||||
<td>'.$p['level'].'</td>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if (isset($account) && $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)) {
|
||||
?>
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">Character List:</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<table class="table table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th style="width: 10px">#</th>
|
||||
<th>Name</th>
|
||||
<th>Level</th>
|
||||
<th style="width: 40px">Edit</th>
|
||||
</tr>
|
||||
<?php
|
||||
$i = 1;
|
||||
foreach ($query as $p) {
|
||||
$account_players[] = $p;
|
||||
echo '<tr>
|
||||
<td>' . $i . '.</td>
|
||||
<td>' . $p['name'] . '</td>
|
||||
<td>' . $p['level'] . '</td>
|
||||
<td><a href="?p=players&search_name=' . $p['name'] . '"><span class="btn btn-success btn-sm edit btn-flat"><i class="fa fa-edit"></i></span></a></span></td>
|
||||
</tr>';
|
||||
$i++;
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
$i++;
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
};
|
||||
};
|
||||
?>
|
||||
<?php
|
||||
};
|
||||
};
|
||||
?>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#lastlogin').datetimepicker({ format: 'unixtime' });
|
||||
$('#lastlogout').datetimepicker({ format: 'unixtime' });
|
||||
$('#created').datetimepicker({ format: 'unixtime' });
|
||||
$('#web_lastlogin').datetimepicker({ format: 'unixtime' });
|
||||
$(document).ready(function () {
|
||||
$('.input_control').change(function () {
|
||||
$('input[name=pass]')[0].disabled = !this.checked;
|
||||
$('input[name=pass]')[0].value = '';
|
||||
}).change();
|
||||
});
|
||||
$('#lastlogin').datetimepicker({format: 'unixtime'});
|
||||
$('#lastlogout').datetimepicker({format: 'unixtime'});
|
||||
$('#created').datetimepicker({format: 'unixtime'});
|
||||
$('#web_lastlogin').datetimepicker({format: 'unixtime'});
|
||||
$(document).ready(function () {
|
||||
$('.input_control').change(function () {
|
||||
$('input[name=pass]')[0].disabled = !this.checked;
|
||||
$('input[name=pass]')[0].value = '';
|
||||
}).change();
|
||||
});
|
||||
</script>
|
@@ -10,7 +10,7 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'MyAAC Changelog';
|
||||
|
||||
if(!file_exists(BASE . 'CHANGELOG')) {
|
||||
if (!file_exists(BASE . 'CHANGELOG')) {
|
||||
echo 'File CHANGELOG doesn\'t exist.';
|
||||
return;
|
||||
}
|
||||
|
@@ -12,39 +12,39 @@ $title = 'Dashboard';
|
||||
|
||||
$cache = Cache::getInstance();
|
||||
if ($cache->enabled()) {
|
||||
if (isset($_GET['clear_cache'])) {
|
||||
if (clearCache())
|
||||
success('Cache cleared.');
|
||||
else
|
||||
error('Error while clearing cache.');
|
||||
}
|
||||
if (isset($_GET['clear_cache'])) {
|
||||
if (clearCache())
|
||||
success('Cache cleared.');
|
||||
else
|
||||
error('Error while clearing cache.');
|
||||
}
|
||||
}
|
||||
if (isset($_GET['maintenance'])) {
|
||||
$_status = (int)$_POST['status'];
|
||||
$message = $_POST['message'];
|
||||
if (empty($message)) {
|
||||
error('Message cannot be empty.');
|
||||
} else if (strlen($message) > 255) {
|
||||
error('Message is too long. Maximum length allowed is 255 chars.');
|
||||
} else {
|
||||
$tmp = '';
|
||||
if (fetchDatabaseConfig('site_closed', $tmp))
|
||||
updateDatabaseConfig('site_closed', $_status);
|
||||
else
|
||||
registerDatabaseConfig('site_closed', $_status);
|
||||
$_status = (int)$_POST['status'];
|
||||
$message = $_POST['message'];
|
||||
if (empty($message)) {
|
||||
error('Message cannot be empty.');
|
||||
} else if (strlen($message) > 255) {
|
||||
error('Message is too long. Maximum length allowed is 255 chars.');
|
||||
} else {
|
||||
$tmp = '';
|
||||
if (fetchDatabaseConfig('site_closed', $tmp))
|
||||
updateDatabaseConfig('site_closed', $_status);
|
||||
else
|
||||
registerDatabaseConfig('site_closed', $_status);
|
||||
|
||||
if (fetchDatabaseConfig('site_closed_message', $tmp))
|
||||
updateDatabaseConfig('site_closed_message', $message);
|
||||
else
|
||||
registerDatabaseConfig('site_closed_message', $message);
|
||||
}
|
||||
if (fetchDatabaseConfig('site_closed_message', $tmp))
|
||||
updateDatabaseConfig('site_closed_message', $message);
|
||||
else
|
||||
registerDatabaseConfig('site_closed_message', $message);
|
||||
}
|
||||
}
|
||||
$is_closed = getDatabaseConfig('site_closed') == '1';
|
||||
|
||||
$closed_message = 'Server is under maintenance, please visit later.';
|
||||
$tmp = '';
|
||||
if (fetchDatabaseConfig('site_closed_message', $tmp))
|
||||
$closed_message = $tmp;
|
||||
$closed_message = $tmp;
|
||||
|
||||
$query = $db->query('SELECT count(*) as `how_much` FROM `accounts`;');
|
||||
$query = $query->fetch();
|
||||
@@ -63,73 +63,73 @@ $query = $query->fetch();
|
||||
$total_houses = $query['how_much'];
|
||||
|
||||
if ($db->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;');
|
||||
$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 = 0;
|
||||
}
|
||||
|
||||
if ($db->hasColumn('accounts', 'coins')) {
|
||||
$coins = $db->query('SELECT `coins`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `coins` DESC LIMIT 10;');
|
||||
$coins = $db->query('SELECT `coins`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `coins` DESC LIMIT 10;');
|
||||
} else {
|
||||
$coins = 0;
|
||||
$coins = 0;
|
||||
}
|
||||
|
||||
$twig->display('admin.statistics.html.twig', array(
|
||||
'total_accounts' => $total_accounts,
|
||||
'total_players' => $total_players,
|
||||
'total_guilds' => $total_guilds,
|
||||
'total_houses' => $total_houses
|
||||
'total_accounts' => $total_accounts,
|
||||
'total_players' => $total_players,
|
||||
'total_guilds' => $total_guilds,
|
||||
'total_houses' => $total_houses
|
||||
));
|
||||
|
||||
$twig->display('admin.dashboard.html.twig', array(
|
||||
'is_closed' => $is_closed,
|
||||
'closed_message' => $closed_message,
|
||||
'status' => $status,
|
||||
'account_type' => (USE_ACCOUNT_NAME ? 'name' : 'number'),
|
||||
'points' => $points,
|
||||
'coins' => $coins,
|
||||
'is_closed' => $is_closed,
|
||||
'closed_message' => $closed_message,
|
||||
'status' => $status,
|
||||
'account_type' => (USE_ACCOUNT_NAME ? 'name' : 'number'),
|
||||
'points' => $points,
|
||||
'coins' => $coins,
|
||||
));
|
||||
function clearCache()
|
||||
{
|
||||
global $template_name;
|
||||
$cache = Cache::getInstance();
|
||||
global $template_name;
|
||||
$cache = Cache::getInstance();
|
||||
|
||||
$tmp = '';
|
||||
if ($cache->fetch('status', $tmp))
|
||||
$cache->delete('status');
|
||||
$tmp = '';
|
||||
if ($cache->fetch('status', $tmp))
|
||||
$cache->delete('status');
|
||||
|
||||
if ($cache->fetch('templates', $tmp))
|
||||
$cache->delete('templates');
|
||||
if ($cache->fetch('templates', $tmp))
|
||||
$cache->delete('templates');
|
||||
|
||||
if ($cache->fetch('config_lua', $tmp))
|
||||
$cache->delete('config_lua');
|
||||
if ($cache->fetch('config_lua', $tmp))
|
||||
$cache->delete('config_lua');
|
||||
|
||||
if ($cache->fetch('vocations', $tmp))
|
||||
$cache->delete('vocations');
|
||||
if ($cache->fetch('vocations', $tmp))
|
||||
$cache->delete('vocations');
|
||||
|
||||
if ($cache->fetch('towns', $tmp))
|
||||
$cache->delete('towns');
|
||||
if ($cache->fetch('towns', $tmp))
|
||||
$cache->delete('towns');
|
||||
|
||||
if ($cache->fetch('groups', $tmp))
|
||||
$cache->delete('groups');
|
||||
if ($cache->fetch('groups', $tmp))
|
||||
$cache->delete('groups');
|
||||
|
||||
if ($cache->fetch('visitors', $tmp))
|
||||
$cache->delete('visitors');
|
||||
if ($cache->fetch('visitors', $tmp))
|
||||
$cache->delete('visitors');
|
||||
|
||||
if ($cache->fetch('views_counter', $tmp))
|
||||
$cache->delete('views_counter');
|
||||
if ($cache->fetch('views_counter', $tmp))
|
||||
$cache->delete('views_counter');
|
||||
|
||||
if ($cache->fetch('failed_logins', $tmp))
|
||||
$cache->delete('failed_logins');
|
||||
if ($cache->fetch('failed_logins', $tmp))
|
||||
$cache->delete('failed_logins');
|
||||
|
||||
if ($cache->fetch('news' . $template_name . '_' . NEWS, $tmp))
|
||||
$cache->delete('news' . $template_name . '_' . NEWS);
|
||||
if ($cache->fetch('news' . $template_name . '_' . NEWS, $tmp))
|
||||
$cache->delete('news' . $template_name . '_' . NEWS);
|
||||
|
||||
if ($cache->fetch('news' . $template_name . '_' . TICKER, $tmp))
|
||||
$cache->delete('news' . $template_name . '_' . TICKER);
|
||||
if ($cache->fetch('news' . $template_name . '_' . TICKER, $tmp))
|
||||
$cache->delete('news' . $template_name . '_' . TICKER);
|
||||
|
||||
if ($cache->fetch('template_ini' . $template_name, $tmp))
|
||||
$cache->delete('template_ini' . $template_name);
|
||||
if ($cache->fetch('template_ini' . $template_name, $tmp))
|
||||
$cache->delete('template_ini' . $template_name);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
@@ -16,13 +16,13 @@ require LIBS . 'weapons.php';
|
||||
$twig->display('admin.items.html.twig');
|
||||
|
||||
$reload = isset($_REQUEST['reload']) && (int)$_REQUEST['reload'] == 1;
|
||||
if($reload) {
|
||||
if(Items::loadFromXML(true))
|
||||
if ($reload) {
|
||||
if (Items::loadFromXML(true))
|
||||
success('Successfully loaded items.');
|
||||
else
|
||||
error(Items::getError());
|
||||
|
||||
if(Weapons::loadFromXML(true))
|
||||
if (Weapons::loadFromXML(true))
|
||||
success('Successfully loaded weapons.');
|
||||
else
|
||||
error(Weapons::getError());
|
||||
|
@@ -10,23 +10,23 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Login';
|
||||
$logout = '';
|
||||
if($action == 'logout') {
|
||||
$logout = "You have been logged out!";
|
||||
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) {
|
||||
if (isset($errors)) {
|
||||
foreach ($errors as $error) {
|
||||
error($error);
|
||||
$twig->display('admin.error.html.twig', array('errors' => $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',
|
||||
));
|
||||
'errors' => $search_errors,
|
||||
'logout' => $logout,
|
||||
'account' => USE_ACCOUNT_NAME ? 'Name' : 'Number',
|
||||
));
|
@@ -12,113 +12,113 @@ $title = 'Logs viewer';
|
||||
?>
|
||||
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">Logs:</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div id="logs_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<table id="logs" class="table table-bordered table-striped dataTable" role="grid"
|
||||
aria-describedby="logs_info">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
<th class="sorting_asc" tabindex="0" aria-controls="logs" rowspan="1" colspan="1"
|
||||
aria-sort="ascending" aria-label="Log name: activate to sort column descending"
|
||||
style="width: 297px;">Log name
|
||||
</th>
|
||||
<th class="sorting" tabindex="0" aria-controls="logs" rowspan="1" colspan="1"
|
||||
aria-label="Last updated: activate to sort column ascending" style="width: 361px;">Last
|
||||
updated
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$files = array();
|
||||
$aac_path_logs = BASE . 'system/logs/';
|
||||
foreach (scandir($aac_path_logs) as $f) {
|
||||
if ($f[0] == '.' || $f == '..' || is_dir($aac_path_logs . $f))
|
||||
continue;
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">Logs:</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div id="logs_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<table id="logs" class="table table-bordered table-striped dataTable" role="grid"
|
||||
aria-describedby="logs_info">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
<th class="sorting_asc" tabindex="0" aria-controls="logs" rowspan="1" colspan="1"
|
||||
aria-sort="ascending" aria-label="Log name: activate to sort column descending"
|
||||
style="width: 297px;">Log name
|
||||
</th>
|
||||
<th class="sorting" tabindex="0" aria-controls="logs" rowspan="1" colspan="1"
|
||||
aria-label="Last updated: activate to sort column ascending" style="width: 361px;">Last
|
||||
updated
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$files = array();
|
||||
$aac_path_logs = BASE . 'system/logs/';
|
||||
foreach (scandir($aac_path_logs) as $f) {
|
||||
if ($f[0] == '.' || $f == '..' || 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['server_path'] . 'logs/';
|
||||
if (!file_exists($server_path_logs)) {
|
||||
$server_path_logs = $config['data_path'] . 'logs/';
|
||||
}
|
||||
|
||||
if (file_exists($server_path_logs)) {
|
||||
foreach (scandir($server_path_logs) as $f) {
|
||||
if ($f[0] == '.' || $f == '..')
|
||||
continue;
|
||||
if (file_exists($server_path_logs)) {
|
||||
foreach (scandir($server_path_logs) as $f) {
|
||||
if ($f[0] == '.' || $f == '..')
|
||||
continue;
|
||||
|
||||
if (is_dir($server_path_logs . $f)) {
|
||||
foreach (scandir($server_path_logs . $f) as $f2) {
|
||||
if ($f2[0] == '.' || $f2 == '..')
|
||||
continue;
|
||||
$files[] = array($f . '/' . $f2, $server_path_logs);
|
||||
}
|
||||
if (is_dir($server_path_logs . $f)) {
|
||||
foreach (scandir($server_path_logs . $f) as $f2) {
|
||||
if ($f2[0] == '.' || $f2 == '..')
|
||||
continue;
|
||||
$files[] = array($f . '/' . $f2, $server_path_logs);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
$files[] = array($f, $server_path_logs);
|
||||
}
|
||||
}
|
||||
$files[] = array($f, $server_path_logs);
|
||||
}
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
foreach ($files as $f) {
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?php echo ADMIN_URL . '?p=logs&file=' . $f[0]; ?>"><?php echo $f[0]; ?></a>
|
||||
</td>
|
||||
<td><?php echo date("Y-m-d H:i:s", filemtime($f[1] . $f[0])); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<th>Log name</th>
|
||||
<th>Last updated</th>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
$i = 0;
|
||||
foreach ($files as $f) {
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?php echo ADMIN_URL . '?p=logs&file=' . $f[0]; ?>"><?php echo $f[0]; ?></a>
|
||||
</td>
|
||||
<td><?php echo date("Y-m-d H:i:s", filemtime($f[1] . $f[0])); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<th>Log name</th>
|
||||
<th>Last updated</th>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
$file = isset($_GET['file']) ? $_GET['file'] : NULL;
|
||||
if (!empty($file)) {
|
||||
if (!preg_match('/[^A-z0-9\' _\/\-\.]/', $file)) {
|
||||
if (file_exists($aac_path_logs . $file)) {
|
||||
echo '
|
||||
if (!preg_match('/[^A-z0-9\' _\/\-\.]/', $file)) {
|
||||
if (file_exists($aac_path_logs . $file)) {
|
||||
echo '
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><b>' . $file . '</b></h3>
|
||||
</div>
|
||||
<div class="box-body">';
|
||||
echo nl2br(file_get_contents($aac_path_logs . $file));
|
||||
echo '</div>
|
||||
echo nl2br(file_get_contents($aac_path_logs . $file));
|
||||
echo '</div>
|
||||
</div>';
|
||||
} else if (file_exists($server_path_logs . $file)) {
|
||||
echo '<div class="box"><div class="box-header"><h3 class="box-title"><b>' . $file . '</b></h3></div><div class="box-body">';
|
||||
echo nl2br(file_get_contents($server_path_logs . $file));
|
||||
echo '</div></div>';
|
||||
} else
|
||||
echo 'Specified file does not exist.';
|
||||
} else
|
||||
echo 'Invalid file name specified.';
|
||||
} else if (file_exists($server_path_logs . $file)) {
|
||||
echo '<div class="box"><div class="box-header"><h3 class="box-title"><b>' . $file . '</b></h3></div><div class="box-body">';
|
||||
echo nl2br(file_get_contents($server_path_logs . $file));
|
||||
echo '</div></div>';
|
||||
} else
|
||||
echo 'Specified file does not exist.';
|
||||
} else
|
||||
echo 'Invalid file name specified.';
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
$(function () {
|
||||
$('#logs').DataTable()
|
||||
})
|
||||
$(function () {
|
||||
$('#logs').DataTable()
|
||||
})
|
||||
</script>
|
@@ -10,14 +10,12 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Mailer';
|
||||
|
||||
if(!hasFlag(FLAG_CONTENT_MAILER) && !superAdmin())
|
||||
{
|
||||
if (!hasFlag(FLAG_CONTENT_MAILER) && !superAdmin()) {
|
||||
echo 'Access denied.';
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$config['mail_enabled'])
|
||||
{
|
||||
if (!$config['mail_enabled']) {
|
||||
echo 'Mail support disabled.';
|
||||
return;
|
||||
}
|
||||
@@ -27,11 +25,11 @@ $mail_subject = isset($_POST['mail_subject']) ? stripslashes($_POST['mail_subjec
|
||||
$preview = isset($_REQUEST['preview']);
|
||||
|
||||
$preview_done = false;
|
||||
if($preview) {
|
||||
if(!empty($mail_content) && !empty($mail_subject)) {
|
||||
if ($preview) {
|
||||
if (!empty($mail_content) && !empty($mail_subject)) {
|
||||
$preview_done = _mail($account_logged->getCustomField('email'), $mail_subject, $mail_content);
|
||||
|
||||
if(!$preview_done)
|
||||
if (!$preview_done)
|
||||
error('Error while sending preview mail: ' . $mailer->ErrorInfo);
|
||||
}
|
||||
}
|
||||
@@ -43,31 +41,29 @@ $twig->display('admin.mailer.html.twig', array(
|
||||
'preview_done' => $preview_done
|
||||
));
|
||||
|
||||
if(empty($mail_content) || empty($mail_subject) || $preview)
|
||||
if (empty($mail_content) || empty($mail_subject) || $preview)
|
||||
return;
|
||||
|
||||
$success = 0;
|
||||
$failed = 0;
|
||||
|
||||
$add = '';
|
||||
if($config['account_mail_verify']) {
|
||||
if ($config['account_mail_verify']) {
|
||||
note('Note: Sending only to users with verified E-Mail.');
|
||||
$add = ' AND ' . $db->fieldName('email_verified') . ' = 1';
|
||||
}
|
||||
|
||||
$query = $db->query('SELECT ' . $db->fieldName('email') . ' FROM ' . $db->tableName('accounts') . ' WHERE ' . $db->fieldName('email') . ' != ""' . $add);
|
||||
foreach($query as $email)
|
||||
{
|
||||
if(_mail($email['email'], $mail_subject, $mail_content))
|
||||
foreach ($query as $email) {
|
||||
if (_mail($email['email'], $mail_subject, $mail_content))
|
||||
$success++;
|
||||
else
|
||||
{
|
||||
else {
|
||||
$failed++;
|
||||
echo '<br />';
|
||||
error('An error occorred while sending email to <b>' . $email['email'] . '</b>. Error: ' . $mailer->ErrorInfo);
|
||||
}
|
||||
}
|
||||
|
||||
success('Mailing finished.');
|
||||
success("$success emails delivered.");
|
||||
warning("$failed emails failed.");
|
||||
success('Mailing finished.');
|
||||
success("$success emails delivered.");
|
||||
warning("$failed emails failed.");
|
||||
|
@@ -10,84 +10,81 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Menus';
|
||||
|
||||
if(!hasFlag(FLAG_CONTENT_MENUS) && !superAdmin())
|
||||
{
|
||||
echo 'Access denied.';
|
||||
return;
|
||||
if (!hasFlag(FLAG_CONTENT_MENUS) && !superAdmin()) {
|
||||
echo 'Access denied.';
|
||||
return;
|
||||
}
|
||||
|
||||
if(isset($_REQUEST['template'])) {
|
||||
$template = $_REQUEST['template'];
|
||||
if (isset($_REQUEST['template'])) {
|
||||
$template = $_REQUEST['template'];
|
||||
|
||||
if(isset($_REQUEST['menu'])) {
|
||||
$post_menu = $_REQUEST['menu'];
|
||||
$post_menu_link = $_REQUEST['menu_link'];
|
||||
$post_menu_blank = $_REQUEST['menu_blank'];
|
||||
$post_menu_color = $_REQUEST['menu_color'];
|
||||
if(count($post_menu) != count($post_menu_link)) {
|
||||
echo 'Menu count is not equal menu links. Something went wrong when sending form.';
|
||||
return;
|
||||
}
|
||||
if (isset($_REQUEST['menu'])) {
|
||||
$post_menu = $_REQUEST['menu'];
|
||||
$post_menu_link = $_REQUEST['menu_link'];
|
||||
$post_menu_blank = $_REQUEST['menu_blank'];
|
||||
$post_menu_color = $_REQUEST['menu_color'];
|
||||
if (count($post_menu) != count($post_menu_link)) {
|
||||
echo 'Menu count is not equal menu links. Something went wrong when sending form.';
|
||||
return;
|
||||
}
|
||||
|
||||
$db->query('DELETE FROM `' . TABLE_PREFIX . 'menu` WHERE `template` = ' . $db->quote($template));
|
||||
foreach($post_menu as $category => $menus) {
|
||||
foreach($menus as $i => $menu) {
|
||||
if(empty($menu)) // don't save empty menu item
|
||||
continue;
|
||||
$db->query('DELETE FROM `' . TABLE_PREFIX . 'menu` WHERE `template` = ' . $db->quote($template));
|
||||
foreach ($post_menu as $category => $menus) {
|
||||
foreach ($menus as $i => $menu) {
|
||||
if (empty($menu)) // don't save empty menu item
|
||||
continue;
|
||||
|
||||
try {
|
||||
$db->insert(TABLE_PREFIX . 'menu', array('template' => $template, 'name' => $menu, 'link' => $post_menu_link[$category][$i], 'blank' => $post_menu_blank[$category][$i] == 'on' ? 1 : 0, 'color' => str_replace('#', '', $post_menu_color[$category][$i]), 'category' => $category, 'ordering' => $i));
|
||||
}
|
||||
catch(PDOException $error) {
|
||||
warning('Error while adding menu item (' . $menu . '): ' . $error->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
$db->insert(TABLE_PREFIX . 'menu', array('template' => $template, 'name' => $menu, 'link' => $post_menu_link[$category][$i], 'blank' => $post_menu_blank[$category][$i] == 'on' ? 1 : 0, 'color' => str_replace('#', '', $post_menu_color[$category][$i]), 'category' => $category, 'ordering' => $i));
|
||||
} catch (PDOException $error) {
|
||||
warning('Error while adding menu item (' . $menu . '): ' . $error->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success('Saved at ' . date('H:i'));
|
||||
}
|
||||
success('Saved at ' . date('H:i'));
|
||||
}
|
||||
|
||||
$file = TEMPLATES . $template . '/config.php';
|
||||
if(file_exists($file)) {
|
||||
require_once $file;
|
||||
}
|
||||
else {
|
||||
echo 'Cannot find template config.php file.';
|
||||
return;
|
||||
}
|
||||
$file = TEMPLATES . $template . '/config.php';
|
||||
if (file_exists($file)) {
|
||||
require_once $file;
|
||||
} else {
|
||||
echo 'Cannot find template config.php file.';
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isset($config['menu_categories'])) {
|
||||
echo "No menu categories set in template config.php.<br/>This template doesn't support dynamic menus.";
|
||||
return;
|
||||
}
|
||||
if (!isset($config['menu_categories'])) {
|
||||
echo "No menu categories set in template config.php.<br/>This template doesn't support dynamic menus.";
|
||||
return;
|
||||
}
|
||||
|
||||
echo 'Hint: You can drag menu items.<br/>
|
||||
echo 'Hint: You can drag menu items.<br/>
|
||||
Hint: Add links to external sites using: <b>http://</b> prefix.<br/>
|
||||
Not all templates support blank and colorful links.<br/>
|
||||
<div class="row">';
|
||||
$menus = array();
|
||||
$menus_db = $db->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']);
|
||||
}
|
||||
$menus = array();
|
||||
$menus_db = $db->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 '<form method="post" id="menus-form" action="?p=menus">';
|
||||
echo '<input type="hidden" name="template" value="' . $template . '"/>';
|
||||
foreach($config['menu_categories'] as $id => $cat) {
|
||||
echo ' <div class="col-md-12 col-lg-6">
|
||||
$last_id = array();
|
||||
echo '<form method="post" id="menus-form" action="?p=menus">';
|
||||
echo '<input type="hidden" name="template" value="' . $template . '"/>';
|
||||
foreach ($config['menu_categories'] as $id => $cat) {
|
||||
echo ' <div class="col-md-12 col-lg-6">
|
||||
<div class="box box-danger">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">'. $cat['name'] . ' <img class="add-button" id="add-button-' . $id . '" src="' . BASE_URL . 'images/plus.png" width="16" height="16"/></h3>
|
||||
<h3 class="box-title">' . $cat['name'] . ' <img class="add-button" id="add-button-' . $id . '" src="' . BASE_URL . 'images/plus.png" width="16" height="16"/></h3>
|
||||
</div>
|
||||
<div class="box-body">';
|
||||
|
||||
|
||||
echo '<ul class="sortable" id="sortable-' . $id . '">';
|
||||
if(isset($menus[$id])) {
|
||||
$i = 0;
|
||||
foreach($menus[$id] as $menu) {
|
||||
echo '<li class="ui-state-default" id="list-' . $id . '-' . $i . '"><input type="text" name="menu[' . $id . '][]" value="' . $menu['name'] . '"/>
|
||||
echo '<ul class="sortable" id="sortable-' . $id . '">';
|
||||
if (isset($menus[$id])) {
|
||||
$i = 0;
|
||||
foreach ($menus[$id] as $menu) {
|
||||
echo '<li class="ui-state-default" id="list-' . $id . '-' . $i . '"><input type="text" name="menu[' . $id . '][]" value="' . $menu['name'] . '"/>
|
||||
<input type="text" name="menu_link[' . $id . '][]" value="' . $menu['link'] . '"/>
|
||||
<input type="hidden" name="menu_blank[' . $id . '][]" value="0" />
|
||||
<label><input class="blank-checkbox" type="checkbox" ' . ($menu['blank'] == 1 ? 'checked' : '') . '/><span title="Open in New Window">Blank</span></label>
|
||||
@@ -96,41 +93,40 @@ if(isset($_REQUEST['template'])) {
|
||||
|
||||
<a class="remove-button" id="remove-button-' . $id . '-' . $i . '"><img src="' . BASE_URL . 'images/del.png"/></a></li>';
|
||||
|
||||
$i++;
|
||||
$last_id[$id] = $i;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
$last_id[$id] = $i;
|
||||
}
|
||||
}
|
||||
|
||||
echo '</ul>';
|
||||
echo ' </div>
|
||||
echo '</ul>';
|
||||
echo ' </div>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
echo ' </div><div class="row"><div class="col-md-6">';
|
||||
echo '<input type="submit" class="button" value="Update">';
|
||||
echo '<input type="button" class="button" value="Cancel" onclick="window.location = \'' . ADMIN_URL . '?p=menus&template=' . $template . '\';">';
|
||||
echo '</div></div>';
|
||||
echo '</form>';
|
||||
}
|
||||
echo ' </div><div class="row"><div class="col-md-6">';
|
||||
echo '<input type="submit" class="button" value="Update">';
|
||||
echo '<input type="button" class="button" value="Cancel" onclick="window.location = \'' . ADMIN_URL . '?p=menus&template=' . $template . '\';">';
|
||||
echo '</div></div>';
|
||||
echo '</form>';
|
||||
|
||||
$twig->display('admin.menus.js.html.twig', array(
|
||||
'menus' => $menus,
|
||||
'last_id' => $last_id
|
||||
));
|
||||
?>
|
||||
$twig->display('admin.menus.js.html.twig', array(
|
||||
'menus' => $menus,
|
||||
'last_id' => $last_id
|
||||
));
|
||||
?>
|
||||
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
$templates = $db->query('SELECT `template` FROM `' . TABLE_PREFIX . 'menu` GROUP BY `template`;')->fetchAll();
|
||||
foreach($templates as $key => $value) {
|
||||
$file = TEMPLATES . $value['template'] . '/config.php';
|
||||
if(!file_exists($file)) {
|
||||
unset($templates[$key]);
|
||||
}
|
||||
}
|
||||
<?php
|
||||
} else {
|
||||
$templates = $db->query('SELECT `template` FROM `' . TABLE_PREFIX . 'menu` GROUP BY `template`;')->fetchAll();
|
||||
foreach ($templates as $key => $value) {
|
||||
$file = TEMPLATES . $value['template'] . '/config.php';
|
||||
if (!file_exists($file)) {
|
||||
unset($templates[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$twig->display('admin.menus.form.html.twig', array(
|
||||
'templates' => $templates
|
||||
));
|
||||
$twig->display('admin.menus.form.html.twig', array(
|
||||
'templates' => $templates
|
||||
));
|
||||
}
|
@@ -11,19 +11,16 @@ defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Notepad';
|
||||
|
||||
$notepad_content = Notepad::get($account_logged->getId());
|
||||
if(isset($_POST['content']))
|
||||
{
|
||||
if (isset($_POST['content'])) {
|
||||
$_content = html_entity_decode(stripslashes($_POST['content']));
|
||||
if(!$notepad_content)
|
||||
if (!$notepad_content)
|
||||
Notepad::create($account_logged->getId(), $_content);
|
||||
else
|
||||
Notepad::update($account_logged->getId(), $_content);
|
||||
|
||||
echo '<div class="success" style="text-align: center;">Saved at ' . date('H:i') . '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if($notepad_content !== false)
|
||||
} else {
|
||||
if ($notepad_content !== false)
|
||||
$_content = $notepad_content;
|
||||
}
|
||||
|
||||
@@ -35,7 +32,7 @@ class Notepad
|
||||
{
|
||||
global $db;
|
||||
$query = $db->select(TABLE_PREFIX . 'notepad', array('account_id' => $account_id));
|
||||
if($query !== false)
|
||||
if ($query !== false)
|
||||
return $query['content'];
|
||||
|
||||
return false;
|
||||
|
@@ -10,8 +10,7 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Pages';
|
||||
|
||||
if(!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin())
|
||||
{
|
||||
if (!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin()) {
|
||||
echo 'Access denied.';
|
||||
return;
|
||||
}
|
||||
@@ -24,66 +23,59 @@ $groups = new OTS_Groups_List();
|
||||
$php = false;
|
||||
$access = 0;
|
||||
|
||||
if(!empty($action))
|
||||
{
|
||||
if($action == 'delete' || $action == 'edit' || $action == 'hide')
|
||||
if (!empty($action)) {
|
||||
if ($action == 'delete' || $action == 'edit' || $action == 'hide')
|
||||
$id = $_REQUEST['id'];
|
||||
|
||||
if(isset($_REQUEST['name']))
|
||||
if (isset($_REQUEST['name']))
|
||||
$name = $_REQUEST['name'];
|
||||
|
||||
if(isset($_REQUEST['title']))
|
||||
if (isset($_REQUEST['title']))
|
||||
$p_title = $_REQUEST['title'];
|
||||
|
||||
$php = isset($_REQUEST['php']) && $_REQUEST['php'] == 1;
|
||||
if($php)
|
||||
if ($php)
|
||||
$body = $_REQUEST['body'];
|
||||
else if(isset($_REQUEST['body'])) {
|
||||
else if (isset($_REQUEST['body'])) {
|
||||
//$body = $_REQUEST['body'];
|
||||
$body = html_entity_decode(stripslashes($_REQUEST['body']));
|
||||
}
|
||||
|
||||
if(isset($_REQUEST['access']))
|
||||
if (isset($_REQUEST['access']))
|
||||
$access = $_REQUEST['access'];
|
||||
|
||||
$errors = array();
|
||||
$player_id = 1;
|
||||
|
||||
if($action == 'add') {
|
||||
if(Pages::add($name, $p_title, $body, $player_id, $php, $access, $errors))
|
||||
{
|
||||
if ($action == 'add') {
|
||||
if (Pages::add($name, $p_title, $body, $player_id, $php, $access, $errors)) {
|
||||
$name = $p_title = $body = '';
|
||||
$player_id = $access = 0;
|
||||
$php = false;
|
||||
}
|
||||
}
|
||||
else if($action == 'delete') {
|
||||
if(Pages::delete($id, $errors))
|
||||
} else if ($action == 'delete') {
|
||||
if (Pages::delete($id, $errors))
|
||||
success('Page with id ' . $id . ' has been deleted');
|
||||
}
|
||||
else if($action == 'edit')
|
||||
{
|
||||
if(isset($id) && !isset($_REQUEST['name'])) {
|
||||
} else if ($action == 'edit') {
|
||||
if (isset($id) && !isset($_REQUEST['name'])) {
|
||||
$_page = Pages::get($id);
|
||||
$name = $_page['name'];
|
||||
$p_title = $_page['title'];
|
||||
$body = $_page['body'];
|
||||
$php = $_page['php'] == '1';
|
||||
$access = $_page['access'];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Pages::update($id, $name, $p_title, $body, $player_id, $php, $access);
|
||||
$action = $name = $p_title = $body = '';
|
||||
$player_id = 1;
|
||||
$access = 0;
|
||||
$php = false;
|
||||
}
|
||||
}
|
||||
else if($action == 'hide') {
|
||||
} else if ($action == 'hide') {
|
||||
Pages::toggleHidden($id, $errors);
|
||||
}
|
||||
|
||||
if(!empty($errors))
|
||||
if (!empty($errors))
|
||||
$twig->display('admin.error.html.twig', array('errors' => $errors));
|
||||
}
|
||||
|
||||
@@ -91,7 +83,7 @@ $query =
|
||||
$db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'pages'));
|
||||
|
||||
$pages = array();
|
||||
foreach($query as $_page) {
|
||||
foreach ($query as $_page) {
|
||||
$pages[] = array(
|
||||
'link' => getFullLink($_page['name'], $_page['name'], true),
|
||||
'title' => substr($_page['title'], 0, 20),
|
||||
@@ -121,7 +113,7 @@ class Pages
|
||||
{
|
||||
global $db;
|
||||
$query = $db->select(TABLE_PREFIX . 'pages', array('id' => $id));
|
||||
if($query !== false)
|
||||
if ($query !== false)
|
||||
return $query;
|
||||
|
||||
return false;
|
||||
@@ -130,21 +122,20 @@ class Pages
|
||||
static public function add($name, $title, $body, $player_id, $php, $access, &$errors)
|
||||
{
|
||||
global $db;
|
||||
if(isset($name[0]) && isset($title[0]) && isset($body[0]) && $player_id != 0)
|
||||
{
|
||||
if (isset($name[0]) && isset($title[0]) && isset($body[0]) && $player_id != 0) {
|
||||
$query = $db->select(TABLE_PREFIX . 'pages', array('name' => $name));
|
||||
if($query === false)
|
||||
if ($query === false)
|
||||
$db->insert(TABLE_PREFIX . 'pages', array('name' => $name, 'title' => $title, 'body' => $body, 'player_id' => $player_id, 'php' => $php ? '1' : '0', 'access' => $access));
|
||||
else
|
||||
$errors[] = 'Page with this link already exists.';
|
||||
}
|
||||
else
|
||||
} else
|
||||
$errors[] = 'Please fill all inputs.';
|
||||
|
||||
return !count($errors);
|
||||
}
|
||||
|
||||
static public function update($id, $name, $title, $body, $player_id, $php, $access) {
|
||||
static public function update($id, $name, $title, $body, $player_id, $php, $access)
|
||||
{
|
||||
global $db;
|
||||
$db->update(TABLE_PREFIX . 'pages', array('name' => $name, 'title' => $title, 'body' => $body, 'player_id' => $player_id, 'php' => $php ? '1' : '0', 'access' => $access), array('id' => $id));
|
||||
}
|
||||
@@ -152,14 +143,12 @@ class Pages
|
||||
static public function delete($id, &$errors)
|
||||
{
|
||||
global $db;
|
||||
if(isset($id))
|
||||
{
|
||||
if($db->select(TABLE_PREFIX . 'pages', array('id' => $id)) !== false)
|
||||
if (isset($id)) {
|
||||
if ($db->select(TABLE_PREFIX . 'pages', array('id' => $id)) !== false)
|
||||
$db->delete(TABLE_PREFIX . 'pages', array('id' => $id));
|
||||
else
|
||||
$errors[] = 'Page with id ' . $id . ' does not exists.';
|
||||
}
|
||||
else
|
||||
} else
|
||||
$errors[] = 'id not set';
|
||||
|
||||
return !count($errors);
|
||||
@@ -168,18 +157,17 @@ class Pages
|
||||
static public function toggleHidden($id, &$errors)
|
||||
{
|
||||
global $db;
|
||||
if(isset($id))
|
||||
{
|
||||
if (isset($id)) {
|
||||
$query = $db->select(TABLE_PREFIX . 'pages', array('id' => $id));
|
||||
if($query !== false)
|
||||
if ($query !== false)
|
||||
$db->update(TABLE_PREFIX . 'pages', array('hidden' => ($query['hidden'] == 1 ? 0 : 1)), array('id' => $id));
|
||||
else
|
||||
$errors[] = 'Page with id ' . $id . ' does not exists.';
|
||||
}
|
||||
else
|
||||
} else
|
||||
$errors[] = 'id not set';
|
||||
|
||||
return !count($errors);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -10,10 +10,10 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'PHP Info';
|
||||
|
||||
if(!function_exists('phpinfo')) { ?>
|
||||
<b>phpinfo()</b> function is disabled in your webserver config.<br/>
|
||||
You can enable it by editing <b>php.ini</b> file.
|
||||
<?php return;
|
||||
if (!function_exists('phpinfo')) { ?>
|
||||
<b>phpinfo()</b> function is disabled in your webserver config.<br/>
|
||||
You can enable it by editing <b>php.ini</b> file.
|
||||
<?php return;
|
||||
}
|
||||
?>
|
||||
<iframe src="<?php echo BASE_URL; ?>admin/tools/phpinfo.php" width="1024" height="550" />
|
||||
<iframe src="<?php echo BASE_URL; ?>admin/tools/phpinfo.php" width="1024" height="550"/>
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -14,18 +14,15 @@ require LIBS . 'plugins.php';
|
||||
|
||||
$twig->display('admin.plugins.form.html.twig');
|
||||
|
||||
if(isset($_REQUEST['uninstall'])){
|
||||
if (isset($_REQUEST['uninstall'])) {
|
||||
$uninstall = $_REQUEST['uninstall'];
|
||||
|
||||
if(Plugins::uninstall($uninstall)) {
|
||||
if (Plugins::uninstall($uninstall)) {
|
||||
success('Successfully uninstalled plugin ' . $uninstall);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
error('Error while uninstalling plugin ' . $uninstall . ': ' . Plugins::getError());
|
||||
}
|
||||
}
|
||||
else if(isset($_FILES["plugin"]["name"]))
|
||||
{
|
||||
} else if (isset($_FILES["plugin"]["name"])) {
|
||||
$file = $_FILES["plugin"];
|
||||
$filename = $file["name"];
|
||||
$tmp_name = $file["tmp_name"];
|
||||
@@ -34,15 +31,15 @@ else if(isset($_FILES["plugin"]["name"]))
|
||||
$name = explode(".", $filename);
|
||||
$accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed', 'application/octet-stream', 'application/zip-compressed');
|
||||
|
||||
if(isset($file['error'])) {
|
||||
if (isset($file['error'])) {
|
||||
$error = 'Error uploading file';
|
||||
switch($file['error']) {
|
||||
switch ($file['error']) {
|
||||
case UPLOAD_ERR_OK:
|
||||
$error = false;
|
||||
break;
|
||||
case UPLOAD_ERR_INI_SIZE:
|
||||
case UPLOAD_ERR_FORM_SIZE:
|
||||
$error .= ' - file too large (limit of '.ini_get('upload_max_filesize').' bytes).';
|
||||
$error .= ' - file too large (limit of ' . ini_get('upload_max_filesize') . ' bytes).';
|
||||
break;
|
||||
case UPLOAD_ERR_PARTIAL:
|
||||
$error .= ' - file upload was not completed.';
|
||||
@@ -56,56 +53,49 @@ else if(isset($_FILES["plugin"]["name"]))
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($error) && $error != false) {
|
||||
if (isset($error) && $error != false) {
|
||||
error($error);
|
||||
}
|
||||
else {
|
||||
if(is_uploaded_file($file['tmp_name']) ) {
|
||||
} else {
|
||||
if (is_uploaded_file($file['tmp_name'])) {
|
||||
$filetype = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
|
||||
if($filetype == 'zip') // check if it is zipped/compressed file
|
||||
if ($filetype == 'zip') // check if it is zipped/compressed file
|
||||
{
|
||||
$tmp_filename = pathinfo($filename, PATHINFO_FILENAME);
|
||||
$targetzip = BASE . 'plugins/' . $tmp_filename . '.zip';
|
||||
|
||||
if(move_uploaded_file($tmp_name, $targetzip)) { // move uploaded file
|
||||
if(Plugins::install($targetzip)) {
|
||||
foreach(Plugins::getWarnings() as $warning) {
|
||||
if (move_uploaded_file($tmp_name, $targetzip)) { // move uploaded file
|
||||
if (Plugins::install($targetzip)) {
|
||||
foreach (Plugins::getWarnings() as $warning) {
|
||||
warning($warning);
|
||||
}
|
||||
|
||||
$info = Plugins::getPlugin();
|
||||
success((isset($info['name']) ? '<strong>' . $info['name'] . '</strong> p' : 'P') . 'lugin has been successfully installed.');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$error = Plugins::getError();
|
||||
error(!empty($error) ? $error : 'Unexpected error happened while installing plugin. Please try again later.');
|
||||
}
|
||||
|
||||
unlink($targetzip); // delete the Zipped file
|
||||
}
|
||||
else
|
||||
} else
|
||||
error('There was a problem with the upload. Please try again.');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
error('The file you are trying to upload is not a .zip file. Please try again.');
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
error('Error uploading file - unknown error.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$plugins = array();
|
||||
foreach(get_plugins() as $plugin)
|
||||
{
|
||||
foreach (get_plugins() as $plugin) {
|
||||
$string = file_get_contents(BASE . 'plugins/' . $plugin . '.json');
|
||||
$string = Plugins::removeComments($string);
|
||||
$plugin_info = json_decode($string, true);
|
||||
if($plugin_info == false) {
|
||||
if ($plugin_info == false) {
|
||||
warning('Cannot load plugin info ' . $plugin . '.json');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$plugins[] = array(
|
||||
'name' => isset($plugin_info['name']) ? $plugin_info['name'] : '',
|
||||
'description' => isset($plugin_info['description']) ? $plugin_info['description'] : '',
|
||||
|
@@ -11,19 +11,17 @@ defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Tools';
|
||||
|
||||
$tool = $_GET['tool'];
|
||||
if(!isset($tool))
|
||||
{
|
||||
if (!isset($tool)) {
|
||||
echo 'Tool not set.';
|
||||
return;
|
||||
}
|
||||
|
||||
if(preg_match("/[^A-z0-9_\-]/", $tool))
|
||||
{
|
||||
if (preg_match("/[^A-z0-9_\-]/", $tool)) {
|
||||
echo 'Invalid tool.';
|
||||
return;
|
||||
}
|
||||
|
||||
$file = BASE . 'admin/pages/tools/' . $tool . '.php';
|
||||
if(!@file_exists($file))
|
||||
if (!@file_exists($file))
|
||||
require $file;
|
||||
?>
|
||||
|
@@ -14,7 +14,7 @@ $title = 'Version check';
|
||||
//$file = @fopen('http://my-aac.org/VERSION', 'r') or die('Error while fetching version.');
|
||||
//$myaac_version = fgets($file);
|
||||
$myaac_version = @file_get_contents('http://my-aac.org/VERSION');
|
||||
if(!$myaac_version) {
|
||||
if (!$myaac_version) {
|
||||
warning('Error while fetching version info from http://my-aac.org<br/>
|
||||
Please try again later.');
|
||||
return;
|
||||
@@ -22,15 +22,13 @@ if(!$myaac_version) {
|
||||
|
||||
// compare them
|
||||
$version_compare = version_compare($myaac_version, MYAAC_VERSION);
|
||||
if($version_compare == 0) {
|
||||
if ($version_compare == 0) {
|
||||
success('MyAAC latest version is ' . $myaac_version . '. You\'re using the latest version.
|
||||
<br/>View CHANGELOG ' . generateLink(ADMIN_URL . '?p=changelog', 'here'));
|
||||
}
|
||||
else if($version_compare < 0) {
|
||||
} else if ($version_compare < 0) {
|
||||
echo success('Woah, seems you\'re using newer version as latest released one! MyAAC latest released version is ' . $myaac_version . ', and you\'re using version ' . MYAAC_VERSION . '.
|
||||
<br/>View CHANGELOG ' . generateLink(ADMIN_URL . '?p=changelog', 'here'));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
warning('You\'re using outdated version.<br/>
|
||||
Your version: <b>' . MYAAC_VERSION . '</b><br/>
|
||||
Latest version: <b>' . $myaac_version . '</b><br/>
|
||||
|
@@ -10,18 +10,19 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Visitors';
|
||||
|
||||
if(!$config['visitors_counter']): ?>
|
||||
Visitors counter is disabled.<br/>
|
||||
You can enable it by editing this configurable in <b>config.local.php</b> file:<br/>
|
||||
<p style="margin-left: 3em;"><b>$config['visitors_counter'] = true;</b></p>
|
||||
<?php
|
||||
return;
|
||||
if (!$config['visitors_counter']): ?>
|
||||
Visitors counter is disabled.<br/>
|
||||
You can enable it by editing this configurable in <b>config.local.php</b> file:<br/>
|
||||
<p style="margin-left: 3em;"><b>$config['visitors_counter'] = true;</b></p>
|
||||
<?php
|
||||
return;
|
||||
endif;
|
||||
|
||||
require SYSTEM . 'libs/visitors.php';
|
||||
$visitors = new Visitors($config['visitors_counter_ttl']);
|
||||
|
||||
function compare($a, $b) {
|
||||
function compare($a, $b)
|
||||
{
|
||||
return $a['lastvisit'] > $b['lastvisit'] ? -1 : 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user