Admin Panel Updates

- Updated Admin Panel to Bootstrap 4.
- Code cleanup
- Rewrote menu generation code
- Added top 10 coins, top 10 premium points, last 10 logins to modules page.
- Added full account list to Account editor
- Added load outfits from XML to player editor and lists all enabled outfits in editor (will default to textbox if array of outfits do not exist)
- Added tabs to account editor - account, characters,store history, bans(this is based off the bans.php page so will not work on TFS 0.2/1.0)
- Updated datepickers to display the actual date rather than unix time.
- Added last 10 posts to player editor
This commit is contained in:
Lee
2020-03-31 02:03:16 +01:00
parent 92c0671da2
commit eaa11c68f3
88 changed files with 11220 additions and 8080 deletions

View File

@@ -1221,6 +1221,165 @@ function getCustomPage($page, &$success)
return $content;
}
function getBanReason($reasonId)
{
switch($reasonId)
{
case 0:
return "Offensive Name";
case 1:
return "Invalid Name Format";
case 2:
return "Unsuitable Name";
case 3:
return "Name Inciting Rule Violation";
case 4:
return "Offensive Statement";
case 5:
return "Spamming";
case 6:
return "Illegal Advertising";
case 7:
return "Off-Topic Public Statement";
case 8:
return "Non-English Public Statement";
case 9:
return "Inciting Rule Violation";
case 10:
return "Bug Abuse";
case 11:
return "Game Weakness Abuse";
case 12:
return "Using Unofficial Software to Play";
case 13:
return "Hacking";
case 14:
return "Multi-Clienting";
case 15:
return "Account Trading or Sharing";
case 16:
return "Threatening Gamemaster";
case 17:
return "Pretending to Have Influence on Rule Enforcement";
case 18:
return "False Report to Gamemaster";
case 19:
return "Destructive Behaviour";
case 20:
return "Excessive Unjustified Player Killing";
case 21:
return "Invalid Payment";
case 22:
return "Spoiling Auction";
}
return "Unknown Reason";
}
function getBanType($typeId)
{
switch($typeId)
{
case 1:
return "IP Banishment";
case 2:
return "Namelock";
case 3:
return "Banishment";
case 4:
return "Notation";
case 5:
return "Deletion";
}
return "Unknown Type";
}
function getPlayerNameByAccount($id)
{
global $vowels, $ots, $db;
if(is_numeric($id))
{
$player = new OTS_Player();
$player->load($id);
if($player->isLoaded())
return $player->getName();
else
{
$playerQuery = $db->query('SELECT `id` FROM `players` WHERE `account_id` = ' . $id . ' ORDER BY `lastlogin` DESC LIMIT 1;')->fetch();
$tmp = "*Error*";
/*
$acco = new OTS_Account();
$acco->load($id);
if(!$acco->isLoaded())
return "Unknown name";
foreach($acco->getPlayersList() as $p)
{
$player= new OTS_Player();
$player->find($p);*/
$player->load($playerQuery['id']);
//echo 'id gracza = ' . $p . '<br/>';
if($player->isLoaded())
$tmp = $player->getName();
// break;
//}
return $tmp;
}
}
return '';
}
function echo_success($message)
{
echo '<div class="col-12 success mb-2">' . $message . '</div>';
}
function echo_error($message)
{
global $error;
echo '<div class="col-12 error mb-2">' . $message . '</div>';
$error = true;
}
function verify_number($number, $name, $max_length)
{
if (!Validator::number($number))
echo_error($name . ' can contain only numbers.');
$number_length = strlen($number);
if ($number_length <= 0 || $number_length > $max_length)
echo_error($name . ' cannot be longer than ' . $max_length . ' digits.');
}
function Outfits_loadfromXML()
{
global $config;
$file_path = $config['data_path'] . 'XML/outfits.xml';
if (!file_exists($file_path)) { return null; }
$xml = new DOMDocument;
$xml->load($file_path);
$outfits = null;
foreach ($xml->getElementsByTagName('outfit') as $outfit) {
$outfits[] = Outfit_parseNode($outfit);
}
return $outfits;
}
function Outfit_parseNode($node) {
$looktype = (int)$node->getAttribute('looktype');
$type = (int)$node->getAttribute('type');
$lookname = $node->getAttribute('name');
$premium = $node->getAttribute('premium');
$unlocked = $node->getAttribute('unlocked');
$enabled = $node->getAttribute('enabled');
return array('id' => $looktype, 'type' => $type, 'name' => $lookname, 'premium' => $premium, 'unlocked' => $unlocked, 'enabled' => $enabled);
}
// validator functions
require_once LIBS . 'validator.php';
require_once SYSTEM . 'compat.php';

View File

