diff options
Diffstat (limited to 'application/modules/user/controllers/BootisoController.php')
| -rw-r--r-- | application/modules/user/controllers/BootisoController.php | 659 |
1 files changed, 325 insertions, 334 deletions
diff --git a/application/modules/user/controllers/BootisoController.php b/application/modules/user/controllers/BootisoController.php index f1cf37a..a5619f4 100644 --- a/application/modules/user/controllers/BootisoController.php +++ b/application/modules/user/controllers/BootisoController.php @@ -1,339 +1,330 @@ -<?php +<? php /* * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg - * This program is free software distributed under the GPL version 2. - * See http://gpl.openslx.org/ - * - * If you have any feedback please consult http://feedback.openslx.org/ and - * send your suggestions, praise, or complaints to feedback@openslx.org - * - * General information about OpenSLX can be found at http://openslx.org/ - */ - -class user_BootisoController extends Zend_Controller_Action -{ - - protected $bootisoMapper; - protected $membershipMapper; - protected $membership; - protected $page; - - public function init() - { - if (Zend_Auth::getInstance()->hasIdentity()) { - $userIDsNamespace = Zend_Session::namespaceGet('userIDs'); - if($userIDsNamespace['membershipID'] ==''){ - $this->_redirect('/user/index'); - } - - $this->bootisoMapper = new Application_Model_BootIsoMapper(); - - $this->membershipMapper = new Application_Model_MembershipMapper(); - $this->membership = new Application_Model_Membership(); - $this->membershipMapper->find($userIDsNamespace['membershipID'],$this->membership); - - $this->db = Zend_Db_Table::getDefaultAdapter(); - } else { - $this->_helper->redirector('login', 'auth'); - } - $this->page = $this->_request->getParam('page'); - } - - public function indexAction() - { - $result = $this->_request->getParam('addresult'); - if($result != ""){ - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('create',$result); - } - $result = $this->_request->getParam('deleteresult'); - if($result != ""){ - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('delete',$result); - } - $result = $this->_request->getParam('modifyresult'); - if($result != ""){ - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('modify',$result); - } - $result = $this->_request->getParam('downloadresult'); - if($result != ""){ - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('download',$result); - } - - - $groupMapper = new Application_Model_GroupMapper(); - - $groupID = $this->membership->getGroupID(); - - //ACL Darf er BootISOMenu sehen? - if(!Pbs_Acl::checkRight('bai') && !Pbs_Acl::checkRight('bui')) - $this->_redirect('/user/index'); - - $groupgroupsMapper = new Application_Model_GroupGroupsMapper(); - - $parents = array(); - $this->view->bootisolist = array(); - $parents = $groupgroupsMapper->getParentGroups($groupID); - - foreach($parents as $k => $parent){ - foreach($parent as $p){ - $bootiso = $this->bootisoMapper->findBy(array("groupID" => $p)); - foreach ($bootiso as $b) - if($b->getPublic() - $k >= 0 ) - $this->view->bootisolist[] = $b; - elseif($k == 0 && $b->getPublic() == -1 && Pbs_Acl::checkRight('bc')) - $this->view->bootisolist[] = $b; - } - } - - $this->view->bootisolist = array_reverse($this->view->bootisolist); - - $prebootMapper = new Application_Model_PreBootMapper(); - $this->view->prebootlist = array(); - - foreach ($this->view->bootisolist as $bootiso){ - $bootiso->setPrebootID("[".$bootiso->getPrebootID()."] ".$prebootMapper->find($bootiso->getPrebootID())->getTitle()); - $bootiso->setGroupID("[".$bootiso->getGroupID()."] ".$groupMapper->find($bootiso->getGroupID())->getTitle()); - $bootiso->setCreated(date(Zend_Registry::get('dateformat'),$bootiso->getCreated())); - if($bootiso->getExpires() == ""){ - $bootiso->setExpires(0); - } - $bootiso->setExpires(date(Zend_Registry::get('dateformat'),$bootiso->getExpires())); - } - - // Search - $search = $this->_request->getParam('search'); - $mySearch = new Pbs_Search(); - $mySearch->setSearchTerm($search); - $mySearch->setModule('bootiso'); - if($search != ''){ - $this->view->search = $mySearch->getSearchTerm(); - $this->view->bootisolist = $mySearch->search($this->view->bootisolist); - } - $this->view->searchform = $mySearch->searchForm(); - - // Pagination - $pagination = new Pbs_Pagination(); - $pagination->setPerPage(10); - $pagination->setElement($this->view->bootisolist); - $pagination->setRequestPage($this->_request->getParam('page')); - $pagination->setPageUrl('/user/bootiso/index'.((isset($this->view->search))?'/search/'.$this->view->search:'')); - $this->view->bootisolist = $pagination->getElements(); - - $this->view->pagination = $pagination->pagination(); - $this->view->page = $pagination->getRequestPage(); - } - - public function searchAction(){ - $this->_redirect('/user/bootiso/index/search/'.($_GET['search'])); - } - - public function downloadbootisoAction() - { - $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'); - - $bootisoID = $this->_request->getParam('bootisoID'); - - if(!is_numeric($bootisoID)) - $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'); - - $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: 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("preboot.zip", 'r'); - $chunk_size = 8192; - while ($chunk = fread($handle, $chunk_size)) { - echo $chunk; - ob_flush(); - } - - } - - public function createbootisoAction() - { - //ACL Darf er BootISOs erstellen? - if(!Pbs_Acl::checkRight('bc')) - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/forbidden'); - - $groupgroupsMapper = new Application_Model_GroupGroupsMapper(); - $groupID = $this->membership->getGroupID(); - - $groupgroupsMapper = new Application_Model_GroupGroupsMapper(); - $childgroups = count($groupgroupsMapper->getChildGroups($groupID)); - - $prebootMapper = new Application_Model_PreBootMapper(); - $prebootlist = $prebootMapper->findBy(array("groupID" => $groupID)); - if (!isset($_POST["createbootiso"])){ - $bootisoForm = new user_Form_Bootiso(array( - 'action' => 'createbootiso', - 'prebootlist' => $prebootlist, - 'groupdepth' => $childgroups, - 'page'=>$this->page)); - } else { - - $bootisoForm = new user_Form_Bootiso(array( - 'action' => 'createbootiso', - 'prebootlist' => $prebootlist, - 'groupdepth' => $childgroups, - 'page'=>$this->page),$_POST); - - if ($bootisoForm->isValid($_POST)) { - - $bootiso = new Application_Model_BootIso($_POST); - - $bootiso->setGroupID($this->membership->getGroupID()); - $bootiso->setCreated(time()); - - try { - $bootisoID = $this->bootisoMapper->save($bootiso); - }catch(Zend_Exception $e) - { - echo "Caught exception: " . get_class($e) . "<br/>"; - echo "Message: " . $e->getMessage() . "<br/>"; - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/error'); - //TODO Delete File & delete bootiso from DB - - } - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/ok'); - } - } - - $this->view->bootisoForm = $bootisoForm; - } - - public function editbootisoAction() - { - //ACL Darf er BootISOs editieren? - if(!Pbs_Acl::checkRight('be') && !Pbs_Acl::checkRight('bem')) - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden'); - - $bootisoID = $this->_request->getParam('bootisoID'); - if (!is_numeric($bootisoID)) - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden'); - - $groupID = $this->membership->getGroupID(); - - $prebootMapper = new Application_Model_PreBootMapper(); - $prebootlist = $prebootMapper->findBy(array("groupID" => $groupID)); - - $groupgroupsMapper = new Application_Model_GroupGroupsMapper(); - $childgroups = count($groupgroupsMapper->getChildGroups($groupID)); - - $bootiso = new Application_Model_BootIso(); - $this->bootisoMapper->find($bootisoID, $bootiso); - - if($this->membership->getGroupID() != $bootiso->getGroupID()) - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden'); - - if (!isset($_POST["editbootiso"])){ - - $bootisoForm = new user_Form_Bootiso(array( - 'action' => 'editbootiso', - 'prebootlist' => $prebootlist, - 'groupdepth' => $childgroups, - 'page' => $this->page)); - $bootisoForm->populate($bootiso->toArray()); - - }else{ - $bootisoForm = new user_Form_Bootiso(array( - 'action' => 'editbootiso', - 'prebootlist' => $prebootlist, - 'groupdepth' => $childgroups, - 'page' => $this->page),$_POST); - - if ($bootisoForm->isValid($_POST)) { - - $bootisoold = $bootiso; - - $bootiso = new Application_Model_BootIso($_POST); - $bootiso->setGroupID($this->membership->getGroupID()); - $bootiso->setCreated(time()); - $bootiso->setID($bootisoID); - $prebootID = $bootiso->getPrebootID(); - - if( $bootiso->getPrebootID() != $bootisoold->getPrebootID() || - $bootiso->getExpires() != $bootisoold->getExpires() || - $bootiso->getPublic() != $bootisoold->getPublic() || - $bootiso->getSerialnumber() != $bootisoold->getSerialnumber()){ - //ACL Is he allowed to edit other than Metadata? - if(!Pbs_Acl::checkRight('be')) - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden'); - } - - try { - - $this->bootisoMapper->save($bootiso); - - }catch(Zend_Exception $e) - { - echo "Caught exception: " . get_class($e) . "<br/>"; - echo "Message: " . $e->getMessage() . "<br/>"; - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/error'); - //TODO Redo Serial in Files... - } - - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/ok'); - } - - } - - $this->view->bootisoForm = $bootisoForm; - } - - public function deletebootisoAction() - { - //ACL Darf er BootISOs löschen? - if(!Pbs_Acl::checkRight('bd')) - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden'); - - try{ - - $bootisoID = $this->_request->getParam('bootisoID'); - if (!is_numeric($bootisoID)) - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden'); - - $bootiso = new Application_Model_BootIso(); - $this->bootisoMapper->find($bootisoID,$bootiso); - - if($this->membership->getGroupID() != $bootiso->getGroupID()) - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden'); - - $this->bootisoMapper->delete($bootiso); - - }catch(Zend_Exception $e){ - echo "Caught exception: " . get_class($e) . "<br/>"; - echo "Message: " . $e->getMessage() . "<br/>"; - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/error'); - } - $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/ok'); - } +* This program is free software distributed under the GPL version 2. +* See http://gpl.openslx.org/ +* +* If you have any feedback please consult http://feedback.openslx.org/ and +* send your suggestions, praise, or complaints to feedback@openslx.org +* +* General information about OpenSLX can be found at http://openslx.org/ +*/ + +class user_BootisoController extends Zend_Controller_Action { + + protected $bootisoMapper; + protected $membershipMapper; + protected $membership; + protected $page; + + public function init() { + if (Zend_Auth::getInstance()->hasIdentity()) { + $userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + if($userIDsNamespace['membershipID'] == '') { + $this->_redirect('/user/index'); + } + + $this->bootisoMapper = new Application_Model_BootIsoMapper(); + + $this->membershipMapper = new Application_Model_MembershipMapper(); + $this->membership = new Application_Model_Membership(); + $this->membershipMapper->find($userIDsNamespace['membershipID'], $this->membership); + + $this->db = Zend_Db_Table::getDefaultAdapter(); + } else { + $this->_helper->redirector('login', 'auth'); + } + $this->page = $this->_request->getParam('page'); + } + + public function indexAction() { + $result = $this->_request->getParam('addresult'); + if($result != "") { + $pbsNotifier = new Pbs_Notifier(); + $this->view->notification = $pbsNotifier->notify('create', $result); + } + $result = $this->_request->getParam('deleteresult'); + if($result != "") { + $pbsNotifier = new Pbs_Notifier(); + $this->view->notification = $pbsNotifier->notify('delete', $result); + } + $result = $this->_request->getParam('modifyresult'); + if($result != "") { + $pbsNotifier = new Pbs_Notifier(); + $this->view->notification = $pbsNotifier->notify('modify', $result); + } + $result = $this->_request->getParam('downloadresult'); + if($result != "") { + $pbsNotifier = new Pbs_Notifier(); + $this->view->notification = $pbsNotifier->notify('download', $result); + } + + + $groupMapper = new Application_Model_GroupMapper(); + + $groupID = $this->membership->getGroupID(); + + //ACL Darf er BootISOMenu sehen? + if(!Pbs_Acl::checkRight('bai') && !Pbs_Acl::checkRight('bui')) + { $this->_redirect('/user/index'); } + + $groupgroupsMapper = new Application_Model_GroupGroupsMapper(); + + $parents = array(); + $this->view->bootisolist = array(); + $parents = $groupgroupsMapper->getParentGroups($groupID); + + foreach($parents as $k => $parent) { + foreach($parent as $p) { + $bootiso = $this->bootisoMapper->findBy(array("groupID" => $p)); + foreach ($bootiso as $b) + if($b->getPublic() - $k >= 0 ) + { $this->view->bootisolist[] = $b; } + elseif($k == 0 && $b->getPublic() == -1 && Pbs_Acl::checkRight('bc')) + $this->view->bootisolist[] = $b; + } + } + + $this->view->bootisolist = array_reverse($this->view->bootisolist); + + $prebootMapper = new Application_Model_PreBootMapper(); + $this->view->prebootlist = array(); + + foreach ($this->view->bootisolist as $bootiso) { + $bootiso->setPrebootID("[".$bootiso->getPrebootID()."] ".$prebootMapper->find($bootiso->getPrebootID())->getTitle()); + $bootiso->setGroupID("[".$bootiso->getGroupID()."] ".$groupMapper->find($bootiso->getGroupID())->getTitle()); + $bootiso->setCreated(date(Zend_Registry::get('dateformat'), $bootiso->getCreated())); + if($bootiso->getExpires() == "") { + $bootiso->setExpires(0); + } + $bootiso->setExpires(date(Zend_Registry::get('dateformat'), $bootiso->getExpires())); + } + + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('bootiso'); + if($search != '') { + $this->view->search = $mySearch->getSearchTerm(); + $this->view->bootisolist = $mySearch->search($this->view->bootisolist); + } + $this->view->searchform = $mySearch->searchForm(); + + // Pagination + $pagination = new Pbs_Pagination(); + $pagination->setPerPage(10); + $pagination->setElement($this->view->bootisolist); + $pagination->setRequestPage($this->_request->getParam('page')); + $pagination->setPageUrl('/user/bootiso/index'.((isset($this->view->search)) ? '/search/'.$this->view->search : '')); + $this->view->bootisolist = $pagination->getElements(); + + $this->view->pagination = $pagination->pagination(); + $this->view->page = $pagination->getRequestPage(); + } + + public function searchAction() { + $this->_redirect('/user/bootiso/index/search/'.($_GET['search'])); + } + + public function downloadbootisoAction() { + $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'); } + + $bootisoID = $this->_request->getParam('bootisoID'); + + if(!is_numeric($bootisoID)) + { $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'); } + + $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: 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("preboot.zip", 'r'); + $chunk_size = 8192; + while ($chunk = fread($handle, $chunk_size)) { + echo $chunk; + ob_flush(); + } + + } + + public function createbootisoAction() { + //ACL Darf er BootISOs erstellen? + if(!Pbs_Acl::checkRight('bc')) + { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/forbidden'); } + + $groupgroupsMapper = new Application_Model_GroupGroupsMapper(); + $groupID = $this->membership->getGroupID(); + + $groupgroupsMapper = new Application_Model_GroupGroupsMapper(); + $childgroups = count($groupgroupsMapper->getChildGroups($groupID)); + + $prebootMapper = new Application_Model_PreBootMapper(); + $prebootlist = $prebootMapper->findBy(array("groupID" => $groupID)); + if (!isset($_POST["createbootiso"])) { + $bootisoForm = new user_Form_Bootiso(array( + 'action' => 'createbootiso', + 'prebootlist' => $prebootlist, + 'groupdepth' => $childgroups, + 'page' => $this->page)); + } else { + + $bootisoForm = new user_Form_Bootiso(array( + 'action' => 'createbootiso', + 'prebootlist' => $prebootlist, + 'groupdepth' => $childgroups, + 'page' => $this->page), $_POST); + + if ($bootisoForm->isValid($_POST)) { + + $bootiso = new Application_Model_BootIso($_POST); + + $bootiso->setGroupID($this->membership->getGroupID()); + $bootiso->setCreated(time()); + + try { + $bootisoID = $this->bootisoMapper->save($bootiso); + } catch(Zend_Exception $e) { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/error'); + //TODO Delete File & delete bootiso from DB + + } + $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/ok'); + } + } + + $this->view->bootisoForm = $bootisoForm; + } + + public function editbootisoAction() { + //ACL Darf er BootISOs editieren? + if(!Pbs_Acl::checkRight('be') && !Pbs_Acl::checkRight('bem')) + { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden'); } + + $bootisoID = $this->_request->getParam('bootisoID'); + if (!is_numeric($bootisoID)) + { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden'); } + + $groupID = $this->membership->getGroupID(); + + $prebootMapper = new Application_Model_PreBootMapper(); + $prebootlist = $prebootMapper->findBy(array("groupID" => $groupID)); + + $groupgroupsMapper = new Application_Model_GroupGroupsMapper(); + $childgroups = count($groupgroupsMapper->getChildGroups($groupID)); + + $bootiso = new Application_Model_BootIso(); + $this->bootisoMapper->find($bootisoID, $bootiso); + + if($this->membership->getGroupID() != $bootiso->getGroupID()) + { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden'); } + + if (!isset($_POST["editbootiso"])) { + + $bootisoForm = new user_Form_Bootiso(array( + 'action' => 'editbootiso', + 'prebootlist' => $prebootlist, + 'groupdepth' => $childgroups, + 'page' => $this->page)); + $bootisoForm->populate($bootiso->toArray()); + + } else { + $bootisoForm = new user_Form_Bootiso(array( + 'action' => 'editbootiso', + 'prebootlist' => $prebootlist, + 'groupdepth' => $childgroups, + 'page' => $this->page), $_POST); + + if ($bootisoForm->isValid($_POST)) { + + $bootisoold = $bootiso; + + $bootiso = new Application_Model_BootIso($_POST); + $bootiso->setGroupID($this->membership->getGroupID()); + $bootiso->setCreated(time()); + $bootiso->setID($bootisoID); + $prebootID = $bootiso->getPrebootID(); + + if( $bootiso->getPrebootID() != $bootisoold->getPrebootID() || + $bootiso->getExpires() != $bootisoold->getExpires() || + $bootiso->getPublic() != $bootisoold->getPublic() || + $bootiso->getSerialnumber() != $bootisoold->getSerialnumber()) { + //ACL Is he allowed to edit other than Metadata? + if(!Pbs_Acl::checkRight('be')) + { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden'); } + } + + try { + + $this->bootisoMapper->save($bootiso); + + } catch(Zend_Exception $e) { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/error'); + //TODO Redo Serial in Files... + } + + $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/ok'); + } + + } + + $this->view->bootisoForm = $bootisoForm; + } + + public function deletebootisoAction() { + //ACL Darf er BootISOs löschen? + if(!Pbs_Acl::checkRight('bd')) + { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden'); } + + try { + + $bootisoID = $this->_request->getParam('bootisoID'); + if (!is_numeric($bootisoID)) + { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden'); } + + $bootiso = new Application_Model_BootIso(); + $this->bootisoMapper->find($bootisoID, $bootiso); + + if($this->membership->getGroupID() != $bootiso->getGroupID()) + { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden'); } + + $this->bootisoMapper->delete($bootiso); + + } catch(Zend_Exception $e) { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/error'); + } + $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/ok'); + } } |
