Issues (267)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

blocks/xoopstube_top.php (10 issues)

1
<?php
2
/**
3
 * Module: XoopsTube
4
 *
5
 * You may not change or alter any portion of this comment or credits
6
 * of supporting developers from this source code or any supporting source code
7
 * which is considered copyrighted (c) material of the original comment or credit authors.
8
 *
9
 * PHP version 5
10
 *
11
 * @category        Module
12
 * @package         Xoopstube
13
 * @author          XOOPS Development Team
14
 * @copyright       2001-2016 XOOPS Project (https://xoops.org)
15
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
16
 * @link            https://xoops.org/
17
 * @since           1.0.6
18
 */
19
20
use XoopsModules\Xoopstube;
21
use XoopsModules\Xoopstube\{
22
    Utility,
23
    Tree
24
};
25
26
/**
27
 * @param int    $cid
28
 * @param string $permType
29
 * @param bool   $redirect
30
 *
31
 * @return bool
32
 */
33
function checkBlockGroups($cid = 0, $permType = 'XTubeCatPerm', $redirect = false)
34
{
35
    $moduleDirName = \basename(\dirname(__DIR__));
36
    $groups        = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
37
    /** @var \XoopsGroupPermHandler $grouppermHandler */
38
    $grouppermHandler = xoops_getHandler('groupperm');
39
    /** @var \XoopsModuleHandler $moduleHandler */
40
    $moduleHandler = xoops_getHandler('module');
41
    $module        = $moduleHandler->getByDirname($moduleDirName);
42
    if (!$grouppermHandler->checkRight($permType, $cid, $groups, $module->getVar('mid'))) {
43
        if (!$redirect) {
44
            return false;
45
        }
46
        redirect_header('index.php', 3, _NOPERM);
47
    }
48
    unset($module);
49
50
    return true;
51
}
52
53
/**
54
 * @param int    $cid
55
 * @param string $permType
56
 * @param bool   $redirect
57
 *
58
 * @return bool
59
 */
60
function xtubeCheckBlockGroups($cid = 0, $permType = 'XTubeCatPerm', $redirect = false)
61
{
62
    $moduleDirName = \basename(\dirname(__DIR__));
63
    $groups        = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
64
    /** @var \XoopsModuleHandler $moduleHandler */
65
    $moduleHandler = xoops_getHandler('module');
66
    $xtubeModule   = $moduleHandler->getByDirname($moduleDirName);
67
    /** @var \XoopsGroupPermHandler $grouppermHandler */
68
    $grouppermHandler = xoops_getHandler('groupperm');
69
    if (!$grouppermHandler->checkRight($permType, $cid, $groups, $xtubeModule->getVar('mid'))) {
70
        if (!$redirect) {
71
            return false;
72
        }
73
    }
74
75
    return true;
76
}
77
78
/**
79
 * @param       $bvidid
80
 * @param       $btitle
81
 * @param       $bsource
82
 * @param       $bpicurl
83
 * @param array $size
84
 *
85
 * @return string
86
 */
