Compare commits

..

31 Commits

Author SHA1 Message Date
slawkens
be7746d73d Release v0.8.25 2026-01-31 09:41:21 +01:00
slawkens
6715a83d03 Use apcu_clear_cache 2026-01-30 23:09:06 +01:00
slawkens
347ad40da1 Fix xdebug warnings in load_config_lua 2026-01-30 23:08:26 +01:00
slawkens
b0e88aea5e Use __DIR__ instead of template path 2026-01-30 23:07:43 +01:00
slawkens
54c1f5f486 Fix polls link 2026-01-30 23:07:05 +01:00
slawkens
364b140316 Cache::remember: $ttl = 0 means no cache 2026-01-30 23:04:32 +01:00
slawkens
f7cf2425d0 Twig: add cache variable 2026-01-30 23:04:06 +01:00
slawkens
207cf3a3c1 Fix submenu initialization for missing elements
Added a check in InitializeMenu to skip submenu items if their corresponding DOM element does not exist, preventing potential JavaScript errors.
2026-01-30 23:03:14 +01:00
slawkens
b190db3149 Fix online skulls display (Fix #320) 2026-01-30 23:02:07 +01:00
slawkens
fc3eaefc3f Fix exception when email cannot be send on create account 2026-01-30 23:00:41 +01:00
slawkens
fcf2b14921 Fix Menu div wrong tag/closing (#329) 2026-01-30 22:57:40 +01:00
slawkens
496499abbb Replace firstChild with firstElementChild (Thanks to @un000000) 2026-01-30 22:56:19 +01:00
slawkens
52a6256905 Prevent injection in $db->hasColumn 2026-01-30 22:54:09 +01:00
slawkens
92254e2671 Cache::remember -1 = infinite
Patching from 1.x
2026-01-30 22:52:55 +01:00
slawkens
7378905ae8 New configurable: hooks_debug
To view where hooks are located in .twig files
Patching from 1.x
2026-01-30 22:51:14 +01:00
slawkens
ab89ccaaa7 Allow links in error_box 2026-01-30 22:50:15 +01:00
slawkens
d37c2e7720 Merge branch '0.8' of https://github.com/slawkens/myaac into 0.8 2026-01-30 22:48:00 +01:00
slawkens
db83a6c5a9 Show if there is mysql error on import schema
Weird fix, don't know why it didn't worked with query()
Patching from 1.x
2026-01-30 22:47:54 +01:00
slawkens
9bfa5bc0ab Ignore only top-most Lua folder 2026-01-30 22:46:56 +01:00
slawkens
6a1e6b470c Don't display hidden news for admin - it's confusing
Patching from 1.x
2026-01-30 22:46:02 +01:00
slawkens
0c69e59104 Merge branch '0.8' of https://github.com/slawkens/myaac into 0.8 2026-01-30 22:41:08 +01:00
slawkens
2e50f8f81c Fix $status['uptimeReadable'], was totally wrong 2026-01-30 22:40:58 +01:00
slawkens
ed8b36f452 Server Status: Write to status-error.log if there is connection error
Patching from 1.x
2026-01-30 22:38:19 +01:00
slawkens
fdf2476501 Update .gitignore 2026-01-30 22:37:42 +01:00
slawkens
63e0ce696e Fixed [player/guild/house] bb code in forum 2026-01-30 22:35:34 +01:00
slawkens
44c917aefa Account character list: Add [ DELETED ] for deleted characters 2026-01-30 22:34:33 +01:00
slawkens
0a930e9acb Account Manage: Change last login to correct login time
Instead of just "now"
2026-01-30 22:32:44 +01:00
slawkens
c376fd93c6 Return 404 when signature player not found (patching from 1.x)
In most cases it was a request for a non existing file
2026-01-30 22:32:21 +01:00
slawkens
a76741c9da Remove html tags from email function (patched from 1.x)
Better score in tests
2026-01-30 22:29:44 +01:00
slawkens
63a99e0f92 Fix post_edit being an author, didn't worked 2026-01-30 22:24:09 +01:00
slawkens
ca114eb564 Start 0.8.25-dev 2025-06-03 23:53:57 +02:00
22 changed files with 170 additions and 67 deletions

3
.gitignore vendored
View File

@@ -4,7 +4,7 @@ Thumbs.db
#
/.htaccess
lua
/lua
# composer
composer.lock
@@ -24,6 +24,7 @@ releases
tmp
config.local.php
config2.local.php
# all custom templates
templates/*

View File

@@ -1,10 +1,43 @@
# Changelog
## [0.8.25 - 31.01.2026]
### Added
* New configurable: hooks_debug To view where hooks are located in .twig files (https://github.com/slawkens/myaac/commit/7378905ae8cf033e36a27461b5ccffeed042dacd)
* Twig: add global cache variable (https://github.com/slawkens/myaac/commit/f7cf2425d0e970356c477a96b20c4c31837430e7)
### Changed
* Server Status: Write to status-error.log if there is a connection error (https://github.com/slawkens/myaac/commit/ed8b36f4528668f29ea1a2adc7234ec249fa031b)
* Remove HTML tags from the email function (patched from 1.x) Better score in tests (https://github.com/slawkens/myaac/commit/a76741c9dae97584cbc6736bbc6404d1e59f856d)
* Return 404 when the signature player is not found (patching from 1.x) - In most cases it was a request for a non existing file (https://github.com/slawkens/myaac/commit/c376fd93c6fbf3f9c4bd79bae8875720464c28fa)
* Don't display hidden news for admin - it's confusing (https://github.com/slawkens/myaac/commit/6a1e6b470ca05e5a43d9986865f8938e92951e45)
* Allow links in error_box.html.twig (https://github.com/slawkens/myaac/commit/ab89ccaaa722f4c1acdfb0302c3cddb2ed343e61)
* Account character list: Add [ DELETED ] for deleted characters (https://github.com/slawkens/myaac/commit/44c917aefa20ad8dcba7a47ccab50635e33f2e53)
### Fixed
* Fix $status['uptimeReadable'], was totally wrong (https://github.com/slawkens/myaac/commit/2e50f8f81cfd1bfe763c6ed8e329c89b69604865)
* Fixed [player/guild/house] bb code in forum (https://github.com/slawkens/myaac/commit/63e0ce696e078fb0b020c45a777d1c6571ac1ae3)
* Fix post_edit being an author, didn't worked (https://github.com/slawkens/myaac/commit/63a99e0f92214bc5fd60b867f80bb451af29da79)
* Show if there is a mysql error on import schema (https://github.com/slawkens/myaac/commit/db83a6c5a92a56ef47afd148ab1621759211e4b9)
* Prevent injection in $db->hasColumn (https://github.com/slawkens/myaac/commit/52a62569056582da2862ffcfbb5c68bf7f25c4df)
* Account Create: Fix the exception when email cannot be sent (https://github.com/slawkens/myaac/commit/fc3eaefc3f84cf4e977d4f3cc8b2fbf96555cc2a)
* Online: Fix online skulls display (Fix #320) (https://github.com/slawkens/myaac/commit/b190db3149fca54217ca507e8502096d40813d44)
* Tibiacom template: Fix submenu initialization for missing elements (https://github.com/slawkens/myaac/commit/207cf3a3c1b6f3ed18e3850e2240c15e6ca9e51c)
* Account Manage: Change the last login to the correct login time - Instead of just "now" (https://github.com/slawkens/myaac/commit/0a930e9acb7f3adc708307cb2d4e1f57d9aa08ad)
* Fix Menu div wrong tag/closing (#329) (https://github.com/slawkens/myaac/commit/fcf2b1492147c03ee3aa825284e3c974f6c2f66e)
* tibiacom template: Fix polls link in the widget (https://github.com/slawkens/myaac/commit/54c1f5f486872efad418402b439a1a2e09abaa5f)
* Fix xdebug warnings in load_config_lua (https://github.com/slawkens/myaac/commit/347ad40da10afa39b6c8cabd73937a21a3b629f6)
### Internal
* Replace firstChild with firstElementChild (Thanks to @un000000) (https://github.com/slawkens/myaac/commit/496499abbb54da738bf9190cf9cf962a5e3ce4ba)
* Cache::remember -1 = infinite (https://github.com/slawkens/myaac/commit/92254e2671ec6f37e936f48f07ec645c7c595a5a)
* Cache::remember: $ttl = 0 means no cache (https://github.com/slawkens/myaac/commit/364b140316346c3f8720caefb709fb1c412369ad)
* Use apcu_clear_cache to clear cache (https://github.com/slawkens/myaac/commit/6715a83d03851bd191d74f431031495df27ea8f9)
## [0.8.24 - 03.06.2025]
### Added
* Add code to insert guild_ranks on guild create, in case guild trigger is missing (https://github.com/slawkens/myaac/commit/149e10261befab22a38246bd792e2e4d1c42ef1e)
* Two new hooks for pages loaded from database (custom pages): HOOK_BEFORE_PAGE_CUSTOM + HOOK_AFTER_PAGE_CUSTOM (https://github.com/slawkens/myaac/commit/e542e8a7cebad2d4bd6984c62cd6f385363ba9eb)
* Add code to insert guild_ranks on guild create, in case the guild trigger is missing (https://github.com/slawkens/myaac/commit/149e10261befab22a38246bd792e2e4d1c42ef1e)
* Two new hooks for pages loaded from a database (custom pages): HOOK_BEFORE_PAGE_CUSTOM + HOOK_AFTER_PAGE_CUSTOM (https://github.com/slawkens/myaac/commit/e542e8a7cebad2d4bd6984c62cd6f385363ba9eb)
* Load hooks before twig, add new hooks: HOOK_TWIG + HOOK_INIT (https://github.com/slawkens/myaac/commit/5726c9fa94e6f5a198917f6bda9014c0cbb141fb)
* New hooks for account characters change-comment page (https://github.com/slawkens/myaac/commit/76440a37d009b845db9157312f2807774e15de14)

View File

@@ -26,7 +26,7 @@
if (version_compare(phpversion(), '7.2.5', '<')) die('PHP version 7.2.5 or higher is required.');
define('MYAAC', true);
define('MYAAC_VERSION', '0.8.24');
define('MYAAC_VERSION', '0.8.25');
define('DATABASE_VERSION', 33);
define('TABLE_PREFIX', 'myaac_');
define('START_TIME', microtime(true));

View File

@@ -37,7 +37,7 @@ if($db->hasTable(TABLE_PREFIX . 'account_actions')) {
else {
// import schema
try {
$db->query(file_get_contents(BASE . 'install/includes/schema.sql'));
$db->exec(file_get_contents(BASE . 'install/includes/schema.sql'));
$locale['step_database_success_schema'] = str_replace('$PREFIX$', TABLE_PREFIX, $locale['step_database_success_schema']);
success($locale['step_database_success_schema']);

View File

@@ -823,11 +823,11 @@ function getWorldName($id)
*
* @param string $to Recipient email address.
* @param string $subject Subject of the message.
* @param string $body Message body in html format.
* @param string $body Message body in HTML format.
* @param string $altBody Alternative message body, plain text.
* @return bool PHPMailer status returned (success/failure).
*/
function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
function _mail(string $to, string $subject, string $body, string $altBody = ''): bool
{
/** @var PHPMailer $mailer */
global $mailer, $config;
@@ -841,15 +841,6 @@ function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
$mailer->clearAllRecipients();
}
$signature_html = '';
if(isset($config['mail_signature']['html']))
$signature_html = $config['mail_signature']['html'];
if($add_html_tags && isset($body[0]))
$tmp_body = '<html><head></head><body>' . $body . '<br/><br/>' . $signature_html . '</body></html>';
else
$tmp_body = $body . '<br/><br/>' . $signature_html;
if($config['smtp_enabled'])
{
$mailer->isSMTP();
@@ -864,6 +855,12 @@ function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
$mailer->isMail();
}
if(isset($config['mail_signature']['html'])) {
$signature_html = $config['mail_signature']['html'];
}
$tmp_body = $body . '<br/><br/>' . $signature_html;
$mailer->isHTML(isset($body[0]) > 0);
$mailer->From = $config['mail_address'];
$mailer->Sender = $config['mail_address'];
@@ -934,11 +931,12 @@ function load_config_lua($filename)
foreach($lines as $ln => $line)
{
$line = trim($line);
if(@$line[0] === '{' || @$line[0] === '}') {
if(isset($line[0]) && ($line[0] === '{' || $line[0] === '}')) {
// arrays are not supported yet
// just ignore the error
continue;
}
$tmp_exp = explode('=', $line, 2);
if(strpos($line, 'dofile') !== false)
{
@@ -1177,6 +1175,10 @@ function clearCache()
if ($cache->fetch('last_kills', $tmp)) {
$cache->delete('last_kills');
}
if (function_exists('apcu_clear_cache')) {
apcu_clear_cache();
}
}
deleteDirectory(CACHE . 'signatures', ['index.html'], true);
@@ -1338,6 +1340,43 @@ function getDatabasePages($withHidden = false): array
return $ret;
}
function getStatusUptimeReadable(int $uptime): string
{
$fullMinute = 60;
$fullHour = (60 * $fullMinute);
$fullDay = (24 * $fullHour);
$fullMonth = (30 * $fullDay);
$fullYear = (365 * $fullDay);
// years
$years = floor($uptime / $fullYear);
$y = ($years > 1 ? "$years years, " : ($years == 1 ? 'year, ' : ''));
$uptime -= $years * $fullYear;
// months
$months = floor($uptime / $fullMonth);
$m = ($months > 1 ? "$months months, " : ($months == 1 ? 'month, ' : ''));
$uptime -= $months * $fullMonth;
// days
$days = floor($uptime / $fullDay);
$d = ($days > 1 ? "$days days, " : ($days == 1 ? 'day, ' : ''));
$uptime -= $days * $fullDay;
// hours
$hours = floor($uptime / $fullHour);
$uptime -= $hours * $fullHour;
// minutes
$min = floor($uptime / $fullMinute);
return "{$y}{$m}{$d}{$hours}h {$min}m";
}
// validator functions
require_once LIBS . 'validator.php';
require_once SYSTEM . 'compat/base.php';

View File

@@ -114,7 +114,7 @@ class Cache
public static function remember($key, $ttl, $callback)
{
$cache = self::getInstance();
if(!$cache->enabled()) {
if(!$cache->enabled() || $ttl == 0) {
return $callback();
}
@@ -123,8 +123,13 @@ class Cache
return unserialize($value);
}
// -1 for infinite cache
if ($ttl == -1) {
$ttl = 10 * 365 * 24 * 60 * 60; // 10 years should be enough
}
$value = $callback();
$cache->set($key, serialize($value),$ttl);
$cache->set($key, serialize($value), $ttl);
return $value;
}
}

View File

@@ -230,6 +230,7 @@ class Forum
if(!is_int($rows / 2)) { $bgcolor = 'ABED25'; } else { $bgcolor = '23ED25'; } $rows++;
$text = str_ireplace('[code]'.$code.'[/code]', '<i>Code:</i><br /><table cellpadding="0" style="background-color: #'.$bgcolor.'; width: 480px; border-style: dotted; border-color: #CCCCCC; border-width: 2px"><tr><td>'.$code.'</td></tr></table>', $text);
}
$rows = 0;
while(stripos($text, '[quote]') !== false && stripos($text, '[/quote]') !== false )
{
@@ -237,11 +238,31 @@ class Forum
if(!is_int($rows / 2)) { $bgcolor = 'AAAAAA'; } else { $bgcolor = 'CCCCCC'; } $rows++;
$text = str_ireplace('[quote]'.$quote.'[/quote]', '<table cellpadding="0" style="background-color: #'.$bgcolor.'; width: 480px; border-style: dotted; border-color: #007900; border-width: 2px"><tr><td>'.$quote.'</td></tr></table>', $text);
}
$rows = 0;
while(stripos($text, '[url]') !== false && stripos($text, '[/url]') !== false )
{
$url = substr($text, stripos($text, '[url]')+5, stripos($text, '[/url]') - stripos($text, '[url]') - 5);
$text = str_ireplace('[url]'.$url.'[/url]', '<a href="'.$url.'" target="_blank">'.$url.'</a>', $text);
$tagsToParse = [
'url' => function ($str) {
return '<a href="'.$str.'" target="_blank">'.$str.'</a>';
},
'player' => function ($str) {
return generateLink(getPlayerLink($str, false), $str, true);
},
'guild' => function ($str) {
return generateLink(getGuildLink($str, false), $str, true);
},
'house' => function ($str) {
return generateLink(getHouseLink($str, false), $str, true);
}
];
foreach ($tagsToParse as $tag => $callback) {
while(stripos($text, "[$tag]") !== false && stripos($text, "[/$tag]") !== false
&& stripos($text, "[$tag]") < stripos($text, "[/$tag]"))
{
$length = strlen("[$tag]");
$substr = substr($text, stripos($text, "[$tag]") + $length, stripos($text, "[/$tag]") - stripos($text, "[$tag]") - $length);
$text = str_ireplace('[' . $tag . ']' . $substr . '[/' . $tag . ']', $callback($substr), $text);
}
}
$xhtml = false;
@@ -251,9 +272,6 @@ class Forum
'#\[u\](.*?)\[/u\]#si' => ($xhtml ? '<span style="text-decoration: underline;">\\1</span>' : '<u>\\1</u>'),
'#\[s\](.*?)\[/s\]#si' => ($xhtml ? '<strike>\\1</strike>' : '<s>\\1</s>'),
'#\[guild\](.*?)\[/guild\]#si' => urldecode(generateLink(getGuildLink('$1', false), '$1', true)),
'#\[house\](.*?)\[/house\]#si' => urldecode(generateLink(getHouseLink('$1', false), '$1', true)),
'#\[player\](.*?)\[/player\]#si' => urldecode(generateLink(getPlayerLink('$1', false), '$1', true)),
// TODO: [poll] tag
'#\[color=(.*?)\](.*?)\[/color\]#si' => ($xhtml ? '<span style="color: \\1;">\\2</span>' : '<span style="color: \\1">\\2</span>'),

View File

@@ -216,8 +216,8 @@ class OTS_DB_MySQL extends OTS_Base_DB
return $this->hasColumnInternal($table, $column);
}
private function hasColumnInternal($table, $column) {
return $this->hasTable($table) && ($this->has_column_cache[$table . '.' . $column] = count($this->query('SHOW COLUMNS FROM `' . $table . "` LIKE '" . $column . "'")->fetchAll()) > 0);
private function hasColumnInternal($table, $column): bool {
return $this->hasTable($table) && ($this->has_column_cache[$table . '.' . $column] = count($this->query('SHOW COLUMNS FROM `' . $table . "` LIKE " . $this->quote($column))->fetchAll()) > 0);
}
public function hasTableAndColumns(string $table, array $columns = []): bool

View File

@@ -92,6 +92,8 @@ class OTS_ServerInfo
return new OTS_Buffer($data);
}
log_append('status-error.log', "Cannot connect to {$this->server}:{$this->port} - Error code: $error, message: $message");
return false;
}

