1 | <?php |
---|
2 | // Chech whether we are indeed included by Piwigo. |
---|
3 | if (!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 | ?> |
---|