This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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 | // This program is free software; you can redistribute it and/or modify // |
||
5 | // it under the terms of the GNU General Public License as published by // |
||
6 | // the Free Software Foundation; either version 2 of the License, or // |
||
7 | // (at your option) any later version. // |
||
8 | // // |
||
9 | // You may not change or alter any portion of this comment or credits // |
||
10 | // of supporting developers from this source code or any supporting // |
||
11 | // source code which is considered copyrighted (c) material of the // |
||
12 | // original comment or credit authors. // |
||
13 | // // |
||
14 | // This program is distributed in the hope that it will be useful, // |
||
15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
||
16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
||
17 | // GNU General Public License for more details. // |
||
18 | // // |
||
19 | // You should have received a copy of the GNU General Public License // |
||
20 | // along with this program; if not, write to the Free Software // |
||
21 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
||
22 | // ------------------------------------------------------------------------ // |
||
23 | // Author: phppp (D.J., [email protected]) // |
||
24 | // URL: https://xoops.org // |
||
25 | // Project: Article Project // |
||
26 | // ------------------------------------------------------------------------ // |
||
27 | |||
28 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
||
29 | require_once __DIR__ . '/../include/vars.php'; |
||
30 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
||
31 | |||
32 | /*** GENERAL USAGE ********************************************************* |
||
33 | * $xmlHandler = xoops_getModuleHandler("xml", $xoopsModule->getVar("dirname")); |
||
34 | * $xml = $xmlHandler->create("RSS0.91"); |
||
35 | * $xml->setVar("title", $title); |
||
36 | * $xml->setVar("description", $description); |
||
37 | * $xml->setVar("descriptionHtmlSyndicated", true); |
||
38 | * $xml->setVar("link", $link); |
||
39 | * $xml->setVar("syndicationURL", $syndicationURL); |
||
40 | * |
||
41 | * $image = array( |
||
42 | * "width" => $imagewidth, |
||
43 | * "height" => $height, |
||
44 | * "title" => $imagetitle, |
||
45 | * "url" => $imageurl, |
||
46 | * "link" => $imagelink, |
||
47 | * "description" => $imagedesc |
||
48 | * ); |
||
49 | * |
||
50 | * $item = array( |
||
51 | * "title" => $datatitle, |
||
52 | * "link" => $dataurl, |
||
53 | * "description" => $datadesc, |
||
54 | * "descriptionHtmlSyndicated" => true, |
||
55 | * "date" => $datadate, |
||
56 | * "source" => $datasource, |
||
57 | * "author" => $dataauthor |
||
58 | * ); |
||
59 | * |
||
60 | * $xml->setImage($image); |
||
61 | * $xml->addItem($item); |
||
62 | * |
||
63 | * $xmlHandler->display($xml); |
||
64 | */ |
||
65 | |||
66 | // your local timezone, set to "" to disable or for GMT |
||
67 | $server_TZ = abs((int)($GLOBALS['xoopsConfig']['server_TZ'] * 3600.0)); |
||
68 | $prefix = ($GLOBALS['xoopsConfig']['server_TZ'] < 0) ? '-' : '+'; |
||
69 | $TIME_ZONE = $prefix . date('H:i', $server_TZ); |
||
70 | define('TIME_ZONE', $TIME_ZONE); |
||
71 | // Version string. |
||
72 | define('FEEDCREATOR_VERSION', 'ARTICLE @ XOOPS powered by FeedCreator'); |
||
73 | |||
74 | require_once __DIR__ . '/feedcreator.class.php'; |
||
75 | |||
76 | /** |
||
77 | * Description |
||
78 | * |
||
79 | * @param type $var description |
||
80 | * @return type description |
||
81 | * @link |
||
82 | */ |
||
83 | if (!class_exists('Xmlfeed')) { |
||
84 | /** |
||
85 | * Class Bxmlfeed |
||
86 | */ |
||
87 | class Bxmlfeed extends UniversalFeedCreator |
||
88 | { |
||
89 | public $version; |
||
90 | public $filename = ''; |
||
91 | |||
92 | /** |
||
93 | * Bxmlfeed constructor. |
||
94 | * @param $version |
||
95 | */ |
||
96 | public function __construct($version) |
||
97 | { |
||
98 | $this->filename = XOOPS_CACHE_PATH . '/feed.xml'; |
||
99 | $this->version = $version; |
||
100 | } |
||
101 | |||
102 | /** |
||
103 | * @param $var |
||
104 | * @param $val |
||
105 | * @param bool $encoding |
||
106 | */ |
||
107 | public function setVar($var, $val, $encoding = false) |
||
108 | { |
||
109 | if (!empty($encoding)) { |
||
110 | $val = $this->convert_encoding($val); |
||
111 | } |
||
112 | $this->$var = $val; |
||
113 | } |
||
114 | |||
115 | /** |
||
116 | * @param $val |
||
117 | * @return array|mixed|string |
||
118 | */ |
||
119 | View Code Duplication | public function convert_encoding($val) |
|
0 ignored issues
–
show
|
|||
120 | { |
||
121 | if (is_array($val)) { |
||
122 | foreach (array_keys($val) as $key) { |
||
123 | $val[$key] = $this->convert_encoding($val[$key]); |
||
124 | } |
||
125 | } else { |
||
126 | $val = XoopsLocal::convert_encoding($val, $this->encoding, _CHARSET); |
||
127 | } |
||
128 | |||
129 | return $val; |
||
130 | } |
||
131 | |||
132 | /** |
||
133 | * @param $var |
||
134 | * @return mixed |
||
135 | */ |
||
136 | public function getVar($var) |
||
137 | { |
||
138 | return $this->$var; |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * @param $img |
||
143 | */ |
||
144 | public function setImage(&$img) |
||
145 | { |
||
146 | $image = new FeedImage(); |
||
147 | foreach ($img as $key => $val) { |
||
148 | $image->$key = $this->convert_encoding($val); |
||
149 | } |
||
150 | $this->setVar('image', $image); |
||
151 | } |
||
152 | |||
153 | /** |
||
154 | * @param $itm |
||
155 | */ |
||
156 | public function _addItem(&$itm) |
||
157 | { |
||
158 | $item = new FeedItem(); |
||
159 | foreach ($itm as $key => $val) { |
||
160 | $item->$key = $this->convert_encoding($val); |
||
161 | } |
||
162 | $this->addItem($item); |
||
163 | } |
||
164 | |||
165 | /** |
||
166 | * @param $items |
||
167 | */ |
||
168 | public function addItems(&$items) |
||
169 | { |
||
170 | if (!is_array($items) || 0 == count($items)) { |
||
171 | return; |
||
172 | } |
||
173 | foreach ($items as $item) { |
||
174 | $this->_addItem($item); |
||
175 | } |
||
176 | } |
||
177 | } |
||
178 | } |
||
179 | |||
180 | PlanetUtility::planetParseClass(' |
||
181 | class [CLASS_PREFIX]XmlHandler |
||
182 | { |
||
183 | public function &create($format = "RSS0.91") |
||
184 | { |
||
185 | $xmlfeed = new Bxmlfeed($format); |
||
186 | |||
187 | return $xmlfeed; |
||
188 | } |
||
189 | |||
190 | public function display(&$feed, $filename="", $display=false) |
||
191 | { |
||
192 | if(!is_object($feed)) return null; |
||
193 | $filename=empty($filename)?$feed->filename:$filename; |
||
194 | if ($display) { |
||
195 | $feed->saveFeed($feed->version, $filename); |
||
196 | } else { |
||
197 | $feed->saveFeed($feed->version, $filename, false); |
||
198 | $content = implode("",file($filename)); |
||
199 | |||
200 | return trim($content); |
||
201 | } |
||
202 | } |
||
203 | |||
204 | public function insert(\XoopsObject $feed) |
||
205 | { |
||
206 | $xml_data = array(); |
||
207 | $xml_data["version"] = $feed->version; |
||
208 | $xml_data["encoding"] = $feed->encoding; |
||
209 | $xml_data["image"] = $feed->image; |
||
210 | $xml_data["items"] = $feed->items; |
||
211 | |||
212 | return $xml_data; |
||
213 | } |
||
214 | |||
215 | public function &get(&$feed) |
||
216 | { |
||
217 | $xml_data = array(); |
||
218 | $xml_data["version"] = $feed->version; |
||
219 | $xml_data["encoding"] = $feed->encoding; |
||
220 | $xml_data["image"] = $feed->image; |
||
221 | $xml_data["items"] = $feed->items; |
||
222 | |||
223 | return $xml_data; |
||
224 | } |
||
225 | } |
||
226 | '); |
||
227 |
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.