View File

@@ -232,8 +232,9 @@ if($save)
}
else
{
error('An error occorred while sending email! Account not created. Try again. For Admin: More info can be found in system/logs/mailer-error.log');
error('An error occurred while sending email! Account not created. Try again. For Admin: More info can be found in system/logs/mailer-error.log');
$new_account->delete();
return;
}
}
else

View File

@@ -24,7 +24,7 @@ if(Forum::canPost($account_logged))
{
$first_post = $db->query("SELECT `" . FORUM_TABLE_PREFIX . "forum`.`author_guid`, `" . FORUM_TABLE_PREFIX . "forum`.`author_aid`, `" . FORUM_TABLE_PREFIX . "forum`.`first_post`, `" . FORUM_TABLE_PREFIX . "forum`.`post_topic`, `" . FORUM_TABLE_PREFIX . "forum`.`post_text`, `" . FORUM_TABLE_PREFIX . "forum`.`post_smile`, `" . FORUM_TABLE_PREFIX . "forum`.`id`, `" . FORUM_TABLE_PREFIX . "forum`.`section` FROM `" . FORUM_TABLE_PREFIX . "forum` WHERE `" . FORUM_TABLE_PREFIX . "forum`.`id` = ".(int) $thread['first_post']." LIMIT 1")->fetch();
echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($thread['section']) . '">'.$sections[$thread['section']]['name'].'</a> >> <a href="' . getForumThreadLink($thread['first_post']) . '">'.htmlspecialchars($first_post['post_topic']).'</a> >> <b>Edit post</b>';
if(Forum::hasAccess($thread['section'] && ($account_logged->getId() == $thread['author_aid'] || Forum::isModerator())))
if(Forum::hasAccess($thread['section']) && ($account_logged->getId() == $thread['author_aid'] || Forum::isModerator()))
{
$char_id = $post_topic = $text = $smile = $html = null;
$players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();

View File

@@ -115,7 +115,7 @@ if(!$news_cached)
);
}
$tickers_db = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'news` WHERE `type` = ' . TICKER .($canEdit ? '' : ' AND `hidden` != 1') .' ORDER BY `date` DESC LIMIT ' . $config['news_ticker_limit']);
$tickers_db = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'news` WHERE `type` = ' . TICKER . ' AND `hidden` != 1 ORDER BY `date` DESC LIMIT ' . $config['news_ticker_limit']);
$tickers_content = '';
if($tickers_db->rowCount() > 0)
{
@@ -134,7 +134,7 @@ if(!$news_cached)
if($cache->enabled() && !$canEdit)
$cache->set('news_' . $template_name . '_' . TICKER, $tickers_content, 60 * 60);
$featured_article_db =$db->query('SELECT `id`, `title`, `article_text`, `article_image`, `hidden` FROM `' . TABLE_PREFIX . 'news` WHERE `type` = ' . ARTICLE . ($canEdit ? '' : ' AND `hidden` != 1') .' ORDER BY `date` DESC LIMIT 1');
$featured_article_db =$db->query('SELECT `id`, `title`, `article_text`, `article_image`, `hidden` FROM `' . TABLE_PREFIX . 'news` WHERE `type` = ' . ARTICLE . ' AND `hidden` != 1 ORDER BY `date` DESC LIMIT 1');
$article = '';
if($featured_article_db->rowCount() > 0) {
$article = $featured_article_db->fetch();
@@ -166,7 +166,7 @@ else {
if(!$news_cached)
{
ob_start();
$newses = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'news') . ' WHERE type = ' . NEWS . ($canEdit ? '' : ' AND hidden != 1') . ' ORDER BY date' . ' DESC LIMIT ' . $config['news_limit']);
$newses = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'news') . ' WHERE type = ' . NEWS . ' AND hidden != 1 ORDER BY date' . ' DESC LIMIT ' . $config['news_limit']);
if($newses->rowCount() > 0)
{
foreach($newses as $news)
@@ -227,4 +227,4 @@ if(!$news_cached)
echo $tmp_content;
}
else
echo $news_cached;
echo $news_cached;

