Passed
Pull Request — master (#175)
by Michael
03:42
created

class/FriendsController.php (1 issue)

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
use Criteria;
18
19
/**
20
 * @category        Module
21
 * @package         suico
22
 * @copyright       {@link https://xoops.org/ XOOPS Project}
23
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
24
 * @author          Marcello Brandão aka  Suico, Mamba, LioMJ  <https://xoops.org>
25
 */
26
require_once XOOPS_ROOT_PATH . '/kernel/object.php';
27
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
28
require_once XOOPS_ROOT_PATH . '/class/criteria.php';
29
require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
30
31
/**
32
 * Class FriendsController
33
 */
34
class FriendsController extends SuicoController
35
{
36
    /**
37
     * @return bool|void
38
     */
39
    public function checkPrivilege()
40
    {
41
        if (0 === $this->helper->getConfig('enable_friends')) {
42
            \redirect_header('index.php?uid=' . $this->owner->getVar('uid'), 3, \_MD_SUICO_FRIENDS_ENABLED_NOT);
43
        }
44
        $criteria = new Criteria('config_uid', $this->owner->getVar('uid'));
45
        if (1 === $this->configsFactory->getCount($criteria)) {
46
            $configs = $this->configsFactory->getObjects($criteria);
47
            $config  = $configs[0]->getVar('friends');
0 ignored issues
show
The assignment to $config is dead and can be removed.
Loading history...
48
/*
49
            if (!$this->checkPrivilegeLevel($config)) {
50
                //mb temporary fix for self-loop
51
//                  \redirect_header('index.php?uid=' . $this->owner->getVar('uid'), 10, sprintf(_MD_SUICO_NOPRIVILEGE,'Friends'));
52
                redirect_header('/', 10, sprintf(_MD_SUICO_NOPRIVILEGE,'Friends'));
53
            }
54
*/
55
        }
56
        return true;
57
    }
58
}
59