ImpressCMS/impresscms

View on GitHub
htdocs/install/page_dbsettings.php

Summary

Maintainability
D
2 days
Test Coverage

File page_dbsettings.php has 311 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Installer database configuration page
 *
 * See the enclosed file license.txt for licensing information.
Severity: Minor
Found in htdocs/install/page_dbsettings.php - About 3 hrs to fix

    Method xoFormFieldCollation has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function xoFormFieldCollation($name, $value, $label, $link, $charset, $help = '') {
        if (version_compare(getDBVersion($link), "4.1.0", "lt")) {
            return "";
        }
        if (empty ($charset) || !$collations = getDbCollations($link, $charset)) {
    Severity: Minor
    Found in htdocs/install/page_dbsettings.php - About 1 hr to fix

      Method xoFormFieldCharset has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function xoFormFieldCharset($name, $value, $label, $link, $help = '') {
          if (version_compare(getDBVersion($link), "4.1.0", "lt")) {
              return "";
          }
          if (!$chars = getDbCharsets($link)) {
      Severity: Minor
      Found in htdocs/install/page_dbsettings.php - About 1 hr to fix

        Function xoFormFieldCollation has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        function xoFormFieldCollation($name, $value, $label, $link, $charset, $help = '') {
            if (version_compare(getDBVersion($link), "4.1.0", "lt")) {
                return "";
            }
            if (empty ($charset) || !$collations = getDbCollations($link, $charset)) {
        Severity: Minor
        Found in htdocs/install/page_dbsettings.php - About 55 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method xoFormFieldCollation has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function xoFormFieldCollation($name, $value, $label, $link, $charset, $help = '') {
        Severity: Minor
        Found in htdocs/install/page_dbsettings.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                          while ($row = fetch_assoc($result)) {
                              $character_sets[$row["Variable_name"]] = $row["Value"];
                          }
          Severity: Major
          Found in htdocs/install/page_dbsettings.php - About 45 mins to fix

            Method xoFormBlockCollation has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function xoFormBlockCollation($name, $value, $label, $link, $charset, $help = '') {
            Severity: Minor
            Found in htdocs/install/page_dbsettings.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              while ($row = fetch_assoc($result)) {
                                  $collations[$row["Variable_name"]] = $row["Value"];
                              }
              Severity: Major
              Found in htdocs/install/page_dbsettings.php - About 45 mins to fix

                Function getDbCharsets has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                function getDbCharsets($link) {
                    static $charsets = array( );
                    if ($charsets) {
                        return $charsets;
                    }
                Severity: Minor
                Found in htdocs/install/page_dbsettings.php - About 45 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function validateDbCharset has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                function validateDbCharset($link, &$charset, &$collation) {
                    $error = null;
                
                    if (empty ($charset)) {
                        $collation = "";
                Severity: Minor
                Found in htdocs/install/page_dbsettings.php - About 45 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

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

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

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

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

                    The function xoFormFieldCollation() has an NPath complexity of 240. The configured NPath complexity threshold is 200.
                    Open

                    function xoFormFieldCollation($name, $value, $label, $link, $charset, $help = '') {
                        if (version_compare(getDBVersion($link), "4.1.0", "lt")) {
                            return "";
                        }
                        if (empty ($charset) || !$collations = getDbCollations($link, $charset)) {
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    NPathComplexity

                    Since: 0.1

                    The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                    Example

                    class Foo {
                        function bar() {
                            // lots of complicated code
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#npathcomplexity

                    The function xoFormFieldCollation() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                    Open

                    function xoFormFieldCollation($name, $value, $label, $link, $charset, $help = '') {
                        if (version_compare(getDBVersion($link), "4.1.0", "lt")) {
                            return "";
                        }
                        if (empty ($charset) || !$collations = getDbCollations($link, $charset)) {
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    CyclomaticComplexity

                    Since: 0.1

                    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                    Example

                    // Cyclomatic Complexity = 11
                    class Foo {
                    1   public function example() {
                    2       if ($a == $b) {
                    3           if ($a1 == $b1) {
                                    fiddle();
                    4           } elseif ($a2 == $b2) {
                                    fiddle();
                                } else {
                                    fiddle();
                                }
                    5       } elseif ($c == $d) {
                    6           while ($c == $d) {
                                    fiddle();
                                }
                    7        } elseif ($e == $f) {
                    8           for ($n = 0; $n < $h; $n++) {
                                    fiddle();
                                }
                            } else {
                                switch ($z) {
                    9               case 1:
                                        fiddle();
                                        break;
                    10              case 2:
                                        fiddle();
                                        break;
                    11              case 3:
                                        fiddle();
                                        break;
                                    default:
                                        fiddle();
                                        break;
                                }
                            }
                        }
                    }

                    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                    Avoid assigning values to variables in if clauses and the like (line '133', column '6').
                    Open

                    function getDbCollations($link, $charset) {
                        static $collations = array( );
                    
                        if ($result = exec_query("SHOW COLLATION WHERE Charset=" . quote_sql($charset), $link)) {
                            while ($row = fetch_assoc($result)) {
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    IfStatementAssignment

                    Since: 2.7.0

                    Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($foo = 'bar') { // possible typo
                                // ...
                            }
                            if ($baz = 0) { // always false
                                // ...
                            }
                        }
                    }

                    Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                    The method fetch_assoc uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                        } else {
                            return mysql_fetch_assoc($result);
                        }
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    Avoid assigning values to variables in if clauses and the like (line '325', column '7').
                    Open

                    function xoFormFieldCharset($name, $value, $label, $link, $help = '') {
                        if (version_compare(getDBVersion($link), "4.1.0", "lt")) {
                            return "";
                        }
                        if (!$chars = getDbCharsets($link)) {
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    IfStatementAssignment

                    Since: 2.7.0

                    Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($foo = 'bar') { // possible typo
                                // ...
                            }
                            if ($baz = 0) { // always false
                                // ...
                            }
                        }
                    }

                    Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                    The method validateDbCharset uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                        } else {
                            $collations = getDbCollations($link, $charset);
                            if (!isset ($collations [$collation])) {
                                $error = sprintf(ERR_INVALID_DBCOLLATION, $collation);
                            }
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method quote_sql uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                        } else {
                            return '\'' . mysql_real_escape_string($sql) . '\'';
                        }
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    The method exec_query uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                        } else {
                            return mysql_query($sql, $link);
                        }
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    Avoid assigning values to variables in if clauses and the like (line '109', column '6').
                    Open

                    function getDbCharsets($link) {
                        static $charsets = array( );
                        if ($charsets) {
                            return $charsets;
                        }
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    IfStatementAssignment

                    Since: 2.7.0

                    Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($foo = 'bar') { // possible typo
                                // ...
                            }
                            if ($baz = 0) { // always false
                                // ...
                            }
                        }
                    }

                    Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                    Avoid assigning values to variables in if clauses and the like (line '182', column '27').
                    Open

                    function xoFormFieldCollation($name, $value, $label, $link, $charset, $help = '') {
                        if (version_compare(getDBVersion($link), "4.1.0", "lt")) {
                            return "";
                        }
                        if (empty ($charset) || !$collations = getDbCollations($link, $charset)) {
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    IfStatementAssignment

                    Since: 2.7.0

                    Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($foo = 'bar') { // possible typo
                                // ...
                            }
                            if ($baz = 0) { // always false
                                // ...
                            }
                        }
                    }

                    Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                    The method getDBVersion uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                        {
                        echo 'error getting DB version';
                        }
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    ElseExpression

                    Since: 1.4.0

                    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                    Example

                    class Foo
                    {
                        public function bar($flag)
                        {
                            if ($flag) {
                                // one branch
                            } else {
                                // another branch
                            }
                        }
                    }

                    Source https://phpmd.org/rules/cleancode.html#elseexpression

                    syntax error, unexpected ')'
                    Open

                                echo xoFormBlockCollation('DB_COLLATION', $vars ['DB_COLLATION'], DB_COLLATION_LABEL, $link, $vars ['DB_CHARSET'], DB_COLLATION_HELP, );
                    Severity: Critical
                    Found in htdocs/install/page_dbsettings.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_dbsettings.php and 1 other location - About 4 hrs to fix
                    htdocs/install/page_dbconnection.php on lines 49..69

                    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

                    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);
                        $maxlength = (int) ($maxlength);
                    Severity: Major
                    Found in htdocs/install/page_dbsettings.php and 2 other locations - About 2 hrs to fix
                    upgrade/upd-icms-1.0-to-1.1/settings_salt.php on lines 19..33
                    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

                    The parameter $database_name is not named in camelCase.
                    Open

                    function sanitize_database($database_name) {
                        return preg_replace('/[^A-Za-z0-9_]+/', '', $database_name);
                    }
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    The parameter $db_name is not named in camelCase.
                    Open

                    function select_db($db_name, $link) {
                        //if ($link instanceof PDO) {
                            try {
                                $link->exec("use `" . $db_name . '`;');
                                return true;
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    CamelCaseParameterName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name parameters.

                    Example

                    class ClassName {
                        public function doSomething($user_name) {
                        }
                    }

                    Source

                    Blank line found at end of control structure
                    Open

                    
                    

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

                        $block .= xoFormFieldCollation($name, $value, $label,  $link, $charset, $help);

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

                                        ));

                    Space before opening parenthesis of function call prohibited
                    Open

                            $field .= "<option value='{$collation_default}'" . (($value == $collation_default || empty ($value))?" 'selected'":"") . ">{$collation_default} (Default)</option>";

                    Space before opening parenthesis of function call prohibited
                    Open

                        exit ();

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

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

                    Space before opening parenthesis of function call prohibited
                    Open

                        if (empty ($charset) && empty ($collation)) {

                    Expected 1 space after closing brace; newline found
                    Open

                        }

                    Space before opening parenthesis of function call prohibited
                    Open

                    if ($_SERVER ['REQUEST_METHOD'] == 'GET' && isset ($_GET ['charset']) && @$_GET ['action'] == 'updateCollation') {

                    Space before opening parenthesis of function call prohibited
                    Open

                    if ($_SERVER ['REQUEST_METHOD'] == 'POST' && !empty ($vars ['DB_NAME'])) {

                    Space after opening parenthesis of function call prohibited
                    Open

                                $result = exec_query("CREATE DATABASE " . sanitize_database( $vars ['DB_NAME'] ), $link);

                    Space before opening parenthesis of function call prohibited
                    Open

                            unset ($chars ["utf8"]);

                    Space before opening parenthesis of function call prohibited
                    Open

                        if (empty ($charset) && empty ($collation)) {

                    Line indented incorrectly; expected 1 tabs, found 2
                    Open

                            try {

                    Space after opening parenthesis of function call prohibited
                    Open

                                $sql = "ALTER DATABASE " . sanitize_database( $vars ['DB_NAME']) . " DEFAULT CHARACTER SET " . quote_sql($vars ['DB_CHARSET']) . ($vars ['DB_COLLATION']?" COLLATE " . quote_sql($vars ['DB_COLLATION']):"");

                    Space before opening parenthesis of function call prohibited
                    Open

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

                    Line indented incorrectly; expected at least 2 tabs, found 1
                    Open

                        echo 'error getting DB version';

                    No space found after comma in function call
                    Open

                        echo xoFormFieldCollation('DB_COLLATION', $vars ['DB_COLLATION'], DB_COLLATION_LABEL, $link, $_GET ['charset'],DB_COLLATION_HELP);

                    Line indented incorrectly; expected 1 tabs, found 2
                    Open

                            } catch (PDOException $ex) {

                    Line indented incorrectly; expected 1 tabs, found 2
                    Open

                            }

                    Space before opening parenthesis of function call prohibited
                    Open

                        if (empty ($charset)) {

                    Space before opening parenthesis of function call prohibited
                    Open

                    if (@empty ($vars ['DB_NAME'])) {

                    Space before opening parenthesis of function call prohibited
                    Open

                        if (isset ($chars ["utf8"])) {

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

                                        $vars['DB_PASS'],

                    Space before opening parenthesis of function call prohibited
                    Open

                            unset ($charsets ["utf8"]);

                    Space before opening parenthesis of function call prohibited
                    Open

                        if (!isset ($charsets [$charset])) {

                    Space before opening parenthesis of function call prohibited
                    Open

                            exit ();

                    Space before opening parenthesis of function call prohibited
                    Open

                        if (empty ($charset) || !$collations = getDbCollations($link, $charset)) {

                    Expected 0 spaces before closing bracket; 1 found
                    Open

                                $result = exec_query("CREATE DATABASE " . sanitize_database( $vars ['DB_NAME'] ), $link);

                    Expected 1 space after ELSE keyword; newline found
                    Open

                        else

                    Space before opening parenthesis of function call prohibited
                    Open

                        if (empty ($error)) {

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

                                        ));

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

                                        array(

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

                                        $vars['DB_USER'],

                    Space before opening parenthesis of function call prohibited
                    Open

                        exit ();

                    Space before opening parenthesis of function call prohibited
                    Open

                            if (!isset ($collations [$collation])) {

                    Space before opening parenthesis of function call prohibited
                    Open

                        exit ();

                    Space before opening parenthesis of function call prohibited
                    Open

                    if (!empty ($error)) {

                    Space before opening parenthesis of function call prohibited
                    Open

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

                    Space before opening parenthesis of function call prohibited
                    Open

                        if (empty ($error)) {

                    Expected 0 spaces before closing bracket; 1 found
                    Open

                                echo xoFormBlockCollation('DB_COLLATION', $vars ['DB_COLLATION'], DB_COLLATION_LABEL, $link, $vars ['DB_CHARSET'], DB_COLLATION_HELP, );

                    The variable $collation_default is not named in camelCase.
                    Open

                    function xoFormFieldCollation($name, $value, $label, $link, $charset, $help = '') {
                        if (version_compare(getDBVersion($link), "4.1.0", "lt")) {
                            return "";
                        }
                        if (empty ($charset) || !$collations = getDbCollations($link, $charset)) {
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    CamelCaseVariableName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name variables.

                    Example

                    class ClassName {
                        public function doSomething() {
                            $data_module = new DataModule();
                        }
                    }

                    Source

                    The variable $collation_default is not named in camelCase.
                    Open

                    function xoFormFieldCollation($name, $value, $label, $link, $charset, $help = '') {
                        if (version_compare(getDBVersion($link), "4.1.0", "lt")) {
                            return "";
                        }
                        if (empty ($charset) || !$collations = getDbCollations($link, $charset)) {
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    CamelCaseVariableName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name variables.

                    Example

                    class ClassName {
                        public function doSomething() {
                            $data_module = new DataModule();
                        }
                    }

                    Source

                    The variable $ut8_available is not named in camelCase.
                    Open

                    function getDbCharsets($link) {
                        static $charsets = array( );
                        if ($charsets) {
                            return $charsets;
                        }
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    CamelCaseVariableName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name variables.

                    Example

                    class ClassName {
                        public function doSomething() {
                            $data_module = new DataModule();
                        }
                    }

                    Source

                    The variable $collation_default is not named in camelCase.
                    Open

                    function xoFormFieldCollation($name, $value, $label, $link, $charset, $help = '') {
                        if (version_compare(getDBVersion($link), "4.1.0", "lt")) {
                            return "";
                        }
                        if (empty ($charset) || !$collations = getDbCollations($link, $charset)) {
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    CamelCaseVariableName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name variables.

                    Example

                    class ClassName {
                        public function doSomething() {
                            $data_module = new DataModule();
                        }
                    }

                    Source

                    The variable $db_name is not named in camelCase.
                    Open

                    function select_db($db_name, $link) {
                        //if ($link instanceof PDO) {
                            try {
                                $link->exec("use `" . $db_name . '`;');
                                return true;
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    CamelCaseVariableName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name variables.

                    Example

                    class ClassName {
                        public function doSomething() {
                            $data_module = new DataModule();
                        }
                    }

                    Source

                    The variable $collation_default is not named in camelCase.
                    Open

                    function xoFormFieldCollation($name, $value, $label, $link, $charset, $help = '') {
                        if (version_compare(getDBVersion($link), "4.1.0", "lt")) {
                            return "";
                        }
                        if (empty ($charset) || !$collations = getDbCollations($link, $charset)) {
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    CamelCaseVariableName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name variables.

                    Example

                    class ClassName {
                        public function doSomething() {
                            $data_module = new DataModule();
                        }
                    }

                    Source

                    The variable $ut8_available is not named in camelCase.
                    Open

                    function getDbCharsets($link) {
                        static $charsets = array( );
                        if ($charsets) {
                            return $charsets;
                        }
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    CamelCaseVariableName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name variables.

                    Example

                    class ClassName {
                        public function doSomething() {
                            $data_module = new DataModule();
                        }
                    }

                    Source

                    The variable $ut8_available is not named in camelCase.
                    Open

                    function getDbCharsets($link) {
                        static $charsets = array( );
                        if ($charsets) {
                            return $charsets;
                        }
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    CamelCaseVariableName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name variables.

                    Example

                    class ClassName {
                        public function doSomething() {
                            $data_module = new DataModule();
                        }
                    }

                    Source

                    The variable $collation_default is not named in camelCase.
                    Open

                    function xoFormFieldCollation($name, $value, $label, $link, $charset, $help = '') {
                        if (version_compare(getDBVersion($link), "4.1.0", "lt")) {
                            return "";
                        }
                        if (empty ($charset) || !$collations = getDbCollations($link, $charset)) {
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    CamelCaseVariableName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name variables.

                    Example

                    class ClassName {
                        public function doSomething() {
                            $data_module = new DataModule();
                        }
                    }

                    Source

                    The variable $database_name is not named in camelCase.
                    Open

                    function sanitize_database($database_name) {
                        return preg_replace('/[^A-Za-z0-9_]+/', '', $database_name);
                    }
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    CamelCaseVariableName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name variables.

                    Example

                    class ClassName {
                        public function doSomething() {
                            $data_module = new DataModule();
                        }
                    }

                    Source

                    The variable $collation_default is not named in camelCase.
                    Open

                    function xoFormFieldCollation($name, $value, $label, $link, $charset, $help = '') {
                        if (version_compare(getDBVersion($link), "4.1.0", "lt")) {
                            return "";
                        }
                        if (empty ($charset) || !$collations = getDbCollations($link, $charset)) {
                    Severity: Minor
                    Found in htdocs/install/page_dbsettings.php by phpmd

                    CamelCaseVariableName

                    Since: 0.2

                    It is considered best practice to use the camelCase notation to name variables.

                    Example

                    class ClassName {
                        public function doSomething() {
                            $data_module = new DataModule();
                        }
                    }

                    Source

                    There are no issues that match your filters.

                    Category
                    Status