source: extensions/Evil_Blog/feed.php @ 19055

Last change on this file since 19055 was 19055, checked in by EvilKant, 12 years ago
File size: 1.5 KB
Line 
1<?php
2// Chech whether we are indeed included by Piwigo.
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5        include_once(PHPWG_ROOT_PATH.'include/feedcreator.class.php');
6        $rss = new UniversalFeedCreator();
7        $rss->encoding=get_pwg_charset();
8        $rss->title = $conf['gallery_title'];
9        $rss->link = get_root_url().'?/blog';
10        $rss->description = $page['evil_blog']['blog_description'];
11       
12       
13        $result = pwg_query("
14                SELECT id, UNIX_TIMESTAMP(date) AS date, header, text
15                FROM `".Evil_Blog_Table."`
16                WHERE 1
17                ORDER BY `date` DESC
18        ");
19        while ($row = pwg_db_fetch_assoc($result)) {
20                if($ExDesc['state'] == 'active') {
21                                $row['text'] = get_extended_desc($row['text']);
22                                $row['header'] = get_user_language_desc($row['header']);
23                                }
24                $item = new FeedItem();
25                //$row['date'] = date($page['evil_blog']['date_format'], $row['date']);
26                $item->title = $row['header'].' '.$row['date'];
27                $item->link = get_gallery_home_url().'?/blog/id/'.$row['id'];
28                $item->description = $row['text'];
29                $item->date = $row['date'];
30                $item->descriptionHtmlSyndicated = true;
31                $item->guid= sprintf('%s', $row['date']);
32                $rss->addItem($item);
33        }
34       
35        $fileName= PHPWG_ROOT_PATH.$conf['data_location'].'tmp';
36        mkgetdir($fileName); // just in case
37        $fileName.='/evil_blog_feed.xml';
38        // send XML feed
39        echo $rss->saveFeed('RSS2.0', $fileName, true);
40       
41        /*$item = new FeedItem();
42        foreach ($item as $key => $value) {
43                echo $key.' = '. $value . '<br>';
44        }*/
45?>
Note: See TracBrowser for help on using the repository browser.