Index: branches/5.1.x/core/editor/editor/filemanager/connectors/php/util.php =================================================================== diff -u -N -r13086 -r14241 --- branches/5.1.x/core/editor/editor/filemanager/connectors/php/util.php (.../util.php) (revision 13086) +++ branches/5.1.x/core/editor/editor/filemanager/connectors/php/util.php (.../util.php) (revision 14241) @@ -1,218 +1,218 @@ - $val ) - { - $lcaseHtmlExtensions[$key] = strtolower( $val ) ; - } - return in_array( $ext, $lcaseHtmlExtensions ) ; -} - -/** - * Detect HTML in the first KB to prevent against potential security issue with - * IE/Safari/Opera file type auto detection bug. - * Returns true if file contain insecure HTML code at the beginning. - * - * @param string $filePath absolute path to file - * @return boolean - */ -function DetectHtml( $filePath ) -{ - $fp = @fopen( $filePath, 'rb' ) ; - - //open_basedir restriction, see #1906 - if ( $fp === false || !flock( $fp, LOCK_SH ) ) - { - return -1 ; - } - - $chunk = fread( $fp, 1024 ) ; - flock( $fp, LOCK_UN ) ; - fclose( $fp ) ; - - $chunk = strtolower( $chunk ) ; - - if (!$chunk) - { - return false ; - } - - $chunk = trim( $chunk ) ; - - if ( preg_match( "/= 4.0.7 - if ( function_exists( 'version_compare' ) ) { - $sCurrentVersion = phpversion(); - if ( version_compare( $sCurrentVersion, "4.2.0" ) >= 0 ) { - $imageCheckExtensions[] = "tiff"; - $imageCheckExtensions[] = "tif"; - } - if ( version_compare( $sCurrentVersion, "4.3.0" ) >= 0 ) { - $imageCheckExtensions[] = "swc"; - } - if ( version_compare( $sCurrentVersion, "4.3.2" ) >= 0 ) { - $imageCheckExtensions[] = "jpc"; - $imageCheckExtensions[] = "jp2"; - $imageCheckExtensions[] = "jpx"; - $imageCheckExtensions[] = "jb2"; - $imageCheckExtensions[] = "xbm"; - $imageCheckExtensions[] = "wbmp"; - } - } - - if ( !in_array( $extension, $imageCheckExtensions ) ) { - return true; - } - - if ( @getimagesize( $filePath ) === false ) { - return false ; - } - - return true; + $val ) + { + $lcaseHtmlExtensions[$key] = strtolower( $val ) ; + } + return in_array( $ext, $lcaseHtmlExtensions ) ; +} + +/** + * Detect HTML in the first KB to prevent against potential security issue with + * IE/Safari/Opera file type auto detection bug. + * Returns true if file contain insecure HTML code at the beginning. + * + * @param string $filePath absolute path to file + * @return boolean + */ +function DetectHtml( $filePath ) +{ + $fp = @fopen( $filePath, 'rb' ) ; + + //open_basedir restriction, see #1906 + if ( $fp === false || !flock( $fp, LOCK_SH ) ) + { + return -1 ; + } + + $chunk = fread( $fp, 1024 ) ; + flock( $fp, LOCK_UN ) ; + fclose( $fp ) ; + + $chunk = strtolower( $chunk ) ; + + if (!$chunk) + { + return false ; + } + + $chunk = trim( $chunk ) ; + + if ( preg_match( "/= 4.0.7 + if ( function_exists( 'version_compare' ) ) { + $sCurrentVersion = phpversion(); + if ( version_compare( $sCurrentVersion, "4.2.0" ) >= 0 ) { + $imageCheckExtensions[] = "tiff"; + $imageCheckExtensions[] = "tif"; + } + if ( version_compare( $sCurrentVersion, "4.3.0" ) >= 0 ) { + $imageCheckExtensions[] = "swc"; + } + if ( version_compare( $sCurrentVersion, "4.3.2" ) >= 0 ) { + $imageCheckExtensions[] = "jpc"; + $imageCheckExtensions[] = "jp2"; + $imageCheckExtensions[] = "jpx"; + $imageCheckExtensions[] = "jb2"; + $imageCheckExtensions[] = "xbm"; + $imageCheckExtensions[] = "wbmp"; + } + } + + if ( !in_array( $extension, $imageCheckExtensions ) ) { + return true; + } + + if ( @getimagesize( $filePath ) === false ) { + return false ; + } + + return true; } \ No newline at end of file