Completed
Push — master ( 98eeb4...22887c )
by Michael
11s
created

admin/menu.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * xLanguage module (eXtensible Language Management For XOOPS)
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
 * This program is distributed in the hope that it will be useful,
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * @copyright    XOOPS Project (https://xoops.org)
13
 * @license      {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
14
 * @package      xlanguage
15
 * @since        2.0
16
 * @author       D.J.(phppp) [email protected]
17
 **/
18
19
use Xmf\Module\Admin;
20
use Xmf\Module\Helper;
21
22
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% 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...
23
24
//$path = dirname(dirname(dirname(__DIR__)));
0 ignored issues
show
Unused Code Comprehensibility introduced by
55% 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...
25
//require_once $path . '/mainfile.php';
26
27
$moduleDirName = basename(dirname(__DIR__));
28
29
if (false !== ($moduleHelper = Helper::getHelper($moduleDirName))) {
0 ignored issues
show
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 = Helper::getHelper('system');
32
}
33
$pathIcon32    = Admin::menuIconPath('');
34
$pathModIcon32 = $moduleHelper->getModule()->getInfo('modicons32');
35
36
xoops_loadLanguage('modinfo', $moduleDirName);
37
38
$adminmenu = array();
39
40
$i                      = 1;
41
$adminmenu[$i]['title'] = _MI_XLANGUAGE_ADMENU_HOME;
42
$adminmenu[$i]['link']  = 'admin/index.php';
43
$adminmenu[$i]['icon']  = $pathIcon32 . '/home.png';
44
++$i;
45
$adminmenu[$i]['title'] = _MI_XLANGUAGE_ADMENU0;
46
$adminmenu[$i]['link']  = 'admin/main.php';
47
$adminmenu[$i]['icon']  = $pathIcon32 . '/manage.png';
48
++$i;
49
$adminmenu[$i]['title'] = _MI_XLANGUAGE_ADMENU1;
50
$adminmenu[$i]['link']  = 'admin/main.php?op=add&type=base';
51
$adminmenu[$i]['icon']  = $pathIcon32 . '/add.png';
52
++$i;
53
$adminmenu[$i]['title'] = _MI_XLANGUAGE_ADMENU2;
54
$adminmenu[$i]['link']  = 'admin/main.php?op=add&type=ext';
55
$adminmenu[$i]['icon']  = $pathIcon32 . '/insert_table_row.png';
56
++$i;
57
$adminmenu[$i]['title'] = _MI_XLANGUAGE_ADMENU3;
58
$adminmenu[$i]['link']  = 'admin/about.php';
59
$adminmenu[$i]['icon']  = $pathIcon32 . '/about.png';
60
// ++$i;
61
// $adminmenu[$i]['title'] = _MI_XLANGUAGE_ADMENU3;
62
// $adminmenu[$i]['link'] = "admin/about2.php";
63
// $adminmenu[$i]['icon']  = $pathIcon32.'/about.png';
64