1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 13:17:24 +02:00

Bugfix: fixed comflict between $pref['redirectsiteurl'] and $pref['multilanguage_subdomain'] - using redirectsiteurl will no longer break multilanguage capabilities. Also fixed subdomain detection when using: www.fr.siteurl.com instead of fr.siteurl.com for example.

This commit is contained in:
CaMer0n
2008-04-26 02:12:13 +00:00
parent eec8be4a21
commit 42ac38bcbd

View File

@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/class2.php,v $
| $Revision: 1.51 $
| $Date: 2008-03-13 19:15:56 $
| $Author: lisa_ $
| $Revision: 1.52 $
| $Date: 2008-04-26 02:12:13 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
//
@@ -140,7 +140,7 @@ define("MAGIC_QUOTES_GPC", (ini_get('magic_quotes_gpc') ? TRUE : FALSE));
if($_SERVER['HTTP_HOST'] && is_numeric(str_replace(".","",$_SERVER['HTTP_HOST']))){
$srvtmp = ""; // Host is an IP address.
}else{
$srvtmp = explode(".",$_SERVER['HTTP_HOST']);
$srvtmp = explode(".",str_replace("www.","",$_SERVER['HTTP_HOST']));
}
define("e_SUBDOMAIN", (count($srvtmp)>2 && $srvtmp[2] ? $srvtmp[0] : FALSE)); // needs to be available to e107_config.
@@ -399,7 +399,7 @@ if(varset($pref['multilanguage_subdomain']) && ($pref['user_tracking'] == "sessi
e107_ini_set("session.cookie_domain",".".e_DOMAIN);
require_once(e_HANDLER."language_class.php");
$lng = new language;
if(e_SUBDOMAIN == "www" || e_SUBDOMAIN === FALSE)
if(!e_SUBDOMAIN)
{
$GLOBALS['elan'] = $pref['sitelanguage'];
}
@@ -435,6 +435,18 @@ define("e_SELF", ($pref['ssl_enabled'] == '1' ? "https://".$_SERVER['HTTP_HOST']
// Now matches RFC 2616 (sec 3.2): case insensitive, https/:443 and http/:80 are equivalent.
// And, this is robust against hack attacks. Malignant users can put **anything** in HTTP_HOST!
if($pref['redirectsiteurl'] && $pref['siteurl']) {
if(isset($pref['multilanguage_subdomain']) && $pref['multilanguage_subdomain'])
{
if(substr(e_SELF,7,4)=="www." || substr(e_SELF,8,4)=="www.")
{
$location = str_replace("://www.","://",e_SELF);
header("Location: {$location}", true, 301); // send 301 header, not 302
exit();
}
}
else
{
// Find domain and port from user and from pref
list($urlbase,$urlport) = explode(':',$_SERVER['HTTP_HOST'].':');
if (!$urlport) { $urlport = $_SERVER['SERVER_PORT']; }
@@ -461,7 +473,8 @@ if($pref['redirectsiteurl'] && $pref['siteurl']) {
header("Location: {$location}", true, 301); // send 301 header, not 302
exit();
}
}
}
}
}
$page = substr(strrchr($_SERVER['PHP_SELF'], "/"), 1);