1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
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 | This program is distributed in the hope that it will be useful, |
||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
13 | */ |
||
14 | |||
15 | /** |
||
16 | * @category Module |
||
17 | * @package yogurt |
||
18 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
19 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
20 | * @author Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
||
21 | */ |
||
22 | |||
23 | use Xmf\Request; |
||
24 | use XoopsModules\Yogurt; |
||
25 | |||
26 | require __DIR__ . '/header.php'; |
||
27 | |||
28 | //require_once __DIR__ . '/class/Image.php'; |
||
29 | |||
30 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
31 | redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 3, _MD_YOGURT_TOKENEXPIRED); |
||
32 | } |
||
33 | |||
34 | $cod_img = Request::getInt('cod_img', 0, 'POST'); |
||
35 | |||
36 | /** |
||
37 | * Creating the factory loading the picture changing its caption |
||
38 | */ |
||
39 | $imageFactory = new Yogurt\ImageHandler( |
||
40 | $xoopsDB |
||
41 | ); |
||
42 | $picture = $imageFactory->create(false); |
||
43 | $picture->load($cod_img); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
44 | $picture->setVar('private', Request::getInt('private', 0, 'POST')); |
||
45 | |||
46 | /** |
||
47 | * Verifying who's the owner to allow changes |
||
48 | */ |
||
49 | $uid = (int)$xoopsUser->getVar('uid'); |
||
50 | if ($uid === (int)$picture->getVar('uid_owner')) { |
||
51 | if ($imageFactory->insert2($picture)) { |
||
52 | if (1 === Request::getInt('private', 0, 'POST')) { |
||
53 | redirect_header('album.php', 2, _MD_YOGURT_PRIVATIZED); |
||
54 | } else { |
||
55 | redirect_header('album.php', 2, _MD_YOGURT_UNPRIVATIZED); |
||
56 | } |
||
57 | } else { |
||
58 | redirect_header('album.php', 2, _MD_YOGURT_ERROR); |
||
59 | } |
||
60 | } |
||
61 | |||
62 | require dirname(__DIR__, 2) . '/footer.php'; |
||
63 |