You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

71 lines
2.2 KiB

<?php
//~ Include RSS Fusion
require_once 'vendor/RSS-Fusion/index.php';
if(!array_key_exists('c', $_GET)
OR !isset($_GET['c'])
OR !file_exists(TL_ROOT . '/../../c/'.$_GET['c'])){
exit;
}
$oConf = json_decode(file_get_contents(TL_ROOT . '/../../c/'.$_GET['c']));
if($oConf && gettype($oConf) == 'object'){
$_links = $oConf->flux;
\Config::set('where', $oConf->where);
\Config::set('_starWords', $oConf->_starWords);
\Config::set('_badWords', $oConf->_badWords);
$oFeeds = new FeedReader($_links);
if(!is_null($oFeeds->objParseFeed)){
$_items = array();
$_c = array();
foreach($oFeeds->objParseFeed->items as $item){
if(!empty($item['link']) && !in_array($item['link'], $_c)){
//~ Delete duplicate item by link
array_push($_c, $item['link']);
if((count(Config::get('_starWords')) && $item['show'] == 'star')
OR (!count(Config::get('_starWords')) && $item['show'] == 'show')){
array_push($_items, $item);
}
}
}
}
$rssfeed = '<?xml version="1.0" encoding="UTF-8"?>';
$rssfeed .= '<rss version="2.0">';
$rssfeed .= '<channel>';
$rssfeed .= '<title>Flux personnalisé RSS Fusion</title>';
$rssfeed .= '<link>https://framagit.org/Erase/RSS-Fusion-demo</link>';
$rssfeed .= '<description>Flux généré avec RSS Fusion</description>';
if(count($_items)){
foreach ($_items as $item){
$rssfeed .= '<item>';
$rssfeed .= '<title>'.html_entity_decode($item['title']).'</title>';
$rssfeed .= '<link>'.$item['link'].'</link>';
$rssfeed .= '<description><![CDATA['.$item['description'].']]></description>';
$rssfeed .= '<pubDate>'.date('r', $item['pubdate']).'</pubDate>';
$rssfeed .= '<category>'.$item['category'].'</category>';
$rssfeed .= '<enclosure url="'.$item['enclosure'].'" />';
$rssfeed .= '<permalink>'.$item['permalink'].'</permalink>';
$rssfeed .= '<show>'.$item['show'].'</show>';
$rssfeed .= '<base>'.$item['base'].'</base>';
$rssfeed .= '</item>';
}
}
$rssfeed .= '</channel>';
$rssfeed .= '</rss>';
header('Content-type: application/xml');
echo $rssfeed;
}