summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol/pages/jumphost.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/rebootcontrol/pages/jumphost.inc.php')
-rw-r--r--modules-available/rebootcontrol/pages/jumphost.inc.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/modules-available/rebootcontrol/pages/jumphost.inc.php b/modules-available/rebootcontrol/pages/jumphost.inc.php
index 7d1877d2..d9aae234 100644
--- a/modules-available/rebootcontrol/pages/jumphost.inc.php
+++ b/modules-available/rebootcontrol/pages/jumphost.inc.php
@@ -28,10 +28,16 @@ class SubPage
self::execCheckConnection($id);
return;
}
+ $id = Request::post('deleteid', false, 'int');
+ if ($id !== false) {
+ User::assertPermission('jumphost.edit');
+ self::deleteJumphost($id);
+ }
}
private static function execCheckConnection($hostid)
{
+ // Permcheck in caller
$host = self::getJumpHost($hostid);
$task = RebootControl::wakeViaJumpHost($host, '255.255.255.255', [['macaddr' => '00:11:22:33:44:55']]);
if (!Taskmanager::isTask($task))
@@ -39,6 +45,14 @@ class SubPage
Util::redirect('?do=rebootcontrol&show=task&type=checkhost&what=task&taskid=' . $task['id']);
}
+ private static function deleteJumphost($hostid)
+ {
+ // Permcheck in caller
+ $host = self::getJumpHost($hostid);
+ Database::exec('DELETE FROM reboot_jumphost WHERE hostid = :hostid LIMIT 1', ['hostid' => $hostid]);
+ Message::addSuccess('jumphost-deleted', $host['host']);
+ }
+
private static function saveJumpHost()
{
User::assertPermission('jumphost.edit');
@@ -120,7 +134,7 @@ class SubPage
LEFT JOIN reboot_jumphost_x_subnet jxs USING (hostid)
GROUP BY hostid
ORDER BY hostid');
- while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ foreach ($res as $row) {
$hosts[] = $row;
}
$data = [
@@ -173,7 +187,7 @@ class SubPage
ORDER BY start ASC',
['id' => $id]);
$list = [];
- while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ foreach ($res as $row) {
$row['cidr'] = IpUtil::rangeToCidr($row['start'], $row['end']);
if ($row['hostid'] !== null) {
$row['checked'] = 'checked';