mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-02 04:15:05 +02:00
fixes #2145 deal with array value in exif
This commit is contained in:
@@ -183,13 +183,25 @@ function get_exif_data($filename, $map)
|
|||||||
|
|
||||||
if (!$conf['allow_html_in_metadata'])
|
if (!$conf['allow_html_in_metadata'])
|
||||||
{
|
{
|
||||||
|
function strip_html_in_metadata(&$v, $k)
|
||||||
|
{
|
||||||
|
$v = strip_tags($v);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($result as $key => $value)
|
foreach ($result as $key => $value)
|
||||||
{
|
{
|
||||||
// in case the origin of the photo is unsecure (user upload), we remove
|
// in case the origin of the photo is unsecure (user upload), we remove
|
||||||
// HTML tags to avoid XSS (malicious execution of javascript)
|
// HTML tags to avoid XSS (malicious execution of javascript)
|
||||||
|
if (is_array($value))
|
||||||
|
{
|
||||||
|
array_walk_recursive($value, 'strip_html_in_metadata');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$result[$key] = strip_tags($value);
|
$result[$key] = strip_tags($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ if (($conf['show_exif']) and (function_exists('exif_read_data')))
|
|||||||
{
|
{
|
||||||
if (strpos($field, ';') === false)
|
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;
|
$key = $field;
|
||||||
if (isset($lang['exif_field_'.$field]))
|
if (isset($lang['exif_field_'.$field]))
|
||||||
@@ -47,7 +48,8 @@ if (($conf['show_exif']) and (function_exists('exif_read_data')))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tokens = explode(';', $field);
|
$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];
|
$key = $tokens[1];
|
||||||
if (isset($lang['exif_field_'.$key]))
|
if (isset($lang['exif_field_'.$key]))
|
||||||
|
|||||||
Reference in New Issue
Block a user