These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* |
||
3 | ------------------------------------------------------------------------- |
||
4 | ADSLIGHT 2 : Module for Xoops |
||
5 | |||
6 | Redesigned and ameliorate By Luc Bizet user at www.frxoops.org |
||
7 | Started with the Classifieds module and made MANY changes |
||
8 | Website : http://www.luc-bizet.fr |
||
9 | Contact : [email protected] |
||
10 | ------------------------------------------------------------------------- |
||
11 | Original credits below Version History |
||
12 | ########################################################################## |
||
13 | # Classified Module for Xoops # |
||
14 | # By John Mordo user jlm69 at www.xoops.org and www.jlmzone.com # |
||
15 | # Started with the MyAds module and made MANY changes # |
||
16 | ########################################################################## |
||
17 | Original Author: Pascal Le Boustouller |
||
18 | Author Website : [email protected] |
||
19 | Licence Type : GPL |
||
20 | ------------------------------------------------------------------------- |
||
21 | */ |
||
22 | header('Content-Type: application/rss+xml; charset=UTF-8'); |
||
23 | |||
24 | include_once __DIR__ . '/header.php'; |
||
25 | include_once __DIR__ . '/include/functions.php'; |
||
26 | |||
27 | $allads = returnAllAdsRss(); |
||
28 | $base_xoops = 'http://' . $_SERVER['SERVER_NAME'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'modules')); |
||
29 | |||
30 | echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?> |
||
31 | <rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\"> |
||
32 | <channel> |
||
33 | <title>" . $xoopsConfig['sitename'] . '</title> |
||
34 | <link>' . $base_xoops . '</link> |
||
35 | <description>' . $xoopsConfig['slogan'] . '</description> |
||
36 | <language>fr</language>'; |
||
37 | |||
38 | $adslink = 'http://' . $_SERVER['SERVER_NAME'] . substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/')); |
||
39 | |||
40 | View Code Duplication | for ($i = 0, $iMax = count($allads); $i < $iMax; ++$i) { |
|
1 ignored issue
–
show
|
|||
41 | echo '<item> |
||
42 | <title>' . |
||
43 | $allads[$i]['title'] . |
||
44 | '</title> |
||
45 | <description><![CDATA[' . |
||
46 | stripslashes($allads[$i]['desctext']) . |
||
47 | '<br><strong>Ville:</strong> ' . |
||
48 | htmlspecialchars($allads[$i]['town']) . |
||
49 | ' - <strong>Prix:</strong> ' . |
||
50 | htmlspecialchars($allads[$i]['price']) . |
||
51 | '€ <br>'; |
||
52 | echo ']]></description> |
||
53 | <link><![CDATA[' . $adslink . '/viewads.php?lid=' . $allads[$i]['lid'] . ']]></link> |
||
54 | <guid><![CDATA[' . $adslink . '/viewads.php?lid=' . $allads[$i]['lid'] . ']]></guid> |
||
55 | <pubDate>' . date('D, d M Y H:i:s +0100', $allads[$i]['date']) . '</pubDate> |
||
56 | </item>'; |
||
57 | } |
||
58 | echo '</channel> |
||
59 | </rss>'; |
||
60 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.