From b42b2eeb74c4834c016062add25e1edbd830f482 Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Thu, 30 Jun 2011 12:25:31 +0200 Subject: apikey und apipath nun auch in der application.ini --- application/configs/application.ini.dist | 9 ++++++++- application/controllers/EventController.php | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/application/configs/application.ini.dist b/application/configs/application.ini.dist index 31b0843..dec2a7d 100644 --- a/application/configs/application.ini.dist +++ b/application/configs/application.ini.dist @@ -15,7 +15,14 @@ resources.db.params.dbname = resources.db.isDefaultTableAdapter = true resources.view[] = "" resources.modules = "" -pbs2.host = +pbs2.host = +pbs2.apikey = +pbs2.getbootoss = /resource/getbootos/apikey/ +pbs2.getpools = /resource/getpool/apikey/ +pbs2.addbootmenu = /resource/addbootmenu/apikey/ +pbs2.deletebootmenu = /resource/deletebootmenu/apikey/ +pbs2.addfilter = /resource/addfilter/apikey/ +pbs2.deletefilter = /resource/deletefilter/apikey/ resources.layout.layout = "default" resources.layout.layoutPath = APPLICATION_PATH "/layouts" diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php index 09d08e2..4d4759d 100644 --- a/application/controllers/EventController.php +++ b/application/controllers/EventController.php @@ -34,7 +34,7 @@ class EventController extends Zend_Controller_Action { $events = $this->eventMapper->fetchAll(); if(is_array($events)) { - $bootOsApiResult = PostToHost($this->pbs2host, '/resource/getbootos/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', ''); + $bootOsApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getbootoss'] . $this->config['pbs2']['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', ''); $bootOsXMLString = $bootOsApiResult['http-body']; $bootOsXML = new SimpleXMLElement($bootOsXMLString); foreach($bootOsXML->bootoslist->bootos as $bootos) { @@ -55,7 +55,7 @@ class EventController extends Zend_Controller_Action $bootosobj->setTitle(sprintf("%s", $bootos->title)); $bootoslist[$bootosobj->getID()] = $bootosobj; } - $poolApiResult = PostToHost($this->pbs2host, '/resource/getpool/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', ''); + $poolApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getpools'] . $this->config['pbs2']['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', ''); $poolXMLString = $poolApiResult['http-body']; $poolXML = new SimpleXMLElement($poolXMLString); foreach($poolXML->poollist->pool as $pool) { @@ -90,7 +90,7 @@ class EventController extends Zend_Controller_Action public function addAction() { $eventcategorylist = $this->eventcategoryMapper->fetchAll(); - $bootOsApiResult = PostToHost($this->pbs2host, '/resource/getbootos/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', ''); + $bootOsApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getbootoss'] . $this->config['pbs2']['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', ''); $bootOsXMLString = $bootOsApiResult['http-body']; $bootOsXML = new SimpleXMLElement($bootOsXMLString); foreach($bootOsXML->bootoslist->bootos as $bootos) { @@ -111,7 +111,7 @@ class EventController extends Zend_Controller_Action $bootosobj->setTitle(sprintf("%s", $bootos->title)); $bootoslist[$bootosobj->getID()] = $bootosobj; } - $poolApiResult = PostToHost($this->pbs2host, '/resource/getpool/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', ''); + $poolApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getpools'] . $this->config['pbs2']['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', ''); $poolXMLString = $poolApiResult['http-body']; $poolXML = new SimpleXMLElement($poolXMLString); foreach($poolXML->poollist->pool as $pool) { @@ -134,7 +134,7 @@ class EventController extends Zend_Controller_Action $event = new Application_Model_Event($this->getRequest()->getParams()); $event->setPbs_membershipID(1); $bootmenuquery = "bootosID=" . $event->getPbs_bootosID() . "&startcounter=0&title=" . $event->getTitle() . "&defaultbootmenu=1&order=0&kcl=0"; - $bootmenuApiResult = PostToHost($this->pbs2host, '/resource/addbootmenu/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $bootmenuquery); + $bootmenuApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['addbootmenu'] . $this->config['pbs2']['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $bootmenuquery); $bootmenuXMLString = $bootmenuApiResult['http-body']; $bootmenuXML = new SimpleXMLElement($bootmenuXMLString); $bootmenuID = sprintf("%s", $bootmenuXML->bootmenuid); @@ -163,10 +163,10 @@ class EventController extends Zend_Controller_Action if(isset($eventID)) { $event = new Application_Model_Event(); if($event->getPbs_bootmenuID()) { - $bootmenuApiResult = PostToHost($this->pbs2host, '/resource/deletebootmenu/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "bootmenuid=" . $event->getPbs_bootmenuID()); + $bootmenuApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['deletebootmenu'] . $this->config['pbs2']['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "bootmenuid=" . $event->getPbs_bootmenuID()); } if($event->getPbs_filterID()) { - $filterApiResult = PostToHost($this->pbs2host, '/resource/deletefilter/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "bootmenuid=" . $event->getPbs_filterID()); + $filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['deletefilter'] . $this->config['pbs2']['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "bootmenuid=" . $event->getPbs_filterID()); } $this->eventMapper->find($eventID, $event); try { @@ -187,7 +187,7 @@ class EventController extends Zend_Controller_Action public function editAction() { $eventcategorylist = $this->eventcategoryMapper->fetchAll(); - $bootOsApiResult = PostToHost($this->pbs2host, '/resource/getbootos/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', ''); + $bootOsApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getbootoss'] . $this->config['pbs2']['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', ''); $bootOsXMLString = $bootOsApiResult['http-body']; $bootOsXML = new SimpleXMLElement($bootOsXMLString); foreach($bootOsXML->bootoslist->bootos as $bootos) { @@ -208,7 +208,7 @@ class EventController extends Zend_Controller_Action $bootosobj->setTitle(sprintf("%s", $bootos->title)); $bootoslist[$bootosobj->getID()] = $bootosobj; } - $poolApiResult = PostToHost($this->pbs2host, '/resource/getpool/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', ''); + $poolApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getbootoss'] . $this->config['pbs2']['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', ''); $poolXMLString = $poolApiResult['http-body']; $poolXML = new SimpleXMLElement($poolXMLString); foreach($poolXML->poollist->pool as $pool) { @@ -234,17 +234,17 @@ class EventController extends Zend_Controller_Action $event = new Application_Model_Event(); $this->eventMapper->find($eventID, $event); if($event->getPbs_bootmenuID()) { - $bootmenuApiResult = PostToHost($this->pbs2host, '/resource/deletebootmenu/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "bootmenuid=" . $event->getPbs_bootmenuID()); + $bootmenuApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['deletebootmenu'] . $this->config['pbs2']['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "bootmenuid=" . $event->getPbs_bootmenuID()); unset($bootmenuApiResult); } if($event->getPbs_filterID()) { - $filterApiResult = PostToHost($this->pbs2host, '/resource/deletefilter/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "bootmenuid=" . $event->getPbs_filterID()); + $filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['deletefilter'] . $this->config['pbs2']['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "bootmenuid=" . $event->getPbs_filterID()); unset($filterApiResult); } $event->setOptions($this->getRequest()->getParams()); $event->setID($eventID); $bootmenuquery = "bootosID=" . $event->getPbs_bootosID() . "&startcounter=0&title=" . $event->getTitle() . "&defaultbootmenu=1&order=0&kcl=0"; - $bootmenuApiResult = PostToHost($this->pbs2host, '/resource/addbootmenu/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $bootmenuquery); + $bootmenuApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['addbootmenu'] . $this->config['pbs2']['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $bootmenuquery); $bootmenuXMLString = $bootmenuApiResult['http-body']; $bootmenuXML = new SimpleXMLElement($bootmenuXMLString); $bootmenuID = sprintf("%s", $bootmenuXML->bootmenuid); -- cgit v1.2.3-55-g7522