ImpressCMS/impresscms

View on GitHub
upgrade/upd-icms-1.0-to-1.1/settings_salt.php

Summary

Maintainability
A
3 hrs
Test Coverage

Method xoFormField has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function xoFormField( $name, $value, $label, $maxlength, $help = '' )
Severity: Minor
Found in upgrade/upd-icms-1.0-to-1.1/settings_salt.php - About 35 mins to fix

    Call to method __construct from undeclared class \icms_Password
    Open

        $icmspass = new icms_Password();

    Call to method icms_createSalt from undeclared class \icms_Password
    Open

        $vars['DB_SALT'] = $icmspass->icms_createSalt();

    Reference to undeclared constant \_SUBMIT
    Open

        <button type="submit"><?php echo _SUBMIT; ?></button>

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

    function xoFormField( $name, $value, $label, $maxlength, $help = '' )
    {
        $label = htmlspecialchars( $label );
        $name = htmlspecialchars( $name, ENT_QUOTES );
        $value = htmlspecialchars( $value, ENT_QUOTES );
    Severity: Major
    Found in upgrade/upd-icms-1.0-to-1.1/settings_salt.php and 2 other locations - About 2 hrs to fix
    htdocs/install/page_dbsettings.php on lines 306..319
    upgrade/upd-icms-1.0-to-1.1/settings_trust_path.php on lines 19..33

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

    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

        $vars['DB_SALT'] = $icmspass->icms_createSalt();

    Expected 0 spaces before closing bracket; 1 found
    Open

    <?php if (!empty( $error ) ) echo '<div class="x2-note error">' . $error . "</div>\n"; ?>

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

        $label = htmlspecialchars( $label );

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

        $field .= "<input type='text' name='$name' id='$name' value='$value' />";

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

        require_once ICMS_ROOT_PATH.'/class/icms_Password.php' ;

    Expected 1 space after comma in function call; 3 found
    Open

        <?php echo xoFormField( 'DB_SALT',    $vars['DB_SALT'],    DB_SALT_LABEL, 255, DB_SALT_HELP ); ?>

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

        <button type="submit"><?php echo _SUBMIT; ?></button>

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

        $name = htmlspecialchars( $name, ENT_QUOTES );

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

            $field .= '<div class="xoform-help1">' . $help . "</div>\n";

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

        die( 'Bad installation: please add this folder to the ImpressCMS install you want to upgrade');

    Expected 0 spaces between opening bracket and argument "$name"; 1 found
    Open

    function xoFormField( $name, $value, $label, $maxlength, $help = '' )

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

        }

    Space found after opening bracket of FOREACH loop
    Open

        foreach ( $params as $name) {

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

        $maxlength = (int) $maxlength;

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

        $icmspass = new icms_Password();

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

        return $field;

    Expected 0 spaces between argument "$help" and closing bracket; 1 found
    Open

    function xoFormField( $name, $value, $label, $maxlength, $help = '' )

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

        $field = "<label for='$name'>$label</label>\n";

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

        $value = htmlspecialchars( $value, ENT_QUOTES );

    Expected 1 space after comma in function call; 2 found
    Open

        <?php echo xoFormField( 'DB_SALT',    $vars['DB_SALT'],    DB_SALT_LABEL, 255, DB_SALT_HELP ); ?>

    Opening brace should be on the same line as the declaration
    Open

    {

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

        if ($help) {

    Inline control structures are not allowed
    Open

    <?php if (!empty( $error ) ) echo '<div class="x2-note error">' . $error . "</div>\n"; ?>

    Space after opening parenthesis of function call prohibited
    Open

        $value = htmlspecialchars( $value, ENT_QUOTES );

    Space after opening parenthesis of function call prohibited
    Open

        <?php echo xoFormField( 'DB_SALT',    $vars['DB_SALT'],    DB_SALT_LABEL, 255, DB_SALT_HELP ); ?>

    Space after opening parenthesis of function call prohibited
    Open

    <?php if (!empty( $error ) ) echo '<div class="x2-note error">' . $error . "</div>\n"; ?>

    Expected 0 spaces before closing bracket; 1 found
    Open

        <?php echo xoFormField( 'DB_SALT',    $vars['DB_SALT'],    DB_SALT_LABEL, 255, DB_SALT_HELP ); ?>

    Expected 0 spaces after opening bracket; 1 found
    Open

        foreach ( $params as $name) {

    Expected 0 spaces before closing bracket; 1 found
    Open

        $name = htmlspecialchars( $name, ENT_QUOTES );

    Expected 0 spaces before closing bracket; 1 found
    Open

    <?php if (!empty( $error ) ) echo '<div class="x2-note error">' . $error . "</div>\n"; ?>

    Expected 0 spaces before closing bracket; 1 found
    Open

        $label = htmlspecialchars( $label );

    Space after opening parenthesis of function call prohibited
    Open

        die( 'Bad installation: please add this folder to the ImpressCMS install you want to upgrade');

    Expected 0 spaces before closing bracket; 1 found
    Open

        $value = htmlspecialchars( $value, ENT_QUOTES );

    Expected 1 space after closing parenthesis; found 1
    Open

    if (!isset($vars['DB_SALT']))

    Space after opening parenthesis of function call prohibited
    Open

        $name = htmlspecialchars( $name, ENT_QUOTES );

    Space after opening parenthesis of function call prohibited
    Open

        $label = htmlspecialchars( $label );

    Expected 0 spaces before closing bracket; 1 found
    Open

    if (!defined( 'ICMS_ROOT_PATH' )) {

    Space after opening parenthesis of function call prohibited
    Open

    if (!defined( 'ICMS_ROOT_PATH' )) {

    Unexpected spaces found.
    Open

        return $field;

    Unexpected spaces found.
    Open

        $vars['DB_SALT'] = $icmspass->icms_createSalt();

    Unexpected spaces found.
    Open

        die( 'Bad installation: please add this folder to the ImpressCMS install you want to upgrade');

    Unexpected spaces found.
    Open

        $maxlength = (int) $maxlength;

    Unexpected spaces found.
    Open

        $field .= "<input type='text' name='$name' id='$name' value='$value' />";

    Unexpected spaces found.
    Open

        $icmspass = new icms_Password();

    Unexpected spaces found.
    Open

            $field .= '<div class="xoform-help1">' . $help . "</div>\n";

    Unexpected spaces found.
    Open

        require_once ICMS_ROOT_PATH.'/class/icms_Password.php' ;

    Unexpected spaces found.
    Open

        <button type="submit"><?php echo _SUBMIT; ?></button>

    Unexpected spaces found.
    Open

        $label = htmlspecialchars( $label );

    Unexpected spaces found.
    Open

        $field = "<label for='$name'>$label</label>\n";

    Unexpected spaces found.
    Open

        if ($help) {

    Unexpected spaces found.
    Open

        $name = htmlspecialchars( $name, ENT_QUOTES );

    Unexpected spaces found.
    Open

        $value = htmlspecialchars( $value, ENT_QUOTES );

    Unexpected spaces found.
    Open

        }

    There are no issues that match your filters.

    Category
    Status