From 6c24d394916e26a91a95224a1d4cd8f22960695d Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 29 Oct 2012 18:27:29 +0100 Subject: Fix bug #3 --- app/controllers/indexController.php | 64 +++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 28 deletions(-) (limited to 'app/controllers/indexController.php') diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php index a1b02196d..a4e81ab90 100755 --- a/app/controllers/indexController.php +++ b/app/controllers/indexController.php @@ -20,7 +20,15 @@ class indexController extends ActionController { } elseif ($get != false) { $entries = $entryDAO->listByCategory ($get, $mode, $order); $cat = $catDAO->searchById ($get); - View::prependTitle ($cat->name () . ' - '); + + if ($cat) { + View::prependTitle ($cat->name () . ' - '); + } else { + Error::error ( + 404, + array ('error' => array ('La page que vous cherchez n\'existe pas')) + ); + } } else { View::prependTitle ('Vos flux RSS - '); } @@ -55,33 +63,33 @@ class indexController extends ActionController { } public function loginAction () { - $this->view->_useLayout (false); - - $url = 'https://verifier.login.persona.org/verify'; - $assert = Request::param ('assertion'); - $params = 'assertion=' . $assert . '&audience=' . - urlencode (Url::display () . ':80'); - $ch = curl_init (); - $options = array ( - CURLOPT_URL => $url, - CURLOPT_RETURNTRANSFER => TRUE, - CURLOPT_POST => 2, - CURLOPT_POSTFIELDS => $params - ); - curl_setopt_array ($ch, $options); - $result = curl_exec ($ch); - curl_close ($ch); - - $res = json_decode ($result, true); - if ($res['status'] == 'okay' && $res['email'] == $this->view->conf->mailLogin ()) { - Session::_param ('mail', $res['email']); - } else { - $res = array (); - $res['status'] = 'failure'; - $res['reason'] = 'L\'identifiant est invalide'; - } - - $this->view->res = json_encode ($res); + $this->view->_useLayout (false); + + $url = 'https://verifier.login.persona.org/verify'; + $assert = Request::param ('assertion'); + $params = 'assertion=' . $assert . '&audience=' . + urlencode (Url::display () . ':80'); + $ch = curl_init (); + $options = array ( + CURLOPT_URL => $url, + CURLOPT_RETURNTRANSFER => TRUE, + CURLOPT_POST => 2, + CURLOPT_POSTFIELDS => $params + ); + curl_setopt_array ($ch, $options); + $result = curl_exec ($ch); + curl_close ($ch); + + $res = json_decode ($result, true); + if ($res['status'] == 'okay' && $res['email'] == $this->view->conf->mailLogin ()) { + Session::_param ('mail', $res['email']); + } else { + $res = array (); + $res['status'] = 'failure'; + $res['reason'] = 'L\'identifiant est invalide'; + } + + $this->view->res = json_encode ($res); } public function logoutAction () { -- cgit v1.2.3