@@ -4,39 +4,17 @@
*
* @package MyAAC
* @author Lee
* @copyright 2019 MyAAC
* @copyright 2020 MyAAC
* @link https://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Account editor';
$base = BASE_URL . 'admin/?p=accounts';
$admin_base = BASE_URL . 'admin/?p=accounts';
if ($config['account_country'])
require SYSTEM . 'countries.conf.php';
function echo_success($message)
{
echo '<p class="success">' . $message . '</p>';
}
function echo_error($message)
{
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.');
$number_length = strlen($number);
if ($number_length <= 0 || $number_length > $max_length)
echo_error($name . ' cannot be longer than ' . $max_length . ' digits.');
}
$hasSecretColumn = $db->hasColumn('accounts', 'secret');
$hasCoinsColumn = $db->hasColumn('accounts', 'coins');
$hasPointsColumn = $db->hasColumn('accounts', 'premium_points');
@@ -52,6 +30,8 @@ if ($config['account_country']) {
foreach ($config['countries'] as $code => $c)
$countries[$code] = $c;
}
$web_acc = array("None", "Admin", "Super Admin", "(Admin + Super Admin)");
$acc_type = array("Normal", "Tutor", "Senior Tutor", "Gamemaster", "God");
?>
<link rel="stylesheet" type="text/css" href="<?php echo BASE_URL; ?>tools/css/jquery.datetimepicker.css"/ >
@@ -59,426 +39,536 @@ if ($config['account_country']) {
<?php
$id = 0;
$search_account = '';
if (isset($_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 (isset($_REQUEST['search'])) {
$search_account = $_REQUEST['search'];
if (strlen($search_account) < 3 && !Validator::number($search_account)) {
echo_error('Player name is too short.');
} else {
if (Validator::number($_REQUEST['search_name']))
$id = $_REQUEST['search_name'];
if (Validator::number($search_account))
$id = (int)$search_account;
else {
$query = $db->query('SELECT `id` FROM `accounts` WHERE `name` = ' . $db->quote($_REQUEST['search_name']));
$query = $db->query('SELECT `id` FROM `accounts` WHERE `name` = ' . $db->quote($search_account));
if ($query->rowCount() == 1) {
$query = $query->fetch();
$id = $query['id'];
$id = (int)$query['id'];
} else {
$query = $db->query('SELECT `id`, `name` FROM `accounts` WHERE `name` LIKE ' . $db->quote('%' . $_REQUEST['search_name'] . '%'));
$query = $db->query('SELECT `id`, `name` FROM `accounts` WHERE `name` LIKE ' . $db->quote('%' . $search_account . '%'));
if ($query->rowCount() > 0 && $query->rowCount() <= 10) {
echo 'Do you mean?<ul>';
$str_construct = 'Do you mean?<ul class="mb-0">';
foreach ($query as $row)
echo '<li><a href="' . $base . '&id=' . $row['id'] . '">' . $row['name'] . '</a></li>';
echo '</ul>';
$str_construct .= '<li><a href="' . $admin_base . '&id=' . $row['id'] . '">' . $row['name'] . '</a></li>';
$str_construct .= '</ul>';
echo_error($str_construct);
} else if ($query->rowCount() > 10)
echo 'Specified name resulted with too many accounts.';
echo_error('Specified name resulted with too many accounts.');
else
echo_error('No entries found.');
}
}
}
}
$groups = new OTS_Groups_List();
if ($id > 0) {
$account = new OTS_Account();
$account->load($id);
if (isset($account, $_POST['save']) && $account->isLoaded()) {// we want to save
$error = false;
$_error = '';
$account_db = new OTS_Account();
if(USE_ACCOUNT_NAME) {
$name = $_POST['name'];
$account_db->find($name);
if ($account_db->isLoaded() && $account->getName() != $name)
echo_error('This name is already used. Please choose another name!');
}
$account_db->load($id);
if (!$account_db->isLoaded())
echo_error('Account with this id doesn\'t exist.');
//type/group
if($hasTypeColumn || $hasGroupColumn) {
$group = $_POST['group'];
}
$password = ((!empty($_POST["pass"]) ? $_POST['pass'] : null));
if (!Validator::password($password)) {
$errors['password'] = Validator::getLastError();
}
//secret
if($hasSecretColumn) {
$secret = $_POST['secret'];
}
//key
$key = $_POST['key'];
$email = $_POST['email'];
if (!Validator::email($email))
$errors['email'] = Validator::getLastError();
//tibia coins
if ($hasCoinsColumn) {
$t_coins = $_POST['t_coins'];
verify_number($t_coins, 'Tibia coins', 12);
}
// prem days
$p_days = (int)$_POST['p_days'];
verify_number($p_days, 'Prem days', 11);
//prem points
$p_points = $_POST['p_points'];
verify_number($p_points, 'Prem Points', 11);
//rl name
$rl_name = $_POST['rl_name'];
//location
$rl_loca = $_POST['rl_loca'];
//country
$rl_country = $_POST['rl_country'];
$web_flags = $_POST['web_flags'];
verify_number($web_flags, 'Web Flags', 1);
//created
$created = $_POST['created'];
verify_number($created, 'Created', 11);
//web last login
$web_lastlogin = $_POST['web_lastlogin'];
verify_number($web_lastlogin, 'Web Last logout', 11);
if (!$error) {
if(USE_ACCOUNT_NAME) {
$account->setName($name);
}
if ($hasTypeColumn) {
$account->setCustomField('type', $group);
} elseif ($hasGroupColumn) {
$account->setCustomField('group_id', $group);
}
if($hasSecretColumn) {
$account->setCustomField('secret', $secret);
}
$account->setCustomField('key', $key);
$account->setEMail($email);
if ($hasCoinsColumn) {
$account->setCustomField('coins', $t_coins);
}
$lastDay = 0;
if($p_days != 0 && $p_days != PHP_INT_MAX ) {
$lastDay = time();
} else if ($lastDay != 0) {
$lastDay = 0;
}
$account->setPremDays($p_days);
$account->setLastLogin($lastDay);
if ($hasPointsColumn) {
$account->setCustomField('premium_points', $p_points);
}
$account->setRLName($rl_name);
$account->setLocation($rl_loca);
$account->setCountry($rl_country);
$account->setCustomField('created', $created);
$account->setWebFlags($web_flags);
$account->setCustomField('web_lastlogin', $web_lastlogin);
if (isset($password)) {
$config_salt_enabled = $db->hasColumn('accounts', 'salt');
if ($config_salt_enabled) {
$salt = generateRandomString(10, false, true, true);
$password = $salt . $password;
$account_logged->setCustomField('salt', $salt);
}
$password = encrypt($password);
$account->setPassword($password);
if ($config_salt_enabled)
$account->setCustomField('salt', $salt);
}
$account->save();
echo_success('Account saved at: ' . date('G:i'));
}
}
}
$search_account = '';
if (isset($_REQUEST['search_name']))
$search_account = $_REQUEST['search_name'];
else if (isset($_REQUEST['search_account']))
$search_account = $_REQUEST['search_account'];
else if ($id > 0 && isset($account) && $account->isLoaded()) {
if(USE_ACCOUNT_NAME) {
$search_account = $account->getName();
}
else {
$search_account = $account->getId();
}
}
?>
<div class="row">
<?php if (isset($account) && $account->isLoaded()) { ?>
<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">
<?php if(USE_ACCOUNT_NAME): ?>
<div class="col-xs-4">
<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>
<?php endif; ?>
<div class="col-xs-5">
<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"/>
</span>
<input type="text" class="form-control" id="pass" name="pass"
autocomplete="off" maxlength="20"
value=""/>
</div>
</div>
<div class="col-xs-3">
<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">
<?php
$acc_group = $account->getAccGroupId();
if ($hasTypeColumn) {
$acc_type = array("Normal", "Tutor", "Senior Tutor", "Gamemaster", "God"); ?>
<div class="col-xs-6">
<label for="group" class="control-label">Account Type:</label>
<select name="group" id="group" class="form-control">
<?php foreach ($acc_type as $id => $a_type): ?>
<option value="<?php echo($id + 1); ?>" <?php echo($acc_group == ($id + 1) ? 'selected' : ''); ?>><?php echo $a_type; ?></option>
<?php endforeach; ?>
</select>
</div>
<?php
} elseif ($hasGroupColumn) {
?>
<div class="col-xs-6">
<label for="group" class="control-label">Account Type:</label>
<select name="group" id="group" class="form-control">
<?php
foreach ($groups->getGroups() as $id => $group): ?>
<option value="<?php echo $id; ?>" <?php echo($acc_group == $id ? 'selected' : ''); ?>><?php echo $group->getName(); ?></option>
<?php endforeach; ?>
</select>
</div>
<?php } ?>
<div class="col-xs-6">
<label for="web_flags" class="control-label">Website Access:</label>
<select name="web_flags" id="web_flags" class="form-control">
<?php $web_acc = array("None", "Admin", "Super Admin", "(Admin + Super Admin)");
foreach ($web_acc as $id => $a_type): ?>
<option value="<?php echo($id); ?>" <?php echo($account->getWebFlags() == ($id) ? 'selected' : ''); ?>><?php echo $a_type; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="row">
<?php if($hasSecretColumn): ?>
<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>
<?php endif; ?>
<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>
<?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; ?>
<div class="col-xs-6">
<label for="p_days" class="control-label">Premium 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 ($hasPointsColumn): ?>
<div class="col-xs-6">
<label for="p_points" class="control-label">Premium 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>
<select name="rl_country" id="rl_country" class="form-control">
<?php foreach ($countries as $id => $a_type): ?>
<option value="<?php echo($id); ?>" <?php echo($account->getCountry() == ($id) ? 'selected' : ''); ?>><?php echo $a_type; ?></option>
<?php endforeach; ?>
</select>
</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="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>
</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-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_account; ?>"
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>
$groups = new OTS_Groups_List();
if ($id > 0) {
$account = new OTS_Account();
$account->load($id);
if (isset($account, $_POST['save']) && $account->isLoaded()) {
$error = false;
$_error = '';
$account_db = new OTS_Account();
if (USE_ACCOUNT_NAME) {
$name = $_POST['name'];
$account_db->find($name);
if ($account_db->isLoaded() && $account->getName() != $name)
echo_error('This name is already used. Please choose another name!');
}
$account_db->load($id);
if (!$account_db->isLoaded())
echo_error('Account with this id doesn\'t exist.');
//type/group
if ($hasTypeColumn || $hasGroupColumn) {
$group = $_POST['group'];
}
$password = ((!empty($_POST["pass"]) ? $_POST['pass'] : null));
if (!Validator::password($password)) {
$errors['password'] = Validator::getLastError();
}
//secret
if ($hasSecretColumn) {
$secret = $_POST['secret'];
}
//key
$key = $_POST['key'];
$email = $_POST['email'];
if (!Validator::email($email))
$errors['email'] = Validator::getLastError();
//tibia coins
if ($hasCoinsColumn) {
$t_coins = $_POST['t_coins'];
verify_number($t_coins, 'Tibia coins', 12);
}
// prem days
$p_days = (int)$_POST['p_days'];
verify_number($p_days, 'Prem days', 11);
//prem points
$p_points = $_POST['p_points'];
verify_number($p_points, 'Prem Points', 11);
//rl name
$rl_name = $_POST['rl_name'];
//location
$rl_loca = $_POST['rl_loca'];
//country
$rl_country = $_POST['rl_country'];
$web_flags = $_POST['web_flags'];
verify_number($web_flags, 'Web Flags', 1);
//created
$created = strtotime($_POST['created']);
verify_number($created, 'Created', 11);
//web last login
$web_lastlogin = strtotime($_POST['web_lastlogin']);
verify_number($web_lastlogin, 'Web Last login', 11);
if (!$error) {
if (USE_ACCOUNT_NAME) {
$account->setName($name);
}
if ($hasTypeColumn) {
$account->setCustomField('type', $group);
} elseif ($hasGroupColumn) {
$account->setCustomField('group_id', $group);
}
if ($hasSecretColumn) {
$account->setCustomField('secret', $secret);
}
$account->setCustomField('key', $key);
$account->setEMail($email);
if ($hasCoinsColumn) {
$account->setCustomField('coins', $t_coins);
}
$lastDay = 0;
if ($p_days != 0 && $p_days != PHP_INT_MAX) {
$lastDay = time();
} else if ($lastDay != 0) {
$lastDay = 0;
}
$account->setPremDays($p_days);
$account->setLastLogin($lastDay);
if ($hasPointsColumn) {
$account->setCustomField('premium_points', $p_points);
}
$account->setRLName($rl_name);
$account->setLocation($rl_loca);
$account->setCountry($rl_country);
$account->setCustomField('created', $created);
$account->setWebFlags($web_flags);
$account->setCustomField('web_lastlogin', $web_lastlogin);
if (isset($password)) {
$config_salt_enabled = $db->hasColumn('accounts', 'salt');
if ($config_salt_enabled) {
$salt = generateRandomString(10, false, true, true);
$password = $salt . $password;
$account->setCustomField('salt', $salt);
}
$password = encrypt($password);
$account->setPassword($password);
if ($config_salt_enabled)
$account->setCustomField('salt', $salt);
}
$account->save();
echo_success('Account saved at: ' . date('G:i'));
}
}
} else if ($id == 0) {
$accounts_db = $db->query('SELECT `id`, `name`,`type` FROM `accounts` ORDER BY `id` DESC LIMIT 10;');
?>
<div class="col-12 col-sm-12 col-lg-10">
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Accounts</h5>
</div>
<div class="box-body no-padding">
<table class="table table-striped">
<tbody>
<div class="card-body">
<table class="acc_datatable table table-striped table-bordered">
<thead>
<tr>
<th style="width: 10px">#</th>
<th>ID</th>
<th>Name</th>
<th>Level</th>
<th>Position</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++;
} ?>
</thead>
<tbody>
<?php foreach ($accounts_db as $account_db): ?>
<tr>
<th><?php echo $account_db['id']; ?></th>
<td><?php echo $account_db['name']; ?></a></td>
<td><?php echo $acc_type[$account_db['type'] - 1]; ?></td>
<td><a href="?p=accounts&id=<?php echo $account_db['id']; ?>" class="btn btn-success btn-sm" title="Edit">
<i class="fas fa-pencil-alt"></i>
</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<?php } ?>
<?php
};
};
<?php if (isset($account) && $account->isLoaded()) { ?>
<div class="col-12 col-sm-12 col-lg-10">
<div class="card card-primary card-outline card-outline-tabs">
<div class="card-header p-0 border-bottom-0">
<ul class="nav nav-tabs" id="accounts-tab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="accounts-acc-tab" data-toggle="pill" href="#accounts-acc">Account</a>
</li>
<li class="nav-item">
<a class="nav-link" id="accounts-chars-tab" data-toggle="pill" href="#accounts-chars">Characters</a>
</li>
<?php
if (!$config['otserv_version'] != TFS_02) { ?>
<li class="nav-item">
<a class="nav-link" id="accounts-bans-tab" data-toggle="pill" href="#accounts-bans">Bans</a>
</li>
<?php }
if ($db->hasTable('store_history')) { ?>
<li class="nav-item">
<a class="nav-link" id="accounts-store-tab" data-toggle="pill" href="#accounts-store">Store History</a>
</li>
<?php } ?>
</ul>
</div>
<div class="card-body">
<div class="tab-content" id="accounts-tabContent">
<div class="tab-pane fade active show" id="accounts-acc">
<form action="<?php echo $admin_base . ((isset($id) && $id > 0) ? '&id=' . $id : ''); ?>" method="post">
<div class="form-group row">
<?php if (USE_ACCOUNT_NAME): ?>
<div class="col-12 col-sm-12 col-lg-4">
<label for="name">Account Name:</label>
<input type="text" class="form-control" id="name" name="name" autocomplete="off" value="<?php echo $account->getName(); ?>"/>
</div>
<?php endif; ?>
<div class="col-12 col-sm-12 col-lg-5">
<div class="form-check">
<input type="checkbox"
name="c_pass"
id="c_pass"
value="false"
class="form-check-input"/>
<label for="c_pass">Password: (check to change)</label>
</div>
<div class="input-group">
<input type="text" class="form-control" id="pass" name="pass" autocomplete="off" maxlength="20" value=""/>
</div>
</div>
<div class="col-12 col-sm-12 col-lg-3">
<label for="account_id" class="control-label">Account ID:</label>
<input type="text" class="form-control" id="account_id" name="account_id" autocomplete="off" size="8" maxlength="11" disabled value="<?php echo $account->getId(); ?>"/>
</div>
</div>
<div class="form-group row">
<?php
$acc_group = $account->getAccGroupId();
if ($hasTypeColumn) {
?>
<div class="col-12 col-sm-12 col-lg-6">
<label for="group">Account Type:</label>
<select name="group" id="group" class="form-control">
<?php foreach ($acc_type as $id => $a_type): ?>
<option value="<?php echo($id + 1); ?>" <?php echo($acc_group == ($id + 1) ? 'selected' : ''); ?>><?php echo $a_type; ?></option>
<?php endforeach; ?>
</select>
</div>
<?php
} elseif ($hasGroupColumn) {
?>
<div class="col-12 col-sm-12 col-lg-6">
<label for="group">Account Type:</label>
<select name="group" id="group" class="form-control">
<?php foreach ($groups->getGroups() as $id => $group): ?>
<option value="<?php echo $id; ?>" <?php echo($acc_group == $id ? 'selected' : ''); ?>><?php echo $group->getName(); ?></option>
<?php endforeach; ?>
</select>
</div>
<?php } ?>
<div class="col-12 col-sm-12 col-lg-6">
<label for="web_flags">Website Access:</label>
<select name="web_flags" id="web_flags" class="form-control">
<?php foreach ($web_acc as $id => $a_type): ?>
<option value="<?php echo($id); ?>" <?php echo($account->getWebFlags() == ($id) ? 'selected' : ''); ?>><?php echo $a_type; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group row">
<?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'); ?>"/>
</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'); ?>"/>
</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(); ?>"/>
</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') ?>"/>
</div>
<?php endif; ?>
<div class="col-12 col-sm-12 col-lg-6">
<label for="p_days">Premium 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 ($hasPointsColumn): ?>
<div class="col-12 col-sm-12 col-lg-6">
<label for="p_points" class="control-label">Premium 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="form-group row">
<div class="col-12 col-sm-12 col-lg-4">
<label for="rl_name">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-12 col-sm-12 col-lg-4">
<label for="rl_loca">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-12 col-sm-12 col-lg-4">
<label for="rl_country">Country:</label>
<select name="rl_country" id="rl_country" class="form-control">
<?php foreach ($countries as $id => $a_type): ?>
<option value="<?php echo($id); ?>" <?php echo($account->getCountry() == ($id) ? 'selected' : ''); ?>><?php echo $a_type; ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group row">
<div class="col-12 col-sm-12 col-lg-6">
<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 date("M d Y, H:i:s", $account->getCustomField('created')); ?>"/>
</div>
<div class="col-12 col-sm-12 col-lg-6">
<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 date("M d Y, H:i:s", $account->getCustomField('web_lastlogin')); ?>"/>
</div>
</div>
<input type="hidden" name="save" value="yes"/>
<button type="submit" class="btn btn-info"><i class="fas fa-update"></i> Update</button>
<a href="<?php echo ADMIN_URL; ?>?p=accounts" class="btn btn-danger float-right"><i class="fas fa-cancel"></i> Cancel</a>
</form>
</div>
<div class="tab-pane fade" id="accounts-chars">
<div class="row">
<?php
if (isset($account) && $account->isLoaded()) {
$account_players = $account->getPlayersList();
$account_players->orderBy('id');
if (isset($account_players)) { ?>
<table class="table table-striped table-condensed">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Level</th>
<th>Vocation</th>
<th style="width: 40px">Edit</th>
</tr>
</thead>
<tbody>
<?php foreach ($account_players as $i => $player):
$player_vocation = $player->getVocation();
$player_promotion = $player->getPromotion();
if (isset($player_promotion)) {
if ((int)$player_promotion > 0)
$player_vocation += ($player_promotion * $config['vocations_amount']);
}
if (isset($config['vocations'][$player_vocation])) {
$vocation_name = $config['vocations'][$player_vocation];
} ?>
<tr>
<th><?php echo $i; ?></th>
<td><?php echo $player->getName(); ?></td>
<td><?php echo $player->getLevel(); ?></td>
<td><?php echo $vocation_name; ?></td>
<td><a href="?p=players&id=<?php echo $player->getId() ?>" class=" btn btn-success btn-sm" title="Edit"><i class="fas fa-pencil-alt"></i></a></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php
}
} ?>
</div>
</div>
<?php
if (!$config['otserv_version'] != TFS_02) { ?>
<div class="tab-pane fade" id="accounts-bans">
<?php
$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');
if ($bans->rowCount()) {
?>
<table class="table table-striped table-condensed">
<thead>
<tr>
<th>Nick</th>
<th>Type</th>
<th>Expires</th>
<th>Reason</th>
<th>Comment</th>
<th>Added by:</th>
</tr>
</thead>
<tbody>
<?php
foreach ($bans as $ban) {
if ($i++ > 100) {
$next_page = true;
break;
}
?>
<tr>
<td><?php
$pName = getPlayerNameByAccount($ban['value']);
echo '<a href="?p=players&search=' . $pName . '">' . $pName . '</a>'; ?>
</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
$aName = getPlayerNameByAccount($ban['admin_id']);
echo '<a href="?p=players&search=' . $aName . '">' . $aName . '</a>';
echo '<br/>' . date("d.m.Y", $ban['added']);
?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php
} else {
echo 'No Account bans.';
} ?>
</div>
<?php }
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">
<thead>
<tr>
<th>Description</th>
<th>Coins</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<?php foreach ($store_history as $p): ?>
<tr>
<td><?php echo $p['description']; ?></td>
<td><?php echo $p['coin_amount']; ?></td>
<td><?php echo date('d M y H:i:s', $p['time']); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<?php }
?>
<div class="col-12 col-sm-12 col-lg-2">
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Search Accounts</h5>
</div>
<div class="card-body">
<form action="<?php echo $admin_base; ?>" method="post">
<div class="input-group input-group-sm">
<input type="text" class="form-control" name="search" value="<?php echo $search_account; ?>" maxlength="32" size="32">
<span class="input-group-append"><button type="submit" class="btn btn-info btn-flat">Search</button></span>
</div>
</form>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$('#lastlogout').datetimepicker({format: 'unixtime'});
$('#created').datetimepicker({format: 'unixtime'});
$('#web_lastlogin').datetimepicker({format: 'unixtime'});
<script>
$(document).ready(function () {
$('.input_control').change(function () {
$('input[name=pass]')[0].disabled = !this.checked;
$('input[name=pass]')[0].value = '';
$('#created').datetimepicker({format: "M d Y, H:i:s",});
$('#web_lastlogin').datetimepicker({format: 'M d Y, H:i:s'});
$('#c_pass').change(function () {
const ipass = $('input[name=pass]');
ipass[0].disabled = !this.checked;
ipass[0].value = '';
}).change();
$('.acc_datatable').DataTable({
"order": [[0, "asc"]]
});
});
</script>

View File

@@ -19,8 +19,10 @@ if (isset($_GET['clear_cache'])) {
}
if (isset($_GET['maintenance'])) {
$_status = (int)$_POST['status'];
$message = $_POST['message'];
$message = (!empty($_POST['message']) ? $_POST['message'] : null);
$_status = (isset($_POST['status']) && $_POST['status'] == 'true');
$_status = ($_status ? '0' : '1');
if (empty($message)) {
error('Message cannot be empty.');
} else if (strlen($message) > 255) {
@@ -45,29 +47,17 @@ $tmp = '';
if (fetchDatabaseConfig('site_closed_message', $tmp))
$closed_message = $tmp;
$query = $db->query('SELECT count(*) as `how_much` FROM `accounts`;');
$query = $query->fetch();
$total_accounts = $query['how_much'];
$query = $db->query('SELECT count(*) as `how_much` FROM `players`;');
$query = $query->fetch();
$total_players = $query['how_much'];
$query = $db->query('SELECT count(*) as `how_much` FROM `guilds`;');
$query = $query->fetch();
$total_guilds = $query['how_much'];
$query = $db->query('SELECT count(*) as `how_much` FROM `houses`;');
$query = $query->fetch();
$total_houses = $query['how_much'];
$query_count = $db->query('SELECT
(SELECT COUNT(*) FROM accounts) as total_accounts,
(SELECT COUNT(*) FROM players) as total_players,
(SELECT COUNT(*) FROM guilds) as total_guilds,
(SELECT COUNT(*) FROM houses) as total_houses;')->fetch();
$twig->display('admin.statistics.html.twig', array(
'total_accounts' => $total_accounts,
'total_players' => $total_players,
'total_guilds' => $total_guilds,
'total_houses' => $total_houses
'count' => $query_count,
));
echo '<div class="row">';
$twig->display('admin.dashboard.html.twig', array(
'is_closed' => $is_closed,
'closed_message' => $closed_message,
@@ -75,16 +65,14 @@ $twig->display('admin.dashboard.html.twig', array(
'account_type' => USE_ACCOUNT_NAME ? 'name' : 'number'
));
echo '<div class="row">';
$configAdminPanelModules = config('admin_panel_modules');
if(isset($configAdminPanelModules))
if (isset($configAdminPanelModules))
$configAdminPanelModules = explode(',', $configAdminPanelModules);
$twig_loader->prependPath(__DIR__ . '/modules/templates');
foreach($configAdminPanelModules as $box) {
foreach ($configAdminPanelModules as $box) {
$file = __DIR__ . '/modules/' . $box . '.php';
if(file_exists($file)) {
if (file_exists($file)) {
include($file);
}
}

View File

@@ -4,7 +4,7 @@
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2019 MyAAC
* @copyright 2020 MyAAC
* @link https://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
@@ -13,47 +13,46 @@ $title = 'Logs Viewer';
$files = array();
$aac_path_logs = BASE . 'system/logs/';
foreach (scandir($aac_path_logs, SCANDIR_SORT_ASCENDING) as $f) {
if ($f[0] === '.' || is_dir($aac_path_logs . $f)) {
continue;
}
if ($f[0] === '.' || is_dir($aac_path_logs . $f)) {
continue;
}
$files[] = array($f, $aac_path_logs);
$files[] = array($f, $aac_path_logs);
}
$server_path_logs = $config['server_path'] . 'logs/';
if (!file_exists($server_path_logs)) {
$server_path_logs = $config['data_path'] . 'logs/';
$server_path_logs = $config['data_path'] . 'logs/';
}
if (file_exists($server_path_logs)) {
foreach (scandir($server_path_logs, SCANDIR_SORT_ASCENDING) as $f) {
if ($f[0] === '.') {
continue;
}
foreach (scandir($server_path_logs, SCANDIR_SORT_ASCENDING) as $f) {
if ($f[0] === '.') {
continue;
}
if (is_dir($server_path_logs . $f)) {
foreach (scandir($server_path_logs . $f, SCANDIR_SORT_ASCENDING) as $f2) {
if ($f2[0] === '.') {
continue;
}
if (is_dir($server_path_logs . $f)) {
foreach (scandir($server_path_logs . $f, SCANDIR_SORT_ASCENDING) as $f2) {
if ($f2[0] === '.') {
continue;
}
$files[] = array($f . '/' . $f2, $server_path_logs);
}
$files[] = array($f . '/' . $f2, $server_path_logs);
}
continue;
}
continue;
}
$files[] = array($f, $server_path_logs);
}
$files[] = array($f, $server_path_logs);
}
}
foreach ($files as &$f) {
$f['mtime'] = filemtime($f[1] . $f[0]);
$f['name'] = $f[0];
$f['mtime'] = filemtime($f[1] . $f[0]);
$f['name'] = $f[0];
}
unset($f);
$twig->display('admin.logs.html.twig', array('files' => $files));
define('EXIST_NONE', 0);
define('EXIST_SERVER_LOG', 1);
@@ -72,10 +71,12 @@ if (!empty($file)) {
}
if ($exist !== EXIST_NONE) {
$content = nl2br(file_get_contents(($exist === EXIST_SERVER_LOG ? $server_path_logs : $aac_path_logs) . $file));
$twig->display('admin.logs.view.html.twig', array('file' => $file, 'content' => $content));
$file_content = nl2br(file_get_contents(($exist === EXIST_SERVER_LOG ? $server_path_logs : $aac_path_logs) . $file));
$twig->display('admin.logs.view.html.twig', array('file' => $file, 'content' => $file_content));
}
} else {
echo 'Invalid file name specified.';
}
}
}
$twig->display('admin.logs.html.twig', array('files' => $files));

View File

@@ -46,7 +46,6 @@ if (isset($_REQUEST['template'])) {
if ($cache->enabled()) {
$cache->delete('template_menus');
}
success('Saved at ' . date('H:i'));
}
@@ -57,70 +56,70 @@ if (isset($_REQUEST['template'])) {
echo 'Cannot find template config.php file.';
return;
}
if (!isset($config['menu_categories'])) {
echo "No menu categories set in template config.php.<br/>This template doesn't support dynamic menus.";
return;
}
echo 'Hint: You can drag menu items.<br/>
Hint: Add links to external sites using: <b>http://</b> or <b>https://</b> prefix.<br/>
Not all templates support blank and colorful links.<br/><br/>
<div class="row">';
?>
<div align="center" class="text-center">
<p class="note">Hint: You can drag menu items.<br/>
Hint: Add links to external sites using: <b>http://</b> or <b>https://</b> prefix.<br/>
Not all templates support blank and colorful links.
</p>
</div>
<?php
$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">
<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>
</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 . '"><label>Name:</label><input type="text" name="menu[' . $id . '][]" value="' . $menu['name'] . '"/>
<label>Link:</label><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">Open in New Window</span></label>
<input class="color-picker" type="text" name="menu_color[' . $id . '][]" value="#' . $menu['color'] . '" />
<a class="remove-button" id="remove-button-' . $id . '-' . $i . '"><img src="' . BASE_URL . 'images/del.png"/></a></li>';
$i++;
$last_id[$id] = $i;
}
}
echo '</ul>';
echo ' </div>
</div>
</div>
';
}
echo ' </div><div class="row"><div class="col-md-6">';
echo '<input type="submit" class="btn btn-info" value="Save">';
echo '<input type="button" class="btn btn-default pull-right" value="Cancel" onclick="window.location = \'' . ADMIN_URL . '?p=menus&template=' . $template . '\';">';
echo '</div></div>';
echo '</form>';
?>
<form method="post" id="menus-form" action="?p=menus">
<input type="hidden" name="template" value="<?php echo $template ?>"/>
<div class="row">
<?php foreach ($config['menu_categories'] as $id => $cat): ?>
<div class="col-md-12 col-lg-6">
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0"><?php echo $cat['name'] ?> <i class="far fa-plus-square add-button" id="add-button-<?php echo $id ?>"></i></h5>
</div>
<div class="card-body">
<ul class="sortable" id="sortable-<?php echo $id ?>">
<?php
if (isset($menus[$id])) {
foreach ($menus[$id] as $i => $menu):
?>
<li class="ui-state-default" id="list-<?php echo $id ?>-<?php echo $i ?>"><label>Name:</label> <input type="text" name="menu[<?php echo $id ?>][]" value="<?php echo $menu['name'] ?>"/>
<label>Link:</label> <input type="text" name="menu_link[<?php echo $id ?>][]" value="<?php echo $menu['link'] ?>"/>
<input type="hidden" name="menu_blank[<?php echo $id ?>][]" value="0"/>
<label><input class="blank-checkbox" type="checkbox" <?php echo($menu['blank'] == 1 ? 'checked' : '') ?>/><span title="Open in New Window">New Window</span></label>
<input class="color-picker" type="text" name="menu_color[<?php echo $id ?>][]" value="#<?php echo $menu['color'] ?>"/>
<a class="remove-button" id="remove-button-<?php echo $id ?>-<?php echo $i ?>"><i class="fas fa-trash"></a></i></li>
<?php $last_id[$id] = $i;
endforeach;
} ?>
</ul>
</div>
</div>
</div>
<?php endforeach ?>
</div>
<div class="row pb-2">
<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>';
?>
</div>
</div>
</form>
<?php
$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();
@@ -134,4 +133,4 @@ if (isset($_REQUEST['template'])) {
$twig->display('admin.menus.form.html.twig', array(
'templates' => $templates
));
}
}

View File

@@ -0,0 +1,6 @@
<?php
$balance = ($db->hasColumn('players', 'balance') ? $db->query('SELECT `balance`, `id`, `name`,`level` FROM `players` ORDER BY `balance` DESC LIMIT 10;') : 0);
$twig->display('balance.html.twig', array(
'balance' => $balance
));

View File

@@ -1,11 +1,6 @@
<?php
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;');
} else {
$coins = 0;
}
$coins = ($db->hasColumn('accounts', 'coins') ? $db->query('SELECT `coins`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `coins` DESC LIMIT 10;') : 0);
$twig->display('coins.html.twig', array(
'coins' => $coins
));
));

View File

@@ -0,0 +1,6 @@
<?php
$players = ($db->hasColumn('accounts', 'created') ? $db->query('SELECT `created`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `created` DESC LIMIT 10;') : 0);
$twig->display('created.html.twig', array(
'players' => $players,
));

View File

@@ -1,11 +1,5 @@
<?php
if ($db->hasColumn('players', 'lastlogin')) {
$players = $db->query('SELECT name, level, lastlogin FROM players ORDER BY lastlogin DESC LIMIT 10;');
} else {
$players = 0;
}
$players = ($db->hasColumn('players', 'lastlogin') ? $db->query('SELECT name, level, lastlogin FROM players ORDER BY lastlogin DESC LIMIT 10;') : 0);
$twig->display('lastlogin.html.twig', array(
'players' => $players,
));
));

