diff --git a/html/pages/device/edit/apps.inc.php b/html/pages/device/edit/apps.inc.php index 00fc4a2686..f4c9eb9ee8 100644 --- a/html/pages/device/edit/apps.inc.php +++ b/html/pages/device/edit/apps.inc.php @@ -1,17 +1,102 @@ '); + +if($_POST['addapp']) { + if($_SESSION['userlevel'] == '10') { + include("includes/app-add.inc.php"); + } +} + +if($_POST['delapp']) { + if($_SESSION['userlevel'] == '10') { + include("includes/app-delete.inc.php"); + } +} + if ($handle = opendir($config['install_dir'] . "/includes/polling/applications/")) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && strstr($file, ".inc.php")) { - $file = str_replace(".inc.php", "", $file); - $servicesform .= ""; + $file = str_replace(".inc.php", "", $file); + $applicationsform .= ""; } } closedir($handle); } -echo("$servicesform"); +$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`"); +while($device = mysql_fetch_array($query)) { + $devicesform .= ""; +} + +if($updated) { print_message("Applications Updated"); } + +if(mysql_result(mysql_query("SELECT COUNT(*) from `applications` WHERE `device_id` = '".$device['device_id']."'"), 0) > '0') { + $i = "1"; + $app_query = mysql_query("select * from applications WHERE device_id = '".$device['device_id']."' ORDER BY app_type"); + while($application = mysql_fetch_array($app_query)) { + $existform .= ""; + } + +} + +if($existform){ +echo('
'); +echo(" + +

Remove application

+ +
+ + + + + + +
+ Type + + +
+ + +
"); +echo('
'); +} + +echo('
'); + +echo(" +

Add application

+ +
+ + + + + + +
+ Type + + +
+ + +
"); + +echo('
'); + +echo(''); ?> diff --git a/html/pages/device/edit/services.inc.php b/html/pages/device/edit/services.inc.php index 120417b264..4c07c487e1 100644 --- a/html/pages/device/edit/services.inc.php +++ b/html/pages/device/edit/services.inc.php @@ -32,8 +32,6 @@ while($device = mysql_fetch_array($query)) { if($updated) { print_message("Device Settings Saved"); } -echo('
'); - if(mysql_result(mysql_query("SELECT COUNT(*) from `services` WHERE `device_id` = '".$device['device_id']."'"), 0) > '0') { $i = "1"; $service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type"); @@ -44,7 +42,12 @@ if(mysql_result(mysql_query("SELECT COUNT(*) from `services` WHERE `device_id` = } +if($existform){ +echo('
'); echo(" + +

Remove Service

+
@@ -67,10 +70,13 @@ echo(" echo(''); +} echo('
'); echo(" +

Add Service

+
diff --git a/includes/functions.php b/includes/functions.php index 741b3cadff..34042af93b 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -527,7 +527,9 @@ function createHost ($host, $community, $snmpver, $port = 161, $transport = 'udp function isDomainResolves($domain) { - return count(dns_get_record($domain)) != 0; + # duh. + #return count(dns_get_record($domain)) != 0; + return gethostbyname($domain) != $domain; } function hoststatus($id)