Changeset 6663


Ignore:
Timestamp:
07/05/10 22:54:10 (10 years ago)
Author:
nikrou
Message:

Bug 1762 fixed : Compleet RSS Feed returns notice
Remove mysql specific function
Merge from trunk

Location:
branches/2.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.1/feed.php

    r6410 r6663  
    3737 * @return int timestamp 
    3838 */ 
    39 function mysqldt_to_ts($mysqldt) 
    40 { 
    41   $date = explode_mysqldt($mysqldt); 
    42   return mktime($date['hour'], $date['minute'], $date['second'], 
    43                 $date['month'], $date['day'], $date['year']); 
     39function datetime_to_ts($datetime) 
     40{ 
     41  $date = strptime($datetime, '%Y-%m-%d %H:%M:%S'); 
     42  return mktime($date['tm_hour'], $date['tm_min'], $date['tm_sec'], 
     43                $date['tm_mon'], $date['tm_mday'], 1900+$date['tm_year']); 
    4444} 
    4545 
     
    137137    $item->descriptionHtmlSyndicated = true; 
    138138 
    139     $item->date = mysqldt_to_ts($dbnow); 
     139    $item->date = $dbnow; 
    140140    $item->author = $conf['rss_feed_author']; 
    141141    $item->guid= sprintf('%s', $dbnow);; 
     
    155155{// update the last check from time to time to avoid deletion by maintenance tasks 
    156156  if ( !isset($feed_row['last_check']) 
    157     or time()-mysqldt_to_ts($feed_row['last_check']) > 30*24*3600 ) 
     157    or time()-datetime_to_ts($feed_row['last_check']) > 30*24*3600 ) 
    158158  { 
    159159    $query = ' 
     
    189189  $item->descriptionHtmlSyndicated = true; 
    190190 
    191   $item->date = mysqldt_to_ts($date); 
     191  $item->date = $date; 
    192192  $item->author = $conf['rss_feed_author']; 
    193193  $item->guid= sprintf('%s', 'pics-'.$date);; 
  • branches/2.1/include/functions_notification.inc.php

    r6653 r6663  
    609609 
    610610/** 
    611  * explodes a MySQL datetime format (2005-07-14 23:01:37) in fields "year", 
    612  * "month", "day", "hour", "minute", "second". 
    613  * 
    614  * @param string mysql datetime format 
    615  * @return array 
    616  */ 
    617 function explode_mysqldt($mysqldt) 
    618 { 
    619   $date = array(); 
    620   list($date['year'], 
    621        $date['month'], 
    622        $date['day'], 
    623        $date['hour'], 
    624        $date['minute'], 
    625        $date['second']) 
    626     = preg_split('/[-: ]/', $mysqldt); 
    627  
    628   return $date; 
    629 } 
    630  
    631 /** 
    632611 * returns title about recently published elements grouped by post date 
    633612 * @param $date_detail: selected date computed by get_recent_post_dates function 
     
    638617 
    639618  $date = $date_detail['date_available']; 
    640   $exploded_date = explode_mysqldt($date); 
     619  $exploded_date = strptime($date, '%Y-%m-%d %H:%M:%S'); 
    641620 
    642621  $title = l10n_dec('%d new image', '%d new images', $date_detail['nb_elements']); 
    643   $title .= ' ('.$lang['month'][(int)$exploded_date['month']].' '.$exploded_date['day'].')'; 
     622  $title .= ' ('.$lang['month'][(int)$exploded_date['tm_mon']].' '.$exploded_date['tm_mday'].')'; 
    644623 
    645624  return $title; 
Note: See TracChangeset for help on using the changeset viewer.