Status: offline

LWC

Forum User
Full Member
Registered: 02/19/04
Posts: 818
If I enable RSS for albums, all the dates are shown as:
Text Formatted Code
<pubDate>Thu, 01 Jan 1970 00:00:00 +0100</pubDate>

instead of their real dates.

Status: offline

LWC

Forum User
Full Member
Registered: 02/19/04
Posts: 818
Also, non images (e.g. PDF files) are displayed as media.php?s=ID instead of download.php?s=ID

Status: offline

LWC

Forum User
Full Member
Registered: 02/19/04
Posts: 818
The bad dates are because they have to be RFC approved, but the developer of the relevant code just assumed the local would be English.
I've fixed both issues myself in mediagallery/include/rssfeed.php:

1) Stop treating none images like images:

Text Formatted Code
function MG_processAlbumFeedItems( &$rss, $aid ) {
...
            $item->title = $row['media_title'];
// custom code - start
            if ($row['media_type']==4)
                $external_method = 'download.php?mid=';
            else
                $external_method = 'media.php?s=';
            $item->link =  $_MG_CONF['site_url'] . '/' . $external_method . $row['media_id'];
            // $item->link =  $_MG_CONF['site_url'] . '/media.php?s=' . $row['media_id'];
// custom code - end                   
 


2)
Text Formatted Code
function MG_processAlbumFeedItems( &$rss, $aid ) {
...
// custom code - start
                $item->date = _RFC822DateFormat($row['media_time']);
                //$item->date = strftime("%a, %d %b %Y %H:%M:%S %z",$row['media_time']);
// custom code - end
            $item->source = $_CONF['site_url'];
 


Also in
Text Formatted Code
function MG_parseAlbumsRSS( &$rss, $aid ) {
...
// custom code - start
                $item->date = _RFC822DateFormat($MG_albums[$aid]->last_update);
                //$item->date = strftime("%a, %d %b %Y %H:%M:%S %z",$MG_albums[$aid]->last_update);
// custom code - end
                $item->source = $_CONF['site_url'];
 


_RFC822DateFormat is taken from Geeklog. You'd need to copy and paste this function:

Text Formatted Code

// custom code - start
    /**
      * Generate an RFC-822 compliant date-time stamp.
      *
      * @param timestamp $timestamp Date time to format.
      */
    function _RFC822DateFormat($timestamp='')
    {
        // format the date
        if(!empty($timestamp))
        {
                $time = date( 'r', $timestamp);
        } else {
                $time = date( 'r' );
        }
        // return the time
        return $time;
    }
// custom code - end