blob: 1ac885df57ec5bff7d5c022d43022332a735ad6a (
plain) (
tree)
|
|
<?php
(function() {
$type = Request::any('type');
if ($type === 'bash') {
$builder = new ScriptBuilderBash();
} else {
$builder = new ScriptBuilderIpxe();
}
$bootEntryId = Request::get('beid', false, 'string');
if ($bootEntryId !== false) {
$bootEntryId = Util::cleanUtf8($bootEntryId);
}
$entryId = Request::get('entryid', false, 'int');
if ($bootEntryId !== false) {
$entry = BootEntry::fromDatabaseId($bootEntryId);
$data = $builder->getBootEntry($entry);
} elseif ($entryId !== false) {
$entry = MenuEntry::get($entryId);
$data = $builder->getMenuEntry($entry);
} else {
// Get bootstrap code if required...
$data = $builder->bootstrapLive();
if ($data === false) {
// ...otherwise, generate normal code
$menuId = Request::get('menuid', false, 'int');
if ($menuId !== false) {
$menu = IPxeMenu::get($menuId, true);
} else {
$menu = IPxeMenu::forClient($builder->clientIp(), $builder->uuid());
}
$data = $builder->getMenu($menu, true);
}
}
$builder->output($data);
})();
|