View File

@@ -1,10 +1,6 @@
<?php
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;');
} else {
$points = 0;
}
$points = ($db->hasColumn('accounts', 'premium_points') ? $db->query('SELECT `premium_points`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `premium_points` DESC LIMIT 10;') : 0);
$twig->display('points.html.twig', array(
'points' => $points,
));
));

View File

@@ -0,0 +1,31 @@
{% if balance is iterable %}
<div class=" col-md-6 col-lg-3">
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Top 10 - Balance</h5>
</div>
<div class="card-body p-0">
<table class="table table-striped table-condensed">
<thead>
<tr>
<th>#</th>
<th>Player</th>
<th>Balance</th>
</tr>
</thead>
<tbody>
{% set i = 0 %}
{% for result in balance %}
{% set i = i + 1 %}
<tr>
<th>{{ i }}</th>
<td><a href="?p=players&search_name={{ result.name }}">{{ result.name }}</a></td>
<td>{{ result.balance }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}

View File

@@ -1,23 +1,25 @@
{% if coins is iterable %}
<div class="col-md-3">
<div class="box">
<div class="box-header">
<h3 class="box-title">Top 10 - Most coins</h3>
<div class=" col-md-6 col-lg-3">
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Top 10 - Most coins</h5>
</div>
<div class="box-body no-padding">
<table class="table table-condensed">
<tbody>
<div class="card-body p-0">
<table class="table table-striped table-condensed">
<thead>
<tr>
<th>#</th>
<th>Account {{ account_type }}</th>
<th>Account</th>
<th>Tibia coins</th>
</tr>
</thead>
<tbody>
{% set i = 0 %}
{% for result in coins %}
{% set i = i + 1 %}
<tr>
<td>{{ i }}</td>
<td>{{ result.name }}</td>
<th>{{ i }}</th>
<td><a href="?p=accounts&search_name={{ result.name }}">{{ result.name }}</a></td>
<td>{{ result.coins }}</td>
</tr>
{% endfor %}
@@ -26,4 +28,4 @@
</div>
</div>
</div>
{% endif %}
{% endif %}

