source: extensions/Evil_Blog/feed.php @ 31963

Last change on this file since 31963 was 19072, checked in by EvilKant, 12 years ago
File size: 1.4 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                $item->title = $row['header'].' '.date($page['evil_blog']['date_format'], $row['date']);
26                $item->link = get_gallery_home_url().'?/blog/id/'.$row['id'];
27                $item->description = $row['text'];
28                $item->date = $row['date'];
29                $item->descriptionHtmlSyndicated = true;
30                $item->guid= sprintf('%s', $row['date']);
31                $rss->addItem($item);
32        }
33       
34        $fileName= PHPWG_ROOT_PATH.$conf['data_location'].'tmp';
35        mkgetdir($fileName); // just in case
36        $fileName.='/evil_blog_feed.xml';
37        // send XML feed
38        echo $rss->saveFeed('RSS2.0', $fileName, true);
39       
40        /*$item = new FeedItem();
41        foreach ($item as $key => $value) {
42                echo $key.' = '. $value . '<br>';
43        }*/
44?>
Note: See TracBrowser for help on using the repository browser.