From 8e6749c59984631288e8e9803819b2f0ff389761 Mon Sep 17 00:00:00 2001 From: slawkens Date: Mon, 24 Nov 2025 18:04:09 +0100 Subject: [PATCH 1/6] Hook for adding custom rules to validate new character name --- system/src/Validator.php | 10 ++++++++++ system/src/global.php | 1 + 2 files changed, 11 insertions(+) diff --git a/system/src/Validator.php b/system/src/Validator.php index ad9e3e50..7261454e 100644 --- a/system/src/Validator.php +++ b/system/src/Validator.php @@ -342,6 +342,16 @@ class Validator } } + global $hooks; + + $params = ['name' => $name, 'error' => '']; + $hooks->triggerFilter(HOOK_FILTER_VALIDATE_CHARACTER_NEW_NAME, $params); + + if (!empty($params['error'])) { + self::$lastError = $params['error']; + return false; + } + return true; } diff --git a/system/src/global.php b/system/src/global.php index 85f9476d..a140bdde 100644 --- a/system/src/global.php +++ b/system/src/global.php @@ -108,6 +108,7 @@ define('HOOK_FILTER_ROUTES', ++$i); define('HOOK_FILTER_TWIG_DISPLAY', ++$i); define('HOOK_FILTER_TWIG_RENDER', ++$i); define('HOOK_FILTER_THEME_FOOTER', ++$i); +define('HOOK_FILTER_VALIDATE_CHARACTER_NEW_NAME', ++$i); const HOOK_FIRST = HOOK_INIT; define('HOOK_LAST', $i); From 3011b969a45e4e3149adbfccc0209c0fe3fd5eae Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 30 Nov 2025 17:05:14 +0100 Subject: [PATCH 2/6] Add php 8.5 to cypress workflow --- .github/workflows/cypress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index e93257f1..4dd8e9dd 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: [ '8.1', '8.2', '8.3', '8.4' ] + php-versions: [ '8.1', '8.2', '8.3', '8.4', '8.5' ] ots: ['tfs-1.4', 'canary-3.1.2'] # TODO: add 'tfs-master' (actually doesn't work cause AAC doesn't support reading .env configuration) name: Cypress (PHP ${{ matrix.php-versions }}, ${{ matrix.ots }}) steps: From fd74f01291d0e9cdb92ee1b95021c9d7b591ad7c Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 9 Dec 2025 22:04:21 +0100 Subject: [PATCH 3/6] Fix typo $up -> $down, migration was failing due that --- system/migrations/7.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/migrations/7.php b/system/migrations/7.php index a96ed7c9..5a6a7925 100644 --- a/system/migrations/7.php +++ b/system/migrations/7.php @@ -9,7 +9,7 @@ $up = function () use ($db) { } }; -$up = function () use ($db) { +$down = function () use ($db) { if (!$db->hasColumn(TABLE_PREFIX . 'screenshots', 'name')) { $db->addColumn(TABLE_PREFIX . 'screenshots', 'name', 'VARCHAR(30) NOT NULL'); } From c86257e6dacbad773aa09c0958eeaa106a967f2d Mon Sep 17 00:00:00 2001 From: slawkens Date: Sat, 13 Dec 2025 21:19:00 +0100 Subject: [PATCH 4/6] Highscores: Fix ordering by different skills Adjust order by desc: skill_tries, manaspent, experience --- system/pages/highscores.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/system/pages/highscores.php b/system/pages/highscores.php index cec95d15..79d4feee 100644 --- a/system/pages/highscores.php +++ b/system/pages/highscores.php @@ -176,7 +176,9 @@ if (empty($highscores)) { POT::SKILL_FISH => 'skill_fishing', ); - $query->addSelect($skill_ids[$skill] . ' as value'); + $query + ->addSelect($skill_ids[$skill] . ' as value') + ->orderByDesc($skill_ids[$skill] . '_tries'); } else { $query ->join('player_skills', 'player_skills.player_id', '=', 'players.id') @@ -198,11 +200,11 @@ if (empty($highscores)) { if ($skill == POT::SKILL__MAGLEVEL) { $query ->addSelect('players.maglevel as value', 'players.maglevel') - ->orderBy('manaspent'); + ->orderByDesc('manaspent'); } else { // level $query ->addSelect('players.level as value', 'players.experience') - ->orderBy('experience'); + ->orderByDesc('experience'); $list = 'experience'; } } From 18a1178e4b93607a350259679e0366cb83fb4126 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 14 Dec 2025 10:20:59 +0100 Subject: [PATCH 5/6] Fix exception show on first install, when there is no vendor Before it displayed 500 white page, now it display the exception --- common.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common.php b/common.php index de7a9bfd..fdfd35bd 100644 --- a/common.php +++ b/common.php @@ -148,16 +148,16 @@ if(!IS_CLI) { /** @var array $config */ ini_set('log_errors', 1); -if(@$config['env'] === 'dev' || defined('MYAAC_INSTALL')) { - ini_set('display_errors', 1); - ini_set('display_startup_errors', 1); - error_reporting(E_ALL); -} -else { +if(isset($config['env']) && $config['env'] !== 'dev' && !defined('MYAAC_INSTALL')) { ini_set('display_errors', 0); ini_set('display_startup_errors', 0); error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT); } +else { + ini_set('display_errors', 1); + ini_set('display_startup_errors', 1); + error_reporting(E_ALL); +} $autoloadFile = VENDOR . 'autoload.php'; if (!is_file($autoloadFile)) { From 9ed06782e67772826d927ad847a077b99df5060d Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 14 Dec 2025 10:21:23 +0100 Subject: [PATCH 6/6] Ini set html_errors = 0, to show html code in exceptions --- common.php | 1 + 1 file changed, 1 insertion(+) diff --git a/common.php b/common.php index fdfd35bd..c93cce36 100644 --- a/common.php +++ b/common.php @@ -154,6 +154,7 @@ if(isset($config['env']) && $config['env'] !== 'dev' && !defined('MYAAC_INSTALL' error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT); } else { + ini_set('html_errors', 0); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);