diff --git a/admin.php b/admin.php index 30f4a91..724e165 100644 --- a/admin.php +++ b/admin.php @@ -1,5 +1,5 @@ _other = [ "zone" => null, "comment" => '', - 'conn_tries' => 0 + 'conn_tries' => 0, + 'colored_name' => null ]; } @@ -700,11 +703,11 @@ public function queryLive($request = 'seph') { $protocol = new Protocol($this, $request); $protocol->query(); - global $lgsl_config; - if ($lgsl_config['history'] && LGSL::requestHas($request, "h") && !$this->isPending()) { + $config = new Config(); + if ($config['history'] && LGSL::requestHas($request, "h") && !$this->isPending()) { $last = end($this->_history); if (!$last || time() - $last['t'] >= 60 * 15) { // RECORD IF 15 MINS IS PASSED - $history_limit = $lgsl_config['history_hours'] * 3600; + $history_limit = $config['history_hours'] * 3600; foreach ($this->_history as $key => $value) { if (time() - $this->_history[$key]['t'] > $history_limit) { // NOT OLDER THAN $lgsl_config['history_hours'] HOURS unset($this->_history[$key]); @@ -721,7 +724,7 @@ public function queryLive($request = 'seph') { } } - if ($lgsl_config['locations'] && empty($this->_other['location'])) { + if ($config['locations'] && empty($this->_other['location'])) { $this->_other['location'] = $this->queryLocation(); } } @@ -821,15 +824,15 @@ public function getName($htmlSafe = false) { if ($this->isPending()) { return LGSL::NONE; } - $name = Helper::lgslHtmlColor($this->_server['name'], true); if ($htmlSafe) { - $name = preg_replace('/([\x{0001F000}-\x{0001FAFF}])/mu', '', $name); + $name = preg_replace('/([\x{0001F000}-\x{0001FAFF}])/mu', '', $this->_server['name']); return htmlspecialchars($name, ENT_QUOTES); } - return $name; + return $this->_server['name']; } public function getColoredName() { - return Helper::lgslHtmlColor($this->_server['name']); + if (isset($this->_other['colored_name'])) return Helper::lgslHtmlColor($this->_other['colored_name']); + return $this->_server['name']; } public function setName($name) { $this->_server['name'] = $name; @@ -1199,8 +1202,8 @@ function toString() { $lgsl_file_path = LGSL::filePath(); - require "{$lgsl_file_path}lgsl_config.php"; - require "{$lgsl_file_path}lgsl_protocol.php"; + require_once "{$lgsl_file_path}lgsl_config.php"; + require_once "{$lgsl_file_path}lgsl_protocol.php"; $auth = md5(($_SERVER['REMOTE_ADDR'] ?? "").md5($lgsl_config['admin']['user'].md5($lgsl_config['admin']['pass']))); $cookie = $_COOKIE['lgsl_admin_auth'] ?? ""; diff --git a/src/lgsl_list.php b/src/lgsl_list.php index e5325dc..ddd776c 100644 --- a/src/lgsl_list.php +++ b/src/lgsl_list.php @@ -15,18 +15,19 @@ require "lgsl_language.php"; $lang = new Lang($_COOKIE['lgsl_lang'] ?? Lang::EN); global $output; + $config = new Config(); $type = $_GET['type'] ?? ''; $game = $_GET['game'] ?? ''; $mode = $_GET['mode'] ?? ''; - $sort = $_GET['sort'] ?? ''; + $sort = $_GET['sort'] ?? $config['sort']['servers']; $order= (isset($_GET['order']) ? $_GET['order'] == "ASC" ? "DESC" : 'ASC' : "ASC"); - $page = ($lgsl_config['pagination_mod'] && isset($_GET['page']) ? (int)$_GET['page'] : 1); + $page = ($config['pagination_mod'] && isset($_GET['page']) ? (int)$_GET['page'] : 1); $uri = $_SERVER['REQUEST_URI']; - if ($lgsl_config['preloader']) { + if ($config['preloader']) { $uri = $_SERVER['HTTP_REFERER']; } @@ -47,11 +48,11 @@
{$lgsl_config['text']['sts']}: | -{$lgsl_config['text']['adr']}: | -{$lgsl_config['text']['tns']}: | -{$lgsl_config['text']['map']}: | -{$lgsl_config['text']['plr']}: | -{$lgsl_config['text']['dtl']}: | +{$config['text']['adr']}: | +{$config['text']['tns']}: | +{$config['text']['map']}: | +{$config['text']['plr']}: | +{$config['text']['dtl']}: |
---|---|---|---|---|---|---|---|---|---|---|
- getStatus()]} | {$lgsl_config['text']['lst']}: {$lastupd}' class='status_icon_{$server->getStatus()}'>
+ getStatus()]} | {$config['text']['lst']}: {$lastupd}' class='status_icon_{$server->getStatus()}'>
|
- + | {$server->getAddress()} @@ -117,12 +118,12 @@ $output .= " |