Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 1762 fixed : Compleet RSS Feed returns notice
Remove mysql specific function

git-svn-id: http://piwigo.org/svn/trunk@6662 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
nikrou committed Jul 5, 2010
1 parent c141429 commit 531ee35
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 30 deletions.
14 changes: 7 additions & 7 deletions feed.php
Expand Up @@ -36,11 +36,11 @@
* @param string mysql datetime format
* @return int timestamp
*/
function mysqldt_to_ts($mysqldt)
function datetime_to_ts($datetime)
{
$date = explode_mysqldt($mysqldt);
return mktime($date['hour'], $date['minute'], $date['second'],
$date['month'], $date['day'], $date['year']);
$date = strptime($datetime, '%Y-%m-%d %H:%M:%S');
return mktime($date['tm_hour'], $date['tm_min'], $date['tm_sec'],
$date['tm_mon'], $date['tm_mday'], 1900+$date['tm_year']);
}

/**
Expand Down Expand Up @@ -136,7 +136,7 @@ function ts_to_iso8601($ts)
$item->description.= '</ul>';
$item->descriptionHtmlSyndicated = true;

$item->date = mysqldt_to_ts($dbnow);
$item->date = $dbnow;
$item->author = $conf['rss_feed_author'];
$item->guid= sprintf('%s', $dbnow);;

Expand All @@ -154,7 +154,7 @@ function ts_to_iso8601($ts)
if ( !empty($feed_id) and empty($news) )
{// update the last check from time to time to avoid deletion by maintenance tasks
if ( !isset($feed_row['last_check'])
or time()-mysqldt_to_ts($feed_row['last_check']) > 30*24*3600 )
or time()-datetime_to_ts($feed_row['last_check']) > 30*24*3600 )
{
$query = '
UPDATE '.USER_FEED_TABLE.'
Expand Down Expand Up @@ -188,7 +188,7 @@ function ts_to_iso8601($ts)

$item->descriptionHtmlSyndicated = true;

$item->date = mysqldt_to_ts($date);
$item->date = $date;
$item->author = $conf['rss_feed_author'];
$item->guid= sprintf('%s', 'pics-'.$date);;

Expand Down
25 changes: 2 additions & 23 deletions include/functions_notification.inc.php
Expand Up @@ -607,27 +607,6 @@ function get_html_description_recent_post_date($date_detail)
return $description;
}

/**
* explodes a MySQL datetime format (2005-07-14 23:01:37) in fields "year",
* "month", "day", "hour", "minute", "second".
*
* @param string mysql datetime format
* @return array
*/
function explode_mysqldt($mysqldt)
{
$date = array();
list($date['year'],
$date['month'],
$date['day'],
$date['hour'],
$date['minute'],
$date['second'])
= preg_split('/[-: ]/', $mysqldt);

return $date;
}

/**
* returns title about recently published elements grouped by post date
* @param $date_detail: selected date computed by get_recent_post_dates function
Expand All @@ -637,10 +616,10 @@ function get_title_recent_post_date($date_detail)
global $lang;

$date = $date_detail['date_available'];
$exploded_date = explode_mysqldt($date);
$exploded_date = strptime($date, '%Y-%m-%d %H:%M:%S');

$title = l10n_dec('%d new image', '%d new images', $date_detail['nb_elements']);
$title .= ' ('.$lang['month'][(int)$exploded_date['month']].' '.$exploded_date['day'].')';
$title .= ' ('.$lang['month'][(int)$exploded_date['tm_mon']].' '.$exploded_date['tm_mday'].')';

return $title;
}
Expand Down

0 comments on commit 531ee35

Please sign in to comment.