Révision 18596a08
Ajouté par Assos Assos il y a presque 7 ans
drupal7/sites/all/modules/media/media.module | ||
---|---|---|
1137 | 1137 |
*/ |
1138 | 1138 |
function media_file_validate_types($file, $types) { |
1139 | 1139 |
$errors = array(); |
1140 |
if (!in_array(file_get_type($file), $types)) { |
|
1140 |
|
|
1141 |
$file_candidates = array_keys(file_entity_get_filetype_candidates($file)); |
|
1142 |
if (!array_intersect($file_candidates, $types)) { |
|
1141 | 1143 |
$errors[] = t('Only the following types of files are allowed to be uploaded: %types-allowed', array('%types-allowed' => implode(', ', $types))); |
1142 | 1144 |
} |
1143 | 1145 |
|
... | ... | |
1219 | 1221 |
'fid', |
1220 | 1222 |
'id', |
1221 | 1223 |
'multiselect', |
1224 |
'field', |
|
1222 | 1225 |
'options', |
1223 | 1226 |
'plugins', |
1224 | 1227 |
'render', |
... | ... | |
1227 | 1230 |
); |
1228 | 1231 |
$params = array_intersect_key($params, array_flip($safe_options)); |
1229 | 1232 |
|
1230 |
// Retrieve the security sensitive options from the cache.
|
|
1233 |
// If the cache is present, use its values instead of the GET parameters.
|
|
1231 | 1234 |
if (!empty($params['options']) && is_string($params['options']) && $options = cache_get('media_options:' . $params['options'], 'cache_form')) { |
1232 |
$params = array_merge($options->data, $params);
|
|
1235 |
$params = $options->data;
|
|
1233 | 1236 |
} |
1234 | 1237 |
|
1235 | 1238 |
// Transform text 'true' and 'false' to actual booleans. |
Formats disponibles : Unified diff
Weekly update of contrib modules