diff options
| author | michael pereira | 2011-04-22 11:33:07 +0200 |
|---|---|---|
| committer | michael pereira | 2011-04-22 11:33:07 +0200 |
| commit | a4a3640f4ee97eb8b397914fff0cafaa8c9f2ef6 (patch) | |
| tree | d7e7e7bd38ae1e5a5fce2ca351dbcc159e664dff /application/modules/user/controllers/BootisoController.php | |
| parent | Preboot gefixt (diff) | |
| download | pbs2-a4a3640f4ee97eb8b397914fff0cafaa8c9f2ef6.tar.gz pbs2-a4a3640f4ee97eb8b397914fff0cafaa8c9f2ef6.tar.xz pbs2-a4a3640f4ee97eb8b397914fff0cafaa8c9f2ef6.zip | |
controller fixes
Diffstat (limited to 'application/modules/user/controllers/BootisoController.php')
| -rw-r--r-- | application/modules/user/controllers/BootisoController.php | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/application/modules/user/controllers/BootisoController.php b/application/modules/user/controllers/BootisoController.php index e83a2c5..f1cf37a 100644 --- a/application/modules/user/controllers/BootisoController.php +++ b/application/modules/user/controllers/BootisoController.php @@ -135,33 +135,39 @@ class user_BootisoController extends Zend_Controller_Action $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); - - //ACL Darf er BootISOs downloaden? if(!Pbs_Acl::checkRight('bdld')) - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/forbidden'); + $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/forbidden'); $bootisoID = $this->_request->getParam('bootisoID'); if(!is_numeric($bootisoID)) - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/forbidden'); - - $prebootID = $this->bootisoMapper->find($bootisoID)->getPrebootID(); + $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/forbidden'); + $bootiso = $this->bootisoMapper->find($bootisoID); + $prebootID = $bootiso->getPrebootID(); if(!is_dir("../resources/bootmedium/$prebootID/")) - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/404'); - + $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/404'); + + $zip = new ZipArchive(); + $res = $zip->open("../resources/bootmedium/$prebootID/preboot.zip"); + if($res === true){ + $rootdir = $zip->getNameIndex(0); + $zip->addFromString($rootdir."build/rootfs/tmp/serial", $bootiso->getSerialnumber()); + $zip->close(); + } + chdir("../resources/bootmedium/$prebootID/"); - header("X-Sendfile: $bootisoID".".zip"); + header("X-Sendfile: preboot.zip"); 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="preboot.zip"'); header('Pragma: no-cache'); header('Expires: 0'); - $handle = fopen($bootisoID.".zip", 'r'); + $handle = fopen("preboot.zip", 'r'); $chunk_size = 8192; while ($chunk = fread($handle, $chunk_size)) { echo $chunk; @@ -205,21 +211,8 @@ class user_BootisoController extends Zend_Controller_Action $bootiso->setGroupID($this->membership->getGroupID()); $bootiso->setCreated(time()); - $prebootID = $bootiso->getPrebootID(); - try { - $bootisoID = $this->bootisoMapper->save($bootiso); - - copy("../resources/bootmedium/$prebootID/preboot.zip", "../resources/bootmedium/$prebootID/$bootisoID".".zip"); - $zip = new ZipArchive(); - $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip"); - if($res === true){ - $rootdir = $zip->getNameIndex(0); - $zip->addFromString($rootdir."build/rootfs/tmp/serial", $bootiso->getSerialnumber()); - $zip->close(); - } - }catch(Zend_Exception $e) { echo "Caught exception: " . get_class($e) . "<br/>"; @@ -294,16 +287,8 @@ class user_BootisoController extends Zend_Controller_Action $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden'); } - try { - $zip = new ZipArchive(); - $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip"); - if($res === true){ - $rootdir = $zip->getNameIndex(0); - $zip->addFromString($rootdir."build/rootfs/serial", $bootiso->getSerialnumber()); - $zip->close(); - } - + $this->bootisoMapper->save($bootiso); }catch(Zend_Exception $e) |
