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\{ |
||
23 | Common\LetterChoice, |
||
24 | Helper, |
||
25 | Tree, |
||
26 | Utility, |
||
27 | VideosHandler, |
||
28 | Thumbnails |
||
29 | }; |
||
30 | |||
31 | $GLOBALS['xoopsOption']['template_main'] = 'xoopstube_index.tpl'; |
||
32 | |||
33 | require_once __DIR__ . '/header.php'; |
||
34 | |||
35 | $moduleDirName = basename(__DIR__); |
||
36 | $moduleDirNameUpper = mb_strtoupper($moduleDirName); |
||
37 | |||
38 | $start = Request::getInt('start', Request::getInt('start', 0, 'POST'), 'GET'); |
||
39 | |||
40 | |||
41 | //$xoTheme->addStylesheet('modules/' . $moduleDirName . '/assets/css/xtubestyle.css'); |
||
42 | |||
43 | $xoTheme->addScript(XOOPS_URL . '/browse.php?Frameworks/jquery/jquery.js'); |
||
44 | $xoTheme->addStylesheet(XOOPSTUBE_URL . '/assets/css/module.css'); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
45 | |||
46 | //$xoopsTpl->assign('mod_url', XOOPSTUBE_URL . '/'); |
||
47 | |||
48 | //require_once XOOPS_ROOT_PATH . '/header.php'; |
||
49 | |||
50 | $mytree = new Tree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid'); |
||
51 | $myts = \MyTextSanitizer::getInstance(); // MyTextSanitizer object |
||
52 | |||
53 | // Begin Main page Heading etc |
||
54 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_indexpage'); |
||
55 | $head_arr = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
||
56 | |||
57 | $catarray['imageheader'] = Utility::renderImageHeader($head_arr['indeximage'], $head_arr['indexheading']); |
||
58 | $catarray['indexheaderalign'] = htmlspecialchars($head_arr['indexheaderalign'], ENT_QUOTES | ENT_HTML5); |
||
59 | $catarray['indexfooteralign'] = htmlspecialchars($head_arr['indexfooteralign'], ENT_QUOTES | ENT_HTML5); |
||
60 | |||
61 | $html = $head_arr['nohtml'] ? 0 : 1; |
||
62 | $smiley = $head_arr['nosmiley'] ? 0 : 1; |
||
63 | $xcodes = $head_arr['noxcodes'] ? 0 : 1; |
||
64 | $images = $head_arr['noimages'] ? 0 : 1; |
||
65 | $breaks = $head_arr['nobreak'] ? 1 : 0; |
||
66 | |||
67 | $catarray['indexheading'] = $myts->displayTarea($head_arr['indexheading'], $html, $smiley, $xcodes, $images, $breaks); |
||
68 | $catarray['indexheader'] = $myts->displayTarea($head_arr['indexheader'], $html, $smiley, $xcodes, $images, $breaks); |
||
69 | $catarray['indexfooter'] = $myts->displayTarea($head_arr['indexfooter'], $html, $smiley, $xcodes, $images, $breaks); |
||
70 | |||
71 | //$catarray['letters'] = Utility::getLetters(); |
||
72 | |||
73 | // Letter Choice Start --------------------------------------- |
||
74 | |||
75 | Helper::getInstance()->loadLanguage('common'); |
||
76 | $xoopsTpl->assign('letterChoiceTitle', constant('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC')); |
||
77 | $db = \XoopsDatabaseFactory::getDatabaseConnection(); |
||
78 | $objHandler = new VideosHandler($db); |
||
79 | $choicebyletter = new LetterChoice($objHandler, null, null, range('a', 'z'), 'letter', 'viewcat.php'); |
||
80 | //$choicebyletter = new LetterChoice($objHandler, null, null, range('a', 'z'), 'init', XOOPSTUBE_URL . '/letter.php'); |
||
81 | //render the LetterChoice partial and story as part of the Category array |
||
82 | //$catarray['letters'] = $choicebyletter->render($alphaCount, $howmanyother); |
||
83 | |||
84 | $catarray['letters'] = $choicebyletter->render(); |
||
85 | |||
86 | //now assign it to the Smarty variable |
||
87 | $xoopsTpl->assign('catarray', $catarray); |
||
88 | |||
89 | // Letter Choice End ------------------------------------ |
||
90 | |||
91 | // End main page Headers |
||
92 | |||
93 | $count = 1; |
||
94 | $chcount = 0; |
||
95 | $countin = 0; |
||
96 | |||
97 | // Begin Main page linkload info |
||
98 | $listings = Utility::getTotalItems(); |
||
99 | // get total amount of categories |
||
100 | $total_cat = Utility::getTotalCategoryCount(); |
||
101 | |||
102 | $catsort = $GLOBALS['xoopsModuleConfig']['sortcats']; |
||
103 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' WHERE pid=0 ORDER BY ' . $catsort; |
||
104 | $result = $GLOBALS['xoopsDB']->query($sql); |
||
105 | while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||
106 | ++$countin; |
||
107 | $subtotalvideoload = 0; |
||
108 | $totalvideoload = Utility::getTotalItems($myrow['cid'], 1); |
||
109 | $indicator = Utility::isNewImage($totalvideoload['published']); |
||
110 | if (Utility::checkGroups($myrow['cid'])) { |
||
111 | $title = htmlspecialchars($myrow['title'], ENT_QUOTES | ENT_HTML5); |
||
112 | |||
113 | $arr = []; |
||
114 | $arr = $mytree->getFirstChild($myrow['cid'], 'title'); |
||
115 | |||
116 | $space = 1; |
||
117 | $chcount = 1; |
||
118 | $subcategories = ''; |
||
119 | foreach ($arr as $ele) { |
||
120 | if (true === Utility::checkGroups($ele['cid'])) { |
||
121 | if (1 == $GLOBALS['xoopsModuleConfig']['subcats']) { |
||
122 | $chtitle = htmlspecialchars($ele['title'], ENT_QUOTES | ENT_HTML5); |
||
123 | if ($chcount > 5) { |
||
124 | $subcategories .= '...'; |
||
125 | break; |
||
126 | } |
||
127 | if ($space > 0) { |
||
128 | $subcategories .= '<br>'; |
||
129 | } |
||
130 | $subcategories .= '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $ele['cid'] . '">' . $chtitle . '</a>'; |
||
131 | ++$space; |
||
132 | ++$chcount; |
||
133 | } |
||
134 | } |
||
135 | } |
||
136 | |||
137 | // This code is copyright WF-Projects |
||
138 | // Using this code without our permission or removing this code voids the license agreement |
||
139 | $_image = $myrow['imgurl'] ? urldecode($myrow['imgurl']) : ''; |
||
140 | if ('' !== $_image && $GLOBALS['xoopsModuleConfig']['usethumbs']) { |
||
141 | $_thumb_image = new Thumbnails($_image, $GLOBALS['xoopsModuleConfig']['catimage'], 'thumbs'); |
||
142 | if ($_thumb_image) { |
||
143 | $_thumb_image->setUseThumbs(1); |
||
144 | $_thumb_image->setImageType('gd2'); |
||
145 | $_image = $_thumb_image->createThumbnail($GLOBALS['xoopsModuleConfig']['shotwidth'], $GLOBALS['xoopsModuleConfig']['shotheight'], $GLOBALS['xoopsModuleConfig']['imagequality'], $GLOBALS['xoopsModuleConfig']['updatethumbs'], $GLOBALS['xoopsModuleConfig']['imageAspect']); |
||
146 | } |
||
147 | } |
||
148 | if (empty($_image) || '' == $_image) { |
||
149 | $imgurl = $indicator['image']; |
||
150 | $_width = 33; |
||
151 | $_height = 24; |
||
152 | } else { |
||
153 | $imgurl = "{$GLOBALS['xoopsModuleConfig']['catimage']}/$_image"; |
||
154 | $_width = $GLOBALS['xoopsModuleConfig']['shotwidth']; |
||
155 | $_height = $GLOBALS['xoopsModuleConfig']['shotheight']; |
||
156 | } |
||
157 | // End |
||
158 | |||
159 | $xoopsTpl->append( |
||
160 | 'categories', |
||
161 | [ |
||
162 | 'image' => XOOPS_URL . "/$imgurl", |
||
163 | 'id' => $myrow['cid'], |
||
164 | 'title' => $title, |
||
165 | 'subcategories' => $subcategories, |
||
166 | 'totalvideos' => $totalvideoload['count'], |
||
167 | 'width' => $_width, |
||
168 | 'height' => $_height, |
||
169 | 'count' => $count, |
||
170 | 'alttext' => $myrow['description'], |
||
171 | ] |
||
172 | ); |
||
173 | ++$count; |
||
174 | } |
||
175 | } |
||
176 | switch ($total_cat) { |
||
177 | case '1': |
||
178 | $lang_thereare = _MD_XOOPSTUBE_THEREIS; |
||
179 | break; |
||
180 | default: |
||
181 | $lang_thereare = _MD_XOOPSTUBE_THEREARE; |
||
182 | break; |
||
183 | } |
||
184 | |||
185 | $time = time(); |
||
186 | |||
187 | $sql = $GLOBALS['xoopsDB']->query('SELECT lastvideosyn, lastvideostotal FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_indexpage')); |
||
188 | $lastvideos = $GLOBALS['xoopsDB']->fetchArray($sql); |
||
189 | |||
190 | if (1 == $lastvideos['lastvideosyn'] && $lastvideos['lastvideostotal'] > 0) { |
||
191 | $result = $GLOBALS['xoopsDB']->query( |
||
192 | 'SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published > 0 |
||
193 | AND published <= ' . $time . ' |
||
194 | AND (expired = 0 OR expired > ' . $time . ') |
||
195 | AND offline = 0 |
||
196 | ORDER BY published DESC', |
||
197 | 0, |
||
198 | 0 |
||
199 | ); |
||
200 | [$count] = $GLOBALS['xoopsDB']->fetchRow($result); |
||
201 | |||
202 | $count = (($count > $lastvideos['lastvideostotal']) && (0 !== $lastvideos['lastvideostotal'])) ? $lastvideos['lastvideostotal'] : $count; |
||
203 | $limit = (($start + $GLOBALS['xoopsModuleConfig']['perpage']) > $count) ? ($count - $start) : $GLOBALS['xoopsModuleConfig']['perpage']; |
||
204 | |||
205 | $result = $GLOBALS['xoopsDB']->query( |
||
206 | 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published > 0 |
||
207 | AND published <= ' . time() . ' |
||
208 | AND (expired = 0 OR expired > ' . time() . ') |
||
209 | AND offline = 0 |
||
210 | ORDER BY published DESC', |
||
211 | $limit, |
||
212 | $start |
||
213 | ); |
||
214 | |||
215 | while (false !== ($videoArray = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||
216 | if (true === Utility::checkGroups($videoArray['cid'])) { |
||
217 | $res_type = 0; |
||
218 | $moderate = 0; |
||
219 | $cid = $videoArray['cid']; |
||
220 | require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/videoloadinfo.php'; |
||
221 | $xoopsTpl->append('video', $video); |
||
222 | } |
||
223 | } |
||
224 | |||
225 | $pagenav = new \XoopsPageNav($count, $GLOBALS['xoopsModuleConfig']['perpage'], $start, 'start'); |
||
226 | $xoopsTpl->assign('pagenav', $pagenav->renderNav()); |
||
227 | $xoopsTpl->assign('showlatest', $lastvideos['lastvideosyn']); |
||
228 | } |
||
229 | |||
230 | $xoopsTpl->assign('cat_columns', $GLOBALS['xoopsModuleConfig']['catcolumns']); |
||
231 | $xoopsTpl->assign('lang_thereare', sprintf($lang_thereare, $total_cat, $listings['count'])); |
||
232 | $xoopsTpl->assign('module_dir', $xoopsModule->getVar('dirname')); |
||
233 | $xoopsTpl->assign('mod_url', XOOPSTUBE_URL . '/'); |
||
234 | $xoopsTpl->assign('xoopstube_url', XOOPSTUBE_URL . '/'); |
||
235 | |||
236 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
237 |