Compare commits

...

20 Commits
v1.7 ... main

Author SHA1 Message Date
slawkens
2fe9924437 Start 1.7.2-dev 2025-07-08 19:20:45 +02:00
slawkens
f0f2e3785f Fix phpstan 2025-07-08 15:44:45 +02:00
slawkens
36ca755243 New setting: Display Skills Box on highscores
Better space management
2025-07-08 14:28:48 +02:00
slawkens
f17269e44c Move admin bar code into body_start place_holder 2025-07-08 14:22:51 +02:00
slawkens
dcb96f4ce1 Refactor code - early exit 2025-07-08 13:48:33 +02:00
slawkens
a89f9a8484 Set $process_sections to true 2025-07-08 09:22:12 +02:00
slawkens
45d6047031 Add Coins Transferable to accounts editor 2025-07-05 14:22:58 +02:00
slawkens
c92148d467 Revert delete clearRouteCache, is used somewhere else 2025-06-27 07:23:22 +02:00
slawkens
b4b62442fe Release v1.7.1 2025-06-27 07:21:19 +02:00
slawkens
047742848b Delete clearRouteCache, was useless
Directory is cleaned already
2025-06-27 07:15:13 +02:00
slawkens
fe8281594e Fix cache:clear command (missing init) 2025-06-27 07:13:33 +02:00
slawkens
0bff910a05 adjust command email:send + mail:send (alias) 2025-06-25 19:43:40 +02:00
slawkens
6d43fc181f In case the script don't have install option, inform the user 2025-06-25 17:36:43 +02:00
slawkens
13d33822b5 Rename to plugin:setup, also add alias to previous command 2025-06-25 17:36:02 +02:00
slawkens
f78ebad136 Remove error number from 404 & 405 pages 2025-06-24 14:57:01 +02:00
slawkens
d90fa323d7 Fix polls link 2025-06-24 12:44:43 +02:00
slawkens
181131f7f3 Use __DIR__ instead of template path 2025-06-24 12:44:34 +02:00
slawkens
0da524fefe Fix plugin install:install command 2025-06-23 00:21:41 +02:00
slawkens
6cf4b9dac5 Fix xdebug warnings in load_config_lua 2025-06-22 18:51:20 +02:00
slawkens
5cfa3a697f Start v1.7.1-dev 2025-06-22 11:25:45 +02:00
16 changed files with 239 additions and 195 deletions

View File