View File

@@ -0,0 +1,31 @@
{% if players is iterable %}
<div class=" col-md-6 col-lg-3">
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Last 10 created</h5>
</div>
<div class="card-body p-0">
<table class="table table-striped table-condensed">
<thead>
<tr>
<th>#</th>
<th>Account</th>
<th>Creation Date</th>
</tr>
</thead>
<tbody>
{% set i = 0 %}
{% for result in players %}
{% set i = i + 1 %}
<tr>
<th>{{ i }}</th>
<td><a href="?p=accounts&search_name={{ result.name }}">{{ result.name }}</a></td>
<td>{{ result.created|date("M d Y, H:i:s") }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}

View File

@@ -1,23 +1,25 @@
{% if players is iterable %}
<div class="col-md-3">
<div class="box">
<div class="box-header">
<h3 class="box-title">Last 10 Logins</h3>
<div class=" col-md-6 col-lg-3">
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Last 10 logins</h5>
</div>
<div class="box-body no-padding">
<table class="table table-condensed">
<tbody>
<div class="card-body p-0">
<table class="table table-striped table-condensed">
<thead>
<tr>
<th>#</th>
<th>Player</th>
<th>Login Date</th>
</tr>
</thead>
<tbody>
{% set i = 0 %}
{% for result in players %}
{% set i = i + 1 %}
<tr>
<td>{{ i }}</td>
<td>{{ result.name }}</td>
<th>{{ i }}</th>
<td><a href="?p=players&search_name={{ result.name }}">{{ result.name }}</a></td>
<td>{{ result.lastlogin|date("M d Y, H:i:s") }}</td>
</tr>
{% endfor %}
@@ -26,4 +28,4 @@
</div>
</div>
</div>
{% endif %}
{% endif %}

View File

@@ -1,23 +1,25 @@
{% if points is iterable %}
<div class="col-md-3">
<div class="box">
<div class="box-header">
<h3 class="box-title">Top 10 - Most premium points</h3>
<div class=" col-md-6 col-lg-3">
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Top 10 - Most premium points</h5>
</div>
<div class="box-body no-padding">
<table class="table table-condensed">
<tbody>
<div class="card-body p-0">
<table class="table table-striped table-condensed">
<thead>
<tr>
<th>#</th>
<th>Account {{ account_type }}</th>
<th>Account</th>
<th>Premium points</th>
</tr>
</thead>
<tbody>
{% set i = 0 %}
{% for result in points %}
{% set i = i + 1 %}
<tr>
<td>{{ i }}</td>
<td>{{ result.name }}</td>
<th>{{ i }}</th>
<td><a href="?p=accounts&search_name={{ result.name }}">{{ result.name }}</a></td>
<td>{{ result.premium_points }}</td>
</tr>
{% endfor %}
@@ -26,4 +28,4 @@
</div>
</div>
</div>
{% endif %}
{% endif %}

View File

