Updated and improved StaticExporter

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@42536 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2007-09-25 03:44:07 +00:00
parent 0bf09f0df0
commit fad2ab3eda
3 changed files with 8 additions and 2 deletions

View File

@ -160,7 +160,7 @@ class HTTP {
global $global_mimetypes; global $global_mimetypes;
if(!$global_mimetypes) self::loadMimeTypes(); if(!$global_mimetypes) self::loadMimeTypes();
$ext = strtolower(substr($filename,strrpos($filename,'.')+1)); $ext = strtolower(substr($filename,strrpos($filename,'.')+1));
return $global_mimetypes[$ext]; if(isset($global_mimetypes[$ext])) return $global_mimetypes[$ext];
} }
/* /*

View File

@ -190,6 +190,12 @@ class Director {
} }
static function protocolAndHost() { static function protocolAndHost() {
if(self::$alternateBaseURL) {
if(preg_match('/^(http[^:]*:\/\/[^/]+)\//1', self::$alternateBaseURL, $matches)) {
return $matches[1];
}
}
$s = (isset($_SERVER['SSL']) || isset($_SERVER['HTTPS'])) ? 's' : ''; $s = (isset($_SERVER['SSL']) || isset($_SERVER['HTTPS'])) ? 's' : '';
return "http$s://" . $_SERVER['HTTP_HOST']; return "http$s://" . $_SERVER['HTTP_HOST'];
} }

View File

@ -15,7 +15,7 @@ class Filesystem extends Object {
static function removeFolder( $folder ) { static function removeFolder( $folder ) {
// remove a file encountered by a recursive call. // remove a file encountered by a recursive call.
if( !is_dir( $folder ) ) if( !is_dir( $folder ) || is_link($folder) )
unlink( $folder ); unlink( $folder );
else { else {