From 50d649dbde70ac20687dc6292573a9937756f830 Mon Sep 17 00:00:00 2001 From: slawkens Date: Fri, 4 Apr 2025 21:25:19 +0200 Subject: [PATCH 1/9] Release v1.3.3 --- CHANGELOG-1.x.md | 11 +++++++++++ common.php | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-1.x.md b/CHANGELOG-1.x.md index e77c30f1..473bc51b 100644 --- a/CHANGELOG-1.x.md +++ b/CHANGELOG-1.x.md @@ -1,5 +1,16 @@ # Changelog +## [1.3.3 - 04.04.2025] + +### Fixed +* Fix uninstall plugin when plugin is disabled (https://github.com/slawkens/myaac/commit/6c568fd36a271270684fc412ccd556b230273a6d) + +### Changed +* Display more useful info when error parsing config.lua (https://github.com/slawkens/myaac/commit/fa6b6aa153ffc131e0d1631a4dcd9012a5850c2e) + +### Other +* Small adjustments (https://github.com/slawkens/myaac/commit/35e2483de86e295bdf089cceffa25842eeb2e34c, https://github.com/slawkens/myaac/commit/ae639d65b0bfa491e747e907e2ebc77f83f47981) + ## [1.3.2 - 01.04.2025] ### Fixed diff --git a/common.php b/common.php index 592ce964..4c6346fe 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.3.3-dev'; +const MYAAC_VERSION = '1.3.3'; const DATABASE_VERSION = 43; const TABLE_PREFIX = 'myaac_'; define('START_TIME', microtime(true)); From 6a0356aa0f77645aec1572ee04734c15b17116a5 Mon Sep 17 00:00:00 2001 From: slawkens Date: Fri, 4 Apr 2025 21:31:17 +0200 Subject: [PATCH 2/9] Update version --- common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.php b/common.php index 4c6346fe..33e31085 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.3.3'; +const MYAAC_VERSION = '1.3.4-dev'; const DATABASE_VERSION = 43; const TABLE_PREFIX = 'myaac_'; define('START_TIME', microtime(true)); From e6f05a2731c61d931be49e121c068e49c0ad5e01 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 6 Apr 2025 16:41:28 +0200 Subject: [PATCH 3/9] Plugin name is required, version is optional --- system/src/Plugins.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/system/src/Plugins.php b/system/src/Plugins.php index 605d3e2a..c1d9b360 100644 --- a/system/src/Plugins.php +++ b/system/src/Plugins.php @@ -411,20 +411,13 @@ class Plugins { $continue = true; if(!isset($plugin_json['name']) || empty(trim($plugin_json['name']))) { - self::$warnings[] = 'Plugin "name" tag is not set.'; - } - if(!isset($plugin_json['description']) || empty(trim($plugin_json['description']))) { - self::$warnings[] = 'Plugin "description" tag is not set.'; + self::$error = 'Plugin "name" tag is not set.'; + return false; } + if(!isset($plugin_json['version']) || empty(trim($plugin_json['version']))) { self::$warnings[] = 'Plugin "version" tag is not set.'; } - if(!isset($plugin_json['author']) || empty(trim($plugin_json['author']))) { - self::$warnings[] = 'Plugin "author" tag is not set.'; - } - if(!isset($plugin_json['contact']) || empty(trim($plugin_json['contact']))) { - self::$warnings[] = 'Plugin "contact" tag is not set.'; - } if(isset($plugin_json['require'])) { $require = $plugin_json['require']; From 64f6d3abcada3bf9fd7599f50d2fac0a1367f383 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 6 Apr 2025 16:43:19 +0200 Subject: [PATCH 4/9] Add noSubmit option to buttons.base --- system/templates/buttons.base.html.twig | 2 +- templates/tibiacom/buttons.base.html.twig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/templates/buttons.base.html.twig b/system/templates/buttons.base.html.twig index d44bce10..075af1e1 100644 --- a/system/templates/buttons.base.html.twig +++ b/system/templates/buttons.base.html.twig @@ -1 +1 @@ - \ No newline at end of file + diff --git a/templates/tibiacom/buttons.base.html.twig b/templates/tibiacom/buttons.base.html.twig index a4ab47d5..713321aa 100644 --- a/templates/tibiacom/buttons.base.html.twig +++ b/templates/tibiacom/buttons.base.html.twig @@ -13,7 +13,7 @@
- +
{% endapply %} From 190697ce986d9068373188c9d3e69548e355c049 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 6 Apr 2025 16:43:30 +0200 Subject: [PATCH 5/9] Update config.php --- templates/tibiacom/config.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/tibiacom/config.php b/templates/tibiacom/config.php index 7ed168d9..a49f6f76 100644 --- a/templates/tibiacom/config.php +++ b/templates/tibiacom/config.php @@ -1,13 +1,13 @@ array('id' => 'news', 'name' => 'Latest News'), - MENU_CATEGORY_ACCOUNT => array('id' => 'account', 'name' => 'Account'), - MENU_CATEGORY_COMMUNITY => array('id' => 'community', 'name' => 'Community'), - MENU_CATEGORY_FORUM => array('id' => 'forum', 'name' => 'Forum'), - MENU_CATEGORY_LIBRARY => array('id' => 'library', 'name' => 'Library'), - MENU_CATEGORY_SHOP => array('id' => 'shops', 'name' => 'Shop') -); +$config['menu_categories'] = [ + MENU_CATEGORY_NEWS => ['id' => 'news', 'name' => 'Latest News'], + MENU_CATEGORY_ACCOUNT => ['id' => 'account', 'name' => 'Account'], + MENU_CATEGORY_COMMUNITY => ['id' => 'community', 'name' => 'Community'], + MENU_CATEGORY_FORUM => ['id' => 'forum', 'name' => 'Forum'], + MENU_CATEGORY_LIBRARY => ['id' => 'library', 'name' => 'Library'], + MENU_CATEGORY_SHOP => ['id' => 'shops', 'name' => 'Shop'], +]; $config['menus'] = require __DIR__ . '/menus.php'; From f40b986b59d4c8fa89ab4745731bf366f8619976 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 6 Apr 2025 17:00:59 +0200 Subject: [PATCH 6/9] Small changes in account.login.html.twig * change inputs width to 100% * fix form closing * formatting --- templates/tibiacom/account.login.html.twig | 89 +++++++++++++--------- templates/tibiacom/basic.css | 6 ++ 2 files changed, 58 insertions(+), 37 deletions(-) diff --git a/templates/tibiacom/account.login.html.twig b/templates/tibiacom/account.login.html.twig index 9e9b65c2..8aeba805 100644 --- a/templates/tibiacom/account.login.html.twig +++ b/templates/tibiacom/account.login.html.twig @@ -4,24 +4,25 @@ {% endif %}
- -
-
- - - - -
Account Login
- - - - -
+
+
+ + + + +
Account Login
+ + + +
+
+
+ +
@@ -30,20 +31,21 @@
+ + +
- +
{{ hook('HOOK_ACCOUNT_LOGIN_BEFORE_ACCOUNT') }} - + {{ hook('HOOK_ACCOUNT_LOGIN_AFTER_ACCOUNT') }} - + {{ hook('HOOK_ACCOUNT_LOGIN_AFTER_PASSWORD') }} @@ -53,17 +55,19 @@ {{ hook('HOOK_ACCOUNT_LOGIN_AFTER_REMEMBER_ME') }}
{{ account_login_by }}:
Password:
-
- +
+
{{ include('buttons.login.html.twig') }} -
-
- {{ include('buttons.account_lost.html.twig') }} -
-
+ + {% set noSubmit = true %} + {{ include('buttons.account_lost.html.twig') }} + +
@@ -75,35 +79,40 @@
+
+

