Passed
Pull Request — master (#172)
by
unknown
02:47
created

private.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
/*
5
 You may not change or alter any portion of this comment or credits
6
 of supporting developers from this source code or any supporting source code
7
 which is considered copyrighted (c) material of the original comment or credit authors.
8
9
 This program is distributed in the hope that it will be useful,
10
 but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
*/
13
14
/**
15
 * @category        Module
16
 * @package         suico
17
 * @copyright       {@link https://xoops.org/ XOOPS Project}
18
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
19
 * @author          Marcello Brandão aka  Suico, Mamba, LioMJ  <https://xoops.org>
20
 */
21
22
use Xmf\Request;
23
use XoopsModules\Suico;
24
25
require __DIR__ . '/header.php';
26
//require_once __DIR__ . '/class/Image.php';
27
if (!$GLOBALS['xoopsSecurity']->check()) {
28
    redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 3, _MD_SUICO_TOKENEXPIRED);
29
}
30
$image_id = Request::getInt('image_id', 0, 'POST');
31
/**
32
 * Creating the factory  loading the picture changing its caption
33
 */
34
$imageFactory = new Suico\ImageHandler(
35
    $xoopsDB
36
);
37
$picture      = $imageFactory->create(false);
38
$picture->load($image_id);
0 ignored issues
show
The method load() does not exist on XoopsObject. It seems like you code against a sub-type of XoopsObject such as XoopsModules\Suico\Video or XoopsModules\Suico\Suspensions or XoopsModules\Suico\Notes or XoopsModules\Suico\Image or XoopsModules\Suico\Friendship or XoopsComments or XoopsModules\Suico\Visitors or XoopsModules\Suico\Relgroupuser or XoopsModules\Suico\Groups or XoopsModules\Suico\Configs or XoopsModules\Suico\Friendrequest or XoopsModules\Suico\Ishot or XoopsModules\Suico\Audio. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
$picture->/** @scrutinizer ignore-call */ 
39
          load($image_id);
Loading history...
39
$picture->setVar('private', Request::getInt('private', 0, 'POST'));
40
/**
41
 * Verifying who's the owner to allow changes
42
 */
43
$uid = (int)$xoopsUser->getVar('uid');
44
if ($uid === (int)$picture->getVar('uid_owner')) {
45
    if ($imageFactory->insert2($picture)) {
46
        if (1 === Request::getInt('private', 0, 'POST')) {
47
            redirect_header('album.php', 2, _MD_SUICO_PRIVATIZED);
48
        } else {
49
            redirect_header('album.php', 2, _MD_SUICO_UNPRIVATIZED);
50
        }
51
    } else {
52
        redirect_header('album.php', 2, _MD_SUICO_ERROR);
53
    }
54
}
55
require dirname(__DIR__, 2) . '/footer.php';
56