diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 1777eff29e..6cbaf79304 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -392,9 +392,9 @@ $table_os .= ''; // Network server. $servers = servers_get_names(); -if (!array_key_exists($server_name, $servers)) { - $server_Name = 0; - // Set the agent have not server. +// Set the agent have not server. +if (array_key_exists($server_name, $servers) === false) { + $server_name = 0; } $table_server = '
'.__('Server').'
'; diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php index 69f14e42f1..c496dfe13d 100644 --- a/pandora_console/include/functions_servers.php +++ b/pandora_console/include/functions_servers.php @@ -57,7 +57,7 @@ function servers_get_server($id_server, $filter=false, $fields=false) /** * Get all the server availables. * - * @return All the servers available. + * @return array the servers available. */ function servers_get_names() { @@ -1319,3 +1319,22 @@ function servers_get_server_string_name(int $server) return __('N/A'); } } + + +/** + * Return server name master where status is activated. + * + * @return string + */ +function servers_get_master() +{ + $sql = 'SELECT `name` FROM tserver WHERE `status` = 1 order by `master` desc'; + + $result = db_get_value_sql($sql); + + if ($result === false) { + $result = ''; + } + + return $result; +}