1 | <?php declare(strict_types=1); |
||
2 | /* |
||
3 | You may not change or alter any portion of this comment or credits |
||
4 | of supporting developers from this source code or any supporting source code |
||
5 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
6 | |||
7 | This program is distributed in the hope that it will be useful, |
||
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
10 | */ |
||
11 | |||
12 | /** |
||
13 | * @category Module |
||
14 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
15 | * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
16 | * @author Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
||
17 | */ |
||
18 | |||
19 | use Xmf\Request; |
||
20 | use XoopsModules\Suico\{ |
||
21 | VideoHandler |
||
22 | }; |
||
23 | |||
24 | require __DIR__ . '/header.php'; |
||
25 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
26 | redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 3, _MD_SUICO_TOKENEXPIRED); |
||
27 | } |
||
28 | $video_id = Request::getInt('video_id', 0, 'POST'); |
||
29 | /** |
||
30 | * Creating the factory loading the video changing its caption |
||
31 | */ |
||
32 | $videoFactory = new VideoHandler( |
||
33 | $xoopsDB |
||
34 | ); |
||
35 | $video = $videoFactory->create(false); |
||
36 | $video->load($video_id); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
37 | $video->setVar('featured_video', 1); |
||
38 | /** |
||
39 | * Verifying who's the owner to allow changes |
||
40 | */ |
||
41 | $uid = (int)$xoopsUser->getVar('uid'); |
||
42 | if ($uid === $video->getVar('uid_owner')) { |
||
43 | if ($videoFactory->unsetAllMainsbyID($uid)) { |
||
44 | if ($videoFactory->insert2($video)) { |
||
45 | redirect_header('videos.php?uid=' . (int)$xoopsUser->getVar('uid') . '#' . $video_id, 2, _MD_SUICO_SETFEATUREDVIDEO); |
||
46 | } else { |
||
47 | redirect_header('videos.php', 2, _MD_SUICO_ERROR); |
||
48 | } |
||
49 | } else { |
||
50 | echo 'did not work'; |
||
51 | } |
||
52 | } |
||
53 | require \dirname(__DIR__, 2) . '/footer.php'; |
||
54 |