diff --git a/include/functions_metadata.inc.php b/include/functions_metadata.inc.php index fffa06d77..668ab7740 100644 --- a/include/functions_metadata.inc.php +++ b/include/functions_metadata.inc.php @@ -183,11 +183,23 @@ function get_exif_data($filename, $map) if (!$conf['allow_html_in_metadata']) { + function strip_html_in_metadata(&$v, $k) + { + $v = strip_tags($v); + } + foreach ($result as $key => $value) { // in case the origin of the photo is unsecure (user upload), we remove // HTML tags to avoid XSS (malicious execution of javascript) - $result[$key] = strip_tags($value); + if (is_array($value)) + { + array_walk_recursive($value, 'strip_html_in_metadata'); + } + else + { + $result[$key] = strip_tags($value); + } } } diff --git a/include/picture_metadata.inc.php b/include/picture_metadata.inc.php index b692dc14c..2bf14f963 100644 --- a/include/picture_metadata.inc.php +++ b/include/picture_metadata.inc.php @@ -34,7 +34,8 @@ if (($conf['show_exif']) and (function_exists('exif_read_data'))) { if (strpos($field, ';') === false) { - if (isset($exif[$field])) + // template cannot deal with an array as value, we skip it + if (isset($exif[$field]) and !is_array($exif[$field])) { $key = $field; if (isset($lang['exif_field_'.$field])) @@ -47,7 +48,8 @@ if (($conf['show_exif']) and (function_exists('exif_read_data'))) else { $tokens = explode(';', $field); - if (isset($exif[$field])) + // template cannot deal with an array as value, we skip it + if (isset($exif[$field]) and !is_array($exif[$field])) { $key = $tokens[1]; if (isset($lang['exif_field_'.$key]))