diff options
| author | michael pereira | 2011-04-20 18:49:49 +0200 |
|---|---|---|
| committer | michael pereira | 2011-04-20 18:49:49 +0200 |
| commit | cc3660add480ac1dc217d7f853b325db7d6ec7d0 (patch) | |
| tree | 8056c87777d806c613a607c3f479ce07475b5db6 /application/controllers | |
| parent | API + Fixes (diff) | |
| parent | Url für Config gekürzt (diff) | |
| download | pbs2-cc3660add480ac1dc217d7f853b325db7d6ec7d0.tar.gz pbs2-cc3660add480ac1dc217d7f853b325db7d6ec7d0.tar.xz pbs2-cc3660add480ac1dc217d7f853b325db7d6ec7d0.zip | |
merges
Diffstat (limited to 'application/controllers')
| -rw-r--r-- | application/controllers/ErrorController.php | 7 | ||||
| -rw-r--r-- | application/controllers/IndexController.php | 40 | ||||
| -rw-r--r-- | application/controllers/ResourceController.php | 18 | ||||
| -rw-r--r-- | application/controllers/StatsController.php | 34 |
4 files changed, 51 insertions, 48 deletions
diff --git a/application/controllers/ErrorController.php b/application/controllers/ErrorController.php index 0dfcdb3..abf3ec1 100644 --- a/application/controllers/ErrorController.php +++ b/application/controllers/ErrorController.php @@ -25,13 +25,14 @@ class ErrorController extends Zend_Controller_Action // 404 error -- controller or action not found $this->getResponse()->setHttpResponseCode(404); $this->view->message = 'Page not found'; - print_a($errors); + $this->_redirect('/user/'); + # print_a($errors); break; default: // application error $this->getResponse()->setHttpResponseCode(500); - $this->view->message = 'Application error'; - print_a($errors); + $this->view->message = 'Application error - Please contact the admin'; + # print_a($errors); break; } diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php index c6e6eba..5120d6f 100644 --- a/application/controllers/IndexController.php +++ b/application/controllers/IndexController.php @@ -13,31 +13,31 @@ class IndexController extends Zend_Controller_Action { - public function init() - { - /* Initialize action controller here */ - } - - public function indexAction() - { - if(stristr($_SERVER['HTTP_USER_AGENT'],'prebootGUI')){ - $mySession =new Zend_Session_Namespace('pbs'); - if(!isset($mySession->postdata)){ - $mySession->postdata = $_POST; + public function init() + { + /* Initialize action controller here */ + } + + public function indexAction() + { + if(stristr($_SERVER['HTTP_USER_AGENT'],'prebootGUI')){ + $mySession =new Zend_Session_Namespace('pbs'); + if(!isset($mySession->postdata)){ + $mySession->postdata = $_POST; } - + $d = new Pbs_Debug(); $d->debug(array('MainIndexController',$_SERVER['REMOTE_ADDR'],implode("\t",$mySession->postdata))); - - $this->_redirect("/fbgui/index/index"); - } - - // action body - - } + $this->_redirect("/fbgui/index/index"); + } + $this->_redirect("/user/auth/login"); + // action body + + + } + - } diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php index e94d9c7..88ec38e 100644 --- a/application/controllers/ResourceController.php +++ b/application/controllers/ResourceController.php @@ -34,20 +34,24 @@ class ResourceController extends Zend_Controller_Action $membershipMapper = new Application_Model_MembershipMapper(); $this->membership = new Application_Model_Membership(); $this->rightrolesMapper = new Application_Model_RightRolesMapper(); + $rightroles = new Application_Model_RightRoles(); + @list($this->membership) = $membershipMapper->findBy(array('apikey' => $apikey)); if($this->membership == null){ header('HTTP/1.0 401 Member not found'); die(); } - + } elseif($alpha == "0"){ $bootmenuentryID = $this->_request->getParam('bootmenuentryID'); $this->page = $this->_request->getParam('page'); - if(!is_numeric($bootmenuentryID)) - $this->_redirect('/user/bootmenu/index/page/'.$this->page.'/json/error'); + + if(!is_numeric($bootmenuentryID)){ + $this->_redirect('/user/bootmenu/index/page/'.$this->page.'/json/error'); + } $bootmenuentry = new Application_Model_BootMenuEntries(); $bootmenuentryMapper = new Application_Model_BootMenuEntriesMapper(); @@ -102,7 +106,6 @@ class ResourceController extends Zend_Controller_Action header('HTTP/1.0 400 Title, Distro, Distroversion and Share must be set'); die(); } - if($_FILES['config']['size'] == 0 && $_FILES['config']['name'] != '' || $_FILES['kernel']['size'] == 0 && $_FILES['kernel']['name'] != ''|| $_FILES['init']['size'] == 0 && $_FILES['init']['name'] != ''){ header('HTTP/1.0 400 File must be larger than 0 bytes'); @@ -367,7 +370,6 @@ class ResourceController extends Zend_Controller_Action public function getconfigAction() { - $bootmenuentryID = $this->thisSession->getBootmenuentryID(); $bootmenuentry = new Application_Model_BootMenuEntries(); $bmm = new Application_Model_BootMenuEntriesMapper(); @@ -415,6 +417,7 @@ class ResourceController extends Zend_Controller_Action if($configID == null) $configID = 'default'; chdir("../resources/config/$bootosID/$configID/"); + passthru( "cat default.tgz"); } }else{ @@ -470,9 +473,9 @@ class ResourceController extends Zend_Controller_Action $kcl = $bootosmapper->find($bme->getBootosID())->getDefaultkcl(); if($bme->getKcl() && $kcl != null){ - $result = $kcl . " alpha=" . $this->_request->getParam('alpha') . " file=http://".$_SERVER['HTTP_HOST']."/resource/getconfig/alpha/".$this->_request->getParam('alpha')."/file/default.tgz ".$bme->getKclappend(); + $result = $kcl . " alpha=" . $this->_request->getParam('alpha') . " file=http://".$_SERVER['HTTP_HOST']."/c/".$this->_request->getParam('alpha')."/default.tgz ".$bme->getKclappend(); }else{ - $result = "alpha=" . $this->_request->getParam('alpha') . " file=http://".$_SERVER['HTTP_HOST']."/resource/getconfig/alpha/".$this->_request->getParam('alpha')."/file/default.tgz ".$bme->getKclappend(); + $result = "alpha=" . $this->_request->getParam('alpha') . " file=http://".$_SERVER['HTTP_HOST']."/c/".$this->_request->getParam('alpha')."/default.tgz ".$bme->getKclappend(); } header("Content-Length: ".(strlen($result))); @@ -512,7 +515,6 @@ class ResourceController extends Zend_Controller_Action } private function generateURL($action, $varname, $varvalue, $filename){ - $path = '/resource/'. $action .'/' . $varname .'/' . $varvalue .'/bootmenuentryID/'.$this->thisSession->getBootmenuentryID().'/file/' . $filename ; $path = "http://" . $_SERVER['SERVER_NAME'] . $path; return $path; diff --git a/application/controllers/StatsController.php b/application/controllers/StatsController.php index 0b180e7..05762a4 100644 --- a/application/controllers/StatsController.php +++ b/application/controllers/StatsController.php @@ -13,39 +13,39 @@ class StatsController extends Zend_Controller_Action { - public function init() - { - $this->_helper->layout->disableLayout(); + public function init() + { + $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); - } - - public function graphgroupAction(){ - - $userIDsNamespace = Zend_Session::namespaceGet('userIDs'); - + } + + public function graphgroupAction(){ + + $userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + if(isset($userIDsNamespace['groupID'])){ header("Content-Type: image/png"); - header("Expires: 0"); + header("Expires: 0"); $n = new Pbs_Graph(); - + $level = $this->_request->getParam('level'); if(is_numeric($level) && $level != ''){ $n->setHiglightLevel($level); } $groupID = $userIDsNamespace['groupID']; - + $group = $this->_request->getParam('group'); if((Pbs_Acl::checkRight('gsdo') || Pbs_Acl::checkRight('gsdog')) && is_numeric($group)){ $groupID = $group; } - + $child = $this->_request->getParam('child'); if(Pbs_Acl::checkRight('glk') && $child != ''){ $n->newChild($child); } - - echo $n->graph($groupID); - } - } + + echo $n->graph($groupID); + } + } } |