@ -1,5 +1,14 @@
# Changelog
## [1.7.1 - 27.06.2025]
### Changed
* Rename plugin:install:install to plugin:setup, also add alias to previous command (https://github.com/slawkens/myaac/commit/13d33822b59df349199e885a78a3d6beb0863d0b)
### Fixed
* Fix commands: setup + cache:clear (https://github.com/slawkens/myaac/commit/0da524fefe93b3028392e9014550eea3324d3a22, https://github.com/slawkens/myaac/commit/fe8281594e989f00280ba1adc734a9198c6b5cc1)
* Fix polls link in tibiacom template (https://github.com/slawkens/myaac/commit/d90fa323d7c77d81768df60feeb1c374b1650a0c)
## [1.7 - 22.06.2025]
### Added

View File

@ -27,6 +27,13 @@ $nameOrNumberColumn = getAccountIdentityColumn();
$hasSecretColumn = $db->hasColumn('accounts', 'secret');
$hasCoinsColumn = $db->hasColumn('accounts', 'coins');
$hasCoinsTransferableColumn = $db->hasColumn('accounts', 'coins_transferable');
$hasTransferableCoinsColumn = $db->hasColumn('accounts', 'transferable_coins');
$coinsTransferableColumn =
$hasTransferableCoinsColumn ?
'transferable_coins' : 'coins_transferable';
$hasPointsColumn = $db->hasColumn('accounts', 'premium_points');
$hasTypeColumn = $db->hasColumn('accounts', 'type');
$hasGroupColumn = $db->hasColumn('accounts', 'group_id');
@ -136,11 +143,18 @@ else if (isset($_REQUEST['search'])) {
if (!Validator::email($email))
$errors['email'] = Validator::getLastError();
//tibia coins
// tibia coins
if ($hasCoinsColumn) {
$t_coins = $_POST['t_coins'];
verify_number($t_coins, 'Tibia coins', 12);
}
// transferable tibia coins
if ($hasCoinsTransferableColumn || $hasTransferableCoinsColumn) {
$t_coins_transferable = $_POST['t_coins_transferable'];
verify_number($t_coins_transferable, 'Transferable Tibia coins', 12);
}
// prem days
$p_days = (int)$_POST['p_days'];
verify_number($p_days, 'Prem days', 11);
@ -185,12 +199,18 @@ else if (isset($_REQUEST['search'])) {
if ($hasSecretColumn) {
$account->setCustomField('secret', $secret);
}
$account->setCustomField('key', $key);
$account->setEMail($email);
if ($hasCoinsColumn) {
$account->setCustomField('coins', $t_coins);
}
if ($hasCoinsTransferableColumn || $hasTransferableCoinsColumn) {
$account->setCustomField($coinsTransferableColumn, $t_coins_transferable);
}
$lastDay = 0;
if($p_days != 0 && $p_days != OTS_Account::GRATIS_PREMIUM_DAYS) {
$lastDay = time();
@ -401,6 +421,12 @@ else if (isset($_REQUEST['search'])) {
<input type="text" class="form-control" id="t_coins" name="t_coins" autocomplete="off" maxlength="11" value="<?php echo $account->getCustomField('coins') ?>"/>
</div>
<?php endif; ?>
<?php if ($hasCoinsTransferableColumn || $hasTransferableCoinsColumn): ?>
<div class="col-12 col-sm-12 col-lg-6">
<label for="t_coins_transferable">Transferable Tibia Coins:</label>
<input type="text" class="form-control" id="t_coins_transferable" name="t_coins_transferable" autocomplete="off" maxlength="11" value="<?php echo $account->getCustomField($coinsTransferableColumn) ?>"/>
</div>
<?php endif; ?>
<div class="col-12 col-sm-12 col-lg-6">
<label for="p_days">Premium Days:</label>
<input type="text" class="form-control" id="p_days" name="p_days" autocomplete="off" maxlength="11" value="<?php echo $account->getPremDays(); ?>"/>

View File

@ -26,7 +26,7 @@
if (version_compare(phpversion(), '8.1', '<')) die('PHP version 8.1 or higher is required.');
const MYAAC = true;
const MYAAC_VERSION = '1.7';
const MYAAC_VERSION = '1.7.2-dev';
const DATABASE_VERSION = 45;
const TABLE_PREFIX = 'myaac_';
define('START_TIME', microtime(true));

View File

@ -162,15 +162,6 @@ if(setting('core.anonymous_usage_statistics')) {
}
}
/**
* @var OTS_Account $account_logged
*/
if ($logged && admin()) {
$content .= $twig->render('admin-bar.html.twig', [
'username' => USE_ACCOUNT_NAME ? $account_logged->getName() : $account_logged->getId()
]);
}
$title_full = (isset($title) ? $title . ' - ' : '') . $config['lua']['serverName'];
require $template_path . '/' . $template_index;

View File

@ -512,6 +512,13 @@ function template_place_holder($type): string
}
elseif ($type === 'body_start') {
$ret .= $twig->render('browsehappy.html.twig');
if (admin()) {
global $account_logged;
$ret .= $twig->render('admin-bar.html.twig', [
'username' => USE_ACCOUNT_NAME ? $account_logged->getName() : $account_logged->getId()
]);
}
}
elseif($type === 'body_end') {
$ret .= template_ga_code();
@ -982,11 +989,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(str_contains($line, 'dofile')) {
$delimiter = '"';
@ -1274,9 +1282,6 @@ function clearCache()
deleteDirectory(CACHE . 'plugins', ['index.html'], true);
deleteDirectory(CACHE, ['signatures', 'twig', 'plugins', 'index.html', 'persistent'], true);
// routes cache
clearRouteCache();
global $hooks;
$hooks->trigger(HOOK_CACHE_CLEAR, ['cache' => Cache::getInstance()]);

View File

@ -8,7 +8,7 @@
* @link https://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = '404 Not Found';
$title = 'Not Found';
header('HTTP/1.0 404 Not Found');
?>

View File

@ -8,7 +8,7 @@
* @link https://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = '405 Method Not Allowed';
$title = 'Method Not Allowed';
header('HTTP/1.0 405 Method Not Allowed');
?>

View File

@ -1062,6 +1062,12 @@ Sent by MyAAC,<br/>
'desc' => 'How often to update highscores from database in minutes. Too low may slow down your website.<br/>0 to disable.',
'default' => 15,
],
'highscores_skills_box' => [
'name' => 'Display Skills Box',
'type' => 'boolean',
'desc' => 'show "Choose a skill" box on the highscores (allowing peoples to sort highscores by skill)?',
'default' => true,
],
'highscores_vocation_box' => [
'name' => 'Display Vocation Box',
'type' => 'boolean',

View File

@ -17,10 +17,7 @@ class CacheClearCommand extends Command
protected function execute(InputInterface $input, OutputInterface $output): int
{
global $hooks;
$hooks = new Hooks();
$hooks->load();
$hooks->trigger(HOOK_INIT);
require SYSTEM . 'init.php';
$io = new SymfonyStyle($input, $output);

View File

@ -12,9 +12,10 @@ class MailSendCommand extends Command
{
protected function configure(): void
{
$this->setName('mail:send')
$this->setName('email:send')
->setAliases(['mail:send'])
->setDescription('This command sends E-Mail to single user. Message can be provided as follows: ' . PHP_EOL
. ' echo "Hello World" | php sa email:send --subject="This is the subject" test@test.com')
. ' echo "Hello World" | php aac email:send --subject="This is the subject" test@test.com')
->addArgument('recipient', InputArgument::REQUIRED, 'Email, Account Name, Account id or Player Name')
->addOption('subject', 's', InputOption::VALUE_REQUIRED, 'Subject');
}

View File

@ -12,7 +12,8 @@ class PluginInstallInstallCommand extends Command
{
protected function configure(): void
{
$this->setName('plugin:install:install')
$this->setName('plugin:setup')
->setAliases(['plugin:install:install'])
->setDescription('This command executes the "install" part of the plugin')
->addArgument('plugin', InputArgument::REQUIRED, 'Plugin name');
}

View File

@ -532,8 +532,9 @@ class Plugins {
self::$plugin_json = $plugin_json;
if ($plugin_json == null) {
self::$warnings[] = 'Cannot load ' . $file_name . '. File might be not a valid json code.';
return false;
}
else {
$continue = true;
if(!isset($plugin_json['name']) || empty(trim($plugin_json['name']))) {
@ -689,7 +690,10 @@ class Plugins {
}
}
if($continue) {
if(!$continue) {
return false;
}
if(!$zip->extractTo(BASE)) { // "Real" Install
self::$error = 'There was a problem with extracting zip archive to base directory.';
$zip->close();
@ -713,13 +717,8 @@ class Plugins {
}
clearCache();
return true;
}
}
return false;
}
public static function isEnabled($pluginFileName): bool
{
@ -781,15 +780,20 @@ class Plugins {
return false;
}
if(!isset($plugin_json['install'])) {
self::$error = "Plugin doesn't have install options defined. Skipping...";
$install = $plugin_json['install'] ?? '';
if (self::getAutoLoadOption($plugin_json, 'install', true) && is_file(PLUGINS . $plugin_name . '/install.php')) {
$install = 'plugins/' . $plugin_name . '/install.php';
}
if (empty($install)) {
self::$error = "This plugin doesn't seem to have install script defined.";
return false;
}
global $db;
if (file_exists(BASE . $plugin_json['install'])) {
if (file_exists(BASE . $install)) {
$db->revalidateCache();
require BASE . $plugin_json['install'];
require BASE . $install;
$db->revalidateCache();
}
else {

View File

@ -91,7 +91,7 @@ else {
$file = BASE . $template_path . '/layout_config.ini';
}
$template_ini = parse_ini_file($file);
$template_ini = parse_ini_file($file, true);
unset($file);
if ($cache->enabled()) {

View File

@ -94,8 +94,10 @@
{% endif %}
</table>
</td>
{% if setting('core.highscores_skills_box') or setting('core.highscores_vocation_box') %}
<td width="5%"></td>
<td width="15%" valign="top" align="right">
{% if setting('core.highscores_skills_box') %}
<table style="border: 0; width: 100%" cellpadding="4" cellspacing="1">
<tr bgcolor="{{ config.vdarkborder }}">
<td class="white"><B>Choose a skill</B></TD>
@ -109,7 +111,8 @@
</tr>
</table>
<br/>
{% if config.highscores_vocation_box %}
{% endif %}
{% if setting('core.highscores_vocation_box') %}
<table border="0" width="100%" cellpadding="4" cellspacing="1">
<tr bgcolor="{{ config.vdarkborder }}">
<td class="white"><b>Choose a vocation</b></td>
@ -126,5 +129,6 @@
{% endif %}
</td>
<td style="width: 18px"></td>
{% endif %}
</tr>
</table>

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') }}?ìd={{ 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

@ -454,7 +454,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