2007-04-03 14:10:23 +00:00
|
|
|
<?php
|
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
if ($_SESSION['userlevel'] < '10')
|
|
|
|
{
|
2011-03-28 10:39:55 +00:00
|
|
|
include("includes/error-no-perm.inc.php");
|
2007-04-03 14:10:23 +00:00
|
|
|
}
|
2011-03-17 00:09:20 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if ($_POST['addsrv'])
|
|
|
|
{
|
2015-02-16 23:45:28 +00:00
|
|
|
if ($_SESSION['userlevel'] >= '10')
|
2011-03-17 00:09:20 +00:00
|
|
|
{
|
2012-05-06 23:02:18 +00:00
|
|
|
$updated = '1';
|
|
|
|
|
|
|
|
#FIXME should call add_service (needs more parameters)
|
|
|
|
$service_id = dbInsert(array('device_id' => $_POST['device'], 'service_ip' => $_POST['ip'], 'service_type' => $_POST['type'], 'service_desc' => $_POST['descr'], 'service_param' => $_POST['params'], 'service_ignore' => '0'), 'services');
|
|
|
|
|
|
|
|
if ($service_id)
|
|
|
|
{
|
|
|
|
$message .= $message_break . "Service added (".$service_id.")!";
|
|
|
|
$message_break .= "<br />";
|
|
|
|
}
|
2011-03-17 00:09:20 +00:00
|
|
|
}
|
|
|
|
}
|
2007-04-03 14:10:23 +00:00
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
if ($handle = opendir($config['install_dir'] . "/includes/services/"))
|
|
|
|
{
|
|
|
|
while (false !== ($file = readdir($handle)))
|
|
|
|
{
|
|
|
|
if ($file != "." && $file != ".." && !strstr($file, "."))
|
|
|
|
{
|
|
|
|
$servicesform .= "<option value='$file'>$file</option>";
|
|
|
|
}
|
2007-04-03 14:10:23 +00:00
|
|
|
}
|
|
|
|
closedir($handle);
|
2011-03-17 00:09:20 +00:00
|
|
|
}
|
2007-04-03 14:10:23 +00:00
|
|
|
|
2011-10-04 09:10:21 +00:00
|
|
|
foreach (dbFetchRows("SELECT * FROM `devices` ORDER BY `hostname`") as $device)
|
2011-03-17 00:09:20 +00:00
|
|
|
{
|
|
|
|
$devicesform .= "<option value='" . $device['device_id'] . "'>" . $device['hostname'] . "</option>";
|
|
|
|
}
|
2007-04-03 14:10:23 +00:00
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
if ($updated) { print_message("Device Settings Saved"); }
|
2007-04-03 14:10:23 +00:00
|
|
|
|
2011-10-18 14:41:19 +00:00
|
|
|
$pagetitle[] = "Add service";
|
|
|
|
|
2015-05-19 17:18:39 +01:00
|
|
|
echo "<div class='row'>
|
|
|
|
<div class='col-sm-6'>";
|
|
|
|
|
|
|
|
require_once "includes/print-service-add.inc.php";
|
|
|
|
|
|
|
|
echo "</div>
|
|
|
|
</div>";
|
|
|
|
|
2007-04-03 14:10:23 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-05-13 13:52:01 +00:00
|
|
|
?>
|