$cfg->setConfigEntry('cookie_path', dirname($_SERVER['SCRIPT_NAME']) . "/");
// CFG: COOKIE-DOMAIN
-$cfg->setConfigEntry('cookie_domain', $cfg->readConfig('base_url')); // Is mostly the same...
+$cfg->setConfigEntry('cookie_domain', $cfg->detectDomain()); // Is mostly the same...
// CFG: COOKIE-SSL
$cfg->setConfigEntry('cookie_ssl', (isset($_SERVER['HTTPS'])));
} // END - if
// Construct the full URL now and secure it against CSRF attacks
- $baseUrl = $baseUrl . "://" . htmlentities(strip_tags($_SERVER['SERVER_NAME']), ENT_QUOTES) . dirname($_SERVER['SCRIPT_NAME']);
+ $baseUrl = $baseUrl . "://" . $this->detectDomain() . dirname($_SERVER['SCRIPT_NAME']);
// Return the URL
return $baseUrl;
}
+
+ /**
+ * Detect safely and return the full domain where this script is installed
+ *
+ * @return $fullDomain The detected full domain
+ */
+ public function detectDomain () {
+ // Detect the full domain
+ $fullDomain = htmlentities(strip_tags($_SERVER['SERVER_NAME']), ENT_QUOTES);
+
+ // Return it
+ return $fullDomain;
+ }
} // END - class
// [EOF]