View File

@@ -143,13 +143,7 @@ function updateStatus() {
}
$uptime = $status['uptime'] = $serverStatus->getUptime();
$m = date('m', $uptime);
$m = $m > 1 ? "$m months, " : ($m == 1 ? 'month, ' : '');
$d = date('d', $uptime);
$d = $d > 1 ? "$d days, " : ($d == 1 ? 'day, ' : '');
$h = date('H', $uptime);
$min = date('i', $uptime);
$status['uptimeReadable'] = "{$m}{$d}{$h}h {$min}m";
$status['uptimeReadable'] = getStatusUptimeReadable($uptime);
$status['monsters'] = $serverStatus->getMonstersCount();
$status['motd'] = $serverStatus->getMOTD();

View File

@@ -109,7 +109,7 @@
</tr>
<tr style="background-color: {{ config.darkborder }};" >
<td>Last Login:</td>
<td>{{ "now"|date("j F Y, G:i:s") }}</td>
<td>{{ account_logged.getCustomField('web_lastlogin')|date("j F Y, G:i:s") }}</td>
</tr>
{% autoescape false %}
<tr style="background-color: {{ config.lightborder }};" >
@@ -173,7 +173,7 @@
{% set i = i + 1 %}
<tr bgcolor="{{ getStyle(i) }}">
<td>
<a href="{{ getLink('characters/' ~ player.getName()|urlencode) }}">{{ player.getName() }}</a>
<a href="{{ getLink('characters/' ~ player.getName()|urlencode) }}">{{ player.getName() }}</a>{% if player.isDeleted() %}<span style="color: red"><b> [ DELETED ] </b></span>{% endif %}
</td>
<td>{{ player.getLevel() }}</td>
<td>{{ player.getVocationName() }}</td>

