summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol/page.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/rebootcontrol/page.inc.php')
-rw-r--r--modules-available/rebootcontrol/page.inc.php27
1 files changed, 22 insertions, 5 deletions
diff --git a/modules-available/rebootcontrol/page.inc.php b/modules-available/rebootcontrol/page.inc.php
index cf87a3b3..80eff842 100644
--- a/modules-available/rebootcontrol/page.inc.php
+++ b/modules-available/rebootcontrol/page.inc.php
@@ -21,10 +21,10 @@ class Page_RebootControl extends Page
}
if (User::hasPermission('jumphost.*')) {
- Dashboard::addSubmenu('?do=rebootcontrol&show=jumphost', Dictionary::translate('jumphosts', true));
+ Dashboard::addSubmenu('?do=rebootcontrol&show=jumphost', Dictionary::translate('jumphosts'));
}
if (User::hasPermission('subnet.*')) {
- Dashboard::addSubmenu('?do=rebootcontrol&show=subnet', Dictionary::translate('subnets', true));
+ Dashboard::addSubmenu('?do=rebootcontrol&show=subnet', Dictionary::translate('subnets'));
}
$section = Request::any('show', false, 'string');
@@ -46,7 +46,13 @@ class Page_RebootControl extends Page
} elseif ($action === 'toggle-wol') {
User::assertPermission('woldiscover');
$enabled = Request::post('enabled', false);
+ $c2c = Request::post('enabled-c2c', false);
+ $port = Request::post('port', 9, 'int');
+ $dbcast = Request::post('dbcast', '', 'string');
Property::set(RebootControl::KEY_AUTOSCAN_DISABLED, !$enabled);
+ Property::set(RebootControl::KEY_SCAN_CLIENT_TO_CLIENT, $c2c);
+ Property::set(RebootControl::KEY_UDP_PORT, $port);
+ Property::set(RebootControl::KEY_BROADCAST_ADDRESS, $dbcast);
if ($enabled) {
Message::addInfo('woldiscover-enabled');
} else {
@@ -59,7 +65,13 @@ class Page_RebootControl extends Page
if (Request::isPost()) {
Util::redirect('?do=rebootcontrol' . ($section ? '&show=' . $section : ''));
} elseif ($section === false) {
- Util::redirect('?do=rebootcontrol&show=task');
+ if (User::hasPermission('action.*')) {
+ Util::redirect('?do=rebootcontrol&show=task');
+ } elseif (User::hasPermission('jumphost.*')) {
+ Util::redirect('?do=rebootcontrol&show=jumphost');
+ } else {
+ Util::redirect('?do=rebootcontrol&show=subnet');
+ }
}
}
@@ -89,7 +101,6 @@ class Page_RebootControl extends Page
if (Taskmanager::isTask($task)) {
Util::redirect("?do=rebootcontrol&show=task&what=task&taskid=" . $task["id"]);
}
- return;
}
/**
@@ -98,17 +109,23 @@ class Page_RebootControl extends Page
protected function doRender()
{
+ $port = (int)Property::get(RebootControl::KEY_UDP_PORT);
+ if ($port < 1 || $port > 65535) {
+ $port = 9;
+ }
// Always show public key (it's public, isn't it?)
$data = [
'pubkey' => SSHKey::getPublicKey(),
'wol_auto_checked' => Property::get(RebootControl::KEY_AUTOSCAN_DISABLED) ? '' : 'checked',
+ 'wol_c2c_checked' => Property::get(RebootControl::KEY_SCAN_CLIENT_TO_CLIENT) ? 'checked' : '',
+ 'port' => $port,
+ 'dbcast' => Property::get(RebootControl::KEY_BROADCAST_ADDRESS),
];
Permission::addGlobalTags($data['perms'], null, ['newkeypair', 'woldiscover']);
Render::addTemplate('header', $data);
if ($this->haveSubpage) {
SubPage::doRender();
- return;
}
}