Passed
Push — master ( 4761c2...696f77 )
by
unknown
05:50 queued 19s
created

class/PhotosController.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace XoopsModules\Suico;
6
7
/*
8
 You may not change or alter any portion of this comment or credits
9
 of supporting developers from this source code or any supporting source code
10
 which is considered copyrighted (c) material of the original comment or credit authors.
11
12
 This program is distributed in the hope that it will be useful,
13
 but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
*/
16
17
/**
18
 * @category        Module
19
 * @package         suico
20
 * @copyright       {@link https://xoops.org/ XOOPS Project}
21
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
22
 * @author          Marcello Brandão aka  Suico, Mamba, LioMJ  <https://xoops.org>
23
 */
24
25
use Criteria;
26
27
require_once XOOPS_ROOT_PATH . '/kernel/object.php';
28
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
29
require_once XOOPS_ROOT_PATH . '/class/criteria.php';
30
require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
31
32
/**
33
 * Class PhotosController
34
 */
35
class PhotosController extends SuicoController
36
{
37
    /**
38
     * @return bool|void
39
     */
40
    public function checkPrivilege()
41
    {
42
        if (0 === $this->helper->getConfig('enable_pictures')) {
43
            \redirect_header('index.php?uid=' . $this->owner->getVar('uid'), 3, \_MD_SUICO_PICTURES_ENABLED_NOT);
44
        }
45
        $criteria = new Criteria('config_uid', $this->owner->getVar('uid'));
0 ignored issues
show
It seems like $this->owner->getVar('uid') can also be of type array and array; however, parameter $value of Criteria::__construct() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

45
        $criteria = new Criteria('config_uid', /** @scrutinizer ignore-type */ $this->owner->getVar('uid'));
Loading history...
46
        if (1 == $this->configsFactory->getCount($criteria)) {
47
            $configs = $this->configsFactory->getObjects($criteria);
48
            $config  = $configs[0]->getVar('pictures');
49
            if (!$this->checkPrivilegeLevel($config)) {
50
                \redirect_header('index.php?uid=' . $this->owner->getVar('uid'), 10, \_MD_SUICO_NOPRIVILEGE);
51
            }
52
        }
53
        return true;
54
    }
55
}
56