87
function getThumbsTopVideoBlock($bvidid, $btitle, $bsource, $bpicurl, array $size = [])
88
{
89
    $thumbb = '';
90
    /** @var \XoopsModuleHandler $moduleHandler */
91
    $moduleHandler = xoops_getHandler('module');
92
    $xtubeModule   = $moduleHandler->getByDirname('xoopstube');
93
    /** @var \XoopsConfigHandler $configHandler */
94
    $configHandler     = xoops_getHandler('config');
95
    $xtubeModuleConfig = $configHandler->getConfigsByCat(0, $xtubeModule->getVar('mid'));
96
    if (isset($size['shotwidth'])) {
97
        $xtubeModuleConfig['shotwidth'] = $size['shotwidth'];
98
    }
99
    if (isset($size['shotheight'])) {
100
        $xtubeModuleConfig['shotheight'] = $size['shotheight'];
101
    }
102
    // Determine if video source YouTube
103
    if (0 == $bsource) {
104
        $thumbb = '<img src="https://img.youtube.com/vi/' . $bvidid . '/default.jpg" title="' . $btitle . '" alt="' . $btitle . '" width="' . $xtubeModuleConfig['shotwidth'] . '" height="' . $xtubeModuleConfig['shotheight'] . '"  border="0">';
105
    }
106
    // Determine if video source MetaCafe
107
    if (1 == $bsource) {
108
        [$metaclip] = explode('[/]', $bvidid);
109
        $videothumb['metathumb'] = $metaclip;
0 ignored issues
show
Comprehensibility Best Practice introduced by
$videothumb was never initialized. Although not strictly required by PHP, it is generally a good practice to add $videothumb = array(); before regardless.
Loading history...
110
        $thumbb                  = '<img src="https://www.metacafe.com/thumb/' . $videothumb['metathumb'] . '.jpg" title="' . $btitle . '" alt="' . $btitle . '" width="' . $xtubeModuleConfig['shotwidth'] . '" height="' . $xtubeModuleConfig['shotheight'] . '"  border="0">';
111
    }
112
    // Determine if video source iFilm/Spike
113
    if (2 == $bsource) {
114
        $thumbb = '<img src="https://img2.ifilmpro.com/resize/image/stills/films/resize/istd/' . $bvidid . '.jpg?width=' . $xtubeModuleConfig['shotwidth'] . ' title="' . $btitle . '" alt="' . $btitle . '" border="0">';
115
    }
116
    // Determine if video source Photobucket
117
    if (3 == $bsource) {
118
        $thumbb = '<img src="https://i153.photobucket.com/albums/' . $bvidid . '.jpg" title="' . $btitle . '" alt="' . $btitle . '" width="' . $xtubeModuleConfig['shotwidth'] . '" height="' . $xtubeModuleConfig['shotheight'] . '"  border="0">';
119
    }
120
    // Determine if video source Google Video / MySpace TV / DailyMotion
121
    if (100 == $bsource) {
122
        $thumbb = '<img src="' . $bpicurl . '" title="' . $btitle . '" alt="' . $btitle . '" width="' . $xtubeModuleConfig['shotwidth'] . '" height="' . $xtubeModuleConfig['shotheight'] . '"  border="0">';
123
    }
124
    // Determine if video source MySpace TV
125
    if (101 == $bsource) {
126
        $thumbb = '<img src="' . $bpicurl . '" title="' . $btitle . '" alt="' . $btitle . '" width="' . $xtubeModuleConfig['shotwidth'] . '" height="' . $xtubeModuleConfig['shotheight'] . '"  border="0">';
127
    }
128
    // Determine if video source DailyMotion
129
    if (102 == $bsource) {
130
        $thumbb = '<img src="' . $bpicurl . '" title="' . $btitle . '" alt="' . $btitle . '" width="' . $xtubeModuleConfig['shotwidth'] . '" height="' . $xtubeModuleConfig['shotheight'] . '"  border="0">';
131
    }
132
133
    return $thumbb;
134
}
135
136
/* Function: b_xoopstube_spotlight_show
137
 * Input   : $options[0] = date for the most recent videos
138
 *             hits for the most popular videos
139
 *           $block['content'] = The optional above content
140
 *           $options[1] = How many videos are displayes
141
 * Output  : Returns the most recent or most popular videos
142
 */
143
/**
144
 * @param $options
145
 *
146
 * @return array
147
 */
