From 1fb1c6c225fe65576597e74a7591b7173e5b3311 Mon Sep 17 00:00:00 2001 From: plegall Date: Sat, 30 Oct 2010 20:22:15 +0000 Subject: merge r7506 from branch 2.1 to trunk bug 1974 fixed: don't generate invalid creation date from IPTC, if month = 0 or day = 0, then month=1 and day=1. git-svn-id: http://piwigo.org/svn/trunk@7507 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/functions_metadata.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/admin/include/functions_metadata.php b/admin/include/functions_metadata.php index 5d1f80bc2..b1c32dc62 100644 --- a/admin/include/functions_metadata.php +++ b/admin/include/functions_metadata.php @@ -38,7 +38,18 @@ function get_sync_iptc_data($file) { if (preg_match('/(\d{4})(\d{2})(\d{2})/', $value, $matches)) { - $iptc[$pwg_key] = $matches[1].'-'.$matches[2].'-'.$matches[3]; + $year = $matches[1]; + $month = $matches[2]; + $day = $matches[3]; + + if (!checkdate($month, $day, $year)) + { + // we suppose the year is correct + $month = 1; + $day = 1; + } + + $iptc[$pwg_key] = $year.'-'.$month.'-'.$day; } } } -- cgit v1.2.3