Commit 391e05cb authored by Falko Timme's avatar Falko Timme
Browse files

- Display hostname next to IP (where available) in the jQuery IP suggestion box.

parent 3327ed19
......@@ -237,12 +237,24 @@ class functions {
// IPv6
$regex = "/^(\:\:([a-f0-9]{1,4}\:){0,6}?[a-f0-9]{0,4}|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){0,6}?\:\:|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){1,6}?\:\:([a-f0-9]{1,4}\:){1,6}?[a-f0-9]{1,4})(\/\d{1,3})?$/i";
}
$server_by_id = array();
$server_by_ip = array();
$servers = $app->db->queryAllRecords("SELECT * FROM server");
if(is_array($servers) && !empty($servers)){
foreach($servers as $server){
$server_by_id[$server['server_id']] = $server['server_name'];
}
}
$ips = array();
$results = $app->db->queryAllRecords("SELECT ip_address AS ip FROM server_ip WHERE ip_type = '".$type."'");
$results = $app->db->queryAllRecords("SELECT ip_address AS ip, server_id FROM server_ip WHERE ip_type = '".$type."'");
if(!empty($results) && is_array($results)){
foreach($results as $result){
if(preg_match($regex, $result['ip'])) $ips[] = $result['ip'];
if(preg_match($regex, $result['ip'])){
$ips[] = $result['ip'];
$server_by_ip[$result['ip']] = $server_by_id[$result['server_id']];
}
}
}
$results = $app->db->queryAllRecords("SELECT ip_address AS ip FROM openvz_ip");
......@@ -317,7 +329,7 @@ class functions {
foreach($ips as $ip){
$result_array['cdata'][] = array( 'title' => $ip,
'description' => $type,
'description' => $type.($server_by_ip[$ip] != ''? ' > '.$server_by_ip[$ip] : ''),
'onclick' => '',
'fill_text' => $ip
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment