Merge branch 'develop' into feature/debug-bar

This commit is contained in:
slawkens
2023-11-11 11:11:13 +01:00
152 changed files with 1287 additions and 808 deletions

19
system/bin/cronjob.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
require_once __DIR__ . '/../../common.php';
require_once SYSTEM . 'functions.php';
require_once SYSTEM . 'init.php';
require_once SYSTEM . 'hooks.php';
$hooks = new Hooks();
$hooks->load();
use GO\Scheduler;
// Create a new scheduler
$scheduler = new Scheduler();
$hooks->trigger(HOOK_CRONJOB, ['scheduler' => $scheduler]);
// Let the scheduler execute jobs which are due.
$scheduler->run();

View File

@@ -0,0 +1,50 @@
<?php
require_once __DIR__ . '/../../common.php';
require_once SYSTEM . 'functions.php';
require_once SYSTEM . 'init.php';
if(!IS_CLI) {
echo 'This script can be run only in command line mode.' . PHP_EOL;
exit(1);
}
if (MYAAC_OS !== 'LINUX') {
echo 'This script can be run only on linux.' . PHP_EOL;
exit(1);
}
$job = '* * * * * /usr/bin/php ' . SYSTEM . 'bin/cronjob.php >> ' . SYSTEM . 'logs/cron.log 2>&1';
if (cronjob_exists($job)) {
echo 'MyAAC cronjob already installed.' . PHP_EOL;
exit(0);
}
exec ('crontab -l', $content);
$content = implode(' ', $content);
$content .= PHP_EOL . $job;
file_put_contents(CACHE . 'cronjob', $content . PHP_EOL);
exec('crontab ' . CACHE. 'cronjob');
echo 'Installed crontab successfully.' . PHP_EOL;
function cronjob_exists($command)
{
$cronjob_exists=false;
exec('crontab -l', $crontab);
if(isset($crontab)&&is_array($crontab)) {
$crontab = array_flip($crontab);
if(isset($crontab[$command])){
$cronjob_exists = true;
}
}
return $cronjob_exists;
}

View File

@@ -99,4 +99,10 @@ $config['clients'] = [
1291,
1300,
1310,
1311,
1312,
1316,
1320,
1321,
];

View File

