diff options
Diffstat (limited to 'modules/ipxe.inc.php')
-rw-r--r-- | modules/ipxe.inc.php | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/modules/ipxe.inc.php b/modules/ipxe.inc.php index 869f4c72..d479bd15 100644 --- a/modules/ipxe.inc.php +++ b/modules/ipxe.inc.php @@ -1,35 +1,40 @@ <?php -User::load(); +class Page_iPxe extends Page +{ -if (!User::hasPermission('superadmin')) { - Message::addError('no-permission'); - Util::redirect('?do=main'); -} + protected function doPreprocess() + { + User::load(); + + if (!User::hasPermission('superadmin')) { + Message::addError('no-permission'); + Util::redirect('?do=Main'); + } -if (isset($_POST['action'])) { - if ($_POST['action'] === 'compile') { - if (!Util::verifyToken()) { - Util::redirect('?do=main'); + if (isset($_POST['action'])) { + if ($_POST['action'] === 'compile') { + if (!Util::verifyToken()) { + Util::redirect('?do=Main'); + } + } } } -} -function render_module() -{ - $ips = array(); - $current = CONFIG_IPXE_DIR . '/last-ip'; - if (file_exists($current)) $current = file_get_contents($current); - exec('/bin/ip a', $retval); - foreach ($retval as $ip) { - if (preg_match('#inet (\d+\.\d+\.\d+\.\d+)/\d+.*scope#', $ip, $out) && $out[1] !== '127.0.0.1') { - $ips[] = array( - 'ip' => $out[1], - 'current' => ($out[1] == $current) - ); + protected function doRender() + { + $ips = array(); + $current = CONFIG_IPXE_DIR . '/last-ip'; + if (file_exists($current)) $current = file_get_contents($current); + exec('/bin/ip a', $retval); + foreach ($retval as $ip) { + if (preg_match('#inet (\d+\.\d+\.\d+\.\d+)/\d+.*scope#', $ip, $out) && $out[1] !== '127.0.0.1') { + $ips[] = array( + 'ip' => $out[1], + 'current' => ($out[1] == $current) + ); + } } + Render::addTemplate('page-ipxe', array('ips' => $ips, 'token' => Session::get('token'))); } - Render::addTemplate('page-ipxe', array('ips' => $ips, 'token' => Session::get('token'))); } - - |