[19048] | 1 | <?php |
---|
[19049] | 2 | // Chech whether we are indeed included by Piwigo. |
---|
| 3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 4 | |
---|
[19048] | 5 | include_once(PHPWG_ROOT_PATH.'include/feedcreator.class.php'); |
---|
| 6 | $rss = new UniversalFeedCreator(); |
---|
| 7 | $rss->encoding=get_pwg_charset(); |
---|
[19055] | 8 | $rss->title = $conf['gallery_title']; |
---|
[19054] | 9 | $rss->link = get_root_url().'?/blog'; |
---|
[19048] | 10 | $rss->description = $page['evil_blog']['blog_description']; |
---|
| 11 | |
---|
[19055] | 12 | |
---|
[19048] | 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(); |
---|
[19072] | 25 | $item->title = $row['header'].' '.date($page['evil_blog']['date_format'], $row['date']); |
---|
[19055] | 26 | $item->link = get_gallery_home_url().'?/blog/id/'.$row['id']; |
---|
[19048] | 27 | $item->description = $row['text']; |
---|
| 28 | $item->date = $row['date']; |
---|
| 29 | $item->descriptionHtmlSyndicated = true; |
---|
[19055] | 30 | $item->guid= sprintf('%s', $row['date']); |
---|
[19048] | 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 | ?> |
---|