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/PrebootController.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/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"); } |
