summaryrefslogtreecommitdiffstats
path: root/application/modules
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
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')
-rw-r--r--application/modules/fbgui/controllers/AuthController.php51
-rw-r--r--application/modules/fbgui/controllers/IndexController.php172
-rw-r--r--application/modules/fbgui/controllers/PersonController.php12
-rw-r--r--application/modules/fbgui/forms/Login.php5
-rw-r--r--application/modules/fbgui/layouts/rz.phtml20
-rw-r--r--application/modules/fbgui/views/scripts/auth/login.phtml8
-rw-r--r--application/modules/fbgui/views/scripts/index/index.phtml147
-rw-r--r--application/modules/user/controllers/AuthController.php57
-rw-r--r--application/modules/user/controllers/BootisoController.php514
-rw-r--r--application/modules/user/controllers/BootmenuController.php950
-rw-r--r--application/modules/user/controllers/BootosController.php39
-rw-r--r--application/modules/user/controllers/ClientController.php50
-rw-r--r--application/modules/user/controllers/ConfigController.php380
-rw-r--r--application/modules/user/controllers/FilterController.php86
-rw-r--r--application/modules/user/controllers/GroupController.php47
-rw-r--r--application/modules/user/controllers/IndexController.php20
-rw-r--r--application/modules/user/controllers/PersonController.php82
-rw-r--r--application/modules/user/controllers/PoolController.php65
-rw-r--r--application/modules/user/controllers/PrebootController.php537
-rw-r--r--application/modules/user/controllers/RoleController.php182
-rw-r--r--application/modules/user/controllers/SessionController.php9
-rw-r--r--application/modules/user/forms/Bootiso.php4
-rw-r--r--application/modules/user/forms/Bootmenu.php8
-rw-r--r--application/modules/user/forms/FilterEntry.php2
-rw-r--r--application/modules/user/layouts/user.phtml4
-rw-r--r--application/modules/user/views/scripts/bootiso/index.phtml15
-rw-r--r--application/modules/user/views/scripts/bootmenu/index.phtml38
-rw-r--r--application/modules/user/views/scripts/bootos/index.phtml8
-rw-r--r--application/modules/user/views/scripts/client/index.phtml3
-rw-r--r--application/modules/user/views/scripts/config/index.phtml7
-rw-r--r--application/modules/user/views/scripts/person/edit.phtml2
-rw-r--r--application/modules/user/views/scripts/person/owndetails.phtml2
-rw-r--r--application/modules/user/views/scripts/pool/index.phtml8
-rw-r--r--application/modules/user/views/scripts/role/index.phtml4
-rw-r--r--application/modules/user/views/scripts/role/show.phtml2
35 files changed, 1852 insertions, 1688 deletions
diff --git a/application/modules/fbgui/controllers/AuthController.php b/application/modules/fbgui/controllers/AuthController.php
index c811b06..936aa61 100644
--- a/application/modules/fbgui/controllers/AuthController.php
+++ b/application/modules/fbgui/controllers/AuthController.php
@@ -39,35 +39,29 @@ class Fbgui_AuthController extends Zend_Controller_Action
$auth = Zend_Auth::getInstance();
- $adapter = new Zend_Auth_Adapter_DbTable(
- $this->db,
- 'pbs_person',
- 'email',
- 'password',
- 'MD5(CONCAT(?, password_salt))'
- );
+ $adapter = new Zend_Auth_Adapter_DbTable($this->db, 'pbs_person', 'email', 'password', 'MD5(CONCAT(?, password_salt))');
- $adapter->setIdentity($loginForm->getValue('email'));
- $adapter->setCredential($loginForm->getValue('password'));
-
- $result = $auth->authenticate($adapter);
-
- // TODO: erweiterte fehlerbeschreibung des Users
-
- if ($result->isValid()) {
- $this->personmapper = new Application_Model_PersonMapper();
- $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
- $person = new Application_Model_Person($result[0]);
- $person->setID($result[0]['personID']);
- $date = new DateTime();
- $person->setLogindate($date->getTimestamp());
- $this->personmapper->save($person);
- $this->_helper->redirector('selectmembership', 'person');
- return;
- } else {
- echo "Wrong Email or Password.";
- }
+ $adapter->setIdentity($loginForm->getValue('email'));
+ $adapter->setCredential($loginForm->getValue('password'));
+
+ $result = $auth->authenticate($adapter);
+
+ // TODO: erweiterte fehlerbeschreibung des Users
+
+ if ($result->isValid()) {
+ $this->personmapper = new Application_Model_PersonMapper();
+ $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
+ $person = new Application_Model_Person($result[0]);
+ $person->setID($result[0]['personID']);
+ $date = new DateTime();
+ $person->setLogindate($date->getTimestamp());
+ $this->personmapper->save($person);
+ $this->_helper->redirector('selectmembership', 'person');
+ return;
+ } else {
+ echo "Wrong Email or Password.";
+ }
}
}
$this->view->loginForm = $loginForm;
@@ -81,7 +75,8 @@ class Fbgui_AuthController extends Zend_Controller_Action
$auth->clearIdentity();
Zend_Session::namespaceUnset('userIDs');
Zend_Session::forgetMe();
- $this->_helper->redirector('login', 'auth');
+ $this->_redirect('/fbgui/index');
+# $this->_helper->redirector('fbgui', 'index');
return;
}
}
diff --git a/application/modules/fbgui/controllers/IndexController.php b/application/modules/fbgui/controllers/IndexController.php
index fb8282a..d2b21be 100644
--- a/application/modules/fbgui/controllers/IndexController.php
+++ b/application/modules/fbgui/controllers/IndexController.php
@@ -13,65 +13,75 @@
class Fbgui_IndexController extends Zend_Controller_Action
{
protected $membership;
-
- public function init()
- {
- /* Initialize action controller here */
- $membershipMapper = new Application_Model_MembershipMapper();
+
+ public function init()
+ {
+ /* Initialize action controller here */
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+
+ $membershipMapper = new Application_Model_MembershipMapper();
$this->membership = new Application_Model_Membership();
$membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
- }
+ }
- public function errorAction()
- {
- $result = $this->_request->getParam('serialresult');
+ public function errorAction()
+ {
+ $result = $this->_request->getParam('serialresult');
if($result != ""){
$pbsNotifier = new Pbs_Notifier();
$this->view->notification = $pbsNotifier->notify('serial',$result);
- }
- }
-
- public function indexAction()
- {
+ }
+ }
+
+ public function indexAction()
+ {
$mySession = new Zend_Session_Namespace('pbs');
-
- if(count($mySession->postdata)<=0)
+
+ if(count($mySession->postdata)<=0){
$mySession->postdata = $_POST;
+ }
+ $result = $this->_request->getParam('notify');
+ if($result == 'nomember'){
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('You have no membership, therefore you have no own BootMenu','info');
+ }
+
$d = new Pbs_Debug();
$d->debug(array('FBGuiIndexController',$_SERVER['REMOTE_ADDR'],implode("\t",$mySession->postdata)));
- if(isset($mySession->postdata['bootisoID']) || isset($mySession->postdata['serialnumber'])){
- // Create a session
- $n = new Pbs_Session();
-
- $bootisomapper = new Application_Model_BootIsoMapper();
- $bootiso = new Application_Model_BootIso();
- if(isset($mySession->postdata['bootisoID'])){
- $bootisomapper->find($mySession->postdata['bootisoID'],$bootiso);
- $groupID = $bootiso->getGroupID();
- }
- elseif(isset($mySession->postdata['serialnumber'])){
- $results = $bootisomapper->findBy(array('serialnumber' => $mySession->postdata['serialnumber']),true);
+ if(isset($mySession->postdata['bootisoID']) || isset($mySession->postdata['serialnumber'])){
+ // Create a session
+ $n = new Pbs_Session();
+
+ $bootisomapper = new Application_Model_BootIsoMapper();
+ $bootiso = new Application_Model_BootIso();
+ if(isset($mySession->postdata['bootisoID'])){
+ $bootisomapper->find($mySession->postdata['bootisoID'],$bootiso);
+ $groupID = $bootiso->getGroupID();
+ }
+ elseif(isset($mySession->postdata['serialnumber'])){
+ $results = $bootisomapper->findBy(array('serialnumber' => $mySession->postdata['serialnumber']),true);
if(count($results) == 0){
$this->_redirect('/fbgui/index/error/serialresult/noserial2');
}
- $bootiso->setOptions($results[0]);
- $bootiso->setID($results[0]['bootisoID']);
- $groupID = $bootiso->getGroupID();
-
- }
-
- $client = new Application_Model_Client();
- $client->setMacadress($mySession->postdata['mac']);
- $client->setHardwarehash($mySession->postdata['hardwarehash']);
+ $bootiso->setOptions($results[0]);
+ $bootiso->setID($results[0]['bootisoID']);
+ $groupID = $bootiso->getGroupID();
+
+ }
+
+ $client = new Application_Model_Client();
+ $client->setMacadress($mySession->postdata['mac']);
+ $client->setHardwarehash($mySession->postdata['hardwarehash']);
$client->setGroupID($groupID);
+ $client->setCreated(time());
$client = $n->createClient($client);
$clientID = $client->getID();
-
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
-
- if(!isset($_SESSION['alphasessionID'])){
+
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+
+ if(!isset($_SESSION['alphasessionID'])){
$session = new Application_Model_Session();
$session->setBootisoID($bootiso->getID());
$session->setClientID($clientID);
@@ -79,18 +89,18 @@ class Fbgui_IndexController extends Zend_Controller_Action
if($this->membership->getID() != ''){
$session->setMembershipID($this->membership->getID());
}
- $session->setIp($_SERVER['REMOTE_ADDR']);
+ $session->setIp($_SERVER['REMOTE_ADDR']);
$session = $n->createSession($session);
- $_SESSION['alphasessionID'] = $session->getAlphasessionID();
+ $_SESSION['alphasessionID'] = $session->getAlphasessionID();
}
else{
$session = new Application_Model_Session();
$sessionMapper = new Application_Model_SessionMapper();
$sessions = $sessionMapper->findBy(array('alphasessionID'=>$_SESSION['alphasessionID']));
$session = $sessions[0];
- if($this->membership->getID() != ''){
+ if($this->membership->getID() != '' && $session->getMembershipID() == ''){
$session->setMembershipID($this->membership->getID());
- $session->save();
+ $sessionMapper->save($session);
}
}
// Request Bootmenu
@@ -98,74 +108,70 @@ class Fbgui_IndexController extends Zend_Controller_Action
$bootmenuID = $pbsFilter->evaluate();
if($bootmenuID != null){
$this->view->alphasessionID = $_SESSION['alphasessionID'];
-// print_a('Debug Output',
-// 'Session is now set',
-// 'Your sessionID is '.$session->getID(),
-// 'Your alphasessionID is '.$session->getAlphasessionID(),
-// 'Your client is '.$session->getClientID(),
-// 'goto bootmenu '.$bootmenuID);
-
+ // print_a('Debug Output',
+ // 'Session is now set',
+ // 'Your sessionID is '.$session->getID(),
+ // 'Your alphasessionID is '.$session->getAlphasessionID(),
+ // 'Your client is '.$session->getClientID(),
+ // 'goto bootmenu '.$bootmenuID);
+
$bootmenuMapper = new Application_Model_BootMenuMapper();
$bm = $bootmenuMapper->find($bootmenuID);
$this->view->title = $bm->getTitle();
-
+ $this->view->startcounter = $bm->getStartcounter();
+
$bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
$res = $bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID),false);
$this->view->entries = $res;
- #print_a(Zend_Auth::getInstance()->hasIdentity(),$bm->MembershipID ,$this->membership->getID());
- if (!Zend_Auth::getInstance()->hasIdentity()) {
- # $pbsNotifier = new Pbs_Notifier();
- # $this->view->notification = $pbsNotifier->notify("This is not your Bootmenu. You have to login to get your own Bootmenu.<br />Click here to <a href='/fbgui/auth/login/'>login</a>",'info');
+
+ if (!Zend_Auth::getInstance()->hasIdentity()) {
$this->view->loginmenu = true;
}
- if(Zend_Auth::getInstance()->hasIdentity()){
+
+ if(Zend_Auth::getInstance()->hasIdentity()){
if($bm->MembershipID != '' && $bm->MembershipID == $this->membership->getID()){}
else{
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify("This is not your Bootmenu. There is currently a BootMenu with a higher priority active.",'info');
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify("This is not your Bootmenu. There is currently a BootMenu with a higher priority active.",'info');
}
}
}
else{
-
-// print_a('Debug Output',
-// 'Session is now set',
-// 'Your sessionID is '.$session->getID(),
-// 'Your alphasessionID is '.$session->getAlphasessionID(),
-// 'Your client is '.$session->getClientID(),
-// 'there is no bootmenu for you');
-
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify("There is no BootMenu to show. Please log in to get your BootMenu.<br />Click here to <a href='/fbgui/auth/login/'>login</a>",'error');
-
+ // print_a('Debug Output',
+ // 'Session is now set',
+ // 'Your sessionID is '.$session->getID(),
+ // 'Your alphasessionID is '.$session->getAlphasessionID(),
+ // 'Your client is '.$session->getClientID(),
+ // 'there is no bootmenu for you');
+ $this->view->nobootmenu = true;
}
}
else{
- #$this->_redirect('/fbgui/index/error/serialresult/noserial');
- }
-
- }
+ #$this->_redirect('/fbgui/index/error/serialresult/noserial');
+ }
+
+ }
public function startAction(){
$bootmenuntryID = $this->_request->getParam('bme');
$a = $_SESSION['alphasessionID'];
$bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
$bootmenuentry = new Application_Model_BootMenuEntries();
$bootmenuentriesMapper->find($bootmenuntryID,$bootmenuentry);
-
+
$sessionMapper = new Application_Model_SessionMapper();
- $session_k = $sessionMapper->findBy(array('alphasessionID' => $a),true);
-
- $session = new Application_Model_Session();
+ $session_k = $sessionMapper->findBy(array('alphasessionID' => $a),true);
+
+ $session = new Application_Model_Session();
$session->setOptions($session_k[0]);
$session->setID($session_k[0]['sessionID']);
- #print_a($bootmenuentry);
+
$session->setBootmenuentryID($bootmenuntryID);
$session->setBootosID($bootmenuentry->getBootosID());
$sessionMapper->save($session);
-
-
+
+
$this->view->host = '132.230.4.27';
- $this->view->alphasessionID = $a;
+ $this->view->alphasessionID = $a;
}
}
diff --git a/application/modules/fbgui/controllers/PersonController.php b/application/modules/fbgui/controllers/PersonController.php
index 7bb82aa..b884a28 100644
--- a/application/modules/fbgui/controllers/PersonController.php
+++ b/application/modules/fbgui/controllers/PersonController.php
@@ -42,7 +42,15 @@ class Fbgui_PersonController extends Zend_Controller_Action
if(isset($userIDsNamespace['membershipID'])) {
$this->_redirect('/fbgui/');
} else {
- if(count($this->memberships) > 0) {
+ if(count($this->memberships) == 1) {
+ $myMembership = $this->memberships[0];
+ $roleSession = new Zend_Session_Namespace('userIDs');
+ $roleSession->membershipID = $myMembership['membershipID'];
+ $roleSession->personID = $myMembership['personID'];
+ $roleSession->groupID = $myMembership['groupID'];
+ $roleSession->roleID = $myMembership['roleID'];
+ $this->_redirect('/fbgui/');
+ } elseif(count($this->memberships) > 1) {
if(isset($_POST['selectmembership'])) {
$roleSession = new Zend_Session_Namespace('userIDs');
$roleSession->membershipID = $_POST['membershipID'];
@@ -70,7 +78,7 @@ class Fbgui_PersonController extends Zend_Controller_Action
$this->view->membershipSelectForm = $membershipSelectForm;
}
} else {
- $this->_redirect('/fbgui/');
+ $this->_redirect('/fbgui/index/index/notify/nomember');
}
}
}
diff --git a/application/modules/fbgui/forms/Login.php b/application/modules/fbgui/forms/Login.php
index ee8846f..896b555 100644
--- a/application/modules/fbgui/forms/Login.php
+++ b/application/modules/fbgui/forms/Login.php
@@ -25,7 +25,7 @@ class fbgui_Form_Login extends Zend_Form
),
'required' => true,
'id' => 'email',
- 'class' => '',
+ 'class' => 'keyboardInput',
'label' => 'E-Mail:',
));
@@ -36,12 +36,13 @@ class fbgui_Form_Login extends Zend_Form
),
'required' => true,
'id' => 'pass',
- 'class' => '',
+ 'class' => 'keyboardInput',
'label' => 'Password:',
));
$this->addElement('submit', 'login', array(
'required' => false,
+ 'id' => 'submit',
'ignore' => true,
'label' => 'Login',
));
diff --git a/application/modules/fbgui/layouts/rz.phtml b/application/modules/fbgui/layouts/rz.phtml
index 5945695..cecf38e 100644
--- a/application/modules/fbgui/layouts/rz.phtml
+++ b/application/modules/fbgui/layouts/rz.phtml
@@ -17,26 +17,9 @@ echo $this->headScript()."\n";
<script src='/media/js/jquery-ui.min.js'></script>
<script src='/media/js/script.js'></script>
-<script src='/media/js/jquery.mousewheel.js'></script>
-<script src='/media/js/jquery.keyboard.js'></script>
-<script src='/media/js/jquery.keyboard.extension-typing.js'></script>
+<script src='/media/js/keyboard.js'></script>
<link href="/media/css/keyboard.css" media="screen" rel="stylesheet" type="text/css" />
-<script type="text/javascript">
-function toggleKeyboard(onoff){
- if($('#email').hasClass('qwerty') == false){
- $('#email').addClass('qwerty');
- $('#pass').addClass('qwerty');
- $('.qwerty').keyboard({ layout: 'qwerty' }).addTyping();
- }
- else{
- $('#email').removeClass('qwerty ui-keyboard-input ui-widget-content ui-corner-all').unbind();
- $('#pass').removeClass('qwerty ui-keyboard-input ui-widget-content ui-corner-all').unbind();
- }
-}
-
-</script>
-
</head>
<body>
<div id='sidepannel'>
@@ -72,6 +55,7 @@ function toggleKeyboard(onoff){
</div>
<div id="footer" class="footer flexbox flex">
+ <div style='float:left;padding-left:5px;'><button onclick='fbgui.shutDown();'>Shutdown</button></div>
<div style='padding:5px;'>
<a onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();">display Debug</a> //
<i>last edit: <?php echo date("m\/Y",filectime('index.php'));?></i> //
diff --git a/application/modules/fbgui/views/scripts/auth/login.phtml b/application/modules/fbgui/views/scripts/auth/login.phtml
index 09724d4..330b34f 100644
--- a/application/modules/fbgui/views/scripts/auth/login.phtml
+++ b/application/modules/fbgui/views/scripts/auth/login.phtml
@@ -3,9 +3,15 @@
$this->loginForm->setAction($this->url());
echo $this->loginForm;
?>
-<button class='keyboardbutton' onclick='toggleKeyboard();return false;'>Show/Hide on-screen keyboard</button>
+
<script>
$(document).ready(function(){
$("#email").focus();
+ $('input').keypress(function(e) {
+ if(e.which == 13) {
+ $(this).blur();
+ $('#login').focus().click();
+ }
+ });
});
</script>
diff --git a/application/modules/fbgui/views/scripts/index/index.phtml b/application/modules/fbgui/views/scripts/index/index.phtml
index a141add..8a5f0e6 100644
--- a/application/modules/fbgui/views/scripts/index/index.phtml
+++ b/application/modules/fbgui/views/scripts/index/index.phtml
@@ -1,20 +1,114 @@
<?php if($this->notification != ''){echo $this->notification;} ?>
-<?php if($this->loginmenu):?>
-<div class="fbguilogin selectswitch" style=''>
- <div style='font-size:16px;font-weight:bold;margin-bottom:5px;'>Login</div>
- <i>This is not your Bootmenu. Select this to get your own Bootmenu.</i>
- <input type="hidden" class="id" value="login"/>
-</div>
+
+<?php if($this->nobootmenu === true):?>
+ <div class="fbguilogin selectswitch" style=''>
+ <div style='font-size:16px;font-weight:bold;margin-bottom:5px;'>Login</div>
+ <i>There is no BootMenu to show. Please login to get your BootMenu.</i>
+ <input type="hidden" class="id" value="login"/>
+ </div>
+ <script type="text/javascript">
+ var activeElement = 0;
+ $(document).ready(function(){
+ $('.selectswitch').click(function(){
+ $('.selectswitch').removeClass('selected');
+ $(this).addClass('selected');
+ $("#selectedBootOs").val($(this).find('.id').val());
+ $("#startbutton").focus();
+ });
+ $('.selectswitch').click();
+ $('#startbutton').focus();
+ $('.selectswitch').dblclick(function(){
+ $('.selectswitch').removeClass('selected');
+ $(this).addClass('selected');
+ $("#selectedBootOs").val($(this).find('.id').val());
+ $("#startbutton").focus();
+ start();
+ });
+
+ $(function() {
+ $(document).click(function(){
+ abortStartcount = true;
+ })
+ $(document).keyup(function (event) {
+ if (event.keyCode == 38) {
+ // up
+ if(activeElement >=1)
+ activeElement = activeElement-1;
+ $('.selectswitch').eq(activeElement).click();
+ } else if (event.keyCode == 40) {
+ // Down
+ if(activeElement < $('.selectswitch').length-1 )
+ activeElement = activeElement+1;
+ $('.selectswitch').eq(activeElement).click();
+ } else if (event.keyCode == 13) {
+ // Down
+ $('#startbutton').click();
+ }
+ abortStartcount = true;
+ });
+ });
+ decreaseDown();
+ });
+ function decreaseDown(){
+ var act = parseInt($('.startcounter').html());
+ if(act == 0){
+ start();
+ return;
+ }
+ var next = act-1;
+ $('.startcounter').html(next);
+ if(next == 0){
+ start();
+ }
+ if(next > 0 && abortStartcount == false){
+ setTimeout('decreaseDown()',1000);
+ }
+ if(abortStartcount == true){
+ $('.startcounter').parent().fadeOut();
+ }
+ }
+ function start(){
+ if($('#selectedBootOs').val() != ''){
+ if($('#selectedBootOs').val() == 'login'){
+ window.location='/fbgui/auth/login/'
+ } else{
+ window.location='/fbgui/index/start/bme/'+$('#selectedBootOs').val();
+ }
+ }
+ else{
+ alert('You have to select a BootOs');
+ }
+ }
+ </script>
+ <input style="display:none;" type='text' id="selectedBootOs" />
+ <button onClick="start();" id='startbutton' class="fbguistart" style='font-size:16px;font-weight:bold;margin-bottom:5px;'>
+ Login
+ </button>
+ <div class='clear'></div>
<?php endif; ?>
<?php if(isset($this->entries)):?>
+ <?php if($this->loginmenu):?>
+ <div class="fbguilogin selectswitch" style=''>
+ <div style='font-size:16px;font-weight:bold;margin-bottom:5px;'>Login</div>
+ <i>This is not your Bootmenu. Select this to get your own Bootmenu.</i>
+ <input type="hidden" class="id" value="login"/>
+ </div>
+ <?php else:?>
+ <div class="fbguilogin selectswitch" style=''>
+ <div style='font-size:16px;font-weight:bold;margin-bottom:5px;'>Logout</div>
+ <i>Select this to logout and get to the default BootMenu.</i>
+ <input type="hidden" class="id" value="logout"/>
+ </div>
+ <?php endif;?>
<script type="text/javascript">
var activeElement = 0;
+ var abortStartcount = false;
$(document).ready(function(){
$('.selectswitch').click(function(){
$('.selectswitch').removeClass('selected');
$(this).addClass('selected');
$("#selectedBootOs").val($(this).find('.id').val());
- $("#startbutton").focus();
+ $("#startbutton").focus();
});
$('.bootmenu .selectswitch').eq(activeElement).click();
$('#startbutton').focus();
@@ -27,6 +121,9 @@
});
$(function() {
+ $(document).click(function(){
+ abortStartcount = true;
+ })
$(document).keyup(function (event) {
if (event.keyCode == 38) {
// up
@@ -42,14 +139,37 @@
// Down
$('#startbutton').click();
}
+ abortStartcount = true;
});
});
-
+ <?php if(count($this->entries) > 0): ?>
+ decreaseDown()
+ <?php endif; ?>
});
+ function decreaseDown(){
+ var act = parseInt($('.startcounter').html());
+ if(act == 0){
+ start();
+ return;
+ }
+ var next = act-1;
+ $('.startcounter').html(next);
+ if(next == 0){
+ start();
+ }
+ if(next > 0 && abortStartcount == false){
+ setTimeout('decreaseDown()',1000);
+ }
+ if(abortStartcount == true){
+ $('.startcounter').parent().fadeOut();
+ }
+ }
function start(){
if($('#selectedBootOs').val() != ''){
if($('#selectedBootOs').val() == 'login'){
window.location='/fbgui/auth/login/'
+ }else if($('#selectedBootOs').val() == 'logout'){
+ window.location='/fbgui/auth/logout/'
} else{
window.location='/fbgui/index/start/bme/'+$('#selectedBootOs').val();
}
@@ -60,6 +180,9 @@
}
</script>
<h1><?php echo $this->title;?></h1>
+ <?php if(count($this->entries) > 0): ?>
+ <div style='padding:5px;float:right;'>Starting in <span class='startcounter'><?php echo $this->startcounter; ?></span> seconds</div>
+ <?php endif; ?>
<div class='bootmenu'>
<?php $first = true;
?>
@@ -77,14 +200,10 @@
<input type="hidden" class="id" value="<?php echo $entry->getID();?>"/>
</div>
<?php endforeach; ?>
- </div>
+ </div>
<input style="display:none;" type='text' id="selectedBootOs" />
<button onClick="start();" id='startbutton' class="fbguistart" style='font-size:16px;font-weight:bold;margin-bottom:5px;'>
Start System
</button>
- <div class='clear'></div>
- <?php if($this->notificationbot != ''){echo $this->notificationbot;} ?>
-
-
-
+ <div class='clear'></div>
<?php endif;?>
diff --git a/application/modules/user/controllers/AuthController.php b/application/modules/user/controllers/AuthController.php
index 7fc199a..4a5bcf4 100644
--- a/application/modules/user/controllers/AuthController.php
+++ b/application/modules/user/controllers/AuthController.php
@@ -41,39 +41,32 @@ class User_AuthController extends Zend_Controller_Action
$auth = Zend_Auth::getInstance();
- $adapter = new Zend_Auth_Adapter_DbTable(
- $this->db,
- 'pbs_person',
- 'email',
- 'password',
- 'MD5(CONCAT(?, password_salt))'
- );
-
+ $adapter = new Zend_Auth_Adapter_DbTable( $this->db, 'pbs_person', 'email', 'password', 'MD5(CONCAT(?, password_salt))');
+
+ $adapter->setIdentity($loginForm->getValue('email'));
+ $adapter->setCredential($loginForm->getValue('password'));
- $adapter->setIdentity($loginForm->getValue('email'));
- $adapter->setCredential($loginForm->getValue('password'));
+ $result = $auth->authenticate($adapter);
- $result = $auth->authenticate($adapter);
-
- if ($result->isValid()) {
- $this->personmapper = new Application_Model_PersonMapper();
- $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
- $person = new Application_Model_Person($result[0]);
- $person->setID($result[0]['personID']);
- $date = new DateTime();
- $person->setLogindate($date->getTimestamp());
- if($person->getSuspended()) {
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('Your Account is suspended', 'error');
- } else {
- $this->personmapper->save($person);
- $this->_helper->redirector('selectmembership', 'person');
- return;
- }
- } else {
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('Wrong Email or Password', 'error');
- }
+ if ($result->isValid()) {
+ $this->personmapper = new Application_Model_PersonMapper();
+ $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
+ $person = new Application_Model_Person($result[0]);
+ $person->setID($result[0]['personID']);
+ $date = new DateTime();
+ $person->setLogindate($date->getTimestamp());
+ if($person->getSuspended()) {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Your Account is suspended', 'error');
+ } else {
+ $this->personmapper->save($person);
+ $this->_helper->redirector('selectmembership', 'person');
+ return;
+ }
+ } else {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Wrong Email or Password', 'error');
+ }
}
}
$this->view->loginForm = $loginForm;
@@ -235,7 +228,7 @@ class User_AuthController extends Zend_Controller_Action
$name = $person->getFirstname() . ' ' . $person->getName();
$url = $this->getRequest()->getScheme() . '://' . $this->getRequest()->getHttpHost() . $this->view->url();
$recoveryid = randomString(100);
- $mailbody = 'Um das Passwort zu ändern klicken Sie auf folgenden Link<br /><br /><a href="'. $url . '/auth/recoverpassword/?recoveryid='. $recoveryid . '">Passwort ändern</a>';
+ $mailbody = 'Um das Passwort zu ändern klicken Sie auf folgenden Link<br /><br /><a href="'. $url . '/auth/recoverpassword/?recoveryid='. $recoveryid . '">Passwort ändern</a>';
$mail = new Zend_Mail();
$mail->setBodyHtml($mailbody, 'utf8');
$mail->getBodyHtml()->getContent();
diff --git a/application/modules/user/controllers/BootisoController.php b/application/modules/user/controllers/BootisoController.php
index e0b9e6e..18472a9 100644
--- a/application/modules/user/controllers/BootisoController.php
+++ b/application/modules/user/controllers/BootisoController.php
@@ -15,19 +15,19 @@ class user_BootisoController extends Zend_Controller_Action
protected $bootisoMapper;
protected $membershipMapper;
- protected $membership;
+ protected $membership;
protected $page;
-
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
+
+ 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);
@@ -36,12 +36,12 @@ class user_BootisoController extends Zend_Controller_Action
} else {
$this->_helper->redirector('login', 'auth');
}
- $this->page = $this->_request->getParam('page');
- }
+ $this->page = $this->_request->getParam('page');
+ }
- public function indexAction()
- {
- $result = $this->_request->getParam('addresult');
+ public function indexAction()
+ {
+ $result = $this->_request->getParam('addresult');
if($result != ""){
$pbsNotifier = new Pbs_Notifier();
$this->view->notification = $pbsNotifier->notify('create',$result);
@@ -56,297 +56,297 @@ class user_BootisoController extends Zend_Controller_Action
$pbsNotifier = new Pbs_Notifier();
$this->view->notification = $pbsNotifier->notify('modify',$result);
}
- $result = $this->_request->getParam('downloadresult');
+ $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()));
- $bootiso->setExpires(date(Zend_Registry::get('dateformat'),$bootiso->getExpires()));
- }
-
- // Search
+
+
+ $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()));
+ @$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->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
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
$pagination->setElement($this->view->bootisolist);
- $pagination->setRequestPage($this->_request->getParam('page'));
+ $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->bootisolist = $pagination->getElements();
+
$this->view->pagination = $pagination->pagination();
$this->view->page = $pagination->getRequestPage();
- }
-
- public function searchAction(){
+ }
+
+ public function searchAction(){
$this->_redirect('/user/bootiso/index/search/'.($_GET['search']));
}
-
- public function downloadbootisoAction()
- {
- $this->_helper->layout->disableLayout();
+
+ 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');
-
- $prebootID = $this->bootisoMapper->find($bootisoID)->getPrebootID();
-
-
- if(!is_dir("../resources/bootmedium/$prebootID/"))
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/404');
-
- chdir("../resources/bootmedium/$prebootID/");
-
- header("X-Sendfile: $bootisoID".".zip");
+ $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');
+
+ $prebootID = $this->bootisoMapper->find($bootisoID)->getPrebootID();
+
+
+ if(!is_dir("../resources/bootmedium/$prebootID/"))
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/404');
+
+ chdir("../resources/bootmedium/$prebootID/");
+
+ header("X-Sendfile: $bootisoID".".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');
+ header('Expires: 0');
- $handle = fopen($bootisoID.".zip", 'r');
+ $handle = fopen($bootisoID.".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(
+
+ }
+
+ 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(
+ } 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());
-
- $prebootID = $bootiso->getPrebootID();
-
- try {
-
- $bootisoID = $this->bootisoMapper->save($bootiso);
-
- copy("../resources/bootmedium/$prebootID/preboot.zip", "../resources/bootmedium/$prebootID/$bootisoID".".zip");
- $zip = new ZipArchive();
- $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
- if($res === true){
- $rootdir = $zip->getNameIndex(0);
- $zip->addFromString($rootdir."build/rootfs/tmp/serial", $bootiso->getSerialnumber());
- $zip->close();
- }
-
- }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(
+
+ if ($bootisoForm->isValid($_POST)) {
+
+ $bootiso = new Application_Model_BootIso($_POST);
+
+ $bootiso->setGroupID($this->membership->getGroupID());
+ $bootiso->setCreated(time());
+
+ $prebootID = $bootiso->getPrebootID();
+
+ try {
+
+ $bootisoID = $this->bootisoMapper->save($bootiso);
+
+ copy("../resources/bootmedium/$prebootID/preboot.zip", "../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ $zip = new ZipArchive();
+ $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ if($res === true){
+ $rootdir = $zip->getNameIndex(0);
+ $zip->addFromString($rootdir."build/rootfs/tmp/serial", $bootiso->getSerialnumber());
+ $zip->close();
+ }
+
+ }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(
+ $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 {
- $zip = new ZipArchive();
- $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
- if($res === true){
- $rootdir = $zip->getNameIndex(0);
- $zip->addFromString($rootdir."build/rootfs/serial", $bootiso->getSerialnumber());
- $zip->close();
- }
-
- $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');
- }
-
+
+ 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 {
+ $zip = new ZipArchive();
+ $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ if($res === true){
+ $rootdir = $zip->getNameIndex(0);
+ $zip->addFromString($rootdir."build/rootfs/serial", $bootiso->getSerialnumber());
+ $zip->close();
+ }
+
+ $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');
+ }
+
}
diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php
index 9e9f972..f901568 100644
--- a/application/modules/user/controllers/BootmenuController.php
+++ b/application/modules/user/controllers/BootmenuController.php
@@ -12,43 +12,43 @@
class user_BootmenuController extends Zend_Controller_Action
{
-
+
protected $bootmenuMapper;
protected $bootmenuentryMapper;
protected $membershipMapper;
protected $membership;
protected $page;
protected $type;
-
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
+
+ public function init()
+ {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
$userIDsNamespace = Zend_Session::namespaceGet('userIDs');
if($userIDsNamespace['membershipID'] ==''){
$this->_redirect('/user/index');
}
-
+
$this->bootmenuMapper = new Application_Model_BootMenuMapper();
$this->bootmenuentryMapper = new Application_Model_BootMenuEntriesMapper();
-
-
+
+
$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();
-
+
$this->type = $this->_request->getParam('type');
} else {
$this->_helper->redirector('login', 'auth');
}
- $this->page = $this->_request->getParam('page');
- }
+ $this->page = $this->_request->getParam('page');
+ }
- public function indexAction()
- {
-
- $result = $this->_request->getParam('addresult');
+ public function indexAction()
+ {
+
+ $result = $this->_request->getParam('addresult');
if($result != ""){
$pbsNotifier = new Pbs_Notifier();
$this->view->notification = $pbsNotifier->notify('create',$result);
@@ -62,301 +62,301 @@ class user_BootmenuController extends Zend_Controller_Action
if($result != ""){
$pbsNotifier = new Pbs_Notifier();
$this->view->notification = $pbsNotifier->notify('modify',$result);
- }
- $result = $this->_request->getParam('json');
+ }
+ $result = $this->_request->getParam('json');
if($result != ""){
$pbsNotifier = new Pbs_Notifier();
$this->view->notification = $pbsNotifier->notify('json',$result);
}
-
-
+
+
//ACL Darf er Bootmenus sehen?
- if(!Pbs_Acl::checkRight('booai') && !Pbs_Acl::checkRight('booui'))
- $this->_redirect('/user/index');
-
- $this->bootMenumapper = new Application_Model_BootMenuMapper();
- $this->bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
- $bootosMapper = new Application_Model_BootOsMapper();
- $configMapper = new Application_Model_ConfigMapper();
-
- if($this->type =='group' && Pbs_Acl::checkRight('booai')){
- $this->view->type = 'group';
- $bootmenu = $this->bootmenuMapper->findBy(array('groupID' => $this->membership->getGroupID()));
- foreach ($bootmenu as $bm){
- $bm->setCreated(date(Zend_Registry::get('dateformat'),$bm->getCreated()));
- $bootmenuID = $bm->getID();
- $bootmenuentries[$bootmenuID] = $this->bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID));
- foreach ($bootmenuentries[$bootmenuID] as $bootmenuentry){
- $kcl = $bootosMapper->find($bootmenuentry->getBootosID())->getDefaultkcl();
- if($bootmenuentry->getKcl() && $kcl != null)
- $bootmenuentry->setKcl($kcl);
- else
- $bootmenuentry->setKcl("deactivated (edit Bootmenuentry to activate)");
- if($bootmenuentry->getKclappend() == null)
- $bootmenuentry->setKclappend("none (edit Bootmenuentry to set KCL-Append)");
- $bootmenuentry->setBootosID("[".$bootmenuentry->getBootosID()."] ".$bootosMapper->find($bootmenuentry->getBootosID())->getTitle());
+ if(!Pbs_Acl::checkRight('booai') && !Pbs_Acl::checkRight('booui'))
+ $this->_redirect('/user/index');
+
+ $this->bootMenumapper = new Application_Model_BootMenuMapper();
+ $this->bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
+ $bootosMapper = new Application_Model_BootOsMapper();
+ $configMapper = new Application_Model_ConfigMapper();
+
+ if($this->type =='group' && Pbs_Acl::checkRight('booai')){
+ $this->view->type = 'group';
+ $bootmenu = $this->bootmenuMapper->findBy(array('groupID' => $this->membership->getGroupID()));
+ foreach ($bootmenu as $bm){
+ $bm->setCreated(date(Zend_Registry::get('dateformat'),$bm->getCreated()));
+ $bootmenuID = $bm->getID();
+ $bootmenuentries[$bootmenuID] = $this->bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID));
+ foreach ($bootmenuentries[$bootmenuID] as $bootmenuentry){
+ $kcl = $bootosMapper->find($bootmenuentry->getBootosID())->getDefaultkcl();
+ if($bootmenuentry->getKcl() && $kcl != null)
+ $bootmenuentry->setKcl($kcl);
+ else
+ $bootmenuentry->setKcl("deactivated (edit Bootmenuentry to activate)");
+ if($bootmenuentry->getKclappend() == null)
+ $bootmenuentry->setKclappend("none (edit Bootmenuentry to set KCL-Append)");
+ $bootmenuentry->setBootosID("[".$bootmenuentry->getBootosID()."] ".$bootosMapper->find($bootmenuentry->getBootosID())->getTitle());
$bootmenuentry->setConfigID("[".$bootmenuentry->getConfigID()."] ".$configMapper->find($bootmenuentry->getConfigID())->gettitle());
- }
- }
- }else{
+ }
+ }
+ }else{
$this->view->type = 'own';
- $bootmenu = $this->bootmenuMapper->findBy(array('membershipID' => $this->membership->getID()));
- if($bootmenu != null){
- $bootmenu[0]->setCreated(date(Zend_Registry::get('dateformat'),$bootmenu[0]->getCreated()));
- $bootmenuID = $bootmenu[0]->getID();
- $bootmenuentries[$bootmenuID] = $this->bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID));
- foreach ($bootmenuentries[$bootmenuID] as $bootmenuentry){
- $kcl = $bootosMapper->find($bootmenuentry->getBootosID())->getDefaultkcl();
- if($bootmenuentry->getKcl() && $kcl != null)
- $bootmenuentry->setKcl($kcl);
- else
- $bootmenuentry->setKcl("deactivated (edit Bootmenuentry to activate)");
- if($bootmenuentry->getKclappend() == null)
- $bootmenuentry->setKclappend("none");
- $bootmenuentry->setBootosID("[".$bootmenuentry->getBootosID()."] ".$bootosMapper->find($bootmenuentry->getBootosID())->getTitle());
+ $bootmenu = $this->bootmenuMapper->findBy(array('membershipID' => $this->membership->getID()));
+ if($bootmenu != null){
+ $bootmenu[0]->setCreated(date(Zend_Registry::get('dateformat'),$bootmenu[0]->getCreated()));
+ $bootmenuID = $bootmenu[0]->getID();
+ $bootmenuentries[$bootmenuID] = $this->bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID));
+ foreach ($bootmenuentries[$bootmenuID] as $bootmenuentry){
+ $kcl = $bootosMapper->find($bootmenuentry->getBootosID())->getDefaultkcl();
+ if($bootmenuentry->getKcl() && $kcl != null)
+ $bootmenuentry->setKcl($kcl);
+ else
+ $bootmenuentry->setKcl("deactivated (edit Bootmenuentry to activate)");
+ if($bootmenuentry->getKclappend() == null)
+ $bootmenuentry->setKclappend("none");
+ $bootmenuentry->setBootosID("[".$bootmenuentry->getBootosID()."] ".$bootosMapper->find($bootmenuentry->getBootosID())->getTitle());
$bootmenuentry->setConfigID("[".$bootmenuentry->getConfigID()."] ".$configMapper->find($bootmenuentry->getConfigID())->gettitle());
- }
- }
- }
-
- // Search
+ }
+ }
+ }
+
+ // Search
$search = $this->_request->getParam('search');
$mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search);
+ $mySearch->setSearchTerm($search);
$mySearch->setType($this->type);
$mySearch->setModule('bootmenu');
if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $bootmenu = $mySearch->search($bootmenu);
+ $this->view->search = $mySearch->getSearchTerm();
+ $bootmenu = $mySearch->search($bootmenu);
}
$this->view->searchform = $mySearch->searchForm();
-
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
+
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
$pagination->setElement($bootmenu);
- $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setRequestPage($this->_request->getParam('page'));
$pagination->setPageUrl('/user/bootmenu/index/type/'.$this->type.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $bootmenu = $pagination->getElements();
-
+ $bootmenu = $pagination->getElements();
+
$this->view->pagination = $pagination->pagination();
$this->view->page = $pagination->getRequestPage();
-
- $this->view->bootmenulist = $bootmenu;
- $this->view->bootmenuentrylist = $bootmenuentries;
-
- }
-
- public function searchAction(){
+
+ $this->view->bootmenulist = $bootmenu;
+ @$this->view->bootmenuentrylist = $bootmenuentries;
+
+ }
+
+ public function searchAction(){
$this->_redirect('/user/bootmenu/index/type/'.$this->type.'/search/'.($_GET['search']));
}
-
- public function createbootmenuAction()
- {
- //ACL Darf er BootMenus erstellen?
- if(!Pbs_Acl::checkRight('booc'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
-
- if (!isset($_POST["createbootmenu"])){
- $bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu','page' => $this->page, 'type'=>$this->type));
- } else {
-
- $bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu','page' => $this->page, 'type'=>$this->type),$_POST);
-
- if ($bootmenuForm->isValid($_POST)) {
-
- $bootmenu = new Application_Model_BootMenu($_POST);
- $bootmenu->setCreated(time());
- $bootmenu->setGroupID($this->membership->getGroupID());
- $bootmenu->setDefaultbootmenu('0');
-
- try{
- $this->bootmenuMapper->save($bootmenu);
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
- }
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/ok');
- }
- }
-
- $this->view->bootmenuForm = $bootmenuForm;
- }
-
- public function editbootmenuAction()
- {
-
- //ACL Is he allowed to edit BootMenus?
- if(!Pbs_Acl::checkRight('booe'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
-
- $bootmenuID = $this->_request->getParam('bootmenuID');
- if (!is_numeric($bootmenuID))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
-
- $bootmenu = new Application_Model_BootMenu();
- $this->bootmenuMapper->find($bootmenuID, $bootmenu);
-
- if($this->membership->getGroupID() != $bootmenu->getGroupID())
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
-
- if (!isset($_POST["editbootmenu"])){
-
- $bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu','page' => $this->page, 'type'=>$this->type));
- $bootmenuForm->populate($bootmenu->toArray());
-
- }else{
- $bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu','page' => $this->page, 'type'=>$this->type),$_POST);
-
- if ($bootmenuForm->isValid($_POST)) {
-
- $bootmenuold = $bootmenu;
-
- $bootmenu = new Application_Model_BootMenu($_POST);
- $bootmenu->setGroupID($this->membership->getGroupID());
- $bootmenu->setCreated(time());
- $bootmenu->setID($bootmenuID);
- $bootmenu->setDefaultbootmenu($bootmenuold->getDefaultbootmenu());
-
- try {
- $this->bootmenuMapper->save($bootmenu);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
- }
-
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
- }
-
- }
-
- $this->view->bootmenuForm = $bootmenuForm;
- }
-
- public function deletebootmenuAction()
- {
-
- //ACL Is he allowed to delete Bootmenu?
- if(!Pbs_Acl::checkRight('bood'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
-
- try{
- $bootmenuID = $this->_request->getParam('bootmenuID');
- if (!is_numeric($bootmenuID))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
-
- $bootmenu = new Application_Model_BootMenu();
- $this->bootmenuMapper->find($bootmenuID, $bootmenu);
-
- if($this->membership->getGroupID() != $bootmenu->getGroupID())
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
-
- $this->bootmenuMapper->delete($bootmenu);
-
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
- }
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/ok');
- }
-
- public function defaultbootmenuAction()
- {
-
- //ACL Is he allowed to set Bootmenu as Default?
- if(!Pbs_Acl::checkRight('boodbm'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
-
- try{
- $bootmenuID = $this->_request->getParam('bootmenuID');
- if (!is_numeric($bootmenuID))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
-
- $bootmenu = new Application_Model_BootMenu();
-
- $this->bootmenuMapper->find($bootmenuID, $bootmenu);
+
+ public function createbootmenuAction()
+ {
+ //ACL Darf er BootMenus erstellen?
+ if(!Pbs_Acl::checkRight('booc'))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
- if($bootmenu->getDefaultbootmenu() == false){
-
- @list($defaultbootmenu) = $this->bootmenuMapper->findBy(array('defaultbootmenu' => '1'));
- if($defaultbootmenu != null){
- $defaultbootmenu->setDefaultbootmenu(false);
- $this->bootmenuMapper->save($defaultbootmenu);
- }
- $bootmenu->setDefaultbootmenu(true);
- $this->bootmenuMapper->save($bootmenu);
- }
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
- }
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
-
- }
-
- public function addbootmenuentryAction()
- {
-
- //ACL Darf er BootMenuEntries erstellen?
- if(!Pbs_Acl::checkRight('booae') && !Pbs_Acl::checkRight('booaeo'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
-
- $bootmenuID = $this->_request->getParam('bootmenuID');
- $maxorder = $this->_request->getParam('maxorder');
-
- if (!is_numeric($bootmenuID) || !is_numeric($maxorder))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
-
- $bootosMapper = new Application_Model_BootOsMapper();
- $configMapper = new Application_Model_ConfigMapper();
- $groupMapper = new Application_Model_GroupMapper();
-
- $groupID = $this->membership->getGroupID();
- $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
-
- $parents = array();
- $bootoslist = array();
- $parents = $groupgroupsMapper->getParentGroups($groupID);
-
- foreach($parents as $k => $parent){
- foreach($parent as $p){
- $bootos = $bootosMapper->findBy(array("groupID" => $p));
- foreach ($bootos as $b)
- if($b->getPublic() - $k >= 0 ){
- $grouptitle = $groupMapper->find($p)->getTitle();
- $bootoslist[$b->getID()] = $b;
- $bootosanzeige[$grouptitle][$b->getID()] = $b->getTitle();
- }
- }
- }
-
- $configlist = array('Preset' => array(), 'Custom' => Array());
- $configlist['Preset'] = $configMapper->findBy(array('groupID' => $groupID));
- $configlist['Custom'] = $configMapper->findBy(array('membershipID' => $this->membership->getID()));
-
- $bootmenu = new Application_Model_BootMenu();
- $this->bootmenuMapper->find($bootmenuID, $bootmenu);
-
- if($bootmenu->getMembershipID() != null){
- if($this->membership->getID() != $bootmenu->getMembershipID() || !Pbs_Acl::checkRight('booaeo'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
- }else{
- if($this->membership->getGroupID() != $bootmenu->getGroupID() || !Pbs_Acl::checkRight('booae'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
- }
-
- if (!isset($_POST["addbootmenuentry"])){
-
- if(!isset($_POST['kcl']))
- $_POST['kcl'] = true;
-
- $bootmenuentryForm = new user_Form_BootmenuEntries(array(
+ if (!isset($_POST["createbootmenu"])){
+ $bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu','page' => $this->page, 'type'=>$this->type));
+ } else {
+
+ $bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu','page' => $this->page, 'type'=>$this->type),$_POST);
+
+ if ($bootmenuForm->isValid($_POST)) {
+
+ $bootmenu = new Application_Model_BootMenu($_POST);
+ $bootmenu->setCreated(time());
+ $bootmenu->setGroupID($this->membership->getGroupID());
+ $bootmenu->setDefaultbootmenu('0');
+
+ try{
+ $this->bootmenuMapper->save($bootmenu);
+ }catch(Zend_Exception $e){
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
+ }
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/ok');
+ }
+ }
+
+ $this->view->bootmenuForm = $bootmenuForm;
+ }
+
+ public function editbootmenuAction()
+ {
+
+ //ACL Is he allowed to edit BootMenus?
+ if(!Pbs_Acl::checkRight('booe'))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
+
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+ if (!is_numeric($bootmenuID))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
+
+ $bootmenu = new Application_Model_BootMenu();
+ $this->bootmenuMapper->find($bootmenuID, $bootmenu);
+
+ if($this->membership->getGroupID() != $bootmenu->getGroupID())
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
+
+ if (!isset($_POST["editbootmenu"])){
+
+ $bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu','page' => $this->page, 'type'=>$this->type));
+ $bootmenuForm->populate($bootmenu->toArray());
+
+ }else{
+ $bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu','page' => $this->page, 'type'=>$this->type),$_POST);
+
+ if ($bootmenuForm->isValid($_POST)) {
+
+ $bootmenuold = $bootmenu;
+
+ $bootmenu = new Application_Model_BootMenu($_POST);
+ $bootmenu->setGroupID($this->membership->getGroupID());
+ $bootmenu->setCreated(time());
+ $bootmenu->setID($bootmenuID);
+ $bootmenu->setDefaultbootmenu($bootmenuold->getDefaultbootmenu());
+ print_a($bootmenu);
+ try {
+ $this->bootmenuMapper->save($bootmenu);
+ }catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
+ }
+
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
+ }
+
+ }
+
+ $this->view->bootmenuForm = $bootmenuForm;
+ }
+
+ public function deletebootmenuAction()
+ {
+
+ //ACL Is he allowed to delete Bootmenu?
+ if(!Pbs_Acl::checkRight('bood'))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
+
+ try{
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+ if (!is_numeric($bootmenuID))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
+
+ $bootmenu = new Application_Model_BootMenu();
+ $this->bootmenuMapper->find($bootmenuID, $bootmenu);
+
+ if($this->membership->getGroupID() != $bootmenu->getGroupID())
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
+
+ $this->bootmenuMapper->delete($bootmenu);
+
+ }catch(Zend_Exception $e){
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
+ }
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/ok');
+ }
+
+ public function defaultbootmenuAction()
+ {
+
+ //ACL Is he allowed to set Bootmenu as Default?
+ if(!Pbs_Acl::checkRight('boodbm'))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
+
+ try{
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+ if (!is_numeric($bootmenuID))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
+
+ $bootmenu = new Application_Model_BootMenu();
+
+ $this->bootmenuMapper->find($bootmenuID, $bootmenu);
+
+ if($bootmenu->getDefaultbootmenu() == false){
+
+ @list($defaultbootmenu) = $this->bootmenuMapper->findBy(array('defaultbootmenu' => '1'));
+ if($defaultbootmenu != null){
+ $defaultbootmenu->setDefaultbootmenu(false);
+ $this->bootmenuMapper->save($defaultbootmenu);
+ }
+ $bootmenu->setDefaultbootmenu(true);
+ $this->bootmenuMapper->save($bootmenu);
+ }
+ }catch(Zend_Exception $e){
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
+ }
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
+
+ }
+
+ public function addbootmenuentryAction()
+ {
+
+ //ACL Darf er BootMenuEntries erstellen?
+ if(!Pbs_Acl::checkRight('booae') && !Pbs_Acl::checkRight('booaeo'))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
+
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+ $maxorder = $this->_request->getParam('maxorder');
+
+ if (!is_numeric($bootmenuID) || !is_numeric($maxorder))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
+
+ $bootosMapper = new Application_Model_BootOsMapper();
+ $configMapper = new Application_Model_ConfigMapper();
+ $groupMapper = new Application_Model_GroupMapper();
+
+ $groupID = $this->membership->getGroupID();
+ $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
+
+ $parents = array();
+ $bootoslist = array();
+ $parents = $groupgroupsMapper->getParentGroups($groupID);
+
+ foreach($parents as $k => $parent){
+ foreach($parent as $p){
+ $bootos = $bootosMapper->findBy(array("groupID" => $p));
+ foreach ($bootos as $b)
+ if($b->getPublic() - $k >= 0 ){
+ $grouptitle = $groupMapper->find($p)->getTitle();
+ $bootoslist[$b->getID()] = $b;
+ $bootosanzeige[$grouptitle][$b->getID()] = $b->getTitle();
+ }
+ }
+ }
+
+ $configlist = array('Preset' => array(), 'Custom' => Array());
+ $configlist['Preset'] = $configMapper->findBy(array('groupID' => $groupID));
+ $configlist['Custom'] = $configMapper->findBy(array('membershipID' => $this->membership->getID()));
+
+ $bootmenu = new Application_Model_BootMenu();
+ $this->bootmenuMapper->find($bootmenuID, $bootmenu);
+
+ if($bootmenu->getMembershipID() != null){
+ if($this->membership->getID() != $bootmenu->getMembershipID() || !Pbs_Acl::checkRight('booaeo'))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
+ }else{
+ if($this->membership->getGroupID() != $bootmenu->getGroupID() || !Pbs_Acl::checkRight('booae'))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
+ }
+
+ if (!isset($_POST["addbootmenuentry"])){
+
+ if(!isset($_POST['kcl']))
+ $_POST['kcl'] = true;
+
+ $bootmenuentryForm = new user_Form_BootmenuEntries(array(
'bootoslist'=> $bootoslist,
'bootosanzeige' => $bootosanzeige,
'maxorder'=> $maxorder,
@@ -364,16 +364,16 @@ class user_BootmenuController extends Zend_Controller_Action
'page' => $this->page,
'type' => $this->type,
'action' => 'addbootmenuentry',
- ));
-
- $bootmenuentryForm->populate(array('order' => $maxorder));
- unset($_POST['defaultkcl']);
- unset($_POST['configID']);
- $bootmenuentryForm->populate($_POST);
-
- } else {
-
- $bootmenuentryForm = new user_Form_BootmenuEntries(array(
+ ));
+
+ $bootmenuentryForm->populate(array('order' => $maxorder));
+ unset($_POST['defaultkcl']);
+ unset($_POST['configID']);
+ $bootmenuentryForm->populate($_POST);
+
+ } else {
+
+ $bootmenuentryForm = new user_Form_BootmenuEntries(array(
'bootoslist'=>$bootoslist,
'bootosanzeige' => $bootosanzeige,
'maxorder'=> $maxorder,
@@ -381,96 +381,96 @@ class user_BootmenuController extends Zend_Controller_Action
'page' => $this->page,
'type' => $this->type,
'action' => 'addbootmenuentry',
- ),$_POST);
-
- if ($bootmenuentryForm->isValid($_POST)) {
-
- $bootmenuentry = new Application_Model_BootMenuEntries($_POST);
- $bootmenuentry->setBootmenuID($bootmenuID);
-
- try {
- if($bootmenuentry->getOrder() < $maxorder){
- $bootmenuentry->setOrder($bootmenuentry->getOrder());
- $this->bootmenuentryMapper->order($bootmenuentry);
- }
-
- //print_a($bootmenuentry);
-
- $this->bootmenuentryMapper->save($bootmenuentry);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
-
- }
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/ok');
- }
- }
-
- $this->view->bootmenuentryForm = $bootmenuentryForm;
-
- }
-
- public function editbootmenuentryAction()
- {
- //ACL Is he allowed to edit BootMenus?
- if(!Pbs_Acl::checkRight('booee') && !Pbs_Acl::checkRight('booeem') && !Pbs_Acl::checkRight('booeeo'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
-
- $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
- $maxorder = $this->_request->getParam('maxorder');
- $oldorder = $this->_request->getParam('oldorder');
- if (!is_numeric($bootmenuentryID) || !is_numeric($maxorder) || !is_numeric($oldorder))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
-
- $bootosMapper = new Application_Model_BootOsMapper();
- $configMapper = new Application_Model_ConfigMapper();
-
- $groupID = $this->membership->getGroupID();
- $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
- $groupMapper = new Application_Model_GroupMapper();
-
- $parents = array();
- $bootoslist = array();
- $parents = $groupgroupsMapper->getParentGroups($groupID);
-
- foreach($parents as $k => $parent){
- foreach($parent as $p){
- $bootos = $bootosMapper->findBy(array("groupID" => $p));
- foreach ($bootos as $b)
- if($b->getPublic() - $k >= 0 ){
- $grouptitle = $groupMapper->find($p)->getTitle();
- $bootoslist[$b->getID()] = $b;
- $bootosanzeige[$grouptitle][$b->getID()] = $b->getTitle();
- }
- }
- }
-
- $configlist = array('Preset' => array(), 'Custom' => Array());
- $configlist['Preset'] = $configMapper->findBy(array('groupID' => $groupID));
- $configlist['Custom'] = $configMapper->findBy(array('membershipID' => $this->membership->getID()));
-
- $bootmenuentry = new Application_Model_BootMenuEntries();
- $bootmenu = new Application_Model_BootMenu();
- $this->bootmenuentryMapper->find($bootmenuentryID, $bootmenuentry);
- $this->bootmenuMapper->find($bootmenuentry->getBootmenuID(), $bootmenu);
-
- if($bootmenu->getMembershipID() != null){
- if($this->membership->getID() != $bootmenu->getMembershipID() || !Pbs_Acl::checkRight('booeeo'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
- }else{
- if($this->membership->getGroupID() != $bootmenu->getGroupID() || (!Pbs_Acl::checkRight('booee') && !Pbs_Acl::checkRight('booeem')))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
- }
-
- if (!isset($_POST["editbootmenuentry"])){
- if(!isset($_POST['bootosID']))
- $_POST['bootosID'] = $bootmenuentry->getBootosID();
- if(!isset($_POST['kcl']))
- $_POST['kcl'] = $bootmenuentry->getKcl();
-
- $bootmenuentryForm = new user_Form_BootmenuEntries(array(
+ ),$_POST);
+
+ if ($bootmenuentryForm->isValid($_POST)) {
+
+ $bootmenuentry = new Application_Model_BootMenuEntries($_POST);
+ $bootmenuentry->setBootmenuID($bootmenuID);
+
+ try {
+ if($bootmenuentry->getOrder() < $maxorder){
+ $bootmenuentry->setOrder($bootmenuentry->getOrder());
+ $this->bootmenuentryMapper->order($bootmenuentry);
+ }
+
+ //print_a($bootmenuentry);
+
+ $this->bootmenuentryMapper->save($bootmenuentry);
+ }catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
+
+ }
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/ok');
+ }
+ }
+
+ $this->view->bootmenuentryForm = $bootmenuentryForm;
+
+ }
+
+ public function editbootmenuentryAction()
+ {
+ //ACL Is he allowed to edit BootMenus?
+ if(!Pbs_Acl::checkRight('booee') && !Pbs_Acl::checkRight('booeem') && !Pbs_Acl::checkRight('booeeo'))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
+
+ $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
+ $maxorder = $this->_request->getParam('maxorder');
+ $oldorder = $this->_request->getParam('oldorder');
+ if (!is_numeric($bootmenuentryID) || !is_numeric($maxorder) || !is_numeric($oldorder))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
+
+ $bootosMapper = new Application_Model_BootOsMapper();
+ $configMapper = new Application_Model_ConfigMapper();
+
+ $groupID = $this->membership->getGroupID();
+ $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
+ $groupMapper = new Application_Model_GroupMapper();
+
+ $parents = array();
+ $bootoslist = array();
+ $parents = $groupgroupsMapper->getParentGroups($groupID);
+
+ foreach($parents as $k => $parent){
+ foreach($parent as $p){
+ $bootos = $bootosMapper->findBy(array("groupID" => $p));
+ foreach ($bootos as $b)
+ if($b->getPublic() - $k >= 0 ){
+ $grouptitle = $groupMapper->find($p)->getTitle();
+ $bootoslist[$b->getID()] = $b;
+ $bootosanzeige[$grouptitle][$b->getID()] = $b->getTitle();
+ }
+ }
+ }
+
+ $configlist = array('Preset' => array(), 'Custom' => Array());
+ $configlist['Preset'] = $configMapper->findBy(array('groupID' => $groupID));
+ $configlist['Custom'] = $configMapper->findBy(array('membershipID' => $this->membership->getID()));
+
+ $bootmenuentry = new Application_Model_BootMenuEntries();
+ $bootmenu = new Application_Model_BootMenu();
+ $this->bootmenuentryMapper->find($bootmenuentryID, $bootmenuentry);
+ $this->bootmenuMapper->find($bootmenuentry->getBootmenuID(), $bootmenu);
+
+ if($bootmenu->getMembershipID() != null){
+ if($this->membership->getID() != $bootmenu->getMembershipID() || !Pbs_Acl::checkRight('booeeo'))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
+ }else{
+ if($this->membership->getGroupID() != $bootmenu->getGroupID() || (!Pbs_Acl::checkRight('booee') && !Pbs_Acl::checkRight('booeem')))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
+ }
+
+ if (!isset($_POST["editbootmenuentry"])){
+ if(!isset($_POST['bootosID']))
+ $_POST['bootosID'] = $bootmenuentry->getBootosID();
+ if(!isset($_POST['kcl']))
+ $_POST['kcl'] = $bootmenuentry->getKcl();
+
+ $bootmenuentryForm = new user_Form_BootmenuEntries(array(
'bootoslist'=> $bootoslist,
'bootosanzeige' => $bootosanzeige,
'maxorder'=> $maxorder-1,
@@ -478,19 +478,19 @@ class user_BootmenuController extends Zend_Controller_Action
'page' => $this->page,
'type' => $this->type,
'action' => 'editbootmenuentry',
- ));
+ ));
- if(!isset($_POST['configID'])){
- $bootmenuentryForm->populate($bootmenuentry->toArray());
+ if(!isset($_POST['configID'])){
+ $bootmenuentryForm->populate($bootmenuentry->toArray());
+ }
+ else{
+ unset($_POST['defaultkcl']);
+ unset($_POST['configID']);
+ $bootmenuentryForm->populate($_POST);
}
- else{
- unset($_POST['defaultkcl']);
- unset($_POST['configID']);
- $bootmenuentryForm->populate($_POST);
- }
-
- }else{
- $bootmenuentryForm = new user_Form_BootmenuEntries(array(
+
+ }else{
+ $bootmenuentryForm = new user_Form_BootmenuEntries(array(
'bootoslist'=> $bootoslist,
'bootosanzeige' => $bootosanzeige,
'maxorder'=> $maxorder-1,
@@ -498,83 +498,83 @@ class user_BootmenuController extends Zend_Controller_Action
'page' => $this->page,
'type' => $this->type,
'action' => 'editbootmenuentry'),$_POST);
-
- if ($bootmenuentryForm->isValid($_POST)) {
-
- $bootmenuentryold= $bootmenuentry;
-
- $bootmenuentry = new Application_Model_BootMenuEntries($_POST);
- $bootmenuentry->setBootmenuID($bootmenu->getID());
- $bootmenuentry->setID($bootmenuentryID);
-
- if( $bootmenuentryold->getBootosID() != $bootmenuentry->getBootosID() ||
- $bootmenuentryold->getConfigID() != $bootmenuentry->getConfigID() ||
- $bootmenuentryold->getKcl() != $bootmenuentry->getKcl() ||
- $bootmenuentryold->getKclappend() != $bootmenuentry->getKclappend()){
- //ACL Is he allowed to edit this?
- if(!Pbs_Acl::checkRight('booee') && !Pbs_Acl::checkRight('booeeo'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
- }
-
- try {
- if($bootmenuentry->getOrder() < $oldorder)
- $this->bootmenuentryMapper->orderbefore($bootmenuentry, $oldorder);
- else
- $this->bootmenuentryMapper->orderafter($bootmenuentry, $oldorder);
-
- $this->bootmenuentryMapper->save($bootmenuentry);
-
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
-
- }
-
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
- }
-
- }
-
- $this->view->bootmenuentryForm = $bootmenuentryForm;
-
- }
-
- public function removebootmenuentryAction()
- {
- //ACL Is he allowed to delete Bootos?
- if(!Pbs_Acl::checkRight('boode') && !Pbs_Acl::checkRight('boodeo'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
-
- try{
- $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
- if (!is_numeric($bootmenuentryID))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
-
- $bootmenuentry = new Application_Model_BootMenuEntries();
- $bootmenu = new Application_Model_BootMenu();
- $this->bootmenuentryMapper->find($bootmenuentryID, $bootmenuentry);
- $this->bootmenuMapper->find($bootmenuentry->getBootmenuID(), $bootmenu);
-
- if($bootmenu->getMembershipID() != null){
- if($this->membership->getID() != $bootmenu->getMembershipID() || !Pbs_Acl::checkRight('boodeo'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
- }else{
- if($this->membership->getGroupID() != $bootmenu->getGroupID() || !Pbs_Acl::checkRight('boode'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
- }
-
- $this->bootmenuentryMapper->delete($bootmenuentry);
- $this->bootmenuentryMapper->orderremove($bootmenuentry);
-
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
- }
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/ok');
- }
+
+ if ($bootmenuentryForm->isValid($_POST)) {
+
+ $bootmenuentryold= $bootmenuentry;
+
+ $bootmenuentry = new Application_Model_BootMenuEntries($_POST);
+ $bootmenuentry->setBootmenuID($bootmenu->getID());
+ $bootmenuentry->setID($bootmenuentryID);
+
+ if( $bootmenuentryold->getBootosID() != $bootmenuentry->getBootosID() ||
+ $bootmenuentryold->getConfigID() != $bootmenuentry->getConfigID() ||
+ $bootmenuentryold->getKcl() != $bootmenuentry->getKcl() ||
+ $bootmenuentryold->getKclappend() != $bootmenuentry->getKclappend()){
+ //ACL Is he allowed to edit this?
+ if(!Pbs_Acl::checkRight('booee') && !Pbs_Acl::checkRight('booeeo'))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
+ }
+
+ try {
+ if($bootmenuentry->getOrder() < $oldorder)
+ $this->bootmenuentryMapper->orderbefore($bootmenuentry, $oldorder);
+ else
+ $this->bootmenuentryMapper->orderafter($bootmenuentry, $oldorder);
+
+ $this->bootmenuentryMapper->save($bootmenuentry);
+
+ }catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
+
+ }
+
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
+ }
+
+ }
+
+ $this->view->bootmenuentryForm = $bootmenuentryForm;
+
+ }
+
+ public function removebootmenuentryAction()
+ {
+ //ACL Is he allowed to delete Bootos?
+ if(!Pbs_Acl::checkRight('boode') && !Pbs_Acl::checkRight('boodeo'))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
+
+ try{
+ $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
+ if (!is_numeric($bootmenuentryID))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
+
+ $bootmenuentry = new Application_Model_BootMenuEntries();
+ $bootmenu = new Application_Model_BootMenu();
+ $this->bootmenuentryMapper->find($bootmenuentryID, $bootmenuentry);
+ $this->bootmenuMapper->find($bootmenuentry->getBootmenuID(), $bootmenu);
+
+ if($bootmenu->getMembershipID() != null){
+ if($this->membership->getID() != $bootmenu->getMembershipID() || !Pbs_Acl::checkRight('boodeo'))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
+ }else{
+ if($this->membership->getGroupID() != $bootmenu->getGroupID() || !Pbs_Acl::checkRight('boode'))
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
+ }
+
+ $this->bootmenuentryMapper->delete($bootmenuentry);
+ $this->bootmenuentryMapper->orderremove($bootmenuentry);
+
+ }catch(Zend_Exception $e){
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
+ }
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/ok');
+ }
}
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);
diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php
index cbb114a..589fcdc 100644
--- a/application/modules/user/controllers/ClientController.php
+++ b/application/modules/user/controllers/ClientController.php
@@ -14,7 +14,7 @@ class User_ClientController extends Zend_Controller_Action
{
private $membership;
protected $page;
-
+
public function init()
{
if (Zend_Auth::getInstance()->hasIdentity()) {
@@ -30,14 +30,14 @@ class User_ClientController extends Zend_Controller_Action
} else {
$this->_helper->redirector('login', 'auth');
}
- $this->page = $this->_request->getParam('page');
+ $this->page = $this->_request->getParam('page');
}
public function indexAction()
{
// ACL: is he authorized to see this ?
if(!Pbs_Acl::checkRight('clo'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
// Get the Clients which booted with a bootiso of this group
$result = $this->_request->getParam('deleteresult');
@@ -58,27 +58,32 @@ class User_ClientController extends Zend_Controller_Action
$clientMapper = new Application_Model_ClientMapper();
$clientsInGroup = $clientMapper->findBy(array('groupID' => $this->membership->getGroupID()),true);
-
+
// Search
$search = $this->_request->getParam('search');
$mySearch = new Pbs_Search();
$mySearch->setSearchTerm($search);
$mySearch->setModule('client');
if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $clientsInGroup = $mySearch->search($clientsInGroup);
+ $this->view->search = $mySearch->getSearchTerm();
+ $clientsInGroup = $mySearch->search($clientsInGroup);
}
$this->view->searchform = $mySearch->searchForm();
+ // Format Time-String
+ foreach($clientsInGroup as $k=>$cig){
+ $clientsInGroup[$k]['created'] = date(Zend_Registry::get('dateformat'),$cig['created']);
+ }
+
// Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
$pagination->setElement($clientsInGroup);
- $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setRequestPage($this->_request->getParam('page'));
$pagination->setPageUrl('/user/client/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $clientsInGroup = $pagination->getElements();
-
- $this->view->pagination = $pagination->pagination($pageurl);
+ $clientsInGroup = $pagination->getElements();
+
+ $this->view->pagination = $pagination->pagination();
$this->view->page = $pagination->getRequestPage();
$this->view->clients = $clientsInGroup;
@@ -94,7 +99,7 @@ class User_ClientController extends Zend_Controller_Action
// ACL: is he authorized to create new clients?
if(!Pbs_Acl::checkRight('cla'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
if (!isset($_POST["add"])){
$addclient = new user_Form_Client(array(
@@ -102,7 +107,7 @@ class User_ClientController extends Zend_Controller_Action
'page' => $this->page));
$this->view->addclient = $addclient;
}
- else{
+ else{
$addclient = new user_Form_Client(array(
'buttontext' => 'Create Client',
'page' => $this->page),$_POST);
@@ -111,7 +116,8 @@ class User_ClientController extends Zend_Controller_Action
$mac = ($mac!='')?$mac:$_POST['macadress'];
$hh = ($hh!='')?$hh:$_POST['hardwarehash'];
$client->setMacadress($mac);
- $client->setHardwarehash($hh);
+ $client->setHardwarehash($hh);
+ $client->setCreated(time());
$client->setGroupID($this->membership->getGroupID());
$clientmapper = new Application_Model_ClientMapper();
$clientmapper->save($client);
@@ -124,11 +130,11 @@ class User_ClientController extends Zend_Controller_Action
public function removeclientAction()
{
$clientID = $this->_request->getParam('clientID');
-
+
// ACL: is he authorized to delete clients?
if(!Pbs_Acl::checkRight('cld'))
- $this->_redirect('/user');
-
+ $this->_redirect('/user');
+
$clientMapper = new Application_Model_ClientMapper();
if(is_numeric($clientID)){
$client = new Application_Model_Client();
@@ -148,14 +154,14 @@ class User_ClientController extends Zend_Controller_Action
public function editclientAction(){
// ACL: Is he authorized to edit clients ?
if(!Pbs_Acl::checkRight('cle'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
if (!isset($_POST["add"])){
$clientID = $this->_request->getParam('clientID');
$client = new Application_Model_Client();
$mapper = new Application_Model_ClientMapper();
$mapper->find($clientID,$client);
-
+
if($client->getGroupID() == $this->membership->getGroupID()){
$editclient = new user_Form_Client(array(
'buttontext' => 'Edit Client',
@@ -173,11 +179,13 @@ class User_ClientController extends Zend_Controller_Action
'page' => $this->page),$_POST);
if ($editclient->isValid($_POST) || ($mac != '' && $hh != '') ) {
$client = new Application_Model_Client($_POST);
- $client->setID($this->_request->getParam('clientID'));
+ $client->setID($this->_request->getParam('clientID'));
$dbclient = new Application_Model_Client();
$clientMapper = new Application_Model_ClientMapper();
$clientMapper->find($this->_request->getParam('clientID'),$dbclient);
+
+ $client->setCreated($dbclient->getCreated());
if($dbclient->getGroupID() == $this->membership->getGroupID()){
$client->setGroupID($this->membership->getGroupID());
diff --git a/application/modules/user/controllers/ConfigController.php b/application/modules/user/controllers/ConfigController.php
index 7f752a8..aba51f7 100644
--- a/application/modules/user/controllers/ConfigController.php
+++ b/application/modules/user/controllers/ConfigController.php
@@ -19,33 +19,33 @@ class user_ConfigController extends Zend_Controller_Action
protected $page;
protected $config;
protected $type;
-
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
+
+ public function init()
+ {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
$userIDsNamespace = Zend_Session::namespaceGet('userIDs');
if($userIDsNamespace['membershipID'] ==''){
$this->_redirect('/user/index');
}
-
+
$this->configMapper = new Application_Model_ConfigMapper();
-
+
$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();
-
+
$this->type = $this->_request->getParam('type');
} else {
$this->_helper->redirector('login', 'auth');
}
- $this->page = $this->_request->getParam('page');
- }
+ $this->page = $this->_request->getParam('page');
+ }
- public function indexAction()
- {
- $result = $this->_request->getParam('addresult');
+ public function indexAction()
+ {
+ $result = $this->_request->getParam('addresult');
if($result != ""){
$pbsNotifier = new Pbs_Notifier();
$this->view->notification = $pbsNotifier->notify('create',$result);
@@ -60,200 +60,200 @@ class user_ConfigController extends Zend_Controller_Action
$pbsNotifier = new Pbs_Notifier();
$this->view->notification = $pbsNotifier->notify('modify',$result);
}
-
- $groupID = $this->membership->getGroupID();
-
+
+ $groupID = $this->membership->getGroupID();
+
//ACL Darf er Configs sehen?
- if(!Pbs_Acl::checkRight('csai') && !Pbs_Acl::checkRight('csui'))
- $this->_redirect('/user/index');
-
- $this->configMapper = new Application_Model_ConfigMapper();
-
- if($this->type =='own' && Pbs_Acl::checkRight('csui')){
- $this->view->type = 'own';
- $this->view->configlist = $this->configMapper->findBy(array('membershipID' => $this->membership->getID()));
- }else{
- $this->view->type = 'group';
- $this->view->configlist = $this->configMapper->findBy(array('groupID' => $this->membership->getGroupID()));
- }
-
- foreach ($this->view->configlist as $config){
- $config->setCreated(date(Zend_Registry::get('dateformat'),$config->getCreated()));
- }
-
- // Search
+ if(!Pbs_Acl::checkRight('csai') && !Pbs_Acl::checkRight('csui'))
+ $this->_redirect('/user/index');
+
+ $this->configMapper = new Application_Model_ConfigMapper();
+
+ if($this->type =='own' && Pbs_Acl::checkRight('csui')){
+ $this->view->type = 'own';
+ $this->view->configlist = $this->configMapper->findBy(array('membershipID' => $this->membership->getID()));
+ }else{
+ $this->view->type = 'group';
+ $this->view->configlist = $this->configMapper->findBy(array('groupID' => $this->membership->getGroupID()));
+ }
+
+ foreach ($this->view->configlist as $config){
+ $config->setCreated(date(Zend_Registry::get('dateformat'),$config->getCreated()));
+ }
+
+ // Search
$search = $this->_request->getParam('search');
$mySearch = new Pbs_Search();
$mySearch->setSearchTerm($search);
$mySearch->setType($this->type);
$mySearch->setModule('config');
if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $this->view->configlist = $mySearch->search($this->view->configlist);
+ $this->view->search = $mySearch->getSearchTerm();
+ $this->view->configlist = $mySearch->search($this->view->configlist);
}
$this->view->searchform = $mySearch->searchForm();
-
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
+
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
$pagination->setElement($this->view->configlist);
- $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setRequestPage($this->_request->getParam('page'));
$pagination->setPageUrl('/user/config/index/type/'.$this->type.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $this->view->configlist = $pagination->getElements();
-
+ $this->view->configlist = $pagination->getElements();
+
$this->view->pagination = $pagination->pagination();
$this->view->page = $pagination->getRequestPage();
-
- }
-
- public function searchAction(){
+
+ }
+
+ public function searchAction(){
$this->_redirect('/user/config/index/type/'.$this->type.'/search/'.($_GET['search']));
}
- public function createconfigAction()
- {
- //ACL Darf er Configs erstellen?
- if(!Pbs_Acl::checkRight('cc') && !Pbs_Acl::checkRight('cco'))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
-
- if (!isset($_POST["createconfig"])){
- $configForm = new user_Form_Config(array('action' => 'createconfig','page'=>$this->page, 'type'=>$this->type));
- } else {
- $configForm = new user_Form_Config(array('action' => 'createconfig','page'=>$this->page, 'type'=>$this->type),$_POST);
-
- if ($configForm->isValid($_POST)) {
-
- $config = new Application_Model_Config($_POST);
- $config->setCreated(time());
-
- if(Pbs_Acl::checkRight('cc') && $this->_request->getParam('type') == 'group')
- $config->setGroupID($this->membership->getGroupID());
- elseif(Pbs_Acl::checkRight('cco') && $this->_request->getParam('type') == 'own')
- $config->setMembershipID($this->membership->getID());
- else
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
-
- try {
- $this->configMapper->save($config);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
- }
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/ok');
- }
- }
-
- $this->view->configForm = $configForm;
- }
-
- public function addUserAction(){
-
- }
-
- public function editconfigAction()
- {
- //ACL Darf er Configs editieren?
- if(!Pbs_Acl::checkRight('ce') && !Pbs_Acl::checkRight('cem') && !Pbs_Acl::checkRight('ceo'))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
-
- $configID = $this->_request->getParam('configID');
- if (!is_numeric($configID))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
-
- $groupID = $this->membership->getGroupID();
-
- $config = new Application_Model_Config();
- $this->configMapper->find($configID, $config);
-
- if($config->getMembershipID() != null){
- if($this->membership->getID() != $config->getMembershipID() || !Pbs_Acl::checkRight('ceo'))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
- }else{
- if($this->membership->getGroupID() != $config->getGroupID() || (!Pbs_Acl::checkRight('ce') && !Pbs_Acl::checkRight('cem')))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
- }
-
- if (!isset($_POST["editconfig"])){
-
- $configForm = new user_Form_Config(array('action' => 'editconfig','page'=>$this->page, 'type'=>$this->type));
- $configForm->populate($config->toArray());
-
- }else{
- $configForm = new user_Form_Config(array('action' => 'editconfig','page'=>$this->page, 'type'=>$this->type),$_POST);
-
- if ($configForm->isValid($_POST)) {
-
- $configold = $config;
-
- $config = new Application_Model_Config($_POST);
- $config->setCreated(time());
-
- if(Pbs_Acl::checkRight('ce') && $configold->getGroupID() != null)
- $config->setGroupID($this->membership->getGroupID());
- elseif(Pbs_Acl::checkRight('ceo') && $configold->getMembershipID() != null)
- $config->setMembershipID($this->membership->getID());
- else
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
-
- $config->setID($configID);
-
- if($configold->getShellscript() != $config->getShellscript()){
- //ACL Is he allowed to edit other than Metadata?
- if(!Pbs_Acl::checkRight('ce'))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
- }
-
-
- try {
- $this->configMapper->save($config);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
- }
-
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
- }
-
- }
-
- $this->view->configForm = $configForm;
- }
-
- public function deleteconfigAction()
- {
- //ACL Darf er Configs löschen?
- if(!Pbs_Acl::checkRight('cd') && !Pbs_Acl::checkRight('cdo'))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
-
- try{
- $configID = $this->_request->getParam('configID');
- if (!is_numeric($configID))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
-
- $config = new Application_Model_Config();
- $this->configMapper->find($configID,$config);
-
- if($config->getMembershipID() != null){
- if($this->membership->getID() != $config->getMembershipID() || !Pbs_Acl::checkRight('cdo'))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
- }else{
- if($this->membership->getGroupID() != $config->getGroupID() || !Pbs_Acl::checkRight('cd'))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
- }
-
- $this->configMapper->delete($config);
-
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
- }
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/ok');
- }
+ public function createconfigAction()
+ {
+ //ACL Darf er Configs erstellen?
+ if(!Pbs_Acl::checkRight('cc') && !Pbs_Acl::checkRight('cco'))
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
+
+ if (!isset($_POST["createconfig"])){
+ $configForm = new user_Form_Config(array('action' => 'createconfig','page'=>$this->page, 'type'=>$this->type));
+ } else {
+ $configForm = new user_Form_Config(array('action' => 'createconfig','page'=>$this->page, 'type'=>$this->type),$_POST);
+
+ if ($configForm->isValid($_POST)) {
+
+ $config = new Application_Model_Config($_POST);
+ $config->setCreated(time());
+
+ if(Pbs_Acl::checkRight('cc') && $this->_request->getParam('type') == 'group')
+ $config->setGroupID($this->membership->getGroupID());
+ elseif(Pbs_Acl::checkRight('cco') && $this->_request->getParam('type') == 'own')
+ $config->setMembershipID($this->membership->getID());
+ else
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
+
+ try {
+ $this->configMapper->save($config);
+ }catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
+ }
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/ok');
+ }
+ }
+
+ $this->view->configForm = $configForm;
+ }
+
+ public function addUserAction(){
+
+ }
+
+ public function editconfigAction()
+ {
+ //ACL Darf er Configs editieren?
+ if(!Pbs_Acl::checkRight('ce') && !Pbs_Acl::checkRight('cem') && !Pbs_Acl::checkRight('ceo'))
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
+
+ $configID = $this->_request->getParam('configID');
+ if (!is_numeric($configID))
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
+
+ $groupID = $this->membership->getGroupID();
+
+ $config = new Application_Model_Config();
+ $this->configMapper->find($configID, $config);
+
+ if($config->getMembershipID() != null){
+ if($this->membership->getID() != $config->getMembershipID() || !Pbs_Acl::checkRight('ceo'))
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
+ }else{
+ if($this->membership->getGroupID() != $config->getGroupID() || (!Pbs_Acl::checkRight('ce') && !Pbs_Acl::checkRight('cem')))
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
+ }
+
+ if (!isset($_POST["editconfig"])){
+
+ $configForm = new user_Form_Config(array('action' => 'editconfig','page'=>$this->page, 'type'=>$this->type));
+ $configForm->populate($config->toArray());
+
+ }else{
+ $configForm = new user_Form_Config(array('action' => 'editconfig','page'=>$this->page, 'type'=>$this->type),$_POST);
+
+ if ($configForm->isValid($_POST)) {
+
+ $configold = $config;
+
+ $config = new Application_Model_Config($_POST);
+ $config->setCreated(time());
+
+ if(Pbs_Acl::checkRight('ce') && $configold->getGroupID() != null)
+ $config->setGroupID($this->membership->getGroupID());
+ elseif(Pbs_Acl::checkRight('ceo') && $configold->getMembershipID() != null)
+ $config->setMembershipID($this->membership->getID());
+ else
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
+
+ $config->setID($configID);
+
+ if($configold->getShellscript() != $config->getShellscript()){
+ //ACL Is he allowed to edit other than Metadata?
+ if(!Pbs_Acl::checkRight('ce'))
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
+ }
+
+
+ try {
+ $this->configMapper->save($config);
+ }catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
+ }
+
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
+ }
+
+ }
+
+ $this->view->configForm = $configForm;
+ }
+
+ public function deleteconfigAction()
+ {
+ //ACL Darf er Configs löschen?
+ if(!Pbs_Acl::checkRight('cd') && !Pbs_Acl::checkRight('cdo'))
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
+
+ try{
+ $configID = $this->_request->getParam('configID');
+ if (!is_numeric($configID))
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
+
+ $config = new Application_Model_Config();
+ $this->configMapper->find($configID,$config);
+
+ if($config->getMembershipID() != null){
+ if($this->membership->getID() != $config->getMembershipID() || !Pbs_Acl::checkRight('cdo'))
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
+ }else{
+ if($this->membership->getGroupID() != $config->getGroupID() || !Pbs_Acl::checkRight('cd'))
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
+ }
+
+ $this->configMapper->delete($config);
+
+ }catch(Zend_Exception $e){
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
+ }
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/ok');
+ }
}
diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php
index 703bd7d..f9a4724 100644
--- a/application/modules/user/controllers/FilterController.php
+++ b/application/modules/user/controllers/FilterController.php
@@ -33,14 +33,14 @@ class User_FilterController extends Zend_Controller_Action
} else {
$this->_helper->redirector('login', 'auth');
}
- $this->page = $this->_request->getParam('page');
+ $this->page = $this->_request->getParam('page');
}
public function indexAction()
{
// ACL: Is he allowed to see the overview
if(!Pbs_Acl::checkRight('fo'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
$result = $this->_request->getParam('addresult');
if($result != ""){
@@ -68,33 +68,33 @@ class User_FilterController extends Zend_Controller_Action
$ff->setCreated(date(Zend_Registry::get('dateformat'),$ff->getCreated()));
$allFilter[] = $ff;
}
-
- // Search
+
+ // Search
$search = $this->_request->getParam('search');
$mySearch = new Pbs_Search();
$mySearch->setSearchTerm($search);
$mySearch->setModule('filter');
if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $allFilter = $mySearch->search($allFilter);
+ $this->view->search = $mySearch->getSearchTerm();
+ $allFilter = $mySearch->search($allFilter);
}
$this->view->searchform = $mySearch->searchForm();
-
+
// Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
$pagination->setElement($allFilter);
- $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setRequestPage($this->_request->getParam('page'));
$pagination->setPageUrl('/user/filter/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $allFilter = $pagination->getElements();
-
+ $allFilter = $pagination->getElements();
+
$this->view->pagination = $pagination->pagination();
$this->view->page = $pagination->getRequestPage();
- $this->view->filters = $allFilter;
-
+ $this->view->filters = $allFilter;
+
}
-
- public function searchAction(){
+
+ public function searchAction(){
$this->_redirect('/user/filter/index/search/'.($_GET['search']));
}
@@ -102,21 +102,21 @@ class User_FilterController extends Zend_Controller_Action
{
// ACL: Is he allowed to add a Filter
if(!Pbs_Acl::checkRight('fa'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
$bmmapper = new Application_Model_BootMenuMapper();
- $result = $bmmapper->findBy(array('groupID' => $this->membership->getGroupID()),true);
+ $result = $bmmapper->findBy(array('groupID' => $this->membership->getGroupID()),true);
print_a($result);
-
+
foreach($result as $rr){
$bm = new Application_Model_BootMenu();
$bm->setOptions($rr);
$bm->setID($rr['bootmenuID']);
$bootmenus[] = $bm;
}
-
+
$this->view->bootmenus = $bootmenus;
if (!isset($_POST["add"])){
@@ -161,10 +161,10 @@ class User_FilterController extends Zend_Controller_Action
{
$filterID = $this->_request->getParam('filterID');
$filtermapper = new Application_Model_FilterMapper();
-
+
// ACL: Is he allowed to remove the filter
if(!Pbs_Acl::checkRight('fd'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
if(is_numeric($filterID)){
$filter = new Application_Model_Filter();
@@ -194,12 +194,12 @@ class User_FilterController extends Zend_Controller_Action
$bm->setID($rr['bootmenuID']);
$bootmenus[] = $bm;
}
-
+
// ACL: Is he allowed to edit the filter or the filterpriority?
if(!Pbs_Acl::checkRight('fe') && !Pbs_Acl::checkRight('fefp'))
- $this->_redirect('/user');
-
- if (!isset($_POST["add"])){
+ $this->_redirect('/user');
+
+ if (!isset($_POST["add"])){
$filterID = $this->_request->getParam('filterID');
$filter = new Application_Model_Filter();
@@ -218,7 +218,7 @@ class User_FilterController extends Zend_Controller_Action
$this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
}
} else{
- try{
+ try{
$filterID = $this->_request->getParam('filterID');
$filter = new Application_Model_Filter();
$filtermapper = new Application_Model_FilterMapper();
@@ -230,17 +230,17 @@ class User_FilterController extends Zend_Controller_Action
'page' => $this->page),$_POST);
if ($editfilterform->isValid($_POST)) {
$filtermapper = new Application_Model_FilterMapper();
-
+
$newfilterentry = new Application_Model_Filter($_POST);
$newfilterentry->setID($this->_request->getParam('filterID'));
$newfilterentry->setGroupID($this->membership->getGroupID());
$newfilterentry->setMembershipID(null);
-
+
// ACL: if he is only allowed to edit filterpriority
if(Pbs_Acl::checkRight('fefp') && !Pbs_Acl::checkRight('fe')){
$DBfilterentry = new Application_Model_Filter();
$filtermapper->find($this->_request->getParam('filterID'),$DBfilterentry);
-
+
$compareresult = $filtermapper->compare($newfilterentry,$DBfilterentry);
if(isset($compareresult['priority']) && count($compareresult) == 1){
$filtermapper->save($newfilterentry);
@@ -251,7 +251,7 @@ class User_FilterController extends Zend_Controller_Action
}
}
// ACL: he is allowed to edit the filter
- elseif(Pbs_Acl::checkRight('fe')){
+ elseif(Pbs_Acl::checkRight('fe')){
$filtermapper->save($newfilterentry);
$this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/ok');
}
@@ -276,8 +276,8 @@ class User_FilterController extends Zend_Controller_Action
$bootisos = $bootisoMapper->findBy(array('groupID'=>$this->membership->getGroupID()),true);
$membershipMapper = new Application_Model_MembershipMapper();
- $memberships = $membershipMapper->findBy(array('groupID'=>$this->membership->getGroupID()),true);
-
+ $memberships = $membershipMapper->findBy(array('groupID'=>$this->membership->getGroupID()),true);
+
$grouppMapper = new Application_Model_GroupMapper();
$group = new Application_Model_Group();
$grouppMapper->find($this->membership->getGroupID(),$group);
@@ -298,8 +298,8 @@ class User_FilterController extends Zend_Controller_Action
{
// ACL: is he allowed to create a new filterentry?
if(!Pbs_Acl::checkRight('ffa'))
- $this->_redirect('/user');
-
+ $this->_redirect('/user');
+
$filterID = $this->_request->getParam('filterID');
$filterMapper = new Application_Model_FilterMapper();
$filter = new Application_Model_Filter();
@@ -310,7 +310,7 @@ class User_FilterController extends Zend_Controller_Action
if($filter->getGroupID() == $this->membership->getGroupID()){
if (!isset($_POST["add"])){
try{
- $addform = new user_Form_FilterEntry(array(
+ $addform = new user_Form_FilterEntry(array(
'buttontext' => 'Add Filterentry',
'filterID' => $filterID,
'selectData' => $selectData,
@@ -365,7 +365,7 @@ class User_FilterController extends Zend_Controller_Action
{
//ACL: is he allowed to edit filterentrys ?
if(!Pbs_Acl::checkRight('ffe'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
$selectData = $this->prepareFormData();
if (!isset($_POST["add"])){
try{
@@ -433,12 +433,12 @@ class User_FilterController extends Zend_Controller_Action
else{
$newfilterenty->setFiltervalue($_POST['filtervalue']);
$newfilterenty->setFiltervalue2($_POST['filtervalue2']);
- }
-
+ }
+
$newfilter2 = new Application_Model_FilterEntriesMapper();
$newfilter2->save($newfilterenty);
$this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/ok');
-
+
}
else{
$this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
@@ -456,7 +456,7 @@ class User_FilterController extends Zend_Controller_Action
{
//ACL: is he autohorized to delete a filterentry?
if(!Pbs_Acl::checkRight('ffd'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
$filterentriesID = $this->_request->getParam('filterentriesID');
if(is_numeric($filterentriesID)){
@@ -473,11 +473,11 @@ class User_FilterController extends Zend_Controller_Action
try{
$deletefilterentry = new Application_Model_FilterEntries();
$deletefilterentry->setID($filterentriesID);
-
+
$filterentriesmapper = new Application_Model_FilterEntriesMapper();
$filterentriesmapper->delete($deletefilterentry);
$this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/ok');
-
+
}catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
$this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/error');
diff --git a/application/modules/user/controllers/GroupController.php b/application/modules/user/controllers/GroupController.php
index 561f116..3f7fde0 100644
--- a/application/modules/user/controllers/GroupController.php
+++ b/application/modules/user/controllers/GroupController.php
@@ -38,7 +38,7 @@ class User_GroupController extends Zend_Controller_Action
$userIDsNamespace = Zend_Session::namespaceGet('userIDs');
$this->membership = new Application_Model_Membership();
$this->membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
-
+
$this->page = $this->_request->getParam('page');
} else {
$this->_helper->redirector('login', 'auth');
@@ -51,7 +51,7 @@ class User_GroupController extends Zend_Controller_Action
// ACL show overview
if(!Pbs_Acl::checkRight('gso'))
$this->_redirect('/user');
-
+
$result = $this->_request->getParam('deleteresult');
if($result != ""){
$pbsNotifier = new Pbs_Notifier();
@@ -126,7 +126,7 @@ class User_GroupController extends Zend_Controller_Action
$membership->setID();
$membership->setGroupID($groupID);
$membership->setRoleID($roleID);
-
+
try {
$this->membershipMapper->save($membership);
} catch(Zend_Exception $e)
@@ -173,7 +173,7 @@ class User_GroupController extends Zend_Controller_Action
{
// ACL edit a group
if(!Pbs_Acl::checkRight('geo') && !Pbs_Acl::checkRight('ge'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
$groupID = $this->_request->getParam('groupID');
if(!isset($groupID)) {
@@ -186,7 +186,7 @@ class User_GroupController extends Zend_Controller_Action
return;
}
if((!Pbs_Acl::checkRight('geo') && $groupID == $this->membership->getGroupID()) || ( !Pbs_Acl::checkRight('ge') && $groupID != $this->membership->getGroupID() ))
- $this->_redirect('/user/group/index/page/'.$this->page.'/deleteresult/forbidden');
+ $this->_redirect('/user/group/index/page/'.$this->page.'/deleteresult/forbidden');
if (!isset($_POST["save"])){
$group = $this->groupMapper->find($groupID);
$_POST['title'] = $group->getTitle();
@@ -194,9 +194,9 @@ class User_GroupController extends Zend_Controller_Action
$editForm = new user_Form_GroupEdit(array('groupID' => $groupID));
} else {
$editForm = new user_Form_GroupEdit(array('groupID' => $groupID), $_POST);
- if ($editForm->isValid($_POST)) {
+ if ($editForm->isValid($_POST)) {
$group = new Application_Model_Group($_POST);
- $group->setID($groupID);
+ $group->setID($groupID);
try {
$this->groupMapper->save($group);
} catch(Zend_Exception $e)
@@ -225,12 +225,13 @@ class User_GroupController extends Zend_Controller_Action
}
}
if($groupID == $this->membership->getGroupID() && !Pbs_Acl::checkRight('gsdo'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
$this->view->usergroup = $this->membership->getGroupID();
$this->view->requestgroup = $groupID;
$groupRequests = $this->groupRequestMapper->findBy(array('groupID' => $groupID),true);
if(isset($groupRequests)) {
+ $groupRequestList = array();
foreach($groupRequests as $groupRequest) {
$person = $this->personmapper->find($groupRequest['personID']);
$groupRequestList[] = array(
@@ -238,7 +239,7 @@ class User_GroupController extends Zend_Controller_Action
'person' => $person
);
}
- if(is_array($groupRequestList)) {
+ if(count($groupRequestList) > 0) {
$this->view->groupRequestList = $groupRequestList;
}
// Search all inherit Roles
@@ -247,15 +248,15 @@ class User_GroupController extends Zend_Controller_Action
$parents = $groupGroupsMapper->getParentGroups($groupID);
$groupMapper = new Application_Model_GroupMapper();
$crawled = array();
- foreach($parents as $p){
+ foreach($parents as $p){
foreach($p as $a){
if(!in_array($a,$crawled)){
$crawled[] = $a;
$group = $groupMapper->find($a);
if($groupID != $a)
- $r = $this->rolemapper->findBy(array('groupID' => $a,'inheritance'=>"1"));
+ $r = $this->rolemapper->findBy(array('groupID' => $a,'inheritance'=>"1"));
else
- $r = $this->rolemapper->findBy(array('groupID' => $a));
+ $r = $this->rolemapper->findBy(array('groupID' => $a));
foreach($r as $d){
$roles[$group->getTitle()][] = $d;
}
@@ -265,7 +266,7 @@ class User_GroupController extends Zend_Controller_Action
$this->view->roleList = $roles;
}
- if(Pbs_Acl::checkRight('gsmg') || Pbs_Acl::checkRight('gsmgo')){
+ if(Pbs_Acl::checkRight('gsmg') || Pbs_Acl::checkRight('gsmgo')){
$members = $this->membershipMapper->findBy(array('groupID' => $groupID),true);
if(isset($members)) {
foreach($members as $member) {
@@ -291,7 +292,7 @@ class User_GroupController extends Zend_Controller_Action
$memberPagination->setPageUrl('/user/group/show'.((isset($this->view->search))?'/search/'.$this->view->search:''));
}
$this->view->membersList = $memberPagination->getElements();
- $this->view->memberPagination = $memberPagination->pagination($pageurl);
+ $this->view->memberPagination = $memberPagination->pagination();
$this->view->page = $memberPagination->getRequestPage();
}
}
@@ -310,12 +311,12 @@ class User_GroupController extends Zend_Controller_Action
public function linkAction()
{
if(!Pbs_Acl::checkRight('glk'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
$linkableGroups = $this->groupList;
- $groupGroupsMapper = new Application_Model_GroupGroupsMapper();
+ $groupGroupsMapper = new Application_Model_GroupGroupsMapper();
$childs = array();
- $parents = array();
+ $parents = array();
$childs = $groupGroupsMapper->getChildGroups($this->membership->getGroupID());
$parents = $groupGroupsMapper->getParentGroups($this->membership->getGroupID());
#print_a($childs,$parents);
@@ -365,7 +366,7 @@ class User_GroupController extends Zend_Controller_Action
{
// ACL delete a group
if(!Pbs_Acl::checkRight('gd'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
$this->_helper->viewRenderer->setNoRender();
$groupID = $this->_request->getParam('groupID');
@@ -404,7 +405,7 @@ class User_GroupController extends Zend_Controller_Action
{
// ACL grant a membership to request
if(!Pbs_Acl::checkRight('gam'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
$this->_helper->viewRenderer->setNoRender();
if(isset($_POST['grouprequestID']) && isset($_POST['roleID'])) {
@@ -419,13 +420,13 @@ class User_GroupController extends Zend_Controller_Action
}
$membership = new Application_Model_Membership();
$membership->setGroupID($groupRequest->getGroupID());
- $membership->setPersonID($groupRequest->getPersonID());
+ $membership->setPersonID($groupRequest->getPersonID());
$membership->setRoleID($_POST['roleID']);
- $membership->setSuspended(0);
+ $membership->setSuspended(0);
$apikey = randomString(32);
$membership->setApikey($apikey);
-
-
+
+
try {
$id = $this->membershipMapper->save($membership);
diff --git a/application/modules/user/controllers/IndexController.php b/application/modules/user/controllers/IndexController.php
index 350d0e5..a704261 100644
--- a/application/modules/user/controllers/IndexController.php
+++ b/application/modules/user/controllers/IndexController.php
@@ -12,15 +12,15 @@
class User_IndexController extends Zend_Controller_Action
{
- public function init()
- {
- /* Initialize action controller here */
- }
+ public function init()
+ {
+ /* Initialize action controller here */
+ }
- public function indexAction()
- {
-
- if (!Zend_Auth::getInstance()->hasIdentity()) {
+ public function indexAction()
+ {
+
+ if (!Zend_Auth::getInstance()->hasIdentity()) {
$this->view->text = 'Your not logged in, please log in first <a href="/user/auth/">here</a>.';
}
else{
@@ -32,7 +32,7 @@ class User_IndexController extends Zend_Controller_Action
'/user/bootmenu' => 'Create your Bootmenu',
);
$this->view->links = $links;
- }
- }
+ }
+ }
}
diff --git a/application/modules/user/controllers/PersonController.php b/application/modules/user/controllers/PersonController.php
index da640ba..07a69ee 100644
--- a/application/modules/user/controllers/PersonController.php
+++ b/application/modules/user/controllers/PersonController.php
@@ -14,19 +14,12 @@ class user_PersonController extends Zend_Controller_Action
{
protected $person = null;
-
protected $personmapper = null;
-
protected $membershipMapper = null;
-
protected $memberships = null;
-
protected $groupMapper = null;
-
protected $groups = null;
-
protected $groupRequestMapper = null;
-
protected $userIDsNamespace = null;
public function init()
@@ -34,7 +27,7 @@ class user_PersonController extends Zend_Controller_Action
if (Zend_Auth::getInstance()->hasIdentity()) {
$this->personmapper = new Application_Model_PersonMapper();
$this->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- if($this->userIDsNamespace['personID']) {
+ if(isset($this->userIDsNamespace['personID'])) {
$this->person = $this->personmapper->find($this->userIDsNamespace['personID']);
} else {
$result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
@@ -45,28 +38,28 @@ class user_PersonController extends Zend_Controller_Action
$this->groupRequestMapper = new Application_Model_GroupRequestMapper();
$this->membershipMapper = new Application_Model_MembershipMapper();
$this->memberships = $this->membershipMapper->findBy(array("personID" => $this->person->getID()),true);
-
+
$rightrolesMapper = new Application_Model_RightRolesMapper();
- $rightroles = new Application_Model_RightRoles();
+ $rightroles = new Application_Model_RightRoles();
$role = new Application_Model_Role();
$roleMapper = new Application_Model_RoleMapper();
-
- $this->view->apikeys = array();
+ $this->view->apikeys = array();
+
if(isset($this->memberships)) {
foreach($this->memberships as $membership) {
$group = $this->groupMapper->find($membership['groupID']);
@list($rightroles) = $rightrolesMapper->findBy(array('rightID' => '55', 'roleID' => $membership['roleID']));
$role = $roleMapper->find($membership['roleID']);
if($rightroles != null)
- $this->view->apikeys[$group->getID()] = $membership['apikey'];
-
+ $this->view->apikeys[$group->getID()] = $membership['apikey'];
+
$this->groups[] = array (
- 'groupID' => $group->getID(),
- 'title' => $group->getTitle(),
- 'description' => $group->getDescription(),
- 'membershipID' => $membership['membershipID'],
- 'role' => $role->getTitle()
+ 'groupID' => $group->getID(),
+ 'title' => $group->getTitle(),
+ 'description' => $group->getDescription(),
+ 'membershipID' => $membership['membershipID'],
+ 'role' => $role->getTitle()
);
}
}
@@ -111,7 +104,7 @@ class user_PersonController extends Zend_Controller_Action
$pagination->setPageUrl('/user/person/index/'.((isset($this->view->search))?'/search/'.$this->view->search:''));
$this->view->personList = $pagination->getElements();
- $this->view->pagination = $pagination->pagination($pageurl);
+ $this->view->pagination = $pagination->pagination();
$this->view->page = $pagination->getRequestPage();
}
@@ -123,6 +116,7 @@ class user_PersonController extends Zend_Controller_Action
$this->view->person = $this->person;
$groupRequests = $this->groupRequestMapper->findBy(array('personID' => $this->person->getID()),true);
if(isset($groupRequests)) {
+ $groupRequestList = array();
foreach($groupRequests as $groupRequest) {
$group = $this->groupMapper->find($groupRequest['groupID']);
$groupRequestList[] = array(
@@ -130,7 +124,7 @@ class user_PersonController extends Zend_Controller_Action
'group' => $group
);
}
- if(is_array($groupRequestList)) {
+ if(count($groupRequestList)> 0) {
$this->view->groupRequestList = $groupRequestList;
}
}
@@ -142,7 +136,7 @@ class user_PersonController extends Zend_Controller_Action
$pagination->setPageUrl('/user/person/index' .((isset($this->view->search))?'/search/'.$this->view->search:''));
$this->view->groups = $pagination->getElements();
- $this->view->pagination = $pagination->pagination($pageurl);
+ $this->view->pagination = $pagination->pagination();
$this->view->page = $pagination->getRequestPage();
// This should be activated in case the person has no membership and no rights.
$this->view->groupRequestRight = true;
@@ -157,7 +151,7 @@ class user_PersonController extends Zend_Controller_Action
if(!Pbs_Acl::checkRight('peod')) {
$this->_redirect('/user');
}
- if($personID = $this->_request->getParam('personID')) {
+ if($this->person->getID() == $this->_request->getParam('personID')) {
if(!Pbs_Acl::checkRight('peoa')) {
$this->_redirect('/user');
}
@@ -171,14 +165,14 @@ class user_PersonController extends Zend_Controller_Action
} else {
$editForm = new user_Form_PersonEdit($_POST);
if ($editForm->isValid($_POST)) {
- if($personID = $this->_request->getParam('personID')) {
- if(isset($_POST['newpassword'])) {
- $date = new DateTime();
+ if($this->person->getID() == $this->_request->getParam('personID')) {
+
+ $person->setOptions($_POST);
+ if($_POST['newpassword'] != '') {
$person->setPassword($_POST['newpassword']);
- $person->setPasswordSalt(MD5($date->getTimestamp()));
- $person->setPassword(MD5($person->getPassword() . $this->person->getPasswordSalt()));
+ $person->setPasswordSalt(MD5(microtime(true)));
+ $person->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
}
- $person->setOptions($_POST);
try {
$this->personmapper->save($person);
} catch(Zend_Exception $e)
@@ -189,14 +183,13 @@ class user_PersonController extends Zend_Controller_Action
return;
}
$this->_helper->redirector('', 'person');
- } else {
- if(isset($_POST['newpassword'])) {
- $date = new DateTime();
+ } else {
+ $this->person->setOptions($_POST);
+ if($_POST['newpassword'] != '') {
$this->person->setPassword($_POST['newpassword']);
- $this->person->setPasswordSalt(MD5($date->getTimestamp()));
+ $this->person->setPasswordSalt(MD5(microtime(true)));
$this->person->setPassword(MD5($this->person->getPassword() . $this->person->getPasswordSalt()));
}
- $this->person->setOptions($_POST);
try {
$this->personmapper->save($this->person);
} catch(Zend_Exception $e)
@@ -235,7 +228,7 @@ class user_PersonController extends Zend_Controller_Action
if($membership['groupID'] == $group->getID()) {
$groupsFound[$count] = true;
} else {
- if($groupsFound[$count] != true) {
+ if(@$groupsFound[$count] != true) {
$groupsFound[$count] = false;
}
}
@@ -316,7 +309,15 @@ class user_PersonController extends Zend_Controller_Action
if(isset($userIDsNamespace['membershipID'])) {
$this->_redirect('/user/');
} else {
- if(count($this->memberships) > 0) {
+ if(count($this->memberships) == 1) {
+ $myMembership = $this->memberships[0];
+ $roleSession = new Zend_Session_Namespace('userIDs');
+ $roleSession->membershipID = $myMembership['membershipID'];
+ $roleSession->personID = $myMembership['personID'];
+ $roleSession->groupID = $myMembership['groupID'];
+ $roleSession->roleID = $myMembership['roleID'];
+ $this->_redirect('/user/');
+ } elseif(count($this->memberships) > 1) {
if(isset($_POST['selectmembership'])) {
$roleSession = new Zend_Session_Namespace('userIDs');
$roleSession->membershipID = $_POST['membershipID'];
@@ -330,6 +331,7 @@ class user_PersonController extends Zend_Controller_Action
$groupMapper = new Application_Model_GroupMapper();
$roleMapper = new Application_Model_RoleMapper();
if(isset($this->memberships)) {
+ $suspendlist = array();
foreach($this->memberships as $membership) {
$group = $groupMapper->find($membership['groupID']);
$role = $roleMapper->find($membership['roleID']);
@@ -345,8 +347,8 @@ class user_PersonController extends Zend_Controller_Action
'membershipID' => $membership['membershipID'],
'group' => $group->getTitle(),
'role' => $role->getTitle());
- }
-
+ }
+
}
if(count($suspendlist) >=1){
$pbsNotifier = new Pbs_Notifier();
@@ -420,7 +422,7 @@ class user_PersonController extends Zend_Controller_Action
$pagination->setPageUrl('/user/person/show/personID/' . $personID .((isset($this->view->search))?'/search/'.$this->view->search:''));
$this->view->groups = $pagination->getElements();
- $this->view->pagination = $pagination->pagination($pageurl);
+ $this->view->pagination = $pagination->pagination();
$this->view->page = $pagination->getRequestPage();
$this->view->personID = $personID;
$this->view->editRight = Pbs_Acl::checkRight('peoa');
@@ -437,7 +439,7 @@ class user_PersonController extends Zend_Controller_Action
{
if(!Pbs_Acl::checkRight('gdm')) {
$this->_redirect('/user');
- }
+ }
$grouprequestID = $this->_request->getParam('grouprequestID');
$grouprequest = $this->groupRequestMapper->find($grouprequestID);
try {
diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php
index b793d80..3d6a0f5 100644
--- a/application/modules/user/controllers/PoolController.php
+++ b/application/modules/user/controllers/PoolController.php
@@ -14,7 +14,7 @@ class User_PoolController extends Zend_Controller_Action
{
private $membership;
protected $page;
-
+
public function init()
{
if (Zend_Auth::getInstance()->hasIdentity()) {
@@ -30,14 +30,14 @@ class User_PoolController extends Zend_Controller_Action
} else {
$this->_helper->redirector('login', 'auth');
}
- $this->page = $this->_request->getParam('page');
+ $this->page = $this->_request->getParam('page');
}
public function indexAction()
{
// ACL: is he allowed to see the pools of a group
if(!Pbs_Acl::checkRight('poo'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
$result = $this->_request->getParam('deleteresult');
if($result != ""){
@@ -74,30 +74,30 @@ class User_PoolController extends Zend_Controller_Action
$ff->setID($pool['poolID']);
$yourpools[] = $ff;
}
-
- // Search
+
+ // Search
$search = $this->_request->getParam('search');
$mySearch = new Pbs_Search();
$mySearch->setSearchTerm($search);
$mySearch->setModule('pool');
if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $yourpools = $mySearch->search($yourpools);
+ $this->view->search = $mySearch->getSearchTerm();
+ $yourpools = $mySearch->search($yourpools);
}
$this->view->searchform = $mySearch->searchForm();
-
+
// Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
$pagination->setElement($yourpools);
- $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setRequestPage($this->_request->getParam('page'));
$pagination->setPageUrl('/user/pool/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $yourpools = $pagination->getElements();
-
+ $yourpools = $pagination->getElements();
+
$this->view->pagination = $pagination->pagination();
$this->view->page = $pagination->getRequestPage();
- $this->view->pools = $yourpools;
-
+ $this->view->pools = $yourpools;
+
// Get all Clients from this group
$clientmapper = new Application_Model_ClientMapper();
@@ -112,12 +112,17 @@ class User_PoolController extends Zend_Controller_Action
// extract the un-assigned clients from the clientlist of the group
$freeclients = $this->arrayDiff($clientsArray,$assignedclientsArray);
-
- if(Pbs_Acl::checkRight('posuc'))
- $this->view->freeclients = $freeclients;
+
+ // Format Time-String
+ foreach($freeclients as $k=>$cig){
+ $freeclients[$k]['created'] = date(Zend_Registry::get('dateformat'),$cig['created']);
+ }
+
+ if(Pbs_Acl::checkRight('posuc'))
+ $this->view->freeclients = $freeclients;
}
-
- public function searchAction(){
+
+ public function searchAction(){
$this->_redirect('/user/pool/index/search/'.($_GET['search']));
}
@@ -125,8 +130,8 @@ class User_PoolController extends Zend_Controller_Action
{
// ACL: is he allowed to create a pool?
if(!Pbs_Acl::checkRight('poc'))
- $this->_redirect('/user');
-
+ $this->_redirect('/user');
+
if (!isset($_POST["add"])){
$addfilterform = new user_Form_Pool(array(
'buttontext' => 'Create Pool',
@@ -155,10 +160,10 @@ class User_PoolController extends Zend_Controller_Action
public function deletepoolAction()
{
$poolID = $this->_request->getParam('poolID');
-
+
// ACL: is he allowed to delete a pool?
if(!Pbs_Acl::checkRight('pod'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
if(is_numeric($poolID)){
$poolmapper = new Application_Model_PoolMapper();
@@ -181,10 +186,10 @@ class User_PoolController extends Zend_Controller_Action
{
// ACL: is he allowed to edit a pool?
if(!Pbs_Acl::checkRight('poe'))
- $this->_redirect('/user');
-
+ $this->_redirect('/user');
+
if (!isset($_POST["add"])){
- $poolID = $this->_request->getParam('poolID');
+ $poolID = $this->_request->getParam('poolID');
$pool = new Application_Model_Pool();
$poolmapper = new Application_Model_PoolMapper();
$poolmapper->find($poolID,$pool);
@@ -236,8 +241,8 @@ class User_PoolController extends Zend_Controller_Action
// ACL: Is he allowed to link clients to pools?
if(!Pbs_Acl::checkRight('polc'))
- $this->_redirect('/user');
-
+ $this->_redirect('/user');
+
if(!isset($_POST['clientID']) && ($clientID == '')){
$clientmapper = new Application_Model_ClientMapper();
$clients = $clientmapper->findBy(array('groupID',$this->membership->getGroupID()),true);
@@ -293,7 +298,7 @@ class User_PoolController extends Zend_Controller_Action
// ACL: Is he allowed to unlink clients from pools?
if(!Pbs_Acl::checkRight('pouc'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
if(is_numeric($poolentriesID)){
$poolentriesMapper = new Application_Model_PoolEntriesMapper();
diff --git a/application/modules/user/controllers/PrebootController.php b/application/modules/user/controllers/PrebootController.php
index 7e082d3..2b2955d 100644
--- a/application/modules/user/controllers/PrebootController.php
+++ b/application/modules/user/controllers/PrebootController.php
@@ -12,22 +12,22 @@
class User_PrebootController extends Zend_Controller_Action
{
-
+
protected $prebootMapper;
protected $membershipMapper;
protected $membership;
protected $page;
-
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
+
+ public function init()
+ {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
$userIDsNamespace = Zend_Session::namespaceGet('userIDs');
if($userIDsNamespace['membershipID'] ==''){
$this->_redirect('/user/index');
}
-
+
$this->prebootMapper = new Application_Model_PreBootMapper();
-
+
$this->membershipMapper = new Application_Model_MembershipMapper();
$this->membership = new Application_Model_Membership();
$this->membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
@@ -35,14 +35,14 @@ class User_PrebootController extends Zend_Controller_Action
$this->db = Zend_Db_Table::getDefaultAdapter();
} else {
$this->_helper->redirector('login', 'auth');
- }
- $this->page = $this->_request->getParam('page');
- }
-
+ }
+ $this->page = $this->_request->getParam('page');
+ }
+
- public function indexAction()
- {
- $result = $this->_request->getParam('addresult');
+ public function indexAction()
+ {
+ $result = $this->_request->getParam('addresult');
if($result != ""){
$pbsNotifier = new Pbs_Notifier();
$this->view->notification = $pbsNotifier->notify('create',$result);
@@ -75,20 +75,21 @@ class User_PrebootController extends Zend_Controller_Action
$mySearch->setSearchTerm($search);
$mySearch->setModule('preboot');
if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $this->view->prebootlist = $mySearch->search($this->view->prebootlist);
+ $this->view->search = $mySearch->getSearchTerm();
+ $this->view->prebootlist = $mySearch->search($this->view->prebootlist);
}
$this->view->searchform = $mySearch->searchForm();
-
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
+
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
$pagination->setElement($this->view->prebootlist);
- $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setRequestPage($this->_request->getParam('page'));
$pagination->setPageUrl('/user/preboot/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $this->view->prebootlist = $pagination->getElements();
-
+ $this->view->prebootlist = $pagination->getElements();
+
$this->view->pagination = $pagination->pagination();
+
$this->view->page = $pagination->getRequestPage();
}
@@ -96,224 +97,224 @@ class User_PrebootController extends Zend_Controller_Action
public function searchAction(){
$this->_redirect('/user/preboot/index/search/'.($_GET['search']));
}
-
- public function createprebootAction()
- {
-
- //ACL Is he allowed to create Preboots?
- if(!Pbs_Acl::checkRight('prc'))
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/forbidden');
-
- if (!isset($_POST["createpreboot"])){
- $prebootForm = new user_Form_Preboot(array(
+
+ public function createprebootAction()
+ {
+
+ //ACL Is he allowed to create Preboots?
+ if(!Pbs_Acl::checkRight('prc'))
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/forbidden');
+
+ if (!isset($_POST["createpreboot"])){
+ $prebootForm = new user_Form_Preboot(array(
'action' => 'createpreboot',
'page' => $this->page));
- } else {
-
- $prebootForm = new user_Form_Preboot(array(
+ } else {
+
+ $prebootForm = new user_Form_Preboot(array(
'action' => 'createpreboot',
'page' => $this->page),$_POST);
-
- if ($prebootForm->isValid($_POST)) {
-
- $preboot = new Application_Model_PreBoot($_POST);
- $preboot->setGroupID($this->membership->getGroupID());
-
- try {
-
- $path_tmp = "../resources/bootmedium/";
- mkdir($path_tmp ,0777, true);
-
- $hash = md5(microtime(1));
- exec("wget -O '".$path_tmp."preboot.zip".$hash."' ".escapeshellcmd($preboot->getPath_preboot())." 2>&1 | grep 'saved'", $status);
-
- if(!array_pop($status)){
- $this->view->prebootForm = $prebootForm;
- $pbsNotifier = new Pbs_Notifier();
- echo $pbsNotifier->notify('The Resource was not found on the specified path','error');
+
+ if ($prebootForm->isValid($_POST)) {
+
+ $preboot = new Application_Model_PreBoot($_POST);
+ $preboot->setGroupID($this->membership->getGroupID());
+
+ try {
+
+ $path_tmp = "../resources/bootmedium/";
+ mkdir($path_tmp ,0777, true);
+
+ $hash = md5(microtime(1));
+ exec("wget -O '".$path_tmp."preboot.zip".$hash."' ".escapeshellcmd($preboot->getPath_preboot())." 2>&1 | grep 'saved'", $status);
+
+ if(!array_pop($status)){
+ $this->view->prebootForm = $prebootForm;
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('The Resource was not found on the specified path','error');
- return;
- }
-
- $prebootID = $this->prebootMapper->save($preboot);
-
- $path_preboot = "../resources/bootmedium/$prebootID/";
- mkdir($path_preboot ,0777, true);
-
- exec("mv ../resources/bootmedium/preboot.zip$hash ../resources/bootmedium/$prebootID/preboot.zip");
-
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/error');
- //TODO Delete folder + preboot in DB
-
- }
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/ok');
- }
- }
-
- $this->view->prebootForm = $prebootForm;
- }
-
- public function checkupdateAction($preboot)
- {
-
- //ACL Is he allowed to update Preboots?
- if(!Pbs_Acl::checkRight('pru'))
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden');
-
- $prebootID = $preboot->getID();
- exec("wget --server-response --spider ".escapeshellcmd($preboot->getPath_preboot())." 2>&1 | grep 'Last-Modified:'", $prebootdate);
+ return;
+ }
- //print_a($prebootdate);
-
- $prebootdate = strtotime(trim(str_replace('Last-Modified:', '', array_pop($prebootdate))));
-
- if(is_file("../resources/bootmedium/$prebootID/preboot.zip")){
- $prebootolddate = filemtime("../resources/bootmedium/".$prebootID."/preboot.zip");
- }else{
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('There are updates available','ok');
- return true;
- }
-
- //print_a($prebootname,$prebootdate,$prebootolddate);
-
- $pbsNotifier = new Pbs_Notifier();
-
- if($prebootdate > $prebootolddate){
+ $prebootID = $this->prebootMapper->save($preboot);
+
+ $path_preboot = "../resources/bootmedium/$prebootID/";
+ mkdir($path_preboot ,0777, true);
+
+ exec("mv ../resources/bootmedium/preboot.zip$hash ../resources/bootmedium/$prebootID/preboot.zip");
+
+ }catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/error');
+ //TODO Delete folder + preboot in DB
+
+ }
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/ok');
+ }
+ }
+
+ $this->view->prebootForm = $prebootForm;
+ }
+
+ public function checkupdateAction($preboot)
+ {
+
+ //ACL Is he allowed to update Preboots?
+ if(!Pbs_Acl::checkRight('pru'))
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden');
+
+ $prebootID = $preboot->getID();
+ exec("wget --server-response --spider ".escapeshellcmd($preboot->getPath_preboot())." 2>&1 | grep 'Last-Modified:'", $prebootdate);
+
+ //print_a($prebootdate);
+
+ $prebootdate = strtotime(trim(str_replace('Last-Modified:', '', array_pop($prebootdate))));
+
+ if(is_file("../resources/bootmedium/$prebootID/preboot.zip")){
+ $prebootolddate = filemtime("../resources/bootmedium/".$prebootID."/preboot.zip");
+ }else{
+ $pbsNotifier = new Pbs_Notifier();
$this->view->notification = $pbsNotifier->notify('There are updates available','ok');
return true;
- }
- else
- return false;
-
- }
-
- public function updateprebootAction()
- {
- //ACL Is he allowed to update Preboots?
- if(!Pbs_Acl::checkRight('pru'))
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden');
-
- $prebootID = $this->_request->getParam('prebootID');
- if (!is_numeric($prebootID))
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden');
-
- $preboot = new Application_Model_PreBoot();
- $this->prebootMapper->find($prebootID,$preboot);
-
- if($this->membership->getGroupID() != $preboot->getGroupID())
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden');
-
-
- $path_preboot = "../resources/bootmedium/$prebootID/";
-
+ }
+
+ //print_a($prebootname,$prebootdate,$prebootolddate);
+
+ $pbsNotifier = new Pbs_Notifier();
+
+ if($prebootdate > $prebootolddate){
+ $this->view->notification = $pbsNotifier->notify('There are updates available','ok');
+ return true;
+ }
+ else
+ return false;
+
+ }
+
+ public function updateprebootAction()
+ {
+ //ACL Is he allowed to update Preboots?
+ if(!Pbs_Acl::checkRight('pru'))
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden');
+
+ $prebootID = $this->_request->getParam('prebootID');
+ if (!is_numeric($prebootID))
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden');
+
+ $preboot = new Application_Model_PreBoot();
+ $this->prebootMapper->find($prebootID,$preboot);
+
+ if($this->membership->getGroupID() != $preboot->getGroupID())
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden');
+
+
+ $path_preboot = "../resources/bootmedium/$prebootID/";
+
exec("wget -O '".$path_preboot."preboot.zip' ".escapeshellcmd($preboot->getPath_preboot())." 2>&1 | grep 'saved'", $status);
-
+
if(!array_pop($status)){
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/404');
- }
-
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/404');
+ }
+
try{
$filelist = array();
$filelist = scandir($path_preboot);
-
+
$bootisoMapper = new Application_Model_BootIsoMapper();
-
- //TODO Lock preboot
-
+
+ //TODO Lock preboot
+
foreach($filelist as $file){
if($file == preg_match('![0-9]+\.zip!')){
$bootisoID = str_replace('.zip', '', $file);
$serialnumber = $bootisoMapper->find($bootisoID)->getSerialnumber();
-
+
copy("../resources/bootmedium/$prebootID/preboot.zip", "../resources/bootmedium/$prebootID/$bootisoID".".zip");
- $zip = new ZipArchive();
- $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
- if($res === true){
- $rootdir = $zip->getNameIndex(0);
- $zip->addFromString($rootdir."build/rootfs/serial", $serialnumber);
- $zip->close();
- }
- }
+ $zip = new ZipArchive();
+ $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ if($res === true){
+ $rootdir = $zip->getNameIndex(0);
+ $zip->addFromString($rootdir."build/rootfs/serial", $serialnumber);
+ $zip->close();
+ }
+ }
}
}catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/error');
- //TODO Delete Folder + Preboot
- }
-
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/ok');
- }
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/error');
+ //TODO Delete Folder + Preboot
+ }
- public function editprebootAction()
- {
- //ACL Is he allowed to edit Preboots?
- if(!Pbs_Acl::checkRight('pre') && !Pbs_Acl::checkRight('prem'))
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden');
-
- $prebootID = $this->_request->getParam('prebootID');
-
- if (!is_numeric($prebootID))
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden');
-
-
- $preboot = new Application_Model_PreBoot();
- $this->prebootMapper->find($prebootID, $preboot);
-
- if($this->membership->getGroupID() != $preboot->getGroupID())
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden');
-
- if (!isset($_POST["editpreboot"])){
-
- $prebootForm = new user_Form_Preboot(array(
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/ok');
+ }
+
+ public function editprebootAction()
+ {
+ //ACL Is he allowed to edit Preboots?
+ if(!Pbs_Acl::checkRight('pre') && !Pbs_Acl::checkRight('prem'))
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden');
+
+ $prebootID = $this->_request->getParam('prebootID');
+
+ if (!is_numeric($prebootID))
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden');
+
+
+ $preboot = new Application_Model_PreBoot();
+ $this->prebootMapper->find($prebootID, $preboot);
+
+ if($this->membership->getGroupID() != $preboot->getGroupID())
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden');
+
+ if (!isset($_POST["editpreboot"])){
+
+ $prebootForm = new user_Form_Preboot(array(
'action' => 'editpreboot',
'page' => $this->page));
- $prebootForm->populate($preboot->toArray());
-
- }else{
-
- $prebootForm = new user_Form_Preboot(array(
+ $prebootForm->populate($preboot->toArray());
+
+ }else{
+
+ $prebootForm = new user_Form_Preboot(array(
'action' => 'editpreboot',
'page' => $this->page),$_POST);
-
- if ($prebootForm->isValid($_POST)) {
-
- $prebootold = $preboot;
-
- $preboot = new Application_Model_PreBoot($_POST);
- $preboot->setGroupID($this->membership->getGroupID());
- $preboot->setID($prebootID);
-
- $path_preboot = "../resources/bootmedium/$prebootID/";
-
- if($preboot->getPath_preboot() != $prebootold->getPath_preboot()){
-
- //ACL Is he allowed to edit the Preboot Path?
- if(!Pbs_Acl::checkRight('pre'))
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden');
-
- exec("wget -O '".$path_preboot."preboot.zip' ".escapeshellcmd($preboot->getPath_preboot()) ." 2>&1 | grep 'saved'" , $status);
- if(!array_pop($status)){
- $this->view->prebootForm = $prebootForm;
- $pbsNotifier = new Pbs_Notifier();
+
+ if ($prebootForm->isValid($_POST)) {
+
+ $prebootold = $preboot;
+
+ $preboot = new Application_Model_PreBoot($_POST);
+ $preboot->setGroupID($this->membership->getGroupID());
+ $preboot->setID($prebootID);
+
+ $path_preboot = "../resources/bootmedium/$prebootID/";
+
+ if($preboot->getPath_preboot() != $prebootold->getPath_preboot()){
+
+ //ACL Is he allowed to edit the Preboot Path?
+ if(!Pbs_Acl::checkRight('pre'))
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden');
+
+ exec("wget -O '".$path_preboot."preboot.zip' ".escapeshellcmd($preboot->getPath_preboot()) ." 2>&1 | grep 'saved'" , $status);
+ if(!array_pop($status)){
+ $this->view->prebootForm = $prebootForm;
+ $pbsNotifier = new Pbs_Notifier();
echo $pbsNotifier->notify('The Resource was not found on the specified path','error');
- return;
- }
-
- try{
- $filelist = array();
+ return;
+ }
+
+ try{
+ $filelist = array();
$filelist = scandir($path_preboot);
$bootisoMapper = new Application_Model_BootIsoMapper();
- //TODO Lock preboot
+ //TODO Lock preboot
foreach($filelist as $file){
if(preg_match('![0-9]+\.zip!',$file)){
@@ -321,70 +322,70 @@ class User_PrebootController extends Zend_Controller_Action
$serialnumber = $bootisoMapper->find($bootisoID)->getSerialnumber();
copy("../resources/bootmedium/$prebootID/preboot.zip", "../resources/bootmedium/$prebootID/$bootisoID".".zip");
- $zip = new ZipArchive();
- $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
- if($res === true){
- $rootdir = $zip->getNameIndex(0);
- $zip->addFromString($rootdir."build/rootfs/serial", $serialnumber);
- $zip->close();
- }
- }
+ $zip = new ZipArchive();
+ $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ if($res === true){
+ $rootdir = $zip->getNameIndex(0);
+ $zip->addFromString($rootdir."build/rootfs/serial", $serialnumber);
+ $zip->close();
+ }
+ }
}
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/error');
- }
- }
-
- try {
- $this->prebootMapper->save($preboot);
-
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/error');
- //TODO Delete Folder + Preboot
- }
-
+ }catch(Zend_Exception $e){
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/error');
+ }
+ }
+
+ try {
+ $this->prebootMapper->save($preboot);
+
+ }catch(Zend_Exception $e){
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/error');
+ //TODO Delete Folder + Preboot
+ }
+
$this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/ok');
- }
- }
-
- $this->view->prebootForm = $prebootForm;
- }
+ }
+ }
- public function deleteprebootAction()
- {
-
- //ACL Is he allowed to delete Preboots?
- if(!Pbs_Acl::checkRight('prd'))
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/forbidden');
-
- try{
- $prebootID = $this->_request->getParam('prebootID');
- if (!is_numeric($prebootID))
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/forbidden');
-
- $preboot = new Application_Model_PreBoot();
- $this->prebootMapper->find($prebootID, $preboot);
-
- if($this->membership->getGroupID() != $preboot->getGroupID())
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/forbidden');
-
- $this->prebootMapper->delete($preboot);
- exec("rm -r ../resources/bootmedium/".$prebootID);
-
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/error');
- }
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/ok');
- }
+ $this->view->prebootForm = $prebootForm;
+ }
+
+ public function deleteprebootAction()
+ {
+
+ //ACL Is he allowed to delete Preboots?
+ if(!Pbs_Acl::checkRight('prd'))
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/forbidden');
+
+ try{
+ $prebootID = $this->_request->getParam('prebootID');
+ if (!is_numeric($prebootID))
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/forbidden');
+
+ $preboot = new Application_Model_PreBoot();
+ $this->prebootMapper->find($prebootID, $preboot);
+
+ if($this->membership->getGroupID() != $preboot->getGroupID())
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/forbidden');
+
+ $this->prebootMapper->delete($preboot);
+ exec("rm -r ../resources/bootmedium/".$prebootID);
+
+ }catch(Zend_Exception $e){
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/error');
+ }
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/ok');
+ }
}
-
+
diff --git a/application/modules/user/controllers/RoleController.php b/application/modules/user/controllers/RoleController.php
index 312a647..4a4640f 100644
--- a/application/modules/user/controllers/RoleController.php
+++ b/application/modules/user/controllers/RoleController.php
@@ -28,7 +28,7 @@ class User_RoleController extends Zend_Controller_Action
$this->rightMapper = new Application_Model_RightMapper();
$this->rightRolesMapper = new Application_Model_RightRolesMapper();
$this->membershipMapper = new Application_Model_MembershipMapper();
-
+
$userIDsNamespace = Zend_Session::namespaceGet('userIDs');
$this->membership = new Application_Model_Membership();
$this->membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
@@ -45,60 +45,60 @@ class User_RoleController extends Zend_Controller_Action
if(!Pbs_Acl::checkRight('ro')) {
$this->_redirect('/user');
}
- $this->view->membership = $this->membership;
- $groupID = $this->membership->getGroupID();
- $this->view->roleList = $this->roleMapper->findBy(array('groupID' => $groupID),true);
+ $this->view->membership = $this->membership;
+ $groupID = $this->membership->getGroupID();
+ $this->view->roleList = $this->roleMapper->findBy(array('groupID' => $groupID),true);
- $roles = array();
- $groupGroupsMapper = new Application_Model_GroupGroupsMapper();
- $parents = $groupGroupsMapper->getParentGroups($groupID);
- $groupMapper = new Application_Model_GroupMapper();
- $roleMapper = new Application_Model_RoleMapper();
- $crawled = array();
- foreach($parents as $p){
- foreach($p as $a){
- if(!in_array($a,$crawled)){
- $crawled[] = $a;
- $group = $groupMapper->find($a);
- if($groupID != $a)
- $r = $roleMapper->findBy(array('groupID' => $a,'inheritance'=>"1"));
- else
- $r = $roleMapper->findBy(array('groupID' => $a));
- foreach($r as $d){
- $roles[$group->getTitle()][] = $d;
- }
+ $roles = array();
+ $groupGroupsMapper = new Application_Model_GroupGroupsMapper();
+ $parents = $groupGroupsMapper->getParentGroups($groupID);
+ $groupMapper = new Application_Model_GroupMapper();
+ $roleMapper = new Application_Model_RoleMapper();
+ $crawled = array();
+ foreach($parents as $p){
+ foreach($p as $a){
+ if(!in_array($a,$crawled)){
+ $crawled[] = $a;
+ $group = $groupMapper->find($a);
+ if($groupID != $a)
+ $r = $roleMapper->findBy(array('groupID' => $a,'inheritance'=>"1"));
+ else
+ $r = $roleMapper->findBy(array('groupID' => $a));
+ foreach($r as $d){
+ $roles[$group->getTitle()][] = $d;
}
}
}
- $this->view->roleList = $roles;
+ }
+ $this->view->roleList = $roles;
- // Search
- $search = $this->_request->getParam('search');
- $mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search);
- $mySearch->setModule('role');
- if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $this->view->roleList = $mySearch->search($this->view->roleList);
- }
- $this->view->searchform = $mySearch->searchForm();
+ // Search
+ $search = $this->_request->getParam('search');
+ $mySearch = new Pbs_Search();
+ $mySearch->setSearchTerm($search);
+ $mySearch->setModule('role');
+ if($search != ''){
+ $this->view->search = $mySearch->getSearchTerm();
+ $this->view->roleList = $mySearch->search($this->view->roleList);
+ }
+ $this->view->searchform = $mySearch->searchForm();
+
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
+ $pagination->setElement($this->view->roleList);
+ $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setPageUrl('/user/role/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
- $pagination->setElement($this->view->roleList);
- $pagination->setRequestPage($this->_request->getParam('page'));
- $pagination->setPageUrl('/user/role/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
+ $this->view->roleList = $pagination->getElements();
+ $this->view->pagination = $pagination->pagination();
+ $this->view->page = $pagination->getRequestPage();
+ $this->view->addRight = Pbs_Acl::checkRight('ra');
+ $this->view->editRight = Pbs_Acl::checkRight('re');
+ $this->view->deleteRight = Pbs_Acl::checkRight('rd');
+ $this->view->detailsRight = Pbs_Acl::checkRight('rdd');
+ $this->view->userIDsNamespace = $this->userIDsNamespace;
- $this->view->roleList = $pagination->getElements();
- $this->view->pagination = $pagination->pagination();
- $this->view->page = $pagination->getRequestPage();
- $this->view->addRight = Pbs_Acl::checkRight('ra');
- $this->view->editRight = Pbs_Acl::checkRight('re');
- $this->view->deleteRight = Pbs_Acl::checkRight('rd');
- $this->view->detailsRight = Pbs_Acl::checkRight('rdd');
- $this->view->userIDsNamespace = $this->userIDsNamespace;
-
}
public function searchAction(){
@@ -113,53 +113,53 @@ class User_RoleController extends Zend_Controller_Action
if(!Pbs_Acl::checkRight('ra')) {
$this->_redirect('/user');
}
-
- $roleID = $this->userIDsNamespace['roleID'];
- $rights = $this->rightMapper->fetchAll();
- if(count($rights) > 0) {
- $rightCategoryMapper = new Application_Model_RightCategoryMapper();
- foreach($rights as $right) {
- $rightCategory = $rightCategoryMapper->find($right->getRightcategoryID());
- $rightlist[$rightCategory->getTitle()][$right->getID()] = $right->getTitle();
- }
+
+ $roleID = $this->userIDsNamespace['roleID'];
+ $rights = $this->rightMapper->fetchAll();
+ if(count($rights) > 0) {
+ $rightCategoryMapper = new Application_Model_RightCategoryMapper();
+ foreach($rights as $right) {
+ $rightCategory = $rightCategoryMapper->find($right->getRightcategoryID());
+ $rightlist[$rightCategory->getTitle()][$right->getID()] = $right->getTitle();
}
- if (!isset($_POST["add"])){
- $addForm = new user_Form_RoleAdd(array('rightlist' => $rightlist, 'inheritanceright' => Pbs_Acl::checkRight('rir'), 'addrighttoroleright' => Pbs_Acl::checkRight('rar')));
- } else {
- $addForm = new user_Form_RoleAdd(array('rightlist' => $rightlist, 'inheritanceright' => Pbs_Acl::checkRight('rir'), 'addrighttoroleright' => Pbs_Acl::checkRight('rar')),$_POST);
- if ($addForm->isValid($_POST)) {
- $_POST['groupID'] = $this->userIDsNamespace['groupID'];
- $role = new Application_Model_Role($_POST);
- try {
- $this->roleMapper->save($role);
- $db = Zend_Db_Table::getDefaultAdapter();
- $insertedRoleID = $db->lastInsertId();
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- foreach($_POST['rights'] as $rightID => $bool) {
- if($bool == 1) {
- $rightrole = new Application_Model_RightRoles();
- $rightrole->setRightID($rightID);
- $rightrole->setRoleID($insertedRoleID);
- try {
- $this->rightRolesMapper->save($rightrole);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
+ }
+ if (!isset($_POST["add"])){
+ $addForm = new user_Form_RoleAdd(array('rightlist' => $rightlist, 'inheritanceright' => Pbs_Acl::checkRight('rir'), 'addrighttoroleright' => Pbs_Acl::checkRight('rar')));
+ } else {
+ $addForm = new user_Form_RoleAdd(array('rightlist' => $rightlist, 'inheritanceright' => Pbs_Acl::checkRight('rir'), 'addrighttoroleright' => Pbs_Acl::checkRight('rar')),$_POST);
+ if ($addForm->isValid($_POST)) {
+ $_POST['groupID'] = $this->userIDsNamespace['groupID'];
+ $role = new Application_Model_Role($_POST);
+ try {
+ $this->roleMapper->save($role);
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $insertedRoleID = $db->lastInsertId();
+ } catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ foreach($_POST['rights'] as $rightID => $bool) {
+ if($bool == 1) {
+ $rightrole = new Application_Model_RightRoles();
+ $rightrole->setRightID($rightID);
+ $rightrole->setRoleID($insertedRoleID);
+ try {
+ $this->rightRolesMapper->save($rightrole);
+ } catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
}
}
- $this->_helper->redirector('', 'role');
- return;
}
+ $this->_helper->redirector('', 'role');
+ return;
}
- $this->view->addForm = $addForm;
+ }
+ $this->view->addForm = $addForm;
}
public function editAction()
@@ -377,7 +377,7 @@ class User_RoleController extends Zend_Controller_Action
$rightroles = new Application_Model_RightRoles();
$rightroles->setRightID($rightID);
$rightroles->setRoleID($roleID);
-
+
try {
$this->rightRolesMapper->save($rightroles);
} catch(Zend_Exception $e)
diff --git a/application/modules/user/controllers/SessionController.php b/application/modules/user/controllers/SessionController.php
index 88f73f4..91b6dbd 100644
--- a/application/modules/user/controllers/SessionController.php
+++ b/application/modules/user/controllers/SessionController.php
@@ -59,7 +59,7 @@ class User_SessionController extends Zend_Controller_Action
$bm = $bootmenuentriesMapper->find($session->getBootmenuentryID());
if($bm != null)
$session->setBootmenuentryID("[".$session->getBootmenuentryID()."] ".$bm->getTitle());
-
+
}
if($session->getBootisoID() != ''){
@@ -80,7 +80,7 @@ class User_SessionController extends Zend_Controller_Action
}
}
// Sort after date/id
- usort($mySessions, sortFunc);
+ usort($mySessions, 'sortFunc');
// Search
$search = $this->_request->getParam('search');
@@ -92,7 +92,7 @@ class User_SessionController extends Zend_Controller_Action
$mySessions = $mySearch->search($mySessions);
}
$this->view->searchform = $mySearch->searchForm();
-
+
// Pagination
$pagination = new Pbs_Pagination();
$pagination->setPerPage(10);
@@ -113,8 +113,7 @@ class User_SessionController extends Zend_Controller_Action
}
-
function sortFunc($func_a, $func_b) {
if($func_a->getID() == $func_b->getID()) return 0;
return ($func_a->getID() < $func_b->getID()) ? 1 : -1;
-} \ No newline at end of file
+}
diff --git a/application/modules/user/forms/Bootiso.php b/application/modules/user/forms/Bootiso.php
index cb2337f..6ec9eb7 100644
--- a/application/modules/user/forms/Bootiso.php
+++ b/application/modules/user/forms/Bootiso.php
@@ -107,9 +107,9 @@ class user_Form_Bootiso extends Zend_Form
$this->addElement($publicfield);
if($this->action == "createbootiso")
- $label = "Create Bootiso";
+ $label = "Create BootMedium";
else
- $label = "Edit Bootiso";
+ $label = "Edit BootMedium";
$this->addElement('submit', $this->action, array(
'required' => false,
diff --git a/application/modules/user/forms/Bootmenu.php b/application/modules/user/forms/Bootmenu.php
index 77b8f3c..0a827d9 100644
--- a/application/modules/user/forms/Bootmenu.php
+++ b/application/modules/user/forms/Bootmenu.php
@@ -50,6 +50,14 @@ class user_Form_Bootmenu extends Zend_Form
'required' => true,
'label' => 'Title:',
));
+ $this->addElement('text', 'startcounter', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('Int'),
+ ),
+ 'required' => true,
+ 'label' => 'Startcounter:',
+ ));
if($this->action == "createbootmenu")
$label = "Create Bootmenu";
diff --git a/application/modules/user/forms/FilterEntry.php b/application/modules/user/forms/FilterEntry.php
index 2751dc6..42885ff 100644
--- a/application/modules/user/forms/FilterEntry.php
+++ b/application/modules/user/forms/FilterEntry.php
@@ -201,7 +201,7 @@ class user_Form_FilterEntry extends Zend_Form
$filtervalue1->setRegisterInArrayValidator(false);
break;
case "6":
- $desc = "Select a Group";
+ $desc = "For all members in this Group";
$label1 = 'Group:';
// TODO: insert the child Groups
$filtervalue1 = $this->createElement('select','filtervalue');
diff --git a/application/modules/user/layouts/user.phtml b/application/modules/user/layouts/user.phtml
index 53d2574..672877b 100644
--- a/application/modules/user/layouts/user.phtml
+++ b/application/modules/user/layouts/user.phtml
@@ -42,7 +42,7 @@ echo $this->headScript()."\n";
if(Pbs_Acl::checkRight('ro'))
echo "<li class='navTreeItem'><a href='/user/role'>Role</a></li>";
if(Pbs_Acl::checkRight('bai') || Pbs_Acl::checkRight('bui'))
- echo "<li class='navTreeItem'><a href='/user/bootiso'>BootIso</a></li>";
+ echo "<li class='navTreeItem'><a href='/user/bootiso'>BootMedium</a></li>";
if(Pbs_Acl::checkRight('pro'))
echo "<li class='navTreeItem'><a href='/user/preboot'>PreBoot</a></li>";
if(Pbs_Acl::checkRight('booai') || Pbs_Acl::checkRight('booui'))
@@ -146,4 +146,4 @@ echo $this->headScript()."\n";
<?php print_a('Session',$_SESSION,'GET',$_GET,'POST',$_POST); ?></div>
</div>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/application/modules/user/views/scripts/bootiso/index.phtml b/application/modules/user/views/scripts/bootiso/index.phtml
index a8c4e1c..70c6a3b 100644
--- a/application/modules/user/views/scripts/bootiso/index.phtml
+++ b/application/modules/user/views/scripts/bootiso/index.phtml
@@ -1,9 +1,12 @@
-<h1>BootMedien</h1>
+<h1>BootMedien<img class='helpericon' src='/media/img/bulb_off.png' /></h1>
<?php if($this->notification != ''){echo $this->notification;} ?>
+
+<div class='helper infobox'>This are the available BootMedia. You can download this BootMedia to your Computer to create a bootable USB stick or a bootable CD.</div>
+
<?php echo $this->searchform; ?>
<?php if(Pbs_Acl::checkRight('bc')): ?>
-<?php echo $this->formButton('createbootiso', 'Create BootISO', array(
+<?php echo $this->formButton('createbootiso', 'Create BootMedium', array(
'onclick' => 'self.location="/user/bootiso/createbootiso/page/'.$this->page.'"',
'class' => 'addbutton'))?>
<?php endif;?>
@@ -25,11 +28,11 @@
<div class='listelement'>
<?php if(count($this->bootisolist)==0)
- echo "There are no BootISO entries to display." ?>
+ echo "There are no BootMedium entries to display." ?>
<?php foreach ($this->bootisolist as $k => $bootiso): ?>
<div class='element'>
<div class='number'>
- <div class='smallnumber'>BootIso</div>
+ <div class='smallnumber'>BootMed</div>
<?php echo $k+1; ?>
</div>
<div class='content'>
@@ -56,7 +59,7 @@
'page' => $this->page
),
'default',
- true, false) ?>"><img src='/media/img/edit.png' alt='Edit BootISO' /></a>
+ true, false) ?>"><img src='/media/img/edit.png' alt='Edit BootMedium' /></a>
<?php endif; ?>
<?php if(Pbs_Acl::checkRight('bd')): ?>
<a href="<?php echo $this->url(
@@ -68,7 +71,7 @@
'page' => $this->page
),
'default',
- true) ?>"><img src='/media/img/delete.png' alt='Delete BootISO'/></a>
+ true) ?>"><img src='/media/img/delete.png' alt='Delete BootMedium'/></a>
<?php endif; ?>
</div>
<?php if(!Pbs_Acl::checkRight('bai')){
diff --git a/application/modules/user/views/scripts/bootmenu/index.phtml b/application/modules/user/views/scripts/bootmenu/index.phtml
index bdaf3a5..cf23e1d 100644
--- a/application/modules/user/views/scripts/bootmenu/index.phtml
+++ b/application/modules/user/views/scripts/bootmenu/index.phtml
@@ -1,7 +1,14 @@
-<h1>BootMenu</h1>
+<h1>BootMenu<?php if($this->type == 'own'):?><img class='helpericon' src='/media/img/bulb_off.png' /><?php endif;?></h1>
<?php if($this->notification != ''){echo $this->notification;} ?>
+
+<?php if($this->type == 'own'):?>
+ <div class='helper infobox'>Here you can see your Bootmenu. You can add a BootOs with a default Config or with a default Config. If you are overwhelmed by the possibilities the default Config is the best choice.</div>
+<?php endif;?>
+
<div id='notification' style='display:none;'></div>
-<?php echo $this->searchform; ?>
+<?php if(Pbs_Acl::checkRight('booai')): ?>
+ <?php echo $this->searchform; ?>
+<?php endif; ?>
<?php $conflabel = $this->type == 'group'?'own':'group';?>
@@ -16,15 +23,14 @@
'onclick' => 'self.location="/user/bootmenu/index/type/'.$conflabel.'/page/'.$this->page.'"',
'class' => 'addbutton'))?>
<?php endif;?>
-
-<div class='searchvars'>
- <div class='head'>Available searchfilter:</div>
- <?php if(Pbs_Acl::checkRight('booai')): ?>
- <div class='code'>bootmenuID</div>
- <?php endif; ?>
- <div class='code'>title</div>
- <div class='code'>changed</div>
-</div>
+<?php if(Pbs_Acl::checkRight('booai')): ?>
+ <div class='searchvars'>
+ <div class='head'>Available searchfilter:</div>
+ <div class='code'>bootmenuID</div>
+ <div class='code'>title</div>
+ <div class='code'>changed</div>
+ </div>
+<?php endif; ?>
<div class='listelement'>
<?php if(count($this->bootmenulist)==0)
@@ -102,8 +108,14 @@
<?php endif; ?>
</div>
<div class='title'><?php echo $this->escape($bootmenu->getTitle()); ?></div>
- <div class='subtitle'><?php echo count($this->bootmenuentrylist[$bootmenu->getID()]);?> Entrys - <?php echo $this->escape($bootmenu->getCreated()); ?></div>
- <div class='details dispnone'>
+ <div class='subtitle'><?php echo count($this->bootmenuentrylist[$bootmenu->getID()]);?> Entrys -
+ Startcounter: <?php echo $this->escape($bootmenu->getStartcounter()); ?> - <?php echo $this->escape($bootmenu->getCreated()); ?></div>
+ <?php
+ $class='';
+ if($this->type != 'own')
+ $class=' dispnone';
+ ?>
+ <div class='details<?php echo $class;?>'>
<?php if(Pbs_Acl::checkRight('booai')): ?>
<label>BootmenuID</label>
<div class='item'><?php echo $this->escape($bootmenu->getID()); ?></div>
diff --git a/application/modules/user/views/scripts/bootos/index.phtml b/application/modules/user/views/scripts/bootos/index.phtml
index 94e35c0..c0f201e 100644
--- a/application/modules/user/views/scripts/bootos/index.phtml
+++ b/application/modules/user/views/scripts/bootos/index.phtml
@@ -1,5 +1,8 @@
-<h1>BootOS</h1>
+<h1>BootOS<img class='helpericon' src='/media/img/bulb_off.png' /></h1>
<?php if($this->notification != ''){echo $this->notification;} ?>
+
+<div class='helper infobox'>Here you can see all available BootOs you can select to start. Before you can boot one of these you have to add it to your BootMenu.</div>
+
<?php echo $this->searchform; ?>
<?php if(Pbs_Acl::checkRight('bou')): ?>
@@ -27,8 +30,7 @@
<div class='code'>share</div>
<div class='code'>shortname</div>
<div class='code'>source</div>
- <?php endif; ?>
-
+ <?php endif; ?>
<div class='code'>title</div>
<div class='code'>groupID</div>
<div class='code'>description</div>
diff --git a/application/modules/user/views/scripts/client/index.phtml b/application/modules/user/views/scripts/client/index.phtml
index b519140..6f7a806 100644
--- a/application/modules/user/views/scripts/client/index.phtml
+++ b/application/modules/user/views/scripts/client/index.phtml
@@ -11,6 +11,7 @@
<div class='code'>clientID</div>
<div class='code'>macadress</div>
<div class='code'>hardwarehash</div>
+ <div class='code'>created</div>
</div>
<div class='listelement'>
@@ -55,6 +56,8 @@
<div class='item'><?php echo $this->escape($client['macadress']) ?></div>
<label>Hardwarehash</label>
<div class='item'><?php echo $this->escape($client['hardwarehash']) ?></div>
+ <label>Created</label>
+ <div class='item'><?php echo $this->escape($client['created']) ?></div>
</div>
</div>
<div class='clear'></div>
diff --git a/application/modules/user/views/scripts/config/index.phtml b/application/modules/user/views/scripts/config/index.phtml
index 8361ffd..bfcce9f 100644
--- a/application/modules/user/views/scripts/config/index.phtml
+++ b/application/modules/user/views/scripts/config/index.phtml
@@ -1,5 +1,10 @@
-<h1>Config</h1>
+<h1>Config<?php if(Pbs_Acl::checkRight('csui')): ?><img class='helpericon' src='/media/img/bulb_off.png' /><?php endif; ?></h1>
<?php if($this->notification != ''){echo $this->notification;} ?>
+
+<?php if(Pbs_Acl::checkRight('csui')): ?>
+<div class='helper infobox'>Here you the the available Configs which you can select to your BootOS. The Config does some modification to the selected BootOs after the start. In Most Cases you don't have to change here anything.</div>
+<?php endif; ?>
+
<?php echo $this->searchform; ?>
<?php $conflabel = $this->type == 'own'?'group':'own';?>
diff --git a/application/modules/user/views/scripts/person/edit.phtml b/application/modules/user/views/scripts/person/edit.phtml
index 3e666d4..76316db 100644
--- a/application/modules/user/views/scripts/person/edit.phtml
+++ b/application/modules/user/views/scripts/person/edit.phtml
@@ -2,4 +2,4 @@
<?php
$this->editForm->setAction($this->url());
echo $this->editForm;
-?> \ No newline at end of file
+?>
diff --git a/application/modules/user/views/scripts/person/owndetails.phtml b/application/modules/user/views/scripts/person/owndetails.phtml
index 3f1cfb4..60364c0 100644
--- a/application/modules/user/views/scripts/person/owndetails.phtml
+++ b/application/modules/user/views/scripts/person/owndetails.phtml
@@ -74,7 +74,7 @@ if(count($this->groups)==0)
<label>Role</label>
<div class='item'><?php echo $group['role']; ?>&nbsp;</div>
</div>
- <?php if($this->apikeys[$group['groupID']] != null):?>
+ <?php if(isset($this->apikeys[$group['groupID']]) && $this->apikeys[$group['groupID']] != null):?>
<div class='details'>
<label>API-Key</label>
<div class='item'><?php echo $this->apikeys[$group['groupID']]; ?>&nbsp;</div>
diff --git a/application/modules/user/views/scripts/pool/index.phtml b/application/modules/user/views/scripts/pool/index.phtml
index 56ae8d5..f78df6a 100644
--- a/application/modules/user/views/scripts/pool/index.phtml
+++ b/application/modules/user/views/scripts/pool/index.phtml
@@ -144,7 +144,7 @@
<div class='content'>
<div class='actions'>
<?php if(Pbs_Acl::checkRight('polc')):?>
- <select onChange="location.href=this.options[this.selectedIndex].value">
+ Pool:<select onChange="location.href=this.options[this.selectedIndex].value">
<option></option>
<?php foreach ($this->pools as $pool): ?>
<option value="<?php echo $this->url(
@@ -165,9 +165,11 @@
</div>
<div class='details'>
<label>MacAdress</label>
- <div class='item'><?php echo $client['macadress']; ?></div>
+ <div class='item'><?php echo $this->escape($client['macadress']); ?></div>
<label>HardwareHash</label>
- <div class='item'><?php echo $client['hardwarehash']; ?></div>
+ <div class='item'><?php echo $this->escape($client['hardwarehash']); ?></div>
+ <label>Created</label>
+ <div class='item'><?php echo $this->escape($client['created']) ?></div>
</div>
</div>
<div class='clear'></div>
diff --git a/application/modules/user/views/scripts/role/index.phtml b/application/modules/user/views/scripts/role/index.phtml
index 580238f..6dc0707 100644
--- a/application/modules/user/views/scripts/role/index.phtml
+++ b/application/modules/user/views/scripts/role/index.phtml
@@ -68,8 +68,8 @@
<?php } ?>
</div>
- <div class='title'><?php echo "[".$i."] ";?><?php echo $role->getTitle();?></div>
- <div class='subtitle'><?php echo $role->getDescription(); ?>&nbsp;</div></div>
+ <div class='title'><?php echo $role->getTitle();?></div>
+ <div class='subtitle'><?php echo $i." - ";?><?php echo $role->getDescription(); ?>&nbsp;</div></div>
<div class='clear'></div>
</div>
<?php endforeach ?>
diff --git a/application/modules/user/views/scripts/role/show.phtml b/application/modules/user/views/scripts/role/show.phtml
index 0e440f2..d6fb6cb 100644
--- a/application/modules/user/views/scripts/role/show.phtml
+++ b/application/modules/user/views/scripts/role/show.phtml
@@ -58,7 +58,7 @@ if(count($this->rightsList)==0) {
<?php
if(isset($this->rightcategorieslist)) {
foreach($this->rightcategorieslist as $k => $v):
- $rights = $this->rightsList[$k];
+ @$rights = $this->rightsList[$k];
if(count($rights) > 0) {
?>
<h3><?php echo $v; ?>:</h3>