New to {{ config.lua.serverName }}?

- -
-
- - - - -
New Player
- - - - -
+
+
+ + + + +
New Player
+ + + +
+
+
+ +
+ +
@@ -112,6 +121,7 @@
+ + +
@@ -129,9 +139,12 @@

... where hardcore gaming meets fantasy.

... where friendships last a lifetime.

-

... unites adventurers since 2017!

+

... unites adventurers since 1997!

+
@@ -143,10 +156,12 @@
{{ hook('HOOK_ACCOUNT_LOGIN_AFTER_PAGE') }} diff --git a/templates/tibiacom/basic.css b/templates/tibiacom/basic.css index 3d260a97..4633c5ed 100644 --- a/templates/tibiacom/basic.css +++ b/templates/tibiacom/basic.css @@ -36,6 +36,12 @@ img { width: expression(document.body.clientWidth > 1200? "1200px": "100%" ); } +#LoginFormButtonCell { + width: 145px; + vertical-align: top; + padding-right: 10px; +} + #ContentRow { position: relative; top: 155px; From 6d8f4718a1d349fba8f0ebc39cfd3a1a84d104b0 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 6 Apr 2025 22:37:36 +0200 Subject: [PATCH 7/9] pages in theme folder have precedence over normal pages --- system/router.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/system/router.php b/system/router.php index 5b103a90..ab9ea966 100644 --- a/system/router.php +++ b/system/router.php @@ -343,16 +343,16 @@ function getDatabasePages($withHidden = false): array function loadPageFromFileSystem($page, &$found): string { - $file = SYSTEM . 'pages/' . $page . '.php'; + // feature: load pages from templates/ dir + global $template_path; + $file = $template_path . '/pages/' . $page . '.php'; if (!is_file($file)) { - // feature: convert camelCase to snake_case - // so instead of forum/move_thread - // we can write: forum/moveThread - $file = SYSTEM . 'pages/' . camelCaseToUnderscore($page) . '.php'; + $file = SYSTEM . 'pages/' . $page . '.php'; if (!is_file($file)) { - // feature: load pages from templates/ dir - global $template_path; - $file = $template_path . '/pages/' . $page . '.php'; + // feature: convert camelCase to snake_case + // so instead of forum/move_thread + // we can write: forum/moveThread + $file = SYSTEM . 'pages/' . camelCaseToUnderscore($page) . '.php'; if (!is_file($file)) { $found = false; } From 6844f4392a1a09cfc8da4baa1448120900641aa3 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 6 Apr 2025 23:46:52 +0200 Subject: [PATCH 8/9] Change logout button color --- templates/tibiacom/buttons.logout.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/tibiacom/buttons.logout.html.twig b/templates/tibiacom/buttons.logout.html.twig index fccaf69d..6926617c 100644 --- a/templates/tibiacom/buttons.logout.html.twig +++ b/templates/tibiacom/buttons.logout.html.twig @@ -1,3 +1,3 @@ {% set button_name = 'Logout' %} -{% set button_image = '_sbutton_logout' %} +{% set button_color = 'red' %} {% include('buttons.base.html.twig') %} \ No newline at end of file From ceaa0639e66d31e8177ff90791463470367aa45d Mon Sep 17 00:00:00 2001 From: slawkens Date: Fri, 18 Apr 2025 13:57:53 +0200 Subject: [PATCH 9/9] feat: admin-pages (can add admin pages through plugins) Also possibility to overwrite default myaac admin pages --- admin/index.php | 26 ++++++++++----- plugins/example.json | 4 ++- system/src/Plugins.php | 75 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 10 deletions(-) diff --git a/admin/index.php b/admin/index.php index 15ab133c..86ebf3dc 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,6 +1,8 @@ $name, 'file' => $file, 'priority' => $adminPagesDefaultPriority]; + } + + if (self::getAutoLoadOption($plugin, 'admin-pages-sub-folders', true)) { + // + // Get all plugins/*/admin-pages/subFolder/*.php pages + // + $pluginAdminPagesSubFolders = glob(PLUGINS . $plugin['filename'] . '/admin-pages/*', GLOB_ONLYDIR); + foreach ($pluginAdminPagesSubFolders as $folder) { + $folderName = pathinfo($folder, PATHINFO_FILENAME); + + $subFiles = glob(PLUGINS . $plugin['filename'] . '/admin-pages/' . $folderName . '/*.php'); + foreach ($subFiles as $file) { + $file = str_replace(PLUGINS, 'plugins/', $file); + $name = $folderName . '/' . pathinfo($file, PATHINFO_FILENAME); + + $adminPages[] = ['name' => $name, 'file' => $file, 'priority' => $adminPagesDefaultPriority]; + } + + $subFolders = glob(PLUGINS . $plugin['filename'] . '/admin-pages/' . $folderName . '/*', GLOB_ONLYDIR); + foreach ($subFolders as $subFolder) { + $subFolderName = pathinfo($subFolder, PATHINFO_FILENAME); + $subSubFiles = glob(PLUGINS . $plugin['filename'] . '/admin-pages/' . $folderName . '/' . $subFolderName . '/*.php'); + + foreach ($subSubFiles as $subSubFile) { + $subSubFile = str_replace(PLUGINS, 'plugins/', $subSubFile); + $name = $folderName . '/' . $subFolderName . '/' . pathinfo($subSubFile, PATHINFO_FILENAME); + + $adminPages[] = ['name' => $name, 'file' => $subSubFile, 'priority' => $adminPagesDefaultPriority];; + } + } + } + } + } + + usort($adminPages, function ($a, $b) + { + if ($a['priority'] == $b['priority']) { + return 0; + } + + return ($a['priority'] > $b['priority']) ? -1 : 1; + }); + + $ret = []; + foreach ($adminPages as $value) { + $ret[$value['name']] = $value['file']; + } + + return $ret; + }); + } + public static function getRoutes() { $cache = Cache::getInstance();