XoopsModules25x /
xoopstube
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 | * @since 1.0.6 |
||
| 18 | * @link http://xoops.org/ |
||
| 19 | */ |
||
| 20 | |||
| 21 | include __DIR__ . '/header.php'; |
||
| 22 | |||
| 23 | $xoopsOption['template_main'] = 'xoopstube_newlistindex.tpl'; |
||
| 24 | include XOOPS_ROOT_PATH . '/header.php'; |
||
| 25 | |||
| 26 | global $xoopsModule; |
||
|
0 ignored issues
–
show
|
|||
| 27 | |||
| 28 | $catarray['imageheader'] = XoopstubeUtilities::xtubeRenderImageHeader(); |
||
| 29 | $xoopsTpl->assign('catarray', $catarray); |
||
| 30 | |||
| 31 | if (XoopsRequest::getInt('newvideoshowdays', '', 'GET')) { |
||
| 32 | $newvideoshowdays = XoopsRequest::getInt('newvideoshowdays', 7, 'GET'); |
||
| 33 | if ($newvideoshowdays !== 7) { |
||
| 34 | if ($newvideoshowdays !== 14) { |
||
| 35 | if ($newvideoshowdays !== 30) { |
||
| 36 | redirect_header('newlist.php?newvideoshowdays=7', 5, |
||
| 37 | _MD_XOOPSTUBE_STOPIT . '<br><img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/security.png" />'); |
||
| 38 | } |
||
| 39 | } |
||
| 40 | } |
||
| 41 | $time_cur = time(); |
||
| 42 | $duration = ($time_cur - (86400 * 30)); |
||
| 43 | $duration_week = ($time_cur - (86400 * 7)); |
||
| 44 | $allmonthvideos = 0; |
||
| 45 | $allweekvideos = 0; |
||
| 46 | $result = |
||
| 47 | $GLOBALS['xoopsDB']->query('SELECT lid, cid, published, updated FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE (published >= ' . $duration . ' AND published <= ' |
||
| 48 | . $time_cur . ') OR updated >= ' . $duration . ' AND (expired = 0 OR expired > ' . $time_cur . ') AND offline = 0'); |
||
| 49 | while (false !== ($myrow = $GLOBALS['xoopsDB']->fetcharray($result))) { |
||
| 50 | $published = ($myrow['updated'] > 0) ? $myrow['updated'] : $myrow['published']; |
||
| 51 | ++$allmonthvideos; |
||
| 52 | if ($published > $duration_week) { |
||
| 53 | ++$allweekvideos; |
||
| 54 | } |
||
| 55 | } |
||
| 56 | $xoopsTpl->assign('allweekvideos', $allweekvideos); |
||
| 57 | $xoopsTpl->assign('allmonthvideos', $allmonthvideos); |
||
| 58 | |||
| 59 | // List Last VARIABLE Days of videos |
||
| 60 | // $newvideoshowdays = xtubeCleanRequestVars($_REQUEST, 'newvideoshowdays', 7 ); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
53% 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. Loading history...
|
|||
| 61 | $newvideoshowdays = (int)XoopsRequest::getInt('newvideoshowdays', 7, 'GET'); |
||
| 62 | $xoopsTpl->assign('newvideoshowdays', $newvideoshowdays); |
||
| 63 | |||
| 64 | $dailyvideos = array(); |
||
| 65 | for ($i = 0; $i < $newvideoshowdays; ++$i) { |
||
| 66 | $key = $newvideoshowdays - $i - 1; |
||
| 67 | $time = $time_cur - (86400 * $key); |
||
| 68 | $dailyvideos[$key]['newvideodayRaw'] = $time; |
||
| 69 | $dailyvideos[$key]['newvideoView'] = XoopstubeUtilities::xtubeGetTimestamp(formatTimestamp($time, $GLOBALS['xoopsModuleConfig']['dateformat'])); |
||
| 70 | $dailyvideos[$key]['totalvideos'] = 0; |
||
| 71 | } |
||
| 72 | } |
||
| 73 | |||
| 74 | $duration = ($time_cur - (86400 * ($newvideoshowdays - 1))); |
||
| 75 | $result = |
||
| 76 | $GLOBALS['xoopsDB']->query('SELECT lid, cid, published, updated FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE (published > ' . $duration . ' AND published <= ' . $time_cur |
||
| 77 | . ') OR (updated >= ' . $duration . ' AND updated <= ' . $time_cur . ') AND (expired = 0 OR expired > ' . $time_cur . ') AND offline = 0'); |
||
| 78 | while (false !== ($myrow = $GLOBALS['xoopsDB']->fetcharray($result))) { |
||
| 79 | $published = ($myrow['updated'] > 0) ? $myrow['updated'] : $myrow['published']; |
||
| 80 | $d = date('j', $published); |
||
| 81 | $m = date('m', $published); |
||
| 82 | $y = date('Y', $published); |
||
| 83 | $key = (int)($time_cur - mktime(0, 0, 0, $m, $d, $y) / 86400); |
||
| 84 | $dailyvideos[$key]['totalvideos']++; |
||
| 85 | } |
||
| 86 | ksort($dailyvideos); |
||
| 87 | reset($dailyvideos); |
||
| 88 | $xoopsTpl->assign('dailyvideos', $dailyvideos); |
||
| 89 | unset($dailyvideos); |
||
| 90 | |||
| 91 | $mytree = new XoopstubeTree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid'); |
||
| 92 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos'); |
||
| 93 | $sql .= 'WHERE (published > 0 AND published <= ' . $time_cur . ') |
||
| 94 | OR (updated > 0 AND updated <= ' . $time_cur . ') |
||
| 95 | AND (expired = 0 OR expired > ' . $time_cur . ') |
||
| 96 | AND offline = 0 |
||
| 97 | ORDER BY ' . $GLOBALS['xoopsModuleConfig']['linkxorder']; |
||
| 98 | $result = $GLOBALS['xoopsDB']->query($sql, 10, 0); |
||
| 99 | while (false !== ($video_arr = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||
| 100 | include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/videoloadinfo.php'; |
||
| 101 | } |
||
| 102 | |||
| 103 | $xoopsTpl->assign('back', '<a href="javascript:history.go(-1)"><img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/back.png" /></a>'); |
||
| 104 | $xoopsTpl->assign('module_dir', $xoopsModule->getVar('dirname')); |
||
| 105 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
| 106 |
Instead of relying on
globalstate, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state