148
function getSpotlightVideos($options)
149
{
150
    require_once dirname(__DIR__) . '/include/video.php';
151
    $block = [];
152
    /** @var \XoopsModuleHandler $moduleHandler */
153
    $moduleHandler = xoops_getHandler('module');
154
    $xtubeModule   = $moduleHandler->getByDirname('xoopstube');
155
    /** @var \XoopsConfigHandler $configHandler */
156
    $configHandler     = xoops_getHandler('config');
157
    $xtubeModuleConfig = $configHandler->getConfigsByCat(0, $xtubeModule->getVar('mid'));
158
    $myts         = \MyTextSanitizer:: getInstance();
0 ignored issues
show
The assignment to $myts is dead and can be removed.
Loading history...
159
160
    $options[1] = 4;
161
    $result     = $GLOBALS['xoopsDB']->query(
162
        'SELECT lid, cid, title, vidid, date, hits, vidsource, picurl FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published > 0 AND published <= ' . time() . ' AND (expired = 0 OR expired > ' . time() . ') AND offline = 0 ORDER BY ' . $options[0] . ' DESC',
163
        $options[1],
164
        0
165
    );
166
167
    $i = 0;
168
    while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) {
169
        if (!checkBlockGroups($myrow['cid']) || 0 == $myrow['cid']) {
170
            continue;
171
        }
172
        if (!xtubeCheckBlockGroups($myrow['cid'])) {
173
            exit;
0 ignored issues
show
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
174
        }
175
        $videoload = [];
176
        $title     = htmlspecialchars($myrow['title'], ENT_QUOTES | ENT_HTML5);
177
        if (!XOOPS_USE_MULTIBYTES) {
178
            if (mb_strlen($myrow['title']) >= $options[2]) {
179
                $title = mb_substr($myrow['title'], 0, $options[2] - 1) . '...';
180
            }
181
        }
182
        $videoload['id']    = (int)$myrow['lid'];
183
        $videoload['cid']   = (int)$myrow['cid'];
184
        $videoload['title'] = $title;
185
        if ('date' === $options[0]) {
186
            $videoload['date'] = formatTimestamp($myrow['date'], $xtubeModuleConfig['dateformat']);
187
        } elseif ('hits' === $options[0]) {
188
            $videoload['hits'] = $myrow['hits'];
189
        }
190
191
        $size               = [];
192
        $rate               = 425 / 350;
193
        $size['shotwidth']  = '100';
194
        $size['shotheight'] = (int)($size['shotwidth'] / $rate);
195
196
        if (0 == $i && 0 == $myrow['vidsource']) {
197
            $videowidth             = 340;
198
            $videoheight            = (int)($videowidth / $rate);
199
            $showvideo              = '<object width="'
200
                                      . $videowidth
201
                                      . '" height="'
202
                                      . $videoheight
203
                                      . '"><param name="movie" value="https://www.youtube.com/v/'
204
                                      . $myrow['vidid']
205
                                      . '"></param><param name="wmode" value="transparent"></param><embed src="https://www.youtube.com/v/'
206
                                      . $myrow['vidid']
207
                                      . '" type="application/x-shockwave-flash" wmode="transparent" width="'
208
                                      . $videowidth
209
                                      . '" height="'
210
                                      . $videoheight
211
                                      . '"></embed></object>';
212
            $videoload['showvideo'] = $showvideo;
213
        }
214
215
        $videoload['videothumb'] = getThumbsTopVideoBlock($myrow['vidid'], $title, $myrow['vidsource'], $myrow['picurl'], $size);
216
217
        $videoload['dirname'] = $xtubeModule->getVar('dirname');
218
        $block['videos'][]    = $videoload;
219
        ++$i;
220
    }
221
    unset($_block_check_array);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $_block_check_array seems to be never defined.
Loading history...
222
223
    return $block;
224
}
225
226
// Function: showTopVideoBlock
227
// Input   : $options[0] = date for the most recent videos
228
//             hits for the most popular videos
229
//           $block['content'] = The optional above content
230
//           $options[1] = How many videos are displayes
231
//           $options[2] = Length of title
232
//           $options[3] = Set date format
233
// Output  : Returns the most recent or most popular videos
234
/**
235
 * @param $options
236
 *
237
 * @return array
238
 */
