aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/indexController.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2012-10-29 18:27:29 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2012-10-29 18:27:29 +0100
commit6c24d394916e26a91a95224a1d4cd8f22960695d (patch)
tree92931cd71e52c6c015599d1bd6f6289b251d7991 /app/controllers/indexController.php
parent4d21eb67468a83c849b1bbf683eec1a573aacf04 (diff)
Fix bug #3
Diffstat (limited to 'app/controllers/indexController.php')
-rwxr-xr-xapp/controllers/indexController.php64
1 files changed, 36 insertions, 28 deletions
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 () {