Changeset 7507


Ignore:
Timestamp:
Oct 30, 2010, 10:22:15 PM (13 years ago)
Author:
plg
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions_metadata.php

    r5196 r7507  
    3939      if (preg_match('/(\d{4})(\d{2})(\d{2})/', $value, $matches))
    4040      {
    41         $iptc[$pwg_key] = $matches[1].'-'.$matches[2].'-'.$matches[3];
     41        $year = $matches[1];
     42        $month = $matches[2];
     43        $day = $matches[3];
     44
     45        if (!checkdate($month, $day, $year))
     46        {
     47          // we suppose the year is correct
     48          $month = 1;
     49          $day = 1;
     50        }
     51       
     52        $iptc[$pwg_key] = $year.'-'.$month.'-'.$day;
    4253      }
    4354    }
Note: See TracChangeset for help on using the changeset viewer.