239
function showTopVideoBlock($options)
240
{
241
    $moduleDirName = \basename(\dirname(__DIR__));
242
    $block         = [];
243
    /** @var \XoopsModuleHandler $moduleHandler */
244
    $moduleHandler = xoops_getHandler('module');
245
    $xtubeModule   = $moduleHandler->getByDirname($moduleDirName);
246
    /** @var \XoopsConfigHandler $configHandler */
247
    $configHandler     = xoops_getHandler('config');
248
    $xtubeModuleConfig = $configHandler->getConfigsByCat(0, $xtubeModule->getVar('mid'));
249
    $myts         = \MyTextSanitizer:: getInstance();
0 ignored issues
show
The assignment to $myts is dead and can be removed.
Loading history...
250
251
    if (isset($options[4]) && ($options[4] > 0)) {
252
        $result = $GLOBALS['xoopsDB']->query(
253
            'SELECT lid, cid, title, vidid, screenshot, published, hits, vidsource, picurl FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published>0
254
                                    AND published<=' . time() . '
255
                                    AND (expired=0 OR expired>' . time() . ')
256
                                    AND offline=0
257
                                    AND cid=' . $options[4] . '
258
                                    ORDER BY ' . $options[0] . '
259
                                    DESC',
260
            $options[1],
261
            0
262
        );
263
    } else {
264
        $result = $GLOBALS['xoopsDB']->query(
265
            'SELECT lid, cid, title, vidid, screenshot, published, hits, vidsource, picurl FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published>0
266
                                    AND published<=' . time() . '
267
                                    AND (expired=0 OR expired>' . time() . ')
268
                                    AND offline=0
269
                                    ORDER BY ' . $options[0] . '
270
                                    DESC',
271
            $options[1],
272
            0
273
        );
274
    }
275
276
    require_once XOOPS_ROOT_PATH . '/modules/' . $xtubeModule->getVar('dirname') . '/include/video.php';
277
    //    require_once XOOPS_ROOT_PATH . '/modules/' . $xtubeModule->getVar('dirname') . '/class/Utility.php';
278
279
    while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) {
280
        if (!checkBlockGroups($myrow['cid']) || 0 == $myrow['cid']) {
281
            continue;
282
        }
283
284
        if (!xtubeCheckBlockGroups($myrow['cid'])) {
285
            exit;
0 ignored issues
show
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
286
        }
287
288
        $videoload = [];
289
        $title     = htmlspecialchars($myrow['title'], ENT_QUOTES | ENT_HTML5);
290
        if (!XOOPS_USE_MULTIBYTES) {
291
            if (mb_strlen($myrow['title']) >= $options[2]) {
292
                $title = mb_substr($myrow['title'], 0, $options[2] - 1) . '...';
293
            }
294
        }
295
        $videoload['id']    = (int)$myrow['lid'];
296
        $videoload['cid']   = (int)$myrow['cid'];
297
        $videoload['title'] = $title;
298
        if ('published' === $options[0]) {
299
            $videoload['date'] = Utility::getTimestamp(formatTimestamp($myrow['published'], $options[3]));
300
        } elseif ('hits' === $options[0]) {
301
            $videoload['hits'] = $myrow['hits'];
302
        }
303
304
        $videoload['videothumb'] = xtubeGetVideoThumb($myrow['vidid'], $title, $myrow['vidsource'], $myrow['picurl'], $xtubeModuleConfig['videoimgdir'] . '/' . $myrow['screenshot'], $xtubeModuleConfig['shotwidth'], $xtubeModuleConfig['shotheight']);
305
        $videoload['dirname']    = $xtubeModule->getVar('dirname');
306
        $videoload['width']      = $xtubeModuleConfig['shotwidth'] + 2;
307
        $block['videos'][]       = $videoload;
308
    }
309
    unset($_block_check_array);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $_block_check_array seems to be never defined.
Loading history...
310
311
    return $block;
312
}
313
314
// Function: getRandomVideo
315
// Output  : Returns random video
316
/**
317
 * @param $options
318
 *
319
 * @return array
320
 */
321
function getRandomVideo($options)
322
{
323
    global $myts;
324
    $utility       = new Utility();
325
    $moduleDirName = \basename(\dirname(__DIR__));
326
    $block         = [];
327
    /** @var \XoopsModuleHandler $moduleHandler */
328
    $moduleHandler = xoops_getHandler('module');
329
    $xtubeModule   = $moduleHandler->getByDirname($moduleDirName);
330
    /** @var \XoopsConfigHandler $configHandler */
331
    $configHandler     = xoops_getHandler('config');
332
    $xtubeModuleConfig = $configHandler->getConfigsByCat(0, $xtubeModule->getVar('mid'));
333
    $myts         = \MyTextSanitizer:: getInstance();
334
335
    if (isset($options[4]) && ($options[4] > 0)) {
336
        $result2 = $GLOBALS['xoopsDB']->query(
337
            'SELECT lid, cid, title, vidid, screenshot, published, vidsource, picurl FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published > 0
338
                                    AND published<=' . time() . '
339
                                    AND (expired=0 OR expired>' . time() . ')
340
                                    AND offline=0
341
                                    AND cid=' . $options[4] . '
342
                                    ORDER BY RAND() LIMIT ' . $options[1]
343
        );
344
    } else {
345
        $result2 = $GLOBALS['xoopsDB']->query(
346
            'SELECT lid, cid, title, vidid, screenshot, published, vidsource, picurl FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published > 0
347
                                    AND published<=' . time() . '
348
                                    AND (expired=0 OR expired>' . time() . ')
349
                                    AND offline=0
350
                                    ORDER BY RAND() LIMIT ' . $options[1]
351
        );
352
    }
353
354
    require_once XOOPS_ROOT_PATH . '/modules/' . $xtubeModule->getVar('dirname') . '/include/video.php';
355
    //    require_once XOOPS_ROOT_PATH . '/modules/' . $xtubeModule->getVar('dirname') . '/class/Utility.php';
356
357
    while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result2))) {
358
        if (!checkBlockGroups($myrow['cid']) || 0 == $myrow['cid']) {
359
            continue;
360
        }
361
        $videorandom = [];
362
        $title       = htmlspecialchars($myrow['title'], ENT_QUOTES | ENT_HTML5);
363
        if (!XOOPS_USE_MULTIBYTES) {
364
            if (mb_strlen($myrow['title']) >= $options[2]) {
365
                $title = mb_substr($myrow['title'], 0, $options[2] - 1) . '...';
366
            }
367
        }
368
        $videorandom['id']    = (int)$myrow['lid'];
369
        $videorandom['cid']   = (int)$myrow['cid'];
370
        $videorandom['title'] = $title;
371
        if (isset($options[3])) {
372
            $videorandom['date'] = $utility::getTimestamp(formatTimestamp($myrow['published'], $options[3]));
373
        }
374
        $videorandom['videothumb'] = xtubeGetVideoThumb($myrow['vidid'], $myrow['title'], $myrow['vidsource'], $myrow['picurl'], $xtubeModuleConfig['videoimgdir'] . '/' . $myrow['screenshot'], $xtubeModuleConfig['shotwidth'], $xtubeModuleConfig['shotheight']);
375
        $videorandom['dirname']    = $xtubeModule->getVar('dirname');
376
        $videorandomh['width']     = $xtubeModuleConfig['shotwidth'] + 2;
377
        $block['random'][]         = $videorandom;
378
    }
379
    unset($_block_check_array);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $_block_check_array seems to be never defined.
Loading history...
380
381
    return $block;
382
}
383
384
// Function: b_xoopstube_random_h
385
// Output  : Returns random video in horizontal block
386
/**
387
 * @param $options
388
 *
389
 * @return array
390
 */
391
function getRandomVideoForHorizontalBlock($options)
392
{
393
    global $myts;
394
    $moduleDirName = \basename(\dirname(__DIR__));
395
    $block         = [];
396
    /** @var \XoopsModuleHandler $moduleHandler */
397
    $moduleHandler = xoops_getHandler('module');
398
    $xtubeModule   = $moduleHandler->getByDirname($moduleDirName);
399
    /** @var \XoopsConfigHandler $configHandler */
400
    $configHandler     = xoops_getHandler('config');
401
    $xtubeModuleConfig = $configHandler->getConfigsByCat(0, $xtubeModule->getVar('mid'));
402
    $myts         = \MyTextSanitizer:: getInstance();
403
404
    if (isset($options[4]) && ($options[4] > 0)) {
405
        $result2 = $GLOBALS['xoopsDB']->query(
406
            'SELECT lid, cid, title, vidid, screenshot, published, vidsource, picurl FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published > 0
407
                                    AND published<=' . time() . '
408
                                    AND (expired=0 OR expired>' . time() . ')
409
                                    AND offline=0
410
                                    AND cid=' . $options[4] . '
411
                                    ORDER BY RAND() LIMIT ' . $options[1]
412
        );
413
    } else {
414
        $result2 = $GLOBALS['xoopsDB']->query(
415
            'SELECT lid, cid, title, vidid, screenshot, published, vidsource, picurl FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published > 0
416
                                    AND published<=' . time() . '
417
                                    AND (expired=0 OR expired>' . time() . ')
418
                                    AND offline=0
419
                                    ORDER BY RAND() LIMIT ' . $options[1]
420
        );
421
    }
422
423
    require_once XOOPS_ROOT_PATH . '/modules/' . $xtubeModule->getVar('dirname') . '/include/video.php';
424
    //    require_once XOOPS_ROOT_PATH . '/modules/' . $xtubeModule->getVar('dirname') . '/class/Utility.php';
425
426
    while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result2))) {
427
        if (!checkBlockGroups($myrow['cid']) || 0 == $myrow['cid']) {
428
            continue;
429
        }
430
        $videorandomh            = [];
431
        $title                   = htmlspecialchars($myrow['title'], ENT_QUOTES | ENT_HTML5);
432
        $videorandomh['balloon'] = $myrow['title'];
433
        if (!XOOPS_USE_MULTIBYTES) {
434
            if (mb_strlen($myrow['title']) >= $options[2]) {
435
                $title = mb_substr($myrow['title'], 0, $options[2] - 1) . '...';
436
            }
437
        }
438
        $videorandomh['id']    = (int)$myrow['lid'];
439
        $videorandomh['cid']   = (int)$myrow['cid'];
440
        $videorandomh['title'] = $title;
441
        if (isset($options[3])) {
442
            $videorandomh['date'] = Utility::getTimestamp(formatTimestamp($myrow['published'], $options[3]));
443
        }
444
        require_once XOOPS_ROOT_PATH . '/modules/' . $xtubeModule->getVar('dirname') . '/include/video.php';
445
        $videorandomh['videothumb'] = xtubeGetVideoThumb($myrow['vidid'], $myrow['title'], $myrow['vidsource'], $myrow['picurl'], $xtubeModuleConfig['videoimgdir'] . '/' . $myrow['screenshot'], $xtubeModuleConfig['shotwidth'], $xtubeModuleConfig['shotheight']);
446
        $videorandomh['dirname']    = $xtubeModule->getVar('dirname');
447
        $videorandomh['width']      = $xtubeModuleConfig['shotwidth'] + 2;
448
        $block['random'][]          = $videorandomh;
449
    }
