diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3e2fe40 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +php +*.db +*.log +*.cache +*.phar +*.bat \ No newline at end of file diff --git a/charts.php b/charts.php index 63565ee..99cbdb6 100644 --- a/charts.php +++ b/charts.php @@ -11,11 +11,16 @@ function findMax(&$server) { } return $max + 1; } + require "src/lgsl_class.php"; + if (!LGSL::isEnabled("gd")) { + echo 'No GD '; + exit; + } // SETTINGS $w = 400; $h = 150; - $im = @imagecreate($w, $h); + $im = @\imagecreate($w, $h); $white = imagecolorallocate($im, 255, 255, 255); $gray = imagecolorallocate($im, 225, 225, 225); $black = imagecolorallocate($im, 0, 0, 0); @@ -24,7 +29,6 @@ function findMax(&$server) { // MAIN SECTION header("Content-Type: image/png"); - require "src/lgsl_class.php"; $s = (int) ($_GET['s'] ?? null); $ip = $_GET['ip'] ?? null; $port = (int) ($_GET['port'] ?? null); @@ -78,9 +82,10 @@ function findMax(&$server) { } imagestring($im, 1, $x0 - 6, $maxY + 2, Date($timeFormat, time() - $period), $black); for ($i = 1; $i < $xSteps + 1; $i++) { - imageline($im, $x0 + $xStep * $i, $y0, $x0 + $xStep * $i, $maxY - 1, $gray); - $str = Date($timeFormat, time() - $period + (int) ($i * round($xStep / $scaleX, 1))); - imagestring($im, 1, (($x0 + $xStep * $i) - 6), $maxY + 2, $str, $black); + $calcX = (int) ($x0 + $xStep * $i); + imageline($im, $calcX, $y0, $calcX, $maxY - 1, $gray); + $str = Date($timeFormat, time() - $period + (int) ($i * round($xStep / $scaleX, 1))); + imagestring($im, 1, ($calcX - 6), $maxY + 2, $str, $black); } if (count($history) > 0) { diff --git a/index.php b/index.php index f6c0c65..8f591fc 100644 --- a/index.php +++ b/index.php @@ -94,6 +94,9 @@ function alertContents() { ?> "; } + function shutdown() { + $e = error_get_last(); + if ($e) { + if ($e['type'] === E_ERROR) { + $msg = isset($e['message']) ? $e['message'] : ''; + $msg = str_replace(array('Uncaught Exception:','Stack trace:') + ,array('Uncaught Exception:
', + 'Stack trace:'),$msg); + $msg = preg_replace('/[a-z0-9_\-]*\.php/i','$1$0',$msg); + $msg = preg_replace('/[0-9]/i','$1$0',$msg); + $msg = preg_replace('/[\(\)#\[\]\':]/i','$1$0',$msg); + + echo " +

Fatal PHP error

".nl2br($msg)."
"; + } + } + } + register_shutdown_function('tltneon\LGSL\shutdown'); \ No newline at end of file diff --git a/src/lgsl_zone.php b/src/lgsl_zone.php index ebbfbbe..f8692f7 100644 --- a/src/lgsl_zone.php +++ b/src/lgsl_zone.php @@ -24,7 +24,7 @@ $zone_width = "{$lgsl_config['zone']['width']}px"; $zone_grid = $lgsl_config['grid'][$lgsl_zone_number] ?? 1; $zone_count = 0; - $output = ''; + $output = ""; $request = empty($lgsl_config['players'][$lgsl_zone_number]) ? "s" : "sp"; if ($lgsl_zone_number) { @@ -36,7 +36,7 @@ //$server_list = lgsl_sort_servers($server_list); if (!$server_list) { - $output .= "
NO SERVERS IN ZONE {$lgsl_zone_number}
"; return; + $output .= "
NO SERVERS IN ZONE {$lgsl_zone_number}
"; return; } $output .= " @@ -50,48 +50,12 @@ color: $link; text-decoration:none; } - .sidebarserver * { - scrollbar-width: thin; - scrollbar-color: black gray; - } - - .sidebarserver *::-webkit-scrollbar { - height: 12px; - width: 12px; - } - .sidebarserver *::-webkit-scrollbar-track { - background: gray; - } - .sidebarserver *::-webkit-scrollbar-thumb { - background-color: black; - border-radius: 5px; - border: 3px solid gray; - } - - .sidebarserver img { - border: none; - } - - .marquee { - width:100%; - white-space:nowrap; - overflow:hidden; - } - - .marquee span.on { - display:inline-block; - animation: marquee 10s infinite linear alternate; - } - .sidebarserver table:hover .marquee span.on { - animation: marquee 4s infinite linear alternate; - } - @keyframes marquee{ 0%{transform: translateX(15px);} 100%{transform: translateX(calc(-100% + {$zone_width} - 15px));} } - +
"; foreach ($server_list as $server) { @@ -105,14 +69,18 @@ $zone_count ++; $marquee = strlen($server->getName()) > 25 ? "class='on'" : ""; + $location = ""; + if ($lgsl_config['locations']) { + $location = ""; + } $output .= "
- +
- - - - @@ -160,16 +123,16 @@ $output .= " -
-
+
+
{$server->getAddress()} @@ -121,34 +89,29 @@
-
+
+
{$server->getName()}
-
+
+
getMap()}' style='padding:0px;'> -
+
getMap()}'> +
{$server->getMap()}
- {$lang->get('zpl')} - {$server->getPlayersCountFormatted()} "; + + {$lang->get('zpl')} + {$server->getPlayersCountFormatted()} "; $players = $server->getPlayersArray(); if (count($players) > 0) { $output .= "
"; foreach ($players as $player) { $output .= " -
{$player['name']}
"; +
{$player['name']}
"; } $output .= " li {display: inline-block;padding: 0px 10px;} #topmenu > li:before {content: '► ';} +.flag {transform: translateY(-2px);} /* add */ .addserver_table { margin: auto; }