diff options
Diffstat (limited to 'application/modules/user/controllers/PrebootController.php')
| -rw-r--r-- | application/modules/user/controllers/PrebootController.php | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/application/modules/user/controllers/PrebootController.php b/application/modules/user/controllers/PrebootController.php index a2bbc48..b0b1077 100644 --- a/application/modules/user/controllers/PrebootController.php +++ b/application/modules/user/controllers/PrebootController.php @@ -124,14 +124,8 @@ class User_PrebootController extends Zend_Controller_Action if($_FILES['preboot']['size'] == 0 && $_FILES['preboot']['name'] != ''){ $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/file'); } - - list($preboot) = $this->prebootMapper->findBy(array('groupid' => $groupID, 'title' => $_POST['title'])); - if($preboot != null){ - header('HTTP/1.0 400 Preboot already exists'); - die(); - } - + $preboot = new Application_Model_PreBoot($_POST); $preboot->setGroupID($groupID); @@ -143,7 +137,7 @@ class User_PrebootController extends Zend_Controller_Action $prebootpath = "../resources/bootmedium/".$prebootID."/"; mkdir($prebootpath ,0777, true); - if(isset($_FILES['preboot'])){ + if($_FILES['preboot']['name'] != ''){ move_uploaded_file($_FILES['preboot']['tmp_name'], $prebootpath."preboot.zip"); } @@ -201,14 +195,25 @@ class User_PrebootController extends Zend_Controller_Action $preboot = new Application_Model_PreBoot($_POST); $preboot->setGroupID($this->membership->getGroupID()); $preboot->setID($prebootID); - $preboot->setSource($source); + $preboot->setSource($prebootold->getSource()); $preboot->setCreated(time()); - + + if($_FILES['preboot']['name'] != ''){ + //ACL Is he allowed to edit other than Metadata? + if(!Pbs_Acl::checkRight('pre')) + $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden'); + } + + if($_FILES['preboot']['size'] == 0 && $_FILES['preboot']['name'] != ''){ + $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/file'); + } + $prebootpath = "../resources/bootmedium/$prebootID/"; mkdir($prebootpath ,0777, true); - if(isset($_FILES['preboot'])){ + if($_FILES['preboot']['name'] != ''){ + $preboot->setSource($source); move_uploaded_file($_FILES['preboot']['tmp_name'], $prebootpath."preboot.zip"); } |
