XoopsModules25x /
xoopstube
| 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 | Utility, |
||
| 24 | Tree |
||
| 25 | }; |
||
| 26 | |||
| 27 | $GLOBALS['xoopsOption']['template_main'] = 'xoopstube_singlevideo.tpl'; |
||
| 28 | |||
| 29 | require_once __DIR__ . '/header.php'; |
||
| 30 | |||
| 31 | $lid = Request::getInt('lid', Request::getInt('lid', '', 'POST'), 'GET'); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 32 | $cid = Request::getInt('cid', Request::getInt('cid', '', 'POST'), 'GET'); |
||
| 33 | |||
| 34 | $sql2 = 'SELECT count(*) FROM ' |
||
| 35 | . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') |
||
| 36 | . ' a LEFT JOIN ' |
||
| 37 | . $GLOBALS['xoopsDB']->prefix('xoopstube_altcat') |
||
| 38 | . ' b' |
||
| 39 | . ' ON b.lid = a.lid' |
||
| 40 | . ' WHERE a.published > 0 AND a.published <= ' |
||
| 41 | . time() |
||
| 42 | . ' AND (a.expired = 0 OR a.expired > ' |
||
| 43 | . time() |
||
| 44 | . ') AND a.offline = 0' |
||
| 45 | . ' AND (b.cid=a.cid OR (a.cid=' |
||
| 46 | . $cid |
||
| 47 | . ' OR b.cid=' |
||
| 48 | . $cid |
||
| 49 | . '))'; |
||
| 50 | [$count] = $GLOBALS['xoopsDB']->fetchRow($GLOBALS['xoopsDB']->query($sql2)); |
||
| 51 | |||
| 52 | if (false === Utility::checkGroups($cid) || 0 === $count) { |
||
| 53 | redirect_header('index.php', 1, _MD_XOOPSTUBE_MUSTREGFIRST); |
||
| 54 | } |
||
| 55 | |||
| 56 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . $lid . ' |
||
| 57 | AND (published > 0 AND published <= ' . time() . ') |
||
| 58 | AND (expired = 0 OR expired > ' . time() . ') |
||
| 59 | AND offline = 0 |
||
| 60 | AND cid > 0'; |
||
| 61 | $result = $GLOBALS['xoopsDB']->query($sql); |
||
| 62 | $video_arr = $GLOBALS['xoopsDB']->fetchArray($result); |
||
| 63 | |||
| 64 | if (!is_array($video_arr)) { |
||
| 65 | redirect_header('index.php', 1, _MD_XOOPSTUBE_NOVIDEOLOAD); |
||
| 66 | } |
||
| 67 | |||
| 68 | |||
| 69 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
| 70 | $xoTheme->addStylesheet('modules/' . $moduleDirName . '/assets/css/xtubestyle.css'); |
||
| 71 | |||
| 72 | // tags support |
||
| 73 | if (Utility::isModuleTagInstalled()) { |
||
| 74 | require_once XOOPS_ROOT_PATH . '/modules/tag/include/tagbar.php'; |
||
| 75 | $xoopsTpl->assign('tagbar', tagBar($video_arr['lid'], 0)); |
||
| 76 | } |
||
| 77 | |||
| 78 | $video['imageheader'] = Utility::renderImageHeader(); |
||
| 79 | $video['id'] = $video_arr['lid']; |
||
| 80 | $video['cid'] = $video_arr['cid']; |
||
| 81 | $video['vidid'] = $video_arr['vidid']; |
||
| 82 | $video['description2'] = $myts->displayTarea($video_arr['description'], 1, 1, 1, 1, 1); |
||
| 83 | |||
| 84 | $mytree = new Tree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid'); |
||
| 85 | $pathstring = '<a href="index.php">' . _MD_XOOPSTUBE_MAIN . '</a> : '; |
||
| 86 | $pathstring .= $mytree->getNicePathFromId($cid, 'title', 'viewcat.php?op='); |
||
| 87 | $video['path'] = $pathstring; |
||
| 88 | // Get video from source |
||
| 89 | $video['showvideo'] = xtubeShowVideo($video_arr['vidid'], $video_arr['vidsource'], $video_arr['screenshot'], $video_arr['picurl']); |
||
| 90 | |||
| 91 | // Get Social Bookmarks |
||
| 92 | $video['sbmarks'] = getSocialBookmarks($video_arr['lid']); |
||
| 93 | |||
| 94 | // Start of meta tags |
||
| 95 | global $xoopsTpl, $xoTheme; |
||
| 96 | |||
| 97 | $maxWords = 100; |
||
| 98 | $words = []; |
||
| 99 | $words = explode(' ', Utility::convertHtml2text($video_arr['description'])); |
||
| 100 | $newWords = []; |
||
| 101 | $i = 0; |
||
| 102 | while ($i < $maxWords - 1 && $i < count($words)) { |
||
| 103 | if (isset($words[$i])) { |
||
| 104 | $newWords[] = trim($words[$i]); |
||
| 105 | } |
||
| 106 | ++$i; |
||
| 107 | } |
||
| 108 | $video_meta_description = implode(' ', $newWords); |
||
| 109 | |||
| 110 | if (is_object($GLOBALS['xoTheme'])) { |
||
| 111 | if ($video_arr['keywords']) { |
||
| 112 | $GLOBALS['xoTheme']->addMeta('meta', 'keywords', $video_arr['keywords']); |
||
| 113 | } |
||
| 114 | $GLOBALS['xoTheme']->addMeta('meta', 'title', $video_arr['title']); |
||
| 115 | if (1 == $GLOBALS['xoopsModuleConfig']['usemetadescr']) { |
||
| 116 | $GLOBALS['xoTheme']->addMeta('meta', 'description', $video_meta_description); |
||
| 117 | } |
||
| 118 | } else { |
||
| 119 | if ($video_arr['keywords']) { |
||
| 120 | $xoopsTpl->assign('xoops_meta_keywords', $video_arr['keywords']); |
||
| 121 | } |
||
| 122 | if (1 == $GLOBALS['xoopsModuleConfig']['usemetadescr']) { |
||
| 123 | $GLOBALS['xoTheme']->assign('xoops_meta_description', $video_meta_description); |
||
| 124 | } |
||
| 125 | } |
||
| 126 | $xoopsTpl->assign('xoops_pagetitle', $video_arr['title']); |
||
| 127 | // End of meta tags |
||
| 128 | |||
| 129 | $moderate = 0; |
||
| 130 | require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/videoloadinfo.php'; |
||
| 131 | |||
| 132 | $xoopsTpl->assign('show_screenshot', false); |
||
| 133 | if (isset($GLOBALS['xoopsModuleConfig']['screenshot']) && 1 == $GLOBALS['xoopsModuleConfig']['screenshot']) { |
||
| 134 | $xoopsTpl->assign('shotwidth', $GLOBALS['xoopsModuleConfig']['shotwidth']); |
||
| 135 | $xoopsTpl->assign('shotheight', $GLOBALS['xoopsModuleConfig']['shotheight']); |
||
| 136 | $xoopsTpl->assign('show_screenshot', true); |
||
| 137 | } |
||
| 138 | |||
| 139 | if (false === $video['isadmin']) { |
||
| 140 | $count = Utility::updateCounter($lid); |
||
|
0 ignored issues
–
show
Are you sure the assignment to
$count is correct as XoopsModules\Xoopstube\U...ty::updateCounter($lid) targeting XoopsModules\Xoopstube\Utility::updateCounter() seems to always return null.
This check looks for function or method calls that always return null and whose return value is assigned to a variable. class A
{
function getObject()
{
return null;
}
}
$a = new A();
$object = $a->getObject();
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 141 | } |
||
| 142 | |||
| 143 | // Show other author videos |
||
| 144 | $sql = 'SELECT lid, cid, title, published FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' |
||
| 145 | WHERE submitter=' . $video_arr['submitter'] . ' |
||
| 146 | AND lid <> ' . $video_arr['lid'] . ' |
||
| 147 | AND published > 0 AND published <= ' . time() . ' AND (expired = 0 OR expired > ' . time() . ') |
||
| 148 | AND offline = 0 ORDER BY published DESC'; |
||
| 149 | $result = $GLOBALS['xoopsDB']->query($sql, 10, 0); |
||
| 150 | |||
| 151 | while (false !== ($arr = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||
| 152 | if (true === Utility::checkGroups($arr['cid'])) { |
||
| 153 | $videouid['title'] = htmlspecialchars($arr['title']); |
||
| 154 | $videouid['lid'] = $arr['lid']; |
||
| 155 | $videouid['cid'] = $arr['cid']; |
||
| 156 | $videouid['published'] = Utility::getTimestamp(formatTimestamp($arr['published'], $GLOBALS['xoopsModuleConfig']['dateformat'])); |
||
| 157 | $xoopsTpl->append('video_uid', $videouid); |
||
| 158 | } |
||
| 159 | } |
||
| 160 | |||
| 161 | // Copyright notice |
||
| 162 | if (isset($GLOBALS['xoopsModuleConfig']['copyright']) && 1 == $GLOBALS['xoopsModuleConfig']['copyright']) { |
||
| 163 | $xoopsTpl->assign('lang_copyright', '' . $video['publisher'] . ' © ' . _MD_XOOPSTUBE_COPYRIGHT . ' ' . formatTimestamp(time(), 'Y') . ' - ' . XOOPS_URL); |
||
| 164 | } |
||
| 165 | |||
| 166 | // Show other videos by submitter |
||
| 167 | if (isset($GLOBALS['xoopsModuleConfig']['othervideos']) && 1 == $GLOBALS['xoopsModuleConfig']['othervideos']) { |
||
| 168 | $xoopsTpl->assign('other_videos', '<b>' . _MD_XOOPSTUBE_OTHERBYUID . '</b>' . $video['submitter'] . '<br>'); |
||
| 169 | } else { |
||
| 170 | $xoopsTpl->assign('other_videos', '<b>' . _MD_XOOPSTUBE_NOOTHERBYUID . '</b>' . $video['submitter'] . '<br>'); |
||
| 171 | } |
||
| 172 | |||
| 173 | $video['showsubmitterx'] = $GLOBALS['xoopsModuleConfig']['showsubmitter']; |
||
| 174 | $video['showsbookmarx'] = $GLOBALS['xoopsModuleConfig']['showsbookmarks']; |
||
| 175 | $video['othervideox'] = $GLOBALS['xoopsModuleConfig']['othervideos']; |
||
| 176 | $xoopsTpl->assign('video', $video); |
||
| 177 | |||
| 178 | $xoopsTpl->assign('back', '<a href="javascript:history.go(-1)"><img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/back.png"></a>'); // Displays Back button |
||
| 179 | $xoopsTpl->assign('module_dir', $xoopsModule->getVar('dirname')); |
||
| 180 | $xoopsTpl->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName); |
||
| 181 | |||
| 182 | require_once XOOPS_ROOT_PATH . '/include/comment_view.php'; |
||
| 183 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
| 184 |