Changeset 17803

Show
Ignore:
Timestamp:
09/30/08 13:52:23 (2 months ago)
Author:
rambo
Message:

fix metadata timestemp rewriting bug introduced in r17294, fixes #295

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/midcom.core/midcom/baseclasses/core/dbobject.php

    r17761 r17803  
    232232            $object->metadata->published = time(); 
    233233        } 
    234  
    235234        /* 
    236235        debug_push_class(__CLASS__, __FUNCTION__); 
     
    12811280    function _rewrite_timestamps_to_isodate(&$object) 
    12821281    { 
    1283         $timestamps = array 
     1282        static $timestamps = array 
    12841283        ( 
    12851284            'revised',  
     
    12881287            'approved' 
    12891288        ); 
    1290         $metadata_timestamps = array 
     1289        static $metadata_timestamps = array 
    12911290        ( 
    12921291            'created',  
     
    13001299            'scheduleend', 
    13011300        ); 
     1301        /* 
     1302        debug_push_class(__CLASS__, __FUNCTION__); 
     1303        debug_print_r('$object->metadata before rewrites', $object->metadata); 
     1304        debug_pop(); 
     1305        */ 
    13021306 
    13031307        foreach ($timestamps as $timestamp) 
     
    13201324        } 
    13211325         
    1322         // Pre 1.8 doe not have the metadata property. 
    1323         if (!isset($object->metadata)) 
    1324         { 
    1325             return; 
    1326         } 
    13271326        foreach ($metadata_timestamps as $timestamp) 
    13281327        { 
     
    13321331                { 
    13331332                    $object->metadata->$timestamp = 0; 
     1333                } 
     1334                else 
     1335                { 
     1336                    // typecast just to be sure. 
     1337                    $object->metadata->$timestamp = (int)$object->metadata->$timestamp; 
    13341338                } 
    13351339                if ($object->metadata->$timestamp == 0) 
     
    13391343                else 
    13401344                { 
    1341                     $object->metadata->$timestamp = gmstrftime('%Y-%m-%d %T', strtotime($object->metadata->$timestamp)); 
     1345                    $object->metadata->$timestamp = gmstrftime('%Y-%m-%d %T', $object->metadata->$timestamp); 
    13421346                } 
    13431347            } 
    13441348        } 
     1349        /* 
     1350        debug_push_class(__CLASS__, __FUNCTION__); 
     1351        debug_print_r('$object->metadata after rewrites', $object->metadata); 
     1352        debug_pop(); 
     1353        */ 
    13451354    } 
    13461355