mambax7/adslight

View on GitHub
report-abuse.php

Summary

Maintainability
B
5 hrs
Test Coverage

reportAbuse accesses the super-global variable $GLOBALS.
Open

function reportAbuse($lid): void
{
    global $xoopsConfig, $xoopsDB, $xoopsTheme;
    $helper = Helper::getInstance();
    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
Severity: Minor
Found in report-abuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

mailAd accesses the super-global variable $GLOBALS.
Open

function mailAd($lid, $yname, $ymail, $fname, $fmail): void
{
    global $xoopsConfig, $xoopsTpl, $xoopsDB, $xoopsModule, $myts;
    $helper = Helper::getInstance();
    if ('1' === $helper->getConfig('adslight_use_captcha')) {
Severity: Minor
Found in report-abuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

reportAbuse accesses the super-global variable $GLOBALS.
Open

function reportAbuse($lid): void
{
    global $xoopsConfig, $xoopsDB, $xoopsTheme;
    $helper = Helper::getInstance();
    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
Severity: Minor
Found in report-abuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

reportAbuse accesses the super-global variable $GLOBALS.
Open

function reportAbuse($lid): void
{
    global $xoopsConfig, $xoopsDB, $xoopsTheme;
    $helper = Helper::getInstance();
    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
Severity: Minor
Found in report-abuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

reportAbuse accesses the super-global variable $GLOBALS.
Open

function reportAbuse($lid): void
{
    global $xoopsConfig, $xoopsDB, $xoopsTheme;
    $helper = Helper::getInstance();
    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
Severity: Minor
Found in report-abuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

mailAd accesses the super-global variable $GLOBALS.
Open

function mailAd($lid, $yname, $ymail, $fname, $fmail): void
{
    global $xoopsConfig, $xoopsTpl, $xoopsDB, $xoopsModule, $myts;
    $helper = Helper::getInstance();
    if ('1' === $helper->getConfig('adslight_use_captcha')) {
Severity: Minor
Found in report-abuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

mailAd accesses the super-global variable $GLOBALS.
Open

function mailAd($lid, $yname, $ymail, $fname, $fmail): void
{
    global $xoopsConfig, $xoopsTpl, $xoopsDB, $xoopsModule, $myts;
    $helper = Helper::getInstance();
    if ('1' === $helper->getConfig('adslight_use_captcha')) {
Severity: Minor
Found in report-abuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

mailAd accesses the super-global variable $GLOBALS.
Open

function mailAd($lid, $yname, $ymail, $fname, $fmail): void
{
    global $xoopsConfig, $xoopsTpl, $xoopsDB, $xoopsModule, $myts;
    $helper = Helper::getInstance();
    if ('1' === $helper->getConfig('adslight_use_captcha')) {
Severity: Minor
Found in report-abuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

mailAd accesses the super-global variable $GLOBALS.
Open

function mailAd($lid, $yname, $ymail, $fname, $fmail): void
{
    global $xoopsConfig, $xoopsTpl, $xoopsDB, $xoopsModule, $myts;
    $helper = Helper::getInstance();
    if ('1' === $helper->getConfig('adslight_use_captcha')) {
Severity: Minor
Found in report-abuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

mailAd accesses the super-global variable $GLOBALS.
Open

function mailAd($lid, $yname, $ymail, $fname, $fmail): void
{
    global $xoopsConfig, $xoopsTpl, $xoopsDB, $xoopsModule, $myts;
    $helper = Helper::getInstance();
    if ('1' === $helper->getConfig('adslight_use_captcha')) {
Severity: Minor
Found in report-abuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

mailAd accesses the super-global variable $GLOBALS.
Open

function mailAd($lid, $yname, $ymail, $fname, $fmail): void
{
    global $xoopsConfig, $xoopsTpl, $xoopsDB, $xoopsModule, $myts;
    $helper = Helper::getInstance();
    if ('1' === $helper->getConfig('adslight_use_captcha')) {
Severity: Minor
Found in report-abuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

mailAd accesses the super-global variable $GLOBALS.
Open

function mailAd($lid, $yname, $ymail, $fname, $fmail): void
{
    global $xoopsConfig, $xoopsTpl, $xoopsDB, $xoopsModule, $myts;
    $helper = Helper::getInstance();
    if ('1' === $helper->getConfig('adslight_use_captcha')) {
Severity: Minor
Found in report-abuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

mailAd accesses the super-global variable $GLOBALS.
Open

function mailAd($lid, $yname, $ymail, $fname, $fmail): void
{
    global $xoopsConfig, $xoopsTpl, $xoopsDB, $xoopsModule, $myts;
    $helper = Helper::getInstance();
    if ('1' === $helper->getConfig('adslight_use_captcha')) {
Severity: Minor
Found in report-abuse.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Method mailAd has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function mailAd($lid, $yname, $ymail, $fname, $fmail): void
{
    global $xoopsConfig, $xoopsTpl, $xoopsDB, $xoopsModule, $myts;
    $helper = Helper::getInstance();
    if ('1' === $helper->getConfig('adslight_use_captcha')) {
Severity: Major
Found in report-abuse.php - About 2 hrs to fix

    Method reportAbuse has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function reportAbuse($lid): void
    {
        global $xoopsConfig, $xoopsDB, $xoopsTheme;
        $helper = Helper::getInstance();
        require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    Severity: Minor
    Found in report-abuse.php - About 1 hr to fix

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

      function mailAd($lid, $yname, $ymail, $fname, $fmail): void
      Severity: Minor
      Found in report-abuse.php - About 35 mins to fix

        Missing class import via use statement (line '82', column '28').
        Open

                $jlm_captcha = new \XoopsFormCaptcha(_ADSLIGHT_CAPTCHA, 'xoopscaptcha', false);
        Severity: Minor
        Found in report-abuse.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

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

        Avoid using static access to class '\XoopsModules\Adslight\Utility' in method 'mailAd'.
        Open

            $tags['TYPE']               = Utility::getNameType($type);
        Severity: Minor
        Found in report-abuse.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 '\XoopsModules\Adslight\Helper' in method 'mailAd'.
        Open

            $helper = Helper::getInstance();
        Severity: Minor
        Found in report-abuse.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 reportAbuse uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

            } else {
                $iddee = $xoopsConfig['adminmail'];
            }
        Severity: Minor
        Found in report-abuse.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 'XoopsCaptcha' in method 'mailAd'.
        Open

                $xoopsCaptcha = XoopsCaptcha::getInstance();
        Severity: Minor
        Found in report-abuse.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 '\XoopsModules\Adslight\Helper' in method 'reportAbuse'.
        Open

            $helper = Helper::getInstance();
        Severity: Minor
        Found in report-abuse.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 '$date_created'.
        Open

            [$lid, $title, $expire, $type, $desctext, $tel, $price, $typeprice, $date_created, $email, $submitter, $town, $country, $photo] = $xoopsDB->fetchRow($result);
        Severity: Minor
        Found in report-abuse.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 '$photo'.
        Open

            [$lid, $title, $expire, $type, $desctext, $tel, $price, $typeprice, $date_created, $email, $submitter, $town, $country, $photo] = $xoopsDB->fetchRow($result);
        Severity: Minor
        Found in report-abuse.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 '$xoopsTpl'.
        Open

            global $xoopsConfig, $xoopsTpl, $xoopsDB, $xoopsModule, $myts;
        Severity: Minor
        Found in report-abuse.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 '$xoopsTheme'.
        Open

            global $xoopsConfig, $xoopsDB, $xoopsTheme;
        Severity: Minor
        Found in report-abuse.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 '$email'.
        Open

            [$lid, $title, $expire, $type, $desctext, $tel, $price, $typeprice, $date_created, $email, $submitter, $town, $country, $photo] = $xoopsDB->fetchRow($result);
        Severity: Minor
        Found in report-abuse.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

        A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 35 and the first side effect is on line 29.
        Open

        <?php declare(strict_types=1);
        Severity: Minor
        Found in report-abuse.php by phpcodesniffer

        There must be one blank line after the last USE statement; 0 found;
        Open

        use XoopsModules\Adslight\{
        Severity: Minor
        Found in report-abuse.php by phpcodesniffer

        There must be one USE keyword per declaration
        Open

        use XoopsModules\Adslight\{
        Severity: Minor
        Found in report-abuse.php by phpcodesniffer

        Line exceeds 120 characters; contains 162 characters
        Open

            [$lid, $title, $expire, $type, $desctext, $tel, $price, $typeprice, $date_created, $email, $submitter, $town, $country, $photo] = $xoopsDB->fetchRow($result);
        Severity: Minor
        Found in report-abuse.php by phpcodesniffer

        Line exceeds 120 characters; contains 160 characters
        Open

            $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/');
        Severity: Minor
        Found in report-abuse.php by phpcodesniffer

        Line exceeds 120 characters; contains 221 characters
        Open

            $sql    = 'SELECT lid, title, expire, type, desctext, tel, price, typeprice, date_created, email, submitter, town, country, photo FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE lid=' . $xoopsDB->escape($lid);
        Severity: Minor
        Found in report-abuse.php by phpcodesniffer

        Line exceeds 120 characters; contains 126 characters
        Open

            $sql    = 'SELECT lid, title, type FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE lid=' . $xoopsDB->escape($lid);
        Severity: Minor
        Found in report-abuse.php by phpcodesniffer

        The variable $jlm_captcha is not named in camelCase.
        Open

        function reportAbuse($lid): void
        {
            global $xoopsConfig, $xoopsDB, $xoopsTheme;
            $helper = Helper::getInstance();
            require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
        Severity: Minor
        Found in report-abuse.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 $date_created is not named in camelCase.
        Open

        function mailAd($lid, $yname, $ymail, $fname, $fmail): void
        {
            global $xoopsConfig, $xoopsTpl, $xoopsDB, $xoopsModule, $myts;
            $helper = Helper::getInstance();
            if ('1' === $helper->getConfig('adslight_use_captcha')) {
        Severity: Minor
        Found in report-abuse.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 $jlm_captcha is not named in camelCase.
        Open

        function reportAbuse($lid): void
        {
            global $xoopsConfig, $xoopsDB, $xoopsTheme;
            $helper = Helper::getInstance();
            require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
        Severity: Minor
        Found in report-abuse.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