ImpressCMS/impresscms

View on GitHub
htdocs/modules/system/admin/modulesadmin/main.php

Summary

Maintainability
C
1 day
Test Coverage

File main.php has 256 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
// $Id: main.php 12313 2013-09-15 21:14:35Z skenow $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
Severity: Minor
Found in htdocs/modules/system/admin/modulesadmin/main.php - About 2 hrs to fix

    Call to method checkVarArray from undeclared class \icms_core_DataFilter
    Open

        $clean_GET = icms_core_DataFilter::checkVarArray($_GET, $filter_get, false);

    Variable $oldname is undeclared
    Open

            if ($newname[$mid] != $oldname[$mid]) {

    Variable $from_112 is undeclared
    Open

        if ($from_112) {

    Variable $oldstatus is undeclared
    Open

                if ($oldstatus[$mid] == 0) {

    Variable $oldweight is undeclared
    Open

            if ($oldweight[$mid] != $weight[$mid]) {

    Variable $weight is undeclared
    Open

                echo $weight[$mid];

    Variable $oldstatus is undeclared
    Open

                if ($oldstatus[$mid] == 0) {

    Variable $newname is undeclared
    Open

            $newname[$mid] = trim($newname[$mid]);

    Reference to static property user from undeclared class \icms
    Open

    if (!is_object(icms::$user) || !is_object(icms::$module) || !icms::$user->isAdmin(icms::$module->getVar('mid'))) {

    Variable $oldstatus is undeclared
    Open

                if ($oldstatus[$mid] == 1) {

    Variable $weight is undeclared
    Open

            if ($oldweight[$mid] != $weight[$mid]) {

    Variable $oldstatus is undeclared
    Open

            ."' /><input type='hidden' name='oldstatus[" . $mid . "]' value='" . (int) $oldstatus[$mid]

    Variable $oldweight is undeclared
    Open

            ."' /><input type='hidden' name='oldweight[" . $mid . "]' value='" . (int) $oldweight[$mid]

    Variable $weight is undeclared
    Open

            if ($oldname[$mid] != $newname[$mid] || $oldweight[$mid] != $weight[$mid]) {

    Reference to static property module from undeclared class \icms
    Open

    if (!is_object(icms::$user) || !is_object(icms::$module) || !icms::$user->isAdmin(icms::$module->getVar('mid'))) {

    Reference to undeclared constant \_YES
    Open

        icms_core_Message::confirm(array('module' => $module, 'op' => 'uninstall_ok', 'fct' => 'modulesadmin'), 'admin.php', $msgs, _YES);

    Reference to static property security from undeclared class \icms
    Open

        if (!icms::$security->check()) {

    Variable $weight is undeclared
    Open

            ."' /><input type='hidden' name='weight[" . $mid . "]' value='" . (int) $weight[$mid]

    Variable $module is undeclared
    Open

        foreach ($module as $mid) {

    Call to method stripSlashesGPC from undeclared class \icms_core_DataFilter
    Open

            echo '<tr class="' . $class . '"><td align="center">' . icms_core_DataFilter::stripSlashesGPC($oldname[$mid]);

    Call to method confirm from undeclared class \icms_core_Message
    Open

        icms_core_Message::confirm(array('module' => $module, 'op' => 'uninstall_ok', 'fct' => 'modulesadmin'), 'admin.php', $msgs, _YES);

    Call to method confirm from undeclared class \icms_core_Message
    Open

        icms_core_Message::confirm(array('module' => $module, 'op' => 'install_ok', 'fct' => 'modulesadmin', 'from_112' => $from_112), 'admin.php', $msgs, _MD_AM_INSTALL);

    Variable $module is undeclared
    Open

        foreach ($module as $mid) {

    Variable $oldname is undeclared
    Open

            ."' /><input type='hidden' name='oldname[" . $mid . "]' value='" . htmlspecialchars($oldname[$mid], ENT_QUOTES)

    Variable $oldname is undeclared
    Open

            if ($oldname[$mid] != $newname[$mid] || $oldweight[$mid] != $weight[$mid]) {

    Call to method __construct from undeclared class \icms_view_Tpl
    Open

    $icmsAdminTpl = new icms_view_Tpl();

    Call to method error from undeclared class \icms_core_Message
    Open

            icms_core_Message::error($error);

    Variable $newname was undeclared, but array fields are being added to it.
    Open

            $newname[$mid] = trim($newname[$mid]);

    Call to method handler from undeclared class \icms
    Open

        $module_handler = icms::handler('icms_module');

    Variable $newname was undeclared, but array fields are being added to it.
    Open

            $newname[$mid] = trim(icms_core_DataFilter::stripslashesGPC($newname[$mid]));

    Call to method checkVarArray from undeclared class \icms_core_DataFilter
    Open

        $clean_POST = icms_core_DataFilter::checkVarArray($_POST, $filter_post, false);

    Call to method stripslashesGPC from undeclared class \icms_core_DataFilter
    Open

            $newname[$mid] = trim(icms_core_DataFilter::stripslashesGPC($newname[$mid]));

    Variable $weight is undeclared
    Open

                echo "<span style='color:#ff0000;font-weight:bold;'>" . $weight[$mid] . "</span>";

    Variable $oldstatus is undeclared
    Open

                if ($oldstatus[$mid] == 1) {

    Variable $oldweight is undeclared
    Open

            if ($oldname[$mid] != $newname[$mid] || $oldweight[$mid] != $weight[$mid]) {

    Variable $weight is undeclared
    Open

                $ret[] = xoops_module_change($mid, $weight[$mid], $newname[$mid]);

    Suspicious argument null for an echo/print statement
    Open

        echo xoops_module_list();

    Reference to undeclared constant \_MUSTWABLE
    Open

                $error[] = sprintf(_MUSTWABLE, "<strong>" . ICMS_CACHE_PATH . '/</strong>');

    Reference to static property security from undeclared class \icms
    Open

        . "' onclick='location=\"admin.php?fct=modulesadmin\"' />" . icms::$security->getTokenHTML()

    Variable $module is undeclared
    Open

        $ret[] = xoops_module_uninstall($module);

    Call to method handler from undeclared class \icms
    Open

        $module_handler = icms::handler('icms_module');

    Argument 1 (content) is array but \xoops_module_write_admin_menu() takes string defined at /code/htdocs/include/cp_functions.php:583
    Open

            if (!xoops_module_write_admin_menu($contents)) {

    Argument 1 (content) is array but \xoops_module_write_admin_menu() takes string defined at /code/htdocs/include/cp_functions.php:583
    Open

        if (!xoops_module_write_admin_menu($contents)) {

    Call to method error from undeclared class \icms_core_Message
    Open

            icms_core_Message::error(sprintf(_MD_AM_IMAGESFOLDER_UPDATE_TEXT, str_ireplace(ICMS_ROOT_PATH, "", ICMS_IMANAGER_FOLDER_PATH)), _MD_AM_IMAGESFOLDER_UPDATE_TITLE, TRUE);

    Call to method confirm from undeclared class \icms_core_Message
    Open

        icms_core_Message::confirm(array('module' => $module, 'op' => 'update_ok', 'fct' => 'modulesadmin'), 'admin.php', $msgs, _MD_AM_UPDATE);

    Variable $module is undeclared
    Open

        $ret[] = xoops_module_install($module);

    Call to method error from undeclared class \icms_core_Message
    Open

            icms_core_Message::error(sprintf(_MD_AM_PLUGINSFOLDER_UPDATE_TEXT, ICMS_PLUGINS_PATH,ICMS_ROOT_PATH . '/plugins/preloads'), _MD_AM_PLUGINSFOLDER_UPDATE_TITLE, TRUE);

    Argument 1 (content) is array but \xoops_module_write_admin_menu() takes string defined at /code/htdocs/include/cp_functions.php:583
    Open

        if (!xoops_module_write_admin_menu($contents)) {

    Call to method handler from undeclared class \icms
    Open

        $module_handler = icms::handler('icms_module');

    Variable $module is undeclared
    Open

            $ret[] = icms_module_update($module);

    Variable $module is undeclared
    Open

        $ret[] = icms_module_update($module);

    Argument 1 (content) is array but \xoops_module_write_admin_menu() takes string defined at /code/htdocs/include/cp_functions.php:583
    Open

        if (!xoops_module_write_admin_menu($contents)) {

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    if ($op == 'update_ok') {
        $ret = array();
        $ret[] = icms_module_update($module);
        $contents = impresscms_get_adminmenu();
        if (!xoops_module_write_admin_menu($contents)) {
    Severity: Major
    Found in htdocs/modules/system/admin/modulesadmin/main.php and 1 other location - About 3 hrs to fix
    htdocs/modules/system/admin/modulesadmin/main.php on lines 276..294

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 143.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    if ($op == 'uninstall_ok') {
        $ret = array();
        $ret[] = xoops_module_uninstall($module);
        $contents = impresscms_get_adminmenu();
        if (!xoops_module_write_admin_menu($contents)) {
    Severity: Major
    Found in htdocs/modules/system/admin/modulesadmin/main.php and 1 other location - About 3 hrs to fix
    htdocs/modules/system/admin/modulesadmin/main.php on lines 321..339

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 143.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

        if ($mod->getInfo('image') != FALSE && trim($mod->getInfo('image')) != '') {
            $msgs ='<img src="' . ICMS_MODULES_URL . '/' . $mod->getVar('dirname') . '/' . trim($mod->getInfo('image')) . '" alt="" />';
    
        }
    Severity: Minor
    Found in htdocs/modules/system/admin/modulesadmin/main.php and 2 other locations - About 35 mins to fix
    htdocs/modules/system/admin/modulesadmin/main.php on lines 222..225
    htdocs/modules/system/admin/modulesadmin/main.php on lines 300..303

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 92.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

        if ($mod->getInfo('image') != FALSE && trim($mod->getInfo('image')) != '') {
            $msgs ='<img src="' . ICMS_MODULES_URL . '/' . $mod->getVar('dirname') . '/' . trim($mod->getInfo('image')) . '" alt="" />';
    
        }
    Severity: Minor
    Found in htdocs/modules/system/admin/modulesadmin/main.php and 2 other locations - About 35 mins to fix
    htdocs/modules/system/admin/modulesadmin/main.php on lines 265..268
    htdocs/modules/system/admin/modulesadmin/main.php on lines 300..303

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 92.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

        if ($mod->getInfo('image') != FALSE && trim($mod->getInfo('image')) != '') {
            $msgs ='<img src="' . ICMS_MODULES_URL . '/' . $mod->getVar('dirname') . '/' . trim($mod->getInfo('image')) . '" alt="" />';
    
        }
    Severity: Minor
    Found in htdocs/modules/system/admin/modulesadmin/main.php and 2 other locations - About 35 mins to fix
    htdocs/modules/system/admin/modulesadmin/main.php on lines 222..225
    htdocs/modules/system/admin/modulesadmin/main.php on lines 265..268

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 92.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    TRUE, FALSE and NULL must be lowercase; expected "true" but found "TRUE"
    Open

                $write = TRUE;

    TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
    Open

        if ($mod->getInfo('image') != FALSE && trim($mod->getInfo('image')) != '') {

    TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
    Open

        if ($mod->getInfo('image') != FALSE && trim($mod->getInfo('image')) != '') {

    Blank line found at end of control structure
    Open

    
    

    Blank line found at start of control structure
    Open

        if (icms_getModuleInfo('system')->getDBVersion() < 14 && (!is_writable(ICMS_PLUGINS_PATH) || !is_dir(ICMS_ROOT_PATH . '/plugins/preloads') || !is_writable(ICMS_ROOT_PATH . '/plugins/preloads'))) {

    Blank line found at end of control structure
    Open

    
    

    Blank line found at end of control structure
    Open

    
    

    TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
    Open

            $from_112 = FALSE;

    TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
    Open

        if ($mod->getInfo('image') != FALSE && trim($mod->getInfo('image')) != '') {

    TRUE, FALSE and NULL must be lowercase; expected "true" but found "TRUE"
    Open

            icms_core_Message::error(sprintf(_MD_AM_IMAGESFOLDER_UPDATE_TEXT, str_ireplace(ICMS_ROOT_PATH, "", ICMS_IMANAGER_FOLDER_PATH)), _MD_AM_IMAGESFOLDER_UPDATE_TITLE, TRUE);

    Blank line found at start of control structure
    Open

            if (isset($newstatus[$mid]) && $newstatus[$mid] ==1) {

    Blank line found at start of control structure
    Open

            if (isset($newstatus[$mid]) && $newstatus[$mid] ==1) {

    TRUE, FALSE and NULL must be lowercase; expected "true" but found "TRUE"
    Open

            icms_core_Message::error(sprintf(_MD_AM_PLUGINSFOLDER_UPDATE_TEXT, ICMS_PLUGINS_PATH,ICMS_ROOT_PATH . '/plugins/preloads'), _MD_AM_PLUGINSFOLDER_UPDATE_TITLE, TRUE);

    Blank line found at end of control structure
    Open

    
    

    Blank line found at start of control structure
    Open

        foreach ($module as $mid) {

    TRUE, FALSE and NULL must be lowercase; expected "true" but found "TRUE"
    Open

    icms_loadLanguageFile('system', 'blocksadmin', TRUE);

    TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
    Open

        $write = FALSE;

    Inline control structures are not allowed
    Open

        if (isset($_GET['filter_post'])) unset($_GET['filter_post']);

    No space found after comma in function call
    Open

            icms_core_Message::error(sprintf(_MD_AM_PLUGINSFOLDER_UPDATE_TEXT, ICMS_PLUGINS_PATH,ICMS_ROOT_PATH . '/plugins/preloads'), _MD_AM_PLUGINSFOLDER_UPDATE_TITLE, TRUE);

    Expected 1 newline at end of file; 0 found
    Open

    }

    There are no issues that match your filters.

    Category
    Status