security update for contrib modules

This commit is contained in:
2019-04-23 16:27:46 +02:00
parent 3c1b4f164e
commit 868629cbb2
729 changed files with 41254 additions and 20866 deletions
@@ -73,11 +73,17 @@ function image_features_export_render($module_name, $data, $export = NULL) {
*/
function image_features_revert($module) {
if ($default_styles = features_get_default('image', $module)) {
foreach (array_keys($default_styles) as $default_style) {
if ($style = image_style_load($default_style)) {
foreach ($default_styles as $default_style_name => $default_style) {
if ($style = image_style_load($default_style_name)) {
if ($style['storage'] != IMAGE_STORAGE_DEFAULT) {
image_default_style_revert($style);
}
else {
// Verify that the loaded style still matches what's in code.
if ($default_style['effects'] !== $style['effects']) {
image_default_style_revert($style);
}
}
}
}
}
@@ -86,16 +92,25 @@ function image_features_revert($module) {
/**
* Remove unnecessary keys for export.
*/
function _image_features_style_sanitize(&$style, $child = FALSE) {
$omit = $child ? array('isid', 'ieid', 'storage') : array('isid', 'ieid', 'storage', 'module');
if (is_array($style)) {
foreach ($style as $k => $v) {
if (in_array($k, $omit, TRUE)) {
unset($style[$k]);
}
else if (is_array($v)) {
_image_features_style_sanitize($style[$k], TRUE);
}
}
function _image_features_style_sanitize(array &$style) {
// Sanitize style: Don't export numeric IDs and things which get overwritten
// in image_styles() or are code/storage specific. The name property will be
// the key of the exported $style array.
$style = array_diff_key($style, array_flip(array(
'isid',
'name',
'module',
'storage',
)));
// Sanitize effects: all that needs to be kept is name, weight and data,
// which holds all the style-specific configuration. Other keys are assumed
// to belong to the definition of the effect itself, so not configuration.
foreach ($style['effects'] as $id => $effect) {
$style['effects'][$id] = array_intersect_key($effect, array_flip(array(
'name',
'data',
'weight',
)));
}
}