diff --git a/public/css/default.css b/public/css/default.css index 09b6584..1e3c181 100644 --- a/public/css/default.css +++ b/public/css/default.css @@ -12,6 +12,7 @@ /* vars */ --container-max-width: 768px; + --color-success: #4bc432; --color-warning: #ee784e; --color-error: #ff6363; --color-default: #999; @@ -86,6 +87,53 @@ footer } /* framework */ +.cursor-default +{ + cursor: default; +} + +.cursor-pointer +{ + cursor: pointer; +} + +.cursor-help +{ + cursor: help; +} + +.color-success, +a.color-success, +a.color-success:active, +a.color-success:visited +{ + color: var(--color-success); +} + +.color-warning, +a.color-warning, +a.color-warning:active, +a.color-warning:visited +{ + color: var(--color-warning); +} + +.color-error, +a.color-error, +a.color-error:active, +a.color-error:visited +{ + color: var(--color-error); +} + +.color-default, +a.color-default, +a.color-default:active, +a.color-default:visited +{ + color: var(--color-default); +} + .text-align-left { text-align: left; diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 988eadb..951dbbf 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -43,6 +43,36 @@ class MainController extends AbstractController foreach ($hlservers as $hlserver) { + // Init defaults + $info = []; + $session = []; + $online = []; + + // Generate CRC32 ID + $crc32server = crc32( + $hlserver->host . ':' . $hlserver->port + ); + + // Prepare aliases + $aliases = []; + + foreach ($hlserver->alias as $value) + { + $alias = new \xPaw\SourceQuery\SourceQuery(); + + $alias->Connect( + $value->host, + $value->port + ); + + $aliases[] = [ + 'host' => $value->host, + 'port' => $value->port, + 'status' => $alias->Ping() + ]; + } + + // Request server info try { $server = new \xPaw\SourceQuery\SourceQuery(); @@ -56,11 +86,6 @@ class MainController extends AbstractController { if ($info = (array) $server->GetInfo()) { - // Generate CRC32 ID - $crc32server = crc32( - $hlserver->host . ':' . $hlserver->port - ); - // Get session $session = empty($info['Players']) ? [] : (array) $server->GetPlayers(); @@ -87,18 +112,14 @@ class MainController extends AbstractController ], 10 ); - - // Add server - $servers[] = [ - 'crc32server' => $crc32server, - 'host' => $hlserver->host, - 'port' => $hlserver->port, - 'alias' => $hlserver->alias, - 'info' => $info, - 'session' => $session, - 'online' => $online - ]; } + + $status = true; + } + + else + { + $status = false; } } @@ -111,6 +132,18 @@ class MainController extends AbstractController { $server->Disconnect(); } + + // Add server + $servers[] = [ + 'crc32server' => $crc32server, + 'host' => $hlserver->host, + 'port' => $hlserver->port, + 'aliases' => $aliases, + 'info' => $info, + 'session' => $session, + 'online' => $online, + 'status' => $status + ]; } return $this->render( diff --git a/templates/default/main/index.html.twig b/templates/default/main/index.html.twig index 8ee462c..88e229a 100644 --- a/templates/default/main/index.html.twig +++ b/templates/default/main/index.html.twig @@ -7,12 +7,38 @@