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 | use Xmf\Request; |
||
22 | |||
23 | require_once __DIR__ . '/header.php'; |
||
24 | |||
25 | $op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET'); |
||
26 | $lid = Request::getInt('lid', Request::getInt('lid', '', 'POST'), 'GET'); |
||
27 | |||
28 | $buttonn = strtolower(_MD_XOOPSTUBE_SUBMITBROKEN); |
||
29 | |||
30 | switch (strtolower($op)) { |
||
31 | case $buttonn: |
||
32 | $sender = (is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsUser'])) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
||
33 | $ip = getenv('REMOTE_ADDR'); |
||
34 | $title = Request::getString('title', '', 'POST'); |
||
35 | $time = time(); |
||
36 | |||
37 | // Check if REG user is trying to report twice |
||
38 | $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_broken') . ' WHERE lid=' . (int)$lid); |
||
39 | list($count) = $GLOBALS['xoopsDB']->fetchRow($result); |
||
40 | if ($count > 0) { |
||
41 | $ratemessage = _MD_XOOPSTUBE_ALREADYREPORTED; |
||
42 | redirect_header('singlevideo.php?cid=' . (int)$cid . '&lid=' . (int)$lid, 2, $ratemessage); |
||
43 | } else { |
||
44 | $reportid = 0; |
||
45 | $sql = sprintf('INSERT INTO %s (reportid, lid, sender, ip, date, confirmed, acknowledged, title ) VALUES ( %u, %u, %u, %s, %u, %u, %u, %s)', $GLOBALS['xoopsDB']->prefix('xoopstube_broken'), $reportid, $lid, $sender, $GLOBALS['xoopsDB']->quoteString($ip), $time, 0, 0, |
||
46 | $GLOBALS['xoopsDB']->quoteString($title)); |
||
47 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
||
48 | $error[] = _MD_XOOPSTUBE_ERROR; |
||
49 | } |
||
50 | $newid = $GLOBALS['xoopsDB']->getInsertId(); |
||
51 | |||
52 | // Send notifications |
||
53 | $tags = array(); |
||
54 | $tags['BROKENREPORTS_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/main.php?op=listBrokenvideos'; |
||
55 | $notificationHandler = xoops_getHandler('notification'); |
||
56 | $notificationHandler->triggerEvent('global', 0, 'video_broken', $tags); |
||
57 | |||
58 | // Send email to the owner of the linkload stating that it is broken |
||
59 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . (int)$lid . ' AND published > 0 AND published <= ' . time() . ' AND (expired = 0 OR expired > ' . time() . ')'; |
||
60 | $video_arr = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
||
61 | unset($sql); |
||
62 | |||
63 | $memberHandler = xoops_getHandler('member'); |
||
64 | $submit_user = $memberHandler->getUser($video_arr['submitter']); |
||
65 | if (is_object($submit_user) && !empty($submit_user)) { |
||
66 | $subdate = formatTimestamp($video_arr['date'], $GLOBALS['xoopsModuleConfig']['dateformat']); |
||
67 | $cid = $video_arr['cid']; |
||
68 | $title = $xtubemyts->htmlSpecialCharsStrip($video_arr['title']); |
||
69 | $subject = _MD_XOOPSTUBE_BROKENREPORTED; |
||
70 | |||
71 | $xoopsMailer = xoops_getMailer(); |
||
72 | $xoopsMailer->useMail(); |
||
73 | $template_dir = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/mail_template'; |
||
74 | $xoopsMailer->setTemplateDir($template_dir); |
||
75 | $xoopsMailer->setTemplate('videobroken_notify.tpl'); |
||
76 | $xoopsMailer->setToEmails($submit_user->getVar('email')); |
||
77 | $xoopsMailer->setFromEmail($GLOBALS['xoopsConfig']['adminmail']); |
||
78 | $xoopsMailer->setFromName($GLOBALS['xoopsConfig']['sitename']); |
||
79 | $xoopsMailer->assign('X_UNAME', $submit_user->getVar('uname')); |
||
80 | $xoopsMailer->assign('SITENAME', $GLOBALS['xoopsConfig']['sitename']); |
||
81 | $xoopsMailer->assign('X_ADMINMAIL', $GLOBALS['xoopsConfig']['adminmail']); |
||
82 | $xoopsMailer->assign('X_SITEvidid', XOOPS_VIDID . '/'); |
||
83 | $xoopsMailer->assign('X_TITLE', $title); |
||
84 | $xoopsMailer->assign('X_SUB_DATE', $subdate); |
||
85 | $xoopsMailer->assign('X_VIDEOLOAD', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' . $cid . '&lid=' . $lid); |
||
86 | $xoopsMailer->setSubject($subject); |
||
87 | $message = $xoopsMailer->send() ? _MD_XOOPSTUBE_BROKENREPORTED : _MD_XOOPSTUBE_ERRORSENDEMAIL; |
||
88 | } else { |
||
89 | $message = _MD_XOOPSTUBE_ERRORSENDEMAIL; |
||
90 | } |
||
91 | redirect_header('singlevideo.php?cid=' . (int)$cid . '&lid=' . (int)$lid, 2, $message); |
||
92 | } |
||
93 | break; |
||
94 | |||
95 | default: |
||
0 ignored issues
–
show
|
|||
96 | |||
97 | $GLOBALS['xoopsOption']['template_main'] = 'xoopstube_brokenvideo.tpl'; |
||
98 | include XOOPS_ROOT_PATH . '/header.php'; |
||
99 | |||
100 | $catarray['imageheader'] = XoopstubeUtility::xtubeRenderImageHeader(); |
||
101 | $xoopsTpl->assign('catarray', $catarray); |
||
102 | |||
103 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . (int)$lid; |
||
104 | $video_arr = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
||
105 | unset($sql); |
||
106 | |||
107 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_broken') . ' WHERE lid=' . (int)$lid; |
||
108 | $broke_arr = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
||
109 | xoops_load('XoopsUserUtility'); |
||
110 | if (is_array($broke_arr)) { |
||
111 | $broken['title'] = $xtubemyts->htmlSpecialCharsStrip($video_arr['title']); |
||
112 | $broken['id'] = $broke_arr['reportid']; |
||
113 | $broken['reporter'] = XoopsUserUtility::getUnameFromId($broke_arr['sender']); |
||
114 | $broken['date'] = XoopstubeUtility::xtubeGetTimestamp(formatTimestamp($broke_arr['date'], $GLOBALS['xoopsModuleConfig']['dateformat'])); |
||
115 | $broken['acknowledged'] = ($broke_arr['acknowledged'] == 1) ? _YES : _NO; |
||
116 | $broken['confirmed'] = ($broke_arr['confirmed'] == 1) ? _YES : _NO; |
||
117 | $xoopsTpl->assign('broken', $broken); |
||
118 | $xoopsTpl->assign('brokenreport', true); |
||
119 | } else { |
||
120 | if (!is_array($video_arr) || empty($video_arr)) { |
||
121 | $ratemessage = _MD_XOOPSTUBE_THISFILEDOESNOTEXIST; |
||
122 | redirect_header('singlevideo.php?cid=' . (int)$cid . '&lid=' . (int)$lid, 0, $ratemessage); |
||
123 | } |
||
124 | |||
125 | // file info |
||
126 | $video['title'] = $xtubemyts->htmlSpecialCharsStrip($video_arr['title']); |
||
127 | $time = ($video_arr['published'] > 0) ? $video_arr['published'] : $link_arr['updated']; |
||
128 | $video['updated'] = XoopstubeUtility::xtubeGetTimestamp(formatTimestamp($time, $GLOBALS['xoopsModuleConfig']['dateformat'])); |
||
129 | $is_updated = ($video_arr['updated'] !== 0) ? _MD_XOOPSTUBE_UPDATEDON : _MD_XOOPSTUBE_SUBMITDATE; |
||
130 | |||
131 | $video['publisher'] = XoopsUserUtility::getUnameFromId($video_arr['submitter']); |
||
132 | |||
133 | $xoopsTpl->assign('video_id', (int)$lid); |
||
134 | $xoopsTpl->assign('lang_subdate', $is_updated); |
||
135 | $xoopsTpl->assign('video', $video); |
||
136 | } |
||
137 | |||
138 | XoopstubeUtility::xtubeSetNoIndexNoFollow(); |
||
139 | |||
140 | $xoopsTpl->assign('module_dir', $xoopsModule->getVar('dirname')); |
||
141 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
142 | break; |
||
143 | } |
||
144 |
According to the PSR-2, the body of a default statement must start on the line immediately following the statement.
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.