2010-06-20 17:21:35 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
echo('<div style="padding: 10px;">');
|
|
|
|
|
2011-03-16 23:10:10 +00:00
|
|
|
if ($_POST['addsrv']) {
|
|
|
|
if ($_SESSION['userlevel'] == '10') {
|
2010-06-20 17:21:35 +00:00
|
|
|
include("includes/service-add.inc.php");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-16 23:10:10 +00:00
|
|
|
if ($_POST['delsrv']) {
|
|
|
|
if ($_SESSION['userlevel'] == '10') {
|
2010-07-29 13:42:36 +00:00
|
|
|
include("includes/service-delete.inc.php");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-16 23:10:10 +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>";
|
2010-06-20 17:21:35 +00:00
|
|
|
}
|
2011-03-16 23:10:10 +00:00
|
|
|
}
|
2011-03-17 00:09:20 +00:00
|
|
|
|
2011-03-16 23:10:10 +00:00
|
|
|
closedir($handle);
|
2010-06-20 17:21:35 +00:00
|
|
|
}
|
|
|
|
|
2011-05-15 17:20:26 +00:00
|
|
|
foreach (dbFetchRows("SELECT * FROM `devices` ORDER BY `hostname`") as $dev);
|
2011-03-16 23:10:10 +00:00
|
|
|
{
|
2011-05-15 17:20:26 +00:00
|
|
|
$devicesform .= "<option value='" . $dev['device_id'] . "'>" . $dev['hostname'] . "</option>";
|
2010-06-20 17:21:35 +00:00
|
|
|
}
|
|
|
|
|
2011-03-16 23:10:10 +00:00
|
|
|
if ($updated) { print_message("Device Settings Saved"); }
|
2010-06-20 17:21:35 +00:00
|
|
|
|
2011-05-15 17:20:26 +00:00
|
|
|
if (dbFetchCell("SELECT COUNT(*) from `services` WHERE `device_id` = ?" array($device['device_id'])) > '0')
|
2011-03-16 23:10:10 +00:00
|
|
|
{
|
|
|
|
$i = "1";
|
2011-05-15 17:20:26 +00:00
|
|
|
foreach (dbFetchRows("select * from services WHERE device_id = ? ORDER BY service_type", array($device['device_id'])) as $service)
|
2011-03-16 23:10:10 +00:00
|
|
|
{
|
|
|
|
$existform .= "<option value='" . $service['service_id'] . "'>" . $service['service_type'] . "</option>";
|
|
|
|
}
|
2010-06-20 17:21:35 +00:00
|
|
|
}
|
|
|
|
|
2011-03-16 23:10:10 +00:00
|
|
|
if($existform
|
|
|
|
{
|
|
|
|
echo('<div style="float: left;">');
|
|
|
|
echo("
|
2011-03-16 12:12:10 +00:00
|
|
|
|
|
|
|
<h1>Remove Service</h1>
|
|
|
|
|
2010-06-20 17:21:35 +00:00
|
|
|
<form id='delsrv' name='delsrv' method='post' action=''>
|
|
|
|
<input type=hidden name='delsrv' value='yes'>
|
|
|
|
<table width='200' border='0'>
|
|
|
|
<option type=hidden name=device value='".$device['device_id']."'>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
Type
|
|
|
|
</td>
|
|
|
|
<td>
|
2010-07-29 13:42:36 +00:00
|
|
|
<select name='service'>
|
2010-06-20 17:21:35 +00:00
|
|
|
$existform
|
|
|
|
</select>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<input type='submit' name='Submit' value='Delete' />
|
|
|
|
</label>
|
|
|
|
</form>");
|
|
|
|
|
2011-03-16 23:10:10 +00:00
|
|
|
echo('</div>');
|
2011-03-16 12:12:10 +00:00
|
|
|
}
|
2010-06-20 17:21:35 +00:00
|
|
|
|
|
|
|
echo('<div style="width: 45%; float: right;">');
|
|
|
|
|
|
|
|
echo("
|
2011-03-16 12:12:10 +00:00
|
|
|
<h1>Add Service</h1>
|
|
|
|
|
2010-06-20 17:21:35 +00:00
|
|
|
<form id='addsrv' name='addsrv' method='post' action=''>
|
|
|
|
<input type=hidden name='addsrv' value='yes'>
|
|
|
|
<table width='200' border='0'>
|
|
|
|
<option type=hidden name=device value='".$device['device_id']."'>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
Type
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<select name='type'>
|
|
|
|
$servicesform
|
|
|
|
</select>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<input type='submit' name='Submit' value='Add' />
|
|
|
|
<label><br />
|
|
|
|
</label>
|
2011-03-16 23:10:10 +00:00
|
|
|
</form>
|
|
|
|
</div>");
|
2010-06-20 17:21:35 +00:00
|
|
|
|
2011-05-15 17:20:26 +00:00
|
|
|
?>
|