@@ -16,4 +16,4 @@ if (!function_exists('phpinfo')) { ?>
<?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"></iframe>

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@
*
* @package MyAAC
* @author Lee
* @copyright 2019 MyAAC
* @copyright 2020 MyAAC
* @link https://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
@@ -14,25 +14,25 @@ $files = array();
$server_path_reports = $config['data_path'] . 'reports/';
if (file_exists($server_path_reports)) {
foreach (scandir($server_path_reports, SCANDIR_SORT_ASCENDING) as $f) {
if ($f[0] === '.') {
continue;
}
foreach (scandir($server_path_reports, SCANDIR_SORT_ASCENDING) as $f) {
if ($f[0] === '.') {
continue;
}
if (is_dir($server_path_reports . $f)) {
foreach (scandir($server_path_reports . $f, SCANDIR_SORT_ASCENDING) as $f2) {
if ($f2[0] === '.') {
continue;
}
if (is_dir($server_path_reports . $f)) {
foreach (scandir($server_path_reports . $f, SCANDIR_SORT_ASCENDING) as $f2) {
if ($f2[0] === '.') {
continue;
}
$files[] = array($f . '/' . $f2, $server_path_reports);
}
$files[] = array($f . '/' . $f2, $server_path_reports);
}
continue;
}
continue;
}
$files[] = array($f, $server_path_reports);
}
$files[] = array($f, $server_path_reports);
}
}
foreach ($files as &$f) {
@@ -42,20 +42,19 @@ foreach ($files as &$f) {
unset($f);
$twig->display('admin.reports.html.twig', array('files' => $files));
$file = isset($_GET['file']) ? $_GET['file'] : NULL;
if (!empty($file)) {
if (!preg_match('/[^A-z0-9\' _\/\-\.]/', $file)) {
if (file_exists($server_path_reports . $file)) {
$content = nl2br(file_get_contents($server_path_reports . $file));
$file_content = nl2br(file_get_contents($server_path_reports . $file));
$twig->display('admin.logs.view.html.twig', array('file' => $file, 'content' => $content));
$twig->display('admin.logs.view.html.twig', array('file' => $file, 'content' => $file_content));
} else {
echo 'Specified file does not exist.';
}
} else {
echo 'Invalid file name specified.';
}
}
}
$twig->display('admin.reports.html.twig', array('files' => $files));

View File

@@ -90,116 +90,3 @@ 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>
<?php
function getBanReason($reasonId)
{
switch($reasonId)
{
case 0:
return "Offensive Name";
case 1:
return "Invalid Name Format";
case 2:
return "Unsuitable Name";
case 3:
return "Name Inciting Rule Violation";
case 4:
return "Offensive Statement";
case 5:
return "Spamming";
case 6:
return "Illegal Advertising";
case 7:
return "Off-Topic Public Statement";
case 8:
return "Non-English Public Statement";
case 9:
return "Inciting Rule Violation";
case 10:
return "Bug Abuse";
case 11:
return "Game Weakness Abuse";
case 12:
return "Using Unofficial Software to Play";
case 13:
return "Hacking";
case 14:
return "Multi-Clienting";
case 15:
return "Account Trading or Sharing";
case 16:
return "Threatening Gamemaster";
case 17:
return "Pretending to Have Influence on Rule Enforcement";
case 18:
return "False Report to Gamemaster";
case 19:
return "Destructive Behaviour";
case 20:
return "Excessive Unjustified Player Killing";
case 21:
return "Invalid Payment";
case 22:
return "Spoiling Auction";
}
return "Unknown Reason";
}
function getBanType($typeId)
{
switch($typeId)
{
case 1:
return "IP Banishment";
case 2:
return "Namelock";
case 3:
return "Banishment";
case 4:
return "Notation";
case 5:
return "Deletion";
}
return "Unknown Type";
}
function getPlayerNameByAccount($id)
{
global $vowels, $ots, $db;
if(is_numeric($id))
{
$player = new OTS_Player();
$player->load($id);
if($player->isLoaded())
return $player->getName();
else
{
$playerQuery = $db->query('SELECT `id` FROM `players` WHERE `account_id` = ' . $id . ' ORDER BY `lastlogin` DESC LIMIT 1;')->fetch();
$tmp = "*Error*";
/*
$acco = new OTS_Account();
$acco->load($id);
if(!$acco->isLoaded())
return "Unknown name";
foreach($acco->getPlayersList() as $p)
{
$player= new OTS_Player();
$player->find($p);*/
$player->load($playerQuery['id']);
//echo 'id gracza = ' . $p . '<br/>';
if($player->isLoaded())
$tmp = $player->getName();
// break;
//}
return $tmp;
}
}
return '';
}
?>

View File

@@ -1,102 +1,27 @@
<div class="row">
<div class="col-md-6">
<div class="box box-warning">
<div class="box-header with-border">
<h3 class="box-title">Maintenance</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 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">
<h5 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 class="custom-control-label" for="status"> {% if is_closed %}Closed{% else %}Open{% endif %}</label>
</div></span>
</h5>
</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="box-body">
<form action="?p=dashboard&maintenance" method="post" class="form-horizontal">
<div class="box-body">
<div class="form-group">
<label for="status" class="col-sm-2 control-label">Website:</label>
<div class="col-sm-10">
<select class="form-control" id="status" name="status">
<option value="0"{% if not is_closed %} selected{% endif %}>Open</option>
<option value="1"{% if is_closed %} selected{% endif %}>Closed</option>
</select>
</div>
</div>
<div class="form-group">
<label for="message" class="col-sm-2 control-label">Message:<br>
<small>(only if closed)</small>
</label>
<div class="col-sm-10">
<textarea name="message" cols="40" class="form-control" rows="5" maxlength="255"
placeholder="Enter ...">{{ closed_message }}</textarea>
</div>
</div>
</div>
<div class="box-footer">
<a href="?p=dashboard&clear_cache" onclick="return confirm('Are you sure?');"><span
class="btn btn-danger">Clear cache</span></a>
<div class="pull-right">
<input type="submit" class="btn btn-primary" value="Update"/>
</div>
</div>
</form>
<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>
</div>
</form>
</div>
{% if points is iterable %}
<div class="col-md-3">
<div class="box">
<div class="box-header">
<h3 class="box-title">Top 10 - Most premium points</h3>
</div>
<div class="box-body no-padding">
<table class="table table-condensed">
<tbody>
<tr>
<th>#</th>
<th>Account {{ account_type }}</th>
<th>Premium points</th>
</tr>
{% set i = 0 %}
{% for result in points %}
{% set i = i + 1 %}
<tr>
<td>{{ i }}</td>
<td>{{ result.name }}</td>
<td>{{ result.premium_points }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
{% if coins is iterable %}
<div class="col-md-3">
<div class="box">
<div class="box-header">
<h3 class="box-title">Top 10 - Most coins</h3>
</div>
<div class="box-body no-padding">
<table class="table table-condensed">
<tbody>
<tr>
<th>#</th>
<th>Account {{ account_type }}</th>
<th>Tibia coins</th>
</tr>
{% set i = 0 %}
{% for result in coins %}
{% set i = i + 1 %}
<tr>
<td>{{ i }}</td>
<td>{{ result.name }}</td>
<td>{{ result.coins }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
</div>
</div>

View File

@@ -1,4 +1,4 @@
<form method="post" action="{{ constant('ADMIN_URL') }}?p=items">
<input type="hidden" name="reload" value="1"/>
<input type="submit" value="Reload items and weapons (it may take some time to finish)"/>
</form>
<button type="submit" class="btn btn-info"><i class="fas fa-update"></i> Reload items and weapons</button><br/><small> (it may take some time to finish)</small>
</form>

View File

@@ -1,38 +1,47 @@
<div class="login-box">
{% if logout %}
<div class="alert alert-success alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h4><i class="icon fa fa-check"></i> Status</h4>
{{ logout }}
</div>
{% endif %}
<form method="post">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">Please login.</h3>
<div class="login-page">
<div class="login-box">
<div class="login-logo"><b>My</b>AAC</div>
{% if logout %}
<div class="toast bg-success fade show">
<div class="toast-header"><strong class="mr-auto">Status</strong></div>
<div class="toast-body">{{ logout }}</div>
</div>
<div class="box-body">
<div class="form-group">
<div class="form-group input-group">
<span class="input-group-addon"><i class="fa fa-lock"></i></span>
{% endif %}
<div class="card">
<div class="card-body">
<p class="login-box-msg">Please login.</p>
<form method="post">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-lock"></i></span>
</div>
<input type="text" class="form-control" id="account-name-input" name="account_login"
placeholder="Account {{ account }}" required autofocus>
</div>
<div class="form-group input-group">
<span class="input-group-addon"><i class="fa fa-key"></i></span>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-key"></i></span>
</div>
<input type="password" class="form-control" placeholder="Password" name="password_login"
placeholder="Password" required>
</div>
</div>
</div>
<div class="box-footer">
<label>
<input type="checkbox" id="remember_me" name="remember_me" value="true"> Remember me
</label>
<input type="hidden" name="admin" value="1"/>
<button type="submit" class="btn btn-info pull-right">Sign in</button>
<div class="row">
<div class="col-8">
<div class="icheck-primary">
<input type="checkbox" id="remember_me" name="remember_me" value="true">
<label for="remember">Remember Me</label>
</div>
</div>
<div class="col-4">
<input type="hidden" name="admin" value="1"/>
<button type="submit" class="btn btn-info btn-block">Sign In</button>
</div>
</div>
</form>
</div>
</div>
</form>
</div>
</div>
</div>

View File

@@ -1,41 +1,30 @@
<div class="box">
<div class="box-header">
<h3 class="box-title">Logs:</h3>
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Logs</h5>
</div>
<div class="box-body">
<div class="row">
<div class="col-sm-12">
<table id="tb_logs">
<thead>
<tr>
<th>Log name</th>
<th>Last updated</th>
</tr>
</thead>
<tbody>
{% for file in files %}
<tr>
<td>
<a href="{{ constant('ADMIN_URL') }}?p=logs&file={{ file.name }}">{{ file.name }}</a>
</td>
<td>{{ file.mtime|date('Y-m-d H:i:s') }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th>Log name</th>
<th>Last updated</th>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="card-body">
<table class="table table-striped table-bordered" id="tb_logs">
<thead>
<tr>
<th>Log name</th>
<th>Last updated</th>
</tr>
</thead>
<tbody>
{% for file in files %}
<tr>
<td>
<a href="{{ constant('ADMIN_URL') }}?p=logs&file={{ file.name }}">{{ file.name }}</a>
</td>
<td>{{ file.mtime|date('Y-m-d H:i:s') }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<script>
$(function () {
$('#tb_logs').DataTable()
})
</script>
</script>

View File

@@ -1,8 +1,10 @@
<div class="box">
<div class="box-header">
<h3 class="box-title"><b>{{ file }}</b></h3>
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">{{ file }}</h5>
</div>
<div class="box-body">
{{ content|raw }}
</div>
</div>
<div class="card-body pr-0">
<div style="max-height: 410px; overflow-y: auto;">
{{ content|raw }}
</div>
</div>
</div>

View File

@@ -11,37 +11,28 @@
document_base_url: "{{ constant('BASE_URL') }}"
});
</script>
<div class="row">
<div class="col-md-8">
<div class="box box-danger">
<div class="box-header with-border">
<h3 class="box-title">Mailer</h3>
</div>
<form method="post">
<div class="box-body">
<div align="center" class="row"><p class="note note-image" style="width: 80%;">Sending mails may
take some time if there are many users in db.</p></div>
<div class="form-group">
<div class="row">
<div class="col-xs-12 ">
<label for="mail_subject" class="control-label">Subject:</label>
<input class="form-control" type="text" id="mail_subject" name="mail_subject"
value="{{ mail_subject }}" size="30" maxlength="30"/>
</div>
</div>
</div>
<label for="mail_content" class="control-label">Content:</label>
<textarea id="mail_content" name="mail_content" style="width: 100%"
class="tinymce">{{ mail_content }}</textarea>
</div>
<div class="box-footer">
<input type="checkbox" name="preview" id="preview" value="1"/><label for="preview">Just send test
email to me (preview)</label>{% if preview_done %} - <b>Done.</b>{% endif %}<br/>
<button type="submit" name="submit" value="Send" class="btn btn-primary">Send</button>
</div>
</form>
</div>
<div align="center" class="text-center"><p class="note">Sending mails may take some time if there are many users in db.</p></div>
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Mailer</h5>
</div>
</div>
<form method="post">
<div class="card-body">
<div class="form-group row">
<label for="mail_subject">Subject:</label>
<input class="form-control" type="text" id="mail_subject" name="mail_subject"
value="{{ mail_subject }}" size="30" maxlength="30"/>
</div>
<div class="form-group row">
<label for="mail_content" class="control-label">Content:</label>
<textarea id="mail_content" name="mail_content" style="width: 100%" class="tinymce">{{ mail_content }}</textarea>
</div>
<div class="form-group row">
<input type="checkbox" name="preview" id="preview" value="1"/><label for="category">Just send test email to me (preview)</label>{% if preview_done %} - <b>Done.</b>{% endif %}
</div>
</div>
<div class="card-footer">
<button type="submit" class="btn btn-info"><i class="fas fa-share"></i> Send</button>
</div>
</form>
</div>

View File

@@ -1,28 +1,22 @@
<div class="row">
<div class="col-md-6">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Templates</h3>
</div>
<div class="box-body">
<form method="post" action="?p=menus">
<p>Please choose template in which you want to edit menu items.</p>
<div class="row">
<div class="col-xs-6">
<div class="input-group input-group-sm">
<select id="template" name="template" class="form-control">
{% for template in templates %}
<option value="{{ template.template }}">{{ template.template }}</option>
{% endfor %}
</select>
<span class="input-group-btn">
<button type="submit" type="button" class="btn btn-primary btn-flat">Edit</button>
</span>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Templates</h5>
</div>
</div>
<div class="card-body">
<form method="post" action="?p=menus">
<p>Please choose template in which you want to edit menu items.</p>
<div class="col-md-6">
<div class="input-group input-group-sm">
<select id="template" name="template" class="form-control">
{% for template in templates %}
<option value="{{ template.template }}">{{ template.template }}</option>
{% endfor %}
</select>
<span class="input-group-append">
<button type="submit" class="btn btn-info btn-flat">Edit!</button>
</span>
</div>
</div>
</form>
</div>
</div>

View File

@@ -1,149 +1,119 @@
{% if action %}
<div class="row">
<form method="post" action="{{ news_link_form }}" id="news-edit-form">
{% if action == 'edit' %}
<input type="hidden" name="id" value="{{ news_id }}"/>
{% endif %}
<div class="col-md-8" id="page-edit-table">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">{% if action == 'edit' %}Edit{% else %}Add{% endif %} news</h3>
</div>
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">{% if action == 'edit' %}Edit{% else %}Add{% endif %} news</h5>
</div>
<form role="form" method="post" action="{{ news_link_form }}" id="news-edit-form">
<div class="card-body " id="page-edit-table">
{% if action == 'edit' %}
<input type="hidden" name="id" value="{{ news_id }}"/>
{% endif %}
<div class="box-body">
<div class="form-group">
<label for="title" class="col-sm-2 control-label">Title</label>
<div class="form-group row">
<label for="title">Title</label>
<input type="text" id="title" name="title" class="form-control" autocomplete="off" style="cursor: auto;" value="{{ title }}">
</div>
<div class="col-sm-10">
<input type="text" id="title" name="title" class="form-control" autocomplete="off" style="cursor: auto;" value="{{ title }}">
</div>
</div>
<div class="form-group row">
<label for="body">Content</label>
<textarea class="form-control" id="body" name="body" maxlength="65000" cols="50" rows="5">{{ body|raw }}</textarea>
</div>
<div class="form-group">
<label for="body" class="col-sm-2 control-label">Content</label>
<div class="form-group row">
<label for="select-type">Type</label>
<select class="form-control" name="type" id="select-type">
<option value="{{ constant('NEWS') }}" {% if type is defined and type == constant('NEWS') %}selected="yes"{% endif %}{% if action == 'edit' and type != constant('NEWS') %} disabled{% endif %}>News</option>
<option value="{{ constant('TICKER') }}" {% if type is defined and type == constant('TICKER') %}selected="yes"{% endif %}{% if action == 'edit' and type != constant('TICKER') %} disabled{% endif %}>Ticket</option>
<option value="{{ constant('ARTICLE') }}" {% if type is defined and type == constant('ARTICLE') %}selected="yes"{% endif %}{% if action == 'edit' and type != constant('ARTICLE') %} disabled{% endif %}>Article</option>
</select>
</div>
<div class="col-sm-10" id="body-parent">
<textarea class="form-control" id="body" name="body" maxlength="65000" cols="50" rows="5">{{ body|raw }}</textarea>
</div>
</div>
<div id="article-text" class="form-group row"{% if type is not defined or type != constant('ARTICLE') %} style="display: none;"{% endif %}>
<label for="article_text">Article short text</label>
<textarea class="form-control" name="article_text" id="article_text" cols="50" rows="5">{% if article_text is not empty %}{{ article_text }}{% endif %}</textarea>
</div>
<div class="form-group">
<label for="select-type" class="col-sm-2 control-label">Type</label>
<div class="col-sm-10">
<select class="form-control" name="type" id="select-type">
<option value="{{ constant('NEWS') }}" {% if type is defined and type == constant('NEWS') %}selected="yes"{% endif %}{% if action == 'edit' and type != constant('NEWS') %} disabled{% endif %}>News</option>
<option value="{{ constant('TICKER') }}" {% if type is defined and type == constant('TICKER') %}selected="yes"{% endif %}{% if action == 'edit' and type != constant('TICKER') %} disabled{% endif %}>Ticket</option>
<option value="{{ constant('ARTICLE') }}" {% if type is defined and type == constant('ARTICLE') %}selected="yes"{% endif %}{% if action == 'edit' and type != constant('ARTICLE') %} disabled{% endif %}>Article</option>
<div id="article-image" class="form-group row"{% if type is not defined or type != constant('ARTICLE') %} style="display: none;"{% endif %}>
<label for="article_image">Article image</label>
<input class="form-control" type="text" name="article_image" id="article_image" value="{% if article_image is not empty %}{{ article_image }}{% else %}images/news/announcement.jpg{% endif %}"/>
</div>
<div class="form-group row">
{% if action == 'edit' %}
{% if player is defined %}
<div class="col-sm-6 pl-0">
<label for="author">Author</label>
<select class="form-control" id="author" name="original_id" disabled="disabled">
<option value="{{ player.getId() }}">{{ player.getName() }}</option>
</select>
</div>
</div>
<div id="article-text" class="form-group"{% if type is not defined or type != constant('ARTICLE') %} style="display: none;"{% endif %}>
<label for="article_text" class="col-sm-2 control-label">Article short text</label>
<div class="col-sm-10" id="body-parent">
<textarea class="form-control" name="article_text" id="article_text" cols="50" rows="5">{% if article_text is not empty %}{{ article_text }}{% endif %}</textarea>
</div>
</div>
<div id="article-image" class="form-group"{% if type is not defined or type != constant('ARTICLE') %} style="display: none;"{% endif %}>
<label for="article_image" class="col-sm-2 control-label">Article image</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="article_image" id="article_image" value="{% if article_image is not empty %}{{ article_image }}{% else %}images/news/announcement.jpg{% endif %}" />
</div>
</div>
{% if action == 'edit' %}
{% if player is defined %}
<div class="form-group">
<label for="author" class="col-sm-2 control-label">Author</label>
<div class="col-sm-10">
<select class="form-control" id="author" name="original_id" disabled="disabled">
<option value="{{ player.getId() }}">{{ player.getName() }}</option>
</select>
</div>
</div>
{% endif %}
{% endif %}
{% endif %}
<div class="form-group">
<label for="player_id" class="col-sm-2 control-label">{% if action == 'edit' %}Modified by{% else %}Author{% endif %}</label>
<div class="col-sm-{{ (action == 'edit') ? '6' : '12' }} px-0">
<label for="player_id">{% if action == 'edit' %}Modified by{% else %}Author{% endif %}</label>
<select class="form-control" name="player_id" id="player_id">
{% for player in account_players %}
<option value="{{ player.getId() }}"{% if player_id is defined and player.getId() == player_id %} selected="selected"{% endif %}>{{ player.getName() }}</option>
{% endfor %}
</select>
<div class="col-sm-10">
<select class="form-control" name="player_id" id="player_id">
{% for player in account_players %}
<option value="{{ player.getId() }}"{% if player_id is defined and player.getId() == player_id %} selected="selected"{% endif %}>{{ player.getName() }}</option>
{% endfor %}
</select>
</div>
</div>
</div>
</div>
{% if action != 'edit' %}
<div class="form-group">
<label for="forum_section" class="col-sm-2 control-label">Create forum thread in section:</label>
<div class="col-sm-10">
<select class="form-control" name="forum_section" id="forum_section">
<option value="-1">None</option>
{% for section in forum_boards %}
{% if action != 'edit' %}
<div class="form-group row">
<label for="forum_section">Create forum thread in section:</label>
<select class="form-control" name="forum_section" id="forum_section">
<option value="-1">None</option>
{% for section in forum_boards %}
<option value="{{ section.id }}" {% if forum_section is defined and forum_section == section.id %}checked="yes"{% endif %}>{{ section.name }}</option>
{% endfor %}
</select>
</div>
</div>
{% elseif comments is not null %}
<input type="hidden" name="forum_section" id="forum_section" value="{{ comments }}" />
{% endif %}
<div class="form-group">
<label for="category" class="col-sm-2 control-label">Category</label>
<div class="col-sm-10">
{% for id, cat in categories %}
<input type="radio" name="category" id="category" value="{{ id }}" {% if (category == 0 and id == 1) or (category == id) %}checked="yes"{% endif %}/>
<img src="{{ constant('BASE_URL') }}/images/news/icon_{{ cat.icon_id }}_small.gif" />
{% endfor %}
</div>
</div>
</select>
</div>
{% elseif comments is not null %}
<input type="hidden" name="forum_section" id="forum_section" value="{{ comments }}"/>
{% endif %}
<div class="box-footer">
<td align="right"><input type="submit" class="btn btn-info pull-right" value="Save"/></td>
<td align="left">
<input type="button" onclick="window.location = '{{ constant('ADMIN_URL') }}?p=news';" class="btn btn-default" value="Cancel"/>
</td>
<div class="form-group row">
<label for="category">Category</label>
<div class="col-sm-12">
{% for id, cat in categories %}
<input type="radio" name="category" value="{{ id }}" {% if (category == 0 and id == 1) or (category == id) %}checked="yes"{% endif %}/>
<img src="{{ constant('BASE_URL') }}/images/news/icon_{{ cat.icon_id }}_small.gif"/>
{% endfor %}
</div>
</div>
</div>
<div class="card-footer">
<button type="submit" class="btn btn-info"><i class="fas fa-update"></i> Update</button>
<button type="button" onclick="window.location = '{{ constant('ADMIN_URL') }}?p=news';" class="btn btn-danger float-right"><i class="fas fa-cancel"></i> Cancel</button>
</div>
</form>
</div>
{% if action != 'edit' %}
<script type="text/javascript">
$(document).ready(function() {
$("#news-edit").hide();
<script type="text/javascript">
$(document).ready(function () {
$("#news-edit").hide();
$("#news-button").click(function() {
$("#news-edit").toggle();
return false;
});
$("#news-button").click(function () {
$("#news-edit").toggle();
return false;
});
$('#select-type').change(function() {
var value = $('#select-type').val();
if(value == {{ constant('ARTICLE') }}) {
$('#article-text').show();
$('#article-image').show();
}
else {
$('#article-text').hide();
$('#article-image').hide();
}
$('#select-type').change(function () {
var value = $('#select-type').val();
if (value == {{ constant('ARTICLE') }}) {
$('#article-text').show();
$('#article-image').show();
} else {
$('#article-text').hide();
$('#article-image').hide();
}
});
});
});
</script>
</script>
{% endif %}
<script type="text/javascript" src="{{ constant('BASE_URL') }}tools/tinymce/tinymce.min.js"></script>
@@ -152,38 +122,38 @@
var lastContent = '';
tinymce.init({
selector : "#body",
theme : "modern",
plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists textcolor wordcount spellchecker imagetools contextmenu colorpicker textpattern help code emoticons',
selector: "#body",
theme: "modern",
plugins: 'preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists textcolor wordcount spellchecker imagetools contextmenu colorpicker textpattern help code emoticons',
toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor | emoticons link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat code',
image_advtab: true,
setup: function(ed){
ed.on('NodeChange', function(e) {
if(ed.getContent() != lastContent) {
setup: function (ed) {
ed.on('NodeChange', function (e) {
if (ed.getContent() != lastContent) {
unsaved = true;
}
});
}
});
$(document).ready(function() {
$(":input").change(function(){ //trigers change in all input fields including text type
$(document).ready(function () {
$(":input").change(function () { //triggers change in all input fields including text type
unsaved = true;
});
$("#news-edit-form").submit(function( event ) {
$("#news-edit-form").submit(function (event) {
unsaved = false;
});
lastContent = $("#body").val();
});
function unloadPage(){
if(unsaved){
function unloadPage() {
if (unsaved) {
return "You have unsaved changes on this page. Do you want to leave this page and discard your changes or stay on this page?";
}
}
window.onbeforeunload = unloadPage;
</script>
{% endif %}
window.onbeforeunload = unloadPage;
</script>
{% endif %}

View File

@@ -1,188 +1,141 @@
<div class="box">
<div class="box-header">
<h3 class="box-title">News:</h3>
<div class="box-tools pull-right">
<a href="?p=news&action=new&type=1"><span class="btn btn-success">New</span></a>
</div>
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">News:
<a href="?p=news&action=new&type=1" class="float-right"><span class="btn btn-sm btn-success">New</span></a>
</h5>
</div>
<div class="box-body">
<div class="row">
<div class="col-sm-12">
<table class="tb_datatable">
<thead>
<tr>
<th width="5%">ID</th>
<th>Title</th>
<th>Date</th>
<th>Player</th>
<th style="width: 150px;">Options</th>
</tr>
</thead>
<tbody>
{% for news in newses[constant('NEWS')] %}
<tr>
<td>{{ news.id|raw }}</td>
<td><i><a href="?p=news&action=edit&id={{ news.id }}">{{ news.title }}</a></i></td>
<td>{{ news.date|date(config.news_date_format) }}</td>
<td><a target="_blank" rel="noopener noreferrer" href="{{ news.player_link }}">{{ news.player_name }}</a></td>
<td>
<a href="?p=news&action=edit&id={{ news.id }}" class="ico" title="Edit">
<span class="btn btn-success btn-sm edit btn-flat">
<i class="fa fa-edit"></i>
</span>
</a>
<a href="?p=news&action=delete&id={{ news.id }}" class="ico" onclick="return confirm('Are you sure?');" title="Delete">
<span class="btn btn-danger btn-sm delete btn-flat">
<i class="fa fa-trash"></i>
</span>
</a>
<a href="?p=news&action=hide&id={{ news.id }}" class="ico" title="{% if news.hidden != 1 %}Hide{% else %}Show{% endif %}">
{% if news.hidden != 1 %}
<span class="btn btn-primary btn-sm btn-flat">
<i class="fa fa-eye"></i>
</span>
{% else %}
<span class="btn btn-default btn-sm btn-flat">
<i class="fa fa-eye-slash"></i>
</span>
{% endif %}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="card-body">
<table class="tb_datatable table table-striped table-bordered">
<thead>
<tr>
<th width="5%">ID</th>
<th>Title</th>
<th>Date</th>
<th>Player</th>
<th style="width: 150px;">Options</th>
</tr>
</thead>
<tbody>
{% for news in newses[constant('NEWS')] %}
<tr>
<td>{{ news.id|raw }}</td>
<td><i><a href="?p=news&action=edit&id={{ news.id }}">{{ news.title }}</a></i></td>
<td>{{ news.date|date(config.news_date_format) }}</td>
<td><a target="_blank" rel="noopener noreferrer" href="{{ news.player_link }}">{{ news.player_name }}</a></td>
<td>
<div class="btn-group">
<a href="?p=news&action=edit&id={{ news.id }}" class="btn btn-success btn-sm" title="Edit">
<i class="fas fa-pencil-alt"></i>
</a>
<a href="?p=news&action=delete&id={{ news.id }}" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?');" title="Delete">
<i class="fas fa-trash"></i>
</a>
<a href="?p=news&action=hide&id={{ news.id }}" class="btn btn-{{ (news.hidden != 1) ? 'info' : 'default' }} btn-sm" title="{% if news.hidden != 1 %}Hide{% else %}Show{% endif %}">
<i class="fas fa-eye{{ (news.hidden != 1) ? '' : '-slash' }}"></i>
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title">Tickers:</h3>
<div class="box-tools pull-right">
<a href="?p=news&action=new&type=2"><span class="btn btn-success">New</span></a>
</div>
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Tickers:
<a href="?p=news&action=new&type=2" class="float-right"><span class="btn btn-sm btn-success">New</span></a>
</h5>
</div>
<div class="box-body">
<div class="row">
<div class="col-sm-12">
<table class="tb_datatable">
<thead>
<tr>
<th width="5%">ID</th>
<th>Title</th>
<th>Date</th>
<th>Player</th>
<th style="width: 150px;">Options</th>
</tr>
</thead>
<tbody>
{% for ticker in newses[constant('TICKER')] %}
<tr>
<td>{{ ticker.id|raw }}</td>
<td><i><a href="?p=news&action=edit&id={{ ticker.id }}">{{ ticker.title }}</a></i></td>
<td>{{ ticker.date|date(config.news_date_format) }}</td>
<td><a target="_blank" rel="noopener noreferrer" href="{{ ticker.player_link }}">{{ ticker.player_name }}</a></td>
<td>
<a href="?p=news&action=edit&id={{ ticker.id }}" class="ico" title="Edit">
<span class="btn btn-success btn-sm edit btn-flat">
<i class="fa fa-edit"></i>
</span>
</a>
<a href="?p=news&action=delete&id={{ ticker.id }}" class="ico" onclick="return confirm('Are you sure?');" title="Delete">
<span class="btn btn-danger btn-sm delete btn-flat">
<i class="fa fa-trash"></i>
</span>
</a>
<a href="?p=news&action=hide&id={{ ticker.id }}" class="ico" title="{% if news.hidden != 1 %}Hide{% else %}Show{% endif %}">
{% if ticker.hidden != 1 %}
<span class="btn btn-primary btn-sm btn-flat">
<i class="fa fa-eye"></i>
</span>
{% else %}
<span class="btn btn-default btn-sm btn-flat">
<i class="fa fa-eye-slash"></i>
</span>
{% endif %}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="card-body">
<table class="tb_datatable table table-striped table-bordered">
<thead>
<tr>
<th width="5%">ID</th>
<th>Title</th>
<th>Date</th>
<th>Player</th>
<th style="width: 150px;">Options</th>
</tr>
</thead>
<tbody>
{% for ticker in newses[constant('TICKER')] %}
<tr>
<td>{{ ticker.id|raw }}</td>
<td><i><a href="?p=news&action=edit&id={{ ticker.id }}">{{ ticker.title }}</a></i></td>
<td>{{ ticker.date|date(config.news_date_format) }}</td>
<td><a target="_blank" rel="noopener noreferrer" href="{{ ticker.player_link }}">{{ ticker.player_name }}</a></td>
<td>
<div class="btn-group">
<a href="?p=news&action=edit&id={{ ticker.id }}" class="btn btn-success btn-sm" title="Edit">
<i class="fas fa-pencil-alt"></i>
</a>
<a href="?p=news&action=delete&id={{ ticker.id }}" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?');" title="Delete">
<i class="fas fa-trash"></i>
</a>
<a href="?p=news&action=hide&id={{ ticker.id }}" class="btn btn-{{ (ticker.hidden != 1) ? 'info' : 'default' }} btn-sm" title="{% if ticker.hidden != 1 %}Hide{% else %}Show{% endif %}">
<i class="fas fa-eye{{ (ticker.hidden != 1) ? '' : '-slash' }}"></i>
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="box">
<div class="box-header">
<h3 class="box-title">Articles:</h3>
<div class="box-tools pull-right">
<a href="?p=news&action=new&type=3"><span class="btn btn-success">New</span></a>
</div>
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Articles: <a href="?p=news&action=new&type=3" class="float-right"><span class="btn btn-sm btn-success">New</span></a>
</h5>
</div>
<div class="box-body">
<div class="row">
<div class="col-sm-12">
<table class="tb_datatable">
<thead>
<tr>
<th width="5%">ID</th>
<th>Title</th>
<th>Date</th>
<th>Player</th>
<th style="width: 150px;">Options</th>
</tr>
</thead>
<tbody>
{% for article in newses[constant('ARTICLE')] %}
<tr>
<td>{{ article.id|raw }}</td>
<td><i><a href="?p=news&action=edit&id={{ article.id }}">{{ article.title }}</a></i></td>
<td>{{ article.date|date(config.news_date_format) }}</td>
<td><a target="_blank" rel="noopener noreferrer" href="{{ article.player_link }}">{{ article.player_name }}</a></td>
<td>
<a href="?p=news&action=edit&id={{ article.id }}" class="ico" title="Edit">
<span class="btn btn-success btn-sm edit btn-flat">
<i class="fa fa-edit"></i>
</span>
</a>
<a href="?p=news&action=delete&id={{ article.id }}" class="ico" onclick="return confirm('Are you sure?');" title="Delete">
<span class="btn btn-danger btn-sm delete btn-flat">
<i class="fa fa-trash"></i>
</span>
</a>
<a href="?p=news&action=hide&id={{ article.id }}" class="ico" title="{% if news.hidden != 1 %}Hide{% else %}Show{% endif %}">
{% if article.hidden != 1 %}
<span class="btn btn-primary btn-sm btn-flat">
<i class="fa fa-eye"></i>
</span>
{% else %}
<span class="btn btn-default btn-sm btn-flat">
<i class="fa fa-eye-slash"></i>
</span>
{% endif %}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="card-body">
<table class="tb_datatable table table-striped table-bordered">
<thead>
<tr>
<th width="5%">ID</th>
<th>Title</th>
<th>Date</th>
<th>Player</th>
<th style="width: 150px;">Options</th>
</tr>
</thead>
<tbody>
{% for article in newses[constant('ARTICLE')] %}
<tr>
<td>{{ article.id|raw }}</td>
<td><i><a href="?p=news&action=edit&id={{ article.id }}">{{ article.title }}</a></i></td>
<td>{{ article.date|date(config.news_date_format) }}</td>
<td><a target="_blank" rel="noopener noreferrer" href="{{ article.player_link }}">{{ article.player_name }}</a></td>
<td>
<div class="btn-group">
<a href="?p=news&action=edit&id={{ article.id }}" class="btn btn-success btn-sm" title="Edit">
<i class="fas fa-pencil-alt"></i>
</a>
<a href="?p=news&action=delete&id={{ article.id }}" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?');" title="Delete">
<i class="fas fa-trash"></i>
</a>
<a href="?p=news&action=hide&id={{ article.id }}" class="btn btn-{{ (article.hidden != 1) ? 'info' : 'default' }} btn-sm" title="{% if article.hidden != 1 %}Hide{% else %}Show{% endif %}">
<i class="fas fa-eye{{ (article.hidden != 1) ? '' : '-slash' }}"></i>
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<script>
$(function () {
$('.tb_datatable').DataTable({
"order": [[ 0, "desc" ]]
});
$('.tb_datatable').DataTable({
"order": [[0, "desc"]]
});
});
</script>
</script>

View File

@@ -1,24 +1,19 @@
<div class="row">
<div class="col-md-6">
<div class="box box-danger">
<div class="box-header with-border">
<h3 class="box-title">Notepad</h3>
</div>
<form method="post">
<div class="box-body">
<div class="form-group">
<label>This is your personal notepad. Be sure to save it each time you modify something.</label>
<textarea class="form-control" style="text-align: left;" name="content" cols="50" rows="15"
onchange="notepad_onchange(this);">{% if content is not null %}{{ content }}{% endif %}</textarea>
</div>
</div>
<div class="box-footer">
<button name="submit" onclick="notepad_save(this);" value="Save" class="btn btn-primary">Save
</button>
</div>
</form>
</div>
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Notepad</h5>
</div>
<form method="post">
<div class="card-body">
<div class="form-group">
<label>This is your personal notepad. Be sure to save it each time you modify something.</label>
<textarea class="form-control" name="content" cols="50" rows="15"
onchange="notepad_onchange(this);">{% if content is not null %}{{ content }}{% endif %}</textarea>
</div>
</div>
<div class="card-footer">
<button name="submit" onclick="notepad_save(this);" value="Save" class="btn btn-info">Save</button>
</div>
</form>
</div>
{# <?php echo isset($_content) ? htmlentities($_content, ENT_COMPAT, 'UTF-8') : ''; ?> #}
@@ -53,4 +48,4 @@
};
return true;
}
</script>
</script>

View File

@@ -1,83 +1,65 @@
{% if action %}
<div class="row">
{% if (action == 'edit' or action == 'new') %}
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">{% if action == 'edit' %}Edit{% else %}Add{% endif %} page</h5>
</div>
<form class="form-horizontal" method="post"
action="?p=pages&action={% if action == 'edit' %}edit{% else %}add{% endif %}">
{% if action == 'edit' %}
<input type="hidden" name="id" value="{{ id }}"/>
{% endif %}
<div class="col-md-8" id="page-edit-table">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">{% if action == 'edit' %}Edit{% else %}Add{% endif %} page</h3>
</div>
<div class="box-body">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Link/name</label>
<div class="col-sm-10">
<input type="text" id="name" name="name" class="form-control" autocomplete="off"
maxlength="29"
style="cursor: auto;" value="{{ name }}">
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label">Title</label>
<div class="col-sm-10">
<input type="text" id="title" name="title" class="form-control" autocomplete="off"
maxlength="29"
style="cursor: auto;" value="{{ title }}">
</div>
</div>
<div class="form-group">
<label for="php" class="col-sm-2 control-label">PHP</label>
<div class="col-sm-10">
<input type="checkbox" id="php" name="php"
title="Check if page should be executed as PHP"
value="1"{% if php %} checked{% endif %}{% if action == 'edit' %} disabled{% endif %}/>
{% if action == 'edit' %}
<input type="hidden" name="php" value="{% if php %}1{% else %}0{% endif %}"/>
{% endif %}
</div>
</div>
{% if not php %}
<div class="form-group">
<label for="enable_tinymce" class="col-sm-2 control-label">Enable TinyMCE</label>
<div class="col-sm-10">
<input type="checkbox" id="enable_tinymce" name="enable_tinymce"
title="Check if you want to use TinyMCE Editor"
value="1"{% if enable_tinymce %} checked{% endif %}{% if action == 'edit' %} disabled{% endif %}/>
{% if action == 'edit' %}
<input type="hidden" name="enable_tinymce" value="{% if enable_tinymce %}1{% else %}0{% endif %}"/>
{% endif %}
</div>
</div>
{% endif %}
<div class="form-group">
<label for="body" class="col-sm-2 control-label">Content</label>
<div class="col-sm-10" id="body-parent">
<textarea class="form-control" id="body" name="body" maxlength="65000" cols="50"
rows="5">{{ body|raw }}</textarea>
</div>
</div>
<div class="form-group">
<label for="access" class="col-sm-2 control-label">Access</label>
<div class="col-sm-10">
<select class="form-control" id="access" name="access">
{% for id, group in groups %}
<option value="{{ group.getId() }}"{% if access == group.getId() %} selected{% endif %}>{{ group.getName() }}</option>
{% endfor %}
</select>
</div>
</div>
</div>
<div class="box-footer">
<td align="right"><input type="submit" class="btn btn-info pull-right" value="Save"/></td>
<td align="left">
<input type="button" onclick="window.location = '{{ constant('ADMIN_URL') }}?p=pages';"
class="btn btn-default" value="Cancel"/>
</td>
</div>
<div class="card-body">
<div class="form-group row">
<label for="title">Page Title</label>
<input type="text" id="title" name="title" class="form-control" autocomplete="off"
maxlength="29"
style="cursor: auto;" value="{{ title }}">
</div>
<div class="form-group row">
<label for="name">Link/name</label>
<input type="text" id="name" name="name" class="form-control" autocomplete="off"
maxlength="29"
style="cursor: auto;" value="{{ name }}">
</div>
<div class="form-group row">
<label for="access">Access</label>
<select class="form-control" id="access" name="access">
{% for id, group in groups %}
<option value="{{ group.getId() }}"{% if access == group.getId() %} selected{% endif %}>{{ group.getName() }}</option>
{% endfor %}
</select>
</div>
<div class="form-group row">
<label for="php">PHP
<input type="checkbox" id="php" name="php"
title="Check if page should be executed as PHP"
value="1"{% if php %} checked{% endif %}{% if action == 'edit' %} disabled{% endif %}/>
{% if action == 'edit' %}
<input type="hidden" name="php" value="{% if php %}1{% else %}0{% endif %}"/>
{% endif %}</label>
</div>
{% if not php %}
<div class="form-group row">
<label for="enable_tinymce">Enable TinyMCE
<input type="checkbox" id="enable_tinymce" name="enable_tinymce"
title="Check if you want to use TinyMCE Editor"
value="1"{% if enable_tinymce %} checked{% endif %}{% if action == 'edit' %} disabled{% endif %}/>
{% if action == 'edit' %}
<input type="hidden" name="enable_tinymce" value="{% if enable_tinymce %}1{% else %}0{% endif %}"/>
{% endif %}
</label>
</div>
{% endif %}
<div class="form-group row">
<label for="body">Content</label>
<textarea class="form-control" id="body" name="body" maxlength="65000" cols="50"
rows="10">{{ body|raw }}</textarea>
</div>
</div>
<div class="card-footer">
<button type="submit" class="btn btn-info"><i class="fas fa-update"></i> Update</button>
<button type="button" onclick="window.location = '{{ constant('ADMIN_URL') }}?p=pages';" class="btn btn-danger float-right"><i class="fas fa-cancel"></i> Cancel</button>
</div>
</form>
</div>
@@ -91,8 +73,7 @@
} else {
if (tinymce.editors.length > 0) {
tinymce.activeEditor.show();
}
else {
} else {
init_tinymce();
}
}

View File

@@ -1,53 +1,41 @@
<div class="box">
<div class="box-header">
<h3 class="box-title">Pages:</h3>
<div class="box-tools pull-right">
<a href="?p=pages&action=new"><span class="btn btn-success">New</span></a>
</div>
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Pages
<a href="?p=pages&action=new" class="float-right"><span class="btn btn-sm btn-success">New</span></a></h5>
</div>
<div class="box-body">
<div class="row">
<div class="col-sm-12">
<table id="tb_pages">
<thead>
<tr>
<th>Name</th>
<th>Title</th>
<th>PHP</th>
<th style="width: 150px;">Options</th>
</tr>
</thead>
<tbody>
{% for page in pages %}
<tr>
<td>{{ page.link|raw }}</td>
<td><i>{{ page.title }}</i></td>
<td>{% if page.php %}Yes{% else %}No{% endif %}</td>
<td>
<a href="?p=pages&action=edit&id={{ page.id }}" class="ico" title="Edit"><span
class="btn btn-success btn-sm edit btn-flat"><i
class="fa fa-edit"></i></span></a>
<a href="?p=pages&action=delete&id={{ page.id }}" class="ico"
onclick="return confirm('Are you sure?');" title="Delete"><span
class="btn btn-danger btn-sm delete btn-flat"><i
class="fa fa-trash"></i></span></a>
<a href="?p=pages&action=hide&id={{ page.id }}" class="ico"
title="{% if page.hidden != 1 %}Hide{% else %}Show{% endif %}">
{% if page.hidden != 1 %}
<span class="btn btn-primary btn-sm btn-flat"><i
class="fa fa-eye"></i></span>
{% else %}
<span class="btn btn-default btn-sm btn-flat"><i
class="fa fa-eye-slash"></i></span>
{% endif %}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="card-body">
<table class="table table-striped table-bordered" id="tb_pages">
<thead>
<tr>
<th>Name</th>
<th>Title</th>
<th>PHP</th>
<th style="width: 150px;">Options</th>
</tr>
</thead>
<tbody>
{% for page in pages %}
<tr>
<td>{{ page.link|raw }}</td>
<td><i>{{ page.title }}</i></td>
<td>{% if page.php %}Yes{% else %}No{% endif %}</td>
<td>
<div class="btn-group">
<a href="?p=pages&action=edit&id={{ page.id }}" class="btn btn-success btn-sm" title="Edit">
<i class="fas fa-pencil-alt"></i>
</a>
<a href="?p=pages&action=delete&id={{ page.id }}" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?');" title="Delete">
<i class="fas fa-trash"></i>
</a>
<a href="?p=pages&action=hide&id={{ page.id }}" class="btn btn-{{ (page.hidden != 1) ? 'info' : 'default' }} btn-sm" title="{% if page.hidden != 1 %}Hide{% else %}Show{% endif %}">
<i class="fas fa-eye{{ (page.hidden != 1) ? '' : '-slash' }}"></i>
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<script>

View File

@@ -1,27 +1,20 @@
<div class="row">
<div class="col-md-3">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Install plugin:</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 class="collapse" id="install_plugin">
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Install plugin</h5>
</div>
<form enctype="multipart/form-data" method="post" action="{{ constant('ADMIN_URL') }}?p=plugins">
<div class="card-body">
<input type="hidden" name="upload_plugin"/>
<div class="form-group">
<label>File input</label>
<input type="file" name="plugin">
</div>
</div>
<div class="box-body">
<form enctype="multipart/form-data" method="post" action="{{ constant('ADMIN_URL') }}?p=plugins">
<input type="hidden" name="upload_plugin"/>
<div class="box-body">
<div class="form-group">
<label for="exampleInputFile">File input</label>
<input type="file" name="plugin">
</div>
</div>
<div class="box-footer">
<button type="submit" class="btn btn-primary">Upload</button>
</div>
</form>
<div class="card-footer">
<button type="submit" class="btn btn-info">Upload</button>
</div>
</div>
</form>
</div>
</div>
</div>

View File

@@ -1,50 +1,42 @@
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">Installed plugins:</h3>
</div>
<div class="box-body">
<div class="row">
<div class="col-sm-12">
<table id="tb_plugins">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Author</th>
<th>Filename</th>
<th style="width: 55px;">Options</th>
</tr>
</thead>
<tbody>
{% for plugin in plugins %}
<tr>
<td><b>{{ plugin.name }}</b><br>
<small>{{ plugin.description|raw }}</small>
</td>
<td>{{ plugin.version }}</td>
<td><b>{{ plugin.author }}</b><br>
<small>{{ plugin.contact }}</small>
</td>
<td>{{ plugin.file }}.json</td>
<td>
{% if plugin.uninstall %}
<a href="?p=plugins&uninstall={{ plugin.file }}" title="Uninstall"
onclick="return confirm('Are you sure?');"><span
class="btn btn-danger btn-sm delete btn-flat"><i
class="fa fa-trash"></i></span></a>
{% endif %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Installed plugins<span class="float-right"><a class="" data-toggle="collapse" href="#install_plugin">Install Plugin</a></span></h5>
</div>
<div class="card-body">
<table class="table table-striped table-bordered" id="tb_plugins">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Author</th>
<th>Filename</th>
<th style="width: 55px;">Options</th>
</tr>
</thead>
<tbody>
{% for plugin in plugins %}
<tr>
<td><b>{{ plugin.name }}</b><br>
<small>{{ plugin.description|raw }}</small>
</td>
<td>{{ plugin.version }}</td>
<td><b>{{ plugin.author }}</b><br>
<small>{{ plugin.contact }}</small>
</td>
<td>{{ plugin.file }}.json</td>
<td>
{% if plugin.uninstall %}
<a href="?p=plugins&uninstall={{ plugin.file }}" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?');" title="Uninstall">
<i class="fas fa-trash"></i>
</a>
{% endif %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<script>
$(function () {
$('#tb_plugins').DataTable()

View File

@@ -1,41 +1,30 @@
<div class="box">
<div class="box-header">
<h3 class="box-title">Reports:</h3>
</div>
<div class="box-body">
<div class="row">
<div class="col-sm-12">
<table id="tb_reports">
<thead>
<tr>
<th>Report name</th>
<th>Last updated</th>
</tr>
</thead>
<tbody>
{% for file in files %}
<tr>
<td>
<a href="{{ constant('ADMIN_URL') }}?p=reports&file={{ file.name }}">{{ file.name }}</a>
</td>
<td>{{ file.mtime|date('Y-m-d H:i:s') }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th>Report name</th>
<th>Last updated</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Reports</h5>
</div>
<div class="card-body">
<table class="table table-striped table-bordered" id="tb_reports">
<thead>
<tr>
<th>Report name</th>
<th>Last updated</th>
</tr>
</thead>
<tbody>
{% for file in files %}
<tr>
<td>
<a href="{{ constant('ADMIN_URL') }}?p=reports&file={{ file.name }}">{{ file.name }}</a>
</td>
<td>{{ file.mtime|date('Y-m-d H:i:s') }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<script>
$(document).ready(function () {
$('#tb_reports').DataTable();
});
</script>
$(document).ready(function () {
$('#tb_reports').DataTable();
});
</script>

View File

@@ -1,39 +1,38 @@
<div class="row">
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="col-12 col-sm-6 col-md-3">
<div class="info-box">
<span class="info-box-icon bg-aqua"><i class="ion ion-person-add"></i></span>
<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">Total accounts:</span>
<span class="info-box-number">{{ total_accounts }}</span>
<span class="info-box-number">{{ count.total_accounts }}</span>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="col-12 col-sm-6 col-md-3">
<div class="info-box">
<span class="info-box-icon bg-red"><i class="fa fa-male"></i></span>
<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">Total players:</span>
<span class="info-box-number">{{ total_players }}</span>
<span class="info-box-number">{{ count.total_players }}</span>
</div>
</div>
</div>
<div class="clearfix visible-sm-block"></div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="col-12 col-sm-6 col-md-3">
<div class="info-box">
<span class="info-box-icon bg-green"><i class="ion ion-pie-graph"></i></span>
<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">Total guilds:</span>
<span class="info-box-number">{{ total_guilds }}</span>
<span class="info-box-number">{{ count.total_guilds }}</span>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="col-12 col-sm-6 col-md-3">
<div class="info-box">
<span class="info-box-icon bg-yellow"><i class="fa fa-home"></i></span>
<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">Total houses:</span>
<span class="info-box-number">{{ total_houses }}</span>
<span class="info-box-number">{{ count.total_houses }}</span>
</div>
</div>
</div>
</div>
</div>

View File

@@ -1,38 +1,30 @@
<div class="box">
<div class="box-header">
<h3 class="box-title">Users active within last {{ config_visitors_counter_ttl }} minutes.</h3>
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">Users active within last {{ config_visitors_counter_ttl }} minutes.</h5>
</div>
<div class="box-body">
<div class="row">
<div class="col-sm-12">
<table id="tb_visitors">
<thead>
<tr>
<th>IP</th>
<th>Last visit</th>
<th>Page</th>
</tr>
</thead>
<tbody>
{% set i = 0 %}
{% for visitor in visitors %}
{% set i = i + 1 %}
<tr role="row" class="odd">
<td>{{ visitor.ip }}</td>
<td>{{ visitor.lastvisit|date("H:i:s") }}</td>
<td>
<a href="{{ visitor.page }}">{{ visitor.page|slice(0, 50) }}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="card-body">
<table id="tb_visitors" class="table table-striped table-bordered">
<thead>
<tr>
<th>IP</th>
<th>Last visit</th>
<th>Page</th>
</tr>
</thead>
<tbody>
{% for visitor in visitors %}
<tr>
<td>{{ visitor.ip }}</td>
<td>{{ visitor.lastvisit|date("H:i:s") }}</td>
<td><a href="{{ visitor.page }}">{{ visitor.page|slice(0, 50) }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<script>
$(function () {
$('#tb_visitors').DataTable()
})
</script>
</script>