From 2bf5f5a1dbe678976c36cec3acbb9813891d321d Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 26 Feb 2026 16:46:13 +0100 Subject: [PATCH 1/8] Update GiveAdminCommand.php --- system/src/Commands/GiveAdminCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/src/Commands/GiveAdminCommand.php b/system/src/Commands/GiveAdminCommand.php index d2565783..61070a95 100644 --- a/system/src/Commands/GiveAdminCommand.php +++ b/system/src/Commands/GiveAdminCommand.php @@ -39,7 +39,7 @@ class GiveAdminCommand extends Command } if (!$account->isLoaded()) { - $io->error('Cannot find account mit supplied parameter: ' . $accountParam); + $io->error('Cannot find account with supplied parameter: ' . $accountParam); return self::FAILURE; } From 4ae2fdd0dfcd56697612395c14aecc2dfd33b1c3 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 15 Mar 2026 13:02:22 +0100 Subject: [PATCH 2/8] Add page load time to admin panel --- admin/template/template.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admin/template/template.php b/admin/template/template.php index c6b8747b..7ca4492c 100644 --- a/admin/template/template.php +++ b/admin/template/template.php @@ -172,7 +172,8 @@
- + + From dd97a749b4fda78af59b69886788bd33ca7b9c90 Mon Sep 17 00:00:00 2001 From: Slawomir Boczek Date: Mon, 6 Apr 2026 10:41:29 +0200 Subject: [PATCH 3/8] Better name validation, like in the original game website (#356) * Better name validation, like in the original game website * Don't automatically ucfirst and strtolower the cases of the word * This allows for names like: Lord of Ring, Man of the Earth etc. * Don't allow special characters like: -, [], ' * Don't allow one letter words * Require at least one vowel per word * Add notice about admin logged in * Add trim, for future Currently its stripped anyway in the init.php, but AI don't know it :P Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Implement AI recommended changes * Update tools/validate.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Trim $name * Update Validator.php --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- system/pages/account/create.php | 2 +- system/src/Validator.php | 58 ++++++++++++++++++++++----------- tools/validate.php | 12 ++++--- 3 files changed, 47 insertions(+), 25 deletions(-) diff --git a/system/pages/account/create.php b/system/pages/account/create.php index 731771b7..eb41ece5 100644 --- a/system/pages/account/create.php +++ b/system/pages/account/create.php @@ -160,7 +160,7 @@ if($save) } if(setting('core.account_create_character_create')) { - $character_name = isset($_POST['name']) ? stripslashes(ucwords(strtolower($_POST['name']))) : null; + $character_name = isset($_POST['name']) ? trim(stripslashes($_POST['name'])) : null; $character_sex = isset($_POST['sex']) ? (int)$_POST['sex'] : null; $character_vocation = isset($_POST['vocation']) ? (int)$_POST['vocation'] : null; $character_town = isset($_POST['town']) ? (int)$_POST['town'] : null; diff --git a/system/src/Validator.php b/system/src/Validator.php index 7261454e..8857f07b 100644 --- a/system/src/Validator.php +++ b/system/src/Validator.php @@ -183,7 +183,7 @@ class Validator return false; } - // installer doesn't know config.php yet + // installer doesn't know settings yet // that's why we need to ignore the nulls if(defined('MYAAC_INSTALL')) { $minLength = 4; @@ -207,21 +207,15 @@ class Validator return false; } - if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- [ ] '") != $length) + if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM ") != $length) { - self::$lastError = "Invalid name format. Use only A-Z, spaces and '."; + self::$lastError = "This name contains invalid letters. Please use only A-Z, a-z and space!"; return false; } if(preg_match('/ {2,}/', $name)) { - self::$lastError = 'Invalid character name format. Use only A-Z and no double spaces.'; - return false; - } - - if(!preg_match("/[A-z ']/", $name)) - { - self::$lastError = "Invalid name format. Use only A-Z, spaces and '."; + self::$lastError = 'Invalid character name format. Use only A-Z, a-z and no double spaces.'; return false; } @@ -230,17 +224,23 @@ class Validator /** * Validate new character name. - * Name lenght must be 3-25 chars + * Name length must be 3-25 chars * * @param string $name Name to check * @return bool Is name valid? */ public static function newCharacterName($name) { - global $db, $config; + global $db; + $name = trim($name); $name_lower = strtolower($name); + if(strlen($name) < 1) { + self::$lastError = 'Please enter a name.'; + return false; + } + $first_words_blocked = array_merge(["'", '-'], setting('core.create_character_name_blocked_prefix')); foreach($first_words_blocked as $word) { if($word == substr($name_lower, 0, strlen($word))) { @@ -249,11 +249,6 @@ class Validator } } - if(str_ends_with($name_lower, "'") || str_ends_with($name_lower, "-")) { - self::$lastError = 'Your name contains illegal characters.'; - return false; - } - if(substr($name_lower, 1, 1) == ' ') { self::$lastError = 'Your name contains illegal space.'; return false; @@ -265,11 +260,36 @@ class Validator } if(preg_match('/ {2,}/', $name)) { - self::$lastError = 'Invalid character name format. Use only A-Z and numbers 0-9 and no double spaces.'; + self::$lastError = 'Invalid character name format. Use only A-Z and no double spaces.'; return false; } - if(strtolower($config['lua']['serverName']) == $name_lower) { + if (substr($name[0], 0, 1) !== strtoupper(substr($name[0], 0, 1))) { + self::$lastError = 'The first letter of a name has to be a capital letter.'; + return false; + } + + foreach (explode(' ', $name) as $word) { + $wordCut = substr($word, 1, strlen($word)); + $hasUpperCase = preg_match('/[A-Z]/', $wordCut); + if ($hasUpperCase) { + self::$lastError = 'In names capital letters are only allowed at the beginning of a word.'; + return false; + } + + if (strlen($word) == 1) { + self::$lastError = 'This name contains a word with only one letter. Please use more than one letter for each word.'; + return false; + } + + $hasVowel = preg_match('/[aeiouAEIOU]/', $word); + if (!$hasVowel) { + self::$lastError = 'This name contains a word without vowels. Please choose another name.'; + return false; + } + } + + if(strtolower(configLua('serverName')) == $name_lower) { self::$lastError = 'Your name cannot be same as server name.'; return false; } diff --git a/tools/validate.php b/tools/validate.php index 66b39581..bf362131 100644 --- a/tools/validate.php +++ b/tools/validate.php @@ -63,10 +63,7 @@ else if(isset($_GET['email'])) } else if(isset($_GET['name'])) { - $name = $_GET['name']; - if(!admin()) { - $name = strtolower(stripslashes($name)); - } + $name = trim(stripslashes($_GET['name'])); if(!Validator::characterName($name)) { error_(Validator::getLastError()); @@ -81,7 +78,12 @@ else if(isset($_GET['name'])) error_($errors['name']); } - success_('Good. Your name will be:
' . (admin() ? $name : ucwords($name)) . ''); + $extraText = ''; + if (admin()) { + $extraText = "
Note: You are logged in as admin, so you can create almost any name without rules."; + } + + success_("Good. Your name will be:
$name$extraText"); } else if(isset($_GET['password']) && isset($_GET['password_confirm'])) { $password = $_GET['password']; From 0413de85b5b95f700d7eeee6de5be93aa86b5381 Mon Sep 17 00:00:00 2001 From: slawkens Date: Mon, 6 Apr 2026 12:23:42 +0200 Subject: [PATCH 4/8] Release v1.8.9 --- CHANGELOG-1.x.md | 13 +++++++++++++ common.php | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-1.x.md b/CHANGELOG-1.x.md index 4c231dad..3efc7ad7 100644 --- a/CHANGELOG-1.x.md +++ b/CHANGELOG-1.x.md @@ -1,5 +1,18 @@ # Changelog +## [1.8.9 - 06.04.2026] +### Added +* Settings: Possibility to add custom HTML for the head and body tags like Google Analytics code etc. (https://github.com/slawkens/myaac/commit/108e83806df5686a06826931ed5e243c19cbe130) +* Add command: give-admin (https://github.com/slawkens/myaac/commit/9fa9ec746c4b344387a21f21886c2251319806fc) + * Usage: php aac give:admin slawkens@gmail.com + Parameter: account email, name or id + * It's admin for the website, not the GM for the game! For that, go into the admin panel and change the group manually +* Add page load time to an Admin Panel footer (https://github.com/slawkens/myaac/commit/4ae2fdd0dfcd56697612395c14aecc2dfd33b1c3) + +### Changed +* Better character name validation, like in the original game website (#356) +* Install: don't suggest deleting of install folder - it's not required (https://github.com/slawkens/myaac/commit/5fcde4708a39255cf68edc8c43f2ac6597e2601d) + ## [1.8.8 - 31.01.2026] ### Added * Change Comment: Add missing hooks - patched from 0.8 (https://github.com/slawkens/myaac/commit/a60a23b84f61d41d1503073b52e01e3120f6d92a) diff --git a/common.php b/common.php index 8606cb1b..864b3064 100644 --- a/common.php +++ b/common.php @@ -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.8.9-dev'; +const MYAAC_VERSION = '1.8.9'; const DATABASE_VERSION = 46; const TABLE_PREFIX = 'myaac_'; define('START_TIME', microtime(true)); From aa63e1c9866c0fdc87a51858ce35ea88614f4c1c Mon Sep 17 00:00:00 2001 From: slawkens Date: Fri, 10 Apr 2026 23:08:33 +0200 Subject: [PATCH 5/8] Fix client boosted + online count (?) --- login.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/login.php b/login.php index 438754e2..8f821ba0 100644 --- a/login.php +++ b/login.php @@ -93,9 +93,9 @@ switch ($action) { $creatureBoost = $db->query("SELECT * FROM " . $db->tableName('boosted_creature'))->fetchAll(); $bossBoost = $db->query("SELECT * FROM " . $db->tableName('boosted_boss'))->fetchAll(); die(json_encode([ - 'boostedcreature' => true, + //'boostedcreature' => true, + 'bossraceid' => intval($bossBoost[0]['raceid']), 'creatureraceid' => intval($creatureBoost[0]['raceid']), - 'bossraceid' => intval($bossBoost[0]['raceid']) ])); } From 578c0548ee4f81dbcd17bd16ea5941b8f36dc808 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sat, 11 Apr 2026 15:23:46 +0200 Subject: [PATCH 6/8] Start v1.8.10-dev --- common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.php b/common.php index 864b3064..1455802c 100644 --- a/common.php +++ b/common.php @@ -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.8.9'; +const MYAAC_VERSION = '1.8.10-dev'; const DATABASE_VERSION = 46; const TABLE_PREFIX = 'myaac_'; define('START_TIME', microtime(true)); From 4570ba3801d11275404bc75b987c89545f90fda9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 11 Apr 2026 17:23:17 +0200 Subject: [PATCH 7/8] Bump lodash from 4.17.23 to 4.18.1 (#358) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.23 to 4.18.1. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.23...4.18.1) --- updated-dependencies: - dependency-name: lodash dependency-version: 4.18.1 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 901e9c59..2a675da8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1431,9 +1431,9 @@ } }, "node_modules/lodash": { - "version": "4.17.23", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz", - "integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==", + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", + "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", "dev": true, "license": "MIT" }, From 4145d9eb3c1fd91aa4638b79120246349dcbd44c Mon Sep 17 00:00:00 2001 From: slawkens Date: Sat, 11 Apr 2026 17:49:22 +0200 Subject: [PATCH 8/8] Fix: Clear hooks on plugin uninstall Fixes error with gesior-shop-system clear-cache.php being called, despite it's removed --- system/src/Hooks.php | 20 ++++++++++++++++++++ system/src/Plugins.php | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/system/src/Hooks.php b/system/src/Hooks.php index 8dac8eda..75ad0fe4 100644 --- a/system/src/Hooks.php +++ b/system/src/Hooks.php @@ -14,6 +14,26 @@ class Hooks self::$_hooks[$hook->type()][] = $hook; } + public function unregister($name, $type, $file): void + { + if (is_string($type)) { + $type = constant($type); + } + + if(!isset(self::$_hooks[$type])) { + return; + } + + foreach(self::$_hooks[$type] as $id => $hook) { + if($name == $hook->name() + && $type == $hook->type() + && $file == $hook->file() + ) { + unset(self::$_hooks[$type][$id]); + } + } + } + public function trigger($type, $params = []): bool { $ret = true; diff --git a/system/src/Plugins.php b/system/src/Plugins.php index c6651679..6a88fcab 100644 --- a/system/src/Plugins.php +++ b/system/src/Plugins.php @@ -868,6 +868,11 @@ class Plugins { } } + global $hooks; + foreach($plugin_info['hooks'] ?? [] as $name => $info) { + $hooks->unregister($name, $info['type'], $info['file']); + } + clearCache(); return true; }