diff options
author | Simon Rettberg | 2019-10-16 18:12:17 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-10-16 18:12:17 +0200 |
commit | 36e47dcdfb7d19d4c8982a77b4dd3b87d8c4ca31 (patch) | |
tree | 1326851106dd111dc1bcd32d0622dda094f1dcae /modules-available/serversetup-bwlp-ipxe/page.inc.php | |
parent | [dozmod] Increase sat DB's launch counter on cache hit (diff) | |
download | slx-admin-36e47dcdfb7d19d4c8982a77b4dd3b87d8c4ca31.tar.gz slx-admin-36e47dcdfb7d19d4c8982a77b4dd3b87d8c4ca31.tar.xz slx-admin-36e47dcdfb7d19d4c8982a77b4dd3b87d8c4ca31.zip |
[serversetup-bwlp-ipxe/minilinux] Implement minilinux hook for ipxe
Diffstat (limited to 'modules-available/serversetup-bwlp-ipxe/page.inc.php')
-rw-r--r-- | modules-available/serversetup-bwlp-ipxe/page.inc.php | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/modules-available/serversetup-bwlp-ipxe/page.inc.php b/modules-available/serversetup-bwlp-ipxe/page.inc.php index 40b75dd2..f14c1e57 100644 --- a/modules-available/serversetup-bwlp-ipxe/page.inc.php +++ b/modules-available/serversetup-bwlp-ipxe/page.inc.php @@ -519,25 +519,25 @@ class Page_ServerSetup extends Page $params['oldentryid'] = $params['entryid'] = $row['entryid']; $params['builtin'] = $row['builtin']; } - if (!is_array($params['entries'])) { - $params['entries'] = []; - } - $f = []; - foreach ($params['entries'] as $e) { - if (isset($e['mode'])) { - $f[] = $e['mode']; - } - } - if (!in_array('PCBIOS', $f)) { - $params['entries'][] = ['mode' => 'PCBIOS']; - } - if (!in_array('EFI', $f)) { - $params['entries'][] = ['mode' => 'EFI']; - } $params['menus'] = Database::queryAll('SELECT m.menuid, m.title FROM serversetup_menu m INNER JOIN serversetup_menuentry me ON (me.menuid = m.menuid) WHERE me.entryid = :entryid', ['entryid' => $row['entryid']]); } + if (!isset($params['entries']) || !is_array($params['entries'])) { + $params['entries'] = []; + } + $f = []; + foreach ($params['entries'] as $e) { + if (isset($e['mode'])) { + $f[] = $e['mode']; + } + } + if (!in_array('PCBIOS', $f)) { + $params['entries'][] = ['mode' => 'PCBIOS']; + } + if (!in_array('EFI', $f)) { + $params['entries'][] = ['mode' => 'EFI']; + } $params['disabled'] = User::hasPermission('ipxe.bootentry.edit') ? '' : 'disabled'; Render::addTemplate('ipxe-new-boot-entry', $params); @@ -823,12 +823,19 @@ class Page_ServerSetup extends Page } /** @var BootEntryHook $module */ $module = $hook->run(); - $entryData = Request::post('selection-' . $type, false, 'string'); - $entry = $module->getBootEntry($entryData); + $id = Request::post('selection-' . $type, false, 'string'); + $entry = $module->isValidId($id); if ($entry === null) { - Message::addError('invalid-custom-entry-id', $type, $entryData); + Message::addError('invalid-custom-entry-id', $type, $id); return; } + $entryData = ['id' => $id]; + foreach ($module->extraFields() as $field) { + if ($field->name === 'id') + continue; + $entryData[$field->name] = $field->fromPost($type); + } + $entryData = json_encode($entryData); } $params = [ 'entryid' => $newId, |