Merge branch 'develop' into feature/settings

This commit is contained in:
slawkens 2021-06-08 22:06:21 +02:00
commit 4dbcad5ad5
32 changed files with 229 additions and 2089 deletions

View File

@ -10,6 +10,7 @@
"ext-zip": "*", "ext-zip": "*",
"phpmailer/phpmailer": "^6.1", "phpmailer/phpmailer": "^6.1",
"composer/semver": "^3.2", "composer/semver": "^3.2",
"twig/twig": "~1.42.5" "twig/twig": "~1.42.5",
"erusev/parsedown": "^1.7"
} }
} }

View File

@ -141,6 +141,7 @@ $config = array(
// This is the minimum and the maximum length that a player can create a character. It is highly recommend the maximum length to be 21. // This is the minimum and the maximum length that a player can create a character. It is highly recommend the maximum length to be 21.
'character_name_min_length' => 4, 'character_name_min_length' => 4,
'character_name_max_length' => 21, 'character_name_max_length' => 21,
'character_name_npc_check' => true,
// list of towns // list of towns
// if you use TFS 1.3 with support for 'towns' table in database, then you can ignore this - it will be configured automatically (from MySQL database - Table - towns) // if you use TFS 1.3 with support for 'towns' table in database, then you can ignore this - it will be configured automatically (from MySQL database - Table - towns)

View File

@ -38,7 +38,7 @@ else
$uri = str_replace(array('index.php/', '?'), '', $uri); $uri = str_replace(array('index.php/', '?'), '', $uri);
define('URI', $uri); define('URI', $uri);
if(preg_match("/^[A-Za-z0-9-_%\'+]+\.png$/i", $uri)) { if(preg_match("/^[A-Za-z0-9-_%'+]+\.png$/i", $uri)) {
$tmp = explode('.', $uri); $tmp = explode('.', $uri);
$_REQUEST['name'] = urldecode($tmp[0]); $_REQUEST['name'] = urldecode($tmp[0]);
@ -48,7 +48,7 @@ if(preg_match("/^[A-Za-z0-9-_%\'+]+\.png$/i", $uri)) {
} }
if(preg_match("/^(.*)\.(gif|jpg|png|jpeg|tiff|bmp|css|js|less|map|html|php|zip|rar|gz|ttf|woff|ico)$/i", $_SERVER['REQUEST_URI'])) { if(preg_match("/^(.*)\.(gif|jpg|png|jpeg|tiff|bmp|css|js|less|map|html|php|zip|rar|gz|ttf|woff|ico)$/i", $_SERVER['REQUEST_URI'])) {
header('HTTP/1.0 404 Not Found'); http_response_code(404);
exit; exit;
} }

View File

@ -63,6 +63,16 @@ class DataLoader
self::$startTime = microtime(true); self::$startTime = microtime(true);
require_once LIBS . 'npc.php';
if(NPCs::loadFromXML()) {
success(self::$locale['step_database_loaded_npcs'] . self::getLoadedTime());
}
else {
error(self::$locale['step_database_error_npcs']);
}
self::$startTime = microtime(true);
require LIBS . 'spells.php'; require LIBS . 'spells.php';
if(Spells::loadFromXML()) { if(Spells::loadFromXML()) {
success(self::$locale['step_database_loaded_spells'] . self::getLoadedTime()); success(self::$locale['step_database_loaded_spells'] . self::getLoadedTime());
@ -100,4 +110,4 @@ class DataLoader
$endTime = round(microtime(true) - self::$startTime, 3); $endTime = round(microtime(true) - self::$startTime, 3);
return ' (' . str_replace('$TIME$', $endTime, self::$locale['loaded_in_ms']) . ')'; return ' (' . str_replace('$TIME$', $endTime, self::$locale['loaded_in_ms']) . ')';
} }
} }

File diff suppressed because it is too large Load Diff

59
system/libs/npc.php Normal file
View File

