From 2b8fa32bf5361e8b18fed65f9082b699d7aede00 Mon Sep 17 00:00:00 2001 From: Dan Dart Date: Sun, 27 Mar 2011 20:47:51 +0100 Subject: [PATCH] test of oauth --- .../app/controllers/StatusController.php | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/application/modules/app/controllers/StatusController.php b/application/modules/app/controllers/StatusController.php index bb52496..b24dc13 100644 --- a/application/modules/app/controllers/StatusController.php +++ b/application/modules/app/controllers/StatusController.php @@ -11,16 +11,25 @@ class App_StatusController extends ZB_Controller_Action_App private $_update_url = 'http://twitter.com/statuses/update.json'; private $_callback = 'http://zetabud.dandart.co.uk/app/status/callback'; - private $_config = array( - 'callbackUrl' => $this->_callback, - 'siteUrl' => $this->_site_url, - 'consumerKey' => $this->_consumer_key, - 'consumerSecret' => $this->_consumer_secret - ); + private $_config; + + + public function preDispatch() + { + $this->_config = array( + 'callbackUrl' => $this->_callback, + 'siteUrl' => $this->_site_url, + 'consumerKey' => $this->_consumer_key, + 'consumerSecret' => $this->_consumer_secret + ); + } public function indexAction() { - if(!is_null($_SESSION['ACCESS_TOKEN')) + $this->requireLogin(); + $this->view->assign('apptitle', 'Social Status'); + + if(isset($_SESSION['ACCESS_TOKEN'])) { $this->_redirect('/app/status/post'); } @@ -74,9 +83,4 @@ public function callbackAction() } - public function indexAction() - { - $this->requireLogin(); - $this->view->assign('apptitle', 'Social Status'); - } }