XoopsModules25x/xfguestbook

View on GitHub

Showing 1,027 of 1,027 total issues

Avoid using undefined variables such as '$a_poster' which will lead to PHP notices.
Open

                $rank['title'] ? $a_poster['rank'] = $rank['title'] : $a_poster['rank'] = '';
Severity: Minor
Found in class/Utility.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$uname' which will lead to PHP notices.
Open

                      . $this->db->quoteString($uname)
Severity: Minor
Found in class/MessageHandler.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$url' which will lead to PHP notices.
Open

                      . $this->db->quoteString($url)
Severity: Minor
Found in class/MessageHandler.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$uname' which will lead to PHP notices.
Open

                   . $this->db->quoteString($uname)
Severity: Minor
Found in class/MessageHandler.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$email' which will lead to PHP notices.
Open

                   . $this->db->quoteString($email)
Severity: Minor
Found in class/MessageHandler.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$moderate' which will lead to PHP notices.
Open

                   . $moderate
Severity: Minor
Found in class/MessageHandler.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$other' which will lead to PHP notices.
Open

                   . $this->db->quoteString($other)
Severity: Minor
Found in class/MessageHandler.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$a_poster' which will lead to PHP notices.
Open

            return $a_poster;
Severity: Minor
Found in class/Utility.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$user_id' which will lead to PHP notices.
Open

                   . $user_id
Severity: Minor
Found in class/MessageHandler.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

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

    public static function getServerStats()
    {
        //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
        $moduleDirName      = \basename(dirname(__DIR__, 2));
        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
Severity: Minor
Found in class/Common/ServerStats.php - About 1 hr to fix

    Function xoops_module_install_xfguestbook has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    function xoops_module_install_xfguestbook(\XoopsModule $module)
    {
        require_once dirname(__DIR__) . '/preloads/autoloader.php';
    
        $moduleDirName = basename(dirname(__DIR__));
    Severity: Minor
    Found in include/oninstall.php - About 1 hr 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 rmdirr has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    function rmdirr($dirname)
    {
        // Simple delete for a file
        if (is_file($dirname)) {
            return unlink($dirname);
    Severity: Minor
    Found in include/onuninstall.php - About 1 hr 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 loadSampleData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function loadSampleData()
    {
        global $xoopsConfig;
        $moduleDirName      = basename(dirname(__DIR__));
        $moduleDirNameUpper = mb_strtoupper($moduleDirName);
    Severity: Minor
    Found in testdata/index.php - About 1 hr to fix

      Method upload has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function upload()
          {
              global $xoopsModule, $preview_name, $msgstop;
              /** @var Helper $helper */
              $helper = Helper::getInstance();
      Severity: Minor
      Found in class/Utility.php - About 1 hr to fix

        Method xfguestbook_search has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function xfguestbook_search($queryarray, $andor, $limit, $offset, $user_id)
        {
            global $xoopsDB;
            $sql = 'SELECT msg_id,user_id,title,post_time FROM ' . $xoopsDB->prefix('xfguestbook_msg') . ' WHERE moderate=0 ';
            if (0 != $user_id) {
        Severity: Minor
        Found in include/search.inc.php - About 1 hr to fix

          Each class must be in a namespace of at least one level (a top-level vendor name)
          Open

          class XfguestbookCorePreload extends \XoopsPreloadItem
          Severity: Minor
          Found in preloads/core.php by phpcodesniffer

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

              public static function recurseCopy($src, $dst)
              {
                  $dir = \opendir($src);
                  //        @mkdir($dst);
                  if (!@\mkdir($dst) && !\is_dir($dst)) {
          Severity: Minor
          Found in class/Common/FilesManagement.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

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

              public static function rmove($src, $dest)
              {
                  // Only continue if user is a 'global' Admin
                  if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                      return false;
          Severity: Minor
          Found in class/Common/FilesManagement.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

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

              public static function rcopy($src, $dest)
              {
                  // Only continue if user is a 'global' Admin
                  if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                      return false;
          Severity: Minor
          Found in class/Common/FilesManagement.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

          The parameter $country_id is not named in camelCase.
          Open

          function countryForm($country_id = null)
          {
              require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
          
              if ($country_id) {
          Severity: Minor
          Found in admin/country_manager.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

          Severity
          Category
          Status
          Source
          Language