@ -0,0 +1,59 @@
<?php
/**
* NPC class
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @author Lee
* @copyright 2021 MyAAC
* @link https://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
class NPCs
{
public static $npcs;
public static function loadFromXML($show = false)
{
$npc_path = config('data_path') . 'npc/';
if (!file_exists($npc_path))
return false;
$npcs = [];
$xml = new DOMDocument();
foreach (preg_grep('~\.(xml)$~i', scandir($npc_path)) as $npc) {
$xml->load($npc_path . $npc);
if ($xml) {
$element = $xml->getElementsByTagName('npc')->item(0);
if (isset($element)) {
$name = $element->getAttribute('name');
if (!empty($name) && !in_array($name, $npcs)) {
$npcs[] = strtolower($name);
}
}
}
}
if (count($npcs) == 0) {
return false;
}
require_once LIBS . 'cache_php.php';
$cache_php = new Cache_PHP(config('cache_prefix'), CACHE);
$cache_php->set('npcs', $npcs, 5 * 365 * 24 * 60 * 60);
return true;
}
public static function load()
{
if (self::$npcs) {
return;
}
require_once LIBS . 'cache_php.php';
$cache_php = new Cache_PHP(config('cache_prefix'), CACHE);
self::$npcs = $cache_php->get('npcs');
}
}

View File

@ -42,6 +42,8 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
private $data = array('email' => '', 'blocked' => false, 'rlname' => '','location' => '', 'country' => '','web_flags' => 0, 'lastday' => 0, 'premdays' => 0, 'created' => 0); private $data = array('email' => '', 'blocked' => false, 'rlname' => '','location' => '', 'country' => '','web_flags' => 0, 'lastday' => 0, 'premdays' => 0, 'created' => 0);
public static $cache = array(); public static $cache = array();
const GRATIS_PREMIUM_DAYS = 65535;
/** /**
* Creates new account. * Creates new account.
* *
@ -382,6 +384,10 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
global $config; global $config;
if(isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium'])) return -1; if(isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium'])) return -1;
if($this->data['premdays'] == self::GRATIS_PREMIUM_DAYS){
return self::GRATIS_PREMIUM_DAYS;
}
$ret = ceil($this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday']))); $ret = ceil($this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday'])));
return $ret > 0 ? $ret : 0; return $ret > 0 ? $ret : 0;
} }

View File

@ -221,6 +221,16 @@ class Validator
return false; return false;
} }
$npcCheck = config('character_name_npc_check');
if ($npcCheck) {
require_once LIBS . 'npc.php';
NPCS::load();
if(NPCS::$npcs && in_array(strtolower($name), NPCS::$npcs)) {
self::$lastError = "Invalid name format. Do not use NPC Names";
return false;
}
}
return true; return true;
} }
@ -334,6 +344,16 @@ class Validator
} }
} }
$npcCheck = config('character_name_npc_check');
if ($npcCheck) {
require_once LIBS . 'npc.php';
NPCS::load();
if(NPCS::$npcs && in_array($name_lower, NPCS::$npcs)) {
self::$lastError = "Invalid name format. Do not use NPC Names";
return false;
}
}
if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- '") != $name_length) { if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- '") != $name_length) {
self::$lastError = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.'; self::$lastError = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.';
return false; return false;

View File

@ -85,6 +85,8 @@ $locale['step_database_loaded_items'] = 'Items has been loaded...';
$locale['step_database_loaded_weapons'] = 'Weapons has been loaded...'; $locale['step_database_loaded_weapons'] = 'Weapons has been loaded...';
$locale['step_database_loaded_monsters'] = 'Monsters has been loaded...'; $locale['step_database_loaded_monsters'] = 'Monsters has been loaded...';
$locale['step_database_error_monsters'] = 'There were some problems loading your monsters.xml file. Please check $LOG$ for more info.'; $locale['step_database_error_monsters'] = 'There were some problems loading your monsters.xml file. Please check $LOG$ for more info.';
$locale['step_database_loaded_npcs'] = 'NPCs has been loaded...';
$locale['step_database_error_npcs'] = 'There were some problems loading your NPCs';
$locale['step_database_loaded_spells'] = 'Spells has been loaded...'; $locale['step_database_loaded_spells'] = 'Spells has been loaded...';
$locale['step_database_loaded_towns'] = 'Towns has been loaded...'; $locale['step_database_loaded_towns'] = 'Towns has been loaded...';
$locale['step_database_error_towns'] = 'There were some problems loading your towns. You will need to configure them manually in config.'; $locale['step_database_error_towns'] = 'There were some problems loading your towns. You will need to configure them manually in config.';

View File

@ -84,6 +84,8 @@ $locale['step_database_loaded_items'] = 'Załadowano przedmioty (items)...';
$locale['step_database_loaded_weapons'] = 'Załadowano bronie (weapons)...'; $locale['step_database_loaded_weapons'] = 'Załadowano bronie (weapons)...';
$locale['step_database_loaded_monsters'] = 'Załadowano potworki (monsters)...'; $locale['step_database_loaded_monsters'] = 'Załadowano potworki (monsters)...';
$locale['step_database_error_monsters'] = 'Wystąpiły problemy podczas ładowania pliku monsters.xml. Zobacz $LOG$ po więcej informacji.'; $locale['step_database_error_monsters'] = 'Wystąpiły problemy podczas ładowania pliku monsters.xml. Zobacz $LOG$ po więcej informacji.';
$locale['step_database_loaded_npcs'] = 'Załadowano NPCs...';
$locale['step_database_error_npcs'] = 'Wystąpił problem podczas ładowania NPCs';
$locale['step_database_loaded_spells'] = 'Załadowano czary (spells)...'; $locale['step_database_loaded_spells'] = 'Załadowano czary (spells)...';
$locale['step_database_loaded_towns'] = 'Załadowano miasta (towns)...'; $locale['step_database_loaded_towns'] = 'Załadowano miasta (towns)...';
$locale['step_database_error_towns'] = 'Wystąpił problem podczas ładowania miast. Trzeba będzie je skonfigurować manualnie.'; $locale['step_database_error_towns'] = 'Wystąpił problem podczas ładowania miast. Trzeba będzie je skonfigurować manualnie.';

View File

@ -10,7 +10,7 @@
*/ */
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$character_name = isset($_POST['name']) ? stripslashes(ucwords(strtolower($_POST['name']))) : null; $character_name = isset($_POST['name']) ? stripslashes($_POST['name']) : null;
$character_sex = isset($_POST['sex']) ? (int)$_POST['sex'] : null; $character_sex = isset($_POST['sex']) ? (int)$_POST['sex'] : null;
$character_vocation = isset($_POST['vocation']) ? (int)$_POST['vocation'] : null; $character_vocation = isset($_POST['vocation']) ? (int)$_POST['vocation'] : null;
$character_town = isset($_POST['town']) ? (int)$_POST['town'] : null; $character_town = isset($_POST['town']) ? (int)$_POST['town'] : null;
@ -42,4 +42,4 @@ if(!$character_created) {
'save' => $save, 'save' => $save,
'errors' => $errors 'errors' => $errors
)); ));
} }

