ImpressCMS/impresscms

View on GitHub
htdocs/install/page_dbconnection.php

Summary

Maintainability
B
5 hrs
Test Coverage

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

function xoFormField( $name, $value, $label, $help = '', $type='text') {
Severity: Minor
Found in htdocs/install/page_dbconnection.php - About 35 mins to fix

    Call to undeclared function mysql_connect in callable
    Open

                if (!($link = @$func_connect($vars['DB_HOST'], $vars['DB_USER'], $vars['DB_PASS'], true))) {
    Severity: Minor
    Found in htdocs/install/page_dbconnection.php by phan

    Call to undeclared function mysql_pconnect in callable
    Open

                if (!($link = @$func_connect($vars['DB_HOST'], $vars['DB_USER'], $vars['DB_PASS'], true))) {
    Severity: Minor
    Found in htdocs/install/page_dbconnection.php by phan

    Variable $wizard is undeclared
    Open

            $wizard->redirectToPage('+1');
    Severity: Minor
    Found in htdocs/install/page_dbconnection.php by phan

    Variable $wizard is undeclared
    Open

    $wizard->setPage( 'dbconnection' );
    Severity: Minor
    Found in htdocs/install/page_dbconnection.php by phan

    Function xoFormField defined at /code/htdocs/install/page_dbconnection.php:104 was previously defined at /code/upgrade/upd-icms-1.0-to-1.1/settings_salt.php:19
    Open

    function xoFormField( $name, $value, $label, $help = '', $type='text') {
    Severity: Minor
    Found in htdocs/install/page_dbconnection.php by phan

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

        switch ($vars['DB_TYPE']) {
            case 'mysql':
                $func_connect = empty($vars['DB_PCONNECT'])?"mysql_connect":"mysql_pconnect";
                if (!($link = @$func_connect($vars['DB_HOST'], $vars['DB_USER'], $vars['DB_PASS'], true))) {
                    $error = ERR_NO_DBCONNECTION;
    Severity: Major
    Found in htdocs/install/page_dbconnection.php and 1 other location - About 4 hrs to fix
    htdocs/install/page_dbsettings.php on lines 31..51

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

    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

    Space found after opening bracket of FOREACH loop
    Open

        foreach ( $keys as $k) {

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

            <div class="dbconn_line"><?php echo xoFormField( 'DB_HOST',    $vars['DB_HOST'],        DB_HOST_LABEL, DB_HOST_HELP ); ?>

    Blank line found at end of control structure
    Open

    
    

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

            <div class="dbconn_line"><?php echo xoFormField( 'DB_HOST',    $vars['DB_HOST'],        DB_HOST_LABEL, DB_HOST_HELP ); ?>

    Expected 0 spaces before closing bracket; 1 found
    Open

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

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

            <div class="dbconn_line"><?php echo xoFormField( 'DB_USER',    $vars['DB_USER'],        DB_USER_LABEL, DB_USER_HELP ); ?>

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

            <div class="dbconn_line"><?php echo xoFormField( 'DB_PASS',    $vars['DB_PASS'],        DB_PASS_LABEL, DB_PASS_HELP, 'password' ); ?>

    Space found after opening bracket of FOREACH loop
    Open

        foreach ( $params as $name) {

    Expected 0 spaces before closing bracket; 1 found
    Open

    if (!defined( 'XOOPS_INSTALL' ) )    exit();

    Incorrect spacing between default value and equals sign for argument "$type"; expected 1 but found 0
    Open

    function xoFormField( $name, $value, $label, $help = '', $type='text') {

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

    function xoFormField( $name, $value, $label, $help = '', $type='text') {

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

            <div class="dbconn_line"><?php echo xoFormField( 'DB_USER',    $vars['DB_USER'],        DB_USER_LABEL, DB_USER_HELP ); ?>

    Incorrect spacing between argument "$type" and equals sign; expected 1 but found 0
    Open

    function xoFormField( $name, $value, $label, $help = '', $type='text') {

    Inline control structures are not allowed
    Open

    if (!defined( 'XOOPS_INSTALL' ) )    exit();

    Inline control structures are not allowed
    Open

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

    Inline control structures are not allowed
    Open

                            if (!empty($option['selected'])) $selected = " selected='selected'";

    Expected 0 spaces before closing bracket; 1 found
    Open

    if (!isset( $vars['DB_HOST'] ) || false !== @strpos( $_SERVER['HTTP_CACHE_CONTROL'], 'max-age=0' )) {

    Multi-line function call not indented correctly; expected 16 spaces but found 20
    Open

                        ));

    Closing parenthesis of a multi-line function call must be on a line by itself
    Open

                        ));

    Space after opening parenthesis of function call prohibited
    Open

            <div class="dbconn_line"><?php echo xoFormField( 'DB_PASS',    $vars['DB_PASS'],        DB_PASS_LABEL, DB_PASS_HELP, 'password' ); ?>

    Space after opening parenthesis of function call prohibited
    Open

        <label> <?php echo htmlspecialchars( DB_PCONNECT_LABEL ); ?> <input

    Space after opening parenthesis of function call prohibited
    Open

    $wizard->setPage( 'dbconnection' );

    Expected 0 spaces before closing bracket; 1 found
    Open

        <label> <?php echo htmlspecialchars( DB_PCONNECT_LABEL ); ?> <input

    Space after opening parenthesis of function call prohibited
    Open

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

    Space after opening parenthesis of function call prohibited
    Open

            <div class="dbconn_line"><?php echo xoFormField( 'DB_HOST',    $vars['DB_HOST'],        DB_HOST_LABEL, DB_HOST_HELP ); ?>

    Space after opening parenthesis of function call prohibited
    Open

    if (!isset( $vars['DB_HOST'] ) || false !== @strpos( $_SERVER['HTTP_CACHE_CONTROL'], 'max-age=0' )) {

    Space after opening parenthesis of function call prohibited
    Open

    if (!defined( 'XOOPS_INSTALL' ) )    exit();

    Expected 0 spaces after opening bracket; 1 found
    Open

        foreach ( $keys as $k) {

    Space after opening parenthesis of function call prohibited
    Open

            $vars[ $k ] = defined( "XOOPS_$k" ) ? constant( "XOOPS_$k" ) : '';

    Opening parenthesis of a multi-line function call must be the last content on the line
    Open

                    $dbh = new PDO('mysql:host=' . $vars['DB_HOST'],

    Expected 0 spaces before closing bracket; 1 found
    Open

        $value = htmlspecialchars( $value, 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

    if (!isset( $vars['DB_HOST'] ) || false !== @strpos( $_SERVER['HTTP_CACHE_CONTROL'], 'max-age=0' )) {

    Expected 0 spaces before closing bracket; 1 found
    Open

            $vars[ $k ] = defined( "XOOPS_$k" ) ? constant( "XOOPS_$k" ) : '';

    Expected 0 spaces before closing bracket; 1 found
    Open

            <div class="dbconn_line"><?php echo xoFormField( 'DB_HOST',    $vars['DB_HOST'],        DB_HOST_LABEL, DB_HOST_HELP ); ?>

    Expected 0 spaces before closing bracket; 1 found
    Open

            <div class="dbconn_line"><?php echo xoFormField( 'DB_PASS',    $vars['DB_PASS'],        DB_PASS_LABEL, DB_PASS_HELP, 'password' ); ?>

    Expected 0 spaces before closing bracket; 1 found
    Open

    if (!defined( 'XOOPS_INSTALL' ) )    exit();

    Expected 0 spaces after opening bracket; 1 found
    Open

        foreach ( $params as $name) {

    Expected 0 spaces before closing bracket; 1 found
    Open

                onclick="alert('<?php echo htmlspecialchars( DB_PCONNECT_HELPS ); ?>');"

    Expected 0 spaces before closing bracket; 1 found
    Open

    $wizard->setPage( 'dbconnection' );

    Expected 0 spaces before closing bracket; 1 found
    Open

            <div class="dbconn_line"><?php echo xoFormField( 'DB_USER',    $vars['DB_USER'],        DB_USER_LABEL, DB_USER_HELP ); ?>

    Expected 0 spaces before closing bracket; 1 found
    Open

            <div class="xoform-help"><?php echo htmlspecialchars( DB_PCONNECT_HELP ); ?></div>

    Space after opening parenthesis of function call prohibited
    Open

            $vars[ $k ] = defined( "XOOPS_$k" ) ? constant( "XOOPS_$k" ) : '';

    Space after opening parenthesis of function call prohibited
    Open

        $label = htmlspecialchars( $label );

    Expected 0 spaces before closing bracket; 1 found
    Open

        $name = htmlspecialchars( $name, ENT_QUOTES );

    Space after opening parenthesis of function call prohibited
    Open

        $value = htmlspecialchars( $value, ENT_QUOTES );

    Space after opening parenthesis of function call prohibited
    Open

    if (!isset( $vars['DB_HOST'] ) || false !== @strpos( $_SERVER['HTTP_CACHE_CONTROL'], 'max-age=0' )) {

    Expected 0 spaces before closing bracket; 1 found
    Open

            $vars[ $k ] = defined( "XOOPS_$k" ) ? constant( "XOOPS_$k" ) : '';

    Expected 0 spaces before closing bracket; 1 found
    Open

        $label = htmlspecialchars( $label );

    Space after opening parenthesis of function call prohibited
    Open

        $name = htmlspecialchars( $name, ENT_QUOTES );

    Space after opening parenthesis of function call prohibited
    Open

            <div class="dbconn_line"><?php echo xoFormField( 'DB_USER',    $vars['DB_USER'],        DB_USER_LABEL, DB_USER_HELP ); ?>

    Space after opening parenthesis of function call prohibited
    Open

                onclick="alert('<?php echo htmlspecialchars( DB_PCONNECT_HELPS ); ?>');"

    Space after opening parenthesis of function call prohibited
    Open

            <div class="xoform-help"><?php echo htmlspecialchars( DB_PCONNECT_HELP ); ?></div>

    There are no issues that match your filters.

    Category
    Status