summaryrefslogtreecommitdiffstats
path: root/application/modules/user/controllers/BootosController.php
diff options
context:
space:
mode:
authormichael pereira2011-04-20 18:49:49 +0200
committermichael pereira2011-04-20 18:49:49 +0200
commitcc3660add480ac1dc217d7f853b325db7d6ec7d0 (patch)
tree8056c87777d806c613a607c3f479ce07475b5db6 /application/modules/user/controllers/BootosController.php
parentAPI + Fixes (diff)
parentUrl für Config gekürzt (diff)
downloadpbs2-cc3660add480ac1dc217d7f853b325db7d6ec7d0.tar.gz
pbs2-cc3660add480ac1dc217d7f853b325db7d6ec7d0.tar.xz
pbs2-cc3660add480ac1dc217d7f853b325db7d6ec7d0.zip
merges
Diffstat (limited to 'application/modules/user/controllers/BootosController.php')
-rw-r--r--application/modules/user/controllers/BootosController.php39
1 files changed, 20 insertions, 19 deletions
diff --git a/application/modules/user/controllers/BootosController.php b/application/modules/user/controllers/BootosController.php
index 6330899..06eb60c 100644
--- a/application/modules/user/controllers/BootosController.php
+++ b/application/modules/user/controllers/BootosController.php
@@ -27,7 +27,6 @@ class user_BootosController extends Zend_Controller_Action
}
$this->bootosMapper = new Application_Model_BootOsMapper();
-
$this->membershipMapper = new Application_Model_MembershipMapper();
$this->membership = new Application_Model_Membership();
$this->membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
@@ -61,7 +60,7 @@ class user_BootosController extends Zend_Controller_Action
$pbsNotifier = new Pbs_Notifier();
$this->view->notification = $pbsNotifier->notify('update',$result);
}
-
+
$groupID = $this->membership->getGroupID();
//ACL Darf er BootOs sehen?
@@ -84,13 +83,13 @@ class user_BootosController extends Zend_Controller_Action
$this->view->bootoslist[] = $b;
}
}
-
+
$this->view->bootoslist = array_reverse($this->view->bootoslist);
$this->view->update = array();
$update = $this->_request->getParam('checkupdate');
$groupMapper = new Application_Model_GroupMapper();
-
+
if(count($this->view->bootoslist)>0){
foreach ($this->view->bootoslist as $bootos){
$this->view->update[$bootos->getID()] = $update && $this->checkupdateAction($bootos);
@@ -112,7 +111,7 @@ class user_BootosController extends Zend_Controller_Action
$this->view->bootoslist = $mySearch->search($this->view->bootoslist);
}
$this->view->searchform = $mySearch->searchForm();
-
+
// Pagination
$pagination = new Pbs_Pagination();
$pagination->setPerPage(10);
@@ -123,8 +122,7 @@ class user_BootosController extends Zend_Controller_Action
$this->view->pagination = $pagination->pagination();
$this->view->page = $pagination->getRequestPage();
-
-
+
}
public function searchAction(){
$this->_redirect('/user/bootos/index/search/'.($_GET['search']));
@@ -132,7 +130,7 @@ class user_BootosController extends Zend_Controller_Action
public function createbootosAction()
{
-
+
//ACL Darf er BootISOs erstellen?
if(!Pbs_Acl::checkRight('boc'))
$this->_redirect('/user/bootos/index/page/'.$this->page.'/addresult/forbidden');
@@ -141,7 +139,7 @@ class user_BootosController extends Zend_Controller_Action
$groupgroupsMapper = new Application_Model_GroupGroupsMapper();
$childgroups = count($groupgroupsMapper->getChildGroups($groupID));
-
+
if (!isset($_POST["createbootos"])){
$bootosForm = new user_Form_Bootos(array(
'action' => 'createbootos',
@@ -193,6 +191,7 @@ class user_BootosController extends Zend_Controller_Action
exec("mv ../resources/bootos/initramfs$hash $initpath"."initramfs");
exec("mv ../resources/bootos/config$hash $configpath"."default.tgz");
+
}catch(Zend_Exception $e)
{
echo "Caught exception: " . get_class($e) . "<br/>";
@@ -215,13 +214,14 @@ class user_BootosController extends Zend_Controller_Action
//ACL Is he allowed to update Preboots?
if(!Pbs_Acl::checkRight('bou'))
$this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden');
-
+
$bootosID = $bootos->getID();
if(is_file("../resources/bootos/$bootosID/kernel/kernel") && is_file("../resources/bootos/$bootosID/initramfs/initramfs") && is_file("../resources/bootos/$bootosID/config/config.tgz")){
$kernelolddate = filemtime("../resources/bootos/".$bootosID."/kernel/kernel");
$initolddate = filemtime("../resources/bootos/".$bootosID."/initramfs/initramfs");
$configolddate = filemtime("../resources/bootos/".$bootosID."/config/default.tgz");
+
}
else
{
@@ -239,7 +239,7 @@ class user_BootosController extends Zend_Controller_Action
$configdate = strtotime(trim(str_replace('Last-Modified:', '', array_pop($configdate))));
//print_a($bootos->getPath_kernel(),$kerneldate,$kernelolddate,$initname,$initdate,$initolddate);
-
+
if($kerneldate > $kernelolddate || $initdate > $initolddate || $configdate > $configolddate){
$this->view->notification = $pbsNotifier->notify('There are updates available','ok');
return true;
@@ -269,7 +269,7 @@ class user_BootosController extends Zend_Controller_Action
$kernelpath = "../resources/bootos/".$bootosID."/kernel/";
$configpath = "../resources/bootos/".$bootosID."/config/";
$path_tmp = "../resources/bootos/";
-
+
$hash = md5(microtime(1));
exec("wget -O '".$path_tmp."kernel".$hash."' ".escapeshellcmd($bootos->getPath_kernel())." 2>&1 | grep 'saved'", $status);
exec("wget -O '".$path_tmp."initramfs".$hash."' ".escapeshellcmd($bootos->getPath_init())." 2>&1 | grep 'saved'", $status2);
@@ -293,7 +293,7 @@ class user_BootosController extends Zend_Controller_Action
//ACL Is he allowed to edit Preboots?
if(!Pbs_Acl::checkRight('boe') && !Pbs_Acl::checkRight('boem'))
$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/'.$this->page.'/modifyresult/forbidden');
@@ -302,13 +302,12 @@ class user_BootosController extends Zend_Controller_Action
$groupgroupsMapper = new Application_Model_GroupGroupsMapper();
$childgroups = count($groupgroupsMapper->getChildGroups($groupID));
-
$bootos = new Application_Model_BootOs();
$bootos = $this->bootosMapper->find($bootosID);
if($this->membership->getGroupID() != $bootos->getGroupID())
$this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
-
+
if (!isset($_POST["editbootos"])){
$bootosForm = new user_Form_Bootos(array(
@@ -345,7 +344,7 @@ class user_BootosController extends Zend_Controller_Action
if(!Pbs_Acl::checkRight('boe'))
$this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
}
-
+
if($bootos->getPath_config() != $bootosold->getPath_config() || $bootos->getPath_kernel() != $bootosold->getPath_kernel() || $bootos->getPath_init() != $bootosold->getPath_init()){
//ACL Is he allowed to edit the Kernel/Init Path?
if(!Pbs_Acl::checkRight('boe'))
@@ -353,6 +352,7 @@ class user_BootosController extends Zend_Controller_Action
$path_tmp = "../resources/bootos/";
+
$hash = md5(microtime(1));
exec("wget -O '".$path_tmp."kernel".$hash."' ".escapeshellcmd($bootos->getPath_kernel())." 2>&1 | grep 'saved'", $status);
exec("wget -O '".$path_tmp."initramfs".$hash."' ".escapeshellcmd($bootos->getPath_init())." 2>&1 | grep 'saved'", $status2);
@@ -377,6 +377,7 @@ class user_BootosController extends Zend_Controller_Action
exec("mv ../resources/bootos/kernel$hash $kernelpath"."kernel");
exec("mv ../resources/bootos/initramfs$hash $initpath"."initramfs");
exec("mv ../resources/bootos/config$hash $initpath"."default.tgz");
+
}
try {
@@ -404,7 +405,7 @@ class user_BootosController extends Zend_Controller_Action
//ACL Is he allowed to delete Bootos?
if(!Pbs_Acl::checkRight('bod'))
$this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/forbidden');
-
+
try{
$bootosID = $this->_request->getParam('bootosID');
if (!is_numeric($bootosID))
@@ -414,8 +415,8 @@ class user_BootosController extends Zend_Controller_Action
$this->bootosMapper->find($bootosID, $bootos);
if($this->membership->getGroupID() != $bootos->getGroupID())
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/forbidden');
-
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/forbidden');
+
$this->bootosMapper->delete($bootos);
exec("rm -r ../resources/bootos/".$bootosID);