ImpressCMS/impresscms

View on GitHub
htdocs/install/templates/mainfile.dist.php

Summary

Maintainability
F
4 days
Test Coverage

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

<?php
/**
* All information in order to connect to database are going through here.
*
* Be careful if you are changing data's in this file.
Severity: Major
Found in htdocs/install/templates/mainfile.dist.php and 1 other location - About 4 days to fix
upgrade/upd-icms-1.0-to-1.1/mainfile.dist.php on lines 1..120

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 742.

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

Tabs must be used to indent lines; spaces are not allowed
Open

            exit();

Tabs must be used to indent lines; spaces are not allowed
Open

                 die("ImpressCMS path check: this file cannot be requested directly");

Tabs must be used to indent lines; spaces are not allowed
Open

             exit("ImpressCMS path check: Script is not inside XOOPS_ROOT_PATH and cannot run.");

Tabs must be used to indent lines; spaces are not allowed
Open

        if (isset( $_REQUEST[$bad_global] )) {

Tabs must be used to indent lines; spaces are not allowed
Open

            header( 'Location: '.XOOPS_URL.'/' );

Space found after opening bracket of FOREACH loop
Open

    foreach ( array('GLOBALS', '_SESSION', 'HTTP_SESSION_VARS', '_GET', 'HTTP_GET_VARS', '_POST', 'HTTP_POST_VARS', '_COOKIE', 'HTTP_COOKIE_VARS', '_REQUEST', '_SERVER', 'HTTP_SERVER_VARS', '_ENV', 'HTTP_ENV_VARS', '_FILES', 'HTTP_POST_FILES', 'xoopsDB', 'xoopsUser', 'xoopsUserId', 'xoopsUserGroups', 'xoopsUserIsAdmin', 'icmsConfig', 'xoopsOption', 'xoopsModule', 'xoopsModuleConfig', 'xoopsRequestUri') as $bad_global) {

Tabs must be used to indent lines; spaces are not allowed
Open

    define('XOOPS_DB_CHARSET', '');

Tabs must be used to indent lines; spaces are not allowed
Open

    }

Tabs must be used to indent lines; spaces are not allowed
Open

    if (defined('XOOPS_DB_CHARSET')) die();

Tabs must be used to indent lines; spaces are not allowed
Open

    foreach ( array('GLOBALS', '_SESSION', 'HTTP_SESSION_VARS', '_GET', 'HTTP_GET_VARS', '_POST', 'HTTP_POST_VARS', '_COOKIE', 'HTTP_COOKIE_VARS', '_REQUEST', '_SERVER', 'HTTP_SERVER_VARS', '_ENV', 'HTTP_ENV_VARS', '_FILES', 'HTTP_POST_FILES', 'xoopsDB', 'xoopsUser', 'xoopsUserId', 'xoopsUserGroups', 'xoopsUserIsAdmin', 'icmsConfig', 'xoopsOption', 'xoopsModule', 'xoopsModuleConfig', 'xoopsRequestUri') as $bad_global) {

Tabs must be used to indent lines; spaces are not allowed
Open

    // Set the database charset if applicable

Tabs must be used to indent lines; spaces are not allowed
Open

        }

Inline control structures are not allowed
Open

    if (defined('XOOPS_DB_CHARSET')) die();

Expected 0 spaces before closing bracket; 1 found
Open

            header( 'Location: '.XOOPS_URL.'/' );

Space after opening parenthesis of function call prohibited
Open

    define( 'ICMS_TRUST_PATH', XOOPS_TRUST_PATH );

Expected 0 spaces before closing bracket; 1 found
Open

    define( 'ICMS_URL', XOOPS_URL );

Space after opening parenthesis of function call prohibited
Open

            header( 'Location: '.XOOPS_URL.'/' );

Space after opening parenthesis of function call prohibited
Open

            $xoopsScriptPath = str_replace( strpos( $xoopsScriptPath, '\\\\', 2 ) ? '\\\\' : DIRECTORY_SEPARATOR, '/', $xoopsScriptPath);

Expected 0 spaces before closing bracket; 1 found
Open

    define( 'ICMS_TRUST_PATH', XOOPS_TRUST_PATH );

Expected 0 spaces before closing bracket; 1 found
Open

            $xoopsScriptPath = str_replace( strpos( $xoopsScriptPath, '\\\\', 2 ) ? '\\\\' : DIRECTORY_SEPARATOR, '/', $xoopsScriptPath);

Space after opening parenthesis of function call prohibited
Open

    define( 'ICMS_ROOT_PATH', XOOPS_ROOT_PATH );

Expected 0 spaces after opening bracket; 1 found
Open

    foreach ( array('GLOBALS', '_SESSION', 'HTTP_SESSION_VARS', '_GET', 'HTTP_GET_VARS', '_POST', 'HTTP_POST_VARS', '_COOKIE', 'HTTP_COOKIE_VARS', '_REQUEST', '_SERVER', 'HTTP_SERVER_VARS', '_ENV', 'HTTP_ENV_VARS', '_FILES', 'HTTP_POST_FILES', 'xoopsDB', 'xoopsUser', 'xoopsUserId', 'xoopsUserGroups', 'xoopsUserIsAdmin', 'icmsConfig', 'xoopsOption', 'xoopsModule', 'xoopsModuleConfig', 'xoopsRequestUri') as $bad_global) {

Expected 0 spaces before closing bracket; 1 found
Open

    define( 'ICMS_ROOT_PATH', XOOPS_ROOT_PATH );

Space after opening parenthesis of function call prohibited
Open

        if (strcasecmp( substr($xoopsScriptPath, 0, strlen(XOOPS_ROOT_PATH)), str_replace( DIRECTORY_SEPARATOR, '/', XOOPS_ROOT_PATH))) {

No space found after comma in function call
Open

    define("XOOPS_MAINFILE_INCLUDED",1);

Space after opening parenthesis of function call prohibited
Open

        if (isset( $_REQUEST[$bad_global] )) {

Space after opening parenthesis of function call prohibited
Open

            $xoopsScriptPath = str_replace( strpos( $xoopsScriptPath, '\\\\', 2 ) ? '\\\\' : DIRECTORY_SEPARATOR, '/', $xoopsScriptPath);

Space after opening parenthesis of function call prohibited
Open

        if (strcasecmp( substr($xoopsScriptPath, 0, strlen(XOOPS_ROOT_PATH)), str_replace( DIRECTORY_SEPARATOR, '/', XOOPS_ROOT_PATH))) {

Expected 0 spaces before closing bracket; 1 found
Open

        if (isset( $_REQUEST[$bad_global] )) {

Space after opening parenthesis of function call prohibited
Open

    define( 'ICMS_URL', XOOPS_URL );

Expected 1 newline at end of file; 0 found
Open

}

Unexpected spaces found.
Open

    // Set the database charset if applicable

Unexpected spaces found.
Open

            exit();

Unexpected trailing spaces found.
Open

    

Unexpected spaces found.
Open

    }

Unexpected spaces found.
Open

                 die("ImpressCMS path check: this file cannot be requested directly");

Unexpected spaces found.
Open

    foreach ( array('GLOBALS', '_SESSION', 'HTTP_SESSION_VARS', '_GET', 'HTTP_GET_VARS', '_POST', 'HTTP_POST_VARS', '_COOKIE', 'HTTP_COOKIE_VARS', '_REQUEST', '_SERVER', 'HTTP_SERVER_VARS', '_ENV', 'HTTP_ENV_VARS', '_FILES', 'HTTP_POST_FILES', 'xoopsDB', 'xoopsUser', 'xoopsUserId', 'xoopsUserGroups', 'xoopsUserIsAdmin', 'icmsConfig', 'xoopsOption', 'xoopsModule', 'xoopsModuleConfig', 'xoopsRequestUri') as $bad_global) {

Unexpected trailing spaces found.
Open

 

Unexpected spaces found.
Open

    if (defined('XOOPS_DB_CHARSET')) die();

Unexpected spaces found.
Open

            header( 'Location: '.XOOPS_URL.'/' );

Unexpected spaces found.
Open

        }

Unexpected spaces found.
Open

             exit("ImpressCMS path check: Script is not inside XOOPS_ROOT_PATH and cannot run.");

Unexpected spaces found.
Open

        if (isset( $_REQUEST[$bad_global] )) {

Unexpected spaces found.
Open

 

Unexpected spaces found.
Open

    define('XOOPS_DB_CHARSET', '');

There are no issues that match your filters.

Category
Status