Passed
Push — master ( 6d3e95...4ad186 )
by Goffy
03:09
created

admin/permissions.php (5 issues)

Labels
Severity
1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
/**
13
 * wgGitHub module for xoops
14
 *
15
 * @copyright      2020 XOOPS Project (https://xooops.org)
16
 * @license        GPL 2.0 or later
17
 * @package        wggithub
18
 * @since          1.0
19
 * @min_xoops      2.5.10
20
 * @author         Goffy - XOOPS Development Team - Email:<[email protected]> - Website:<https://wedega.com>
21
 */
22
23
use Xmf\Request;
0 ignored issues
show
The type Xmf\Request was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
24
use XoopsModules\Wggithub;
25
use XoopsModules\Wggithub\Constants;
26
27
require __DIR__ . '/header.php';
28
29
// Template Index
30
$templateMain = 'wggithub_admin_permissions.tpl';
31
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('permissions.php'));
32
33
$op = Request::getCmd('op', 'global');
34
35
// Get Form
36
include_once \XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';
0 ignored issues
show
The constant XOOPS_ROOT_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
37
\xoops_load('XoopsFormLoader');
0 ignored issues
show
The function xoops_load was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

37
/** @scrutinizer ignore-call */ 
38
\xoops_load('XoopsFormLoader');
Loading history...
38
39
$formTitle = \_AM_WGGITHUB_PERMISSIONS_GLOBAL;
40
$permName = 'wggithub_ac';
41
$permDesc = \_AM_WGGITHUB_PERMISSIONS_GLOBAL_DESC;
42
$globalPerms = [
43
    Constants::PERM_GLOBAL_VIEW => \_AM_WGGITHUB_PERMISSIONS_GLOBAL_VIEW,
44
    Constants::PERM_GLOBAL_READ => \_AM_WGGITHUB_PERMISSIONS_GLOBAL_READ,
45
    Constants::PERM_README_UPDATE => \_AM_WGGITHUB_PERMISSIONS_README_UPDATE,
46
];
47
48
$moduleId = $xoopsModule->getVar('mid');
49
$permForm = new \XoopsGroupPermForm($formTitle, $moduleId, $permName, $permDesc, 'admin/permissions.php');
0 ignored issues
show
The type XoopsGroupPermForm was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
50
$permFound = false;
51
if ('global' === $op) {
52
    foreach ($globalPerms as $gPermId => $gPermName) {
53
        $permForm->addItem($gPermId, $gPermName);
54
    }
55
    $GLOBALS['xoopsTpl']->assign('form', $permForm->render());
56
    $permFound = true;
57
}
58
unset($permForm);
59
if (true !== $permFound) {
60
    \redirect_header('permissions.php', 3, \_AM_WGGITHUB_NO_PERMISSIONS_SET);
0 ignored issues
show
The function redirect_header was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

60
    /** @scrutinizer ignore-call */ \redirect_header('permissions.php', 3, \_AM_WGGITHUB_NO_PERMISSIONS_SET);
Loading history...
61
    exit();
62
}
63
64
require __DIR__ . '/footer.php';
65