Permalink
Browse files

Set a flag in the user session to prevent redirect loop

Particularly for private deployments, but needs testing.
  • Loading branch information...
1 parent 0a74c24 commit 0ee8cf329cded1e5cf5768cbe1b9d0b4dff46039 @rjmackay rjmackay committed Nov 4, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 hooks/mobile.php
View
@@ -39,13 +39,16 @@ public function add()
$session->set('full', 1);
}
- if ( ! $session->get('full') )
+ if ( ! $session->get('full') AND ! $session->get('mobileredirected') )
{
// If Mobile Configure Mobile Settings
if(isset($_SERVER['HTTP_USER_AGENT']) AND $this->_is_mobile()
AND strrpos(url::current(), "mobile") === FALSE
AND Router::$controller != 'api')
{
+ // Set mobileredirected flag to prevent too many redirects
+ $session->set('mobileredirected', 1);
+
// Only add the events if we are on that controller
url::redirect(url::base()."mobile");
}

0 comments on commit 0ee8cf3

Please sign in to comment.