diff --git a/install.php b/install.php index 5fe80e5..d51b054 100644 --- a/install.php +++ b/install.php @@ -1,11 +1,7 @@ {$b}"; }); @@ -347,7 +334,7 @@ function check($name, $bool, $hint = '') { $output .= check('FSOCKOPEN', function_exists("fsockopen") && fsockopen("udp://127.0.0.1", 13, $errno, $errstr, 3), 'mainly used for querying'); $output .= check('CURL', LGSL::isEnabled("curl"), 'optional: for some games'); $output .= check('BZ2', function_exists("bzdecompress"), 'optional: for some games'); - $output .= check('GD', function_exists("gd"), 'optional: for charts & userbars'); + $output .= check('GD', LGSL::isEnabled("gd"), 'optional: for charts & userbars'); } $output .= " diff --git a/src/lgsl_admin.php b/src/lgsl_admin.php index ea47563..cfb0e03 100644 --- a/src/lgsl_admin.php +++ b/src/lgsl_admin.php @@ -416,14 +416,14 @@ function lgsl_help_info() { ["href" => "http://php.net/curl", "name" => "CURL", "test" => LGSL::isEnabled("curl"), "desc" => "crl"], ["href" => "http://php.net/mbstring", "name" => "MBSTRING", "test" => function_exists("mb_convert_encoding"), "desc" => "mbs"], ["href" => "http://php.net/bzip2", "name" => "BZIP2", "test" => function_exists("bzdecompress"), "desc" => "bz2"], - ["href" => "http://php.net/gd2", "name" => "GD", "test" => extension_loaded("gd"), "desc" => "gd2"], + ["href" => "http://php.net/gd", "name" => "GD", "test" => LGSL::isEnabled("gd"), "desc" => "gd2"], ["href" => "http://php.net/zlib", "name" => "ZLIB", "test" => function_exists("gzuncompress"), "desc" => "zli"], ]; $output = ""; foreach ($funcs as $func) { $output .= " - {$func['name']} + {$func['name']} {$lgsl_config['text']['enb']}: ".($func['test'] ? $lgsl_config['text']['yes'] : $lgsl_config['text']['nno'])." ( {$lgsl_config['text'][$func['desc']]} ) diff --git a/src/lgsl_class.php b/src/lgsl_class.php index 2eaadf9..d7a58fc 100644 --- a/src/lgsl_class.php +++ b/src/lgsl_class.php @@ -188,10 +188,11 @@ static function buildLink($url, $params) { static public function isEnabled($func) { switch ($func) { case "curl": return function_exists('curl_init') && function_exists('curl_setopt') && function_exists('curl_exec'); + case "gd": return extension_loaded('gd'); } } - static public function locationCoords($code) { - $a = array_search($code, [ + static public function locationsCodes($sort = true) { + $arr = [ "AD","AE","AF","AG","AI","AL","AM","AN","AO","AR","AS","AT","AU","VG", "AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BM","VI", "BN","BO","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","VN", @@ -209,7 +210,15 @@ static public function locationCoords($code) { "PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","", "SH","SI","SJ","SK","SL","SM","SN","SO","SR","ST","SV","SY","SZ","", "TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","", - "TV","TW","TZ","UA","UG","UK","UM","US","UY","UZ","VA","VC","VE"]); + "TV","TW","TZ","UA","UG","UK","UM","US","UY","UZ","VA","VC","VE"]; + if ($sort) { + sort($arr); + return array_filter($arr, fn($value) => !is_null($value) && $value !== ''); + } + return $arr; + } + static public function locationCoords($code) { + $a = array_search($code, self::locationsCodes(false)); return [$a % 14 * 16, floor($a / 14) * 11]; } static public function normalizeString($string) { diff --git a/src/lgsl_details.php b/src/lgsl_details.php index 61b4c22..6145431 100644 --- a/src/lgsl_details.php +++ b/src/lgsl_details.php @@ -98,7 +98,7 @@
"; if ($lgsl_config['image_mod']) { - if (extension_loaded('gd')) { + if (LGSL::isEnabled("gd")) { for ($i = 1; $i < 4; $i++) { $output .= "
{$server->getName()}
diff --git a/src/other/loader.html b/src/other/loader.html index 72bd2cb..e034bc4 100644 --- a/src/other/loader.html +++ b/src/other/loader.html @@ -30,7 +30,7 @@