These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | // $Id: backendt.php 9767 2012-07-02 06:02:52Z beckmi $ |
||
3 | // ------------------------------------------------------------------------ // |
||
4 | // XOOPS - PHP Content Management System // |
||
5 | // Copyright (c) 2000 XOOPS.org // |
||
6 | // <http://xoops.org/> // |
||
7 | // ------------------------------------------------------------------------ // |
||
8 | // This program is free software; you can redistribute it and/or modify // |
||
9 | // it under the terms of the GNU General Public License as published by // |
||
10 | // the Free Software Foundation; either version 2 of the License, or // |
||
11 | // (at your option) any later version. // |
||
12 | // // |
||
13 | // You may not change or alter any portion of this comment or credits // |
||
14 | // of supporting developers from this source code or any supporting // |
||
15 | // source code which is considered copyrighted (c) material of the // |
||
16 | // original comment or credit authors. // |
||
17 | // // |
||
18 | // This program is distributed in the hope that it will be useful, // |
||
19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
||
20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
||
21 | // GNU General Public License for more details. // |
||
22 | // // |
||
23 | // You should have received a copy of the GNU General Public License // |
||
24 | // along with this program; if not, write to the Free Software // |
||
25 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
||
26 | // ------------------------------------------------------------------------ // |
||
27 | /** |
||
28 | * RSS per topics |
||
29 | * |
||
30 | * This script is used to generate RSS feeds for each topic. |
||
31 | * You can enable and disable this feature with the module's option named "Enable RSS feeds per topics?" |
||
32 | * The script uses the permissions to know what to display. |
||
33 | * |
||
34 | * @package News |
||
35 | * @author Xoops Modules Dev Team |
||
36 | * @copyright (c) XOOPS Project (http://xoops.org) |
||
37 | * |
||
38 | * @param type $nomvariable description |
||
39 | */ |
||
40 | include dirname(dirname(__DIR__)) . '/mainfile.php'; |
||
41 | include_once XOOPS_ROOT_PATH . '/class/template.php'; |
||
42 | include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php'; |
||
43 | include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php'; |
||
44 | include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php'; |
||
45 | |||
46 | error_reporting(0); |
||
47 | $GLOBALS['xoopsLogger']->activated = false; |
||
48 | |||
49 | if (!news_getmoduleoption('topicsrss')) { |
||
50 | exit(); |
||
51 | } |
||
52 | |||
53 | $topicid = isset($_GET['topicid']) ? (int)($_GET['topicid']) : 0; |
||
54 | if ($topicid == 0) { |
||
55 | exit(); |
||
56 | } |
||
57 | |||
58 | if (function_exists('mb_http_output')) { |
||
59 | mb_http_output('pass'); |
||
60 | } |
||
61 | |||
62 | $restricted = news_getmoduleoption('restrictindex'); |
||
63 | $newsnumber = news_getmoduleoption('storyhome'); |
||
64 | |||
65 | $charset = 'utf-8'; |
||
66 | |||
67 | header('Content-Type:text/xml; charset=' . $charset); |
||
68 | $story = new NewsStory(); |
||
69 | $tpl = new XoopsTpl(); |
||
70 | $tpl->caching = 2; |
||
71 | $tpl->xoops_setCacheTime(3600); // Change this to the value you want |
||
72 | if (!$tpl->is_cached('db:news_rss.tpl', $topicid)) { |
||
73 | $xt = new NewsTopic($topicid); |
||
74 | $sarray = $story->getAllPublished($newsnumber, 0, $restricted, $topicid); |
||
0 ignored issues
–
show
|
|||
75 | if (is_array($sarray) && count($sarray) > 0) { |
||
76 | $sitename = htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES); |
||
77 | $slogan = htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES); |
||
78 | $tpl->assign('channel_title', xoops_utf8_encode($sitename)); |
||
79 | $tpl->assign('channel_link', XOOPS_URL . '/'); |
||
80 | $tpl->assign('channel_desc', xoops_utf8_encode($slogan)); |
||
81 | $tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss')); |
||
82 | $tpl->assign('channel_webmaster', checkEmail($xoopsConfig['adminmail'], true)); // Fed up with spam |
||
83 | $tpl->assign('channel_editor', checkEmail($xoopsConfig['adminmail'], true)); // Fed up with spam |
||
84 | $tpl->assign('channel_category', $xt->topic_title()); |
||
85 | $tpl->assign('channel_generator', 'XOOPS'); |
||
86 | $tpl->assign('channel_language', _LANGCODE); |
||
87 | $tpl->assign('image_url', XOOPS_URL . '/images/logo.gif'); |
||
88 | $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.gif'); |
||
89 | View Code Duplication | if (empty($dimention[0])) { |
|
90 | $width = 88; |
||
91 | } else { |
||
92 | $width = ($dimention[0] > 144) ? 144 : $dimention[0]; |
||
93 | } |
||
94 | View Code Duplication | if (empty($dimention[1])) { |
|
95 | $height = 31; |
||
96 | } else { |
||
97 | $height = ($dimention[1] > 400) ? 400 : $dimention[1]; |
||
98 | } |
||
99 | $tpl->assign('image_width', $width); |
||
100 | $tpl->assign('image_height', $height); |
||
101 | $count = $sarray; |
||
102 | foreach ($sarray as $story) { |
||
103 | $storytitle = $story->title(); |
||
104 | //if we are allowing html, we need to use htmlspecialchars or any bug will break the output |
||
105 | $description = htmlspecialchars($story->hometext()); |
||
106 | $tpl->append( |
||
107 | 'items', |
||
108 | array( |
||
109 | 'title' => xoops_utf8_encode($storytitle), |
||
110 | 'link' => XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), |
||
111 | 'guid' => XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), |
||
112 | 'pubdate' => formatTimestamp($story->published(), 'rss'), |
||
113 | 'description' => xoops_utf8_encode($description) |
||
114 | ) |
||
115 | ); |
||
116 | } |
||
117 | } |
||
118 | } |
||
119 | $tpl->display('db:news_rss.tpl', $topicid); |
||
120 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: