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 | * 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 (http://xoops.org) |
||
16 | * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
||
17 | * @link http://xoops.org/ |
||
18 | * @since 1.0.6 |
||
19 | */ |
||
20 | |||
21 | include __DIR__ . '/header.php'; |
||
22 | |||
23 | // Begin Main page Heading etc |
||
24 | $cid = XoopsRequest::getInt('cid', 0, 'GET'); //xtubeCleanRequestVars($_REQUEST, 'cid', 0); |
||
25 | $selectdate = XoopsRequest::getString('selectdate', ''); //xtubeCleanRequestVars($_REQUEST, 'selectdate', ''); |
||
26 | $list = XoopsRequest::getString('list', '');// xtubeCleanRequestVars($_REQUEST, 'list', ''); |
||
27 | $start = XoopsRequest::getInt('start', 0, 'GET'); //xtubeCleanRequestVars($_REQUEST, 'start', 0); |
||
28 | |||
29 | $catsort = $GLOBALS['xoopsModuleConfig']['sortcats']; |
||
30 | $mytree = new XoopstubeTree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid'); |
||
31 | $arr = $mytree->getFirstChild($cid, $catsort); |
||
32 | |||
33 | if (is_array($arr) > 0 && !$list && !$selectdate) { |
||
34 | if (false === XoopstubeUtilities::xtubeCheckGroups($cid)) { |
||
35 | redirect_header('index.php', 1, _MD_XOOPSTUBE_MUSTREGFIRST); |
||
36 | } |
||
37 | } |
||
38 | |||
39 | $xoopsOption['template_main'] = 'xoopstube_viewcat.tpl'; |
||
40 | |||
41 | include XOOPS_ROOT_PATH . '/header.php'; |
||
42 | |||
43 | global $xoopsModule; |
||
0 ignored issues
–
show
|
|||
44 | //$catarray['letters'] = XoopstubeUtilities::xtubeGetLetters(); |
||
45 | $catarray['letters'] = XoopstubeUtilities::xoopstubeLettersChoice(); |
||
46 | $catarray['imageheader'] = XoopstubeUtilities::xtubeRenderImageHeader(); |
||
47 | $xoopsTpl->assign('catarray', $catarray); |
||
48 | |||
49 | //$catArray['letters'] = XoopstubeUtilities::xtubeLettersChoice(); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
62% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
50 | //$catArray['letters'] = XoopstubeUtilities::xoopstubeLettersChoice(); |
||
51 | //$catArray['toolbar'] = xoopstube_toolbar(); |
||
52 | //$xoopsTpl->assign('catarray', $catArray); |
||
53 | |||
54 | // Breadcrumb |
||
55 | $pathstring = '<a href="index.php">' . _MD_XOOPSTUBE_MAIN . '</a> : '; |
||
56 | $pathstring .= $mytree->getNicePathFromId($cid, 'title', 'viewcat.php?op='); |
||
57 | $xoopsTpl->assign('category_path', $pathstring); |
||
58 | $xoopsTpl->assign('category_id', $cid); |
||
59 | |||
60 | // Display Sub-categories for selected Category |
||
61 | if (is_array($arr) > 0 && !$list && !$selectdate) { |
||
62 | $scount = 1; |
||
63 | foreach ($arr as $ele) { |
||
64 | if (false === XoopstubeUtilities::xtubeCheckGroups($ele['cid'])) { |
||
65 | continue; |
||
66 | } |
||
67 | $sub_arr = array(); |
||
68 | $sub_arr = $mytree->getFirstChild($ele['cid'], $catsort); |
||
69 | $space = 1; |
||
70 | $chcount = 1; |
||
71 | $infercategories = ''; |
||
72 | View Code Duplication | foreach ($sub_arr as $sub_ele) { |
|
73 | // Subitem file count |
||
74 | $hassubitems = XoopstubeUtilities::xtubeGetTotalItems($sub_ele['cid']); |
||
75 | // Filter group permissions |
||
76 | if (true === XoopstubeUtilities::xtubeCheckGroups($sub_ele['cid'])) { |
||
77 | // If subcategory count > 5 then finish adding subcats to $infercategories and end |
||
78 | if ($chcount > 5) { |
||
79 | $infercategories .= '...'; |
||
80 | break; |
||
81 | } |
||
82 | if ($space > 0) { |
||
83 | $infercategories .= ', '; |
||
84 | } |
||
85 | |||
86 | $infercategories .= '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $sub_ele['cid'] . '">' |
||
87 | . $xtubemyts->htmlSpecialCharsStrip($sub_ele['title']) . '</a> (' . $hassubitems['count'] . ')'; |
||
88 | ++$space; |
||
89 | ++$chcount; |
||
90 | } |
||
91 | } |
||
92 | $totalvideos = XoopstubeUtilities::xtubeGetTotalItems($ele['cid']); |
||
93 | $indicator = XoopstubeUtilities::xtubeIsNewImage($totalvideos['published']); |
||
94 | |||
95 | // This code is copyright WF-Projects |
||
96 | // Using this code without our permission or removing this code voids the license agreement |
||
97 | |||
98 | $_image = $ele['imgurl'] ? urldecode($ele['imgurl']) : ''; |
||
99 | View Code Duplication | if ($_image !== '' && $GLOBALS['xoopsModuleConfig']['usethumbs']) { |
|
100 | $_thumb_image = new XtubeThumbsNails($_image, $GLOBALS['xoopsModuleConfig']['catimage'], 'thumbs'); |
||
101 | if ($_thumb_image) { |
||
102 | $_thumb_image->setUseThumbs(1); |
||
103 | $_thumb_image->setImageType('gd2'); |
||
104 | $_image = $_thumb_image->createThumbnail($GLOBALS['xoopsModuleConfig']['shotwidth'], $GLOBALS['xoopsModuleConfig']['shotheight'], $GLOBALS['xoopsModuleConfig']['imagequality'], |
||
105 | $GLOBALS['xoopsModuleConfig']['updatethumbs'], $GLOBALS['xoopsModuleConfig']['imageAspect']); |
||
106 | } |
||
107 | } |
||
108 | |||
109 | View Code Duplication | if (empty($_image) || '' === $_image) { |
|
110 | $imgurl = $indicator['image']; |
||
111 | $_width = 33; |
||
112 | $_height = 24; |
||
113 | } else { |
||
114 | $imgurl = "{$GLOBALS['xoopsModuleConfig']['catimage']}/$_image"; |
||
115 | $_width = $GLOBALS['xoopsModuleConfig']['shotwidth']; |
||
116 | $_height = $GLOBALS['xoopsModuleConfig']['shotheight']; |
||
117 | } |
||
118 | /* |
||
119 | * End |
||
120 | */ |
||
121 | |||
122 | $xoopsTpl->append('subcategories', array( |
||
123 | 'title' => $xtubemyts->htmlSpecialCharsStrip($ele['title']), |
||
124 | 'id' => $ele['cid'], |
||
125 | 'image' => XOOPS_URL . "/$imgurl", |
||
126 | 'width' => $_width, |
||
127 | 'height' => $_height, |
||
128 | 'infercategories' => $infercategories, |
||
129 | 'totalvideos' => $totalvideos['count'], |
||
130 | 'count' => $scount, |
||
131 | 'alttext' => $ele['description'] |
||
132 | )); |
||
133 | ++$scount; |
||
134 | } |
||
135 | } |
||
136 | |||
137 | // Show Description for Category listing |
||
138 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' WHERE cid=' . (int)$cid; |
||
139 | $head_arr = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
||
140 | $html = $head_arr['nohtml'] ? 0 : 1; |
||
141 | $smiley = $head_arr['nosmiley'] ? 0 : 1; |
||
142 | $xcodes = $head_arr['noxcodes'] ? 0 : 1; |
||
143 | $images = $head_arr['noimages'] ? 0 : 1; |
||
144 | $breaks = $head_arr['nobreak'] ? 1 : 0; |
||
145 | $description =& $xtubemyts->displayTarea($head_arr['description'], $html, $smiley, $xcodes, $images, $breaks); |
||
146 | $xoopsTpl->assign('description', $description); |
||
147 | $moduleHandler = xoops_getHandler('module'); |
||
148 | $versioninfo = $moduleHandler->get($xoopsModule->getVar('mid')); |
||
149 | if ($head_arr['title'] > '') { |
||
150 | $xoopsTpl->assign('xoops_pagetitle', $versioninfo->getInfo('name') . ': ' . $head_arr['title']); |
||
151 | } else { |
||
152 | $xoopsTpl->assign('xoops_pagetitle', $versioninfo->getInfo('name')); |
||
153 | } |
||
154 | |||
155 | if ($head_arr['client_id'] > 0) { |
||
156 | $catarray['imageheader'] = XoopstubeUtilities::xtubeGetBannerFromClientId($head_arr['client_id']); |
||
157 | } elseif ($head_arr['banner_id'] > 0) { |
||
158 | $catarray['imageheader'] = XoopstubeUtilities::xtubeGetBannerFromBannerId($head_arr['banner_id']); |
||
159 | } else { |
||
160 | $catarray['imageheader'] = XoopstubeUtilities::xtubeRenderImageHeader(); |
||
161 | } |
||
162 | $xoopsTpl->assign('catarray', $catarray); |
||
163 | // Extract linkload information from database |
||
164 | $xoopsTpl->assign('show_categort_title', true); |
||
165 | |||
166 | $orderby0 = (isset($_REQUEST['orderby']) |
||
167 | && !empty($_REQUEST['orderby'])) ? XoopstubeUtilities::xtubeConvertOrderByIn(htmlspecialchars($_REQUEST['orderby'])) : XoopstubeUtilities::xtubeConvertOrderByIn($GLOBALS['xoopsModuleConfig']['linkxorder']); |
||
168 | $orderby = XoopsRequest::getString('orderby', '', 'GET') ? XoopstubeUtilities::xtubeConvertOrderByIn(XoopsRequest::getString('orderby', '', |
||
169 | 'GET')) : XoopstubeUtilities::xtubeConvertOrderByIn($GLOBALS['xoopsModuleConfig']['linkxorder']); |
||
170 | |||
171 | if ($selectdate) { |
||
172 | $d = date('j', $selectdate); |
||
173 | $m = date('m', $selectdate); |
||
174 | $y = date('Y', $selectdate); |
||
175 | |||
176 | $stat_begin = mktime(0, 0, 0, $m, $d, $y); |
||
177 | $stat_end = mktime(23, 59, 59, $m, $d, $y); |
||
178 | |||
179 | $query = ' WHERE published>=' . $stat_begin . ' AND published<=' . $stat_end . ' AND (expired=0 OR expired>' . time() . ') AND offline=0 AND cid>0'; |
||
180 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . $query . ' ORDER BY ' . $orderby; |
||
181 | $result = $GLOBALS['xoopsDB']->query($sql, $GLOBALS['xoopsModuleConfig']['perpage'], $start); |
||
182 | |||
183 | $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . $query; |
||
184 | list($count) = $GLOBALS['xoopsDB']->fetchRow($GLOBALS['xoopsDB']->query($sql)); |
||
185 | |||
186 | $list_by = 'selectdate=' . $selectdate; |
||
187 | } elseif ($list) { |
||
188 | $query = " WHERE title LIKE '$list%' AND (published>0 AND published<=" . time() . ') AND (expired=0 OR expired>' . time() . ') AND offline=0 AND cid>0'; |
||
189 | |||
190 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . $query . ' ORDER BY ' . $orderby; |
||
191 | $result = $GLOBALS['xoopsDB']->query($sql, $GLOBALS['xoopsModuleConfig']['perpage'], $start); |
||
192 | |||
193 | $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . $query; |
||
194 | list($count) = $GLOBALS['xoopsDB']->fetchRow($GLOBALS['xoopsDB']->query($sql)); |
||
195 | $list_by = "list=$list"; |
||
196 | } else { |
||
197 | $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 . '))'; |
||
198 | |||
199 | $sql = |
||
200 | '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 ' |
||
201 | . $orderby; |
||
202 | $result = $GLOBALS['xoopsDB']->query($sql, $GLOBALS['xoopsModuleConfig']['perpage'], $start); |
||
203 | |||
204 | $sql2 = 'SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' a LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('xoopstube_altcat') . ' b ON b.lid=a.lid ' . $query; |
||
205 | list($count) = $GLOBALS['xoopsDB']->fetchRow($GLOBALS['xoopsDB']->query($sql2)); |
||
206 | $order = XoopstubeUtilities::xtubeConvertOrderByOut($orderby); |
||
207 | $list_by = 'cid=' . $cid . '&orderby=' . $order; |
||
208 | $xoopsTpl->assign('show_categort_title', false); |
||
209 | } |
||
210 | $pagenav = new XoopsPageNav($count, $GLOBALS['xoopsModuleConfig']['perpage'], $start, 'start', $list_by); |
||
211 | |||
212 | // Show links |
||
213 | if ($count > 0) { |
||
214 | $moderate = 0; |
||
215 | while (false !== ($video_arr = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||
216 | if (true === XoopstubeUtilities::xtubeCheckGroups($video_arr['cid'])) { |
||
217 | require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/videoloadinfo.php'; |
||
218 | $xoopsTpl->append('video', $video); |
||
219 | } |
||
220 | } |
||
221 | |||
222 | unset($video_arr); |
||
223 | |||
224 | // Show order box |
||
225 | $xoopsTpl->assign('show_videos', false); |
||
226 | if ($count > 1 && $cid !== 0) { |
||
227 | $xoopsTpl->assign('show_videos', true); |
||
228 | $orderbyTrans = XoopstubeUtilities::xtubeConvertOrderByTrans($orderby); |
||
229 | $xoopsTpl->assign('lang_cursortedby', sprintf(_MD_XOOPSTUBE_CURSORTBY, XoopstubeUtilities::xtubeConvertOrderByTrans($orderby))); |
||
230 | $orderby = XoopstubeUtilities::xtubeConvertOrderByOut($orderby); |
||
231 | } |
||
232 | |||
233 | // Screenshots display |
||
234 | $xoopsTpl->assign('show_screenshot', false); |
||
235 | View Code Duplication | if (isset($GLOBALS['xoopsModuleConfig']['screenshot']) && $GLOBALS['xoopsModuleConfig']['screenshot'] == 1) { |
|
236 | $xoopsTpl->assign('shotwidth', $GLOBALS['xoopsModuleConfig']['shotwidth']); |
||
237 | $xoopsTpl->assign('shotheight', $GLOBALS['xoopsModuleConfig']['shotheight']); |
||
238 | $xoopsTpl->assign('show_screenshot', true); |
||
239 | } |
||
240 | |||
241 | // Nav page render |
||
242 | $page_nav = $pagenav->renderNav(); |
||
243 | $istrue = (isset($page_nav) && !empty($page_nav)) ? true : false; |
||
244 | $xoopsTpl->assign('page_nav', $istrue); |
||
245 | $xoopsTpl->assign('pagenav', $page_nav); |
||
246 | $xoopsTpl->assign('module_dir', $xoopsModule->getVar('dirname')); |
||
247 | } |
||
248 | |||
249 | $xoopsTpl->assign('cat_columns', $GLOBALS['xoopsModuleConfig']['catcolumns']); |
||
250 | |||
251 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
252 |
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state