XoopsModules25x/xfguestbook

View on GitHub

Showing 1,027 of 1,027 total issues

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

        } else {
            $all_country['flag_img'] = "<img src='" . XOOPS_URL . "/images/blank.gif'>";
        }
Severity: Minor
Found in admin/country_manager.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 unused local variables such as '$result'.
Open

            if (!$result = $xoopsDB->query($sql)) {
Severity: Minor
Found in admin/ip_manager.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$country_id'.
Open

            $country_id = $xoopsDB->genId('ip_id_seq');
Severity: Minor
Found in admin/ip_manager.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid using static access to class '\XoopsModules\Xfguestbook\Utility' in method 'countryDel'.
Open

        $arr_country = Xfguestbook\Utility::getCountry('country_id=' . $country_id, 0, 0);
Severity: Minor
Found in admin/country_manager.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

Avoid unused local variables such as '$limit'.
Open

    $limit     = 15;
Severity: Minor
Found in admin/ip_manager.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$myts'.
Open

    $myts = \MyTextSanitizer::getInstance();
Severity: Minor
Found in admin/country_manager.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$myts'.
Open

    $myts        = \MyTextSanitizer::getInstance();
Severity: Minor
Found in admin/country_manager.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid using static access to class '\XoopsModules\Xfguestbook\Utility' in method 'countryShow'.
Open

    $arr_country = Xfguestbook\Utility::getCountry('', $limit, $start);
Severity: Minor
Found in admin/country_manager.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

Avoid using static access to class '\MyTextSanitizer' in method 'badIpSave'.
Open

    $myts = \MyTextSanitizer::getInstance();
Severity: Minor
Found in admin/ip_manager.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

Avoid unused parameters such as '$ip_id'.
Open

function badIpDel($ip_id)
Severity: Minor
Found in admin/ip_manager.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

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

            } else {
                redirect_header('country_manager.php', 2, $uploader->getErrors());
            }
Severity: Minor
Found in admin/country_manager.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 flagDel uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

    } else {
        xoops_cp_header();
        $adminObject = Admin::getInstance();
        $adminObject->displayNavigation(basename(__FILE__));
        xoops_confirm(['op' => 'flagDel', 'country_code' => $country_code, 'ok' => 1], 'country_manager.php', AM_XFGUESTBOOK_CONFDELFLAG);
Severity: Minor
Found in admin/country_manager.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 using static access to class '\XoopsModules\Xfguestbook\Utility' in method 'countryShow'.
Open

    $scount      = count(Xfguestbook\Utility::getCountry('', $limit, 0));
Severity: Minor
Found in admin/country_manager.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

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

    } else {
        $sform    = new \XoopsThemeForm(AM_XFGUESTBOOK_ADD_BADIP, 'op', xoops_getenv('SCRIPT_NAME'), 'post', true);
        $ip_value = '';
    }
Severity: Minor
Found in admin/ip_manager.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 badIpSave uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $country_id = $xoopsDB->genId('ip_id_seq');
            $sql        = sprintf("INSERT INTO `%s` (ip_id, ip_value) VALUES (%s, '%s')", $xoopsDB->prefix('xfguestbook_badips'), $ip_id, $ip_value);
            $xoopsDB->query($sql);
            $messagesent = AM_XFGUESTBOOK_BADIP_ADDED;
Severity: Minor
Found in admin/ip_manager.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 unused local variables such as '$action'.
Open

    global $action, $start, $xoopsModule, $xoopsModuleConfig;
Severity: Minor
Found in admin/ip_manager.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid using static access to class '\XoopsModules\Xfguestbook\Utility' in method 'countryForm'.
Open

        $arr_country  = Xfguestbook\Utility::getCountry('country_id=' . $country_id, 0, 0);
Severity: Minor
Found in admin/country_manager.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

Avoid using static access to class '\Xmf\Yaml' in method 'loadAdminConfig'.
Open

    $config = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps
Severity: Minor
Found in admin/index.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

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

    } else {
        echo "<tr ><td align='center' colspan ='3' class = 'head'><b>" . AM_XFGUESTBOOK_NOBADIP . '</b></td></tr>';
    }
Severity: Minor
Found in admin/ip_manager.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 countrySave uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

    } else {
        $sql = sprintf("SELECT COUNT(*) FROM  %s WHERE country_code = '%s'", $xoopsDB->prefix('xfguestbook_country'), $country_code);
        [$count] = $xoopsDB->fetchRow($xoopsDB->query($sql));
        if ($count > 0) {
            $messagesent = '<span style="color: #FF0000; ">' . AM_XFGUESTBOOK_COUNTRY_EXIST . '</span>';
Severity: Minor
Found in admin/country_manager.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

Severity
Category
Status
Source
Language