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