diff options
| author | michael pereira | 2011-07-11 03:26:29 +0200 |
|---|---|---|
| committer | michael pereira | 2011-07-11 03:26:29 +0200 |
| commit | 5359c2427b83d3161bba58e1fd22b3af6d2d9605 (patch) | |
| tree | 06b1f1e550e278569232ac3f1dfd4d65048cf047 /application/modules/ipxe/controllers/ResourceController.php | |
| parent | redirect raus (diff) | |
| download | pbs2-5359c2427b83d3161bba58e1fd22b3af6d2d9605.tar.gz pbs2-5359c2427b83d3161bba58e1fd22b3af6d2d9605.tar.xz pbs2-5359c2427b83d3161bba58e1fd22b3af6d2d9605.zip | |
redirect raus
Diffstat (limited to 'application/modules/ipxe/controllers/ResourceController.php')
| -rw-r--r-- | application/modules/ipxe/controllers/ResourceController.php | 62 |
1 files changed, 47 insertions, 15 deletions
diff --git a/application/modules/ipxe/controllers/ResourceController.php b/application/modules/ipxe/controllers/ResourceController.php index 1a14502..6d4192a 100644 --- a/application/modules/ipxe/controllers/ResourceController.php +++ b/application/modules/ipxe/controllers/ResourceController.php @@ -98,32 +98,64 @@ class Ipxe_ResourceController extends Zend_Controller_Action echo $vesamenu; } - public function startAction(){ + public function getkernelAction(){ $bootmenuntryID = $this->_request->getParam('bme'); - $a = $this->thisSession->getAlphasessionID(); $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper(); $bootmenuentry = new Application_Model_BootMenuEntries(); $bootmenuentriesMapper->find($bootmenuntryID,$bootmenuentry); - - $sessionMapper = new Application_Model_SessionMapper(); - $session_k = $sessionMapper->findBy(array('alphasessionID' => $a),true); - $session = new Application_Model_Session(); - $session->setOptions($session_k[0]); - $session->setID($session_k[0]['sessionID']); + $this->thisSession->setBootmenuentryID($bootmenuntryID); + $this->thisSession->setBootosID($bootmenuentry->getBootosID()); + $sessionMapper->save($this->thisSession); - $session->setBootmenuentryID($bootmenuntryID); - $session->setBootosID($bootmenuentry->getBootosID()); - $sessionMapper->save($session); - - $this->_redirect('/resource/getkernel/alpha/'.$session->getAlphasessionID()); - + $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'); + } + } } |
