Correcting env('HTTP_BASE') ensuring that when used with no subdomain (http://example.com) it does not return '.com' as the HTTP_BASE

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7679 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
AD7six 2008-09-29 18:01:52 +00:00
parent badfb42c6a
commit 2cb2ca554c
2 changed files with 70 additions and 2 deletions

View file

@ -402,7 +402,11 @@ if (!function_exists('array_combine')) {
return (PHP_SAPI == 'cgi');
break;
case 'HTTP_BASE':
return preg_replace ('/^([^.])*/i', null, env('HTTP_HOST'));
$host = env('HTTP_HOST');
if (substr_count($host, '.') != 1) {
return preg_replace ('/^([^.])*/i', null, env('HTTP_HOST'));
}
return '.' . $host;
break;
}
return null;
@ -918,4 +922,4 @@ if (!function_exists('file_put_contents')) {
}
return $val2;
}
?>
?>