_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $session = new Application_Model_Session(); $sm = new Application_Model_SessionMapper(); //TODO Error Messages if something failed $alphaID = $this->_request->getParam('alpha'); if($alphaID != ""){ $alphasessionID = $alphaID; $result = $sm->findBy(array('alphasessionID' => $alphasessionID),true); # print_a($result); $this->thisSession = $session->setOptions($result[0]); $this->thisSession->setID($result[0]['sessionID']); } $bootmenuntryID = $this->_request->getParam('bme'); if(isset($bootmenuntryID)){ $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper(); $bootmenuentry = new Application_Model_BootMenuEntries(); $bootmenuentriesMapper->find($bootmenuntryID,$bootmenuentry); $sessionMapper = new Application_Model_SessionMapper(); $this->thisSession->setBootmenuentryID($bootmenuntryID); $this->thisSession->setBootosID($bootmenuentry->getBootosID()); $sessionMapper->save($this->thisSession); } } public function getvesamenuAction(){ if(is_dir("../resources/ipxe/")){ header('Content-Type: application/octet-stream'); $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment'; header('Content-Disposition: ' . $content_disp . '; filename="vesamenu.c32"'); header('Pragma: no-cache'); header('Expires: 0'); chdir("../resources/ipxe/"); header("Content-Length: ".filesize(getcwd()."/vesamenu.c32")); passthru( "cat vesamenu.c32"); }else{ header('HTTP/1.0 404 Not Found'); } } public function getvesamenuconfigAction(){ $login = $this->_request->getParam('login'); if($login){ if(!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])){ header('WWW-Authenticate: Basic realm=""'); header('HTTP/1.0 401 Unauthorized'); exit; } } header('Content-Type: text/html'); $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment'; header('Content-Disposition: ' . $content_disp . '; filename="vesamenu.conf"'); header('Pragma: no-cache'); header('Expires: 0'); $vesamenuView = new Zend_View(); $vesamenuView->addScriptPath(APPLICATION_PATH.'/modules/ipxe/views/scripts/resource/'); $vesamenuView->username = $_SERVER['PHP_AUTH_USER']; $vesamenuView->password = $_SERVER['PHP_AUTH_PW']; $vesamenuView->login = $login; $vesamenuView->host = $_SERVER['HTTP_HOST']; $_SESSION['alphasessionID'] = $this->thisSession->getAlphasessionID(); // Request Bootmenu $pbsFilter = new Pbs_Filter(); $bootmenuID = $pbsFilter->evaluate(); if($bootmenuID != null){ $vesamenuView->alphaID = $this->thisSession->getAlphasessionID(); $bootmenuMapper = new Application_Model_BootMenuMapper(); $bm = $bootmenuMapper->find($bootmenuID); $vesamenuView->title = $bm->getTitle(); // $this->view->startcounter = $bm->getStartcounter(); $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper(); $res = $bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID),false); $vesamenuView->bmelist = $res; } else{ $vesamenuView->error = "You have no BootMenu."; } $vesamenu = $vesamenuView->render('getvesamenu.phtml'); header("Content-Length: ".(strlen($vesamenu))); echo $vesamenu; } public function getkernelAction(){ $bootosID = $this->thisSession->getBootosID(); if(is_dir("../resources/bootos/$bootosID/kernel/") && is_numeric($bootosID)){ header('Content-Type: application/x-gzip'); $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment'; header('Content-Disposition: ' . $content_disp . '; filename="kernel"'); header('Pragma: no-cache'); header('Expires: 0'); // create the gzipped tarfile. chdir("../resources/bootos/$bootosID/kernel/"); $kernelname = array_pop(scandir("./")); header("Content-Length: ".filesize(getcwd()."/".$kernelname)); passthru( "cat ". $kernelname); }else{ header('HTTP/1.0 404 Not Found'); } } public function getinitramfsAction() { $bootosID = $this->thisSession->getBootosID(); if(is_dir("../resources/bootos/$bootosID/initramfs/") && is_numeric($bootosID)){ header('Content-Type: application/x-gzip'); $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment'; header('Content-Disposition: ' . $content_disp . '; filename="initramfs"'); header('Pragma: no-cache'); header('Expires: 0'); // create file. chdir("../resources/bootos/$bootosID/initramfs/"); $initname = array_pop(scandir("./")); header("Content-Length: ".filesize(getcwd()."/".$initname)); passthru( "cat ".$initname); }else{ header('HTTP/1.0 404 Not Found'); } } }