From 9a44d009e7ba95d433e57520669b9d328d274ca1 Mon Sep 17 00:00:00 2001 From: Michael Neves Date: Thu, 26 Jan 2012 20:09:28 +0100 Subject: Bootiso download --- application/modules/user/controllers/BootisoController.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/application/modules/user/controllers/BootisoController.php b/application/modules/user/controllers/BootisoController.php index 344de0e..2136e5f 100644 --- a/application/modules/user/controllers/BootisoController.php +++ b/application/modules/user/controllers/BootisoController.php @@ -96,7 +96,7 @@ class user_BootisoController extends Zend_Controller_Action { $bootiso->setGroupID("[".$bootiso->getGroupID()."] ".$groupMapper->find($bootiso->getGroupID())->getTitle()); $bootiso->setPreBootTypeID($preboottypeMapper->find($bootiso->getPreBootTypeID())->getName()); $bootiso->setCreated(date(Zend_Registry::get('dateformat'), $bootiso->getCreated())); - if($prebootMapper->findBy(array("serialnumber" => $bootiso->getSerialnumber())) != null){ + if($prebootMapper->findBy(array('serialnumber' => $bootiso->getSerialnumber(), 'preboottypeID' => $bootiso->getPreboottypeID())) != null){ $this->view->download[$bootiso->getID()] = true; } if($bootiso->getExpires() == "") { @@ -146,8 +146,11 @@ class user_BootisoController extends Zend_Controller_Action { { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/forbidden'); } $bootiso = $this->bootisoMapper->find($bootisoID); - $prebootID = $bootiso->getPrebootID(); - + + $prebootMapper = new Application_Model_PreBootMapper(); + $preboot = array_shift($prebootMapper->findBy(array('serialnumber' => $bootiso->getSerialnumber(), 'preboottypeID' => $bootiso->getPreboottypeID()))); + $prebootID = $preboot->getID(); + if(!is_dir("../resources/bootmedium/$prebootID/")) { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/404'); } -- cgit v1.2.3-55-g7522