summaryrefslogtreecommitdiffstats
path: root/application/modules/user/controllers/BootosController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/modules/user/controllers/BootosController.php')
-rw-r--r--application/modules/user/controllers/BootosController.php78
1 files changed, 47 insertions, 31 deletions
diff --git a/application/modules/user/controllers/BootosController.php b/application/modules/user/controllers/BootosController.php
index eae0dcf..5757d16 100644
--- a/application/modules/user/controllers/BootosController.php
+++ b/application/modules/user/controllers/BootosController.php
@@ -6,6 +6,7 @@ class user_BootosController extends Zend_Controller_Action
protected $bootosMapper;
protected $membershipMapper;
protected $membership;
+ protected $page;
public function init()
{
@@ -25,6 +26,7 @@ class user_BootosController extends Zend_Controller_Action
} else {
$this->_helper->redirector('login', 'auth');
}
+ $this->page = $this->_request->getParam('page');
}
public function indexAction()
@@ -98,11 +100,10 @@ class user_BootosController extends Zend_Controller_Action
public function createbootosAction()
{
- $page = $this->_request->getParam('page');
//TODO ACL Darf er BootISOs erstellen?
if(false)
- $this->_redirect('/user/bootos/index/page/'.$page.'/addresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/addresult/forbidden');
$groupID = $this->membership->getGroupID();
@@ -114,10 +115,20 @@ class user_BootosController extends Zend_Controller_Action
$configlist = $configMapper->findBy("groupID", $groupID);
if (!isset($_POST["createbootos"])){
- $bootosForm = new user_Form_Bootos(array('action' => 'createbootos', 'groupdepth' => $childgroups, 'configlist'=>$configlist, 'rights' => 'all'));
+ $bootosForm = new user_Form_Bootos(array(
+ 'action' => 'createbootos',
+ 'groupdepth' => $childgroups,
+ 'configlist'=>$configlist,
+ 'rights' => 'all',
+ 'page' => $this->page));
} else {
- $bootosForm = new user_Form_Bootos(array('action' => 'createbootos', 'groupdepth' => $childgroups, 'configlist'=>$configlist, 'rights' => 'all'),$_POST);
+ $bootosForm = new user_Form_Bootos(array(
+ 'action' => 'createbootos',
+ 'groupdepth' => $childgroups,
+ 'configlist'=>$configlist,
+ 'rights' => 'all',
+ 'page' => $this->page),$_POST);
if ($bootosForm->isValid($_POST)) {
@@ -159,12 +170,12 @@ class user_BootosController extends Zend_Controller_Action
{
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootos/index/page/'.$page.'/addresult/error');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/addresult/error');
//TODO Delete File & delete bootiso from DB
}
- $this->_redirect('/user/bootos/index/page/'.$page.'/addresult/ok');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/addresult/ok');
}
}
@@ -173,11 +184,10 @@ class user_BootosController extends Zend_Controller_Action
public function checkupdateAction($bootos)
{
- $page = $this->_request->getParam('page');
//TODO ACL Is he allowed to update Preboots?
if(false)
- $this->_redirect('/user/preboot/index/page/'.$page.'/updateresult/forbidden');
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden');
$bootosID = $bootos->getID();
@@ -211,20 +221,19 @@ class user_BootosController extends Zend_Controller_Action
public function updatebootosAction()
{
- $page = $this->_request->getParam('page');
//TODO ACL Is he allowed to update Preboots?
if(false)
- $this->_redirect('/user/bootiso/index/page/'.$page.'/updateresult/forbidden');
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/updateresult/forbidden');
$bootosID = $this->_request->getParam('bootosID');
if (!is_numeric($bootosID))
- $this->_redirect('/user/bootos/index/page/'.$page.'/updateresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/updateresult/forbidden');
$bootos = $this->bootosMapper->find($bootosID);
if($this->membership->getGroupID() != $bootos->getGroupID())
- $this->_redirect('/user/bootos/index/page/'.$page.'/updateresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/updateresult/forbidden');
$initpath = "../resources/bootos/".$bootosID."/initramfs/";
$kernelpath = "../resources/bootos/".$bootosID."/kernel/";
@@ -235,27 +244,26 @@ class user_BootosController extends Zend_Controller_Action
exec("wget -O '".$path_tmp."initramfs".$hash."' ".escapeshellcmd($bootos->getPath_init())." 2>&1 | grep 'saved'", $status2);
if(!array_pop($status) || !array_pop($status2)){
- $this->_redirect('/user/bootos/index/page/'.$page.'/updateresult/404');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/updateresult/404');
//TODO Delete Files in tmp
}
exec("mv ../resources/bootos/kernel$hash $kernelpath"."kernel");
exec("mv ../resources/bootos/initramfs$hash $initpath"."initramfs");
- $this->_redirect('/user/bootos/index/page/'.$page.'/updateresult/ok');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/updateresult/ok');
}
public function editbootosAction()
{
- $page = $this->_request->getParam('page');
//TODO ACL Is he allowed to edit Preboots?
if(false)
- $this->_redirect('/user/bootos/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
$bootosID = $this->_request->getParam('bootosID');
if (!is_numeric($bootosID))
- $this->_redirect('/user/bootos/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
$groupID = $this->membership->getGroupID();
@@ -271,13 +279,23 @@ class user_BootosController extends Zend_Controller_Action
$bootos = $this->bootosMapper->find($bootosID);
if($this->membership->getGroupID() != $bootos->getGroupID())
- $this->_redirect('/user/bootos/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
- $bootosForm = new user_Form_Bootos(array('action' => 'editbootos', 'groupdepth' => $childgroups, 'configlist'=>$configlist, 'rights' => 'meta'));
+ $bootosForm = new user_Form_Bootos(array(
+ 'action' => 'editbootos',
+ 'groupdepth' => $childgroups,
+ 'configlist'=>$configlist,
+ 'rights' => 'meta',
+ 'page' => $this->page));
$bootosForm->populate($bootos->toArray());
}else{
- $bootosForm = new user_Form_Bootos(array('action' => 'editbootos', 'groupdepth' => $childgroups, 'configlist'=>$configlist, 'rights' => 'meta'),$_POST);
+ $bootosForm = new user_Form_Bootos(array(
+ 'action' => 'editbootos',
+ 'groupdepth' => $childgroups,
+ 'configlist'=>$configlist,
+ 'rights' => 'meta',
+ 'page' => $this->page),$_POST);
if ($bootosForm->isValid($_POST)) {
@@ -298,13 +316,13 @@ class user_BootosController extends Zend_Controller_Action
$bootos->getPublic() != $bootosold->getPublic() ){
//TODO ACL Is he allowed to edit this?
if(false)
- $this->_redirect('/user/bootos/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
}
if($bootos->getPath_kernel() != $bootosold->getPath_kernel() || $bootos->getPath_init() != $bootosold->getPath_init()){
//TODO ACL Is he allowed to edit the Kernel/Init Path?
if(false)
- $this->_redirect('/user/bootos/index/page/'.$page.'/modifyresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
$path_tmp = "../resources/bootos/";
@@ -338,11 +356,11 @@ class user_BootosController extends Zend_Controller_Action
{
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootos/index/page/'.$page.'/modifyresult/error');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/error');
//TODO Delete Folder + Preboot
}
- $this->_redirect('/user/bootos/index/page/'.$page.'/modifyresult/ok');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/ok');
}
}
@@ -353,22 +371,20 @@ class user_BootosController extends Zend_Controller_Action
public function deletebootosAction()
{
- $page = $this->_request->getParam('page');
-
//TODO ACL Is he allowed to delete Bootos?
if(false)
- $this->_redirect('/user/bootos/index/page/'.$page.'/deleteresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/forbidden');
try{
$bootosID = $this->_request->getParam('bootosID');
if (!is_numeric($bootosID))
- $this->_redirect('/user/bootos/index/page/'.$page.'/deleteresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/forbidden');
$bootos = new Application_Model_BootOs();
$this->bootosMapper->find($bootosID, $bootos);
if($this->membership->getGroupID() != $bootos->getGroupID())
- $this->_redirect('/user/bootos/index/page/'.$page.'/deleteresult/forbidden');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/forbidden');
$this->bootosMapper->delete($bootos);
exec("rm -r ../resources/bootos/".$bootosID);
@@ -376,9 +392,9 @@ class user_BootosController extends Zend_Controller_Action
}catch(Zend_Exception $e){
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootos/index/page/'.$page.'/deleteresult/error');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/error');
}
- $this->_redirect('/user/bootos/index/page/'.$page.'/deleteresult/ok');
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/ok');
}