View File

@ -60,14 +60,15 @@ $errors = array();
if($action == '') if($action == '')
{ {
$freePremium = isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium']); $freePremium = isset($config['lua']['freePremium']) && getBoolean($config['lua']['freePremium']) || $account_logged->getPremDays() == OTS_Account::GRATIS_PREMIUM_DAYS;
$dayOrDays = $account_logged->getPremDays() == 1 ? 'day' : 'days';
/** /**
* @var OTS_Account $account_logged * @var OTS_Account $account_logged
*/ */
if(!$account_logged->isPremium()) if(!$account_logged->isPremium())
$account_status = '<b><span style="color: red">Free Account</span></b>'; $account_status = '<b><span style="color: red">Free Account</span></b>';
else else
$account_status = '<b><span style="color: green">Premium Account, ' . ($freePremium ? 'Unlimited' : $account_logged->getPremDays() . ' days left') . '</span></b>'; $account_status = '<b><span style="color: green">' . ($freePremium ? 'Gratis Premium Account' : 'Premium Account, ' . $account_logged->getPremDays() . ' '.$dayOrDays.' left') . '</span></b>';
$recovery_key = $account_logged->getCustomField('key'); $recovery_key = $account_logged->getCustomField('key');
if(empty($recovery_key)) if(empty($recovery_key))

View File

@ -167,7 +167,7 @@ else if (isset($_REQUEST['search'])) {
} }
$lastDay = 0; $lastDay = 0;
if ($p_days != 0 && $p_days != PHP_INT_MAX) { if($p_days != 0 && $p_days != OTS_Account::GRATIS_PREMIUM_DAYS) {
$lastDay = time(); $lastDay = time();
} else if ($lastDay != 0) { } else if ($lastDay != 0) {
$lastDay = 0; $lastDay = 0;

View File

@ -16,8 +16,6 @@ if (!file_exists(BASE . 'CHANGELOG.md')) {
return; return;
} }
require LIBS . 'Parsedown.php';
$changelog = file_get_contents(BASE . 'CHANGELOG.md'); $changelog = file_get_contents(BASE . 'CHANGELOG.md');
$Parsedown = new Parsedown(); $Parsedown = new Parsedown();

View File

@ -54,16 +54,14 @@ if (empty($_REQUEST['creature'])) {
$loot = json_decode($creature['loot'], true); $loot = json_decode($creature['loot'], true);
usort($loot, 'sort_by_chance'); usort($loot, 'sort_by_chance');
$loot_list = []; foreach ($loot as &$item) {
foreach ($loot as $item) {
$item['name'] = getItemNameById($item['id']); $item['name'] = getItemNameById($item['id']);
$item['rarity_chance'] = round($item['chance'] / 1000, 2); $item['rarity_chance'] = round($item['chance'] / 1000, 2);
$item['rarity'] = getItemRarity($item['chance']); $item['rarity'] = getItemRarity($item['chance']);
$item['tooltip'] = ucfirst($item['name']) . '<br/>Chance: ' . $item['rarity'] . (config('creatures_loot_percentage') ? ' ('. $item['rarity_chance'] .'%)' : '') . '<br/>Max count: ' . $item['count']; $item['tooltip'] = ucfirst($item['name']) . '<br/>Chance: ' . $item['rarity'] . (config('creatures_loot_percentage') ? ' ('. $item['rarity_chance'] .'%)' : '') . '<br/>Max count: ' . $item['count'];
$loot_list[] = $item;
} }
$creature['loot'] = isset($loot_list) ? $loot_list : null; $creature['loot'] = isset($loot) ? $loot : null;
$creature['voices'] = isset($voices) ? $voices : null; $creature['voices'] = isset($voices) ? $voices : null;
$creature['summons'] = isset($summons) ? $summons : null; $creature['summons'] = isset($summons) ? $summons : null;
$creature['elements'] = isset($elements) ? $elements : null; $creature['elements'] = isset($elements) ? $elements : null;

View File

@ -43,7 +43,15 @@ echo '<br /><br />Page: '.$links_to_pages.'<br />';
$last_threads = $db->query("SELECT `players`.`id` as `player_id`, `players`.`name`, `" . FORUM_TABLE_PREFIX . "forum`.`post_text`, `" . FORUM_TABLE_PREFIX . "forum`.`post_topic`, `" . FORUM_TABLE_PREFIX . "forum`.`id`, `" . FORUM_TABLE_PREFIX . "forum`.`last_post`, `" . FORUM_TABLE_PREFIX . "forum`.`replies`, `" . FORUM_TABLE_PREFIX . "forum`.`views`, `" . FORUM_TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . FORUM_TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . FORUM_TABLE_PREFIX . "forum`.`author_guid` AND `" . FORUM_TABLE_PREFIX . "forum`.`section` = ".(int) $section_id." AND `" . FORUM_TABLE_PREFIX . "forum`.`first_post` = `" . FORUM_TABLE_PREFIX . "forum`.`id` ORDER BY `" . FORUM_TABLE_PREFIX . "forum`.`last_post` DESC LIMIT ".$config['forum_threads_per_page']." OFFSET ".($_page * $config['forum_threads_per_page']))->fetchAll(); $last_threads = $db->query("SELECT `players`.`id` as `player_id`, `players`.`name`, `" . FORUM_TABLE_PREFIX . "forum`.`post_text`, `" . FORUM_TABLE_PREFIX . "forum`.`post_topic`, `" . FORUM_TABLE_PREFIX . "forum`.`id`, `" . FORUM_TABLE_PREFIX . "forum`.`last_post`, `" . FORUM_TABLE_PREFIX . "forum`.`replies`, `" . FORUM_TABLE_PREFIX . "forum`.`views`, `" . FORUM_TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . FORUM_TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . FORUM_TABLE_PREFIX . "forum`.`author_guid` AND `" . FORUM_TABLE_PREFIX . "forum`.`section` = ".(int) $section_id." AND `" . FORUM_TABLE_PREFIX . "forum`.`first_post` = `" . FORUM_TABLE_PREFIX . "forum`.`id` ORDER BY `" . FORUM_TABLE_PREFIX . "forum`.`last_post` DESC LIMIT ".$config['forum_threads_per_page']." OFFSET ".($_page * $config['forum_threads_per_page']))->fetchAll();
if(isset($last_threads[0])) if(isset($last_threads[0]))
{ {
echo '<table width="100%"><tr bgcolor="'.$config['vdarkborder'].'" align="center"><td><span style="color: white; font-size: 10px"><b>Thread</b></span></td><td><span style="color: white; font-size: 10px"><b>Thread Starter</b></span></td><td><span style="color: white; font-size: 10px"><b>Replies</b></span></td><td><span style="color: white; font-size: 10px"><b>Views</b></span></td><td><span style="color: white; font-size: 10px"><b>Last Post</b></span></td></tr>'; echo '<table width="100%">
<tr bgcolor="'.$config['vdarkborder'].'" align="center">
<td class="white">
<span style="font-size: 10px"><b>Thread</b></span></td>
<td><span style="font-size: 10px"><b>Thread Starter</b></span></td>
<td><span style="font-size: 10px"><b>Replies</b></span></td>
<td><span style="font-size: 10px"><b>Views</b></span></td>
<td><span style="font-size: 10px"><b>Last Post</b></span></td>
</tr>';
$player = new OTS_Player(); $player = new OTS_Player();
foreach($last_threads as $thread) foreach($last_threads as $thread)
@ -83,4 +91,4 @@ if(isset($last_threads[0]))
else else
echo '<h3>No threads in this board.</h3>'; echo '<h3>No threads in this board.</h3>';
?> ?>

View File

@ -51,8 +51,7 @@ if(empty($errors)) {
} }
$twig->display('guilds.change_description.html.twig', array( $twig->display('guilds.change_description.html.twig', array(
'guild' => $guild, 'guild' => $guild
'rows' => bcsub($config['guild_description_lines_limit'],1)
)); ));
} }
else { else {
@ -72,4 +71,4 @@ if(!empty($errors)) {
)); ));
} }
?> ?>

