Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added a cross-(sub) domain cookie (fixes infinite redirect issue when switching from mobile site to full site on an iPhone) #4

Merged
merged 1 commit into from

2 participants

@candidasa

BUGFIX: adding a cross-(sub) domain cookie (fixes infinite redirect issue when switching from mobile site to full site on an iPhone)

@candidasa candidasa BUGFIX: adding a cross-(sub) domain cookie (fixes infinite redirect i…
…ssue when switching from mobile site to full site on an iPhone)
e642a33
@halkyon halkyon merged commit 3afff28 into silverstripe:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 22, 2011
  1. @candidasa

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

    candidasa authored
    …ssue when switching from mobile site to full site on an iPhone)
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 1 deletion.
  1. +8 −1 code/MobileSiteControllerExtension.php
View
9 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
Something went wrong with that request. Please try again.