From bbf923e1a6fe9662d7c77c0cbd44da94c2e99b33 Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 1 Apr 2025 07:56:29 +0200 Subject: [PATCH 1/4] Update common.php --- common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.php b/common.php index bdb4e61a..592ce964 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.2'; +const MYAAC_VERSION = '1.3.3-dev'; const DATABASE_VERSION = 43; const TABLE_PREFIX = 'myaac_'; define('START_TIME', microtime(true)); From 35e2483de86e295bdf089cceffa25842eeb2e34c Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 2 Apr 2025 19:48:23 +0200 Subject: [PATCH 2/4] Change root folder to /var/www/html, like in default config --- nginx-sample.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx-sample.conf b/nginx-sample.conf index d3cf8b6c..bb107f02 100644 --- a/nginx-sample.conf +++ b/nginx-sample.conf @@ -1,6 +1,6 @@ server { listen 80; - root /home/otserv/www/public; + root /var/www/html; index index.php; server_name your-domain.com; From ae639d65b0bfa491e747e907e2ebc77f83f47981 Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 3 Apr 2025 20:39:27 +0200 Subject: [PATCH 3/4] PHP 8 things --- index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 0a42deed..4526e892 100644 --- a/index.php +++ b/index.php @@ -31,11 +31,11 @@ require_once 'common.php'; require_once SYSTEM . 'functions.php'; $uri = $_SERVER['REQUEST_URI']; -if(false !== strpos($uri, 'index.php')) { +if(str_contains($uri, 'index.php')) { $uri = str_replace_first('/index.php', '', $uri); } -if(0 === strpos($uri, '/')) { +if(str_starts_with($uri, '/')) { $uri = str_replace_first('/', '', $uri); } From fa6b6aa153ffc131e0d1631a4dcd9012a5850c2e Mon Sep 17 00:00:00 2001 From: slawkens Date: Fri, 4 Apr 2025 20:07:42 +0200 Subject: [PATCH 4/4] Display more info when error parsing config.lua value --- system/functions.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/system/functions.php b/system/functions.php index 947dd5bd..e0ed8f61 100644 --- a/system/functions.php +++ b/system/functions.php @@ -1012,12 +1012,19 @@ function load_config_lua($filename) } else { - foreach($result as $tmp_key => $tmp_value) // load values defined by other keys, like: dailyFragsToBlackSkull = dailyFragsToRedSkull + foreach($result as $tmp_key => $tmp_value) { // load values defined by other keys, like: dailyFragsToBlackSkull = dailyFragsToRedSkull $value = str_replace($tmp_key, $tmp_value, $value); - $ret = @eval("return $value;"); - if((string) $ret == '' && trim($value) !== '""') // = parser error - { - throw new RuntimeException('ERROR: Loading config.lua file. Line ' . ($ln + 1) . ' of LUA config file is not valid [key: ' . $key . ']'); + } + + try { + $ret = eval("return $value;"); + } + catch (Throwable $e) { + throw new RuntimeException('ERROR: Loading config.lua file. Line: ' . ($ln + 1) . ' - Unable to parse value "' . $value . '" - ' . $e->getMessage()); + } + + if((string) $ret == '' && trim($value) !== '""') { + throw new RuntimeException('ERROR: Loading config.lua file. Line ' . ($ln + 1) . ' is not valid [key: ' . $key . ']'); } $result[$key] = $ret; }