Issues (1149)

admin/admin_header.php (6 issues)

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
 * @copyright    XOOPS Project (https://xoops.org)
14
 * @license      GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
15
 * @package
16
 * @since
17
 * @author       XOOPS Development Team
18
 * @version      $Id $
19
 */
20
21
require_once __DIR__ . '/../../../include/cp_header.php';
22
require_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php');
23
24
$moduleDirName = basename(dirname(__DIR__));
25
26
//require_once __DIR__ . '/../class/utility.php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
48% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
27
//require_once __DIR__ . '/../include/common.php';
28
29
if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) {
0 ignored issues
show
The type Xmf\Module\Helper 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...
This if statement is empty and can be removed.

This check looks for the bodies of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These if bodies can be removed. If you have an empty if but statements in the else branch, consider inverting the condition.

if (rand(1, 6) > 3) {
//print "Check failed";
} else {
    print "Check succeeded";
}

could be turned into

if (rand(1, 6) <= 3) {
    print "Check succeeded";
}

This is much more concise to read.

Loading history...
30
} else {
31
    $moduleHelper = Xmf\Module\Helper::getHelper('system');
32
}
33
$adminObject = \Xmf\Module\Admin::getInstance();
0 ignored issues
show
The type Xmf\Module\Admin 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...
34
35
$pathIcon16    = \Xmf\Module\Admin::iconUrl('', 16);
36
$pathIcon32    = \Xmf\Module\Admin::iconUrl('', 32);
37
$pathModIcon32 = $moduleHelper->getModule()->getInfo('modicons32');
38
39
// Load language files
40
$moduleHelper->loadLanguage('admin');
41
$moduleHelper->loadLanguage('modinfo');
42
$moduleHelper->loadLanguage('main');
43
44
$myts = MyTextSanitizer::getInstance();
0 ignored issues
show
The type MyTextSanitizer 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...
45
46
if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) {
0 ignored issues
show
The type XoopsTpl 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...
47
    require_once $GLOBALS['xoops']->path('class/template.php');
48
    $xoopsTpl = new XoopsTpl();
49
}
50