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 | /** |
||||||||
4 | * Module: XoopsTube |
||||||||
5 | * |
||||||||
6 | * You may not change or alter any portion of this comment or credits |
||||||||
7 | * of supporting developers from this source code or any supporting source code |
||||||||
8 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||||||||
9 | * |
||||||||
10 | * PHP version 5 |
||||||||
11 | * |
||||||||
12 | * @category Module |
||||||||
13 | * @package Xoopstube |
||||||||
14 | * @author XOOPS Development Team |
||||||||
15 | * @copyright 2001-2016 XOOPS Project (https://xoops.org) |
||||||||
16 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||||||||
17 | * @link https://xoops.org/ |
||||||||
18 | * @since 1.0.6 |
||||||||
19 | */ |
||||||||
20 | |||||||||
21 | use Xmf\Request; |
||||||||
22 | use XoopsModules\Xoopstube\{Common\LetterChoice, |
||||||||
23 | Helper, |
||||||||
24 | Thumbnails, |
||||||||
25 | Tree, |
||||||||
26 | Utility, |
||||||||
27 | VideosHandler |
||||||||
28 | }; |
||||||||
29 | |||||||||
30 | /** @var Helper $helper */ |
||||||||
31 | |||||||||
32 | $GLOBALS['xoopsOption']['template_main'] = 'xoopstube_viewcat.tpl'; |
||||||||
33 | |||||||||
34 | require_once __DIR__ . '/header.php'; |
||||||||
35 | |||||||||
36 | $helper = Helper::getInstance(); |
||||||||
37 | |||||||||
38 | // Begin Main page Heading etc |
||||||||
39 | $cid = Request::getInt('cid', 0, 'GET'); //cleanRequestVars($_REQUEST, 'cid', 0); |
||||||||
40 | $selectdate = Request::getString('selectdate', ''); //cleanRequestVars($_REQUEST, 'selectdate', ''); |
||||||||
41 | $list = Request::getString('letter', ''); // cleanRequestVars($_REQUEST, 'letter', ''); |
||||||||
42 | $start = Request::getInt('start', 0, 'GET'); //cleanRequestVars($_REQUEST, 'start', 0); |
||||||||
43 | |||||||||
44 | $catsort = $GLOBALS['xoopsModuleConfig']['sortcats']; |
||||||||
45 | $mytree = new Tree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid'); |
||||||||
46 | $arr = $mytree->getFirstChild($cid, $catsort); |
||||||||
47 | |||||||||
48 | if (is_array($arr) > 0 && !$list && !$selectdate) { |
||||||||
49 | if (false === Utility::checkGroups($cid)) { |
||||||||
50 | redirect_header('index.php', 1, _MD_XOOPSTUBE_MUSTREGFIRST); |
||||||||
51 | } |
||||||||
52 | } |
||||||||
53 | |||||||||
54 | //require_once XOOPS_ROOT_PATH . '/header.php'; |
||||||||
55 | |||||||||
56 | //$xoTheme->addStylesheet('modules/' . $moduleDirName . '/assets/css/xtubestyle.css'); |
||||||||
57 | |||||||||
58 | $xoTheme->addScript(XOOPS_URL . '/browse.php?Frameworks/jquery/jquery.js'); |
||||||||
59 | //$xoTheme->addScript(XOOPSTUBE_URL . '/assets/js/magnific/jquery.magnific-popup.min.js'); |
||||||||
60 | //$xoTheme->addStylesheet(XOOPSTUBE_URL . '/assets/js/magnific/magnific-popup.css'); |
||||||||
61 | $xoTheme->addStylesheet(XOOPSTUBE_URL . '/assets/css/module.css'); |
||||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||||
62 | |||||||||
63 | $xoTheme->addScript(XOOPS_URL . '/browse.php?Frameworks/jquery/jquery.js'); |
||||||||
64 | //$xoTheme->addScript(XOOPSTUBE_URL . '/assets/js/magnific/jquery.magnific-popup.min.js'); |
||||||||
65 | //$xoTheme->addStylesheet(XOOPSTUBE_URL . '/assets/js/magnific/magnific-popup.css'); |
||||||||
66 | $xoTheme->addStylesheet(XOOPSTUBE_URL . '/assets/css/module.css'); |
||||||||
67 | |||||||||
68 | $xoopsTpl->assign('mod_url', XOOPSTUBE_URL . '/'); |
||||||||
69 | |||||||||
70 | global $xoopsModule; |
||||||||
71 | |||||||||
72 | $myts = \MyTextSanitizer::getInstance(); // MyTextSanitizer object |
||||||||
73 | |||||||||
74 | /* |
||||||||
75 | $catarray['letters'] = Utility::getLetters(); |
||||||||
76 | //$catarray['letters'] = Utility::getLettersChoice(); |
||||||||
77 | $catarray['imageheader'] = Utility::renderImageHeader(); |
||||||||
78 | $xoopsTpl->assign('catarray', $catarray); |
||||||||
79 | */ |
||||||||
80 | |||||||||
81 | // Letter Choice Start --------------------------------------- |
||||||||
82 | |||||||||
83 | Helper::getInstance()->loadLanguage('common'); |
||||||||
84 | $xoopsTpl->assign('letterChoiceTitle', constant('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC')); |
||||||||
85 | $db = \XoopsDatabaseFactory::getDatabaseConnection(); |
||||||||
86 | $videosHandler = $helper->getHandler('Videos'); //new VideosHandler($db); |
||||||||
87 | $choicebyletter = new LetterChoice($videosHandler, null, null, range('a', 'z'), 'letter'); |
||||||||
88 | //$choicebyletter = new LetterChoice($videosHandler, null, null, range('a', 'z'), 'init', XOOPSTUBE_URL . '/letter.php'); |
||||||||
89 | $catarray['letters'] = $choicebyletter->render(); |
||||||||
90 | //$catarray['letters'] = $choicebyletter->render($alphaCount, $howmanyother); |
||||||||
91 | |||||||||
92 | $xoopsTpl->assign('catarray', $catarray); |
||||||||
93 | |||||||||
94 | // Letter Choice End ------------------------------------ |
||||||||
95 | |||||||||
96 | //$catArray['letters'] = Utility::getLettersChoice(); |
||||||||
97 | //$catArray['letters'] = Utility::getLettersChoice(); |
||||||||
98 | //$catArray['toolbar'] = xoopstube_toolbar(); |
||||||||
99 | //$xoopsTpl->assign('catarray', $catArray); |
||||||||
100 | |||||||||
101 | //$catArray['imageheader'] = Utility::headerImage(); |
||||||||
102 | ////$catArray['letters'] = Wfdownloads\Utility::lettersChoice(); |
||||||||
103 | ///** @var \XoopsDatabase $db */ |
||||||||
104 | //$db = \XoopsDatabaseFactory::getDatabaseConnection(); |
||||||||
105 | //downloadHandler = new Xoopstube\DownloadHandler($db); |
||||||||
106 | //$choicebyletter = new LetterChoice(downloadHandler, null, null, range('a', 'z'), 'letter'); |
||||||||
107 | //$catarray['letters'] = $choicebyletter->render(); |
||||||||
108 | |||||||||
109 | // Breadcrumb |
||||||||
110 | $pathstring = '<li><a href="index.php">' . _MD_XOOPSTUBE_MAIN . '</a></li>'; |
||||||||
111 | $pathstring .= $mytree->getNicePathFromId($cid, 'title', 'viewcat.php?op='); |
||||||||
112 | $xoopsTpl->assign('category_path', $pathstring); |
||||||||
113 | $xoopsTpl->assign('category_id', $cid); |
||||||||
114 | |||||||||
115 | // Display Sub-categories for selected Category |
||||||||
116 | if (is_array($arr) > 0 && !$list && !$selectdate) { |
||||||||
117 | $scount = 1; |
||||||||
118 | foreach ($arr as $ele) { |
||||||||
119 | if (false === Utility::checkGroups($ele['cid'])) { |
||||||||
120 | continue; |
||||||||
121 | } |
||||||||
122 | $sub_arr = []; |
||||||||
123 | $sub_arr = $mytree->getFirstChild($ele['cid'], $catsort); |
||||||||
124 | $space = 1; |
||||||||
125 | $chcount = 1; |
||||||||
126 | $infercategories = ''; |
||||||||
127 | foreach ($sub_arr as $sub_ele) { |
||||||||
128 | // Subitem file count |
||||||||
129 | $hassubitems = Utility::getTotalItems($sub_ele['cid']); |
||||||||
130 | // Filter group permissions |
||||||||
131 | if (true === Utility::checkGroups($sub_ele['cid'])) { |
||||||||
132 | // If subcategory count > 5 then finish adding subcats to $infercategories and end |
||||||||
133 | if ($chcount > 5) { |
||||||||
134 | $infercategories .= '...'; |
||||||||
135 | break; |
||||||||
136 | } |
||||||||
137 | if ($space > 0) { |
||||||||
138 | $infercategories .= ', '; |
||||||||
139 | } |
||||||||
140 | |||||||||
141 | $infercategories .= '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $sub_ele['cid'] . '">' . htmlspecialchars($sub_ele['title'], ENT_QUOTES | ENT_HTML5) . '</a> (' . $hassubitems['count'] . ')'; |
||||||||
142 | ++$space; |
||||||||
143 | ++$chcount; |
||||||||
144 | } |
||||||||
145 | } |
||||||||
146 | $totalvideos = Utility::getTotalItems($ele['cid']); |
||||||||
147 | $indicator = Utility::isNewImage($totalvideos['published']); |
||||||||
148 | |||||||||
149 | // This code is copyright WF-Projects |
||||||||
150 | // Using this code without our permission or removing this code voids the license agreement |
||||||||
151 | |||||||||
152 | $_image = $ele['imgurl'] ? urldecode($ele['imgurl']) : ''; |
||||||||
153 | if ('' !== $_image && $GLOBALS['xoopsModuleConfig']['usethumbs']) { |
||||||||
154 | $_thumb_image = new Thumbnails($_image, $GLOBALS['xoopsModuleConfig']['catimage'], 'thumbs'); |
||||||||
155 | if ($_thumb_image) { |
||||||||
156 | $_thumb_image->setUseThumbs(1); |
||||||||
157 | $_thumb_image->setImageType('gd2'); |
||||||||
158 | $_image = $_thumb_image->createThumbnail($GLOBALS['xoopsModuleConfig']['shotwidth'], $GLOBALS['xoopsModuleConfig']['shotheight'], $GLOBALS['xoopsModuleConfig']['imagequality'], $GLOBALS['xoopsModuleConfig']['updatethumbs'], $GLOBALS['xoopsModuleConfig']['imageAspect']); |
||||||||
159 | } |
||||||||
160 | } |
||||||||
161 | |||||||||
162 | if (empty($_image) || '' == $_image) { |
||||||||
163 | $imgurl = $indicator['image']; |
||||||||
164 | $_width = 33; |
||||||||
165 | $_height = 24; |
||||||||
166 | } else { |
||||||||
167 | $imgurl = "{$GLOBALS['xoopsModuleConfig']['catimage']}/$_image"; |
||||||||
168 | $_width = $GLOBALS['xoopsModuleConfig']['shotwidth']; |
||||||||
169 | $_height = $GLOBALS['xoopsModuleConfig']['shotheight']; |
||||||||
170 | } |
||||||||
171 | /* |
||||||||
172 | * End |
||||||||
173 | */ |
||||||||
174 | |||||||||
175 | $xoopsTpl->append( |
||||||||
176 | 'subcategories', |
||||||||
177 | [ |
||||||||
178 | 'title' => htmlspecialchars($ele['title'], ENT_QUOTES | ENT_HTML5), |
||||||||
179 | 'id' => $ele['cid'], |
||||||||
180 | 'image' => XOOPS_URL . "/$imgurl", |
||||||||
181 | 'width' => $_width, |
||||||||
182 | 'height' => $_height, |
||||||||
183 | 'infercategories' => $infercategories, |
||||||||
184 | 'totalvideos' => $totalvideos['count'], |
||||||||
185 | 'count' => $scount, |
||||||||
186 | 'alttext' => $ele['description'], |
||||||||
187 | ] |
||||||||
188 | ); |
||||||||
189 | ++$scount; |
||||||||
190 | } |
||||||||
191 | } |
||||||||
192 | |||||||||
193 | // Show Description for Category listing |
||||||||
194 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' WHERE cid=' . $cid; |
||||||||
195 | $head_arr = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
||||||||
196 | $html = isset($head_arr['nohtml']) ? 0 : 1; |
||||||||
197 | $smiley = isset($head_arr['nosmiley']) ? 0 : 1; |
||||||||
198 | $xcodes = isset($head_arr['noxcodes']) ? 0 : 1; |
||||||||
199 | $images = isset($head_arr['noimages']) ? 0 : 1; |
||||||||
200 | $breaks = isset($head_arr['nobreak']) ? 1 : 0; |
||||||||
201 | $tempDescription = $head_arr['description'] ?? ''; |
||||||||
202 | $description = &$myts->displayTarea($tempDescription, $html, $smiley, $xcodes, $images, $breaks); |
||||||||
203 | $xoopsTpl->assign('description', $description); |
||||||||
204 | /** @var \XoopsModuleHandler $moduleHandler */ |
||||||||
205 | $moduleHandler = xoops_getHandler('module'); |
||||||||
206 | $versioninfo = $moduleHandler->get($xoopsModule->getVar('mid')); |
||||||||
207 | if (isset($head_arr['title']) && '' !== $head_arr['title']) { |
||||||||
208 | $xoopsTpl->assign('xoops_pagetitle', $versioninfo->getInfo('name') . ': ' . $head_arr['title']); |
||||||||
209 | } else { |
||||||||
210 | $xoopsTpl->assign('xoops_pagetitle', $versioninfo->getInfo('name')); |
||||||||
211 | } |
||||||||
212 | |||||||||
213 | if (isset($head_arr['client_id']) && (int)$head_arr['client_id'] > 0) { |
||||||||
214 | $catarray['imageheader'] = Utility::getBannerFromClientId($head_arr['client_id']); |
||||||||
215 | } elseif (isset($head_arr['banner_id']) && (int)$head_arr['banner_id'] > 0) { |
||||||||
216 | $catarray['imageheader'] = Utility::getBannerFromBannerId($head_arr['banner_id']); |
||||||||
217 | } else { |
||||||||
218 | $catarray['imageheader'] = Utility::renderImageHeader(); |
||||||||
219 | } |
||||||||
220 | $xoopsTpl->assign('catarray', $catarray); |
||||||||
221 | // Extract linkload information from database |
||||||||
222 | $xoopsTpl->assign('show_category_title', true); |
||||||||
223 | |||||||||
224 | $orderby0 = (isset($_REQUEST['orderby']) |
||||||||
225 | && !empty($_REQUEST['orderby'])) ? Utility::convertOrderByIn(htmlspecialchars($_REQUEST['orderby'], ENT_QUOTES | ENT_HTML5)) : Utility::convertOrderByIn($GLOBALS['xoopsModuleConfig']['linkxorder']); |
||||||||
226 | $orderby = Request::getString('orderby', '', 'GET') ? Utility::convertOrderByIn(Request::getString('orderby', '', 'GET')) : Utility::convertOrderByIn($GLOBALS['xoopsModuleConfig']['linkxorder']); |
||||||||
227 | |||||||||
228 | if ($selectdate) { |
||||||||
229 | $d = date('j', $selectdate); |
||||||||
0 ignored issues
–
show
$selectdate of type string is incompatible with the type integer|null expected by parameter $timestamp of date() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||||
230 | $m = date('m', $selectdate); |
||||||||
231 | $y = date('Y', $selectdate); |
||||||||
232 | |||||||||
233 | $stat_begin = mktime(0, 0, 0, $m, $d, $y); |
||||||||
0 ignored issues
–
show
$d of type string is incompatible with the type integer expected by parameter $day of mktime() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() $y of type string is incompatible with the type integer expected by parameter $year of mktime() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() $m of type string is incompatible with the type integer expected by parameter $month of mktime() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||||
234 | $stat_end = mktime(23, 59, 59, $m, $d, $y); |
||||||||
235 | |||||||||
236 | $query = ' WHERE published>=' . $stat_begin . ' AND published<=' . $stat_end . ' AND (expired=0 OR expired>' . time() . ') AND offline=0 AND cid>0'; |
||||||||
237 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . $query . ' ORDER BY ' . $orderby; |
||||||||
238 | $result = $GLOBALS['xoopsDB']->query($sql, $GLOBALS['xoopsModuleConfig']['perpage'], $start); |
||||||||
239 | |||||||||
240 | $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . $query; |
||||||||
241 | [$count] = $GLOBALS['xoopsDB']->fetchRow($GLOBALS['xoopsDB']->query($sql)); |
||||||||
242 | |||||||||
243 | $list_by = 'selectdate=' . $selectdate; |
||||||||
244 | |||||||||
245 | $xoopsTpl->assign('is_selectdate', true); |
||||||||
246 | $xoopsTpl->assign('selected_date', Utility::getTimestamp(formatTimestamp($selectdate, $GLOBALS['xoopsModuleConfig']['dateformat']))); |
||||||||
247 | } elseif ($list) { |
||||||||
248 | $query = " WHERE title LIKE '$list%' AND (published>0 AND published<=" . time() . ') AND (expired=0 OR expired>' . time() . ') AND offline=0 AND cid>0'; |
||||||||
249 | |||||||||
250 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . $query . ' ORDER BY ' . $orderby; |
||||||||
251 | $result = $GLOBALS['xoopsDB']->query($sql, $GLOBALS['xoopsModuleConfig']['perpage'], $start); |
||||||||
252 | |||||||||
253 | $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . $query; |
||||||||
254 | [$count] = $GLOBALS['xoopsDB']->fetchRow($GLOBALS['xoopsDB']->query($sql)); |
||||||||
255 | $list_by = "letter=$list"; |
||||||||
256 | } else { |
||||||||
257 | $query = 'WHERE a.published>0 AND a.published<=' . time() . ' AND (a.expired=0 OR a.expired>' . time() . ') AND a.offline=0' . ' AND (b.cid=a.cid OR (a.cid=' . $cid . ' OR b.cid=' . $cid . '))'; |
||||||||
258 | |||||||||
259 | $sql = 'SELECT DISTINCT a.* FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' a LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('xoopstube_altcat') . ' b ON b.lid=a.lid ' . $query . ' ORDER BY ' . $orderby; |
||||||||
260 | $result = $GLOBALS['xoopsDB']->query($sql, $GLOBALS['xoopsModuleConfig']['perpage'], $start); |
||||||||
261 | |||||||||
262 | // $sql2 = 'SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' a LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('xoopstube_altcat') . ' b ON b.lid=a.lid ' . $query; |
||||||||
263 | // [$count] = $GLOBALS['xoopsDB']->fetchRow($GLOBALS['xoopsDB']->query($sql2)); |
||||||||
264 | |||||||||
265 | $count = $result->num_rows; |
||||||||
266 | |||||||||
267 | $order = Utility::convertOrderByOut($orderby); |
||||||||
268 | $list_by = 'cid=' . $cid . '&orderby=' . $order; |
||||||||
269 | $xoopsTpl->assign('show_category_title', false); |
||||||||
270 | } |
||||||||
271 | $pagenav = new \XoopsPageNav($count, $GLOBALS['xoopsModuleConfig']['perpage'], $start, 'start', $list_by); |
||||||||
272 | |||||||||
273 | // Show videos |
||||||||
274 | if ($count > 0) { |
||||||||
275 | $moderate = 0; |
||||||||
276 | |||||||||
277 | while (false !== ($videoArray = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||||||||
278 | if (true === Utility::checkGroups($videoArray['cid'])) { |
||||||||
279 | require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/videoloadinfo.php'; |
||||||||
280 | $xoopsTpl->append('video', $video); |
||||||||
281 | } |
||||||||
282 | } |
||||||||
283 | |||||||||
284 | unset($videoArray); |
||||||||
285 | |||||||||
286 | // Show order box |
||||||||
287 | $xoopsTpl->assign('show_videos', false); |
||||||||
288 | if ($count > 1 && 0 !== $cid) { |
||||||||
289 | $xoopsTpl->assign('show_videos', true); |
||||||||
290 | $orderbyTrans = Utility::convertOrderByTrans($orderby); |
||||||||
291 | $xoopsTpl->assign('lang_cursortedby', sprintf(_MD_XOOPSTUBE_CURSORTBY, Utility::convertOrderByTrans($orderby))); |
||||||||
292 | $orderby = Utility::convertOrderByOut($orderby); |
||||||||
293 | } |
||||||||
294 | |||||||||
295 | // Screenshots display |
||||||||
296 | $xoopsTpl->assign('show_screenshot', false); |
||||||||
297 | if (isset($GLOBALS['xoopsModuleConfig']['screenshot']) && 1 == $GLOBALS['xoopsModuleConfig']['screenshot']) { |
||||||||
298 | $xoopsTpl->assign('shotwidth', $GLOBALS['xoopsModuleConfig']['shotwidth']); |
||||||||
299 | $xoopsTpl->assign('shotheight', $GLOBALS['xoopsModuleConfig']['shotheight']); |
||||||||
300 | $xoopsTpl->assign('show_screenshot', true); |
||||||||
301 | } |
||||||||
302 | |||||||||
303 | // Nav page render |
||||||||
304 | $page_nav = $pagenav->renderNav(); |
||||||||
305 | $istrue = (isset($page_nav) && !empty($page_nav)); |
||||||||
306 | $xoopsTpl->assign('page_nav', $istrue); |
||||||||
307 | $xoopsTpl->assign('pagenav', $page_nav); |
||||||||
308 | $xoopsTpl->assign('module_dir', $xoopsModule->getVar('dirname')); |
||||||||
309 | } |
||||||||
310 | |||||||||
311 | $xoopsTpl->assign('cat_columns', $GLOBALS['xoopsModuleConfig']['catcolumns']); |
||||||||
312 | |||||||||
313 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||||||
314 |