aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2010-10-30 20:14:11 +0000
committerplegall <plg@piwigo.org>2010-10-30 20:14:11 +0000
commit0591eda076428a8b1b5a640500e90026b566a0a7 (patch)
treedf48ebc70732850ace08164be237a98caf1ff39a
parentf048a74b087f2dc17416316f3d01ba38d60f4c43 (diff)
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/branches/2.1@7506 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/include/functions_metadata.php13
1 files changed, 12 insertions, 1 deletions
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;
}
}
}