-
Notifications
You must be signed in to change notification settings - Fork 6
/
fluxrss.php
53 lines (48 loc) · 2.27 KB
/
fluxrss.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
declare(strict_types=1);
/*
* You may not change or alter any portion of this comment or credits
* of supporting developers from this source code or any supporting source code
* which is considered copyrighted (c) material of the original comment or credit authors.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* @copyright XOOPS Project (https://xoops.org)
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
* @author XOOPS Development Team
* @author Pascal Le Boustouller: original author ([email protected])
* @author Luc Bizet (www.frxoops.org)
* @author jlm69 (www.jlmzone.com)
* @author mamba (www.xoops.org)
*/
use XoopsModules\Adslight\{
Utility
};
header('Content-Type: application/rss+xml; charset=UTF-8');
require_once __DIR__ . '/header.php';
$xoopsLogger->activated = false;
$allads = Utility::returnAllAdsFluxRss();
$base_xoops = 'http://' . $_SERVER['SERVER_NAME'] . mb_substr($_SERVER['REQUEST_URI'], 0, mb_strpos($_SERVER['REQUEST_URI'], 'modules'));
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>
<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">
<channel>
<title>{$xoopsConfig['sitename']}</title>
<link>{$base_xoops}</link>
<description>" . $xoopsConfig['slogan'] . '</description>
<language>fr</language>';
$adslink = 'http://' . $_SERVER['SERVER_NAME'] . mb_substr($_SERVER['REQUEST_URI'], 0, mb_strrpos($_SERVER['REQUEST_URI'], '/'));
foreach ($allads as $allad) {
echo "<item>
<title>{$allad['title']}</title>
<description><![CDATA[" . stripslashes($allad['desctext']) . '<br><strong>Ville:</strong> ' . htmlspecialchars($allad['town'], ENT_QUOTES | ENT_HTML5) . ' - <strong>Prix:</strong> ' . htmlspecialchars($allad['price'], ENT_QUOTES | ENT_HTML5) . '€ <br>';
echo "]]></description>
<link><![CDATA[{$adslink}/viewads.php?lid={$allad['lid']}]]></link>
<guid><![CDATA[{$adslink}/viewads.php?lid={$allad['lid']}]]></guid>
<pubDate>" . date('D, d M Y H:i:s +0100', $allad['date_created']) . '</pubDate>
</item>';
}
echo '</channel>
</rss>';