View File

@@ -9,7 +9,7 @@
<div class="AttentionSign" style="background-image:url({{ template_path }}/images/content/attentionsign.gif);"></div>
<b>The Following Errors Have Occurred:</b><br/>
{% for error in errors %}
<li>{{ error|striptags('<b>')|raw }}</li>
<li>{{ error|striptags('<b><a>')|raw }}</li>
{% endfor %}
</div>
<div class="BoxFrameHorizontal" style="background-image:url({{ template_path }}/images/content/box-frame-horizontal.gif);"></div>
@@ -17,4 +17,4 @@
<div class="BoxFrameEdgeLeftBottom" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);"></div>
</div>
</div>
<br/>
<br/>

View File

@@ -104,10 +104,10 @@
{% if config.online_outfit %}
<td width="5%"><img style="position:absolute;margin-top:{% if player.player.looktype in [75, 266, 302] %}-20px;margin-left:-0px;{% else %}-45px;margin-left:-25px;{% endif %}" src="{{ player.outfit }}" alt="player outfit"/></td>
{% endif %}
<td>{{ player.name|raw }}{{ player.skull }}</td>
<td>{{ player.name|raw }}{{ player.skull|raw }}</td>
<td>{{ player.level }}</td>
<td>{{ player.vocation }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% endif %}