450
    unset($_block_check_array);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $_block_check_array seems to be never defined.
Loading history...
451
452
    return $block;
453
}
454
455
// editTopVideoBlock()
456
// @param $options
457
// @return
458
/**
459
 * @param $options
460
 *
461
 * @return string
462
 */
463
function editTopVideoBlock($options)
464
{
465
    $form = '' . _MB_XOOPSTUBE_DISP . '&nbsp;';
466
    $form .= "<input type='hidden' name='options[]' value='";
467
    if ('published' === $options[0]) {
468
        $form .= "published'";
469
    }
470
    if ('random' === $options[0]) {
471
        $form .= "random'";
472
    }
473
    if ('randomh' === $options[0]) {
474
        $form .= "randomh'";
475
    } else {
476
        $form .= "hits'";
477
    }
478
    $form .= '>';
479
    $form .= "<input type='text' name='options[]' value='" . $options[1] . "'>&nbsp;" . _MB_XOOPSTUBE_FILES . '';
480
    $form .= '&nbsp;<br>' . _MB_XOOPSTUBE_CHARS . "&nbsp;<input type='text' name='options[]' value='" . $options[2] . "'>&nbsp;" . _MB_XOOPSTUBE_LENGTH . '';
481
    $form .= '&nbsp;<br>' . _MB_XOOPSTUBE_DATEFORMAT . "&nbsp;<input type='text' name='options[]' value='" . $options[3] . "'>&nbsp;" . _MB_XOOPSTUBE_DATEFORMATMANUAL;
482
483
    $cat_arr = [];
0 ignored issues
show
The assignment to $cat_arr is dead and can be removed.
Loading history...
484
    require_once XOOPS_ROOT_PATH . '/modules/xoopstube/class/Tree.php';
485
    $xt      = new Tree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid');
486
    $cat_arr = $xt->getChildTreeArray(0, 'title');
487
488
    $form .= '<br>' . _MB_XOOPSTUBE_SELECTCAT . '<br><select name="options[]" multiple="multiple" size="5">';
489
    $form = !in_array(0, $options, true) ? $form . '<option value="0">' . _MB_XOOPSTUBE_ALLCAT . '</option>' : $form . '<option value="0" selected="selected">' . _MB_XOOPSTUBE_ALLCAT . '</option>';
490
491
    foreach ($cat_arr as $catlist) {
492
        if (!in_array($catlist, $options, true)) {
493
            $form .= '<option value="' . $catlist['cid'] . '">' . $catlist['title'] . '</option>';
494
        } else {
495
            $form .= '<option value="' . $catlist['cid'] . '" selected="selected">' . $catlist['title'] . '</option>';
496
        }
497
    }
498
    $form .= '</select>';
499
500
    return $form;
501
}
502