mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +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:
25
class2.php
25
class2.php
@@ -11,9 +11,9 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/class2.php,v $
|
| $Source: /cvs_backup/e107_0.8/class2.php,v $
|
||||||
| $Revision: 1.51 $
|
| $Revision: 1.52 $
|
||||||
| $Date: 2008-03-13 19:15:56 $
|
| $Date: 2008-04-26 02:12:13 $
|
||||||
| $Author: lisa_ $
|
| $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']))){
|
if($_SERVER['HTTP_HOST'] && is_numeric(str_replace(".","",$_SERVER['HTTP_HOST']))){
|
||||||
$srvtmp = ""; // Host is an IP address.
|
$srvtmp = ""; // Host is an IP address.
|
||||||
}else{
|
}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.
|
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);
|
e107_ini_set("session.cookie_domain",".".e_DOMAIN);
|
||||||
require_once(e_HANDLER."language_class.php");
|
require_once(e_HANDLER."language_class.php");
|
||||||
$lng = new language;
|
$lng = new language;
|
||||||
if(e_SUBDOMAIN == "www" || e_SUBDOMAIN === FALSE)
|
if(!e_SUBDOMAIN)
|
||||||
{
|
{
|
||||||
$GLOBALS['elan'] = $pref['sitelanguage'];
|
$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.
|
// 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!
|
// And, this is robust against hack attacks. Malignant users can put **anything** in HTTP_HOST!
|
||||||
if($pref['redirectsiteurl'] && $pref['siteurl']) {
|
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
|
// Find domain and port from user and from pref
|
||||||
list($urlbase,$urlport) = explode(':',$_SERVER['HTTP_HOST'].':');
|
list($urlbase,$urlport) = explode(':',$_SERVER['HTTP_HOST'].':');
|
||||||
if (!$urlport) { $urlport = $_SERVER['SERVER_PORT']; }
|
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
|
header("Location: {$location}", true, 301); // send 301 header, not 302
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$page = substr(strrchr($_SERVER['PHP_SELF'], "/"), 1);
|
$page = substr(strrchr($_SERVER['PHP_SELF'], "/"), 1);
|
||||||
|
Reference in New Issue
Block a user