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.
1 | <?php |
||||||
2 | /** |
||||||
3 | * Module: Soapbox |
||||||
4 | * Author: hsalazar |
||||||
5 | * Licence: GNU |
||||||
6 | * @param $options |
||||||
7 | * @return array |
||||||
8 | */ |
||||||
9 | |||||||
10 | use XoopsModules\Soapbox; |
||||||
11 | |||||||
12 | /* This function spotlights a column, with a spotlight article and links to others */ |
||||||
13 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
||||||
14 | /** |
||||||
15 | * @param $options |
||||||
16 | * @return array |
||||||
17 | */ |
||||||
18 | function b_arts_spot_show($options) |
||||||
19 | { |
||||||
20 | $block_outdata = []; |
||||||
21 | //------------------------------------- |
||||||
22 | $myts = \MyTextSanitizer:: getInstance(); |
||||||
23 | $helper = \XoopsModules\Soapbox\Helper::getInstance(); |
||||||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||||||
24 | $module_name = 'soapbox'; |
||||||
25 | $moduleHandler = xoops_getHandler('module'); |
||||||
26 | $soapModule = $moduleHandler->getByDirname($module_name); |
||||||
0 ignored issues
–
show
The method
getByDirname() does not exist on XoopsObjectHandler . It seems like you code against a sub-type of XoopsObjectHandler such as XoopsModuleHandler or XoopsPersistableObjectHandler .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
27 | if (!is_object($soapModule)) { |
||||||
28 | return null; |
||||||
29 | } |
||||||
30 | |||||||
31 | $hModConfig = xoops_getHandler('config'); |
||||||
32 | $module_id = $soapModule->getVar('mid'); |
||||||
33 | $soapConfig = $hModConfig->getConfigsByCat(0, $module_id); |
||||||
0 ignored issues
–
show
The method
getConfigsByCat() does not exist on XoopsObjectHandler . It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
34 | //------------------------------------- |
||||||
35 | // To handle options in the template |
||||||
36 | if (isset($options[0]) && 1 === $options[0]) { |
||||||
37 | $block_outdata['showspotlight'] = 1; |
||||||
38 | } else { |
||||||
39 | $block_outdata['showspotlight'] = 0; |
||||||
40 | } |
||||||
41 | //------------------------------------- |
||||||
42 | if (isset($options[1])) { |
||||||
43 | $options[1] = (int)$options[1]; |
||||||
44 | } else { |
||||||
45 | $options[1] = 1; |
||||||
46 | } |
||||||
47 | if (empty($options[1])) { |
||||||
48 | $options[1] = 1; |
||||||
49 | } |
||||||
50 | //------------------------------------- |
||||||
51 | if (isset($options[2]) && 1 === $options[2]) { |
||||||
52 | $block_outdata['showdateask'] = 1; |
||||||
53 | } else { |
||||||
54 | $block_outdata['showdateask'] = 0; |
||||||
55 | } |
||||||
56 | //------------------------------------- |
||||||
57 | if (isset($options[3]) && 1 === $options[3]) { |
||||||
58 | $block_outdata['showbylineask'] = 1; |
||||||
59 | } else { |
||||||
60 | $block_outdata['showbylineask'] = 0; |
||||||
61 | } |
||||||
62 | //------------------------------------- |
||||||
63 | if (isset($options[4]) && 1 === $options[4]) { |
||||||
64 | $block_outdata['showstatsask'] = 1; |
||||||
65 | } else { |
||||||
66 | $block_outdata['showstatsask'] = 0; |
||||||
67 | } |
||||||
68 | //------------------------------------- |
||||||
69 | if (isset($options[5]) && 'ver' === $options[5]) { |
||||||
70 | $block_outdata['verticaltemplate'] = 1; |
||||||
71 | } else { |
||||||
72 | $block_outdata['verticaltemplate'] = 0; |
||||||
73 | } |
||||||
74 | //------------------------------------- |
||||||
75 | if (isset($options[6]) && 1 === $options[6]) { |
||||||
76 | $block_outdata['showpicask'] = 1; |
||||||
77 | } else { |
||||||
78 | $block_outdata['showpicask'] = 0; |
||||||
79 | } |
||||||
80 | //------------------------------------- |
||||||
81 | $sortname = $options[7]; |
||||||
82 | if (!in_array($sortname, ['datesub', 'weight', 'counter', 'rating', 'headline'], true)) { |
||||||
83 | $sortname = 'datesub'; |
||||||
84 | } |
||||||
85 | $sortorder = 'DESC'; |
||||||
86 | if ('weight' === $sortname) { |
||||||
87 | $sortorder = 'ASC'; |
||||||
88 | } |
||||||
89 | //------------------------------------- |
||||||
90 | if (isset($options[8]) && (int)$options[8] > 0) { |
||||||
91 | $options[8] = (int)$options[8]; |
||||||
92 | } else { |
||||||
93 | $options[8] = 65; |
||||||
94 | } |
||||||
95 | //------------------------------------- |
||||||
96 | // Try to see what tabs are visibles (if we are in restricted view of course) |
||||||
97 | $opt_columnIDs = []; |
||||||
98 | if (!empty($options[9])) { |
||||||
99 | $opt_columnIDs = array_slice($options, 9); |
||||||
100 | } |
||||||
101 | if (!empty($opt_columnIDs) && is_array($opt_columnIDs)) { |
||||||
102 | foreach ($opt_columnIDs as $v) { |
||||||
103 | $columnIDs[] = (int)$v; |
||||||
104 | } |
||||||
105 | } else { |
||||||
106 | $columnIDs = null; |
||||||
107 | } |
||||||
108 | // Retrieve the column's name |
||||||
109 | // $resultB = $xoopsDB -> query( "SELECT name, colimage FROM ". $xoopsDB -> prefix( "sbcolumns" ) . " WHERE columnID = " . $options[0] . " " ); |
||||||
110 | // list ( $name, $colimage ) = $xoopsDB -> fetchRow( $resultB ); |
||||||
111 | //------------------------------------- |
||||||
112 | /** @var \XoopsModules\Soapbox\EntrygetHandler $entrydataHandler */ |
||||||
113 | $entrydataHandler = new \XoopsModules\Soapbox\EntrygetHandler(); |
||||||
114 | //------------------------------------- |
||||||
115 | // Retrieve the latest article in the selected column |
||||||
116 | $entryobArray = $entrydataHandler->getArticlesAllPermcheck($options[1], 0, true, true, 0, 0, 1, $sortname, $sortorder, $columnIDs, null, false, false); |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
117 | $totalarts = $entrydataHandler->total_getArticlesAllPermcheck; |
||||||
118 | // If there's no article result (which means there's no article yet... |
||||||
119 | if (empty($entryobArray) || 0 === count($entryobArray)) { |
||||||
120 | $block_outdata['display'] = 0; |
||||||
121 | |||||||
122 | return $block_outdata; |
||||||
123 | } |
||||||
124 | $block_outdata['display'] = 1; |
||||||
125 | //------------------------------------- |
||||||
126 | $block_outdata['moduledir'] = $module_name; |
||||||
127 | $block_outdata['totalarts'] = (int)$totalarts; |
||||||
128 | $block_outdata['modulename'] = $soapModule->getVar('name'); |
||||||
129 | $block_outdata['sbuploaddir'] = $myts->htmlSpecialChars($soapConfig['sbuploaddir']); |
||||||
130 | //------------------------------------- |
||||||
131 | $i = 1; |
||||||
132 | xoops_load('XoopsUserUtility'); |
||||||
133 | foreach ($entryobArray as $key => $_entryob) { |
||||||
134 | // get vars initialize |
||||||
135 | //------------------------------------- |
||||||
136 | $articles = $_entryob->toArray(); |
||||||
137 | //get category object |
||||||
138 | $_categoryob = $_entryob->_sbcolumns; |
||||||
139 | //get vars |
||||||
140 | $category = $_categoryob->toArray(); |
||||||
141 | //spot |
||||||
142 | $_outdata_arr = []; |
||||||
0 ignored issues
–
show
|
|||||||
143 | $_outdata_arr = $articles; |
||||||
144 | $_outdata_arr['column'] = $category; |
||||||
145 | |||||||
146 | $_outdata_arr['authorname'] = \XoopsUserUtility::getUnameFromId((int)$category['author']); |
||||||
147 | $_outdata_arr['poster'] = \XoopsUserUtility::getUnameFromId($articles['uid']); |
||||||
148 | $_outdata_arr['date'] = $myts->htmlSpecialChars(formatTimestamp($articles['datesub'], $soapConfig['dateformat'])); |
||||||
149 | $_outdata_arr['rating'] = number_format($articles['rating'], 2, '.', ''); |
||||||
150 | // -- Then the teaser text and as sorted data |
||||||
151 | $_outdata_arr['subhead'] = xoops_substr($articles['headline'], 0, $options[8]); |
||||||
152 | $_outdata_arr['sublead'] = xoops_substr($articles['lead'], 0, 255); |
||||||
153 | $_outdata_arr['subteaser'] = xoops_substr($articles['teaser'], 0, 255); |
||||||
154 | $_outdata_arr ['subbodytext'] = xoops_substr($articles['bodytext'], 0, 255); |
||||||
155 | $_outdata_arr ['bodytext'] = ''; |
||||||
156 | |||||||
157 | if ('datesub' === $sortname) { |
||||||
158 | $_outdata_arr['new'] = $myts->htmlSpecialChars(formatTimestamp($articles['datesub'], $soapConfig['dateformat'])); |
||||||
159 | } elseif ('counter' === $sortname) { |
||||||
160 | $_outdata_arr['new'] = _MB_SOAPBOX_HITS . $articles['counter']; |
||||||
161 | } elseif ('weight' === $sortname) { |
||||||
162 | $_outdata_arr['new'] = _MB_SOAPBOX_WEIGHT . $articles['weight']; |
||||||
163 | } elseif ('rating' === $sortname) { |
||||||
164 | $_outdata_arr['new'] = _MB_SOAPBOX_RATING . number_format($articles['rating'], 2, '.', '') . _MB_SOAPBOX_VOTE . $articles['votes']; |
||||||
165 | } else { |
||||||
166 | $_outdata_arr['new'] = $myts->htmlSpecialChars(formatTimestamp($articles['datesub'], $soapConfig['dateformat'])); |
||||||
167 | } |
||||||
168 | //-------------------- |
||||||
169 | $block_outdata['artdatas'][$i] = $_outdata_arr; |
||||||
170 | unset($_outdata_arr); |
||||||
171 | ++$i; |
||||||
172 | } |
||||||
173 | |||||||
174 | return $block_outdata; |
||||||
175 | } |
||||||
176 | |||||||
177 | /** |
||||||
178 | * @param $options |
||||||
179 | * @return string |
||||||
180 | */ |
||||||
181 | function b_arts_spot_edit($options) |
||||||
182 | { |
||||||
183 | global $xoopsDB; |
||||||
184 | $myts = \MyTextSanitizer:: getInstance(); |
||||||
185 | $helper = \XoopsModules\Soapbox\Helper::getInstance(); |
||||||
0 ignored issues
–
show
|
|||||||
186 | $columnIDs = []; |
||||||
187 | $module_name = 'soapbox'; |
||||||
188 | $moduleHandler = xoops_getHandler('module'); |
||||||
189 | $soapModule = $moduleHandler->getByDirname($module_name); |
||||||
190 | if (!is_object($soapModule)) { |
||||||
191 | return null; |
||||||
192 | } |
||||||
193 | $form = ''; |
||||||
194 | //----- |
||||||
195 | $chked = ''; |
||||||
196 | $form .= _MB_SOAPBOX_SPOTLIGHT; |
||||||
197 | if (1 === $options[0]) { |
||||||
198 | $chked = ' checked'; |
||||||
199 | } |
||||||
200 | $form .= "<input type='radio' name='options[0]' value='1'" . $chked . '> ' . _YES; |
||||||
201 | $chked = ''; |
||||||
202 | if (0 === $options[0]) { |
||||||
203 | $chked = ' checked'; |
||||||
204 | } |
||||||
205 | $form .= " <input type='radio' name='options[0]' value='0'" . $chked . '>' . _NO . '<br>'; |
||||||
206 | //----- |
||||||
207 | //----- |
||||||
208 | $form .= _MB_SOAPBOX_ARTSTOSHOW . "<input type='text' name='options[1]' value='" . $myts->htmlSpecialChars($options[1]) . "'> " . _MB_SOAPBOX_ARTCLS . '.<br>'; |
||||||
209 | //----- |
||||||
210 | $chked = ''; |
||||||
211 | $form .= _MB_SOAPBOX_SHOWDATE; |
||||||
212 | if (1 === $options[2]) { |
||||||
213 | $chked = ' checked'; |
||||||
214 | } |
||||||
215 | $form .= "<input type='radio' name='options[2]' value='1'" . $chked . '> ' . _YES; |
||||||
216 | $chked = ''; |
||||||
217 | if (0 === $options[2]) { |
||||||
218 | $chked = ' checked'; |
||||||
219 | } |
||||||
220 | $form .= " <input type='radio' name='options[2]' value='0'" . $chked . '>' . _NO . '<br>'; |
||||||
221 | //----- |
||||||
222 | $chked = ''; |
||||||
223 | $form .= _MB_SOAPBOX_SHOWBYLINE; |
||||||
224 | if (1 === $options[3]) { |
||||||
225 | $chked = ' checked'; |
||||||
226 | } |
||||||
227 | $form .= "<input type='radio' name='options[3]' value='1'" . $chked . '> ' . _YES; |
||||||
228 | $chked = ''; |
||||||
229 | if (0 === $options[3]) { |
||||||
230 | $chked = ' checked'; |
||||||
231 | } |
||||||
232 | $form .= ' <input type="radio" name="options[3]" value="0"' . $chked . '>' . _NO . '<br>'; |
||||||
233 | //----- |
||||||
234 | $chked = ''; |
||||||
235 | $form .= _MB_SOAPBOX_SHOWSTATS; |
||||||
236 | if (1 === $options[4]) { |
||||||
237 | $chked = ' checked'; |
||||||
238 | } |
||||||
239 | $form .= "<input type='radio' name='options[4]' value='1'" . $chked . '> ' . _YES; |
||||||
240 | $chked = ''; |
||||||
241 | if (0 === $options[4]) { |
||||||
242 | $chked = ' checked'; |
||||||
243 | } |
||||||
244 | $form .= " <input type='radio' name='options[4]' value='0' " . $chked . '>' . _NO . '<br>'; |
||||||
245 | |||||||
246 | $form .= _MB_SOAPBOX_TEMPLATE . "<select name='options[5]' >"; |
||||||
247 | $form .= "<option value='ver'"; |
||||||
248 | if ('ver' === $options[5]) { |
||||||
249 | $form .= ' selected'; |
||||||
250 | } |
||||||
251 | $form .= '>' . _MB_SOAPBOX_VERTICAL . "</option>\n"; |
||||||
252 | $form .= "<option value='hor'"; |
||||||
253 | if ('hor' === $options[5]) { |
||||||
254 | $form .= ' selected'; |
||||||
255 | } |
||||||
256 | $form .= '>' . _MB_SOAPBOX_HORIZONTAL . '</option>'; |
||||||
257 | $form .= '</select><br>'; |
||||||
258 | |||||||
259 | $chked = ''; |
||||||
260 | $form .= _MB_SOAPBOX_SHOWPIC; |
||||||
261 | if (1 === $options[6]) { |
||||||
262 | $chked = ' checked'; |
||||||
263 | } |
||||||
264 | $form .= "<input type='radio' name='options[6]' value='1' " . $chked . '> ' . _YES; |
||||||
265 | |||||||
266 | $chked = ''; |
||||||
267 | if (0 === $options[6]) { |
||||||
268 | $chked = ' checked'; |
||||||
269 | } |
||||||
270 | $form .= " <input type='radio' name='options[6]' value='0' " . $chked . '>' . _NO . '<br>'; |
||||||
271 | //---------- sortname ------ |
||||||
272 | $form .= '' . _MB_SOAPBOX_ORDER . " <select name='options[7]'>"; |
||||||
273 | |||||||
274 | $form .= "<option value='datesub'"; |
||||||
275 | if ('datesub' === $options[7]) { |
||||||
276 | $form .= ' selected'; |
||||||
277 | } |
||||||
278 | $form .= '>' . _MB_SOAPBOX_DATE . "</option>\n"; |
||||||
279 | |||||||
280 | $form .= "<option value='counter'"; |
||||||
281 | if ('counter' === $options[7]) { |
||||||
282 | $form .= ' selected'; |
||||||
283 | } |
||||||
284 | $form .= '>' . _MB_SOAPBOX_HITS . "</option>\n"; |
||||||
285 | |||||||
286 | $form .= "<option value='weight'"; |
||||||
287 | if ('weight' === $options[7]) { |
||||||
288 | $form .= ' selected'; |
||||||
289 | } |
||||||
290 | $form .= '>' . _MB_SOAPBOX_WEIGHT . "</option>\n"; |
||||||
291 | |||||||
292 | $form .= "<option value='rating'"; |
||||||
293 | if ('rating' === $options[7]) { |
||||||
294 | $form .= ' selected'; |
||||||
295 | } |
||||||
296 | $form .= '>' . _MB_SOAPBOX_RATING . "</option>\n"; |
||||||
297 | |||||||
298 | $form .= "</select>\n"; |
||||||
299 | |||||||
300 | $form .= ' <br>' . _MB_SOAPBOX_CHARS . " <input type='text' name='options[8]' value='" . $myts->htmlSpecialChars($options[8]) . "'> " . _MB_SOAPBOX_LENGTH . ''; |
||||||
301 | |||||||
302 | //------------------------------------- |
||||||
303 | /** @var \XoopsModules\Soapbox\EntrygetHandler $entrydataHandler */ |
||||||
304 | $entrydataHandler = new \XoopsModules\Soapbox\EntrygetHandler(); |
||||||
305 | $categoryobArray = $entrydataHandler->getColumns(); |
||||||
306 | $form .= '<br>' . _MB_SOAPBOX_SPOTLIGHT_TOPIC . "<br><select name='options[]' multiple='multiple'>"; |
||||||
307 | $form .= "<option value='0'>(ALL)</option>"; |
||||||
308 | if (!empty($categoryobArray)) { |
||||||
309 | foreach ($categoryobArray as $_categoryob) { |
||||||
310 | $categoryID = $_categoryob->getVar('columnID'); |
||||||
311 | $name = $_categoryob->getVar('name'); |
||||||
312 | $sel = ''; |
||||||
313 | if (in_array($categoryID, $columnIDs, true)) { |
||||||
314 | $sel = ' selected="selected"'; |
||||||
315 | } |
||||||
316 | $form .= "<option value='" . $categoryID . "' " . $sel . '>' . $categoryID . ' : ' . $name . '</option>'; |
||||||
317 | } |
||||||
318 | } |
||||||
319 | $form .= "</select><br>\n"; |
||||||
320 | |||||||
321 | return $form; |
||||||
322 | } |
||||||
323 |