Permalink
Browse files

BUGFIX: adding a cross-(sub) domain cookie (fixes infinite redirect i…

…ssue when switching from mobile site to full site on an iPhone)
  • Loading branch information...
1 parent 49b98e5 commit e642a33c7f42c5141b07bb9715402848597a2998 Julian Seidenberg committed Aug 22, 2011
Showing with 8 additions and 1 deletion.
  1. +8 −1 code/MobileSiteControllerExtension.php
@@ -36,7 +36,14 @@ public function onAfterInit() {
if(isset($_GET['fullSite'])) {
$fullSite = (int)$_GET['fullSite'];
$_COOKIE['fullSite'] = $fullSite;
- setcookie('fullSite', $fullSite, time() + self::$cookie_expire_time);
+
+ //use the host of the desktop version of the site to set cross-(sub)domain cookie
+ if (!empty($config->FullSiteDomain)) {
+ $parsedURL = parse_url($config->FullSiteDomain);
+ setcookie('fullSite', $fullSite, time() + self::$cookie_expire_time,null,'.'.$parsedURL['host']);
+ } else { //otherwise just use a normal cookie with the default domain
+ setcookie('fullSite', $fullSite, time() + self::$cookie_expire_time);
+ }
}
// Site is being forced via flag or cookie

0 comments on commit e642a33

Please sign in to comment.