View File

@ -77,8 +77,12 @@ if(empty($guild_errors)) {
$new_rank->setName('New Rank level '.$rank->getLevel()); $new_rank->setName('New Rank level '.$rank->getLevel());
$new_rank->save(); $new_rank->save();
} }
foreach($players_with_rank as $player_in_guild) { foreach($players_with_rank as $player_in_guild) {
$player_in_guild->setRank($new_rank); $player = new OTS_Player();
$player->load($player_in_guild['id']);
if ($player->isLoaded())
$player->setRank($new_rank);
} }
} }
$rank->delete(); $rank->delete();
@ -120,4 +124,4 @@ if(!empty($guild_errors)) {
)); ));
} }
?> ?>

View File

@ -29,11 +29,13 @@ if(isset($_GET['archive']))
// display big news by id // display big news by id
if(isset($_GET['id'])) if(isset($_GET['id']))
{ {
$id = (int)$_GET['id'];
$field_name = 'date'; $field_name = 'date';
if($_REQUEST['id'] < 100000) if($id < 100000)
$field_name = 'id'; $field_name = 'id';
$news = $db->query('SELECT * FROM `'.TABLE_PREFIX . 'news` WHERE `hidden` != 1 AND `' . $field_name . '` = ' . (int)$_REQUEST['id'] . ''); $news = $db->query('SELECT * FROM `'.TABLE_PREFIX . 'news` WHERE `hidden` != 1 AND `' . $field_name . '` = ' . $id . '');
if($news->rowCount() == 1) if($news->rowCount() == 1)
{ {
$news = $news->fetch(); $news = $news->fetch();
@ -227,4 +229,4 @@ if(!$news_cached)
echo $tmp_content; echo $tmp_content;
} }
else else
echo $news_cached; echo $news_cached;

View File

@ -9,7 +9,7 @@
* @link https://my-aac.org * @link https://my-aac.org
*/ */
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'Gamemasters List'; $title = 'Support in game';
if($config['account_country']) if($config['account_country'])
require SYSTEM . 'countries.conf.php'; require SYSTEM . 'countries.conf.php';

View File

@ -80,6 +80,7 @@ else {
} }
$template_ini = parse_ini_file($file); $template_ini = parse_ini_file($file);
unset($file);
if ($cache->enabled()) { if ($cache->enabled()) {
$cache->set('template_ini_' . $template_name, serialize($template_ini)); $cache->set('template_ini_' . $template_name, serialize($template_ini));

View File

@ -1,11 +1,11 @@
<p>Clicking the button will reload server data (items, monsters, spells, towns, weapons).</p> <p>Clicking the button will reload server data (items, monsters, npcs, spells, towns, weapons).</p>
<p>It may take up to few minutes.</p> <p>It may take up to few minutes.</p>
<button id="reload_button" class="btn btn-info"><i class="fas fa-update"></i>Reload</button> <button id="reload_button" class="btn btn-info"><i class="fas fa-update"></i>Reload</button>
<div id="spinner" class="spinner-border" role="status"> <button id="spinner" class="btn btn-info" type="button" disabled>
<span class="sr-only">Loading...</span> <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
</div> Loading...
</button>
<div style="height: 20px"></div> <div style="height: 20px"></div>
<div id="messages"></div> <div id="messages"></div>
@ -19,6 +19,7 @@
$(function () { $(function () {
$('#reload_button').on('click', function (e) { $('#reload_button').on('click', function (e) {
$('#spinner').show(); $('#spinner').show();
$('#reload_button').hide();
$('[id^=success]').remove(); $('[id^=success]').remove();
$('#messages').append('<div id="success-1"></div>'); $('#messages').append('<div id="success-1"></div>');

View File

@ -1,21 +1,21 @@
<b>Boards</b> <b>Boards</b>
<table width="100%"> <table width="100%">
<tr bgcolor="{{ config.vdarkborder }}"> <tr bgcolor="{{ config.vdarkborder }}" class="white">
<td> <td>
<span style="color: white; font-size: 10px"><b>Board</b></span> <span style="font-size: 10px"><b>Board</b></span>
</td> </td>
<td> <td>
<span style="color: white; font-size: 10px"><b>Posts</b></span> <span style="font-size: 10px"><b>Posts</b></span>
</td> </td>
<td> <td>
<span style="color: white; font-size: 10px"><b>Threads</b></span> <span style="font-size: 10px"><b>Threads</b></span>
</td> </td>
<td align="center"> <td align="center">
<span style="color: white; font-size: 10px"><b>Last Post</b></span> <span style="font-size: 10px"><b>Last Post</b></span>
</td> </td>
{% if canEdit %} {% if canEdit %}
<td> <td>
<span style="color: white; font-size: 10px"><b>Options</b></span> <span style="font-size: 10px"><b>Options</b></span>
</td> </td>
{% endif %} {% endif %}
</tr> </tr>

View File

@ -12,8 +12,8 @@ Page: {{ links_to_pages|raw }}<br/>
</td> </td>
</tr> </tr>
<tr bgcolor="{{ config.vdarkborder }}"> <tr bgcolor="{{ config.vdarkborder }}">
<td width="200"> <td width="200" class="white">
<span style="color: white; font-size: 10px"><b>Author</b></span> <span style="font-size: 10px"><b>Author</b></span>
</td> </td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>

View File

@ -2,11 +2,11 @@
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">
<input type="hidden" name="todo" value="save"/> <input type="hidden" name="todo" value="save"/>
<textarea name="description" cols="60" rows="{{ rows }}">{{ guild.getCustomField('description')|raw }}</textarea><br> <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/> (max. {{ config.guild_description_lines_limit }} lines, max. {{ config.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">
{{ include('buttons.back.html.twig') }} {{ include('buttons.back.html.twig') }}
</form> </form>
</div> </div>

View File

@ -8,15 +8,11 @@ Here you can change logo of your guild.<br/>Actuall logo: <img src="images/guild
</form> </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>{{ config.guild_image_size_kb }} KB</b><br>
<br/> <br/>
{% spaceless %}
<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">
<div class="BigButton" style="background-image:url({{ template_path }}/images/global/buttons/sbutton.gif)"> {{ include('buttons.back.html.twig') }}
{{ include('buttons.back.html.twig') }}
</div>
</form> </form>
</div> </div>
{% endspaceless %}
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$('#upload_form').submit(function (event) { $('#upload_form').submit(function (event) {
@ -34,4 +30,4 @@ Only <b>jpg, gif, png, bmp</b> pictures. Max. size: <b>{{ config.guild_image_siz
return true; return true;
}); });
}); });
</script> </script>

View File

@ -5,12 +5,8 @@ Here you can change MOTD (Message of the Day, showed in game!) of your guild.<br
<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. {{ config.guild_motd_chars_limit }} chars) <input type="submit" value="Save MOTD" /></form><br/> (max. {{ config.guild_motd_chars_limit }} chars) <input type="submit" value="Save MOTD" /></form><br/>
<br/> <br/>
{% spaceless %}
<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">
<div class="BigButton" style="background-image:url({{ template_path }}/images/global/buttons/sbutton.gif)"> {{ include('buttons.back.html.twig') }}
{{ include('buttons.back.html.twig') }}
</div>
</form> </form>
</div> </div>
{% endspaceless %}

View File

@ -28,7 +28,6 @@
cursor: pointer; cursor: pointer;
font-weight: 600; font-weight: 600;
background-color: {{ config.vdarkborder }}; background-color: {{ config.vdarkborder }};
color: #fff;
} }
</style> </style>
@ -61,13 +60,13 @@
<div class="ts_Spells"> <div class="ts_Spells">
<input type="radio" name="ts_Spells" id="tab_instant" aria-controls="instant" checked> <input type="radio" name="ts_Spells" id="tab_instant" aria-controls="instant" checked>
<label for="tab_instant">Instant</label> <label for="tab_instant" class="white">Instant</label>
<input type="radio" name="ts_Spells" id="tab_conjure" aria-controls="conjure"> <input type="radio" name="ts_Spells" id="tab_conjure" aria-controls="conjure">
<label for="tab_conjure">Conjure</label> <label for="tab_conjure" class="white">Conjure</label>
<input type="radio" name="ts_Spells" id="tab_rune" aria-controls="rune"> <input type="radio" name="ts_Spells" id="tab_rune" aria-controls="rune">
<label for="tab_rune">Rune</label> <label for="tab_rune" class="white">Rune</label>
<div class="tab-panels"> <div class="tab-panels">
<section id="instant" class="tab-panel"> <section id="instant" class="tab-panel">

View File

@ -19,6 +19,31 @@ if($dev_mode) {
} }
unset($dev_mode); unset($dev_mode);
$filter = new Twig_SimpleFilter('timeago', function ($datetime) {
$time = time() - strtotime($datetime);
$units = array (
31536000 => 'year',
2592000 => 'month',
604800 => 'week',
86400 => 'day',
3600 => 'hour',
60 => 'minute',
1 => 'second'
);
foreach ($units as $unit => $val) {
if ($time < $unit) continue;
$numberOfUnits = floor($time / $unit);
return ($val == 'second')? 'a few seconds ago' :
(($numberOfUnits>1) ? $numberOfUnits : 'a')
.' '.$val.(($numberOfUnits>1) ? 's' : '').' ago';
}
});
$twig->addFilter($filter);
$function = new TwigFunction('getStyle', function ($i) { $function = new TwigFunction('getStyle', function ($i) {
return getStyle($i); return getStyle($i);
}); });

View File

@ -0,0 +1,42 @@
<?php
$menus = get_template_menus();
function get_template_pages($category) {
global $menus;
$ret = array();
foreach($menus[$category] as $menu) {
$ret[] = $menu['link'];
}
return $ret;
}
?>
var category = '<?php
if(strpos(URI, 'subtopic=') !== false) {
$tmp = array($_REQUEST['subtopic']);
}
else {
$tmp = URI;
if(empty($tmp)) {
$tmp = array('news');
}
else {
$tmp = explode('/', URI);
}
}
if(in_array($tmp[0], get_template_pages(MENU_CATEGORY_NEWS)))
echo 'news';
elseif(in_array($tmp[0], get_template_pages(MENU_CATEGORY_LIBRARY)))
echo 'library';
elseif(in_array($tmp[0], get_template_pages(MENU_CATEGORY_COMMUNITY)))
echo 'community';
elseif(in_array($tmp[0], array_merge(get_template_pages(MENU_CATEGORY_ACCOUNT), array('account'))))
echo 'account';
elseif(in_array($tmp[0], get_template_pages(MENU_CATEGORY_SHOP)))
echo 'shops';
else {
echo 'news';
}
?>';

View File

@ -13,45 +13,7 @@ defined('MYAAC') or die('Direct access not allowed!');
</script> </script>
<script type="text/javascript" src="tools/basic.js"></script> <script type="text/javascript" src="tools/basic.js"></script>
<script type="text/javascript"> <script type="text/javascript">
<?php <?php require 'javascript.php'; ?>
$menus = get_template_menus();
function get_template_pages($category) {
global $menus;
$ret = array();
foreach($menus[$category] as $menu) {
$ret[] = $menu['link'];
}
return $ret;
}
?>
var category = '<?php
if(strpos(URI, 'subtopic=') !== false) {
$tmp = array($_REQUEST['subtopic']);
}
else {
$tmp = URI;
if(empty($tmp)) {
$tmp = array('news');
}
else {
$tmp = explode('/', URI);
}
}
if(in_array($tmp[0], get_template_pages(MENU_CATEGORY_NEWS)))
echo 'news';
elseif(in_array($tmp[0], get_template_pages(MENU_CATEGORY_LIBRARY)))
echo 'library';
elseif(in_array($tmp[0], get_template_pages(MENU_CATEGORY_COMMUNITY)))
echo 'community';
elseif(in_array($tmp[0], array_merge(get_template_pages(MENU_CATEGORY_ACCOUNT), array('account'))))
echo 'account';
elseif(in_array($tmp[0], get_template_pages(MENU_CATEGORY_SHOP)))
echo 'shops';
?>';
</script> </script>
<?php echo template_place_holder('head_end'); ?> <?php echo template_place_holder('head_end'); ?>
</head> </head>

View File

@ -31,6 +31,7 @@ function performInstall(url) {
// On completed // On completed
ajaxRequest.done(function(data) { ajaxRequest.done(function(data) {
$('#spinner').hide(); $('#spinner').hide();
$('#reload_button').show();
}); });
// On failed // On failed
ajaxRequest.fail(function(error){ ajaxRequest.fail(function(error){