diff --git a/CHANGELOG b/CHANGELOG index 4315ae6d1..3c3db7003 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -39,12 +39,13 @@ Version 1.1.3 to be released - Enh #1202: Added support for using anonymous functions as component property values (Qiang) - Enh #1203: Gii now respects the newDirMode and newFileMode settings even when lower umask is set (Qiang) - Enh #1225: Added 'firstError' option to CHtml::errorSummary() to support displaying only the first error message of each model attribute (Qiang) +- Enh #1232: Added CAuthManager::showErrors. When value is true Yii will turn on error_reporting for RBAC bizRules. False by default (Sam Dark) +- Enh #1239: CBreadcrumbs should have the 'Home' label translated (Qiang) +- Enh #1261: Added magicFile parameter to CFileHelper::getMimeType() and getMimeTypeByExtension() (Qiang) - Enh #1268: Added isset and unset support to behavior properties in a component context (Qiang) - Enh #1271: Added CWebUser::getFlashes() (Qiang) - Enh #1276: Added CClientScript::coreScriptPosition to support customizing the insertion position of core scripts (Qiang) - Enh #1278: Gii model generator will now respect the table prefix when determining which tables the models should be generated for (Qiang) -- Enh #1232: Added CAuthManager::showErrors. When value is true Yii will turn on error_reporting for RBAC bizRules. False by default (Sam Dark) -- Enh #1239: CBreadcrumbs should have the 'Home' label translated (Qiang) - Enh #1283: Added port and securePort properties to CHttpRequest (Qiang) - Enh #1284: Added support to allow passing an AR finder as the first parameter of the constructor of CActiveDataProvider (Qiang) - Enh #1286: Upgraded HTMLPurifier to v4.1.1 (Qiang) diff --git a/framework/utils/CFileHelper.php b/framework/utils/CFileHelper.php index 02cb77668..88bb81f7f 100644 --- a/framework/utils/CFileHelper.php +++ b/framework/utils/CFileHelper.php @@ -207,13 +207,16 @@ class CFileHelper *
  • {@link getMimeTypeByExtension}
  • * * @param string the file name. + * @param string name of a magic database file, usually something like /path/to/magic.mime. + * This will be passed as the second parameter to {@link http://php.net/manual/en/function.finfo-open.php finfo_open}. + * This parameter has been available since version 1.1.3. * @return string the MIME type. Null is returned if the MIME type cannot be determined. */ - public static function getMimeType($file) + public static function getMimeType($file,$magicFile=null) { if(function_exists('finfo_open')) { - if(($info=finfo_open(FILEINFO_MIME)) && ($result=finfo_file($info,$file))!==false) + if(($info=finfo_open(FILEINFO_MIME_TYPE,$magicFile)) && ($result=finfo_file($info,$file))!==false) return $result; } @@ -227,13 +230,16 @@ class CFileHelper * Determines the MIME type based on the extension name of the specified file. * This method will use a local map between extension name and MIME type. * @param string the file name. + * @param string the path of the file that contains all available MIME type information. + * If this is not set, the default 'system.utils.mimeTypes' file will be used. + * This parameter has been available since version 1.1.3. * @return string the MIME type. Null is returned if the MIME type cannot be determined. */ - public static function getMimeTypeByExtension($file) + public static function getMimeTypeByExtension($file,$magicFile=null) { static $extensions; if($extensions===null) - $extensions=require(Yii::getPathOfAlias('system.utils.mimeTypes').'.php'); + $extensions=$magicFile===null ? require(Yii::getPathOfAlias('system.utils.mimeTypes').'.php') : $magicFile; if(($pos=strrpos($file,'.'))!==false) { $ext=strtolower(substr($file,$pos+1));