@@ -68,10 +68,12 @@ $deprecatedConfig = [
'status_ip',
'status_port',
'mail_enabled',
'mail_address',
'account_login_by_email',
'account_login_by_email_fallback',
'account_mail_verify',
'account_mail_unique',
'account_mail_change',
'account_premium_days',
'account_premium_points',
'account_create_character_create',

View File

@@ -9,6 +9,7 @@
*/
defined('MYAAC') or die('Direct access not allowed!');
use MyAAC\CsrfToken;
use MyAAC\Models\Config;
use MyAAC\Models\Guild;
use MyAAC\Models\House;
@@ -43,7 +44,10 @@ function warning($message, $return = false) {
return message($message, 'warning', $return);
}
function note($message, $return = false) {
return message($message, 'note', $return);
return info($message, $return);
}
function info($message, $return = false) {
return message($message, 'info', $return);
}
function error($message, $return = false) {
return message($message, ((defined('MYAAC_INSTALL') || defined('MYAAC_ADMIN')) ? 'danger' : 'error'), $return);
@@ -151,8 +155,7 @@ function getItemImage($id, $count = 1)
if($count > 1)
$file_name .= '-' . $count;
global $config;
return '<img src="' . $config['item_images_url'] . $file_name . config('item_images_extension') . '"' . $tooltip . ' width="32" height="32" border="0" alt="' .$id . '" />';
return '<img src="' . setting('core.item_images_url') . $file_name . setting('core.item_images_extension') . '"' . $tooltip . ' width="32" height="32" border="0" alt="' .$id . '" />';
}
function getItemRarity($chance) {
@@ -500,8 +503,8 @@ function template_place_holder($type): string
*/
function template_header($is_admin = false): string
{
global $title_full, $config, $twig;
$charset = $config['charset'] ?? 'utf-8';
global $title_full, $twig;
$charset = setting('core.charset') ?? 'utf-8';
return $twig->render('templates.header.html.twig',
[
@@ -866,9 +869,6 @@ function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
else
$tmp_body = $body . '<br/><br/>' . $signature_html;
define('MAIL_MAIL', 0);
define('MAIL_SMTP', 1);
$mailOption = setting('core.mail_option');
if($mailOption == MAIL_SMTP)
{
@@ -879,10 +879,6 @@ function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
$mailer->Username = setting('core.smtp_user');
$mailer->Password = setting('core.smtp_pass');
define('SMTP_SECURITY_NONE', 0);
define('SMTP_SECURITY_SSL', 1);
define('SMTP_SECURITY_TLS', 2);
$security = setting('core.smtp_security');
$tmp = '';
@@ -1046,14 +1042,36 @@ function get_browser_real_ip() {
return '0';
}
function setSession($key, $data) {
$_SESSION[config('session_prefix') . $key] = $data;
$_SESSION[setting('core.session_prefix') . $key] = $data;
}
function getSession($key) {
$key = config('session_prefix') . $key;
$key = setting('core.session_prefix') . $key;
return isset($_SESSION[$key]) ? $_SESSION[$key] : false;
}
function unsetSession($key) {
unset($_SESSION[config('session_prefix') . $key]);
unset($_SESSION[setting('core.session_prefix') . $key]);
}
function csrf(): void {
CsrfToken::create();
}
function csrfToken(): string {
return CsrfToken::get();
}
function isValidToken(): bool {
$token = $_POST['csrf_token'] ?? $_SERVER['HTTP_X_CSRF_TOKEN'] ?? null;
return ($_SERVER['REQUEST_METHOD'] !== 'POST' || (isset($token) && CsrfToken::isValid($token)));
}
function csrfProtect(): void
{
if (!isValidToken()) {
$lastUri = BASE_URL . str_replace_first('/', '', getSession('last_uri'));
echo 'Request has been cancelled due to security reasons - token is invalid. Go <a href="' . $lastUri . '">back</a>';
exit();
}
}
function getTopPlayers($limit = 5) {
@@ -1208,15 +1226,37 @@ function clearCache()
if ($cache->fetch('failed_logins', $tmp))
$cache->delete('failed_logins');
global $template_name;
if ($cache->fetch('template_ini' . $template_name, $tmp))
$cache->delete('template_ini' . $template_name);
foreach (get_templates() as $template) {
if ($cache->fetch('template_ini_' . $template, $tmp)) {
$cache->delete('template_ini_' . $template);
}
}
if ($cache->fetch('plugins_hooks', $tmp))
if ($cache->fetch('template_menus', $tmp)) {
$cache->delete('template_menus');
}
if ($cache->fetch('database_tables', $tmp)) {
$cache->delete('database_tables');
}
if ($cache->fetch('database_columns', $tmp)) {
$cache->delete('database_columns');
}
if ($cache->fetch('database_checksum', $tmp)) {
$cache->delete('database_checksum');
}
if ($cache->fetch('last_kills', $tmp)) {
$cache->delete('last_kills');
}
if ($cache->fetch('hooks', $tmp)) {
$cache->delete('hooks');
}
if ($cache->fetch('plugins_hooks', $tmp)) {
$cache->delete('plugins_hooks');
if ($cache->fetch('plugins_routes', $tmp))
}
if ($cache->fetch('plugins_routes', $tmp)) {
$cache->delete('plugins_routes');
}
}
deleteDirectory(CACHE . 'signatures', ['index.html'], true);
@@ -1280,7 +1320,7 @@ function getCustomPage($name, &$success): string
set_error_handler('error_handler');
global $config;
if($config['backward_support']) {
if(setting('core.backward_support')) {
global $SQL, $main_content, $subtopic;
}
@@ -1462,7 +1502,7 @@ function echo_success($message)
function echo_error($message)
{
global $error;
echo '<div class="col-12 alert alert-error mb-2">' . $message . '</div>';
echo '<div class="col-12 alert alert-danger mb-2">' . $message . '</div>';
$error = true;
}
@@ -1537,8 +1577,8 @@ function right($str, $length) {
}
function getCreatureImgPath($creature){
$creature_path = config('monsters_images_url');
$creature_gfx_name = trim(strtolower($creature)) . config('monsters_images_extension');
$creature_path = setting('core.monsters_images_url');
$creature_gfx_name = trim(strtolower($creature)) . setting('core.monsters_images_extension');
if (!file_exists($creature_path . $creature_gfx_name)) {
$creature_gfx_name = str_replace(" ", "", $creature_gfx_name);
if (file_exists($creature_path . $creature_gfx_name)) {
@@ -1617,7 +1657,7 @@ function getGuildLogoById($id)
$guild = Guild::where('id', intval($id))->select('logo_name')->first();
if ($guild) {
$guildLogo = $query->logo_name;
$guildLogo = $guild->logo_name;
if (!empty($guildLogo) && file_exists(GUILD_IMAGES_DIR . $guildLogo)) {
$logo = $guildLogo;

View File

@@ -68,12 +68,15 @@ define('HOOK_ADMIN_LOGIN_AFTER_ACCOUNT', ++$i);
define('HOOK_ADMIN_LOGIN_AFTER_PASSWORD', ++$i);
define('HOOK_ADMIN_LOGIN_AFTER_SIGN_IN', ++$i);
define('HOOK_ADMIN_ACCOUNTS_SAVE_POST', ++$i);
define('HOOK_ADMIN_SETTINGS_BEFORE_SAVE', ++$i);
define('HOOK_CRONJOB', ++$i);
define('HOOK_EMAIL_CONFIRMED', ++$i);
define('HOOK_GUILDS_BEFORE_GUILD_HEADER', ++$i);
define('HOOK_GUILDS_AFTER_GUILD_HEADER', ++$i);
define('HOOK_GUILDS_AFTER_GUILD_INFORMATION', ++$i);
define('HOOK_GUILDS_AFTER_GUILD_MEMBERS', ++$i);
define('HOOK_GUILDS_AFTER_INVITED_CHARACTERS', ++$i);
define('HOOK_TWIG', ++$i);
const HOOK_FIRST = HOOK_STARTUP;
define('HOOK_LAST', $i);

View File

@@ -7,6 +7,9 @@
* @copyright 2019 MyAAC
* @link https://my-aac.org
*/
use MyAAC\CsrfToken;
defined('MYAAC') or die('Direct access not allowed!');
if(!isset($config['installed']) || !$config['installed']) {
@@ -39,6 +42,11 @@ if(isset($config['gzip_output']) && $config['gzip_output'] && isset($_SERVER['HT
require_once SYSTEM . 'libs/cache.php';
$cache = Cache::getInstance();
// event system
require_once SYSTEM . 'hooks.php';
$hooks = new Hooks();
$hooks->load();
// twig
require_once SYSTEM . 'twig.php';
@@ -138,12 +146,23 @@ require_once LIBS . 'Settings.php';
$settings = Settings::getInstance();
$settings->load();
// csrf protection
$token = getSession('csrf_token');
if (!isset($token) || !$token) {
CsrfToken::generate();
}
// deprecated config values
require_once SYSTEM . 'compat/config.php';
date_default_timezone_set(setting('core.date_timezone'));
$config['account_create_character_create'] = config('account_create_character_create') && (!setting('core.mail_enabled') || !config('account_mail_verify'));
setting(
[
'core.account_create_character_create',
setting('core.account_create_character_create') && (!setting('core.mail_enabled') || !setting('core.account_mail_verify'))
]
);
$settingsItemImagesURL = setting('core.item_images_url');
if($settingsItemImagesURL[strlen($settingsItemImagesURL) - 1] !== '/') {

View File

@@ -140,8 +140,8 @@ class CreateCharacter
if(empty($errors))
{
$number_of_players_on_account = $account->getPlayersList(true)->count();
if($number_of_players_on_account >= config('characters_per_account'))
$errors[] = 'You have too many characters on your account <b>('.$number_of_players_on_account.'/'.config('characters_per_account').')</b>!';
if($number_of_players_on_account >= setting('core.characters_per_account'))
$errors[] = 'You have too many characters on your account <b>('.$number_of_players_on_account . '/' . setting('core.characters_per_account') . ')</b>!';
}
if(empty($errors))

View File

@@ -60,6 +60,16 @@ class Settings implements ArrayAccess
}
$settings = $this->settingsFile[$pluginName];
global $hooks;
if (!$hooks->trigger(HOOK_ADMIN_SETTINGS_BEFORE_SAVE, [
'name' => $pluginName,
'values' => $values,
'settings' => $settings,
])) {
return false;
}
if (isset($settings['callbacks']['beforeSave'])) {
if (!$settings['callbacks']['beforeSave']($settings, $values)) {
return false;

View File

@@ -95,6 +95,7 @@ class Changelog
if (!$row->save()) {
$errors[] = 'Fail during toggle hidden Changelog.';
}
$status = $row->hidden;
} else {
$errors[] = 'Changelog with id ' . $id . ' does not exists.';
}

View File

@@ -10,13 +10,13 @@
*/
defined('MYAAC') or die('Direct access not allowed!');
$configForumTablePrefix = setting('core.forum_table_prefix');
if(null !== $configForumTablePrefix && !empty(trim($configForumTablePrefix))) {
if(!in_array($configForumTablePrefix, array('myaac_', 'z_'))) {
$settingForumTablePrefix = setting('core.forum_table_prefix');
if(null !== $settingForumTablePrefix && !empty(trim($settingForumTablePrefix))) {
if(!in_array($settingForumTablePrefix, array('myaac_', 'z_'))) {
throw new RuntimeException('Invalid value for forum_table_prefix in config.php. Can be only: "myaac_" or "z_".');
}
define('FORUM_TABLE_PREFIX', $configForumTablePrefix);
define('FORUM_TABLE_PREFIX', $settingForumTablePrefix);
}
else {
if($db->hasTable('z_forum')) {

View File

@@ -75,18 +75,20 @@ class News
static public function delete($id, &$errors)
{
if(isset($id))
{
if(isset($id)) {
$row = ModelsNews::find($id);
if($row)
if($row) {
if (!$row->delete()) {
$errors[] = 'Fail during delete News.';
}
else
}
else {
$errors[] = 'News with id ' . $id . ' does not exists.';
}
}
else
else {
$errors[] = 'News id not set.';
}
if(count($errors)) {
return false;

View File

@@ -152,6 +152,10 @@ class Plugins {
foreach(self::getAllPluginsJson() as $plugin) {
if (isset($plugin['hooks'])) {
foreach ($plugin['hooks'] as $_name => $info) {
if (str_contains($info['type'], 'HOOK_')) {
$info['type'] = str_replace('HOOK_', '', $info['type']);
}
if (defined('HOOK_'. $info['type'])) {
$hook = constant('HOOK_'. $info['type']);
$hooks[] = ['name' => $_name, 'type' => $hook, 'file' => $info['file']];

View File

@@ -106,8 +106,8 @@ WHERE TABLE_SCHEMA = "' . $config['database_name'] . '";');
}
$ret['templates'] = get_templates();
$ret['date_timezone'] = $config['date_timezone'];
$ret['backward_support'] = $config['backward_support'];
$ret['date_timezone'] = setting('core.date_timezone');
$ret['backward_support'] = setting('core.backward_support');
$cache_engine = strtolower($config['cache_engine']);
if($cache_engine == 'auto') {
@@ -117,4 +117,4 @@ WHERE TABLE_SCHEMA = "' . $config['database_name'] . '";');
$ret['cache_engine'] = $cache_engine;
return $ret;
}
}
}

View File

@@ -7,6 +7,9 @@
* @copyright 2019 MyAAC
* @link https://my-aac.org
*/
use MyAAC\CsrfToken;
defined('MYAAC') or die('Direct access not allowed!');
if(isset($account_logged) && $account_logged->isLoaded()) {
@@ -15,6 +18,8 @@ if(isset($account_logged) && $account_logged->isLoaded()) {
unsetSession('password');
unsetSession('remember_me');
CsrfToken::generate();
$logged = false;
unset($account_logged);

View File

@@ -14,8 +14,9 @@ CREATE TABLE `myaac_menu`
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
");
require_once LIBS . 'plugins.php';
Plugins::installMenus('kathrine', require TEMPLATES . 'kathrine/menus.php');
Plugins::installMenus('tibiacom', require TEMPLATES . 'tibiacom/menus.php');
}
require_once LIBS . 'plugins.php';
Plugins::installMenus('kathrine', require TEMPLATES . 'kathrine/menus.php');
Plugins::installMenus('tibiacom', require TEMPLATES . 'tibiacom/menus.php');

View File

@@ -43,7 +43,7 @@ if($email_new_time < 10) {
}
if(empty($errors)) {
$email_new_time = time() + $config['account_mail_change'] * 24 * 3600;
$email_new_time = time() + setting('core.account_mail_change') * 24 * 3600;
$account_logged->setCustomField("email_new", $email_new);
$account_logged->setCustomField("email_new_time", $email_new_time);
$twig->display('success.html.twig', array(
@@ -92,18 +92,22 @@ else
<tr>
<td width="30">&nbsp;</td>
<td align=left>
<form action="' . getLink('account/email') . '" method="post"><input type="hidden" name="changeemailsave" value=1 >
<form action="' . getLink('account/email') . '" method="post">
' . csrf() . '
<input type="hidden" name="changeemailsave" value=1 >
<INPUT TYPE=image NAME="I Agree" SRC="' . $template_path . '/images/global/buttons/sbutton_iagree.gif" BORDER=0 WIDTH=120 HEIGHT=17>
</form>
</td>
<td align=left>
<form action="' . getLink('account/email') . '" method="post">
' . csrf() . '
<input type="hidden" name="emailchangecancel" value=1 >
' . $twig->render('buttons.cancel.html.twig') . '
</form>
</td>
<td align=right>
<form action="?subtopic=accountmanagement" method="post" >
' . csrf() . '
' . $twig->render('buttons.back.html.twig') . '
</form>
</td>
@@ -125,6 +129,7 @@ else
<td>
<table border="0" cellspacing="0" cellpadding="0" >
<form action="' .getLink('account/email') . '" method="post" >
' . csrf() . '
<tr>
<td style="border:0px;" >
<input type="hidden" name="emailchangecancel" value="1" >
@@ -137,6 +142,7 @@ else
<td>
<table border="0" cellspacing="0" cellpadding="0" >
<form action="' . getLink('account/manage') . '" method="post" >
' . csrf() . '
<tr>
<td style="border:0px;" >
' . $twig->render('buttons.back.html.twig') . '

View File

@@ -20,7 +20,7 @@ if(!$logged) {
return;
}
if($config['account_country'])
if(setting('core.account_country'))
require SYSTEM . 'countries.conf.php';
$account = Account::find($account_logged->getId());
@@ -55,7 +55,7 @@ if(isset($_POST['changeinfosave']) && $_POST['changeinfosave'] == 1) {
if($show_form) {
$account_rlname = $account->rlname;
$account_location = $account->location;
if ($config['account_country']) {
if (setting('core.account_country')) {
$account_country = $account->country;
$countries = array();

View File

@@ -18,18 +18,18 @@ if(!$logged) {
}
$new_password = $_POST['newpassword'] ?? NULL;
$new_password2 = $_POST['newpassword2'] ?? NULL;
$new_password_confirm = $_POST['newpassword_confirm'] ?? NULL;
$old_password = $_POST['oldpassword'] ?? NULL;
if(empty($new_password) && empty($new_password2) && empty($old_password)) {
if(empty($new_password) && empty($new_password_confirm) && empty($old_password)) {
$twig->display('account.change_password.html.twig');
}
else
{
if(empty($new_password) || empty($new_password2) || empty($old_password)){
if(empty($new_password) || empty($new_password_confirm) || empty($old_password)){
$errors[] = 'Please fill in form.';
}
$password_strlen = strlen($new_password);
if($new_password != $new_password2) {
if($new_password != $new_password_confirm) {
$errors[] = 'The new passwords do not match!';
}

View File

@@ -11,7 +11,7 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Create Account';
if($config['account_country'])
if (setting('core.account_country'))
require SYSTEM . 'countries.conf.php';
if($logged)
@@ -20,7 +20,7 @@ if($logged)
return;
}
if(config('account_create_character_create')) {
if(setting('core.account_create_character_create')) {
require_once LIBS . 'CreateCharacter.php';
$createCharacter = new CreateCharacter();
}
@@ -50,7 +50,7 @@ if($save)
$email = $_POST['email'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
$password_confirm = $_POST['password_confirm'];
// account
if(!config('account_login_by_email')) {
@@ -68,7 +68,7 @@ if($save)
// country
$country = '';
if($config['account_country'])
if (setting('core.account_country'))
{
$country = $_POST['country'];
if(!isset($country))
@@ -81,7 +81,7 @@ if($save)
if(empty($password)) {
$errors['password'] = 'Please enter the password for your new account.';
}
elseif($password != $password2) {
elseif($password != $password_confirm) {
$errors['password'] = 'Passwords are not the same.';
}
else if(!Validator::password($password)) {
@@ -93,7 +93,7 @@ if($save)
$errors['password'] = 'Password may not be the same as account name.';
}
if($config['account_mail_unique'])
if(setting('core.account_mail_unique'))
{
$test_email_account = new OTS_Account();
$test_email_account->findByEMail($email);
@@ -115,7 +115,7 @@ if($save)
}
if($account_db->isLoaded()) {
if (config('account_login_by_email') && !config('account_mail_unique')) {
if (config('account_login_by_email') && !setting('core.account_mail_unique')) {
$errors['account'] = 'Account with this email already exist.';
}
else if (!config('account_login_by_email')) {
@@ -134,7 +134,7 @@ if($save)
'email' => $email,
'country' => $country,
'password' => $password,
'password2' => $password2,
'password_confirm' => $password_confirm,
'accept_rules' => isset($_POST['accept_rules']) ? $_POST['accept_rules'] === 'true' : false,
);
@@ -150,7 +150,7 @@ if($save)
return;
}
if(config('account_create_character_create')) {
if(setting('core.account_create_character_create')) {
$character_name = isset($_POST['name']) ? stripslashes(ucwords(strtolower($_POST['name']))) : null;
$character_sex = isset($_POST['sex']) ? (int)$_POST['sex'] : null;
$character_vocation = isset($_POST['vocation']) ? (int)$_POST['vocation'] : null;
@@ -191,27 +191,28 @@ if($save)
$new_account->setCustomField('created', time());
$new_account->logAction('Account created.');
if($config['account_country']) {
if(setting('core.account_country')) {
$new_account->setCustomField('country', $country);
}
if($config['account_premium_days'] && $config['account_premium_days'] > 0) {
$settingAccountPremiumDays = setting('core.account_premium_days');
if($settingAccountPremiumDays && $settingAccountPremiumDays > 0) {
if($db->hasColumn('accounts', 'premend')) { // othire
$new_account->setCustomField('premend', time() + $config['account_premium_days'] * 86400);
$new_account->setCustomField('premend', time() + $settingAccountPremiumDays * 86400);
}
else { // rest
if ($db->hasColumn('accounts', 'premium_ends_at')) { // TFS 1.4+
$new_account->setCustomField('premium_ends_at', time() + $config['account_premium_days'] * (60 * 60 * 24));
$new_account->setCustomField('premium_ends_at', time() + $settingAccountPremiumDays * (60 * 60 * 24));
}
else {
$new_account->setCustomField('premdays', $config['account_premium_days']);
$new_account->setCustomField('premdays', $settingAccountPremiumDays);
$new_account->setCustomField('lastday', time());
}
}
}
if($config['account_premium_points']) {
$new_account->setCustomField('premium_points', $config['account_premium_points']);
if(setting('core.account_premium_points') && setting('core.account_premium_points') > 0) {
$new_account->setCustomField('premium_points', setting('core.account_premium_points'));
}
$tmp_account = $email;
@@ -219,7 +220,7 @@ if($save)
$tmp_account = (USE_ACCOUNT_NAME ? $account_name : $account_id);
}
if(setting('core.mail_enabled') && $config['account_mail_verify'])
if(setting('core.mail_enabled') && setting('core.account_mail_verify'))
{
$hash = md5(generateRandomString(16, true, true) . $email);
$new_account->setCustomField('email_hash', $hash);
@@ -238,7 +239,7 @@ if($save)
'description' => 'Your account ' . $account_type . ' is <b>' . $tmp_account . '</b><br/>You will need the account ' . $account_type . ' and your password to play on ' . configLua('serverName') . '.
Please keep your account ' . $account_type . ' and password in a safe place and
never give your account ' . $account_type . ' or password to anybody.',
'custom_buttons' => config('account_create_character_create') ? '' : null
'custom_buttons' => setting('core.account_create_character_create') ? '' : null
));
}
else
@@ -249,7 +250,7 @@ if($save)
}
else
{
if(config('account_create_character_create')) {
if(setting('core.account_create_character_create')) {
// character creation
$character_created = $createCharacter->doCreate($character_name, $character_sex, $character_vocation, $character_town, $new_account, $errors);
if (!$character_created) {
@@ -258,7 +259,7 @@ if($save)
}
}
if(config('account_create_auto_login')) {
if(setting('core.account_create_auto_login')) {
if ($hasBeenCreatedByEMail) {
$_POST['account_login'] = $email;
}
@@ -266,14 +267,14 @@ if($save)
$_POST['account_login'] = USE_ACCOUNT_NAME ? $account_name : $account_id;
}
$_POST['password_login'] = $password2;
$_POST['password_login'] = $password_confirm;
require PAGES . 'account/login.php';
header('Location: ' . getLink('account/manage'));
}
echo 'Your account';
if(config('account_create_character_create')) {
if(setting('core.account_create_character_create')) {
echo ' and character have';
}
else {
@@ -281,7 +282,7 @@ if($save)
}
echo ' been created.';
if(!config('account_create_character_create')) {
if(!setting('core.account_create_character_create')) {
echo ' Now you can login and create your first character.';
}
@@ -291,10 +292,10 @@ if($save)
'description' => 'Your account ' . $account_type . ' is <b>' . $tmp_account . '</b><br/>You will need the account ' . $account_type . ' and your password to play on ' . configLua('serverName') . '.
Please keep your account ' . $account_type . ' and password in a safe place and
never give your account ' . $account_type . ' or password to anybody.',
'custom_buttons' => config('account_create_character_create') ? '' : null
'custom_buttons' => setting('core.account_create_character_create') ? '' : null
));
if(setting('core.mail_enabled') && $config['account_welcome_mail'])
if(setting('core.mail_enabled') && setting('core.account_welcome_mail'))
{
$mailBody = $twig->render('account.welcome_mail.html.twig', array(
'account' => $tmp_account
@@ -330,7 +331,7 @@ if(setting('core.account_country_recognize')) {
if(!empty($errors))
$twig->display('error_box.html.twig', array('errors' => $errors));
if($config['account_country']) {
if (setting('core.account_country')) {
$countries = array();
foreach (array('pl', 'se', 'br', 'us', 'gb') as $c)
$countries[$c] = $config['countries'][$c];
@@ -353,7 +354,7 @@ $params = array(
'save' => $save
);
if($save && config('account_create_character_create')) {
if($save && setting('core.account_create_character_create')) {
$params = array_merge($params, array(
'name' => $character_name,
'sex' => $character_sex,

View File

@@ -77,10 +77,10 @@ if($player->isLoaded() && !$player->isDeleted())
$rows = 0;
if($config['characters']['outfit'])
$outfit = $config['outfit_images_url'] . '?id=' . $player->getLookType() . ($db->hasColumn('players', 'lookaddons') ? '&addons=' . $player->getLookAddons() : '') . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet();
$outfit = setting('core.outfit_images_url') . '?id=' . $player->getLookType() . ($db->hasColumn('players', 'lookaddons') ? '&addons=' . $player->getLookAddons() : '') . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet();
$flag = '';
if($config['account_country']) {
if(setting('core.account_country')) {
$flag = getFlagImage($account->getCountry());
}
@@ -423,7 +423,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
if($db->hasColumn('players', 'deletion'))
$deleted = 'deletion';
$query = $db->query('SELECT `name`, `level`, `vocation`' . $promotion . ' FROM `players` WHERE `name` LIKE ' . $db->quote('%' . $name . '%') . ' AND ' . $deleted . ' != 1 LIMIT ' . (int)config('characters_search_limit') . ';');
$query = $db->query('SELECT `name`, `level`, `vocation`' . $promotion . ' FROM `players` WHERE `name` LIKE ' . $db->quote('%' . $name . '%') . ' AND ' . $deleted . ' != 1 LIMIT ' . (int)setting('core.characters_search_limit') . ';');
if($query->rowCount() > 0) {
echo 'Did you mean:<ul>';
foreach($query as $player) {

View File

@@ -17,7 +17,7 @@ $title = 'Creatures';
if (empty($_REQUEST['name'])) {
// display list of monsters
$preview = config('monsters_images_preview');
$preview = setting('core.monsters_images_preview');
$creatures = Monster::where('hidden', '!=', 1)->when(!empty($_REQUEST['boss']), function ($query) {
$query->where('rewardboss', 1);
})->get()->toArray();
@@ -65,7 +65,7 @@ if (isset($creature['name'])) {
$item['name'] = getItemNameById($item['id']);
$item['rarity_chance'] = round($item['chance'] / 1000, 2);
$item['rarity'] = getItemRarity($item['chance']);
$item['tooltip'] = ucfirst($item['name']) . '<br/>Chance: ' . $item['rarity'] . (config('monsters_loot_percentage') ? ' ('. $item['rarity_chance'] .'%)' : '') . '<br/>Max count: ' . $item['count'];
$item['tooltip'] = ucfirst($item['name']) . '<br/>Chance: ' . $item['rarity'] . (setting('core.monsters_loot_percentage') ? ' ('. $item['rarity_chance'] .'%)' : '') . '<br/>Max count: ' . $item['count'];
}
$creature['loot'] = isset($loot) ? $loot : null;

View File

@@ -153,7 +153,9 @@ class FAQ
$row = ModelsFAQ::find($id);
if ($row) {
$row->hidden = ($row->hidden == 1 ? 0 : 1);
$row->save();
if (!$row->save()) {
$errors[] = 'Fail during toggle hidden FAQ.';
}
} else {
$errors[] = 'FAQ with id ' . $id . ' does not exists.';
}

View File

@@ -57,7 +57,7 @@ foreach($posts as &$post) {
}
if($config['characters']['outfit']) {
$post['outfit'] = $config['outfit_images_url'] . '?id=' . $player->getLookType() . ($lookaddons ? '&addons=' . $player->getLookAddons() : '') . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet();
$post['outfit'] = setting('core.outfit_images_url') . '?id=' . $player->getLookType() . ($lookaddons ? '&addons=' . $player->getLookAddons() : '') . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet();
}
$groupName = '';

View File

@@ -43,7 +43,7 @@ if(empty($errors)) {
$saved = false;
if($guild_leader) {
if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
$description = htmlspecialchars(stripslashes(substr(trim($_REQUEST['description']),0,$config['guild_description_chars_limit'])));
$description = htmlspecialchars(stripslashes(substr(trim($_REQUEST['description']),0, setting('core.guild_description_chars_limit'))));
$guild->setCustomField('description', $description);
$saved = true;
}

View File

@@ -42,7 +42,7 @@ if(empty($errors)) {
if($guild_leader)
{
$max_image_size_b = $config['guild_image_size_kb'] * 1024;
$max_image_size_b = setting('core.guild_image_size_kb') * 1024;
$allowed_ext = array('image/gif', 'image/jpg', 'image/pjpeg', 'image/jpeg', 'image/bmp', 'image/png', 'image/x-png');
$ext_name = array('image/gif' => 'gif', 'image/jpg' => 'jpg', 'image/jpeg' => 'jpg', 'image/pjpeg' => 'jpg', 'image/bmp' => 'bmp', 'image/png' => 'png', 'image/x-png' => 'png');
$save_file_name = str_replace(' ', '_', strtolower($guild->getName()));
@@ -62,7 +62,7 @@ if(empty($errors)) {
}
}
else {
$upload_errors[] = 'You didn\'t send file or file is too big. Limit: <b>'.$config['guild_image_size_kb'].' KB</b>.';
$upload_errors[] = 'You didn\'t send file or file is too big. Limit: <b>'.setting('core.guild_image_size_kb').' KB</b>.';
}
if(empty($upload_errors)) {

View File

@@ -46,7 +46,7 @@ if(empty($errors)) {
$saved = false;
if($guild_leader) {
if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
$motd = htmlspecialchars(stripslashes(substr($_REQUEST['motd'],0, $config['guild_motd_chars_limit'])));
$motd = htmlspecialchars(stripslashes(substr($_REQUEST['motd'],0, setting('core.guild_motd_chars_limit'))));
$guild->setCustomField('motd', $motd);
$saved = true;
}

View File

@@ -28,8 +28,8 @@ if(empty($guild_errors))
$player_rank = $player->getRank();
if(!$player_rank->isLoaded())
{
if($player->getLevel() >= $config['guild_need_level']) {
if(!$config['guild_need_premium'] || $account_logged->isPremium()) {
if($player->getLevel() >= setting('core.guild_need_level')) {
if(!setting('core.guild_need_premium') || $account_logged->isPremium()) {
$array_of_player_nig[] = $player->getName();
}
}
@@ -39,7 +39,7 @@ if(empty($guild_errors))
if(empty($todo)) {
if(count($array_of_player_nig) == 0) {
$guild_errors[] = 'On your account all characters are in guilds, have too low level to create new guild' . ($config['guild_need_premium'] ? ' or you don\' have a premium account' : '') . '.';
$guild_errors[] = 'On your account all characters are in guilds, have too low level to create new guild' . (setting('core.guild_need_premium') ? ' or you don\' have a premium account' : '') . '.';
}
}
@@ -91,10 +91,10 @@ if($todo == 'save')
}
if(empty($guild_errors)) {
if($player->getLevel() < $config['guild_need_level']) {
$guild_errors[] = 'Character <b>'.$name.'</b> has too low level. To create guild you need character with level <b>'.$config['guild_need_level'].'</b>.';
if($player->getLevel() < setting('core.guild_need_level')) {
$guild_errors[] = 'Character <b>'.$name.'</b> has too low level. To create guild you need character with level <b>' . setting('core.guild_need_level') . '</b>.';
}
if($config['guild_need_premium'] && !$account_logged->isPremium()) {
if(setting('core.guild_need_premium') && !$account_logged->isPremium()) {
$guild_errors[] = 'Character <b>'.$name.'</b> is on FREE account. To create guild you need PREMIUM account.';
}
}
@@ -112,7 +112,7 @@ if(isset($todo) && $todo == 'save')
$new_guild->setName($guild_name);
$new_guild->setOwner($player);
$new_guild->save();
$new_guild->setCustomField('description', config('guild_description_default'));
$new_guild->setCustomField('description', setting('core.guild_description_default'));
//$new_guild->setCustomField('creationdata', time());
$ranks = $new_guild->getGuildRanksList();
$ranks->orderBy('level', POT::ORDER_DESC);

View File

@@ -26,7 +26,7 @@ if(count($guilds_list) > 0)
$description = $guild->getCustomField('description');
$description_with_lines = str_replace(array("\r\n", "\n", "\r"), '<br />', $description, $count);
if ($count < $config['guild_description_lines_limit'])
if ($count < setting('core.guild_description_lines_limit'))
$description = nl2br($description);
$guildName = $guild->getName();

View File

@@ -85,7 +85,7 @@ if(empty($guild_logo) || !file_exists(GUILD_IMAGES_DIR . $guild_logo))
$description = $guild->getCustomField('description');
$description_with_lines = str_replace(array("\r\n", "\n", "\r"), '<br />', $description, $count);
if($count < $config['guild_description_lines_limit'])
if($count < setting('core.guild_description_lines_limit'))
$description = nl2br($description);
//$description = $description_with_lines;

View File

@@ -135,6 +135,7 @@ if($settingHighscoresOutfit) {
$configHighscoresPerPage = setting('core.highscores_per_page');
$limit = $configHighscoresPerPage + 1;
$highscores = [];
$needReCache = true;
$cacheKey = 'highscores_' . $skill . '_' . $vocation . '_' . $page . '_' . $configHighscoresPerPage;
@@ -158,7 +159,7 @@ $query->join('accounts', 'accounts.id', '=', 'players.account_id')
->selectRaw('accounts.country, players.id, players.name, players.account_id, players.level, players.vocation' . $outfit . $promotion)
->orderByDesc('value');
if (!isset($highscores) || empty($highscores)) {
if (empty($highscores)) {
if ($skill >= POT::SKILL_FIRST && $skill <= POT::SKILL_LAST) { // skills
if ($db->hasColumn('players', 'skill_fist')) {// tfs 1.0
$skill_ids = array(
@@ -201,17 +202,17 @@ if (!isset($highscores) || empty($highscores)) {
$list = 'experience';
}
}
$highscores = $query->get()->map(function($row) {
$tmp = $row->toArray();
$tmp['online'] = $row->online_status;
$tmp['vocation'] = $row->vocation_name;
unset($tmp['online_table']);
return $tmp;
})->toArray();
}
$highscores = $query->get()->map(function($row) {
$tmp = $row->toArray();
$tmp['online'] = $row->online_status;
$tmp['vocation'] = $row->vocation_name;
unset($tmp['online_table']);
return $tmp;
})->toArray();
if ($cache->enabled() && $needReCache) {
$cache->set($cacheKey, serialize($highscores), setting('core.highscores_cache_ttl') * 60);
}
@@ -239,7 +240,7 @@ foreach($highscores as $id => &$player)
$player['link'] = getPlayerLink($player['name'], false);
$player['flag'] = getFlagImage($player['country']);
if($settingHighscoresOutfit) {
$player['outfit'] = '<img style="position:absolute;margin-top:' . (in_array($player['looktype'], config('outfit_images_wrong_looktypes')) ? '-15px;margin-left:5px' : '-45px;margin-left:-25px') . ';" src="' . config('outfit_images_url') . '?id=' . $player['looktype'] . ($outfit_addons ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] . '" alt="" />';
$player['outfit'] = '<img style="position:absolute;margin-top:' . (in_array($player['looktype'], setting('core.outfit_images_wrong_looktypes')) ? '-15px;margin-left:5px' : '-45px;margin-left:-25px') . ';" src="' . setting('core.outfit_images_url') . '?id=' . $player['looktype'] . ($outfit_addons ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] . '" alt="" />';
}
$player['rank'] = $offset + $i;
}

View File

@@ -21,7 +21,7 @@ if($cache->enabled() && $cache->fetch('last_kills', $tmp)) {
else {
if($db->hasTable('player_killers')) // tfs 0.3
{
$players_deaths = $db->query('SELECT `player_deaths`.`id`, `player_deaths`.`date`, `player_deaths`.`level`, `players`.`name`' . ($db->hasColumn('players', 'world_id') ? ', `players`.`world_id`' : '') . ' FROM `player_deaths` LEFT JOIN `players` ON `player_deaths`.`player_id` = `players`.`id` ORDER BY `date` DESC LIMIT 0, ' . $config['last_kills_limit']);
$players_deaths = $db->query('SELECT `player_deaths`.`id`, `player_deaths`.`date`, `player_deaths`.`level`, `players`.`name`' . ($db->hasColumn('players', 'world_id') ? ', `players`.`world_id`' : '') . ' FROM `player_deaths` LEFT JOIN `players` ON `player_deaths`.`player_id` = `players`.`id` ORDER BY `date` DESC LIMIT 0, ' . setting('core.last_kills_limit'));
if(!empty($players_deaths)) {
foreach($players_deaths as $death) {
@@ -82,9 +82,9 @@ else {
}
}
} else {
//$players_deaths = $db->query("SELECT `p`.`name` AS `victim`, `player_deaths`.`killed_by` as `killed_by`, `player_deaths`.`time` as `time`, `player_deaths`.`is_player` as `is_player`, `player_deaths`.`level` as `level` FROM `player_deaths`, `players` as `d` INNER JOIN `players` as `p` ON player_deaths.player_id = p.id WHERE player_deaths.`is_player`='1' ORDER BY `time` DESC LIMIT " . $config['last_kills_limit'] . ";");
//$players_deaths = $db->query("SELECT `p`.`name` AS `victim`, `player_deaths`.`killed_by` as `killed_by`, `player_deaths`.`time` as `time`, `player_deaths`.`is_player` as `is_player`, `player_deaths`.`level` as `level` FROM `player_deaths`, `players` as `d` INNER JOIN `players` as `p` ON player_deaths.player_id = p.id WHERE player_deaths.`is_player`='1' ORDER BY `time` DESC LIMIT " . setting('core.last_kills_limit') . ";");
$players_deaths = $db->query("SELECT `p`.`name` AS `victim`, `d`.`killed_by` as `killed_by`, `d`.`time` as `time`, `d`.`level`, `d`.`is_player` FROM `player_deaths` as `d` INNER JOIN `players` as `p` ON d.player_id = p.id ORDER BY `time` DESC LIMIT " . $config['last_kills_limit'] . ";");
$players_deaths = $db->query("SELECT `p`.`name` AS `victim`, `d`.`killed_by` as `killed_by`, `d`.`time` as `time`, `d`.`level`, `d`.`is_player` FROM `player_deaths` as `d` INNER JOIN `players` as `p` ON d.player_id = p.id ORDER BY `time` DESC LIMIT " . setting('core.last_kills_limit') . ";");
if(!empty($players_deaths)) {
foreach($players_deaths as $death) {
$players_deaths_count++;
@@ -114,4 +114,4 @@ else {
$twig->display('lastkills.html.twig', array(
'lastkills' => $last_kills
));
));

View File

@@ -13,6 +13,7 @@ defined('MYAAC') or die('Direct access not allowed!');
require_once LIBS . 'forum.php';
require_once LIBS . 'news.php';
$canEdit = hasFlag(FLAG_CONTENT_NEWS) || superAdmin();
if(isset($_GET['archive']))
{
$title = 'News Archive';
@@ -57,12 +58,17 @@ if(isset($_GET['archive']))
}
}
$admin_options = '';
if($canEdit) {
$admin_options = $twig->render('admin.links.html.twig', ['page' => 'news', 'id' => $news['id'], 'hidden' => $news['hidden']]);
}
$twig->display('news.html.twig', array(
'title' => stripslashes($news['title']),
'content' => $content_,
'content' => $content_ . $admin_options,
'date' => $news['date'],
'icon' => $categories[$news['category']]['icon_id'],
'author' => $config['news_author'] ? $author : '',
'author' => setting('core.news_author') ? $author : '',
'comments' => $news['comments'] != 0 ? getForumThreadLink($news['comments']) : null,
));
}
@@ -81,7 +87,7 @@ if(isset($_GET['archive']))
foreach($news_DB as $news)
{
$newses[] = array(
'link' => getLink('news') . '/archive/' . $news['id'],
'link' => getLink('news') . '/' . $news['id'],
'icon_id' => $categories[$news['category']]['icon_id'],
'title' => stripslashes($news['title']),
'date' => $news['date']
@@ -99,7 +105,6 @@ header('X-XSS-Protection: 0');
$title = 'Latest News';
$cache = Cache::getInstance();
$canEdit = hasFlag(FLAG_CONTENT_NEWS) || superAdmin();
$news_cached = false;
if($cache->enabled())
@@ -116,7 +121,7 @@ if(!$news_cached)
);
}
$tickers_db = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'news` WHERE `type` = ' . TICKER .($canEdit ? '' : ' AND `hidden` != 1') .' ORDER BY `date` DESC LIMIT ' . $config['news_ticker_limit']);
$tickers_db = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'news` WHERE `type` = ' . TICKER .($canEdit ? '' : ' AND `hidden` != 1') .' ORDER BY `date` DESC LIMIT ' . setting('core.news_ticker_limit'));
$tickers_content = '';
if($tickers_db->rowCount() > 0)
{
@@ -167,7 +172,7 @@ else {
if(!$news_cached)
{
ob_start();
$newses = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'news') . ' WHERE type = ' . NEWS . ($canEdit ? '' : ' AND hidden != 1') . ' ORDER BY date' . ' DESC LIMIT ' . $config['news_limit']);
$newses = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'news') . ' WHERE type = ' . NEWS . ($canEdit ? '' : ' AND hidden != 1') . ' ORDER BY date' . ' DESC LIMIT ' . setting('core.news_limit'));
if($newses->rowCount() > 0)
{
foreach($newses as $news)
@@ -180,18 +185,8 @@ if(!$news_cached)
}
$admin_options = '';
if($canEdit)
{
$admin_options = '<br/><br/><a target="_blank" rel="noopener noreferrer" href="' . ADMIN_URL . '?p=news&action=edit&id=' . $news['id'] . '" title="Edit">
<img src="images/edit.png"/>Edit
</a>
<a id="delete" target="_blank" rel="noopener noreferrer" href="' . ADMIN_URL . '?p=news&action=delete&id=' . $news['id'] . '" onclick="return confirm(\'Are you sure?\');" title="Delete">
<img src="images/del.png"/>Delete
</a>
<a target="_blank" rel="noopener noreferrer" href="' . ADMIN_URL . '?p=news&action=hide&id=' . $news['id'] . '" title="' . ($news['hidden'] != 1 ? 'Hide' : 'Show') . '">
<img src="images/' . ($news['hidden'] != 1 ? 'success' : 'error') . '.png"/>
' . ($news['hidden'] != 1 ? 'Hide' : 'Show') . '
</a>';
if($canEdit) {
$admin_options = $twig->render('admin.links.html.twig', ['page' => 'news', 'id' => $news['id'], 'hidden' => $news['hidden']]);
}
$content_ = $news['body'];
@@ -211,7 +206,7 @@ if(!$news_cached)
'content' => $content_ . $admin_options,
'date' => $news['date'],
'icon' => $categories[$news['category']]['icon_id'],
'author' => $config['news_author'] ? $author : '',
'author' => setting('core.news_author') ? $author : '',
'comments' => $news['comments'] != 0 ? getForumThreadLink($news['comments']) : null,
'hidden'=> $news['hidden']
));

View File

@@ -15,7 +15,7 @@ use MyAAC\Models\ServerRecord;
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Who is online?';
if($config['account_country'])
if (setting('core.account_country'))
require SYSTEM . 'countries.conf.php';
$promotion = '';
@@ -42,7 +42,7 @@ if($db->hasColumn('players', 'skull_time')) {
$outfit_addons = false;
$outfit = '';
if($config['online_outfit']) {
if (setting('core.online_outfit')) {
$outfit = ', lookbody, lookfeet, lookhead, looklegs, looktype';
if($db->hasColumn('players', 'lookaddons')) {
$outfit .= ', lookaddons';
@@ -50,7 +50,7 @@ if($config['online_outfit']) {
}
}
if($config['online_vocations']) {
if (setting('core.online_vocations')) {
$vocs = array();
foreach($config['vocations'] as $id => $name) {
$vocs[$id] = 0;
@@ -67,7 +67,7 @@ $players = 0;
$data = '';
foreach($playersOnline as $player) {
$skull = '';
if($config['online_skulls'])
if (setting('core.online_skulls'))
{
if($player['skulltime'] > 0)
{
@@ -90,18 +90,18 @@ foreach($playersOnline as $player) {
'player' => $player,
'level' => $player['level'],
'vocation' => $config['vocations'][$player['vocation']],
'country_image' => $config['account_country'] ? getFlagImage($player['country']) : null,
'outfit' => $config['online_outfit'] ? $config['outfit_images_url'] . '?id=' . $player['looktype'] . ($outfit_addons ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] : null
'country_image' => setting('core.account_country') ? getFlagImage($player['country']) : null,
'outfit' => setting('core.online_outfit') ? setting('core.outfit_images_url') . '?id=' . $player['looktype'] . ($outfit_addons ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] : null
);
if($config['online_vocations']) {
if (setting('core.online_vocations')) {
$vocs[($player['vocation'] > $config['vocations_amount'] ? $player['vocation'] - $config['vocations_amount'] : $player['vocation'])]++;
}
}
$record = '';
if($players > 0) {
if($config['online_record']) {
if( setting('core.online_record')) {
$result = null;
$timestamp = false;
if($db->hasTable('server_record')) {

View File

@@ -71,7 +71,7 @@ $twig->display('spells.html.twig', array(
'post_vocation_id' => $vocation_id,
'post_vocation' => $vocation,
'spells' => $spells,
'item_path' => $config['item_images_url'],
'item_path' => setting('core.item_images_url'),
));
?>

View File

@@ -11,7 +11,7 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Support in game';
if($config['account_country'])
if(setting('core.account_country'))
require SYSTEM . 'countries.conf.php';
$groups = new OTS_Groups_List();

View File

@@ -170,7 +170,7 @@ if(!empty($page) && preg_match('/^[A-z0-9\-]+$/', $page)) {
$_REQUEST['subtopic'] = $_REQUEST['p'];
}
if (config('backward_support')) {
if (setting('core.backward_support')) {
require SYSTEM . 'compat/pages.php';
}
@@ -220,9 +220,8 @@ else {
$content .= $tmp_content;
if (hasFlag(FLAG_CONTENT_PAGES) || superAdmin()) {
$pageInfo = getCustomPageInfo($pageName);
$content = $twig->render('admin.pages.links.html.twig', array(
'page' => array('id' => $pageInfo !== null ? $pageInfo['id'] : 0, 'hidden' => $pageInfo !== null ? $pageInfo['hidden'] : '0')
)) . $content;
$content = $twig->render('admin.links.html.twig', ['page' => 'pages', 'id' => $pageInfo !== null ? $pageInfo['id'] : 0, 'hidden' => $pageInfo !== null ? $pageInfo['hidden'] : '0']
) . $content;
}
$page = $pageName;
@@ -271,7 +270,7 @@ if($hooks->trigger(HOOK_BEFORE_PAGE)) {
unset($file);
if(config('backward_support') && isset($main_content[0]))
if(setting('core.backward_support') && isset($main_content[0]))
$content .= $main_content;
$content .= ob_get_contents();
@@ -282,7 +281,7 @@ if(!isset($title)) {
$title = ucfirst($page);
}
if(config('backward_support')) {
if(setting('core.backward_support')) {
$main_content = $content;
$topic = $title;
}

View File

@@ -12,6 +12,7 @@ defined('MYAAC') or die('Direct access not allowed!');
return [
['GET', '', 'news.php'], // empty URL = show news
['GET', 'news/archive/{id:int}[/]', 'news/archive.php'],
['GET', 'news/{id:int}[/]', 'news/archive.php'],
// block access to some files
['*', 'account/base[/]', '404.php'], // this is to block account/base.php

View File

@@ -65,6 +65,12 @@ return [
'default' => false,
'is_config' => true,
],
'csrf_protection' => [
'name' => 'CSRF protection',
'type' => 'boolean',
'desc' => 'Its recommended to keep it enabled. Disable only if you know what you are doing.',
'default' => true,
],
'google_analytics_id' => [
'name' => 'Google Analytics ID',
'type' => 'text',
@@ -1048,8 +1054,9 @@ Sent by MyAAC,<br/>
'default' => true,
],
'highscores_country_box' => [ // not implemented yet
'hidden' => true,
'name' => 'Display Country Box',
'type' => 'hidden',
'type' => 'boolean',
'desc' => 'Show player outfit?',
'default' => false,
],
@@ -1126,7 +1133,7 @@ Sent by MyAAC,<br/>
'name' => 'Display Quests',
'type' => 'boolean',
'desc' => 'Show characters quests. Can be configured below',
'default' => true,
'default' => false,
],
'quests' => [
'name' => 'Quests List',
@@ -1225,9 +1232,9 @@ Sent by MyAAC,<br/>
'team_style' => [
'name' => 'Style',
'type' => 'options',
'desc' => '',
'options' => ['normal table', 'in boxes, grouped by group id'],
'default' => 1,
'desc' => 'How to show groups',
'options' => [1 => 'normal table', 2 => 'in boxes, grouped by group id'],
'default' => 2,
],
'team_status' => [
'name' => 'Display Online Status',
@@ -1602,7 +1609,7 @@ Sent by MyAAC,<br/>
if ($key == 'server_path') {
$server_path = $values[$key];
}
elseif (strpos($key, 'database_') !== false) {
elseif (str_contains($key, 'database_')) {
$database[$key] = $values[$key];
}

134
system/src/Admin/Pages.php Normal file
View File

@@ -0,0 +1,134 @@
<?php
namespace MyAAC\Admin;
use MyAAC\Models\Pages as ModelsPages;
class Pages
{
static public function verify($name, $title, $body, $player_id, $php, $enable_tinymce, $access, &$errors)
{
if(!isset($title[0]) || !isset($body[0])) {
$errors[] = 'Please fill all inputs.';
return false;
}
if(strlen($name) > PAGE_NAME_LIMIT) {
$errors[] = 'Page name cannot be longer than ' . PAGE_NAME_LIMIT . ' characters.';
return false;
}
if(strlen($title) > PAGE_TITLE_LIMIT) {
$errors[] = 'Page title cannot be longer than ' . PAGE_TITLE_LIMIT . ' characters.';
return false;
}
if(strlen($body) > PAGE_BODY_LIMIT) {
$errors[] = 'Page content cannot be longer than ' . PAGE_BODY_LIMIT . ' characters.';
return false;
}
if(!isset($player_id) || $player_id == 0) {
$errors[] = 'Player ID is wrong.';
return false;
}
if(!isset($php) || ($php != 0 && $php != 1)) {
$errors[] = 'Enable PHP is wrong.';
return false;
}
if ($php == 1 && !getBoolean(setting('core.admin_pages_php_enable'))) {
$errors[] = 'PHP pages disabled on this server. To enable go to Settings in Admin Panel and enable <strong>Enable PHP Pages</strong>.';
return false;
}
if(!isset($enable_tinymce) || ($enable_tinymce != 0 && $enable_tinymce != 1)) {
$errors[] = 'Enable TinyMCE is wrong.';
return false;
}
if(!isset($access) || $access < 0 || $access > PHP_INT_MAX) {
$errors[] = 'Access is wrong.';
return false;
}
return true;
}
static public function get($id)
{
$row = ModelsPages::find($id);
if ($row) {
return $row->toArray();
}
return false;
}
static public function add($name, $title, $body, $player_id, $php, $enable_tinymce, $access, &$errors)
{
if(!self::verify($name, $title, $body, $player_id, $php, $enable_tinymce, $access, $errors)) {
return false;
}
if (!ModelsPages::where('name', $name)->exists())
ModelsPages::create([
'name' => $name,
'title' => $title,
'body' => $body,
'player_id' => $player_id,
'php' => $php ? '1' : '0',
'enable_tinymce' => $enable_tinymce ? '1' : '0',
'access' => $access
]);
else
$errors[] = 'Page with this link already exists.';
return !count($errors);
}
static public function update($id, $name, $title, $body, $player_id, $php, $enable_tinymce, $access, &$errors)
{
if(!self::verify($name, $title, $body, $player_id, $php, $enable_tinymce, $access, $errors)) {
return false;
}
ModelsPages::where('id', $id)->update([
'name' => $name,
'title' => $title,
'body' => $body,
'player_id' => $player_id,
'php' => $php ? '1' : '0',
'enable_tinymce' => $enable_tinymce ? '1' : '0',
'access' => $access
]);
return true;
}
static public function delete($id, &$errors)
{
if (isset($id)) {
$row = ModelsPages::find($id);
if ($row) {
$row->delete();
}
else
$errors[] = 'Page with id ' . $id . ' does not exists.';
} else
$errors[] = 'id not set';
return !count($errors);
}
static public function toggleHidden($id, &$errors, &$status)
{
if (isset($id)) {
$row = ModelsPages::find($id);
if ($row) {
$row->hidden = $row->hidden == 1 ? 0 : 1;
if (!$row->save()) {
$errors[] = 'Fail during toggle hidden Page.';
}
$status = $row->hidden;
}
else {
$errors[] = 'Page with id ' . $id . ' does not exists.';
}
} else
$errors[] = 'id not set';
return !count($errors);
}
}

95
system/src/CsrfToken.php Normal file
View File

@@ -0,0 +1,95 @@
<?php
/**
* CsrfToken
*
* @package MyAAC
* @author Znote
* @author Slawkens <slawkens@gmail.com>
* @copyright 2023 MyAAC
* @link https://my-aac.org
*/
namespace MyAAC;
class CsrfToken
{
public static function generate(): void
{
$token = sha1(uniqid(time(), true));
setSession('csrf_token', $token);
}
/**
* Displays a random token to prevent CSRF attacks.
*
* @access public
* @static true
* @return void
**/
public static function create(): void {
echo '<input type="hidden" name="csrf_token" value="' . self::get() . '" />';
}
/**
* Returns the active token, if there is one.
*
* @access public
* @static true
* @return mixed
**/
public static function get(): mixed
{
$token = getSession('csrf_token');
return $token ?? false;
}
/**
* Validates whether the active token is valid or not.
*
* @param string $post
* @access public
* @static true
* @return boolean
**/
public static function isValid($post): bool
{
if (!setting('core.csrf_protection')) {
return true;
}
// Token doesn't exist yet, return false.
if (!self::get()) {
return false;
}
return ($post == getSession('csrf_token'));
}
/**
* Destroys the active token.
*
* @access protected
* @static true
* @return void
**/
protected static function reset(): void {
unsetSession('csrf_token');
}
/**
* Displays information on both the post token and the session token.
*
* @param string $post
* @access public
* @static true
* @return void
**/
public static function debug($post): void
{
echo '<pre>', var_export([
'post' => $post,
'token' => self::get()
], true), '</pre>';
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace MyAAC\Models;
use Illuminate\Database\Eloquent\Model;
class AccountAction extends Model {
protected $table = TABLE_PREFIX . 'account_actions';
public $timestamps = false;
protected $fillable = ['account_id', 'ip', 'ipv6', 'date', 'action'];
}

View File

@@ -3,7 +3,7 @@
namespace MyAAC\Models;
use Illuminate\Database\Eloquent\Model;
class GuildInvites extends Model {
class GuildInvite extends Model {
protected $table = 'guild_invites';

View File

@@ -125,7 +125,7 @@ function updateStatus() {
$status['playersMax'] = $serverStatus->getMaxPlayers();
// for status afk thing
if($config['online_afk'])
if (setting('core.online_afk'))
{
$status['playersTotal'] = 0;
// get amount of players that are currently logged in-game, including disconnected clients (exited)

View File

@@ -54,7 +54,7 @@ if(file_exists(BASE . $template_path . '/index.php')) {
elseif(file_exists(BASE . $template_path . '/template.php')) {
$template_index = 'template.php';
}
elseif($config['backward_support'] && file_exists(BASE . $template_path . '/layout.php')) {
elseif(setting('core.backward_support') && file_exists(BASE . $template_path . '/layout.php')) {
$template_index = 'layout.php';
}
else {
@@ -77,7 +77,7 @@ if ($cache->enabled() && $cache->fetch('template_ini_' . $template_name, $tmp))
else {
$file = BASE . $template_path . '/config.ini';
$exists = file_exists($file);
if ($exists || ($config['backward_support'] && file_exists(BASE . $template_path . '/layout_config.ini'))) {
if ($exists || (setting('core.backward_support') && file_exists(BASE . $template_path . '/layout_config.ini'))) {
if (!$exists) {
$file = BASE . $template_path . '/layout_config.ini';
}

View File

@@ -2,5 +2,6 @@
<br/>
{% endif %}
<form action="{% if action is not defined %}{{ getLink('account/manage') }}{% else %}{{ action }}{% endif %}" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>

View File

@@ -1,6 +1,7 @@
Here you can see and edit the information about your character.<br/>
If you do not want to specify a certain field, just leave it blank.<br/><br/>
<form action="{{ getLink('account/character/comment') }}" method="post">
{{ csrf() }}
<div class="TableContainer" >
<table class="Table5" cellpadding="0" cellspacing="0">
<div class="CaptionContainer">
@@ -99,6 +100,7 @@ If you do not want to specify a certain field, just leave it blank.<br/><br/>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('account/manage') }}" method="post">
{{ csrf() }}
<tr>
<td style="border:0px;">
{{ include('buttons.back.html.twig') }}

View File

@@ -1,5 +1,6 @@
Here you can tell other players about yourself. This information will be displayed alongside the data of your characters. If you do not want to fill in a certain field, just leave it blank.<br/><br/>
<form action="{{ getLink('account/info') }}" method=post>
<form action="{{ getLink('account/info') }}" method="post">
{{ csrf() }}
<div class="TableContainer" >
<table class="Table1" cellpadding="0" cellspacing="0" >
<div class="CaptionContainer" >
@@ -31,7 +32,7 @@ Here you can tell other players about yourself. This information will be display
<input name="info_location" value="{{ account_location }}" size="30" maxlength="50" >
</td>
</tr>
{% if config.account_country %}
{% if setting('core.account_country') %}
<tr>
<td class="LabelV" >Country:</td>
<td>
@@ -88,6 +89,7 @@ Here you can tell other players about yourself. This information will be display
</form>
<table border="0" cellspacing="0" cellpadding="0" >
<form action="{{ getLink('account/manage') }}" method="post" >
{{ csrf() }}
<tr>
<td style="border:0px;" >
{{ include('buttons.back.html.twig') }}
@@ -97,4 +99,4 @@ Here you can tell other players about yourself. This information will be display
</table>
</td>
</tr>
</table>
</table>

View File

@@ -1,5 +1,6 @@
Please enter your password and the new email address. Make sure that you enter a valid email address which you have access to. <br/><b>For security reasons, the actual change will be finalised after a waiting period of {{ config.account_mail_change }} days.</b><br/><br/>
Please enter your password and the new email address. Make sure that you enter a valid email address which you have access to. <br/><b>For security reasons, the actual change will be finalised after a waiting period of {{ setting('core.account_mail_change') }} days.</b><br/><br/>
<form action="{{ getLink('account/email') }}" method="post">
{{ csrf() }}
<div class="TableContainer">
<table class="Table1" cellpadding="0" cellspacing="0">
<div class="CaptionContainer">
@@ -58,6 +59,7 @@ Please enter your password and the new email address. Make sure that you enter a
<td>
<table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('account/manage') }}" method="post">
{{ csrf() }}
<tr>
<td style="border:0px;">
{{ include('buttons.back.html.twig') }}
@@ -67,4 +69,4 @@ Please enter your password and the new email address. Make sure that you enter a
</table>
</td>
</tr>
</table>
</table>

View File

@@ -1,6 +1,7 @@
To change a name of character select player and choose a new name.<br/>
<span style="color: red">Change name cost {{ setting('core.account_change_character_name_price') }} premium points. You have {{ points }} premium points.</span><br/><br/>
<form action="{{ getLink('account/character/name') }}" method="post">
{{ csrf() }}
<input type="hidden" name="changenamesave" value="1">
<div class="TableContainer">
<table class="Table1" cellpadding="0" cellspacing="0">
@@ -64,6 +65,7 @@ To change a name of character select player and choose a new name.<br/>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('account/manage') }}" method="post">
{{ csrf() }}
<tr>
<td style="border:0px;">
{{ include('buttons.back.html.twig') }}

View File

@@ -1,6 +1,7 @@
Please enter your current password and a new password. For your security, please enter the new password twice.<br/>
<br/>
<form action="{{ getLink('account/password') }}" method="post">
{{ csrf() }}
<div class="TableContainer">
<table class="Table1" cellpadding="0" cellspacing="0">
<div class="CaptionContainer">
@@ -33,7 +34,7 @@ Please enter your current password and a new password. For your security, please
<span>New Password Again:</span>
</td>
<td>
<input type="password" name="newpassword2" size="30" maxlength="29">
<input type="password" name="newpassword_confirm" size="30" maxlength="29">
</td>
</tr>
<tr>
@@ -66,6 +67,7 @@ Please enter your current password and a new password. For your security, please
<td>
<table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('account/manage') }}" method="post">
{{ csrf() }}
<tr>
<td style="border:0px;">
{{ include('buttons.back.html.twig') }}
@@ -75,4 +77,4 @@ Please enter your current password and a new password. For your security, please
</table>
</td>
</tr>
</table>
</table>

View File

@@ -1,6 +1,7 @@
To change a sex of character select player and choose a new sex.<br/>
<span style="color: red">Change sex cost {{ setting('core.account_change_character_sex_price') }} premium points. You have {{ points }} premium points.</span><br/><br/>
<form action="{{ getLink('account/character/sex') }}" method="post">
{{ csrf() }}
<input type="hidden" name="changesexsave" value="1"/>
<div class="TableContainer">
<table class="Table1" cellpadding="0" cellspacing="0">
@@ -64,6 +65,7 @@ To change a sex of character select player and choose a new sex.<br/>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('account/manage') }}" method="post">
{{ csrf() }}
<tr>
<td style="border:0px;" >
{{ include('buttons.back.html.twig') }}

View File

@@ -1,5 +1,6 @@
{{ hook('HOOK_ACCOUNT_CREATE_BEFORE_FORM') }}
<form action="{{ getLink('account/create') }}" method="post" id="createaccount">
{{ csrf() }}
<div class="TableContainer" >
<table class="Table5" cellpadding="0" cellspacing="0" >
<div class="CaptionContainer" >
@@ -59,13 +60,13 @@
<td></td><td><span id="email_error" class="FormFieldError">{% if errors.email is defined %}{{ errors.email }}{% endif %}</span></td>
</tr>
{% if setting('core.mail_enabled') and config.account_mail_verify %}
{% if setting('core.mail_enabled') and setting('core.account_mail_verify') %}
<tr><td></td><td><span><strong>Please use real address!<br/>We will send a link to validate your Email.</strong></span></td></tr>
{% endif %}
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_EMAIL') }}
{% if config.account_country %}
{% if setting('core.account_country') %}
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.country[0] is defined %} class="red"{% endif %}>Country:</span>
@@ -104,11 +105,11 @@
<span{% if errors.password is defined %} class="red"{% endif %}>Repeat password:</span>
</td>
<td>
<input type="password" name="password2" id="password2" value="" size="30" maxlength="29" />
<img id="password2_indicator" src="images/global/general/{% if not save or errors.password is defined %}n{% endif %}ok.gif" style="display: none;" />
<input type="password" name="password_confirm" id="password_confirm" value="" size="30" maxlength="29" />
<img id="password_confirm_indicator" src="images/global/general/{% if not save or errors.password is defined %}n{% endif %}ok.gif" style="display: none;" />
</td>
</tr>
<tr><td></td><td><span id="password2_error" class="FormFieldError">{% if errors.password is defined %}{{ errors.password }}{% endif %}</span></td></tr>
<tr><td></td><td><span id="password_confirm_error" class="FormFieldError">{% if errors.password is defined %}{{ errors.password }}{% endif %}</span></td></tr>
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_PASSWORDS') }}
</tbody>
@@ -122,7 +123,7 @@
{{ hook('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_1') }}
{% if (not setting('core.mail_enabled') or not config.account_mail_verify) and config.account_create_character_create %}
{% if (not setting('core.mail_enabled') or not setting('core.account_mail_verify')) and setting('core.account_create_character_create') %}
<tr>
<td>
<div class="TableShadowContainerRightTop">

View File

@@ -17,7 +17,7 @@
$('#password').blur(function() {
checkPassword();
});
$('#password2').blur(function() {
$('#password_confirm').blur(function() {
checkPassword();
});
$('#SuggestAccountNumber a').click(function (event) {
@@ -150,11 +150,11 @@
return;
}
if(document.getElementById("password2").value == "")
if(document.getElementById("password_confirm").value == "")
{
$('#password2_error').html('Please enter the password again!');
$('#password2_indicator').attr('src', 'images/global/general/nok.gif');
$('#password2_indicator').show();
$('#password_confirm_error').html('Please enter the password again!');
$('#password_confirm_indicator').attr('src', 'images/global/general/nok.gif');
$('#password_confirm_indicator').show();
return;
}
@@ -172,24 +172,24 @@
}
var password = document.getElementById("password").value;
var password2 = document.getElementById("password2").value;
$.getJSON("tools/validate.php", { password: password, password2: password2, uid: Math.random() },
var password_confirm = document.getElementById("password_confirm").value;
$.getJSON("tools/validate.php", { password: password, password_confirm: password_confirm, uid: Math.random() },
function(data){
if(data.hasOwnProperty('success')) {
$('#password_error').html ('');
$('#password2_error').html ('');
$('#password_confirm_error').html ('');
$('#password_indicator').attr('src', 'images/global/general/ok.gif');
$('#password2_indicator').attr('src', 'images/global/general/ok.gif');
$('#password_confirm_indicator').attr('src', 'images/global/general/ok.gif');
}
else if(data.hasOwnProperty('error')) {
$('#password_error').html(data.error);
$('#password2_error').html(data.error);
$('#password_confirm_error').html(data.error);
$('#password_indicator').attr('src', 'images/global/general/nok.gif');
$('#password2_indicator').attr('src', 'images/global/general/nok.gif');
$('#password_confirm_indicator').attr('src', 'images/global/general/nok.gif');
}
$('#password_indicator').show();
$('#password2_indicator').show();
$('#password_confirm_indicator').show();
}
);

View File

@@ -2,11 +2,12 @@ Please choose a name{% if config.character_samples|length > 1 %}, vocation{% end
{% if config.character_towns|length > 1 %}, town{% endif %}
and sex for your character. <br/>
In any case the name must not violate the naming conventions stated in the <a href="?subtopic=rules" target="_blank" >{{ config.lua.serverName }} Rules</a>, or your character might get deleted or name locked.
{% if account_logged.getPlayersList(true)|length >= config.characters_per_account %}
{% if account_logged.getPlayersList(true)|length >= setting('core.characters_per_account') %}
<b><span style="color: red"> You have maximum number of characters per account on your account. Delete one before you make new.</span></b>
{% endif %}
<br/><br/>
<form action="{{ getLink('account/character/create') }}" method="post">
{{ csrf() }}
<input type="hidden" name="save" value="1">
<div class="TableContainer">
<table class="Table3" cellpadding="0" cellspacing="0">
@@ -135,6 +136,7 @@ In any case the name must not violate the naming conventions stated in the <a hr
<td>
<table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('account/manage') }}" method="post">
{{ csrf() }}
<tr>
<td style="border:0px;">
{{ include('buttons.back.html.twig') }}

View File

@@ -1,5 +1,6 @@
To delete a character enter the name of the character and your password.<br/><br/>
<form action="{{ getLink('account/character/delete') }}" method="post">
{{ csrf() }}
<input type="hidden" name="deletecharactersave" value="1"/>
<div class="TableContainer">
<table class="Table1" cellpadding="0" cellspacing="0" >
@@ -54,6 +55,7 @@ To delete a character enter the name of the character and your password.<br/><br
<td>
<table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('account/manage') }}" method="post">
{{ csrf() }}
<tr>
<td style="border:0px;">
{{ include('buttons.back.html.twig') }}
@@ -63,4 +65,4 @@ To delete a character enter the name of the character and your password.<br/><br
</table>
</td>
</tr>
</table>
</table>

View File

@@ -1,6 +1,7 @@
To generate new recovery key for your account please enter your password.<br/>
<span style="color: red"><b>New recovery key cost {{ setting('core.account_generate_new_reckey_price') }} Premium Points.</span> You have {{ points }} premium points. You will receive e-mail with this recovery key.</b><br/>
<form action="{{ getLink('account/register/new') }}" method="post">
{{ csrf() }}
<input type="hidden" name="registeraccountsave" value="1">
<div class="TableContainer" >
<table class="Table1" cellpadding="0" cellspacing="0">
@@ -47,6 +48,7 @@ To generate new recovery key for your account please enter your password.<br/>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('account/manage') }}" method="post">
{{ csrf() }}
<tr>
<td style="border:0px;">
{{ include('buttons.back.html.twig') }}

View File

@@ -1,5 +1,6 @@
To generate recovery key for your account please enter your password.<br/><br/>
<form action="{{ getLink('account/register') }}" method="post">
{{ csrf() }}
<input type="hidden" name="registeraccountsave" value="1"/>
<div class="TableContainer">
<table class="Table1" cellpadding="0" cellspacing="0">
@@ -50,6 +51,7 @@ To generate recovery key for your account please enter your password.<br/><br/>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('account/manage') }}" method="post">
{{ csrf() }}
<tr>
<td style="border: 0px;">
{{ include('buttons.back.html.twig') }}
@@ -59,4 +61,4 @@ To generate recovery key for your account please enter your password.<br/><br/>
</table>
</td>
</tr>
</table>
</table>

View File

@@ -1,6 +1,7 @@
{{ hook('HOOK_ACCOUNT_LOGIN_BEFORE_PAGE') }}
Please enter your account {{ account|lower }} and your password.<br/><a href="{{ getLink('account/create') }}">Create an account</a> if you do not have one yet.<br/><br/>
<form action="{{ getLink('account/manage') }}" method="post" >
<form action="{{ getLink('account/manage') }}" method="post">
{{ csrf() }}
{% if redirect is not null %}
<input type="hidden" name="redirect" value="{{ redirect }}" />
{% endif %}
@@ -66,6 +67,7 @@ Please enter your account {{ account|lower }} and your password.<br/><a href="{{
<td>
<table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('account/lost') }}" method="post">
{{ csrf() }}
<tr>
<td style="border:0px;">
{{ include('buttons.account_lost.html.twig') }}

View File

@@ -1,5 +1,6 @@
The Lost Account Interface can help you to get back your account name and password. Please enter your character name and select what you want to do.<br/>
<form action="?subtopic=lostaccount&action=step1" method=post>
<form action="?subtopic=lostaccount&action=step1" method="post">
{{ csrf() }}
<input type="hidden" name="character" value="">
<table cellspacing="1" cellpadding="4" border="0" width="100%">
<tr>
@@ -32,4 +33,4 @@ The Lost Account Interface can help you to get back your account name and passwo
</td>
</tr>
</table>
</form>
</form>

View File

@@ -68,6 +68,7 @@
<div style="text-align:center">
You can register your account for increased protection. Click on "Register Account" and get your free recovery key today!<br/>
<form action="{{ getLink('account/register') }}" method="post">
{{ csrf() }}
{% set button_name = 'Register Account' %}
{% include('buttons.base.html.twig') %}
</form>
@@ -80,6 +81,7 @@
A request has been submitted to change the email address of this account to <b>{{ email_new }}</b>. After <b>{{ email_new_time|date("j F Y, G:i:s") }}</b> you can accept the new email address and finish the process. Please cancel the request if you do not want your email address to be changed! Also cancel the request if you have no access to the new email address!
<form action="{{ getLink('account/email') }}" method="post">
{{ csrf() }}
{% set button_name = 'Edit' %}
{% include('buttons.base.html.twig') %}
</form>
@@ -99,6 +101,7 @@
<td style="width: 90px;">Email Address:</td>
<td>{{ account_email ~ email_change }}
<form action="{{ getLink('account/email') }}" method="post">
{{ csrf() }}
{% set button_name = 'Change Email' %}
{% include('buttons.base.html.twig') %}
</form>
@@ -137,6 +140,7 @@
</tr>
</table>
<form action="{{ getLink('account/info') }}" method="post">
{{ csrf() }}
{% set button_name = 'Change Info' %}
{% include('buttons.base.html.twig') %}
</form>
@@ -188,6 +192,7 @@
<tr>
<td>
<form action="{{ getLink('account/character/create') }}" method="post" >
{{ csrf() }}
{% set button_name = 'Create Character' %}
{% include('buttons.base.html.twig') %}
</form>
@@ -195,6 +200,7 @@
{% if setting('core.account_change_character_name') %}
<td>
<form action="{{ getLink('account/character/name') }}" method="post" >
{{ csrf() }}
{% set button_name = 'Change Name' %}
{% include('buttons.base.html.twig') %}
</form>
@@ -203,6 +209,7 @@
{% if setting('core.account_change_character_sex') %}
<td>
<form action="{{ getLink('account/character/sex') }}" method="post" >
{{ csrf() }}
{% set button_name = 'Change Sex' %}
{% include('buttons.base.html.twig') %}
</form>
@@ -210,6 +217,7 @@
{% endif %}
<td>
<form action="{{ getLink('account/character/delete') }}" method="post">
{{ csrf() }}
{% set button_name = 'Delete Character' %}
{% include('buttons.base.html.twig') %}
</form>

View File

@@ -98,6 +98,7 @@ html { margin-top: 32px !important; }
<div class="dropdown-content">
<a href="{{ constant('ADMIN_URL') }}?p=news&action=new">News</a>
<a href="{{ constant('ADMIN_URL') }}?p=pages&action=new">Page</a>
<a href="{{ constant('ADMIN_URL') }}?p=changelog&action=new">Changelog</a>
</div>
</li>
<li>
@@ -106,9 +107,11 @@ html { margin-top: 32px !important; }
</a>
</li>
<li>
<a class="ab-item" href="{{ constant('ADMIN_URL') }}?p=dashboard&clear_cache">
Clear Cache
</a>
<form method="post" action="{{ constant('ADMIN_URL') }}?p=dashboard">
{{ csrf() }}
<input type="hidden" name="clear_cache" value="1" />
<a class="ab-item" href="#" onclick="confirm('Are you sure that you want to clear cache?') && $(this).closest('form').submit()" title="Clear Cache">Clear Cache</a>
</form>
</li>
</ul>
<ul class="ab-top-secondary">

View File

@@ -4,6 +4,8 @@
<h5 class="m-0">{{ (action == 'edit') ? 'Edit' : 'Add' }}</h5>
</div>
<form role="form" method="post" action="{{ cl_link_form }}" id="cl-edit-form">
{{ csrf() }}
<input type="hidden" name="action" value="{{ action }}" />
<div class="card-body">
{% if action == 'edit' %}
<input type="hidden" name="id" value="{{ cl_id }}"/>

View File

@@ -1,8 +1,11 @@
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">News:
<a href="{{ constant('ADMIN_URL') }}?p=changelog&action=new" class="float-right"><span
class="btn btn-sm btn-success">New</span></a>
<form method="post" class="float-right">
{{ csrf() }}
<input type="hidden" name="action" value="new" />
<button type="submit" class="btn btn-sm btn-success">New</button>
</form>
</h5>
</div>
@@ -30,15 +33,26 @@
<td><img src="{{ constant('BASE_URL') }}images/changelog/{{ log.where }}.png" alt="icon" title="{{ log.where|capitalize }}"/> {{ log.where|capitalize }}</td>
<td>
<div class="btn-group">
<a href="{{ constant('ADMIN_URL') }}?p=changelog&action=edit&id={{ log.id }}" class="btn btn-success btn-sm" title="Edit">
<i class="fas fa-pencil-alt"></i>
</a>
<a href="{{ constant('ADMIN_URL') }}?p=changelog&action=delete&id={{ log.id }}" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?');" title="Delete">
<i class="fas fa-trash"></i>
</a>
<a href="{{ constant('ADMIN_URL') }}?p=changelog&action=hide&id={{ log.id }}" class="btn btn-{{ (log.hidden != 1) ? 'info' : 'default' }} btn-sm" title="{% if log.hidden != 1 %}Hide{% else %}Show{% endif %}">
<i class="fas fa-eye{{ (log.hidden != 1) ? '' : '-slash' }}"></i>
</a>
<form method="post">
{{ csrf() }}
<input type="hidden" name="action" value="edit" />
<input type="hidden" name="id" value="{{ log.id }}" />
<button type="submit" class="btn btn-success btn-sm" title="Edit"><i class="fas fa-pencil-alt"></i></button>
</form>
<form method="post">
{{ csrf() }}
<input type="hidden" name="action" value="delete" />
<input type="hidden" name="id" value="{{ log.id }}" />
<button type="submit" class="btn btn-danger btn-sm" title="Delete" onclick="return confirm('Are you sure?');"><i class="fas fa-pencil-alt"></i></button>
</form>
<form method="post">
{{ csrf() }}
<input type="hidden" name="action" value="hide" />
<input type="hidden" name="id" value="{{ log.id }}" />
<button type="submit" class="btn btn-{{ (log.hidden != 1) ? 'info' : 'default' }} btn-sm" title="{% if log.hidden != 1 %}Hide{% else %}Show{% endif %}"><i class="fas fa-eye{{ (log.hidden != 1) ? '' : '-slash' }}"></i></button>
</form>
</div>
</td>
</tr>
@@ -53,3 +67,15 @@
</table>
</div>
</div>
<link rel="stylesheet" type="text/css" href="{{ constant('BASE_URL') }}tools/css/jquery.datetimepicker.css"/ >
<script src="{{ constant('BASE_URL') }}tools/js/jquery.datetimepicker.js"></script>
<script>
$(document).ready(function () {
$('#createdate').datetimepicker({format: "M d Y, H:i:s",});
$('.tb_datatable').DataTable({
"order": [[0, "desc"]],
"columnDefs": [{targets: [1, 2,4,5],orderable: false}]
});
});
</script>

View File

@@ -0,0 +1,22 @@
<br/><br/>
<form action="{{ constant('ADMIN_URL') }}?p={{ page }}" method="post" style="float: left">
{{ csrf() }}
<input type="hidden" name="action" value="edit" />
<input type="hidden" name="id" value="{{ id }}" />
<button type="submit" class="btn btn-success btn-sm" title="Edit"><img src="images/edit.png"/> Edit</button>
</form>
<form action="{{ constant('ADMIN_URL') }}?p={{ page }}" method="post" style="float: left">
{{ csrf() }}
<input type="hidden" name="action" value="delete" />
<input type="hidden" name="id" value="{{ id }}" />
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?');" title="Delete"><img src="images/del.png"/>Delete</button>
</form>
<form action="{{ constant('ADMIN_URL') }}?p={{ page }}" method="post" style="float: left">
{{ csrf() }}
<input type="hidden" name="action" value="hide" />
<input type="hidden" name="id" value="{{ id }}" />
<button type="submit" class="btn btn-{{ (hidden != 1) ? 'info' : 'default' }} btn-sm" title="{% if hidden != 1 %}Hide{% else %}Show{% endif %}"><img src="images/{{ hidden != 1 ? 'success' : 'error' }}.png"/>{{ hidden != 1 ? 'Hide' : 'Show' }}</button>
</form>

View File

@@ -19,6 +19,7 @@
<p class="login-box-msg">Please login.</p>
<form method="post" action="{{ constant('ADMIN_URL') }}">
{{ csrf() }}
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-lock"></i></span>

View File

@@ -9,6 +9,7 @@
<h5 class="m-0">Mailer</h5>
</div>
<form id="form" method="post">
{{ csrf() }}
<div class="card-body">
<div class="form-group row">
<label for="mail_to">To: (enter email, or leave empty to all)</label>

View File

@@ -4,6 +4,7 @@
</div>
<div class="card-body">
<form method="post" action="?p=menus">
{{ csrf() }}
<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">

View File

@@ -1,9 +1,11 @@
{% if action %}
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">{% if action == 'edit' %}Edit{% else %}Add{% endif %} news</h5>
<h5 class="m-0">{% if action == 'edit' %}Edit{% else %}Add{% endif %} {% if type == constant('NEWS') %}News{% elseif type == constant('TICKER') %}Ticker{% else %}Article{% endif %}</h5>
</div>
<form id="form" role="form" method="post" action="{{ news_link_form }}">
<form id="form" role="form" method="post">
{{ csrf() }}
<input type="hidden" name="action" value="{{ action == 'edit' ? 'edit' : 'new' }}" />
<div class="card-body " id="page-edit-table">
{% if action == 'edit' %}
<input type="hidden" name="id" value="{{ news_id }}"/>
@@ -22,9 +24,9 @@
<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="selected"{% 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="selected"{% endif %}{% if action == 'edit' and type != constant('TICKER') %} disabled{% endif %}>Ticker</option>
<option value="{{ constant('ARTICLE') }}" {% if type is defined and type == constant('ARTICLE') %}selected="selected"{% endif %}{% if action == 'edit' and type != constant('ARTICLE') %} disabled{% endif %}>Article</option>
<option value="{{ constant('NEWS') }}" {% if type == constant('NEWS') %}selected="selected"{% endif %}{% if action == 'edit' and type != constant('NEWS') %} disabled{% endif %}>News</option>
<option value="{{ constant('TICKER') }}" {% if type == constant('TICKER') %}selected="selected"{% endif %}{% if action == 'edit' and type != constant('TICKER') %} disabled{% endif %}>Ticker</option>
<option value="{{ constant('ARTICLE') }}" {% if type == constant('ARTICLE') %}selected="selected"{% endif %}{% if action == 'edit' and type != constant('ARTICLE') %} disabled{% endif %}>Article</option>
</select>
</div>
@@ -85,7 +87,7 @@
</div>
</div>
<div class="card-footer">
<button type="submit" class="btn btn-info"><i class="fas fa-update"></i> Update</button>
<button type="submit" class="btn btn-info"><i class="fas fa-update"></i> {{ action == 'edit' ? 'Update' : 'Add' }}</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>

View File

@@ -1,136 +1,6 @@
<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="card-body">
<table class="tb_datatable table table-striped table-bordered table-responsive d-md-table">
<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="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="card-body">
<table class="tb_datatable table table-striped table-bordered table-responsive d-md-table">
<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="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="card-body">
<table class="tb_datatable table table-striped table-bordered table-responsive d-md-table">
<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>
{{ include('admin.news.table.html.twig', {type: 1, title: 'News'}) }}
{{ include('admin.news.table.html.twig', {type: 2, title: 'Tickers'}) }}
{{ include('admin.news.table.html.twig', {type: 3, title: 'Articles'}) }}
<script>
$(function () {

View File

@@ -0,0 +1,64 @@
<div class="card card-info card-outline">
<div class="card-header">
<h5 class="m-0">{{ title }}:
<form method="post" class="float-right">
{{ csrf() }}
<input type="hidden" name="action" value="new" />
<input type="hidden" name="type" value="{{ type }}" />
<button type="submit" class="btn btn-sm btn-success">New</button>
</form>
</h5>
</div>
<div class="card-body">
<table class="tb_datatable table table-striped table-bordered table-responsive d-md-table">
<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[type] %}
<tr>
<td>{{ news.id|raw }}</td>
<td>
<i>
<a href="{{ getLink('news') }}/{{ news.id }}" target="_blank">{{ news.title }}</a>
</i>
</td>
<td>{{ news.date|date(setting('core.news_date_format')) }}</td>
<td><a target="_blank" href="{{ news.player_link }}">{{ news.player_name }}</a></td>
<td>
<div class="btn-group">
<form method="post">
{{ csrf() }}
<input type="hidden" name="action" value="edit" />
<input type="hidden" name="id" value="{{ news.id }}" />
<button type="submit" class="btn btn-success btn-sm" title="Edit"><i class="fas fa-pencil-alt"></i></button>
</form>
<form method="post">
{{ csrf() }}
<input type="hidden" name="action" value="delete" />
<input type="hidden" name="id" value="{{ news.id }}" />
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?');" title="Delete"><i class="fas fa-trash"></i></button>
</form>
<form method="post">
{{ csrf() }}
<input type="hidden" name="action" value="hide" />
<input type="hidden" name="id" value="{{ news.id }}" />
<button type="submit" 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></button>
</form>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>

View File

@@ -3,6 +3,7 @@
<h5 class="m-0">Notepad</h5>
</div>
<form method="post">
{{ csrf() }}
<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>

View File

@@ -3,7 +3,9 @@
<div class="card-header">
<h5 class="m-0">{% if action == 'edit' %}Edit{% else %}Add{% endif %} page</h5>
</div>
<form id="form" class="form-horizontal" method="post" action="?p=pages&action={% if action == 'edit' %}edit{% else %}new{% endif %}">
<form id="form" class="form-horizontal" method="post">
{{ csrf() }}
<input type="hidden" name="action" value="{{ action }}" />
{% if action == 'edit' %}
<input type="hidden" name="id" value="{{ id }}"/>
{% endif %}

View File

@@ -1,7 +1,12 @@
<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>
<form method="post" class="float-right">
{{ csrf() }}
<input type="hidden" name="action" value="new" />
<button type="submit" class="btn btn-sm btn-success">New</button>
</form>
</h5>
</div>
<div class="card-body">
<table class="table table-striped table-bordered table-responsive d-md-table" id="tb_pages">
@@ -21,15 +26,26 @@
<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>
<form method="post">
{{ csrf() }}
<input type="hidden" name="action" value="edit" />
<input type="hidden" name="id" value="{{ page.id }}" />
<button type="submit" class="btn btn-success btn-sm" title="Edit"><i class="fas fa-pencil-alt"></i></button>
</form>
<form method="post">
{{ csrf() }}
<input type="hidden" name="action" value="delete" />
<input type="hidden" name="id" value="{{ page.id }}" />
<button type="submit" class="btn btn-danger btn-sm" title="Delete" onclick="return confirm('Are you sure?');"><i class="fas fa-pencil-alt"></i></button>
</form>
<form method="post">
{{ csrf() }}
<input type="hidden" name="action" value="hide" />
<input type="hidden" name="id" value="{{ page.id }}" />
<button type="submit" class="btn btn-{{ (page.hidden != 1) ? 'info' : 'default' }} btn-sm" title="{% if page.hidden != 1 %}Hide{% else %}Show{% endif %}"><i class="fas fa-eye{{ (log.hidden != 1) ? '' : '-slash' }}"></i></button>
</form>
</div>
</td>
</tr>

View File

@@ -1,14 +0,0 @@
<div style="text-align: right;">
<a href="{{ constant('ADMIN_URL') }}?p=pages&action=edit&id={{ page.id }}" title="Edit in Admin Panel" target="_blank">
<img src="images/edit.png"/>Edit
</a>
<a id="delete" href="{{ constant('ADMIN_URL') }}?p=pages&action=delete&id={{ page.id }}" onclick="return confirm('Are you sure?');"
title="Delete in Admin Panel" target="_blank">
<img src="images/del.png"/>Delete
</a>
<a href="{{ constant('ADMIN_URL') }}?p=pages&action=hide&id={{ page.id }}"
title="{% if page.hidden != 1 %}Hide{% else %}Show{% endif %} in Admin Panel" target="_blank">
<img src="images/{% if page.hidden != 1 %}success{% else %}error{% endif %}.png"/>{% if page.hidden != 1 %}Hide{% else %}Show{% endif %}
</a>
<br/>
</div>

View File

@@ -4,6 +4,7 @@
<h5 class="m-0">Install plugin</h5>
</div>
<form enctype="multipart/form-data" method="post" action="{{ constant('ADMIN_URL') }}?p=plugins">
{{ csrf() }}
<div class="card-body">
<input type="hidden" name="upload_plugin"/>

View File

@@ -19,13 +19,17 @@
<tr>
<td>
{% if plugin.enabled %}
<a href="?p=plugins&disable={{ plugin.file }}" class="btn btn-success" onclick="return confirm('Are you sure you want to disable plugin {{ plugin.name }}?');" title="Disable">
<i class="fas fa-check"></i> Enabled
</a>
<form method="post">
{{ csrf() }}
<input type="hidden" name="disable" value="{{ plugin.file }}" />
<button type="submit" class="btn btn-success" onclick="return confirm('Are you sure you want to disable plugin {{ plugin.name }}?');" title="Disable"><i class="fas fa-check"></i> Enabled</button>
</form>
{% else %}
<a href="?p=plugins&enable={{ plugin.file }}" class="btn btn-danger" onclick="return confirm('Are you sure you want to enable plugin {{ plugin.name }}?');" title="Enable">
<i class="fas fa-ban"></i> Disabled
</a>
<form method="post">
{{ csrf() }}
<input type="hidden" name="enable" value="{{ plugin.file }}" />
<button type="submit" class="btn btn-danger" onclick="return confirm('Are you sure you want to enable plugin {{ plugin.name }}?');" title="Enable"><i class="fas fa-ban"></i> Disabled</button>
</form>
{% endif %}
</td>
<td><b>{{ plugin.name }}</b><br>
@@ -38,9 +42,11 @@
<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 you want to uninstall {{ plugin.name }}?');" title="Uninstall">
<i class="fas fa-trash"></i>
</a>
<form method="post">
{{ csrf() }}
<input type="hidden" name="uninstall" value="{{ plugin.file }}" />
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want to uninstall {{ plugin.name }}?');" title="Uninstall"><i class="fas fa-trash"></i></button>
</form>
{% endif %}
</td>
</tr>

View File

@@ -74,6 +74,12 @@
<link rel="stylesheet" type="text/css" href="{{ constant('BASE_URL') }}tools/css/toastify.min.css">
<script type="text/javascript" src="{{ constant('BASE_URL') }}tools/js/toastify.min.js"></script>
<script>
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$('#settings').submit(function(e) {
e.preventDefault();

View File

@@ -6,6 +6,7 @@
<h5 class="m-0">Give Premium Points</h5>
</div>
<form method="post" action="{{ constant('ADMIN_URL') }}?p=mass_account">
{{ csrf() }}
<div class="card-body">
<div class="form-group">
<label>Premium Points</label>
@@ -28,6 +29,7 @@
<h5 class="m-0">Give Coins</h5>
</div>
<form method="post" action="{{ constant('ADMIN_URL') }}?p=mass_account">
{{ csrf() }}
<div class="card-body">
<div class="form-group">
<label>Coins</label>
@@ -50,6 +52,7 @@
<h5 class="m-0">Give Premium Days</h5>
</div>
<form method="post" action="{{ constant('ADMIN_URL') }}?p=mass_account">
{{ csrf() }}
<div class="card-body">
<div class="form-group">
<label>Premium Days</label>

View File

@@ -17,7 +17,7 @@
{% endif %}
<table border="0" cellspacing="1" cellpadding="4" width="100%">
{% if config.characters.outfit %}
<div style="width:64px;height:64px;border:2px solid #F1E0C6; border-radius:50px; padding:13px; margin-top:38px;margin-left:376px;position:absolute;"><img style="margin-left:{% if player.getLookType() in config.outfit_images_wrong_looktypes %}-0px;margin-top:-0px;width:64px;height:64px;{% else %}-60px;margin-top:-60px;width:128px;height:128px;{% endif %}" src="{{ outfit }}" alt="player outfit"/></div>
<div style="width:64px;height:64px;border:2px solid #F1E0C6; border-radius:50px; padding:13px; margin-top:38px;margin-left:376px;position:absolute;"><img style="margin-left:{% if player.getLookType() in setting('core.outfit_images_wrong_looktypes') %}-0px;margin-top:-0px;width:64px;height:64px;{% else %}-60px;margin-top:-60px;width:128px;height:128px;{% endif %}" src="{{ outfit }}" alt="player outfit"/></div>
{% endif %}
<tr bgcolor="{{ config.vdarkborder }}">
@@ -106,6 +106,7 @@
<td>{{ house.name ~ house.town ~ house.add }}</td>
<td>
<form action="?subtopic=houses&page=view" method="post">
{{ csrf() }}
<input type="hidden" name="house" value="{{ house.name }}">
<input type="image" name="View" alt="View" src="{{ template_path }}/images/global/buttons/sbutton_view.gif" border="0" width="120">
</form>
@@ -402,7 +403,8 @@
<td>{% if player.isOnline() %}<b><span style="color: green">Online</span></b>{% endif %}</td>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('characters') }}" method=post>
<form action="{{ getLink('characters') }}" method="post">
{{ csrf() }}
<tr>
<td>
<input type="hidden" name="name" value="{{ player.getName() }}"/>

View File

@@ -155,7 +155,7 @@
{% if (item.count > 1) %}
<span class="loot_amount">{{ item.count }}</span>
{% endif %}
<a href="{{ config.monsters_items_url }}{{ item.name|title }}"><img title="{{ item.tooltip }}" src="{{ config.item_images_url }}{{ item.id }}{{ config.item_images_extension }}" class="loot_image"/></a>
<a href="{{ setting('core.monsters_items_url') }}{{ item.name|title }}"><img title="{{ item.tooltip }}" src="{{ setting('core.item_images_url') }}{{ item.id }}{{ setting('core.item_images_extension') }}" class="loot_image"/></a>
</span>
{% endfor %}
</td>

View File

@@ -52,9 +52,8 @@
});
});
</script>
{{ generateLink('?creatures', 'All', false)|raw }} - <a href="?subtopic=creatures&boss=view">Bosses</a>
<div style="float: right;"><input id="cSearch" type="text" placeholder="Search.."></div>
<table width="100%">
{{ generateLink(getLink('creatures'), 'All', false)|raw }} - <a href="?subtopic=creatures&boss=view">Bosses</a>
<table width="100%" id="creaturestb">
<thead>
<tr>
<th>Name</th>
@@ -83,7 +82,15 @@
</tbody>
</table>
{% endif %}
<script src="tools/js/jquery.min.js"></script>
<script>
$(document).ready(function () {
$('#creaturestb').DataTable();
});
</script>
<script src="tools/js/datatables.min.js"></script>
<link rel="stylesheet" href="tools/css/datatables.min.css">
{% else %}
<table width="100%">
<tr>

View File

@@ -1,7 +1,8 @@
<form method="post" action="{{ link }}">
{% if action == 'edit' %}
<input type="hidden" name="id" value="{{ id }}" />
{% endif %}
{{ csrf() }}
{% if action == 'edit' %}
<input type="hidden" name="id" value="{{ id }}" />
{% endif %}
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td bgcolor="{{ config.vdarkborder }}" class="white"><b>{% if action == 'edit' %}Edit{% else %}Add{% endif %} FAQ</b></td>
@@ -23,4 +24,4 @@
</td>
</tr>
</table>
</form>
</form>

View File

@@ -1,4 +1,5 @@
<form method="post" action="{{ link }}">
{{ csrf() }}
{% if action == 'edit_board' %}
<input type="hidden" name="id" value="{{ id }}" />
{% endif %}
@@ -44,4 +45,4 @@
</td>
</tr>
</table>
</form>
</form>

View File

@@ -1,5 +1,6 @@
<br/>
<form action="{{ getLink('forum') }}" method="post">
{{ csrf() }}
<input type="hidden" name="action" value="edit_post" />
<input type="hidden" name="id" value="{{ post_id }}" />
<input type="hidden" name="save" value="save" />
@@ -49,4 +50,4 @@
<div style="text-align:center">
<input type="submit" value="Save Post" />
</div>
</form>
</form>

View File

@@ -25,6 +25,7 @@
<input type="submit" value="Move Thread">
</form>
<form action="{{ section_link }}" method="post">
{{ csrf() }}
<input type="submit" value="Cancel">
</form>
</td>
@@ -32,4 +33,4 @@
</table>
</td>
</tr>
</table>
</table>

View File

@@ -1,4 +1,5 @@
<form action="?" method="post">
{{ csrf() }}
<input type="hidden" name="action" value="new_post" />
<input type="hidden" name="thread_id" value=" {{ thread_id }}" />
<input type="hidden" name="subtopic" value="forum" />

View File

@@ -1,4 +1,5 @@
<form action="?" method="post">
{{ csrf() }}
<input type="hidden" name="action" value="new_thread" />
<input type="hidden" name="section_id" value="{{ section_id }}" />
<input type="hidden" name="subtopic" value="forum" />
@@ -45,4 +46,4 @@
<div style="text-align:center">
<input type="submit" value="Post Thread" />
</div>
</form>
</form>

View File

@@ -24,7 +24,7 @@ Page: {{ links_to_pages|raw }}<br/>
{% set i = i + 1 %}
<td valign="top">{{ post.player_link|raw }}<br/>
{% if post.outfit is defined %}
<img style="margin-left:{% if post.player.getLookType() in config.outfit_images_wrong_looktypes %}-0px;margin-top:-0px;width:64px;height:64px;{% else %}-60px;margin-top:-60px;width:128px;height:128px;{% endif %}" src="{{ post.outfit }}" alt="player outfit"/>
<img style="margin-left:{% if post.player.getLookType() in setting('core.outfit_images_wrong_looktypes') %}-0px;margin-top:-0px;width:64px;height:64px;{% else %}-60px;margin-top:-60px;width:128px;height:128px;{% endif %}" src="{{ post.outfit }}" alt="player outfit"/>
<br />
{% endif %}
<span style="font-size: 10px">

View File

@@ -1,4 +1,5 @@
<form method="post" action="{{ link }}">
{{ csrf() }}
{% if action == 'edit' %}
<input type="hidden" name="id" value="{{ id }}" />
{% endif %}
@@ -29,4 +30,4 @@
</tr>
</table>
</form>
<br/><br/>
<br/><br/>

View File

@@ -8,6 +8,7 @@
<tr bgcolor="{{ config.darkborder }}">
<td>
<form action="?subtopic=guilds&action=accept_invite&guild={{ guild_name }}&todo=save" method="post">
{{ csrf() }}
{% set i = 0 %}
{% for player in invited_players %}
<input type="radio" name="name" id="name_{{ i }}" value="{{ player }}" /><label for="name_{{ i }}">{{ player }}</label>
@@ -24,9 +25,10 @@
<tr>
<td>
<form action="{{ getLink('guilds') ~ '/' ~ guild_name }}" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>
</td>
</tr>
</table>
</div>
</div>

View File

@@ -3,6 +3,7 @@
{% endif %}
<div style="text-align:center">
<form action="{% if action is not defined %}{{ getLink('guilds') }}{% else %}{{ action }}{% endif %}" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>
</div>
</div>

View File

@@ -1,12 +1,14 @@
<div style="text-align:center"><h2>Change guild description</h2></div>
Here you can change description of your guild.<br/>
<form enctype="multipart/form-data" action="?subtopic=guilds&guild={{ guild.getName() }}&action=change_description" method="post">
{{ csrf() }}
<input type="hidden" name="todo" value="save"/>
<textarea name="description" cols="60" rows="{{ config.guild_description_lines_limit - 1 }}">{{ guild.getCustomField('description')|raw }}</textarea><br>
(max. {{ config.guild_description_lines_limit }} lines, max. {{ config.guild_description_chars_limit }} chars) <input type="submit" value="Save description"/></form><br/>
<textarea name="description" cols="60" rows="{{ setting('core.guild_description_lines_limit') - 1 }}">{{ guild.getCustomField('description')|raw }}</textarea><br>
(max. {{ setting('core.guild_description_lines_limit') }} lines, max. {{ setting('core.guild_description_chars_limit') }} chars) <input type="submit" value="Save description"/></form><br/>
<br/>
<div style="text-align:center">
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=manager" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>
</div>

View File

@@ -1,22 +1,24 @@
<div style="text-align:center"><h2>Change guild logo</h2></div>
Here you can change logo of your guild.<br/>Actuall logo: <img src="{{ constant('GUILD_IMAGES_DIR') }}{{ guild_logo }}" height="64" width="64"><br/><br/>
<form enctype="multipart/form-data" action="?subtopic=guilds&guild={{ guild.getName() }}&action=change_logo" method="post" id="upload_form">
{{ csrf() }}
<input type="hidden" name="todo" value="save" />
<input type="hidden" name="MAX_FILE_SIZE" value="{{ max_image_size_b }}" />
Select new logo: <input name="newlogo" id="newlogo" type="file" />
<input type="submit" value="Send new logo" />
</form>
Only <b>jpg, gif, png, bmp</b> pictures. Max. size: <b>{{ config.guild_image_size_kb }} KB</b><br>
Only <b>jpg, gif, png, bmp</b> pictures. Max. size: <b>{{ setting('core.guild_image_size_kb') }} KB</b><br>
<br/>
<div style="text-align:center">
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=manager" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>
</div>
<script type="text/javascript">
$(function() {
$('#upload_form').submit(function (event) {
var max_img_size = {{ config.guild_image_size_kb * 1024 }};
var max_img_size = {{ setting('core.guild_image_size_kb') * 1024 }};
var input = document.getElementById("newlogo");
// check for browser support (may need to be modified)
if (input.files && input.files.length == 1) {

View File

@@ -1,12 +1,14 @@
<div style="text-align:center"><h2>Change guild MOTD</h2></div>
Here you can change MOTD (Message of the Day, showed in game!) of your guild.<br/>
<form enctype="multipart/form-data" action="?subtopic=guilds&guild={{ guild.getName() }}&action=change_motd" method="post">
{{ csrf() }}
<input type="hidden" name="todo" value="save"/>
<textarea name="motd" cols="60" rows="3">{{ guild.getCustomField('motd')|raw }}</textarea><br/>
(max. {{ config.guild_motd_chars_limit }} chars) <input type="submit" value="Save MOTD" /></form><br/>
(max. {{ setting('core.guild_motd_chars_limit') }} chars) <input type="submit" value="Save MOTD" /></form><br/>
<br/>
<div style="text-align:center">
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=manager" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>
</div>

View File

@@ -1,4 +1,5 @@
<form action="?subtopic=guilds&action=change_rank&guild={{ guild_name }}&todo=save" method="post">
{{ csrf() }}
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="{{ config.vdarkborder }}"><td class="white"><b>Change Rank</b></td></tr>
<tr bgcolor="{{ config.darkborder }}">
@@ -29,9 +30,10 @@
<td>
<div style="text-align:center">
<form action="?subtopic=guilds&action=show&guild={{ guild_name }}" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>
</div>
</td>
</tr>
</table>
</table>

View File

@@ -1,4 +1,5 @@
<form action="?subtopic=guilds&action=create&todo=save" method="post">
{{ csrf() }}
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td bgcolor="{{ config.vdarkborder }}" class="white"><B>Create a {{ config.lua.serverName }} Guild</b></td>
@@ -47,6 +48,7 @@
</td>
<td align="center">
<form action="?subtopic=guilds" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>
</td>
@@ -54,4 +56,4 @@
<img src="{{ template_path }}/images/general/blank.gif" width="120" height="1" border="0"><br>
</td>
</tr>
</table>
</table>

View File

@@ -14,9 +14,10 @@
<td>
<div style="text-align:center">
<form action="{{ getLink('guilds') ~ '/' ~ guild_name }}" method="post">
{{ csrf() }}
{{ include('buttons.submit.html.twig') }}
</form>
</div>
</td>
</tr>
</table>
</table>

View File

@@ -20,6 +20,7 @@
<tr>
<td>Are you sure you want delete guild <b>{{ guild.getName() }}</b>?<br/>
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=delete_guild" method="post">
{{ csrf() }}
<input type="hidden" name="todo" value="save"/>
<input type="submit" value="Yes, delete"/>
</form>
@@ -34,6 +35,7 @@
<br/>
<div style="text-align:center">
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=manager" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }}
</form>
</div>
</div>

Some files were not shown because too many files have changed in this diff Show More