feature: csrf protection

This commit is contained in:
slawkens 2023-09-16 09:23:51 +02:00
parent 046c0b5cf4
commit 0e33fd103c
72 changed files with 332 additions and 39 deletions

View File

@ -13,6 +13,9 @@ use MyAAC\Models\Player;
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'Account editor'; $title = 'Account editor';
csrfProtect();
$admin_base = ADMIN_URL . '?p=accounts'; $admin_base = ADMIN_URL . '?p=accounts';
$use_datatable = true; $use_datatable = true;
@ -289,6 +292,7 @@ else if (isset($_REQUEST['search'])) {
<div class="tab-content" id="accounts-tabContent"> <div class="tab-content" id="accounts-tabContent">
<div class="tab-pane fade active show" id="accounts-acc"> <div class="tab-pane fade active show" id="accounts-acc">
<form action="<?php echo $admin_base . ((isset($id) && $id > 0) ? '&id=' . $id : ''); ?>" method="post"> <form action="<?php echo $admin_base . ((isset($id) && $id > 0) ? '&id=' . $id : ''); ?>" method="post">
<?php csrf(); ?>
<div class="form-group row"> <div class="form-group row">
<?php if (USE_ACCOUNT_NAME): ?> <?php if (USE_ACCOUNT_NAME): ?>
<div class="col-12 col-sm-12 col-lg-4"> <div class="col-12 col-sm-12 col-lg-4">
@ -581,6 +585,7 @@ else if (isset($_REQUEST['search'])) {
<div class="row"> <div class="row">
<div class="col-6 col-lg-12"> <div class="col-6 col-lg-12">
<form action="<?php echo $admin_base; ?>" method="post"> <form action="<?php echo $admin_base; ?>" method="post">
<?php csrf(); ?>
<label for="name">Account Name:</label> <label for="name">Account Name:</label>
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<input type="text" class="form-control" name="search" value="<?php echo $search_account; ?>" maxlength="32" size="32"> <input type="text" class="form-control" name="search" value="<?php echo $search_account; ?>" maxlength="32" size="32">
@ -590,6 +595,7 @@ else if (isset($_REQUEST['search'])) {
</div> </div>
<div class="col-6 col-lg-12"> <div class="col-6 col-lg-12">
<form action="<?php echo $admin_base; ?>" method="post"> <form action="<?php echo $admin_base; ?>" method="post">
<?php csrf(); ?>
<label for="name">Account ID:</label> <label for="name">Account ID:</label>
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<input type="text" class="form-control" name="id" value="" maxlength="32" size="32"> <input type="text" class="form-control" name="id" value="" maxlength="32" size="32">

View File

@ -13,12 +13,15 @@ use MyAAC\Models\Changelog as ModelsChangelog;
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'Changelog';
csrfProtect();
if (!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin()) { if (!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin()) {
echo 'Access denied.'; echo 'Access denied.';
return; return;
} }
$title = 'Changelog';
$use_datatable = true; $use_datatable = true;
const CL_LIMIT = 600; // maximum changelog body length const CL_LIMIT = 600; // maximum changelog body length
?> ?>

View File

@ -10,6 +10,8 @@
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'Dashboard'; $title = 'Dashboard';
csrfProtect();
if (isset($_GET['clear_cache'])) { if (isset($_GET['clear_cache'])) {
if (clearCache()) { if (clearCache()) {
success('Cache cleared.'); success('Cache cleared.');

View File

@ -10,6 +10,8 @@
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'Login'; $title = 'Login';
csrfProtect();
require PAGES . 'account/login.php'; require PAGES . 'account/login.php';
if ($logged) { if ($logged) {
header('Location: ' . (admin() ? ADMIN_URL : BASE_URL)); header('Location: ' . (admin() ? ADMIN_URL : BASE_URL));

View File

@ -10,6 +10,8 @@
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'Mailer'; $title = 'Mailer';
csrfProtect();
if (!hasFlag(FLAG_CONTENT_MAILER) && !superAdmin()) { if (!hasFlag(FLAG_CONTENT_MAILER) && !superAdmin()) {
echo 'Access denied.'; echo 'Access denied.';
return; return;

View File

@ -16,6 +16,8 @@ defined('MYAAC') or die('Direct access not allowed!');
$title = 'Mass Account Actions'; $title = 'Mass Account Actions';
csrfProtect();
$hasCoinsColumn = $db->hasColumn('accounts', 'coins'); $hasCoinsColumn = $db->hasColumn('accounts', 'coins');
$hasPointsColumn = $db->hasColumn('accounts', 'premium_points'); $hasPointsColumn = $db->hasColumn('accounts', 'premium_points');
$freePremium = $config['lua']['freePremium']; $freePremium = $config['lua']['freePremium'];

View File

@ -16,6 +16,8 @@ defined('MYAAC') or die('Direct access not allowed!');
$title = 'Mass Teleport Actions'; $title = 'Mass Teleport Actions';
csrfProtect();
function admin_teleport_position($x, $y, $z) { function admin_teleport_position($x, $y, $z) {
if (!Player::query()->update([ if (!Player::query()->update([
'posx' => $x, 'posy' => $y, 'posz' => $z 'posx' => $x, 'posy' => $y, 'posz' => $z

View File

@ -13,6 +13,8 @@ use MyAAC\Models\Menu;
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'Menus'; $title = 'Menus';
csrfProtect();
if (!hasFlag(FLAG_CONTENT_MENUS) && !superAdmin()) { if (!hasFlag(FLAG_CONTENT_MENUS) && !superAdmin()) {
echo 'Access denied.'; echo 'Access denied.';
return; return;
@ -93,6 +95,7 @@ if (isset($_REQUEST['template'])) {
</p> </p>
<?php if (isset($config['menu_default_color'])) {?> <?php if (isset($config['menu_default_color'])) {?>
<form method="post" action="?p=menus&reset_colors" onsubmit="return confirm('Do you really want to reset colors?');"> <form method="post" action="?p=menus&reset_colors" onsubmit="return confirm('Do you really want to reset colors?');">
<?php csrf(); ?>
<input type="hidden" name="template" value="<?php echo $template ?>"/> <input type="hidden" name="template" value="<?php echo $template ?>"/>
<button type="submit" class="btn btn-danger">Reset Colors to default</button> <button type="submit" class="btn btn-danger">Reset Colors to default</button>
</form> </form>
@ -112,6 +115,7 @@ if (isset($_REQUEST['template'])) {
$last_id = array(); $last_id = array();
?> ?>
<form method="post" id="menus-form" action="?p=menus"> <form method="post" id="menus-form" action="?p=menus">
<?php csrf(); ?>
<input type="hidden" name="template" value="<?php echo $template ?>"/> <input type="hidden" name="template" value="<?php echo $template ?>"/>
<button type="submit" class="btn btn-info">Save</button><br/><br/> <button type="submit" class="btn btn-info">Save</button><br/><br/>
<div class="row"> <div class="row">

View File

@ -1,6 +1,7 @@
<div class="col-12 col-md-6"> <div class="col-12 col-md-6">
<div class="card card-warning card-outline"> <div class="card card-warning card-outline">
<form action="?p=dashboard&maintenance" method="post" class="form-horizontal"> <form action="?p=dashboard&maintenance" method="post" class="form-horizontal">
{{ csrf() }}
<div class="card-header"> <div class="card-header">
<span class="m-0">Website Status<span class="float-right"> <span class="m-0">Website Status<span class="float-right">
<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success"> <div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">

View File

@ -9,12 +9,15 @@
*/ */
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'News Panel';
csrfProtect();
$use_datatable = true;
require_once LIBS . 'forum.php'; require_once LIBS . 'forum.php';
require_once LIBS . 'news.php'; require_once LIBS . 'news.php';
$title = 'News Panel';
$use_datatable = true;
if (!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin()) { if (!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin()) {
echo 'Access denied.'; echo 'Access denied.';
return; return;

View File

@ -13,6 +13,8 @@ use MyAAC\Models\Notepad as ModelsNotepad;
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'Notepad'; $title = 'Notepad';
csrfProtect();
/** /**
* @var $account_logged OTS_Account * @var $account_logged OTS_Account
*/ */

View File

@ -13,6 +13,9 @@ use MyAAC\Models\Player;
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'Player editor'; $title = 'Player editor';
csrfProtect();
$player_base = ADMIN_URL . '?p=players'; $player_base = ADMIN_URL . '?p=players';
$use_datatable = true; $use_datatable = true;
@ -373,6 +376,7 @@ else if (isset($_REQUEST['search'])) {
</ul> </ul>
</div> </div>
<form action="<?php echo $player_base . ((isset($id) && $id > 0) ? '&id=' . $id : ''); ?>" method="post"> <form action="<?php echo $player_base . ((isset($id) && $id > 0) ? '&id=' . $id : ''); ?>" method="post">
<?php csrf(); ?>
<div class="card-body"> <div class="card-body">
<div class="tab-content" id="tabs-tabContent"> <div class="tab-content" id="tabs-tabContent">
<div class="tab-pane fade active show" id="tabs-home"> <div class="tab-pane fade active show" id="tabs-home">
@ -870,6 +874,7 @@ else if (isset($_REQUEST['search'])) {
<div class="card-body row"> <div class="card-body row">
<div class="col-6 col-lg-12"> <div class="col-6 col-lg-12">
<form action="<?php echo $player_base; ?>" method="post"> <form action="<?php echo $player_base; ?>" method="post">
<?php csrf(); ?>
<label for="name">Player Name:</label> <label for="name">Player Name:</label>
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<input type="text" class="form-control" name="search" value="<?php echo $search_player; ?>" maxlength="32" size="32"> <input type="text" class="form-control" name="search" value="<?php echo $search_player; ?>" maxlength="32" size="32">
@ -879,6 +884,7 @@ else if (isset($_REQUEST['search'])) {
</div> </div>
<div class="col-6 col-lg-12"> <div class="col-6 col-lg-12">
<form action="<?php echo $player_base; ?>" method="post"> <form action="<?php echo $player_base; ?>" method="post">
<?php csrf(); ?>
<label for="name">Player ID:</label> <label for="name">Player ID:</label>
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<input type="text" class="form-control" name="id" value="" maxlength="32" size="32"> <input type="text" class="form-control" name="id" value="" maxlength="32" size="32">

View File

@ -9,6 +9,9 @@
*/ */
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'Plugin manager'; $title = 'Plugin manager';
csrfProtect();
$use_datatable = true; $use_datatable = true;
require_once LIBS . 'plugins.php'; require_once LIBS . 'plugins.php';

View File

@ -16,6 +16,8 @@ if(!admin()) {
die('Access denied.'); die('Access denied.');
} }
csrfProtect();
if (!isset($_REQUEST['plugin'])) { if (!isset($_REQUEST['plugin'])) {
http_response_code(500); http_response_code(500);
die('Please enter plugin name.'); die('Please enter plugin name.');

View File

@ -9,6 +9,7 @@
*/ */
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
use MyAAC\CsrfToken;
use MyAAC\Models\Config; use MyAAC\Models\Config;
use MyAAC\Models\Guild; use MyAAC\Models\Guild;
use MyAAC\Models\House; use MyAAC\Models\House;
@ -1045,6 +1046,28 @@ function unsetSession($key) {
unset($_SESSION[setting('core.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) { function getTopPlayers($limit = 5) {
global $db; global $db;

View File

@ -7,6 +7,9 @@
* @copyright 2019 MyAAC * @copyright 2019 MyAAC
* @link https://my-aac.org * @link https://my-aac.org
*/ */
use MyAAC\CsrfToken;
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
if(!isset($config['installed']) || !$config['installed']) { if(!isset($config['installed']) || !$config['installed']) {
@ -132,6 +135,12 @@ require_once LIBS . 'Settings.php';
$settings = Settings::getInstance(); $settings = Settings::getInstance();
$settings->load(); $settings->load();
// csrf protection
$token = getSession('csrf_token');
if (!isset($token)) {
CsrfToken::generate();
}
// deprecated config values // deprecated config values
require_once SYSTEM . 'compat/config.php'; require_once SYSTEM . 'compat/config.php';

View File

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

View File

@ -92,18 +92,22 @@ else
<tr> <tr>
<td width="30">&nbsp;</td> <td width="30">&nbsp;</td>
<td align=left> <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> <INPUT TYPE=image NAME="I Agree" SRC="' . $template_path . '/images/global/buttons/sbutton_iagree.gif" BORDER=0 WIDTH=120 HEIGHT=17>
</form> </form>
</td> </td>
<td align=left> <td align=left>
<form action="' . getLink('account/email') . '" method="post"> <form action="' . getLink('account/email') . '" method="post">
' . csrf() . '
<input type="hidden" name="emailchangecancel" value=1 > <input type="hidden" name="emailchangecancel" value=1 >
' . $twig->render('buttons.cancel.html.twig') . ' ' . $twig->render('buttons.cancel.html.twig') . '
</form> </form>
</td> </td>
<td align=right> <td align=right>
<form action="?subtopic=accountmanagement" method="post" > <form action="?subtopic=accountmanagement" method="post" >
' . csrf() . '
' . $twig->render('buttons.back.html.twig') . ' ' . $twig->render('buttons.back.html.twig') . '
</form> </form>
</td> </td>
@ -125,6 +129,7 @@ else
<td> <td>
<table border="0" cellspacing="0" cellpadding="0" > <table border="0" cellspacing="0" cellpadding="0" >
<form action="' .getLink('account/email') . '" method="post" > <form action="' .getLink('account/email') . '" method="post" >
' . csrf() . '
<tr> <tr>
<td style="border:0px;" > <td style="border:0px;" >
<input type="hidden" name="emailchangecancel" value="1" > <input type="hidden" name="emailchangecancel" value="1" >
@ -137,6 +142,7 @@ else
<td> <td>
<table border="0" cellspacing="0" cellpadding="0" > <table border="0" cellspacing="0" cellpadding="0" >
<form action="' . getLink('account/manage') . '" method="post" > <form action="' . getLink('account/manage') . '" method="post" >
' . csrf() . '
<tr> <tr>
<td style="border:0px;" > <td style="border:0px;" >
' . $twig->render('buttons.back.html.twig') . ' ' . $twig->render('buttons.back.html.twig') . '

View File

@ -65,6 +65,12 @@ return [
'default' => false, 'default' => false,
'is_config' => true, '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' => [ 'google_analytics_id' => [
'name' => 'Google Analytics ID', 'name' => 'Google Analytics ID',
'type' => 'text', 'type' => 'text',

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

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

View File

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

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 {{ setting('core.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"> <form action="{{ getLink('account/email') }}" method="post">
{{ csrf() }}
<div class="TableContainer"> <div class="TableContainer">
<table class="Table1" cellpadding="0" cellspacing="0"> <table class="Table1" cellpadding="0" cellspacing="0">
<div class="CaptionContainer"> <div class="CaptionContainer">
@ -58,6 +59,7 @@ Please enter your password and the new email address. Make sure that you enter a
<td> <td>
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('account/manage') }}" method="post"> <form action="{{ getLink('account/manage') }}" method="post">
{{ csrf() }}
<tr> <tr>
<td style="border:0px;"> <td style="border:0px;">
{{ include('buttons.back.html.twig') }} {{ include('buttons.back.html.twig') }}

View File

@ -1,6 +1,7 @@
To change a name of character select player and choose a new name.<br/> 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/> <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"> <form action="{{ getLink('account/character/name') }}" method="post">
{{ csrf() }}
<input type="hidden" name="changenamesave" value="1"> <input type="hidden" name="changenamesave" value="1">
<div class="TableContainer"> <div class="TableContainer">
<table class="Table1" cellpadding="0" cellspacing="0"> <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> <td>
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('account/manage') }}" method="post"> <form action="{{ getLink('account/manage') }}" method="post">
{{ csrf() }}
<tr> <tr>
<td style="border:0px;"> <td style="border:0px;">
{{ include('buttons.back.html.twig') }} {{ 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/> Please enter your current password and a new password. For your security, please enter the new password twice.<br/>
<br/> <br/>
<form action="{{ getLink('account/password') }}" method="post"> <form action="{{ getLink('account/password') }}" method="post">
{{ csrf() }}
<div class="TableContainer"> <div class="TableContainer">
<table class="Table1" cellpadding="0" cellspacing="0"> <table class="Table1" cellpadding="0" cellspacing="0">
<div class="CaptionContainer"> <div class="CaptionContainer">
@ -66,6 +67,7 @@ Please enter your current password and a new password. For your security, please
<td> <td>
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('account/manage') }}" method="post"> <form action="{{ getLink('account/manage') }}" method="post">
{{ csrf() }}
<tr> <tr>
<td style="border:0px;"> <td style="border:0px;">
{{ include('buttons.back.html.twig') }} {{ include('buttons.back.html.twig') }}

View File

@ -1,6 +1,7 @@
To change a sex of character select player and choose a new sex.<br/> 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/> <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"> <form action="{{ getLink('account/character/sex') }}" method="post">
{{ csrf() }}
<input type="hidden" name="changesexsave" value="1"/> <input type="hidden" name="changesexsave" value="1"/>
<div class="TableContainer"> <div class="TableContainer">
<table class="Table1" cellpadding="0" cellspacing="0"> <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> <td>
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('account/manage') }}" method="post"> <form action="{{ getLink('account/manage') }}" method="post">
{{ csrf() }}
<tr> <tr>
<td style="border:0px;" > <td style="border:0px;" >
{{ include('buttons.back.html.twig') }} {{ include('buttons.back.html.twig') }}

View File

@ -1,5 +1,6 @@
{{ hook('HOOK_ACCOUNT_CREATE_BEFORE_FORM') }} {{ hook('HOOK_ACCOUNT_CREATE_BEFORE_FORM') }}
<form action="{{ getLink('account/create') }}" method="post" id="createaccount"> <form action="{{ getLink('account/create') }}" method="post" id="createaccount">
{{ csrf() }}
<div class="TableContainer" > <div class="TableContainer" >
<table class="Table5" cellpadding="0" cellspacing="0" > <table class="Table5" cellpadding="0" cellspacing="0" >
<div class="CaptionContainer" > <div class="CaptionContainer" >

View File

@ -7,6 +7,7 @@ In any case the name must not violate the naming conventions stated in the <a hr
{% endif %} {% endif %}
<br/><br/> <br/><br/>
<form action="{{ getLink('account/character/create') }}" method="post"> <form action="{{ getLink('account/character/create') }}" method="post">
{{ csrf() }}
<input type="hidden" name="save" value="1"> <input type="hidden" name="save" value="1">
<div class="TableContainer"> <div class="TableContainer">
<table class="Table3" cellpadding="0" cellspacing="0"> <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> <td>
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('account/manage') }}" method="post"> <form action="{{ getLink('account/manage') }}" method="post">
{{ csrf() }}
<tr> <tr>
<td style="border:0px;"> <td style="border:0px;">
{{ include('buttons.back.html.twig') }} {{ 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/> To delete a character enter the name of the character and your password.<br/><br/>
<form action="{{ getLink('account/character/delete') }}" method="post"> <form action="{{ getLink('account/character/delete') }}" method="post">
{{ csrf() }}
<input type="hidden" name="deletecharactersave" value="1"/> <input type="hidden" name="deletecharactersave" value="1"/>
<div class="TableContainer"> <div class="TableContainer">
<table class="Table1" cellpadding="0" cellspacing="0" > <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> <td>
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('account/manage') }}" method="post"> <form action="{{ getLink('account/manage') }}" method="post">
{{ csrf() }}
<tr> <tr>
<td style="border:0px;"> <td style="border:0px;">
{{ include('buttons.back.html.twig') }} {{ include('buttons.back.html.twig') }}

View File

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

View File

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

View File

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

View File

@ -68,6 +68,7 @@
<div style="text-align:center"> <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/> 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"> <form action="{{ getLink('account/register') }}" method="post">
{{ csrf() }}
{% set button_name = 'Register Account' %} {% set button_name = 'Register Account' %}
{% include('buttons.base.html.twig') %} {% include('buttons.base.html.twig') %}
</form> </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! 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"> <form action="{{ getLink('account/email') }}" method="post">
{{ csrf() }}
{% set button_name = 'Edit' %} {% set button_name = 'Edit' %}
{% include('buttons.base.html.twig') %} {% include('buttons.base.html.twig') %}
</form> </form>
@ -99,6 +101,7 @@
<td style="width: 90px;">Email Address:</td> <td style="width: 90px;">Email Address:</td>
<td>{{ account_email ~ email_change }} <td>{{ account_email ~ email_change }}
<form action="{{ getLink('account/email') }}" method="post"> <form action="{{ getLink('account/email') }}" method="post">
{{ csrf() }}
{% set button_name = 'Change Email' %} {% set button_name = 'Change Email' %}
{% include('buttons.base.html.twig') %} {% include('buttons.base.html.twig') %}
</form> </form>
@ -137,6 +140,7 @@
</tr> </tr>
</table> </table>
<form action="{{ getLink('account/info') }}" method="post"> <form action="{{ getLink('account/info') }}" method="post">
{{ csrf() }}
{% set button_name = 'Change Info' %} {% set button_name = 'Change Info' %}
{% include('buttons.base.html.twig') %} {% include('buttons.base.html.twig') %}
</form> </form>
@ -188,6 +192,7 @@
<tr> <tr>
<td> <td>
<form action="{{ getLink('account/character/create') }}" method="post" > <form action="{{ getLink('account/character/create') }}" method="post" >
{{ csrf() }}
{% set button_name = 'Create Character' %} {% set button_name = 'Create Character' %}
{% include('buttons.base.html.twig') %} {% include('buttons.base.html.twig') %}
</form> </form>
@ -195,6 +200,7 @@
{% if setting('core.account_change_character_name') %} {% if setting('core.account_change_character_name') %}
<td> <td>
<form action="{{ getLink('account/character/name') }}" method="post" > <form action="{{ getLink('account/character/name') }}" method="post" >
{{ csrf() }}
{% set button_name = 'Change Name' %} {% set button_name = 'Change Name' %}
{% include('buttons.base.html.twig') %} {% include('buttons.base.html.twig') %}
</form> </form>
@ -203,6 +209,7 @@
{% if setting('core.account_change_character_sex') %} {% if setting('core.account_change_character_sex') %}
<td> <td>
<form action="{{ getLink('account/character/sex') }}" method="post" > <form action="{{ getLink('account/character/sex') }}" method="post" >
{{ csrf() }}
{% set button_name = 'Change Sex' %} {% set button_name = 'Change Sex' %}
{% include('buttons.base.html.twig') %} {% include('buttons.base.html.twig') %}
</form> </form>
@ -210,6 +217,7 @@
{% endif %} {% endif %}
<td> <td>
<form action="{{ getLink('account/character/delete') }}" method="post"> <form action="{{ getLink('account/character/delete') }}" method="post">
{{ csrf() }}
{% set button_name = 'Delete Character' %} {% set button_name = 'Delete Character' %}
{% include('buttons.base.html.twig') %} {% include('buttons.base.html.twig') %}
</form> </form>

View File

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

View File

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

View File

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

View File

@ -4,6 +4,7 @@
</div> </div>
<div class="card-body"> <div class="card-body">
<form method="post" action="?p=menus"> <form method="post" action="?p=menus">
{{ csrf() }}
<p>Please choose template in which you want to edit menu items.</p> <p>Please choose template in which you want to edit menu items.</p>
<div class="col-md-6"> <div class="col-md-6">
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">

View File

@ -4,6 +4,7 @@
<h5 class="m-0">{% if action == 'edit' %}Edit{% else %}Add{% endif %} news</h5> <h5 class="m-0">{% if action == 'edit' %}Edit{% else %}Add{% endif %} news</h5>
</div> </div>
<form id="form" role="form" method="post" action="{{ news_link_form }}"> <form id="form" role="form" method="post" action="{{ news_link_form }}">
{{ csrf() }}
<div class="card-body " id="page-edit-table"> <div class="card-body " id="page-edit-table">
{% if action == 'edit' %} {% if action == 'edit' %}
<input type="hidden" name="id" value="{{ news_id }}"/> <input type="hidden" name="id" value="{{ news_id }}"/>

View File

@ -3,6 +3,7 @@
<h5 class="m-0">Notepad</h5> <h5 class="m-0">Notepad</h5>
</div> </div>
<form method="post"> <form method="post">
{{ csrf() }}
<div class="card-body"> <div class="card-body">
<div class="form-group"> <div class="form-group">
<label>This is your personal notepad. Be sure to save it each time you modify something.</label> <label>This is your personal notepad. Be sure to save it each time you modify something.</label>

View File

@ -4,6 +4,7 @@
<h5 class="m-0">{% if action == 'edit' %}Edit{% else %}Add{% endif %} page</h5> <h5 class="m-0">{% if action == 'edit' %}Edit{% else %}Add{% endif %} page</h5>
</div> </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" action="?p=pages&action={% if action == 'edit' %}edit{% else %}new{% endif %}">
{{ csrf() }}
{% if action == 'edit' %} {% if action == 'edit' %}
<input type="hidden" name="id" value="{{ id }}"/> <input type="hidden" name="id" value="{{ id }}"/>
{% endif %} {% endif %}

View File

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

View File

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

View File

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

View File

@ -106,6 +106,7 @@
<td>{{ house.name ~ house.town ~ house.add }}</td> <td>{{ house.name ~ house.town ~ house.add }}</td>
<td> <td>
<form action="?subtopic=houses&page=view" method="post"> <form action="?subtopic=houses&page=view" method="post">
{{ csrf() }}
<input type="hidden" name="house" value="{{ house.name }}"> <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"> <input type="image" name="View" alt="View" src="{{ template_path }}/images/global/buttons/sbutton_view.gif" border="0" width="120">
</form> </form>
@ -402,7 +403,8 @@
<td>{% if player.isOnline() %}<b><span style="color: green">Online</span></b>{% endif %}</td> <td>{% if player.isOnline() %}<b><span style="color: green">Online</span></b>{% endif %}</td>
<td> <td>
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<form action="{{ getLink('characters') }}" method=post> <form action="{{ getLink('characters') }}" method="post">
{{ csrf() }}
<tr> <tr>
<td> <td>
<input type="hidden" name="name" value="{{ player.getName() }}"/> <input type="hidden" name="name" value="{{ player.getName() }}"/>

View File

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

View File

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

View File

@ -1,5 +1,6 @@
<br/> <br/>
<form action="{{ getLink('forum') }}" method="post"> <form action="{{ getLink('forum') }}" method="post">
{{ csrf() }}
<input type="hidden" name="action" value="edit_post" /> <input type="hidden" name="action" value="edit_post" />
<input type="hidden" name="id" value="{{ post_id }}" /> <input type="hidden" name="id" value="{{ post_id }}" />
<input type="hidden" name="save" value="save" /> <input type="hidden" name="save" value="save" />

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
<div style="text-align:center"><h2>Change guild logo</h2></div> <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/> 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"> <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="todo" value="save" />
<input type="hidden" name="MAX_FILE_SIZE" value="{{ max_image_size_b }}" /> <input type="hidden" name="MAX_FILE_SIZE" value="{{ max_image_size_b }}" />
Select new logo: <input name="newlogo" id="newlogo" type="file" /> Select new logo: <input name="newlogo" id="newlogo" type="file" />
@ -10,6 +11,7 @@ Only <b>jpg, gif, png, bmp</b> pictures. Max. size: <b>{{ setting('core.guild_im
<br/> <br/>
<div style="text-align:center"> <div style="text-align:center">
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=manager" method="post"> <form action="?subtopic=guilds&guild={{ guild.getName() }}&action=manager" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }} {{ include('buttons.back.html.twig') }}
</form> </form>
</div> </div>

View File

@ -1,12 +1,14 @@
<div style="text-align:center"><h2>Change guild MOTD</h2></div> <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/> 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"> <form enctype="multipart/form-data" action="?subtopic=guilds&guild={{ guild.getName() }}&action=change_motd" method="post">
{{ csrf() }}
<input type="hidden" name="todo" value="save"/> <input type="hidden" name="todo" value="save"/>
<textarea name="motd" cols="60" rows="3">{{ guild.getCustomField('motd')|raw }}</textarea><br/> <textarea name="motd" cols="60" rows="3">{{ guild.getCustomField('motd')|raw }}</textarea><br/>
(max. {{ setting('core.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/> <br/>
<div style="text-align:center"> <div style="text-align:center">
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=manager" method="post"> <form action="?subtopic=guilds&guild={{ guild.getName() }}&action=manager" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }} {{ include('buttons.back.html.twig') }}
</form> </form>
</div> </div>

View File

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

View File

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

View File

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

View File

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

View File

@ -8,12 +8,14 @@
<tr> <tr>
<td align="right" width="50%"> <td align="right" width="50%">
<form action="?subtopic=guilds&action=delete_invite&guild={{ guild_name }}&name={{ player_name }}&todo=save" method="post"> <form action="?subtopic=guilds&action=delete_invite&guild={{ guild_name }}&name={{ player_name }}&todo=save" method="post">
{{ csrf() }}
{{ include('buttons.submit.html.twig') }} {{ include('buttons.submit.html.twig') }}
</form> </form>
</td> </td>
<td style="width: 10px; "></td> <td style="width: 10px; "></td>
<td> <td>
<form action="?subtopic=guilds&action=show&guild={{ guild_name }}" method="post"> <form action="?subtopic=guilds&action=show&guild={{ guild_name }}" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }} {{ include('buttons.back.html.twig') }}
</form> </form>
</td> </td>

View File

@ -1,4 +1,5 @@
<form action="?subtopic=guilds&action=invite&guild={{ guild_name }}&todo=save" method="post"> <form action="?subtopic=guilds&action=invite&guild={{ guild_name }}&todo=save" method="post">
{{ csrf() }}
Invite player with name:&nbsp;&nbsp;<input type="text" name="name">&nbsp;&nbsp;&nbsp;&nbsp; Invite player with name:&nbsp;&nbsp;<input type="text" name="name">&nbsp;&nbsp;&nbsp;&nbsp;
{{ include('buttons.submit.html.twig') }} {{ include('buttons.submit.html.twig') }}
</form> </form>

View File

@ -8,12 +8,14 @@
<tr> <tr>
<td align="right" width="50%"> <td align="right" width="50%">
<form action="?subtopic=guilds&action=kick_player&guild={{ guild_name }}&name={{ player_name }}&todo=save" method="post"> <form action="?subtopic=guilds&action=kick_player&guild={{ guild_name }}&name={{ player_name }}&todo=save" method="post">
{{ csrf() }}
{{ include('buttons.submit.html.twig') }} {{ include('buttons.submit.html.twig') }}
</form> </form>
</td> </td>
<td style="width: 10px;"></td> <td style="width: 10px;"></td>
<td> <td>
<form action="{{ getLink('guilds') ~ '/' ~ guild_name }}" method="post"> <form action="{{ getLink('guilds') ~ '/' ~ guild_name }}" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }} {{ include('buttons.back.html.twig') }}
</form> </form>
</td> </td>

View File

@ -1,4 +1,5 @@
<form action="?subtopic=guilds&action=leave_guild&guild={{ guild_name }}&todo=save" METHOD="post"> <form action="?subtopic=guilds&action=leave_guild&guild={{ guild_name }}&todo=save" METHOD="post">
{{ csrf() }}
<table border="0" cellspacing="1" cellpadding="4" width="100%"> <table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="{{ config.vdarkborder }}"> <tr bgcolor="{{ config.vdarkborder }}">
<td class="white"><b>Leave guild</b></td></tr> <td class="white"><b>Leave guild</b></td></tr>
@ -27,6 +28,7 @@
</form> </form>
<td> <td>
<form action="?subtopic=guilds&action=show&guild={{ guild_name }}" method="post"> <form action="?subtopic=guilds&action=show&guild={{ guild_name }}" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }} {{ include('buttons.back.html.twig') }}
</form> </form>
</td> </td>

View File

@ -61,6 +61,7 @@
<tr> <tr>
<td style="border:0;"> <td style="border:0;">
<form action="{{ guild.link }}" method="post"> <form action="{{ guild.link }}" method="post">
{{ csrf() }}
{{ include('buttons.view.html.twig') }} {{ include('buttons.view.html.twig') }}
</form> </form>
</td> </td>
@ -82,12 +83,11 @@
<td> <td>
<table border="0" cellpadding="0" cellspacing="0" width="100%"> <table border="0" cellpadding="0" cellspacing="0" width="100%">
<form action="?subtopic=guilds&action=create" method="post"> <form action="?subtopic=guilds&action=create" method="post">
<form action="?subtopic=guilds&action=create" method="post"> {{ csrf() }}
{% set button_name = 'Found Guild' %} {% set button_name = 'Found Guild' %}
{% set button_image = '_sbutton_foundguild' %} {% set button_image = '_sbutton_foundguild' %}
{% include('buttons.base.html.twig') %} {% include('buttons.base.html.twig') %}
</form> </form>
</form>
</table> </table>
</td> </td>
{% endif %} {% endif %}
@ -128,6 +128,7 @@
{% if logged %} {% if logged %}
No guild found that suits your needs? No guild found that suits your needs?
<form action="?subtopic=guilds&action=create" method="post"> <form action="?subtopic=guilds&action=create" method="post">
{{ csrf() }}
{% set button_name = 'Found Guild' %} {% set button_name = 'Found Guild' %}
{% set button_image = '_sbutton_foundguild' %} {% set button_image = '_sbutton_foundguild' %}
{% include('buttons.base.html.twig') %} {% include('buttons.base.html.twig') %}
@ -136,6 +137,7 @@
<b>Before you can create a guild you must login.</b> <b>Before you can create a guild you must login.</b>
<br/> <br/>
<form action="?subtopic=accountmanagement&redirect={{ getLink('guilds') }}" method="post"> <form action="?subtopic=accountmanagement&redirect={{ getLink('guilds') }}" method="post">
{{ csrf() }}
{% include('buttons.login.html.twig') %} {% include('buttons.login.html.twig') %}
</form> </form>
{% endif %} {% endif %}

View File

@ -76,6 +76,7 @@ Here you can change names of ranks, delete and add ranks, pass leadership to oth
<td width="120" valign="top">New rank name:</td> <td width="120" valign="top">New rank name:</td>
<td> <td>
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=add_rank" method="post"> <form action="?subtopic=guilds&guild={{ guild.getName() }}&action=add_rank" method="post">
{{ csrf() }}
<input type="text" name="rank_name" size="20"/> <input type="text" name="rank_name" size="20"/>
<input type="submit" value="Add"/> <input type="submit" value="Add"/>
</form> </form>
@ -89,6 +90,7 @@ Here you can change names of ranks, delete and add ranks, pass leadership to oth
</div> </div>
<div style="text-align:center"><h3>Change rank names and levels</h3></div> <div style="text-align:center"><h3>Change rank names and levels</h3></div>
<form action="?subtopic=guilds&action=save_ranks&guild={{ guild.getName() }}" method="post"> <form action="?subtopic=guilds&action=save_ranks&guild={{ guild.getName() }}" method="post">
{{ csrf() }}
<table style="clear:both" border="0" cellpadding="0" cellspacing="0" width="100%"> <table style="clear:both" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="{{ config.vdarkborder }}"> <tr bgcolor="{{ config.vdarkborder }}">
<td rowspan="2" width="120" align="center"> <td rowspan="2" width="120" align="center">
@ -163,6 +165,7 @@ Here you can change names of ranks, delete and add ranks, pass leadership to oth
<br/> <br/>
<div style="text-align:center"> <div style="text-align:center">
<form action="?subtopic=guilds&action=show&guild={{ guild.getName() }}" method="post"> <form action="?subtopic=guilds&action=show&guild={{ guild.getName() }}" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }} {{ include('buttons.back.html.twig') }}
</form> </form>
</div> </div>

View File

@ -20,6 +20,7 @@
<tr> <tr>
<td>Pass leadership to: </b><br> <td>Pass leadership to: </b><br>
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=pass_leadership" method="post"> <form action="?subtopic=guilds&guild={{ guild.getName() }}&action=pass_leadership" method="post">
{{ csrf() }}
<input type="hidden" name="todo" value="save"/> <input type="hidden" name="todo" value="save"/>
<input type="text" size="40" name="player"/> <input type="text" size="40" name="player"/>
<input type="submit" value="Save"> <input type="submit" value="Save">
@ -35,6 +36,7 @@
<br/> <br/>
<div style="text-align:center"> <div style="text-align:center">
<form action="?subtopic=guilds&guild={{ guild.getName() }}&action=manager" method="post"> <form action="?subtopic=guilds&guild={{ guild.getName() }}&action=manager" method="post">
{{ csrf() }}
{{ include('buttons.back.html.twig') }} {{ include('buttons.back.html.twig') }}
</form> </form>
</div> </div>

View File

@ -142,6 +142,7 @@
<td> <td>
{% set playerName = player.getName() %} {% set playerName = player.getName() %}
<form action="?subtopic=guilds&action=change_nick&name={{ playerName }}&guild={{ guild_name }}" method="post"> <form action="?subtopic=guilds&action=change_nick&name={{ playerName }}&guild={{ guild_name }}" method="post">
{{ csrf() }}
{{ getPlayerLink(playerName, true)|raw }} {{ getPlayerLink(playerName, true)|raw }}
{% set showGuildNick = false %} {% set showGuildNick = false %}
@ -290,6 +291,7 @@
<tr> <tr>
{% if not logged %} {% if not logged %}
<form action="?subtopic=accountmanagement&redirect={{ getGuildLink(guild_name|url_encode, false) }}" method="post"> <form action="?subtopic=accountmanagement&redirect={{ getGuildLink(guild_name|url_encode, false) }}" method="post">
{{ csrf() }}
<td> <td>
{{ include('buttons.login.html.twig') }} {{ include('buttons.login.html.twig') }}
</td> </td>
@ -297,6 +299,7 @@
{% else %} {% else %}
{% if show_accept_invite > 0 %} {% if show_accept_invite > 0 %}
<form action="?subtopic=guilds&action=accept_invite&guild={{ guild_name|url_encode }}" method="post"> <form action="?subtopic=guilds&action=accept_invite&guild={{ guild_name|url_encode }}" method="post">
{{ csrf() }}
<td> <td>
<input type="image" name="Accept Invite" alt="Accept Invite" src="{{ template_path }}/images/global/buttons/sbutton_acceptinvite.png" style="width: 120px; height: 20px;"> <input type="image" name="Accept Invite" alt="Accept Invite" src="{{ template_path }}/images/global/buttons/sbutton_acceptinvite.png" style="width: 120px; height: 20px;">
</td> </td>
@ -305,6 +308,7 @@
{% if isVice %} {% if isVice %}
<form action="?subtopic=guilds&action=invite&guild={{ guild_name|url_encode }}" method="post"> <form action="?subtopic=guilds&action=invite&guild={{ guild_name|url_encode }}" method="post">
{{ csrf() }}
<td> <td>
{% set button_name = 'Invite Character' %} {% set button_name = 'Invite Character' %}
{% set button_image = '_sbutton_invitecharacter' %} {% set button_image = '_sbutton_invitecharacter' %}
@ -313,6 +317,7 @@
</form> </form>
<form action="?subtopic=guilds&action=change_rank&guild={{ guild_name|url_encode }}" method="post"> <form action="?subtopic=guilds&action=change_rank&guild={{ guild_name|url_encode }}" method="post">
{{ csrf() }}
<td> <td>
{% set button_name = 'Edit Ranks' %} {% set button_name = 'Edit Ranks' %}
{% set button_image = '_sbutton_editranks' %} {% set button_image = '_sbutton_editranks' %}
@ -323,6 +328,7 @@
{% if players_from_account_in_guild|length > 0 %} {% if players_from_account_in_guild|length > 0 %}
<form action="?subtopic=guilds&action=leave_guild&guild={{ guild_name|url_encode }}" method="post"> <form action="?subtopic=guilds&action=leave_guild&guild={{ guild_name|url_encode }}" method="post">
{{ csrf() }}
<td> <td>
{% set button_name = 'Leave Guild' %} {% set button_name = 'Leave Guild' %}
{% set button_image = '_sbutton_leaveguild' %} {% set button_image = '_sbutton_leaveguild' %}
@ -333,6 +339,7 @@
{% endif %} {% endif %}
<form action="{{ getLink('guilds') }}" method="post"> <form action="{{ getLink('guilds') }}" method="post">
{{ csrf() }}
<td style="float: right"> <td style="float: right">
{{ include('buttons.back.html.twig') }} {{ include('buttons.back.html.twig') }}
</td> </td>

View File

@ -1,6 +1,8 @@
<meta charset="{{ charset }}"> <meta charset="{{ charset }}">
<meta http-equiv="content-language" content="{{ config.language }}" /> <meta http-equiv="content-language" content="{{ config.language }}" />
<meta http-equiv="content-type" content="text/html; charset={{ charset }}" /> <meta http-equiv="content-type" content="text/html; charset={{ charset }}" />
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrfToken() }}">
{% if not is_admin %} {% if not is_admin %}
<base href="{{ constant('BASE_URL') }}" /> <base href="{{ constant('BASE_URL') }}" />
<title>{{ title }}</title> <title>{{ title }}</title>

View File

@ -9,6 +9,7 @@
*/ */
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
use MyAAC\CsrfToken;
use Twig\Environment as Twig_Environment; use Twig\Environment as Twig_Environment;
use Twig\Extension\DebugExtension as Twig_DebugExtension; use Twig\Extension\DebugExtension as Twig_DebugExtension;
use Twig\Loader\FilesystemLoader as Twig_FilesystemLoader; use Twig\Loader\FilesystemLoader as Twig_FilesystemLoader;
@ -118,6 +119,16 @@ $function = new TwigFunction('getCustomPage', function ($name) {
}); });
$twig->addFunction($function); $twig->addFunction($function);
$function = new TwigFunction('csrf', function () {
csrf();
});
$twig->addFunction($function);
$function = new TwigFunction('csrfToken', function () {
return csrfToken();
});
$twig->addFunction($function);
$filter = new TwigFilter('urlencode', function ($s) { $filter = new TwigFilter('urlencode', function ($s) {
return urlencode($s); return urlencode($s);
}); });