View File

@@ -50,6 +50,10 @@ $twig->addFunction($function);
$function = new TwigFunction('hook', function ($context, $hook, array $params = []) {
global $hooks;
if (config('hooks_debug')) {
note($hook);
}
if(is_string($hook)) {
if (defined($hook)) {
$hook = constant($hook);
@@ -85,3 +89,5 @@ $twig->addFilter($filter);
unset($function, $filter);
$hooks->trigger(HOOK_TWIG, ['twig' => $twig, 'twig_loader' => $twig_loader]);
$twig->addGlobal('cache', $cache);

View File

@@ -161,7 +161,7 @@
</tr>
<tr style="background-color: {{ config.darkborder }};" >
<td class="LabelV" >Last Login:</td>
<td>{{ "now"|date("j F Y, G:i:s") }}</td>
<td>{{ account_logged.getCustomField('web_lastlogin')|date("j F Y, G:i:s") }}</td>
</tr>
{% autoescape false %}
<tr style="background-color: {{ config.lightborder }};" >

View File

@@ -1,6 +1,6 @@
<div id="CurrentPollBox" class="Themebox" style="background-image:url({{ template_path }}/images/themeboxes/current-poll/currentpollbox.gif);">
<div id="CurrentPollText">{{ poll.question }}</div>
<a class="ThemeboxButton" href="{{ getLink('polls') }}/{{ poll.id }}" onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" style="background-image:url({{ template_path }}/images/global/buttons/sbutton.gif);"><div class="BigButtonOver" style="background-image:url({{ template_path }}/images/global/buttons/sbutton_over.gif);"></div><div class="ButtonText" style="background-image:url({{ template_path }}/images/global/buttons/_sbutton_votenow.gif);"></div>
<a class="ThemeboxButton" href="{{ getLink('polls') }}?id={{ poll.id }}" onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" style="background-image:url({{ template_path }}/images/global/buttons/sbutton.gif);"><div class="BigButtonOver" style="background-image:url({{ template_path }}/images/global/buttons/sbutton_over.gif);"></div><div class="ButtonText" style="background-image:url({{ template_path }}/images/global/buttons/_sbutton_votenow.gif);"></div>
</a>
<div class="Bottom" style="background-image:url({{ template_path }}/images/general/box-bottom.gif);"></div>
</div>

View File

@@ -82,13 +82,13 @@ if(isset($config['boxes']))
// mouse-over and click events of the loginbox
function MouseOverLoginBoxText(source)
{
source.lastChild.style.visibility = "visible";
source.firstChild.style.visibility = "hidden";
source.lastElementChild.style.visibility = "visible";
source.firstElementChild.style.visibility = "hidden";
}
function MouseOutLoginBoxText(source)
{
source.firstChild.style.visibility = "visible";
source.lastChild.style.visibility = "hidden";
source.firstElementChild.style.visibility = "visible";
source.lastElementChild.style.visibility = "hidden";
}
function LoginButtonAction()
{
@@ -146,7 +146,10 @@ if(isset($config['boxes']))
// hide or show the corresponding submenus
function InitializeMenu()
{
for(menuItemName in menu[0]) {
for(menuItemName in menu[0]) {
if (!document.getElementById(menuItemName+"_Submenu")) {
continue;
}
if(menu[0][menuItemName] == "0") {
document.getElementById(menuItemName+"_Submenu").style.visibility = "hidden";
document.getElementById(menuItemName+"_Submenu").style.display = "none";
@@ -205,11 +208,11 @@ if(isset($config['boxes']))
// mouse-over effects of menubuttons and submenuitems
function MouseOverMenuItem(source)
{
source.firstChild.style.visibility = "visible";
source.firstElementChild.style.visibility = "visible";
}
function MouseOutMenuItem(source)
{
source.firstChild.style.visibility = "hidden";
source.firstElementChild.style.visibility = "hidden";
}
function MouseOverSubmenuItem(source)
{
@@ -315,7 +318,7 @@ if(isset($config['boxes']))
<div id="LoginBottom" class="Loginstatus" style="background-image:url(<?php echo $template_path; ?>/images/general/box-bottom.gif)" ></div>
</div>
<div-- id='Menu'>
<div id='Menu'>
<div id='MenuTop' style='background-image:url(<?php echo $template_path; ?>/images/general/box-top.gif);'></div>
<?php
@@ -371,6 +374,7 @@ foreach($config['menu_categories'] as $id => $cat) {
<?php
}
?>
</div>
<script type="text/javascript">
InitializePage();
</script>
@@ -428,7 +432,7 @@ foreach($config['menu_categories'] as $id => $cat) {
foreach($config['boxes'] as $box) {
/** @var string $template_name */
$file = TEMPLATES . $template_name . '/boxes/' . $box . '.php';
$file = __DIR__ . '/boxes/' . $box . '.php';
if(file_exists($file)) {
include($file); ?>
<?php

View File

@@ -1,11 +1,11 @@
function MouseOverBigButton(source) {
if (source?.firstChild?.style) {
source.firstChild.style.visibility = "visible";
if (source?.firstElementChild?.style) {
source.firstElementChild.style.visibility = "visible";
}
}
function MouseOutBigButton(source) {
if (source?.firstChild?.style) {
source.firstChild.style.visibility = "hidden";
if (source?.firstElementChild?.style) {
source.firstElementChild.style.visibility = "hidden";
}
}
function BigButtonAction(path) {

View File

@@ -33,14 +33,14 @@
if(!isset($_REQUEST['name']))
die('Please enter name as get or post parameter.');
$name = stripslashes(ucwords(strtolower(trim($_REQUEST['name']))));
$player = new OTS_Player();
$player->find($name);
$player->find($_REQUEST['name']);
if(!$player->isLoaded())
{
header('Content-type: image/png');
readfile(SIGNATURES_IMAGES.'nocharacter.png');
//header('Content-type: image/png');
//readfile(SIGNATURES_IMAGES.'nocharacter.png');
http_response_code(404);
exit;
}