hasExtension; } public function platform() { return $this->platform; } public function uuid() { return $this->uuid; } public function clientIp() { return $this->clientIp; } public function getLabel() { return 'b' . mt_rand(100, 999) . 'x' . (++$this->lblId); } public function __construct($platform = null, $serverIp = null, $slxExtensions = null) { $this->clientIp = $_SERVER['REMOTE_ADDR']; if (substr($this->clientIp, 0, 7) === '::ffff:') { $this->clientIp = substr($this->clientIp, 7); } $this->serverIp = $serverIp ?? $_SERVER['SERVER_ADDR'] ?? Property::getServerIp(); $this->platform = $platform ?? Request::any('platform', false, 'string'); if ($this->platform !== false) { $this->platform = strtoupper($this->platform); } if ($this->platform !== 'EFI' && $this->platform !== 'PCBIOS') { $this->platform = ''; } $this->hasExtension = $slxExtensions ?? (bool)Request::any('slx-extensions', false, 'int'); $this->uuid = Request::any('uuid', false, 'string'); if (!preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i', $this->uuid)) { $this->uuid = false; } } /** * Output given string (script) to client, in a suitable encoding, headers, etc. * @param string $string */ public abstract function output($string); public abstract function bootstrapLive(); public abstract function getMenu(IPxeMenu $menu, bool $bootstrap); /** * @param MenuEntry|null $menuEntry The according menu entry, or null if invalid. * @param bool $honorPassword Whether we should generate a password dialog if protected, or skip * @return string generated script/code/... */ public abstract function getMenuEntry($menuEntry, $honorPassword = true); /** * @param BootEntry|null|false $bootEntry * @return string */ public abstract function getBootEntry($bootEntry); public abstract function getSpecial($special); /** * @param IPxeMenu|null $menu * @return string */ public abstract function menuToScript($menu); /** * Pass EITHER only $agnostic, OR $bios and/or $efi * If $agnostic is given, it should be used unconditionally, * and $bios/$efi should be ignored. * @param ExecData $agnostic * @param ExecData $bios * @param ExecData $efi * @return string */ public abstract function execDataToScript($agnostic, $bios, $efi); }