From fd729242ff7e74a1a4307e7059a421afc74d8744 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 2 Nov 2025 12:05:47 +0100 Subject: [PATCH 01/19] Fix typo -> satisfied --- system/src/Plugins.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/system/src/Plugins.php b/system/src/Plugins.php index e1a58620..ac57d484 100644 --- a/system/src/Plugins.php +++ b/system/src/Plugins.php @@ -549,21 +549,21 @@ class Plugins { if(isset($plugin_json['require'])) { $require = $plugin_json['require']; - $myaac_satified = true; + $myaac_satisfied = true; if(isset($require['myaac_'])) { $require_myaac = $require['myaac_']; if(!Semver::satisfies(MYAAC_VERSION, $require_myaac)) { - $myaac_satified = false; + $myaac_satisfied = false; } } else if(isset($require['myaac'])) { $require_myaac = $require['myaac']; if(version_compare(MYAAC_VERSION, $require_myaac, '<')) { - $myaac_satified = false; + $myaac_satisfied = false; } } - if(!$myaac_satified) { + if(!$myaac_satisfied) { self::$error = "Your AAC version doesn't meet the requirement of this plugin. Required version is: " . $require_myaac . ", and you're using version " . MYAAC_VERSION . "."; return false; } From 730a0f29124811f525207c24c06eb0d088fa3434 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 2 Nov 2025 12:21:29 +0100 Subject: [PATCH 02/19] Ensure some cache folders & index.html exists --- system/functions.php | 18 +++++++++++++++++- system/init.php | 3 +++ system/src/Cache/PHP.php | 3 +++ system/src/Plugins.php | 3 +++ tools/signature/index.php | 3 +++ 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/system/functions.php b/system/functions.php index 582f9c30..88c02102 100644 --- a/system/functions.php +++ b/system/functions.php @@ -1177,7 +1177,8 @@ function getTopPlayers($limit = 5, $skill = 'level') { }); } -function deleteDirectory($dir, $ignore = array(), $contentOnly = false) { +function deleteDirectory($dir, $ignore = array(), $contentOnly = false): bool +{ if(!file_exists($dir)) { return true; } @@ -1203,6 +1204,21 @@ function deleteDirectory($dir, $ignore = array(), $contentOnly = false) { return rmdir($dir); } +function ensureFolderExists($dir): void +{ + if (!file_exists($dir)) { + mkdir($dir, 0777, true); + } +} + +function ensureIndexExists($dir): void +{ + $dir = rtrim($dir, '/'); + if (!file_exists($file = $dir . '/index.html')) { + touch($file); + } +} + function config($key) { global $config; if (is_array($key)) { diff --git a/system/init.php b/system/init.php index 57c299ba..862b5370 100644 --- a/system/init.php +++ b/system/init.php @@ -18,6 +18,9 @@ use MyAAC\Settings; defined('MYAAC') or die('Direct access not allowed!'); +ensureIndexExists(CACHE); +ensureIndexExists(CACHE . 'twig/'); + global $config; if(!isset($config['installed']) || !$config['installed']) { throw new RuntimeException('MyAAC has not been installed yet or there was error during installation. Please install again.'); diff --git a/system/src/Cache/PHP.php b/system/src/Cache/PHP.php index e42bd928..0b13db07 100644 --- a/system/src/Cache/PHP.php +++ b/system/src/Cache/PHP.php @@ -27,6 +27,9 @@ class PHP { $var = var_export($var, true); + ensureFolderExists($this->dir); + ensureIndexExists($this->dir); + // Write to temp file first to ensure atomicity $tmp = $this->dir . "tmp_$key." . uniqid('', true) . '.tmp'; file_put_contents($tmp, 'getId() . '.png'; if(file_exists($cached) && (time() < (filemtime($cached) + (60 * setting('core.signature_cache_time'))))) { From 25a3db68e69a161a586de4b176ec7eae7f41c86b Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 2 Nov 2025 13:10:09 +0100 Subject: [PATCH 03/19] Use $db->hasTableAndColumns + move $skulls to correct place --- system/pages/characters.php | 38 +++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/system/pages/characters.php b/system/pages/characters.php index 89f98cf0..b88368ff 100644 --- a/system/pages/characters.php +++ b/system/pages/characters.php @@ -202,36 +202,38 @@ if($player->isLoaded() && !$player->isDeleted()) unset($storage); } - if($db->hasTable('player_items') && $db->hasColumn('player_items', 'pid') && $db->hasColumn('player_items', 'sid') && $db->hasColumn('player_items', 'itemtype')) { + if ($db->hasTableAndColumns('player_items', ['pid', 'sid', 'itemtype'])) { $eq_sql = $db->query('SELECT `pid`, `itemtype` FROM player_items WHERE player_id = '.$player->getId().' AND (`pid` >= 1 and `pid` <= 10)'); - $equipment = array(); - foreach($eq_sql as $eq) + $equipment = []; + foreach($eq_sql as $eq) { $equipment[$eq['pid']] = $eq['itemtype']; + } - $empty_slots = array("", "no_helmet", "no_necklace", "no_backpack", "no_armor", "no_handleft", "no_handright", "no_legs", "no_boots", "no_ring", "no_ammo"); - for($i = 0; $i <= 10; $i++) - { + $empty_slots = ["", "no_helmet", "no_necklace", "no_backpack", "no_armor", "no_handleft", "no_handright", "no_legs", "no_boots", "no_ring", "no_ammo"]; + + for($i = 0; $i <= 10; $i++) { if(!isset($equipment[$i]) || $equipment[$i] == 0) $equipment[$i] = $empty_slots[$i]; } - for($i = 1; $i < 11; $i++) - { - if(Validator::number($equipment[$i])) + for($i = 1; $i < 11; $i++) { + if(Validator::number($equipment[$i])) { $equipment[$i] = getItemImage($equipment[$i]); - else + } + else { $equipment[$i] = ' ' . $equipment[$i] . ''; + } } - - $skulls = array( - 1 => 'yellow_skull', - 2 => 'green_skull', - 3 => 'white_skull', - 4 => 'red_skull', - 5 => 'black_skull' - ); } + $skulls = [ + 1 => 'yellow_skull', + 2 => 'green_skull', + 3 => 'white_skull', + 4 => 'red_skull', + 5 => 'black_skull', + ]; + $dead_add_content = ''; $deaths = array(); if($db->hasTable('killers')) { From 49246969439642500c95e943ed848e8d593a5141 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 2 Nov 2025 13:23:30 +0100 Subject: [PATCH 04/19] Try to fix "VirtualProtect() failed [87] The parameter is incorrect" in php logs --- .github/workflows/cypress.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index e93257f1..e05b58ef 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -114,6 +114,7 @@ jobs: with: php-version: ${{ matrix.php-versions }} extensions: mbstring, dom, fileinfo, mysql, json, xml, pdo, pdo_mysql + ini-values: opcache.jit_buffer_size=16M - name: Get composer cache directory id: composer-cache From d201e75b116ca03ec148b7ea7999e8181c592cdf Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 2 Nov 2025 13:38:15 +0100 Subject: [PATCH 05/19] Revert "Try to fix "VirtualProtect() failed [87] The parameter is incorrect" in php logs" This reverts commit 49246969439642500c95e943ed848e8d593a5141. --- .github/workflows/cypress.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index e05b58ef..e93257f1 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -114,7 +114,6 @@ jobs: with: php-version: ${{ matrix.php-versions }} extensions: mbstring, dom, fileinfo, mysql, json, xml, pdo, pdo_mysql - ini-values: opcache.jit_buffer_size=16M - name: Get composer cache directory id: composer-cache From ae7a47464f2379944e4e1be1f59b4d5fc9c5fb21 Mon Sep 17 00:00:00 2001 From: slawkens Date: Mon, 3 Nov 2025 20:37:14 +0100 Subject: [PATCH 06/19] Update menus.php --- admin/template/menus.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/template/menus.php b/admin/template/menus.php index 0bcd7304..6df84745 100644 --- a/admin/template/menus.php +++ b/admin/template/menus.php @@ -60,7 +60,7 @@ usort($menus, function ($a, $b) { foreach ($menus as $i => $menu) { if (isset($menu['link']) && is_array($menu['link'])) { - usort($menus[$i]['link'], function ($a, $b) { + usort($menu['link'], function ($a, $b) { return $a['order'] - $b['order']; }); } From 6367054487368c92741bfd1dc7c70c52aea9ee87 Mon Sep 17 00:00:00 2001 From: slawkens Date: Mon, 3 Nov 2025 21:06:27 +0100 Subject: [PATCH 07/19] Add plugin:remove + plugin:delete as alias for plugin:uninstall --- system/src/Commands/PluginUninstallCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/system/src/Commands/PluginUninstallCommand.php b/system/src/Commands/PluginUninstallCommand.php index a5cc00f5..fb5982d4 100644 --- a/system/src/Commands/PluginUninstallCommand.php +++ b/system/src/Commands/PluginUninstallCommand.php @@ -13,6 +13,7 @@ class PluginUninstallCommand extends Command protected function configure(): void { $this->setName('plugin:uninstall') + ->setAliases(['plugin:remove', 'plugin:delete']) ->setDescription('This command uninstalls plugin') ->addArgument('plugin-name', InputArgument::REQUIRED, 'Plugin that you want to uninstall'); } From baec6c9ebf5c342b3b2f7123427c6ba21dbb93bc Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 4 Nov 2025 08:17:41 +0100 Subject: [PATCH 08/19] plugin:activate/deactivate alias --- system/src/Commands/PluginDisableCommand.php | 1 + system/src/Commands/PluginEnableCommand.php | 1 + 2 files changed, 2 insertions(+) diff --git a/system/src/Commands/PluginDisableCommand.php b/system/src/Commands/PluginDisableCommand.php index baa268dd..36c3b766 100644 --- a/system/src/Commands/PluginDisableCommand.php +++ b/system/src/Commands/PluginDisableCommand.php @@ -13,6 +13,7 @@ class PluginDisableCommand extends Command protected function configure(): void { $this->setName('plugin:disable') + ->setAliases(['plugin:deactivate']) ->setDescription('This command disables plugin') ->addArgument('plugin-name', InputArgument::REQUIRED, 'Plugin that you want to disable'); } diff --git a/system/src/Commands/PluginEnableCommand.php b/system/src/Commands/PluginEnableCommand.php index ae1acea0..8d5d0be5 100644 --- a/system/src/Commands/PluginEnableCommand.php +++ b/system/src/Commands/PluginEnableCommand.php @@ -13,6 +13,7 @@ class PluginEnableCommand extends Command protected function configure(): void { $this->setName('plugin:enable') + ->setAliases(['plugin:activate']) ->setDescription('This command enables plugin') ->addArgument('plugin-name', InputArgument::REQUIRED, 'Plugin that you want to enable'); } From 7ca05e47ff7f52a05f0bd740b0e7d7a5cbd4158e Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 4 Nov 2025 22:01:55 +0100 Subject: [PATCH 09/19] Just testing something, excuse me --- common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.php b/common.php index 48945038..14f3759d 100644 --- a/common.php +++ b/common.php @@ -69,7 +69,7 @@ const ARTICLE = 3; // this may improve security const ADMIN_PANEL_FOLDER = 'admin'; -// directories +// directoriess const BASE = __DIR__ . '/'; const ADMIN = BASE . ADMIN_PANEL_FOLDER . '/'; const SYSTEM = BASE . 'system/'; From 1c7af30997f121c541fccf154f61ea40bd92035f Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 4 Nov 2025 22:17:00 +0100 Subject: [PATCH 10/19] Revert "Just testing something, excuse me" This reverts commit 7ca05e47ff7f52a05f0bd740b0e7d7a5cbd4158e. --- common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.php b/common.php index 14f3759d..48945038 100644 --- a/common.php +++ b/common.php @@ -69,7 +69,7 @@ const ARTICLE = 3; // this may improve security const ADMIN_PANEL_FOLDER = 'admin'; -// directoriess +// directories const BASE = __DIR__ . '/'; const ADMIN = BASE . ADMIN_PANEL_FOLDER . '/'; const SYSTEM = BASE . 'system/'; From 88532b0ebb41ebdab74c4b1e2033a4cdd38c1098 Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 5 Nov 2025 19:32:31 +0100 Subject: [PATCH 11/19] Better message than "Access denied" --- admin/tools/settings_save.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/tools/settings_save.php b/admin/tools/settings_save.php index 9bf745d8..2f2f4cb0 100644 --- a/admin/tools/settings_save.php +++ b/admin/tools/settings_save.php @@ -12,7 +12,7 @@ require SYSTEM . 'login.php'; if(!admin()) { http_response_code(500); - die('Access denied.'); + die('You are not logged in. Probably session expired. Please login again.'); } csrfProtect(); From 9ce55db44cf1afc6e033ad9ff0ca321ad5774d24 Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 5 Nov 2025 22:02:11 +0100 Subject: [PATCH 12/19] Display error message after failed settings save - just in case --- admin/tools/settings_save.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin/tools/settings_save.php b/admin/tools/settings_save.php index 2f2f4cb0..0f0cb028 100644 --- a/admin/tools/settings_save.php +++ b/admin/tools/settings_save.php @@ -40,3 +40,6 @@ if (count($errors) > 0) { if ($success) { echo 'Saved at ' . date('H:i'); } +else { + echo 'Something unexpected happened - it was impossible to save the settings, please try again later. If problem persists - contact MyAAC developers.'; +} From 175e97828b9a08ec3080cc8d3fb4eb3f1c08649f Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 5 Nov 2025 22:21:42 +0100 Subject: [PATCH 13/19] Don't display hidden news for admin - it's confusing --- system/pages/news.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/system/pages/news.php b/system/pages/news.php index dc8c700e..eb7ccd2f 100644 --- a/system/pages/news.php +++ b/system/pages/news.php @@ -122,7 +122,7 @@ if(!$news_cached) ); } - $tickers_db = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'news` WHERE `type` = ' . TICKER .($canEdit ? '' : ' AND `hide` != 1') .' ORDER BY `date` DESC LIMIT ' . setting('core.news_ticker_limit')); + $tickers_db = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'news` WHERE `type` = ' . TICKER . ' AND `hide` != 1 ORDER BY `date` DESC LIMIT ' . setting('core.news_ticker_limit')); $tickers_content = ''; if($tickers_db->rowCount() > 0) { @@ -142,7 +142,8 @@ 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`, `hide` FROM `' . TABLE_PREFIX . 'news` WHERE `type` = ' . ARTICLE . ($canEdit ? '' : ' AND `hide` != 1') .' ORDER BY `date` DESC LIMIT 1'); + $featured_article_db =$db->query('SELECT `id`, `title`, `article_text`, `article_image`, `hide` FROM `' . TABLE_PREFIX . 'news` WHERE `type` = ' . ARTICLE . ' AND `hide` != 1 ORDER BY `date` DESC LIMIT 1'); + $article = ''; if($featured_article_db->rowCount() > 0) { $article = $featured_article_db->fetch(); @@ -175,7 +176,7 @@ else { if(!$news_cached) { ob_start(); - $newses = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'news') . ' WHERE type = ' . NEWS . ($canEdit ? '' : ' AND hide != 1') . ' ORDER BY date' . ' DESC LIMIT ' . setting('core.news_limit')); + $newses = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'news') . ' WHERE type = ' . NEWS . ' AND hide != 1 ORDER BY date' . ' DESC LIMIT ' . setting('core.news_limit')); if($newses->rowCount() > 0) { foreach($newses as $news) From 5861efdbe900ccd35309913af0c0a5f3d4cdc1a8 Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 6 Nov 2025 11:48:42 +0100 Subject: [PATCH 14/19] Settings: escapeHtml in values (support for html code) --- system/src/Settings.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/src/Settings.php b/system/src/Settings.php index ec4a83fa..fea52d04 100644 --- a/system/src/Settings.php +++ b/system/src/Settings.php @@ -248,7 +248,7 @@ class Settings implements \ArrayAccess echo '
'; } - echo ''; + echo ''; if ($setting['type'] === 'password') { echo '
'; @@ -266,7 +266,7 @@ class Settings implements \ArrayAccess if ($rows < 2) { $rows = 2; // always min 2 rows for textarea } - echo ''; + echo ''; } else if ($setting['type'] === 'options') { From 946364f59d7cd01472877108ab27ec78fb28307a Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 6 Nov 2025 12:01:33 +0100 Subject: [PATCH 15/19] New Setting: Account Countries Most Popular --- system/pages/account/create.php | 2 +- system/settings.php | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/system/pages/account/create.php b/system/pages/account/create.php index 9ffdf6f7..731771b7 100644 --- a/system/pages/account/create.php +++ b/system/pages/account/create.php @@ -367,7 +367,7 @@ if(!empty($errors)) if (setting('core.account_country')) { $countries = array(); - foreach (array('pl', 'se', 'br', 'us', 'gb') as $c) + foreach (setting('core.account_countries_most_popular') ?? [] as $c) $countries[$c] = $config['countries'][$c]; $countries['--'] = '----------'; diff --git a/system/settings.php b/system/settings.php index 73605530..96f24a8c 100644 --- a/system/settings.php +++ b/system/settings.php @@ -737,6 +737,18 @@ Sent by MyAAC,
'desc' => 'should country of user be automatically recognized by his IP? This makes an external API call to http://ipinfo.io', 'default' => true, ], + 'account_countries_most_popular' => [ + 'name' => 'Account Countries Most Popular', + 'type' => 'text', + 'desc' => 'Those countries will be display at the top of the list on the create account page. The short codes of countries can be found in file system/countries.conf.php', + 'default' => 'pl,se,br,us,gb', + 'callbacks' => [ + 'get' => function ($value) { + $tmp = array_map('trim', explode(',', $value)); + return array_filter($tmp, function ($v) {return !empty($v); }); + }, + ], + ], 'characters_per_account' => [ 'name' => 'Characters per Account', 'type' => 'number', From 4d17001a0b3a2e4367d61c663ef76806d1ce6520 Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 6 Nov 2025 12:48:33 +0100 Subject: [PATCH 16/19] Add some popular network images (Facebook, Instagram, WhatsApp) --- images/facebook_16x16.png | Bin 0 -> 718 bytes images/instagram_16x16.png | Bin 0 -> 721 bytes images/whatsapp_16x16.png | Bin 0 -> 688 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 images/facebook_16x16.png create mode 100644 images/instagram_16x16.png create mode 100644 images/whatsapp_16x16.png diff --git a/images/facebook_16x16.png b/images/facebook_16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..d64c153a2a541a95b25a14a49224a9f47c5ca41d GIT binary patch literal 718 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!Lb6AYF9SoB8UsT^3j@P1pisjL z28L1t28LG&3=CE?7#PG0=Ijcz0ZJSW@Ck91DE~wd36*?m+WO=F|Nn<>|BC-JgRW}RPp_x#*(_4l?bzhf7C(`o*E!hz*O`n10NLGAOuKnD$B_UeuRi_TeCc=6qHndEejL2@Tcq?;&88m*ZvB?4{?xy60mwT-B|(0{ z46Gh2p8OV{^nRn~pXE<}|9-MO!(`_)pe$pOx4R2p{$2xrAcwQSBeIx*A#WE5GhVy5 zQ5-19UgGKN%Knm@jax@!{ntg4fI=HRT^vIsF5C8B7i%&Qa1nRfo-Yz;sAaYx;eEuv z|Eqn(O5}^u-k(%4W?-0gj_0z;jCG8?sn#BkZ-~9s`*(b*%Vy7_dpSQlwz0|Geg1aA z<+p_;HVIkZ5AT!UaTio#c5eLW;*Fkpglogr-zsMJ?T@;h2d1~dar(Rpb@&o?r zuURD$F+VNY5a@W-64!{5l*E!$tK_0oAjM#0U}UOmXsByo7Gh{nC}Q!>*kach`3ftL}eK?80>NoH~yHyTa1wrN1k zKFPv$K&nv0t$%`rZWOd}Z=01MwWTOjSCU48Ae17dV7jxNdGmNN>daghd3h?v4-V(t z%lW>0&UXVuW`Fn0J8kH%H?q@>-drQ=HZjx6G>0*6Wc#h`K`pyh8-MhowLd~+R&b+{ zEj6;6b?E=lw7pTQr`1f{QJqQUx)@K%Pdo2%c`JzbaA|VA(Q>=%(eg>x z--bOOj4_wWC8B!zeBXy!_dFS%4TcAY6Fv7Swi_;E5fY<12uVjSl^+VkWqkt+1~vl+ zN1DOIgJ8JXF?=<8GlSHqPE=_sN0@XDCUrdS52{H%9JZqrMIE_XE`_jVXkf>@jd;$9 zzfJX&P;Lm-cJO^QSs_hARi|=|cqlOO;CAqLp(X%XfAa}*QD+c!EE(FDQM}3`6)lH1{Q@Nk<@;|o?pZOMx@hzE@aCd6J6lttp zYJ~gZkKT)SwDAk8$60qABCB=C+5^vC3h^hiYB!XYlx`{PsEiaC;>jczDD@1zqV&4b z*P@jG6OoHb>q^fn%_()2Ok-%QFjjh?@VSRR4*dBSv;*~bM?7Z300000NkvXXu0mjf Dw6RGU literal 0 HcmV?d00001 diff --git a/images/whatsapp_16x16.png b/images/whatsapp_16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..a13d2faf9210f5e49223658e9c565980c9650f1d GIT binary patch literal 688 zcmV;h0#E&kP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0!2wgK~y+TbyGWU z6G0HZ0+47B4FwVn0>q=Hrb0?Vhtfp8z4PmKZ}05bh6)M_Fa;$NA)=&B2O>g=65qqG zJVQ=KJQ`nO)7MF1rtOFPzxmFS;rXP4$z=Fg_E#1L>}YwgiDS1tA& zRoX2m5hmbSCp8K=Zp&VOHku)ELbik-s7}CuhpaQJ;J71~2W(k`3xRnJ(ok8%_PQqg z;#`m|`+(%0N&qFL9Tdx6H+W>ds1Agx^c`ZgGMbf4gyvhsP9uP$Cn92X5DXx<@|6N1 zlK_)~^E_fJ<-Otw;KcP2LpC&MbBKU$Tx4y7KsIw%aV)QMbOblHr|TI%G^kk*PbLH`DPY4%$C2o5<;H~#^S&ktn4o6;qJIZ6X7_k( zJ)sNsL$(q^A{ZGWVD+RS#7fKzVyU3{xh2pXO((q`E zBx{V(Oi73xNp3s)+TY7xPO;i()K4qvWh=()h7R(E`5r+{kdlB9lcDb)lKxr5)+?IW zNA%$Fcd49)`A&mjPQX6k7-eFeDoGvZ#W*W{uA2<7Xj&WP)$%zFmQnT!x=X;HH2V%! z`u}61+ea^Rd2V$s0mDR`x$W=dA1-`axH#F%u3e{z^oUeHXX-`Y@8;@W^Qf7L8OA>? WuKeO?hF+ln0000 Date: Thu, 6 Nov 2025 13:47:09 +0100 Subject: [PATCH 17/19] Fix $status['uptimeReadable'], was totally wrong --- system/functions.php | 37 +++++++++++++++++++++++++++++++++++++ system/status.php | 8 +------- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/system/functions.php b/system/functions.php index 88c02102..ca7989ed 100644 --- a/system/functions.php +++ b/system/functions.php @@ -1728,6 +1728,43 @@ function isCanary(): bool return isset($vipSystemEnabled); } +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 SYSTEM . 'compat/base.php'; diff --git a/system/status.php b/system/status.php index 8e8225dd..b69e7acc 100644 --- a/system/status.php +++ b/system/status.php @@ -145,13 +145,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(); From 780d4ccef741c1dd45a00bfc121fba9f1a175313 Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 6 Nov 2025 22:06:05 +0100 Subject: [PATCH 18/19] Server Status: Write to status-error.log if there is connection error --- system/libs/pot/OTS_ServerInfo.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/system/libs/pot/OTS_ServerInfo.php b/system/libs/pot/OTS_ServerInfo.php index 76ebcaf7..a0ee464f 100644 --- a/system/libs/pot/OTS_ServerInfo.php +++ b/system/libs/pot/OTS_ServerInfo.php @@ -97,6 +97,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; } From e440c0d6a6e78032beabc7865a71ba59943d7d69 Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 13 Nov 2025 19:14:59 +0100 Subject: [PATCH 19/19] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 15c069b1..7da27c57 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ releases tmp config.local.php +config2.local.php # all custom templates templates/*