@@ -50,7 +50,7 @@
Status |
- ' . ($s['data'] ? esc_attr($s['data']['server']['gamemode']) : '-') . ' |
+ ' . ($s['data'] ? esc_attr($s['data']['server']['gamemode']) : 'OFFLINE') . ' |
Players |
' . ($s['data'] ? esc_attr("{$s['data']['server']['numplayers']}/{$s['data']['server']['maxplayers']}") : '-') . ' |
diff --git a/src/bf2sclone/template/servers.php b/src/bf2sclone/template/servers.php
index c963e75..2d6e5db 100644
--- a/src/bf2sclone/template/servers.php
+++ b/src/bf2sclone/template/servers.php
@@ -43,94 +43,113 @@
';
foreach($servers as $s) {
- if (!$s['data']) {
- continue;
- }
+ // Show only online servers?
+ // if ($s['data'] === false) {
+ // continue;
+ // }
+
$template .= '
-
- ';
-
- $serverLoad = $s['data']['server']['numplayers'] / $s['data']['server']['maxplayers'];
- if ($serverLoad >= 0.66) {
- $template .= '';
- } else if ($serverLoad >= 0.33) {
- $template .= '';
+ |
+ ';
+ if ($s['data'] === false) {
+ $template .= '
+
+ OFF
+
+ |
+
+ ' . esc_attr($s['name']) . ' |
+ - |
+ - |
+ - |
+ - |
+ - |
+ - |
+
';
} else {
- $template .= '
';
- }
+ $template .= '
';
+ $serverLoad = $s['data']['server']['numplayers'] / $s['data']['server']['maxplayers'];
+ if ($serverLoad >= 0.66) {
+ $template .= '
';
+ } else if ($serverLoad >= 0.33) {
+ $template .= '
';
+ } else {
+ $template .= '
';
+ }
- if (preg_match('/^linux/', $s['data']['server']['bf2_os'])) {
- $template .= '
';
- } else {
- $template .= '
';
- }
+ if (preg_match('/^linux/', $s['data']['server']['bf2_os'])) {
+ $template .= '
';
+ } else {
+ $template .= '
';
+ }
- if (preg_match('/-64$/', $s['data']['server']['bf2_os'])) {
- $template .= '
';
- } else {
- $template .= '
';
- }
-
- if (file_exists(ROOT . "/game-images/mods/{$s['data']['server']['gamevariant']}/mod_icon.png")) {
- $mod = esc_attr($s['data']['server']['gamevariant']);
- $template .= '
';
- } else {
- $template .= '
';
- }
+ if (preg_match('/-64$/', $s['data']['server']['bf2_os'])) {
+ $template .= '
';
+ } else {
+ $template .= '
';
+ }
+
+ if (file_exists(ROOT . "/game-images/mods/{$s['data']['server']['gamevariant']}/mod_icon.png")) {
+ $mod = esc_attr($s['data']['server']['gamevariant']);
+ $template .= '
';
+ } else {
+ $template .= '
';
+ }
- if ($s['data']['server']['bf2_ranked']) {
- $template .= '
';
- } else {
- $template .= '
';
- }
+ if ($s['data']['server']['bf2_ranked']) {
+ $template .= '
';
+ } else {
+ $template .= '
';
+ }
- if ($s['data']['server']['bf2_autorec']) {
- $template .= '
';
- } else {
- $template .= '
';
- }
+ if ($s['data']['server']['bf2_autorec']) {
+ $template .= '
';
+ } else {
+ $template .= '
';
+ }
- if ($s['data']['server']['bf2_voip']) {
- $template .= '
';
- } else {
- $template .= '
';
- }
+ if ($s['data']['server']['bf2_voip']) {
+ $template .= '
';
+ } else {
+ $template .= '
';
+ }
- if ($s['data']['server']['bf2_anticheat']) {
- $template .= '
';
- } else {
- $template .= '
';
- }
-
- if ($s['data']['server']['bf2_pure']) {
- $template .= '
';
- } else {
- $template .= '
';
- }
-
- if ($s['data']['server']['password']) {
- $template .= '
';
- } else {
- $template .= '
';
- }
+ if ($s['data']['server']['bf2_anticheat']) {
+ $template .= '
';
+ } else {
+ $template .= '
';
+ }
+
+ if ($s['data']['server']['bf2_pure']) {
+ $template .= '
';
+ } else {
+ $template .= '
';
+ }
+
+ if ($s['data']['server']['password']) {
+ $template .= '
';
+ } else {
+ $template .= '
';
+ }
- $map = str_replace(' ', '_', strtolower($s['data']['server']['mapname']));
- // devil's Perch Fix
- $map = str_replace('\'', '', $map);
- $mapUrl = file_exists(ROOT . "/game-images/levels/$map.png") ? "$ROOT/game-images/levels/$map.png" : "$ROOT/game-images/levels/default.png";
- $template .= '
-
-
' . esc_attr($s['data']['server']['hostname']) . ' |
-
' . esc_attr("{$s['data']['server']['numplayers']}/{$s['data']['server']['maxplayers']}"). ' |
-
- ' .
- ' ' . esc_attr($s['data']['server']['mapname']) . '
- |
-
' . esc_attr($s['data']['server']['bf2_mapsize']) . ' |
-
' . (preg_match('/gpm_coop/i', $s['data']['server']['gametype']) ? 'Co-op' : 'Conquest') . ' |
-
' . esc_attr($s['data']['server']['gamevariant']). ' |
-
' . esc_attr(preg_replace('/^(\d+\.\d+).*$/', '$1', $s['data']['server']['gamever'])). ' |
- ';
+ $map = str_replace(' ', '_', strtolower($s['data']['server']['mapname']));
+ // devil's Perch Fix
+ $map = str_replace('\'', '', $map);
+ $mapUrl = file_exists(ROOT . "/game-images/levels/$map.png") ? "$ROOT/game-images/levels/$map.png" : "$ROOT/game-images/levels/default.png";
+ $template .= '
+
+
' . esc_attr($s['data']['server']['hostname']) . ' |
+
' . esc_attr("{$s['data']['server']['numplayers']}/{$s['data']['server']['maxplayers']}"). ' |
+
+ ' .
+ ' ' . esc_attr($s['data']['server']['mapname']) . '
+ |
+
' . esc_attr($s['data']['server']['bf2_mapsize']) . ' |
+
' . (preg_match('/gpm_coop/i', $s['data']['server']['gametype']) ? 'Co-op' : 'Conquest') . ' |
+
' . esc_attr($s['data']['server']['gamevariant']). ' |
+
' . esc_attr(preg_replace('/^(\d+\.\d+).*$/', '$1', $s['data']['server']['gamever'])). ' |
+ ';
+ }
}
$template .= '