mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-17 19:23:27 +02:00
Merge branch 'develop' into feature/recaptcha-v3-plus-login
This commit is contained in:
@@ -52,6 +52,29 @@ else
|
||||
$old_name = $player->getName();
|
||||
$player->setName($name);
|
||||
$player->save();
|
||||
|
||||
if ($db->hasTable('player_deaths') &&
|
||||
$db->hasColumn('player_deaths', 'mostdamage_is_player') &&
|
||||
$db->hasColumn('player_deaths', 'killed_by')) {
|
||||
|
||||
$namesToChange = $db->query('SELECT `player_id`, `time`, `is_player`, `killed_by`, `mostdamage_is_player`, `mostdamage_by` FROM `player_deaths` WHERE (`is_player` = 1 AND `killed_by` = ' . $db->quote($old_name) . ') OR (`mostdamage_is_player` = 1 AND `mostdamage_by` = ' . $db->quote($old_name) . ');');
|
||||
|
||||
if ($namesToChange->rowCount() > 0) {
|
||||
foreach ($namesToChange->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$changeKey = '';
|
||||
if ($row['is_player'] == '1' && $row['killed_by'] == $old_name) {
|
||||
$changeKey = 'killed_by';
|
||||
} else if ($row['mostdamage_is_player'] == '1' && $row['mostdamage_by'] == $old_name) {
|
||||
$changeKey = 'mostdamage_by';
|
||||
}
|
||||
|
||||
if (!empty($changeKey)) {
|
||||
$db->update('player_deaths', [$changeKey => $name], ['player_id' => $row['player_id'], 'time' => $row['time']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$account_logged->setCustomField("premium_points", $points - $config['account_change_character_name_points']);
|
||||
$account_logged->logAction('Changed name from <b>' . $old_name . '</b> to <b>' . $player->getName() . '</b>.');
|
||||
$twig->display('success.html.twig', array(
|
||||
@@ -83,4 +106,4 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -10,11 +10,15 @@
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
$character_name = isset($_POST['name']) ? stripslashes(ucwords(strtolower($_POST['name']))) : null;
|
||||
$character_name = isset($_POST['name']) ? stripslashes($_POST['name']) : null;
|
||||
$character_sex = isset($_POST['sex']) ? (int)$_POST['sex'] : null;
|
||||
$character_vocation = isset($_POST['vocation']) ? (int)$_POST['vocation'] : null;
|
||||
$character_town = isset($_POST['town']) ? (int)$_POST['town'] : null;
|
||||
|
||||
if (!admin() && !empty($character_name)) {
|
||||
$character_name = ucwords(strtolower($character_name));
|
||||
}
|
||||
|
||||
$character_created = false;
|
||||
$save = isset($_POST['save']) && $_POST['save'] == 1;
|
||||
$errors = array();
|
||||
@@ -38,4 +42,4 @@ if(!$character_created) {
|
||||
'save' => $save,
|
||||
'errors' => $errors
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@@ -10,60 +10,71 @@
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
$player_name = isset($_POST['delete_name']) ? stripslashes($_POST['delete_name']) : NULL;
|
||||
$password_verify = isset($_POST['delete_password']) ? $_POST['delete_password'] : NULL;
|
||||
$player_name = isset($_POST['delete_name']) ? stripslashes($_POST['delete_name']) : null;
|
||||
$password_verify = isset($_POST['delete_password']) ? $_POST['delete_password'] : null;
|
||||
$password_verify = encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $password_verify);
|
||||
if(isset($_POST['deletecharactersave']) && $_POST['deletecharactersave'] == 1) {
|
||||
if(!empty($player_name) && !empty($password_verify)) {
|
||||
if(Validator::characterName($player_name)) {
|
||||
$player = new OTS_Player();
|
||||
$player->find($player_name);
|
||||
if($player->isLoaded()) {
|
||||
$player_account = $player->getAccount();
|
||||
if($account_logged->getId() == $player_account->getId()) {
|
||||
if($password_verify == $account_logged->getPassword()) {
|
||||
if(!$player->isOnline())
|
||||
{
|
||||
//dont show table "delete character" again
|
||||
$show_form = false;
|
||||
//delete player
|
||||
if($db->hasColumn('players', 'deletion'))
|
||||
$player->setCustomField('deletion', 1);
|
||||
else
|
||||
$player->setCustomField('deleted', 1);
|
||||
$account_logged->logAction('Deleted character <b>' . $player->getName() . '</b>.');
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Character Deleted',
|
||||
'description' => 'The character <b>' . $player_name . '</b> has been deleted.'
|
||||
));
|
||||
}
|
||||
else
|
||||
$errors[] = 'This character is online.';
|
||||
}
|
||||
else {
|
||||
$errors[] = 'Wrong password to account.';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$errors[] = 'Character <b>'.$player_name.'</b> is not on your account.';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$errors[] = 'Character with this name doesn\'t exist.';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$errors[] = 'Name contain illegal characters.';
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(empty($player_name) || empty($password_verify)) {
|
||||
$errors[] = 'Character name or/and password is empty. Please fill in form.';
|
||||
}
|
||||
|
||||
if(empty($errors) && !Validator::characterName($player_name)) {
|
||||
$errors[] = 'Name contain illegal characters.';
|
||||
}
|
||||
|
||||
$player = new OTS_Player();
|
||||
$player->find($player_name);
|
||||
if(empty($errors) && !$player->isLoaded()) {
|
||||
$errors[] = 'Character with this name doesn\'t exist.';
|
||||
}
|
||||
|
||||
if(empty($errors)) {
|
||||
$player_account = $player->getAccount();
|
||||
if($account_logged->getId() != $player_account->getId()) {
|
||||
$errors[] = 'Character <b>' . $player_name . '</b> is not on your account.';
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($errors) && $password_verify != $account_logged->getPassword()) {
|
||||
$errors[] = 'Wrong password to account.';
|
||||
}
|
||||
|
||||
if(empty($errors) && $player->isOnline()) {
|
||||
$errors[] = 'This character is online.';
|
||||
}
|
||||
|
||||
if(empty($errors) && $player->isDeleted()) {
|
||||
$errors[] = 'This player has been already deleted.';
|
||||
}
|
||||
|
||||
if(empty($errors) && $db->hasColumn('houses', 'id')) {
|
||||
$house = $db->query('SELECT `id` FROM `houses` WHERE `owner` = '.$player->getId());
|
||||
if($house->rowCount() > 0) {
|
||||
$errors[] = 'You cannot delete a character when they own a home.';
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($errors)) {
|
||||
//dont show table "delete character" again
|
||||
$show_form = false;
|
||||
/** @var OTS_DB_MySQL $db */
|
||||
if ($db->hasColumn('players', 'deletion'))
|
||||
$player->setCustomField('deletion', 1);
|
||||
else
|
||||
$player->setCustomField('deleted', 1);
|
||||
|
||||
$account_logged->logAction('Deleted character <b>' . $player->getName() . '</b>.');
|
||||
$twig->display('success.html.twig', [
|
||||
'title' => 'Character Deleted',
|
||||
'description' => 'The character <b>' . $player_name . '</b> has been deleted.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
if($show_form) {
|
||||
if(!empty($errors)) {
|
||||
$twig->display('error_box.html.twig', array('errors' => $errors));
|
||||
}
|
||||
|
||||
$twig->display('account.delete_character.html.twig');
|
||||
}
|
||||
?>
|
@@ -40,6 +40,7 @@ if(!$logged)
|
||||
$twig->display('account.login.html.twig', array(
|
||||
'redirect' => isset($_REQUEST['redirect']) ? $_REQUEST['redirect'] : null,
|
||||
'account' => USE_ACCOUNT_NAME ? 'Name' : 'Number',
|
||||
'account_login_by' => getAccountLoginByLabel(),
|
||||
'error' => isset($errors[0]) ? $errors[0] : null
|
||||
));
|
||||
|
||||
@@ -60,16 +61,17 @@ $errors = array();
|
||||
|
||||
if($action == '')
|
||||
{
|
||||
$freePremium = isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium']);
|
||||
$freePremium = isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium']) || $account_logged->getPremDays() == OTS_Account::GRATIS_PREMIUM_DAYS;
|
||||
$dayOrDays = $account_logged->getPremDays() == 1 ? 'day' : 'days';
|
||||
/**
|
||||
* @var OTS_Account $account_logged
|
||||
*/
|
||||
$recovery_key = $account_logged->getCustomField('key');
|
||||
if(!$account_logged->isPremium())
|
||||
$account_status = '<b><span style="color: red">Free Account</span></b>';
|
||||
else
|
||||
$account_status = '<b><span style="color: green">Premium Account, ' . ($freePremium ? 'Unlimited' : $account_logged->getPremDays() . ' days left') . '</span></b>';
|
||||
$account_status = '<b><span style="color: green">' . ($freePremium ? 'Gratis Premium Account' : 'Premium Account, ' . $account_logged->getPremDays() . ' '.$dayOrDays.' left') . '</span></b>';
|
||||
|
||||
$recovery_key = $account_logged->getCustomField('key');
|
||||
if(empty($recovery_key))
|
||||
$account_registered = '<b><span style="color: red">No</span></b>';
|
||||
else
|
||||
@@ -125,7 +127,7 @@ $errors = array();
|
||||
'email_request' => $email_request,
|
||||
'email_new_time' => $email_new_time,
|
||||
'email_new' => isset($email_new) ? $email_new : '',
|
||||
'account' => USE_ACCOUNT_NAME ? $account_logged->getName() : $account_logged->getId(),
|
||||
'account' => USE_ACCOUNT_NAME ? $account_logged->getName() : $account_logged->getNumber(),
|
||||
'account_email' => $account_email,
|
||||
'account_created' => $account_created,
|
||||
'account_status' => $account_status,
|
||||
|
@@ -11,6 +11,7 @@ defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
$title = 'Account editor';
|
||||
$admin_base = BASE_URL . 'admin/?p=accounts';
|
||||
$use_datatable = true;
|
||||
|
||||
if ($config['account_country'])
|
||||
require SYSTEM . 'countries.conf.php';
|
||||
@@ -166,7 +167,7 @@ else if (isset($_REQUEST['search'])) {
|
||||
}
|
||||
|
||||
$lastDay = 0;
|
||||
if ($p_days != 0 && $p_days != PHP_INT_MAX) {
|
||||
if($p_days != 0 && $p_days != OTS_Account::GRATIS_PREMIUM_DAYS) {
|
||||
$lastDay = time();
|
||||
} else if ($lastDay != 0) {
|
||||
$lastDay = 0;
|
||||
@@ -212,7 +213,7 @@ else if (isset($_REQUEST['search'])) {
|
||||
<h5 class="m-0">Accounts</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="acc_datatable table table-striped table-bordered">
|
||||
<table class="acc_datatable table table-striped table-bordered table-responsive d-md-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
@@ -342,23 +343,23 @@ else if (isset($_REQUEST['search'])) {
|
||||
<?php if ($hasSecretColumn): ?>
|
||||
<div class="col-12 col-sm-12 col-lg-6">
|
||||
<label for="secret">Secret:</label>
|
||||
<input type="text" class="form-control" id="secret" name="secret" autocomplete="off" size="8" maxlength="11" value="<?php echo $account->getCustomField('secret'); ?>"/>
|
||||
<input type="text" class="form-control" id="secret" name="secret" autocomplete="off" value="<?php echo $account->getCustomField('secret'); ?>"/>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="col-12 col-sm-12 col-lg-6">
|
||||
<label for="key">Key:</label>
|
||||
<input type="text" class="form-control" id="key" name="key" autocomplete="off" size="8" maxlength="11" value="<?php echo $account->getCustomField('key'); ?>"/>
|
||||
<label for="key">Recovery Key:</label>
|
||||
<input type="text" class="form-control" id="key" name="key" autocomplete="off" value="<?php echo $account->getCustomField('key'); ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-12 col-sm-12 col-lg-6">
|
||||
<label for="email">Email:</label>
|
||||
<input type="text" class="form-control" id="email" name="email" autocomplete="off" maxlength="20" value="<?php echo $account->getEMail(); ?>"/>
|
||||
<label for="email">Email:</label><?php echo (config('mail_enabled') ? ' (<a href="' . ADMIN_URL . '?p=mailer&mail_to=' . $account->getEMail() . '">Send Mail</a>)' : ''); ?>
|
||||
<input type="text" class="form-control" id="email" name="email" autocomplete="off" value="<?php echo $account->getEMail(); ?>"/>
|
||||
</div>
|
||||
<?php if ($hasCoinsColumn): ?>
|
||||
<div class="col-12 col-sm-12 col-lg-6">
|
||||
<label for="t_coins">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') ?>"/>
|
||||
<input type="text" class="form-control" id="t_coins" name="t_coins" autocomplete="off" maxlength="11" value="<?php echo $account->getCustomField('coins') ?>"/>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="col-12 col-sm-12 col-lg-6">
|
||||
@@ -418,7 +419,7 @@ else if (isset($_REQUEST['search'])) {
|
||||
$account_players = $account->getPlayersList();
|
||||
$account_players->orderBy('id');
|
||||
if (isset($account_players)) { ?>
|
||||
<table class="table table-striped table-condensed">
|
||||
<table class="table table-striped table-condensed table-responsive d-md-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
@@ -463,7 +464,7 @@ else if (isset($_REQUEST['search'])) {
|
||||
$bans = $db->query('SELECT * FROM ' . $db->tableName('bans') . ' WHERE ' . $db->fieldName('active') . ' = 1 AND ' . $db->fieldName('id') . ' = ' . $account->getId() . ' ORDER BY ' . $db->fieldName('added') . ' DESC LIMIT 10');
|
||||
if ($bans->rowCount()) {
|
||||
?>
|
||||
<table class="table table-striped table-condensed">
|
||||
<table class="table table-striped table-condensed table-responsive d-md-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nick</th>
|
||||
@@ -517,7 +518,7 @@ else if (isset($_REQUEST['search'])) {
|
||||
if ($db->hasTable('store_history')) { ?>
|
||||
<div class="tab-pane fade" id="accounts-store">
|
||||
<?php $store_history = $db->query('SELECT * FROM `store_history` WHERE `account_id` = "' . $account->getId() . '" ORDER BY `time` DESC')->fetchAll(); ?>
|
||||
<table class="table table-striped table-condensed">
|
||||
<table class="table table-striped table-condensed table-responsive d-md-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Description</th>
|
||||
|
@@ -1,26 +1,140 @@
|
||||
<?php
|
||||
/**
|
||||
* CHANGELOG viewer
|
||||
* CHANGELOG modifier
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2019 MyAAC
|
||||
* @author Lee
|
||||
* @copyright 2020 MyAAC
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'MyAAC Changelog';
|
||||
|
||||
if (!file_exists(BASE . 'CHANGELOG.md')) {
|
||||
echo 'File CHANGELOG.md doesn\'t exist.';
|
||||
if (!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin()) {
|
||||
echo 'Access denied.';
|
||||
return;
|
||||
}
|
||||
|
||||
require LIBS . 'Parsedown.php';
|
||||
$title = 'Changelog';
|
||||
$use_datatable = true;
|
||||
define('CL_LIMIT', 600); // maximum changelog body length
|
||||
?>
|
||||
|
||||
$changelog = file_get_contents(BASE . 'CHANGELOG.md');
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo BASE_URL; ?>tools/css/jquery.datetimepicker.css"/ >
|
||||
<script src="<?php echo BASE_URL; ?>tools/js/jquery.datetimepicker.js"></script>
|
||||
<?php
|
||||
$id = isset($_GET['id']) ? $_GET['id'] : 0;
|
||||
require_once LIBS . 'changelog.php';
|
||||
|
||||
$Parsedown = new Parsedown();
|
||||
if(!empty($action))
|
||||
{
|
||||
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
|
||||
$body = isset($_REQUEST['body']) ? stripslashes($_REQUEST['body']) : null;
|
||||
$create_date = isset($_REQUEST['createdate']) ? (int)strtotime($_REQUEST['createdate'] ): null;
|
||||
$player_id = isset($_REQUEST['player_id']) ? (int)$_REQUEST['player_id'] : null;
|
||||
$type = isset($_REQUEST['type']) ? (int)$_REQUEST['type'] : null;
|
||||
$where = isset($_REQUEST['where']) ? (int)$_REQUEST['where'] : null;
|
||||
|
||||
$changelog = $Parsedown->text($changelog); # prints: <p>Hello <em>Parsedown</em>!</p>
|
||||
$errors = array();
|
||||
|
||||
echo '<div>' . $changelog . '</div>';
|
||||
if($action == 'add') {
|
||||
|
||||
if(Changelog::add($body, $type, $where, $player_id, $create_date, $errors)) {
|
||||
$body = '';
|
||||
$type = $where = $player_id = $create_date = 0;
|
||||
|
||||
success("Added successful.");
|
||||
}
|
||||
}
|
||||
else if($action == 'delete') {
|
||||
Changelog::delete($id, $errors);
|
||||
success("Deleted successful.");
|
||||
}
|
||||
else if($action == 'edit')
|
||||
{
|
||||
if(isset($id) && !isset($body)) {
|
||||
$cl = Changelog::get($id);
|
||||
$body = $cl['body'];
|
||||
$type = $cl['type'];
|
||||
$where = $cl['where'];
|
||||
$create_date = $cl['date'];
|
||||
$player_id = $cl['player_id'];
|
||||
}
|
||||
else {
|
||||
if(Changelog::update($id, $body, $type, $where, $player_id, $create_date,$errors)) {
|
||||
$action = $body = '';
|
||||
$type = $where = $player_id = $create_date = 0;
|
||||
|
||||
success("Updated successful.");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if($action == 'hide') {
|
||||
Changelog::toggleHidden($id, $errors, $status);
|
||||
success(($status == 1 ? 'Show' : 'Hide') . " successful.");
|
||||
}
|
||||
|
||||
if(!empty($errors))
|
||||
error(implode(", ", $errors));
|
||||
}
|
||||
|
||||
$changelogs = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'changelog' . '` ORDER BY `id` DESC')->fetchAll();
|
||||
|
||||
$i = 0;
|
||||
|
||||
$log_type = [
|
||||
['id' => 1, 'icon' => 'added'],
|
||||
['id' => 2, 'icon' => 'removed'],
|
||||
['id' => 3, 'icon' => 'changed'],
|
||||
['id' => 4, 'icon' => 'fixed'],
|
||||
];
|
||||
|
||||
$log_where = [
|
||||
['id' => 1, 'icon' => 'server'],
|
||||
['id' => 2, 'icon' => 'website'],
|
||||
];
|
||||
|
||||
foreach($changelogs as $key => &$log)
|
||||
{
|
||||
$log['type'] = getChangelogType($log['type']);
|
||||
$log['where'] = getChangelogWhere($log['where']);
|
||||
}
|
||||
|
||||
if($action == 'edit' || $action == 'new') {
|
||||
if($action == 'edit') {
|
||||
$player = new OTS_Player();
|
||||
$player->load($player_id);
|
||||
}
|
||||
|
||||
$account_players = $account_logged->getPlayersList();
|
||||
$account_players->orderBy('group_id', POT::ORDER_DESC);
|
||||
$twig->display('admin.changelog.form.html.twig', array(
|
||||
'action' => $action,
|
||||
'cl_link_form' => constant('ADMIN_URL').'?p=changelog&action=' . ($action == 'edit' ? 'edit' : 'add'),
|
||||
'cl_id' => isset($id) ? $id : null,
|
||||
'body' => isset($body) ? htmlentities($body, ENT_COMPAT, 'UTF-8') : '',
|
||||
'create_date' => isset($create_date) ? $create_date : '',
|
||||
'player' => isset($player) && $player->isLoaded() ? $player : null,
|
||||
'player_id' => isset($player_id) ? $player_id : null,
|
||||
'account_players' => $account_players,
|
||||
'type' => isset($type) ? $type : 0,
|
||||
'where' => isset($where) ? $where : 0,
|
||||
'log_type' => $log_type,
|
||||
'log_where' => $log_where,
|
||||
));
|
||||
}
|
||||
$twig->display('admin.changelog.html.twig', array(
|
||||
'changelogs' => $changelogs,
|
||||
));
|
||||
|
||||
?>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#createdate').datetimepicker({format: "M d Y, H:i:s",});
|
||||
|
||||
$('.tb_datatable').DataTable({
|
||||
"order": [[0, "desc"]],
|
||||
"columnDefs": [{targets: [1, 2,4,5],orderable: false}]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
25
system/pages/admin/clmd.php
Normal file
25
system/pages/admin/clmd.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* CHANGELOG viewer
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @author Lee
|
||||
* @copyright 2020 MyAAC
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'MyAAC Changelog';
|
||||
|
||||
if (!file_exists(BASE . 'CHANGELOG.md')) {
|
||||
echo 'File CHANGELOG.md doesn\'t exist.';
|
||||
return;
|
||||
}
|
||||
|
||||
$changelog = file_get_contents(BASE . 'CHANGELOG.md');
|
||||
|
||||
$Parsedown = new Parsedown();
|
||||
|
||||
$changelog = $Parsedown->text($changelog); # prints: <p>Hello <em>Parsedown</em>!</p>
|
||||
|
||||
echo '<div>' . $changelog . '</div>';
|
@@ -47,33 +47,20 @@ $tmp = '';
|
||||
if (fetchDatabaseConfig('site_closed_message', $tmp))
|
||||
$closed_message = $tmp;
|
||||
|
||||
$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(
|
||||
'count' => $query_count,
|
||||
));
|
||||
|
||||
echo '<div class="row">';
|
||||
$twig->display('admin.dashboard.html.twig', array(
|
||||
'is_closed' => $is_closed,
|
||||
'closed_message' => $closed_message,
|
||||
'status' => $status,
|
||||
'account_type' => USE_ACCOUNT_NAME ? 'name' : 'number'
|
||||
));
|
||||
$twig->display('admin.dashboard.html.twig', array());
|
||||
echo '</div>';
|
||||
|
||||
$configAdminPanelModules = config('admin_panel_modules');
|
||||
if (isset($configAdminPanelModules))
|
||||
if (isset($configAdminPanelModules)) {
|
||||
echo '<div class="row">';
|
||||
$configAdminPanelModules = explode(',', $configAdminPanelModules);
|
||||
|
||||
$twig_loader->prependPath(__DIR__ . '/modules/templates');
|
||||
foreach ($configAdminPanelModules as $box) {
|
||||
$file = __DIR__ . '/modules/' . $box . '.php';
|
||||
if (file_exists($file)) {
|
||||
include($file);
|
||||
$twig_loader->prependPath(__DIR__ . '/modules/templates');
|
||||
foreach ($configAdminPanelModules as $box) {
|
||||
$file = __DIR__ . '/modules/' . $box . '.php';
|
||||
if (file_exists($file)) {
|
||||
include($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
@@ -13,5 +13,6 @@ $title = 'Login';
|
||||
$twig->display('admin.login.html.twig', array(
|
||||
'logout' => ($action == 'logout' ? 'You have been logged out!' : ''),
|
||||
'account' => USE_ACCOUNT_NAME ? 'Name' : 'Number',
|
||||
'account_login_by' => getAccountLoginByLabel(),
|
||||
'errors' => isset($errors)? $errors : ''
|
||||
));
|
||||
|
@@ -15,55 +15,69 @@ if (!hasFlag(FLAG_CONTENT_MAILER) && !superAdmin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$config['mail_enabled']) {
|
||||
if (!config('mail_enabled')) {
|
||||
echo 'Mail support disabled.';
|
||||
return;
|
||||
}
|
||||
|
||||
$mail_content = isset($_POST['mail_content']) ? stripslashes($_POST['mail_content']) : NULL;
|
||||
$mail_subject = isset($_POST['mail_subject']) ? stripslashes($_POST['mail_subject']) : NULL;
|
||||
$preview = isset($_REQUEST['preview']);
|
||||
$mail_to = isset($_REQUEST['mail_to']) ? stripslashes(trim($_REQUEST['mail_to'])) : null;
|
||||
$mail_subject = isset($_POST['mail_subject']) ? stripslashes($_POST['mail_subject']) : null;
|
||||
$mail_content = isset($_POST['mail_content']) ? stripslashes($_POST['mail_content']) : null;
|
||||
|
||||
$preview_done = false;
|
||||
if ($preview) {
|
||||
if (!empty($mail_content) && !empty($mail_subject)) {
|
||||
$preview_done = _mail($account_logged->getCustomField('email'), $mail_subject, $mail_content);
|
||||
if (isset($_POST['submit'])) {
|
||||
if (empty($mail_subject)) {
|
||||
warning('Please enter subject of the message.');
|
||||
}
|
||||
|
||||
if (!$preview_done)
|
||||
error('Error while sending preview mail. More info can be found in system/logs/mailer-error.log');
|
||||
if (empty($mail_content)) {
|
||||
warning('Please enter content of the message.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$twig->display('admin.mailer.html.twig', array(
|
||||
'mail_subject' => $mail_subject,
|
||||
'mail_content' => $mail_content,
|
||||
'preview_done' => $preview_done
|
||||
));
|
||||
|
||||
if (empty($mail_content) || empty($mail_subject) || $preview)
|
||||
return;
|
||||
|
||||
$success = 0;
|
||||
$failed = 0;
|
||||
|
||||
$add = '';
|
||||
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))
|
||||
$success++;
|
||||
if (!empty($mail_to)) {
|
||||
if(!Validator::email($mail_to)) {
|
||||
warning('E-Mail is invalid.');
|
||||
}
|
||||
else {
|
||||
$failed++;
|
||||
echo '<br />';
|
||||
error('An error occorred while sending email to <b>' . $email['email'] . '</b>. For Admin: More info can be found in system/logs/mailer-error.log');
|
||||
if (!empty($mail_content) && !empty($mail_subject)) {
|
||||
if (_mail($mail_to, $mail_subject, $mail_content)) {
|
||||
success("Successfully mailed <strong>$mail_to</strong>");
|
||||
}
|
||||
else {
|
||||
error("Error while sending mail to <strong>$mail_to</strong>. More info can be found in system/logs/mailer-error.log");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success('Mailing finished.');
|
||||
success("$success emails delivered.");
|
||||
warning("$failed emails failed.");
|
||||
if (!empty($mail_content) && !empty($mail_subject) && empty($mail_to)) {
|
||||
$success = 0;
|
||||
$failed = 0;
|
||||
|
||||
$add = '';
|
||||
if (config('account_mail_verify')) {
|
||||
note('Note: Sending only to users with verified E-Mail.');
|
||||
$add = ' AND `email_verified` = 1';
|
||||
}
|
||||
|
||||
$query = $db->query('SELECT `email` FROM `accounts` WHERE `email` != ""' . $add);
|
||||
foreach ($query as $email) {
|
||||
if (_mail($email['email'], $mail_subject, $mail_content)) {
|
||||
$success++;
|
||||
}
|
||||
else {
|
||||
$failed++;
|
||||
echo '<br />';
|
||||
error('An error occorred while sending email to <b>' . $email['email'] . '</b>. For Admin: More info can be found in system/logs/mailer-error.log');
|
||||
}
|
||||
}
|
||||
|
||||
success('Mailing finished.');
|
||||
success("$success emails delivered.");
|
||||
warning("$failed emails failed.");
|
||||
}
|
||||
|
||||
$twig->display('admin.mailer.html.twig', [
|
||||
'mail_to' => $mail_to,
|
||||
'mail_subject' => $mail_subject,
|
||||
'mail_content' => $mail_content
|
||||
]);
|
||||
|
@@ -112,7 +112,7 @@ if (isset($_REQUEST['template'])) {
|
||||
<div class="col-md-12">
|
||||
<button type="submit" class="btn btn-info"><i class="fas fa-update"></i> Save</button>
|
||||
<?php
|
||||
echo '<button type="button" class="btn btn-danger float-right" value="Cancel" onclick="window.location = \'' . ADMIN_URL . '?p=menus&template=' . $template . '\';"><i class="fas fa-cancel"></i> Cancel</button>';
|
||||
echo '<button type="button" class="btn btn-danger float-right" value="Cancel" onclick="window.location = \'' . ADMIN_URL . '?p=menus\';"><i class="fas fa-cancel"></i> Cancel</button>';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
46
system/pages/admin/modules/server_status.php
Normal file
46
system/pages/admin/modules/server_status.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
if (isset($status)) {
|
||||
|
||||
$error_icon = '<i class="fas fa-exclamation-circle text-danger"></i>'; ?>
|
||||
<div class=" col-md-6 col-lg-6">
|
||||
<div class="card card-info card-outline">
|
||||
<div class="card-header border-bottom-0">
|
||||
<span class="font-weight-bold m-0">Server Status</span> <span class="float-right small"><b>Last checked</b>: <?php echo(isset($status['lastCheck']) ? date("l, d.m.Y H:i:s", $status['lastCheck']) : $error_icon); ?></span>
|
||||
</div>
|
||||
<div class="card-body p-0 ">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th width="30%">Server</th>
|
||||
<td><?php echo(isset($status['server']) & isset($status['serverVersion']) ? $status['server'] . ' x ' . $status['serverVersion'] : $error_icon) ?></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Client</th>
|
||||
<td><?php echo(isset($status['clientVersion']) ? $status['clientVersion'] : $error_icon) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Map</th>
|
||||
<td>
|
||||
<?php if (isset($status['mapName']) & isset($status['mapAuthor']) & isset($status['mapWidth']) & isset($status['mapHeight'])) {
|
||||
echo $status['mapName'] . ' by <b>' . $status['mapAuthor'] . '</b><br/>' . $status['mapWidth'] . ' x ' . $status['mapHeight'];
|
||||
} else {
|
||||
echo $error_icon;
|
||||
} ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Monsters</th>
|
||||
<td><?php echo (isset($status['monsters']) ? $status['monsters'] : $error_icon); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>MOTD:</th>
|
||||
<td><?php echo(isset($status['motd']) ? $status['motd'] : $error_icon); ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
12
system/pages/admin/modules/statistics.php
Normal file
12
system/pages/admin/modules/statistics.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$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 `' . TABLE_PREFIX . 'monsters`) as total_monsters,
|
||||
(SELECT COUNT(*) FROM `houses`) as total_houses;')->fetch();
|
||||
|
||||
$twig->display('statistics.html.twig', array(
|
||||
'count' => $count,
|
||||
));
|
45
system/pages/admin/modules/templates/statistics.html.twig
Normal file
45
system/pages/admin/modules/templates/statistics.html.twig
Normal file
@@ -0,0 +1,45 @@
|
||||
<div class="col">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-info elevation-1"><i class="fas fa-user-plus"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Accounts:</span>
|
||||
<span class="info-box-number">{{ count.total_accounts }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-red elevation-1"><i class="fas fa-user-plus"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Players:</span>
|
||||
<span class="info-box-number">{{ count.total_players }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-teal elevation-1"><i class="fas fa-pastafarianism"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Monsters:</span>
|
||||
<span class="info-box-number">{{ count.total_monsters }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-green elevation-1"><i class="fas fa-chart-pie"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Guilds:</span>
|
||||
<span class="info-box-number">{{ count.total_guilds }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-yellow elevation-1"><i class="fas fa-home"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Houses:</span>
|
||||
<span class="info-box-number">{{ count.total_houses }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
39
system/pages/admin/modules/templates/web_status.twig
Normal file
39
system/pages/admin/modules/templates/web_status.twig
Normal file
@@ -0,0 +1,39 @@
|
||||
<div class="col-12 col-md-6">
|
||||
<div class="card card-warning card-outline">
|
||||
<form action="?p=dashboard&maintenance" method="post" class="form-horizontal">
|
||||
<div class="card-header">
|
||||
<span class="m-0">Website Status<span class="float-right">
|
||||
<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
|
||||
<input type="checkbox" class="custom-control-input" name="status" id="status" value="true" {% if not is_closed %} checked{% endif %}>
|
||||
<label id="status-label" class="custom-control-label" for="status"> {% if is_closed %}Closed{% else %}Open{% endif %}</label>
|
||||
</div></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body p-2">
|
||||
<div class="col-sm-12">
|
||||
<label for="message" class="col-form-label">Maintenance Message</label>
|
||||
<textarea name="message" class="form-control" cols="40" rows="3" maxlength="255" placeholder="Enter ...">{{ closed_message }}</textarea>
|
||||
<small>(only visible if closed)</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button type="submit" class="btn btn-info"><i class="far fa-update"></i> Update</button>
|
||||
<a href="?p=dashboard&clear_cache" onclick="return confirm('Are you sure?');" class="float-right">
|
||||
<span class="btn btn-danger"><i class="fas fa-clear"></i>Clear cache</span>
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$("#status").change(function() {
|
||||
$statusLabel = $("#status-label");
|
||||
$statusLabel.html("Closed");
|
||||
if ($(this).is(':checked')) {
|
||||
$statusLabel.html("Open");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
10
system/pages/admin/modules/web_status.php
Normal file
10
system/pages/admin/modules/web_status.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
$twig->display('web_status.twig', array(
|
||||
'is_closed' => $is_closed,
|
||||
'closed_message' => $closed_message,
|
||||
'status' => $status,
|
||||
'account_type' => USE_ACCOUNT_NAME ? 'name' : 'number'
|
||||
));
|
||||
?>
|
@@ -13,6 +13,7 @@ require_once LIBS . 'forum.php';
|
||||
require_once LIBS . 'news.php';
|
||||
|
||||
$title = 'News Panel';
|
||||
$use_datatable = true;
|
||||
|
||||
if (!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin()) {
|
||||
echo 'Access denied.';
|
||||
|
@@ -12,6 +12,7 @@ defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Player editor';
|
||||
$player_base = BASE_URL . 'admin/?p=players';
|
||||
|
||||
$use_datatable = true;
|
||||
require_once LIBS . 'forum.php';
|
||||
|
||||
$skills = array(
|
||||
@@ -308,7 +309,7 @@ else if (isset($_REQUEST['search'])) {
|
||||
<h5 class="m-0">Players</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="player_datatable table table-striped table-bordered">
|
||||
<table class="player_datatable table table-striped table-bordered table-responsive d-md-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
@@ -699,7 +700,7 @@ else if (isset($_REQUEST['search'])) {
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="tabs-posts">
|
||||
<table class="table table-striped table-condensed">
|
||||
<table class="table table-striped table-condensed table-responsive d-md-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="w-25">Topic</th>
|
||||
@@ -739,7 +740,7 @@ else if (isset($_REQUEST['search'])) {
|
||||
$account_players = $account->getPlayersList();
|
||||
$account_players->orderBy('id');
|
||||
if (isset($account_players)) { ?>
|
||||
<table class="table table-striped table-condensed">
|
||||
<table class="table table-striped table-condensed table-responsive d-md-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
|
@@ -24,10 +24,10 @@ if (!$myaac_version) {
|
||||
$version_compare = version_compare($myaac_version, MYAAC_VERSION);
|
||||
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'));
|
||||
<br/>View CHANGELOG ' . generateLink(ADMIN_URL . '?p=clmd', 'here'));
|
||||
} else if ($version_compare < 0) {
|
||||
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'));
|
||||
<br/>View CHANGELOG ' . generateLink(ADMIN_URL . '?p=clmd', 'here'));
|
||||
} else {
|
||||
warning('You\'re using outdated version.<br/>
|
||||
Your version: <b>' . MYAAC_VERSION . '</b><br/>
|
||||
|
@@ -11,82 +11,116 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Bans list';
|
||||
|
||||
if($config['otserv_version'] == TFS_02)
|
||||
{
|
||||
echo 'Bans page doesnt work on TFS 0.2/1.0.';
|
||||
$configBansPerPage = config('bans_per_page');
|
||||
$_page = isset($_GET['page']) ? $_GET['page'] : 1;
|
||||
|
||||
if(!is_numeric($_page) || $_page < 1 || $_page > PHP_INT_MAX) {
|
||||
$_page = 1;
|
||||
}
|
||||
|
||||
$offset = ($_page - 1) * $configBansPerPage;
|
||||
|
||||
/**
|
||||
* @var OTS_DB_MySQL $db
|
||||
*/
|
||||
$configBans = [];
|
||||
$configBans['hasType'] = false;
|
||||
$configBans['hasReason'] = false;
|
||||
|
||||
$limit = 'LIMIT ' . ($configBansPerPage + 1) . (isset($offset) ? ' OFFSET ' . $offset : '');
|
||||
if ($db->hasTable('account_bans')) {
|
||||
$bansQuery = $db->query('SELECT * FROM `account_bans` ORDER BY `banned_at` DESC ' . $limit);
|
||||
}
|
||||
else if ($db->hasTable('bans') && $db->hasColumn('bans', 'active')
|
||||
&& $db->hasColumn('bans', 'type') && $db->hasColumn('bans', 'reason')) {
|
||||
$bansQuery = $db->query('SELECT * FROM `bans` WHERE `active` = 1 ORDER BY `added` DESC ' . $limit);
|
||||
$configBans['hasType'] = true;
|
||||
$configBans['hasReason'] = true;
|
||||
}
|
||||
else {
|
||||
echo 'Bans list is not supported in your distribution.';
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$config['bans_display_all'])
|
||||
echo 'Last ' . $config['bans_limit'] . ' banishments.<br/><br/>';
|
||||
|
||||
if($config['bans_display_all'])
|
||||
if(!$bansQuery->rowCount())
|
||||
{
|
||||
$_page = isset($_GET['page']) ? $_GET['page'] : 0;
|
||||
$offset = $_page * $config['bans_limit'] + 1;
|
||||
}
|
||||
|
||||
$bans = $db->query('SELECT * FROM ' . $db->tableName('bans') . ' WHERE ' . $db->fieldName('active') . ' = 1 ORDER BY ' . $db->fieldName('added') . ' DESC LIMIT ' . ($config['bans_limit'] + 1) . (isset($offset) ? ' OFFSET ' . $offset : ''));
|
||||
if(!$bans->rowCount())
|
||||
{
|
||||
?>
|
||||
There are no banishments yet.
|
||||
<?php
|
||||
echo 'There are no banishments yet.';
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<table border="0" cellspacing="1" cellpadding="4" width="100%">
|
||||
<tr align="center" bgcolor="<?php echo $config['vdarkborder']; ?>" class="white">
|
||||
<td><span style="color: white"><b>Nick</b></span></td>
|
||||
<td><span style="color: white"><b>Type</b></span></td>
|
||||
<td><span style="color: white"><b>Expires</b></span></td>
|
||||
<td><span style="color: white"><b>Reason</b></span></td>
|
||||
<td><span style="color: white"><b>Comment</b></span></td>
|
||||
<td><span style="color: white"><b>Added by:</b></span></td>
|
||||
</tr>
|
||||
<?php
|
||||
foreach($bans as $ban)
|
||||
|
||||
$nextPage = false;
|
||||
$i = 0;
|
||||
$bans = $bansQuery->fetchAll();
|
||||
foreach ($bans as $id => &$ban)
|
||||
{
|
||||
if($i++ > 100)
|
||||
if(++$i > $configBansPerPage)
|
||||
{
|
||||
$next_page = true;
|
||||
unset($bans[$id]);
|
||||
$nextPage = true;
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<tr align="center" bgcolor="<?php echo getStyle($i); ?>">
|
||||
<td height="50" width="140"><?php echo getPlayerLink(getPlayerNameByAccount($ban['value'])); ?></td>
|
||||
<td><?php echo getBanType($ban['type']); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if($ban['expires'] == "-1")
|
||||
echo 'Never';
|
||||
else
|
||||
echo date("H:i:s", $ban['expires']) . '<br/>' . date("d M Y", $ban['expires']);
|
||||
?>
|
||||
</td>
|
||||
<td><?php echo getBanReason($ban['reason']); ?></td>
|
||||
<td><?php echo $ban['comment']; ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if($ban['admin_id'] == "0")
|
||||
echo 'Autoban';
|
||||
else
|
||||
echo getPlayerLink(getPlayerNameByAccount($ban['admin_id']));
|
||||
|
||||
echo '<br/>' . date("d.m.Y", $ban['added']);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$ban['i'] = $i;
|
||||
if ($db->hasColumn('bans', 'value')) {
|
||||
$accountId = $ban['value'];
|
||||
}
|
||||
else {
|
||||
// TFS 1.x
|
||||
$accountId = $ban['account_id'];
|
||||
}
|
||||
|
||||
$ban['player'] = getPlayerLink(getPlayerNameByAccount($accountId));
|
||||
|
||||
if ($configBans['hasType']) {
|
||||
$ban['type'] = getBanType($ban['type']);
|
||||
}
|
||||
|
||||
$expiresColumn = 'expires_at';
|
||||
if ($db->hasColumn('bans', 'expires')) {
|
||||
$expiresColumn = 'expires';
|
||||
}
|
||||
|
||||
if ((int)$ban[$expiresColumn] === -1) {
|
||||
$ban['expires'] = 'Never';
|
||||
}
|
||||
else {
|
||||
$ban['expires'] = date('H:i:s', $ban[$expiresColumn]) . '<br/>' . date('d.M.Y', $ban[$expiresColumn]);
|
||||
}
|
||||
|
||||
if ($configBans['hasReason']) {
|
||||
$ban['reason'] = getBanReason($ban['reason']);
|
||||
}
|
||||
else {
|
||||
$ban['comment'] = $ban['reason'];
|
||||
}
|
||||
|
||||
$addedBy = '';
|
||||
if ($db->hasColumn('bans', 'admin_id')) {
|
||||
if ((int)$ban['admin_id'] === 0) {
|
||||
$addedBy = 'Autoban';
|
||||
}
|
||||
else {
|
||||
$addedBy = getPlayerLink(getPlayerNameByAccount($ban['admin_id']));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$addedBy = getPlayerLink(getPlayerNameByAccount($ban['banned_by']));
|
||||
}
|
||||
|
||||
if ($db->hasColumn('bans', 'added')) {
|
||||
$addedTime = $ban['added'];
|
||||
}
|
||||
else {
|
||||
$addedTime = $ban['banned_at'];
|
||||
}
|
||||
|
||||
$ban['addedTime'] = date('H:i:s', $addedTime) . '<br/>' . date('d.M.Y', $addedTime);
|
||||
$ban['addedBy'] = $addedBy;
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<table border="0" cellpadding="4" cellspacing="1" width="100%">
|
||||
<?php
|
||||
if($_page > 0)
|
||||
echo '<tr><td width="100%" align="right" valign="bottom"><a href="?subtopic=bans&page=' . ($_page - 1) . '" class="size_xxs">Previous Page</a></td></tr>';
|
||||
|
||||
if($next_page)
|
||||
echo '<tr><td width="100%" align="right" valign="bottom"><a href="?subtopic=bans&page=' . ($_page + 1) . '" class="size_xxs">Next Page</a></td></tr>';
|
||||
?>
|
||||
</table>
|
||||
$twig->display('bans.html.twig', [
|
||||
'bans' => $bans,
|
||||
'configBans' => $configBans,
|
||||
'page' => $_page,
|
||||
'nextPage' => $nextPage,
|
||||
]);
|
||||
|
@@ -16,7 +16,9 @@ $limit = 30;
|
||||
$offset = $_page * $limit;
|
||||
$next_page = false;
|
||||
|
||||
$changelogs = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'changelog' . '` WHERE `hidden` = 0 ORDER BY `id` DESC LIMIT ' . ($limit + 1) . ' OFFSET ' . $offset)->fetchAll();
|
||||
$canEdit = hasFlag(FLAG_CONTENT_NEWS) || superAdmin();
|
||||
|
||||
$changelogs = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'changelog` ' . ($canEdit ? '' : 'WHERE `hidden` = 0').' ORDER BY `id` DESC LIMIT ' . ($limit + 1) . ' OFFSET ' . $offset)->fetchAll();
|
||||
|
||||
$i = 0;
|
||||
foreach($changelogs as $key => &$log)
|
||||
@@ -39,33 +41,6 @@ $twig->display('changelog.html.twig', array(
|
||||
'changelogs' => $changelogs,
|
||||
'page' => $_page,
|
||||
'next_page' => $next_page,
|
||||
'canEdit' => $canEdit,
|
||||
));
|
||||
|
||||
function getChangelogType($v)
|
||||
{
|
||||
switch($v) {
|
||||
case 1:
|
||||
return 'added';
|
||||
case 2:
|
||||
return 'removed';
|
||||
case 3:
|
||||
return 'changed';
|
||||
case 4:
|
||||
return 'fixed';
|
||||
}
|
||||
|
||||
return 'unknown';
|
||||
}
|
||||
|
||||
function getChangelogWhere($v)
|
||||
{
|
||||
switch($v) {
|
||||
case 1:
|
||||
return 'server';
|
||||
case 2:
|
||||
return 'website';
|
||||
}
|
||||
|
||||
return 'unknown';
|
||||
}
|
||||
?>
|
||||
|
@@ -412,7 +412,6 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
|
||||
'player_link' => getPlayerLink($player->getName(), false),
|
||||
'hidden' => $hidden,
|
||||
'bannedUntil' => isset($bannedUntil) ? $bannedUntil : null,
|
||||
'characters_link' => getLink('characters'),
|
||||
'account_players' => isset($account_players) ? $account_players : null,
|
||||
'search_form' => generate_search_form(),
|
||||
'canEdit' => hasFlag(FLAG_CONTENT_PLAYERS) || superAdmin()
|
||||
|
@@ -34,11 +34,13 @@ $errors = array();
|
||||
$save = isset($_POST['save']) && $_POST['save'] == 1;
|
||||
if($save)
|
||||
{
|
||||
if(USE_ACCOUNT_NAME) {
|
||||
$account_name = $_POST['account'];
|
||||
}
|
||||
else {
|
||||
$account_id = $_POST['account'];
|
||||
if(!config('account_login_by_email')) {
|
||||
if(USE_ACCOUNT_NAME) {
|
||||
$account_name = $_POST['account'];
|
||||
}
|
||||
else {
|
||||
$account_id = $_POST['account'];
|
||||
}
|
||||
}
|
||||
|
||||
$email = $_POST['email'];
|
||||
@@ -46,12 +48,14 @@ if($save)
|
||||
$password2 = $_POST['password2'];
|
||||
|
||||
// account
|
||||
if(isset($account_id)) {
|
||||
if(!Validator::accountId($account_id))
|
||||
if(!config('account_login_by_email')) {
|
||||
if (isset($account_id)) {
|
||||
if (!Validator::accountId($account_id)) {
|
||||
$errors['account'] = Validator::getLastError();
|
||||
}
|
||||
} else if (!Validator::accountName($account_name))
|
||||
$errors['account'] = Validator::getLastError();
|
||||
}
|
||||
else if(!Validator::accountName($account_name))
|
||||
$errors['account'] = Validator::getLastError();
|
||||
|
||||
// email
|
||||
if(!Validator::email($email))
|
||||
@@ -88,7 +92,7 @@ if($save)
|
||||
}
|
||||
|
||||
// check if account name is not equal to password
|
||||
if(USE_ACCOUNT_NAME && strtoupper($account_name) == strtoupper($password)) {
|
||||
if(!config('account_login_by_email') && USE_ACCOUNT_NAME && strtoupper($account_name) == strtoupper($password)) {
|
||||
$errors['password'] = 'Password may not be the same as account name.';
|
||||
}
|
||||
|
||||
@@ -101,16 +105,28 @@ if($save)
|
||||
}
|
||||
|
||||
$account_db = new OTS_Account();
|
||||
if(USE_ACCOUNT_NAME)
|
||||
$account_db->find($account_name);
|
||||
else
|
||||
$account_db->load($account_id);
|
||||
if (config('account_login_by_email')) {
|
||||
$account_db->findByEMail($email);
|
||||
}
|
||||
else {
|
||||
if(USE_ACCOUNT_NAME) {
|
||||
$account_db->find($account_name);
|
||||
}
|
||||
else {
|
||||
$account_db->load($account_id);
|
||||
}
|
||||
}
|
||||
|
||||
if($account_db->isLoaded()) {
|
||||
if(USE_ACCOUNT_NAME)
|
||||
$errors['account'] = 'Account with this name already exist.';
|
||||
else
|
||||
$errors['account'] = 'Account with this id already exist.';
|
||||
if (config('account_login_by_email') && !config('account_mail_unique')) {
|
||||
$errors['account'] = 'Account with this email already exist.';
|
||||
}
|
||||
else if (!config('account_login_by_email')) {
|
||||
if (USE_ACCOUNT_NAME)
|
||||
$errors['account'] = 'Account with this name already exist.';
|
||||
else
|
||||
$errors['account'] = 'Account with this id already exist.';
|
||||
}
|
||||
}
|
||||
|
||||
if(!isset($_POST['accept_rules']) || $_POST['accept_rules'] !== 'true')
|
||||
@@ -125,11 +141,12 @@ if($save)
|
||||
'accept_rules' => isset($_POST['accept_rules']) ? $_POST['accept_rules'] === 'true' : false,
|
||||
);
|
||||
|
||||
if(USE_ACCOUNT_NAME) {
|
||||
$params['account_name'] = $_POST['account'];
|
||||
}
|
||||
else {
|
||||
$params['account_id'] = $_POST['account'];
|
||||
if (!config('account_login_by_email')) {
|
||||
if (USE_ACCOUNT_NAME) {
|
||||
$params['account_name'] = $_POST['account'];
|
||||
} else {
|
||||
$params['account_id'] = $_POST['account'];
|
||||
}
|
||||
}
|
||||
|
||||
$hooks->trigger(HOOK_ACCOUNT_CREATE_AFTER_SUBMIT, $params);
|
||||
@@ -146,10 +163,15 @@ if($save)
|
||||
if(empty($errors))
|
||||
{
|
||||
$new_account = new OTS_Account();
|
||||
if(USE_ACCOUNT_NAME)
|
||||
$new_account->create($account_name);
|
||||
else
|
||||
$new_account->create(NULL, $account_id);
|
||||
if (config('account_login_by_email')) {
|
||||
$new_account->createWithEmail($email);
|
||||
}
|
||||
else {
|
||||
if(USE_ACCOUNT_NAME)
|
||||
$new_account->create($account_name);
|
||||
else
|
||||
$new_account->create(NULL, $account_id);
|
||||
}
|
||||
|
||||
$config_salt_enabled = $db->hasColumn('accounts', 'salt');
|
||||
if($config_salt_enabled)
|
||||
@@ -187,7 +209,11 @@ if($save)
|
||||
$new_account->setCustomField('premium_points', $config['account_premium_points']);
|
||||
}
|
||||
|
||||
$tmp_account = (USE_ACCOUNT_NAME ? $account_name : $account_id);
|
||||
$tmp_account = $email;
|
||||
if (!config('account_login_by_email')) {
|
||||
$tmp_account = (USE_ACCOUNT_NAME ? $account_name : $account_id);
|
||||
}
|
||||
|
||||
if($config['mail_enabled'] && $config['account_mail_verify'])
|
||||
{
|
||||
$hash = md5(generateRandomString(16, true, true) . $email);
|
||||
|
@@ -5,169 +5,78 @@
|
||||
* @package MyAAC
|
||||
* @author Gesior <jerzyskalski@wp.pl>
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2019 MyAAC
|
||||
* @author Lee
|
||||
* @copyright 2020 MyAAC
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = "Creatures";
|
||||
|
||||
?>
|
||||
<script type="text/javascript" src="tools/js/tipped.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="tools/css/tipped.css"/>
|
||||
<link rel="stylesheet" href="<?php echo BASE_URL; ?>tools/css/datatables.min.css">
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
Tipped.create('.item_image');
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
$canEdit = hasFlag(FLAG_CONTENT_MONSTERS) || admin();
|
||||
if (isset($_POST['reload_monsters']) && $canEdit) {
|
||||
require LIBS . 'creatures.php';
|
||||
if (Creatures::loadFromXML(true)) {
|
||||
if (Creatures::getMonstersList()->hasErrors())
|
||||
error('There were some problems loading your monsters.xml file. Please check system/logs/error.log for more info.');
|
||||
} else {
|
||||
error(Creatures::getLastError());
|
||||
}
|
||||
}
|
||||
|
||||
if ($canEdit) {
|
||||
?>
|
||||
<form method="post" action="<?php echo getLink('creatures'); ?>">
|
||||
<input type="hidden" name="reload_monsters" value="yes"/>
|
||||
<input type="submit" value="(admin) Reload monsters"/>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (empty($_REQUEST['creature'])) {
|
||||
//send query to database
|
||||
$monsters = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 ORDER BY name asc');
|
||||
echo '<table id="creaturestb" class=""><thead>
|
||||
<tr role="row"><th>Name</th><th>Health</th><th>Experience</th>
|
||||
<th>Summonable Mana</th><th>Convinceable Mana</th><th>Race</th></tr>
|
||||
</thead><tbody>';
|
||||
$preview = config('creatures_images_preview');
|
||||
$creatures = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 '.(empty($_REQUEST['boss']) ? '': 'AND `rewardboss` = 1').' ORDER BY name asc')->fetchAll();
|
||||
|
||||
foreach ($monsters as $monster) {
|
||||
echo '<tr><td><a href="?subtopic=creatures&creature=' . urlencode($monster['name']) . '">' . $monster['name'] . '</a></td>
|
||||
<td>' . $monster['health'] . '</td>
|
||||
<td>' . $monster['exp'] . '</td>
|
||||
<td>' . ($monster['summonable'] ? $monster['mana'] : "---") . '</td>
|
||||
<td>' . ($monster['convinceable'] ? $monster['mana'] : "---") . '</td>
|
||||
<td>' . ucwords($monster['race']) . '</td></tr>';
|
||||
if ($preview) {
|
||||
foreach($creatures as $key => &$creature)
|
||||
{
|
||||
$creature['img_link'] = getCreatureImgPath($creature['name']);
|
||||
}
|
||||
}
|
||||
echo '</tbody></table>';
|
||||
|
||||
$twig->display('creatures.html.twig', array(
|
||||
'creatures' => $creatures,
|
||||
'preview' => $preview
|
||||
));
|
||||
|
||||
} else {
|
||||
$monster_name = stripslashes(trim(ucwords($_REQUEST['creature'])));
|
||||
$monster = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 AND `name` = ' . $db->quote($monster_name) . ';')->fetch();
|
||||
if (isset($monster['name'])) {
|
||||
$title = $monster['name'] . " - Creatures";
|
||||
$creature_name = urldecode(stripslashes(ucwords(strtolower($_REQUEST['creature']))));
|
||||
$prep = $db->prepare('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 AND `name` = ? LIMIT 1;');
|
||||
$prep->execute([$creature_name]);
|
||||
$creature = $prep->fetch();
|
||||
|
||||
echo '<div style="text-align:center"><h2>' . $monster['name'] . '</h2></div>';
|
||||
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><tr><td>
|
||||
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=60%>';
|
||||
$number_of_rows = 0;
|
||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Health: </b></td><td>' . $monster['health'] . '</td></tr>';
|
||||
$number_of_rows++;
|
||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Experience: </b></td><td>' . $monster['exp'] . '</td></tr>';
|
||||
$number_of_rows++;
|
||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Speed like: </b></td><td>' . $monster['speed_lvl'] . ' level';
|
||||
$number_of_rows++;
|
||||
if ($monster['use_haste'])
|
||||
echo ' (Can use haste)';
|
||||
|
||||
echo '</td></tr>';
|
||||
|
||||
$number_of_rows++;
|
||||
if ($monster['summonable'] == 1)
|
||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Summon: </b></td><td>' . $monster['mana'] . ' mana</td></tr>';
|
||||
else {
|
||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Summon: </b></td><td>Impossible</td></tr>';
|
||||
}
|
||||
|
||||
$number_of_rows++;
|
||||
if ($monster['convinceable'] == 1)
|
||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Convince: </b></td><td>' . $monster['mana'] . ' mana</td></tr>';
|
||||
else
|
||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Convince: </b></td><td>Impossible</td></tr>';
|
||||
|
||||
echo '</TABLE></td><td align=left>
|
||||
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=40%>
|
||||
<tr><td align=left>';
|
||||
$monster['gfx_name'] = trim(strtolower($monster['name'])) . ".gif";
|
||||
if (!file_exists('images/monsters/' . $monster['gfx_name'])) {
|
||||
$gfx_name = str_replace(" ", "", $monster['gfx_name']);
|
||||
if (file_exists('images/monsters/' . $gfx_name))
|
||||
echo '<img src="images/monsters/' . $gfx_name . '" height="128" width="128">';
|
||||
else
|
||||
echo '<img src="images/monsters/nophoto.png" height="128" width="128">';
|
||||
} else
|
||||
echo '<img src="images/monsters/' . $monster['gfx_name'] . '" height="128" width="128">';
|
||||
|
||||
echo '</td></tr>
|
||||
</TABLE></td></tr><tr><td>
|
||||
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>';
|
||||
$immunities = json_decode($monster['immunities'], true);
|
||||
if (count($immunities) > 0) {
|
||||
$number_of_rows++;
|
||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Immunities: </b></td><td width="100%">' . implode(', ', $immunities) . '</td></tr>';
|
||||
}
|
||||
|
||||
$voices = json_decode($monster['voices'], true);
|
||||
if (count($voices) > 0) {
|
||||
foreach ($voices as &$voice) {
|
||||
$voice = '"' . $voice . '"';
|
||||
if (isset($creature['name'])) {
|
||||
function sort_by_chance($a, $b)
|
||||
{
|
||||
if ($a['chance'] == $b['chance']) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$number_of_rows++;
|
||||
echo '<tr BGCOLOR="' . getStyle($number_of_rows) . '"><td width="100"><b>Voices: </b></td><td width="100%">' . implode(', ', $voices) . '</td></tr>';
|
||||
}
|
||||
echo '</TABLE></td></tr>';
|
||||
|
||||
$loot = json_decode($monster['loot'], true);
|
||||
if ($loot) {
|
||||
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><tr><td style="display: block;">';
|
||||
function sort_by_chance($a, $b)
|
||||
{
|
||||
if ($a['chance'] == $b['chance']) {
|
||||
return 0;
|
||||
}
|
||||
return ($a['chance'] > $b['chance']) ? -1 : 1;
|
||||
}
|
||||
|
||||
usort($loot, 'sort_by_chance');
|
||||
|
||||
$i = 0;
|
||||
foreach ($loot as $item) {
|
||||
$name = getItemNameById($item['id']);
|
||||
$tooltip = $name . '<br/>Chance: ' . round($item['chance'] / 1000, 2) . '%<br/>Max count: ' . $item['count'];
|
||||
|
||||
echo '<img src="' . $config['item_images_url'] . $item['id'] . config('item_images_extension') . '" class="item_image" title="' . $tooltip . '" width="32" height="32" border="0" alt=" ' . $name . '" />';
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo '</td></tr></TABLE>';
|
||||
return ($a['chance'] > $b['chance']) ? -1 : 1;
|
||||
}
|
||||
|
||||
echo '</td></tr>';
|
||||
echo '</TABLE>';
|
||||
$title = $creature['name'] . " - Creatures";
|
||||
|
||||
$creature['img_link']= getCreatureImgPath($creature_name);
|
||||
|
||||
$voices = json_decode($creature['voices'], true);
|
||||
$summons = json_decode($creature['summons'], true);
|
||||
$elements = json_decode($creature['elements'], true);
|
||||
$immunities = json_decode($creature['immunities'], true);
|
||||
$loot = json_decode($creature['loot'], true);
|
||||
usort($loot, 'sort_by_chance');
|
||||
|
||||
foreach ($loot as &$item) {
|
||||
$item['name'] = getItemNameById($item['id']);
|
||||
$item['rarity_chance'] = round($item['chance'] / 1000, 2);
|
||||
$item['rarity'] = getItemRarity($item['chance']);
|
||||
$item['tooltip'] = ucfirst($item['name']) . '<br/>Chance: ' . $item['rarity'] . (config('creatures_loot_percentage') ? ' ('. $item['rarity_chance'] .'%)' : '') . '<br/>Max count: ' . $item['count'];
|
||||
}
|
||||
|
||||
$creature['loot'] = isset($loot) ? $loot : null;
|
||||
$creature['voices'] = isset($voices) ? $voices : null;
|
||||
$creature['summons'] = isset($summons) ? $summons : null;
|
||||
$creature['elements'] = isset($elements) ? $elements : null;
|
||||
$creature['immunities'] = isset($immunities) ? $immunities : null;
|
||||
|
||||
$twig->display('creature.html.twig', array(
|
||||
'creature' => $creature,
|
||||
));
|
||||
|
||||
} else {
|
||||
echo "Monster with name <b>" . $monster_name . "</b> doesn't exist.";
|
||||
echo "Creature with name <b>" . $creature_name . "</b> doesn't exist.";
|
||||
}
|
||||
|
||||
//back button
|
||||
$twig->display('creatures.back_button.html.twig');
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#creaturestb').DataTable();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script src="<?php echo BASE_URL; ?>tools/js/datatables.min.js"></script>
|
@@ -43,7 +43,15 @@ echo '<br /><br />Page: '.$links_to_pages.'<br />';
|
||||
$last_threads = $db->query("SELECT `players`.`id` as `player_id`, `players`.`name`, `" . FORUM_TABLE_PREFIX . "forum`.`post_text`, `" . FORUM_TABLE_PREFIX . "forum`.`post_topic`, `" . FORUM_TABLE_PREFIX . "forum`.`id`, `" . FORUM_TABLE_PREFIX . "forum`.`last_post`, `" . FORUM_TABLE_PREFIX . "forum`.`replies`, `" . FORUM_TABLE_PREFIX . "forum`.`views`, `" . FORUM_TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . FORUM_TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . FORUM_TABLE_PREFIX . "forum`.`author_guid` AND `" . FORUM_TABLE_PREFIX . "forum`.`section` = ".(int) $section_id." AND `" . FORUM_TABLE_PREFIX . "forum`.`first_post` = `" . FORUM_TABLE_PREFIX . "forum`.`id` ORDER BY `" . FORUM_TABLE_PREFIX . "forum`.`last_post` DESC LIMIT ".$config['forum_threads_per_page']." OFFSET ".($_page * $config['forum_threads_per_page']))->fetchAll();
|
||||
if(isset($last_threads[0]))
|
||||
{
|
||||
echo '<table width="100%"><tr bgcolor="'.$config['vdarkborder'].'" align="center"><td><span style="color: white; font-size: 10px"><b>Thread</b></span></td><td><span style="color: white; font-size: 10px"><b>Thread Starter</b></span></td><td><span style="color: white; font-size: 10px"><b>Replies</b></span></td><td><span style="color: white; font-size: 10px"><b>Views</b></span></td><td><span style="color: white; font-size: 10px"><b>Last Post</b></span></td></tr>';
|
||||
echo '<table width="100%">
|
||||
<tr bgcolor="'.$config['vdarkborder'].'" align="center">
|
||||
<td class="white">
|
||||
<span style="font-size: 10px"><b>Thread</b></span></td>
|
||||
<td><span style="font-size: 10px"><b>Thread Starter</b></span></td>
|
||||
<td><span style="font-size: 10px"><b>Replies</b></span></td>
|
||||
<td><span style="font-size: 10px"><b>Views</b></span></td>
|
||||
<td><span style="font-size: 10px"><b>Last Post</b></span></td>
|
||||
</tr>';
|
||||
|
||||
$player = new OTS_Player();
|
||||
foreach($last_threads as $thread)
|
||||
@@ -83,4 +91,4 @@ if(isset($last_threads[0]))
|
||||
else
|
||||
echo '<h3>No threads in this board.</h3>';
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -39,13 +39,10 @@ if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
|
||||
$player->find($name);
|
||||
if(!$player->isLoaded()) {
|
||||
$errors[] = 'Player with name <b>'.$name.'</b> doesn\'t exist.';
|
||||
}
|
||||
else
|
||||
{
|
||||
$rank_of_player = $player->getRank();
|
||||
if($rank_of_player->isLoaded()) {
|
||||
$errors[] = 'Character with name <b>'.$name.'</b> is already in guild. You must leave guild before you join other guild.';
|
||||
}
|
||||
}else if ($player->getAccountID() != $account_logged->getId()) {
|
||||
$errors[] = 'Character with name <b> ' . $name. ' </b> is not in your account.';
|
||||
}else if ($player->getRank()->isLoaded()){
|
||||
$errors[] = 'Character with name <b>'.$name.'</b> is already in guild. You must leave guild before you join other guild.';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,9 +60,8 @@ if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!$is_invited) {
|
||||
$errors[] = 'Character '.$player->getName.' isn\'t invited to guild <b>'.$guild->getName().'</b>.';
|
||||
$errors[] = 'Character '.$player->getName() .' isn\'t invited to guild <b>'.$guild->getName().'</b>.';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,4 +120,4 @@ else {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -51,8 +51,7 @@ if(empty($errors)) {
|
||||
}
|
||||
|
||||
$twig->display('guilds.change_description.html.twig', array(
|
||||
'guild' => $guild,
|
||||
'rows' => bcsub($config['guild_description_lines_limit'],1)
|
||||
'guild' => $guild
|
||||
));
|
||||
}
|
||||
else {
|
||||
@@ -72,4 +71,4 @@ if(!empty($errors)) {
|
||||
));
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -86,7 +86,7 @@ if($guild_vice)
|
||||
else
|
||||
{
|
||||
$player_in_guild = false;
|
||||
if($guild->getName() === $player_to_change->getRank()->getGuild()->getName() || $guild_leader)
|
||||
if($guild->getName() === $player_to_change->getRank()->getGuild()->getName())
|
||||
{
|
||||
$player_in_guild = true;
|
||||
$player_has_lower_rank = false;
|
||||
|
@@ -77,8 +77,12 @@ if(empty($guild_errors)) {
|
||||
$new_rank->setName('New Rank level '.$rank->getLevel());
|
||||
$new_rank->save();
|
||||
}
|
||||
|
||||
foreach($players_with_rank as $player_in_guild) {
|
||||
$player_in_guild->setRank($new_rank);
|
||||
$player = new OTS_Player();
|
||||
$player->load($player_in_guild['id']);
|
||||
if ($player->isLoaded())
|
||||
$player->setRank($new_rank);
|
||||
}
|
||||
}
|
||||
$rank->delete();
|
||||
@@ -120,4 +124,4 @@ if(!empty($guild_errors)) {
|
||||
));
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@@ -11,25 +11,34 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Highscores';
|
||||
|
||||
if($config['account_country'] && $config['highscores_country_box'])
|
||||
$configHighscoresCountryBox = config('highscores_country_box');
|
||||
if(config('account_country') && $configHighscoresCountryBox)
|
||||
require SYSTEM . 'countries.conf.php';
|
||||
|
||||
$list = isset($_GET['list']) ? $_GET['list'] : '';
|
||||
$_page = isset($_GET['page']) ? $_GET['page'] : 0;
|
||||
$vocation = isset($_GET['vocation']) ? $_GET['vocation'] : NULL;
|
||||
$list = isset($_GET['list']) ? $_GET['list'] : 'experience';
|
||||
$_page = isset($_GET['page']) ? $_GET['page'] : 1;
|
||||
$vocation = isset($_GET['vocation']) ? $_GET['vocation'] : 'all';
|
||||
|
||||
if(!is_numeric($_page) || $_page < 1 || $_page > PHP_INT_MAX) {
|
||||
$_page = 1;
|
||||
}
|
||||
|
||||
$add_sql = '';
|
||||
$config_vocations = $config['vocations'];
|
||||
if($config['highscores_vocation_box'] && isset($vocation))
|
||||
|
||||
$configHighscoresVocationBox = config('highscores_vocation_box');
|
||||
$configVocations = config('vocations');
|
||||
$configVocationsAmount = config('vocations_amount');
|
||||
|
||||
if($configHighscoresVocationBox && $vocation !== 'all')
|
||||
{
|
||||
foreach($config['vocations'] as $id => $name) {
|
||||
foreach($configVocations as $id => $name) {
|
||||
if(strtolower($name) == $vocation) {
|
||||
$add_vocs = array($id);
|
||||
|
||||
$i = $id + $config['vocations_amount'];
|
||||
while(isset($config['vocations'][$i])) {
|
||||
$i = $id + $configVocationsAmount;
|
||||
while(isset($configVocations[$i])) {
|
||||
$add_vocs[] = $i;
|
||||
$i += $config['vocations_amount'];
|
||||
$i += $configVocationsAmount;
|
||||
}
|
||||
|
||||
$add_sql = 'AND `vocation` IN (' . implode(', ', $add_vocs) . ')';
|
||||
@@ -45,7 +54,7 @@ $skill = POT::SKILL__LEVEL;
|
||||
if(is_numeric($list))
|
||||
{
|
||||
$list = (int) $list;
|
||||
if($list >= POT::SKILL_FIRST && $list <= SKILL__LAST)
|
||||
if($list >= POT::SKILL_FIRST && $list <= POT::SKILL__LAST)
|
||||
$skill = $list;
|
||||
}
|
||||
else
|
||||
@@ -90,12 +99,12 @@ else
|
||||
break;
|
||||
|
||||
case 'frags':
|
||||
if($config['highscores_frags'] && $config['otserv_version'] == TFS_03)
|
||||
if(config('highscores_frags'))
|
||||
$skill = SKILL_FRAGS;
|
||||
break;
|
||||
|
||||
case 'balance':
|
||||
if($config['highscores_balance'])
|
||||
if(config('highscores_balance'))
|
||||
$skill = SKILL_BALANCE;
|
||||
break;
|
||||
}
|
||||
@@ -115,7 +124,10 @@ if($db->hasColumn('players', 'deletion'))
|
||||
|
||||
$outfit_addons = false;
|
||||
$outfit = '';
|
||||
if($config['highscores_outfit']) {
|
||||
|
||||
$configHighscoresOutfit = config('highscores_outfit');
|
||||
|
||||
if($configHighscoresOutfit) {
|
||||
$outfit = ', lookbody, lookfeet, lookhead, looklegs, looktype';
|
||||
if($db->hasColumn('players', 'lookaddons')) {
|
||||
$outfit .= ', lookaddons';
|
||||
@@ -123,82 +135,85 @@ if($config['highscores_outfit']) {
|
||||
}
|
||||
}
|
||||
|
||||
$offset = $_page * $config['highscores_length'];
|
||||
if($skill >= POT::SKILL_FIRST && $skill <= POT::SKILL_LAST) { // skills
|
||||
if($db->hasColumn('players', 'skill_fist')) {// tfs 1.0
|
||||
$skill_ids = array(
|
||||
POT::SKILL_FIST => 'skill_fist',
|
||||
POT::SKILL_CLUB => 'skill_club',
|
||||
POT::SKILL_SWORD => 'skill_sword',
|
||||
POT::SKILL_AXE => 'skill_axe',
|
||||
POT::SKILL_DIST => 'skill_dist',
|
||||
POT::SKILL_SHIELD => 'skill_shielding',
|
||||
POT::SKILL_FISH => 'skill_fishing',
|
||||
);
|
||||
$configHighscoresPerPage = config('highscores_per_page');
|
||||
$limit = $configHighscoresPerPage + 1;
|
||||
|
||||
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . $outfit . ', ' . $skill_ids[$skill] . ' as value FROM accounts,players WHERE players.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND accounts.id = players.account_id ORDER BY ' . $skill_ids[$skill] . ' DESC LIMIT 101 OFFSET '.$offset)->fetchAll();
|
||||
}
|
||||
else
|
||||
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',value,level,vocation' . $promotion . $outfit . ' FROM accounts,players,player_skills WHERE players.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id = player_skills.player_id AND player_skills.skillid = '.$skill.' AND accounts.id = players.account_id ORDER BY value DESC, count DESC LIMIT 101 OFFSET '.$offset)->fetchAll();
|
||||
}
|
||||
else if($skill == SKILL_FRAGS && $config['otserv_version'] == TFS_03) // frags
|
||||
{
|
||||
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . $outfit . ',COUNT(`player_killers`.`player_id`) as value' .
|
||||
' FROM `accounts`, `players`, `player_killers` ' .
|
||||
' WHERE players.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id = player_killers.player_id AND accounts.id = players.account_id' .
|
||||
' GROUP BY `player_id`' .
|
||||
' ORDER BY value DESC' .
|
||||
' LIMIT 101 OFFSET '.$offset)->fetchAll();
|
||||
}
|
||||
else if($skill == SKILL_BALANCE) // balance
|
||||
{
|
||||
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,balance as value,vocation' . $promotion . $outfit . ' FROM accounts,players WHERE players.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND accounts.id = players.account_id ORDER BY value DESC LIMIT 101 OFFSET '.$offset)->fetchAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
if($skill == POT::SKILL__MAGLEVEL) {
|
||||
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',maglevel,level,vocation' . $promotion . $outfit . ' FROM accounts, players WHERE players.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND players.' . $deleted . ' = 0 '.$add_sql.' AND players.group_id < '.$config['highscores_groups_hidden'].' AND accounts.id = players.account_id ORDER BY maglevel DESC, manaspent DESC LIMIT 101 OFFSET '.$offset)->fetchAll();
|
||||
}
|
||||
else { // level
|
||||
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,experience,vocation' . $promotion . $outfit . ' FROM accounts, players WHERE players.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND players.' . $deleted . ' = 0 '.$add_sql.' AND players.group_id < '.$config['highscores_groups_hidden'].' AND accounts.id = players.account_id ORDER BY level DESC, experience DESC LIMIT 101 OFFSET '.$offset)->fetchAll();
|
||||
$list = 'experience';
|
||||
$needReCache = true;
|
||||
$cacheKey = 'highscores_' . $skill . '_' . $vocation . '_' . $_page . '_' . $configHighscoresPerPage;
|
||||
|
||||
$cache = Cache::getInstance();
|
||||
if ($cache->enabled()) {
|
||||
$tmp = '';
|
||||
if ($cache->fetch($cacheKey, $tmp)) {
|
||||
$highscores = unserialize($tmp);
|
||||
$needReCache = false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td><img src="<?php echo $template_path; ?>/images/general/blank.gif" width="10" height="1" border="0"></td>
|
||||
<td>
|
||||
<div style="text-align:center"><h2>Ranking for <?php echo ($skill == SKILL_FRAGS ? 'Frags' : ($skill == SKILL_BALANCE ? 'Balance' : getSkillName($skill))); if(isset($vocation)) echo ' (' . $vocation . ')';?> on <?php echo $config['lua']['serverName']; ?></h2></div><br/>
|
||||
<table border="0" cellpadding="4" cellspacing="1" width="100%"></table>
|
||||
<table border="0" cellpadding="4" cellspacing="1" width="100%">
|
||||
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
|
||||
<?php if($config['account_country']): ?>
|
||||
<td width="11px" class="white">#</td>
|
||||
<?php endif; ?>
|
||||
<td width="10%" class="white"><b>Rank</b></td>
|
||||
<?php if($config['highscores_outfit']): ?>
|
||||
<td class="white"><b>Outfit</b></td>
|
||||
<?php endif; ?>
|
||||
<td width="75%" class="white"><b>Name</b></td>
|
||||
<td width="15%" class="white"><b><?php echo ($skill != SKILL_FRAGS && $skill != SKILL_BALANCE ? 'Level' : ($skill == SKILL_BALANCE ? 'Balance' : 'Frags')); ?></b></td>
|
||||
<?php if($skill == POT::SKILL__LEVEL): ?>
|
||||
<td class="white"><b>Points</b></td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
<?php
|
||||
$offset = ($_page - 1) * $configHighscoresPerPage;
|
||||
if (!isset($highscores) || empty($highscores)) {
|
||||
if ($skill >= POT::SKILL_FIRST && $skill <= POT::SKILL_LAST) { // skills
|
||||
if ($db->hasColumn('players', 'skill_fist')) {// tfs 1.0
|
||||
$skill_ids = array(
|
||||
POT::SKILL_FIST => 'skill_fist',
|
||||
POT::SKILL_CLUB => 'skill_club',
|
||||
POT::SKILL_SWORD => 'skill_sword',
|
||||
POT::SKILL_AXE => 'skill_axe',
|
||||
POT::SKILL_DIST => 'skill_dist',
|
||||
POT::SKILL_SHIELD => 'skill_shielding',
|
||||
POT::SKILL_FISH => 'skill_fishing',
|
||||
);
|
||||
|
||||
$show_link_to_next_page = false;
|
||||
$i = 0;
|
||||
$highscores = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . $outfit . ', ' . $skill_ids[$skill] . ' as value FROM accounts,players WHERE players.id NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 AND players.group_id < ' . config('highscores_groups_hidden') . ' ' . $add_sql . ' AND accounts.id = players.account_id ORDER BY ' . $skill_ids[$skill] . ' DESC LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
|
||||
} else
|
||||
$highscores = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',value,level,vocation' . $promotion . $outfit . ' FROM accounts,players,player_skills WHERE players.id NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 AND players.group_id < ' . config('highscores_groups_hidden') . ' ' . $add_sql . ' AND players.id = player_skills.player_id AND player_skills.skillid = ' . $skill . ' AND accounts.id = players.account_id ORDER BY value DESC, count DESC LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
|
||||
} else if ($skill == SKILL_FRAGS) // frags
|
||||
{
|
||||
if ($db->hasTable('player_killers')) {
|
||||
$highscores = $db->query('SELECT accounts.country, players.id, players.name' . $online . ',level, vocation' . $promotion . $outfit . ', COUNT(`player_killers`.`player_id`) as value' .
|
||||
' FROM `accounts`, `players`, `player_killers` ' .
|
||||
' WHERE players.id NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 AND players.group_id < ' . config('highscores_groups_hidden') . ' ' . $add_sql . ' AND players.id = player_killers.player_id AND accounts.id = players.account_id' .
|
||||
' GROUP BY `player_id`' .
|
||||
' ORDER BY value DESC' .
|
||||
' LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
|
||||
} else {
|
||||
$db->query("SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));");
|
||||
|
||||
$highscores = $db->query('SELECT `a`.country, `p`.id, `p`.name' . $online . ',`p`.level, vocation' . $promotion . $outfit . ', COUNT(`pd`.`killed_by`) as value
|
||||
FROM `players` p
|
||||
LEFT JOIN `accounts` a ON `a`.`id` = `p`.`account_id`
|
||||
LEFT JOIN `player_deaths` pd ON `pd`.`killed_by` = `p`.`name`
|
||||
WHERE `p`.id NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ')
|
||||
AND `p`.' . $deleted . ' = 0
|
||||
AND `p`.group_id < ' . config('highscores_groups_hidden') . ' ' . $add_sql . '
|
||||
AND `pd`.`unjustified` = 1
|
||||
GROUP BY `killed_by`
|
||||
ORDER BY value DESC
|
||||
LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
|
||||
}
|
||||
} else if ($skill == SKILL_BALANCE) // balance
|
||||
{
|
||||
$highscores = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,balance as value,vocation' . $promotion . $outfit . ' FROM accounts,players WHERE players.id NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 AND players.group_id < ' . config('highscores_groups_hidden') . ' ' . $add_sql . ' AND accounts.id = players.account_id ORDER BY value DESC LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
|
||||
} else {
|
||||
if ($skill == POT::SKILL__MAGLEVEL) {
|
||||
$highscores = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',maglevel,level,vocation' . $promotion . $outfit . ' FROM accounts, players WHERE players.id NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 ' . $add_sql . ' AND players.group_id < ' . config('highscores_groups_hidden') . ' AND accounts.id = players.account_id ORDER BY maglevel DESC, manaspent DESC LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
|
||||
} else { // level
|
||||
$highscores = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,experience,vocation' . $promotion . $outfit . ' FROM accounts, players WHERE players.id NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 ' . $add_sql . ' AND players.group_id < ' . config('highscores_groups_hidden') . ' AND accounts.id = players.account_id ORDER BY level DESC, experience DESC LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
|
||||
$list = 'experience';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($cache->enabled() && $needReCache) {
|
||||
$cache->set($cacheKey, serialize($highscores), config('highscores_cache_ttl') * 60);
|
||||
}
|
||||
|
||||
$online_exist = false;
|
||||
if($db->hasColumn('players', 'online'))
|
||||
$online_exist = true;
|
||||
|
||||
$players = array();
|
||||
foreach($skills as $player) {
|
||||
foreach($highscores as $player) {
|
||||
$players[] = $player['id'];
|
||||
}
|
||||
|
||||
@@ -209,158 +224,100 @@ if($db->hasTable('players_online') && count($players) > 0) {
|
||||
}
|
||||
}
|
||||
|
||||
foreach($skills as $player)
|
||||
{
|
||||
if(isset($is_online)) {
|
||||
$player['online'] = (isset($is_online[$player['id']]) ? 1 : 0);
|
||||
} else {
|
||||
if(!isset($player['online'])) {
|
||||
$player['online'] = 0;
|
||||
}
|
||||
}
|
||||
$show_link_to_next_page = false;
|
||||
$i = 0;
|
||||
|
||||
if(++$i <= $config['highscores_length'])
|
||||
$configHighscoresVocation = config('highscores_vocation');
|
||||
|
||||
foreach($highscores as $id => &$player)
|
||||
{
|
||||
if(isset($is_online)) {
|
||||
$player['online'] = (isset($is_online[$player['id']]) ? 1 : 0);
|
||||
} else {
|
||||
if(!isset($player['online'])) {
|
||||
$player['online'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(++$i <= $configHighscoresPerPage)
|
||||
{
|
||||
if($skill == POT::SKILL__MAGIC)
|
||||
$player['value'] = $player['maglevel'];
|
||||
else if($skill == POT::SKILL__LEVEL)
|
||||
else if($skill == POT::SKILL__LEVEL) {
|
||||
$player['value'] = $player['level'];
|
||||
echo '
|
||||
<tr bgcolor="' . getStyle($i) . '">';
|
||||
if($config['account_country'])
|
||||
echo '<td>' . getFlagImage($player['country']) . '</td>';
|
||||
echo '
|
||||
<td>' . ($offset + $i) . '.</td>';
|
||||
if($config['highscores_outfit'])
|
||||
echo '<td><img style="position:absolute;margin-top:' . (in_array($player['looktype'], array(75, 266, 302)) ? '-15px;margin-left:5px' : '-45px;margin-left:-25px') . ';" src="' . $config['outfit_images_url'] . '?id=' . $player['looktype'] . ($outfit_addons ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] . '" alt="" /></td>';
|
||||
$player['experience'] = number_format($player['experience']);
|
||||
}
|
||||
|
||||
echo '
|
||||
<td>
|
||||
<a href="' . getPlayerLink($player['name'], false) . '">
|
||||
<span style="color: ' . ($player['online'] > 0 ? 'green' : 'red') . '">' . $player['name'] . '</span>
|
||||
</a>';
|
||||
if($config['highscores_vocation']) {
|
||||
if(isset($player['promotion'])) {
|
||||
if((int)$player['promotion'] > 0)
|
||||
$player['vocation'] += ($player['promotion'] * $config['vocations_amount']);
|
||||
}
|
||||
|
||||
$tmp = 'Unknown';
|
||||
if(isset($config['vocations'][$player['vocation']])) {
|
||||
$tmp = $config['vocations'][$player['vocation']];
|
||||
}
|
||||
echo '<br/><small>' . $tmp . '</small>';
|
||||
if($configHighscoresVocation) {
|
||||
if(isset($player['promotion'])) {
|
||||
if((int)$player['promotion'] > 0) {
|
||||
$player['vocation'] += ($player['promotion'] * $configVocationsAmount);
|
||||
}
|
||||
echo '
|
||||
</td>
|
||||
<td>
|
||||
<div style="text-align:center">'.$player['value'].'</div>
|
||||
</td>';
|
||||
}
|
||||
|
||||
if($skill == POT::SKILL__LEVEL)
|
||||
echo '<td><div style="text-align:center">' . number_format($player['experience']) . '</div></td>';
|
||||
$tmp = 'Unknown';
|
||||
if(isset($configVocations[$player['vocation']])) {
|
||||
$tmp = $configVocations[$player['vocation']];
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
$player['vocation'] = $tmp;
|
||||
}
|
||||
|
||||
|
||||
$player['link'] = getPlayerLink($player['name'], false);
|
||||
$player['flag'] = getFlagImage($player['country']);
|
||||
if($configHighscoresOutfit) {
|
||||
$player['outfit'] = '<img style="position:absolute;margin-top:' . (in_array($player['looktype'], config('outfit_images_wrong_looktypes')) ? '-15px;margin-left:5px' : '-45px;margin-left:-25px') . ';" src="' . config('outfit_images_url') . '?id=' . $player['looktype'] . ($outfit_addons ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] . '" alt="" />';
|
||||
}
|
||||
$player['rank'] = $offset + $i;
|
||||
}
|
||||
else
|
||||
else {
|
||||
unset($highscores[$id]);
|
||||
$show_link_to_next_page = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$i) {
|
||||
$extra = ($config['highscores_outfit'] ? 1 : 0);
|
||||
echo '<tr bgcolor="' . $config['darkborder'] . '"><td colspan="' . ($skill == POT::SKILL__LEVEL ? 5 + $extra : 4 + $extra) . '">No records yet.</td></tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
<table border="0" cellpadding="4" cellspacing="1" width="100%">
|
||||
<?php
|
||||
//link to previous page if actual page is not first
|
||||
if($_page > 0)
|
||||
echo '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="' . getLink('highscores') . '/' . $list . (isset($vocation) ? '/' . $vocation : '') . '/' . ($_page - 1) . '" CLASS="size_xxs">Previous Page</A></TD></TR>';
|
||||
$linkPreviousPage = '';
|
||||
if($_page > 1) {
|
||||
$linkPreviousPage = getLink('highscores') . '/' . $list . ($vocation !== 'all' ? '/' . $vocation : '') . '/' . ($_page - 1);
|
||||
}
|
||||
|
||||
//link to next page if any result will be on next page
|
||||
if($show_link_to_next_page)
|
||||
echo '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="' . getLink('highscores') . '/' . $list . (isset($vocation) ? '/' . $vocation : '') . '/' . ($_page + 1) . '" CLASS="size_xxs">Next Page</A></TD></TR>';
|
||||
|
||||
//end of page
|
||||
echo '</TABLE>
|
||||
</TD>
|
||||
<TD WIDTH=5%>
|
||||
<IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=1 HEIGHT=1 BORDER=0></TD>
|
||||
<TD WIDTH=15% VALIGN=top ALIGN=right>';
|
||||
/*
|
||||
if($config['highscores_country_box'])
|
||||
{
|
||||
echo
|
||||
'<TABLE BORDER=0 width="100%" CELLPADDING=4 CELLSPACING=1>
|
||||
<TR BGCOLOR="' . $config['vdarkborder'] . '">
|
||||
<TD CLASS=white><B>Choose a country</B></TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="'.$config['lightborder'].'">
|
||||
<TD>
|
||||
<A HREF="?subtopic=highscores&list=' . $list . '" CLASS="size_xs">[ALL]</A><BR>';
|
||||
for($i = 1; $i < count($config_vocations); $i++)
|
||||
echo '<A HREF="?subtopic=highscores&list=' . $list . '&vocation=' . strtolower($config_vocations[$i]) . '" CLASS="size_xs">' . $config_vocations[$i] . '</A><BR>';
|
||||
echo '
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>';
|
||||
}*/
|
||||
|
||||
echo '
|
||||
<TABLE BORDER=0 width="100%" CELLPADDING=4 CELLSPACING=1>
|
||||
<TR BGCOLOR="'.$config['vdarkborder'].'">
|
||||
<TD CLASS=white><B>Choose a skill</B></TD>
|
||||
</TR>
|
||||
<TR BGCOLOR="'.$config['lightborder'].'">
|
||||
<TD>';
|
||||
$types = array(
|
||||
'experience' => 'Experience',
|
||||
'magic' => 'Magic',
|
||||
'shield' => 'Shielding',
|
||||
'distance' => 'Distance',
|
||||
'club' => 'Club',
|
||||
'sword' => 'Sword',
|
||||
'axe' => 'Axe',
|
||||
'fist' => 'Fist',
|
||||
'fishing' => 'Fishing',
|
||||
);
|
||||
|
||||
if($config['highscores_frags']) {
|
||||
$types['frags'] = 'Frags';
|
||||
}
|
||||
if(isset($config['highscores_balance']) && $config['highscores_balance'])
|
||||
$types['balance'] = 'Balance';
|
||||
|
||||
foreach($types as $link => $name) {
|
||||
echo '<A HREF="' . getLink('highscores') . '/' . $link . (isset($vocation) ? '/' . $vocation : '') . '" CLASS="size_xs">' . $name . '</A><BR>';
|
||||
}
|
||||
|
||||
echo '</td>
|
||||
</tr>
|
||||
</table><br>';
|
||||
|
||||
if($config['highscores_vocation_box'])
|
||||
{
|
||||
echo
|
||||
'<table border="0" width="100%" cellpadding="4" cellspacing="1">
|
||||
<tr bgcolor="' . $config['vdarkborder'] . '">
|
||||
<td class="white"><b>Choose a vocation</b></td>
|
||||
</tr>
|
||||
<tr bgcolor="'.$config['lightborder'].'">
|
||||
<td>
|
||||
<a href="' . getLink('highscores') . '/' . $list . '" class="size_xs">[ALL]</A><BR>';
|
||||
for($i = 1; $i <= $config['vocations_amount']; $i++) {
|
||||
echo '<a href="' . getLink('highscores') . '/' . $list . '/' . strtolower($config_vocations[$i]) . '" class="size_xs">' . $config_vocations[$i] . '</a><br/>';
|
||||
}
|
||||
echo '
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
$linkNextPage = '';
|
||||
if($show_link_to_next_page) {
|
||||
$linkNextPage = getLink('highscores') . '/' . $list . ($vocation !== 'all' ? '/' . $vocation : '') . '/' . ($_page + 1);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><img src="<?php echo $template_path; ?>/images/general/blank.gif" width="10" height="1" border="0"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
$types = array(
|
||||
'experience' => 'Experience',
|
||||
'magic' => 'Magic',
|
||||
'shield' => 'Shielding',
|
||||
'distance' => 'Distance',
|
||||
'club' => 'Club',
|
||||
'sword' => 'Sword',
|
||||
'axe' => 'Axe',
|
||||
'fist' => 'Fist',
|
||||
'fishing' => 'Fishing',
|
||||
);
|
||||
|
||||
if(config('highscores_frags')) {
|
||||
$types['frags'] = 'Frags';
|
||||
}
|
||||
if(config('highscores_balance'))
|
||||
$types['balance'] = 'Balance';
|
||||
|
||||
/** @var Twig\Environment $twig */
|
||||
$twig->display('highscores.html.twig', [
|
||||
'highscores' => $highscores,
|
||||
'totalRows' => $i - 1,
|
||||
'list' => $list,
|
||||
'skill' => $skill,
|
||||
'skillName' => ($skill == SKILL_FRAGS ? 'Frags' : ($skill == SKILL_BALANCE ? 'Balance' : getSkillName($skill))),
|
||||
'levelName' => ($skill != SKILL_FRAGS && $skill != SKILL_BALANCE ? 'Level' : ($skill == SKILL_BALANCE ? 'Balance' : 'Frags')),
|
||||
'vocation' => $vocation !== 'all' ? $vocation : null,
|
||||
'types' => $types,
|
||||
'linkPreviousPage' => $linkPreviousPage,
|
||||
'linkNextPage' => $linkNextPage,
|
||||
]);
|
||||
|
@@ -29,11 +29,13 @@ if(isset($_GET['archive']))
|
||||
// display big news by id
|
||||
if(isset($_GET['id']))
|
||||
{
|
||||
$id = (int)$_GET['id'];
|
||||
|
||||
$field_name = 'date';
|
||||
if($_REQUEST['id'] < 100000)
|
||||
if($id < 100000)
|
||||
$field_name = 'id';
|
||||
|
||||
$news = $db->query('SELECT * FROM `'.TABLE_PREFIX . 'news` WHERE `hidden` != 1 AND `' . $field_name . '` = ' . (int)$_REQUEST['id'] . '');
|
||||
$news = $db->query('SELECT * FROM `'.TABLE_PREFIX . 'news` WHERE `hidden` != 1 AND `' . $field_name . '` = ' . $id . '');
|
||||
if($news->rowCount() == 1)
|
||||
{
|
||||
$news = $news->fetch();
|
||||
@@ -227,4 +229,4 @@ if(!$news_cached)
|
||||
echo $tmp_content;
|
||||
}
|
||||
else
|
||||
echo $news_cached;
|
||||
echo $news_cached;
|
||||
|
@@ -11,15 +11,6 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Spells';
|
||||
|
||||
$canEdit = hasFlag(FLAG_CONTENT_SPELLS) || admin();
|
||||
if(isset($_POST['reload_spells']) && $canEdit)
|
||||
{
|
||||
require LIBS . 'spells.php';
|
||||
if(!Spells::loadFromXML(true)) {
|
||||
error(Spells::getLastError());
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_REQUEST['vocation_id'])) {
|
||||
$vocation_id = $_REQUEST['vocation_id'];
|
||||
if($vocation_id == 'all') {
|
||||
@@ -74,7 +65,6 @@ else {
|
||||
<link rel="stylesheet" href="<?php echo BASE_URL; ?>tools/css/datatables.min.css">
|
||||
<?php
|
||||
$twig->display('spells.html.twig', array(
|
||||
'canEdit' => $canEdit,
|
||||
'post_vocation_id' => $vocation_id,
|
||||
'post_vocation' => $vocation,
|
||||
'spells' => $spells,
|
||||
@@ -90,4 +80,4 @@ $twig->display('spells.html.twig', array(
|
||||
} );
|
||||
|
||||
</script>
|
||||
<script src="<?php echo BASE_URL; ?>tools/js/datatables.min.js"></script>
|
||||
<script src="<?php echo BASE_URL; ?>tools/js/datatables.min.js"></script>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Gamemasters List';
|
||||
$title = 'Support in game';
|
||||
|
||||
if($config['account_country'])
|
||||
require SYSTEM . 'countries.conf.php';
|
||||
|
Reference in New Issue
Block a user