XoopsModules25x/contact

View on GitHub

Showing 495 of 495 total issues

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

        $form->display();
Severity: Minor
Found in admin/blocksadmin.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 '$department_mail' which will lead to PHP notices.
Open

                    $department_mail[] = $vale[1];
Severity: Minor
Found in class/ContactHandler.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

    Method updateBlock has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups)
    Severity: Major
    Found in admin/blocksadmin.php - About 1 hr to fix

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

          public function contactSendMailConfirm($contact)
          {
              $xoopsMailer = \xoops_getMailer();
              $xoopsMailer->useMail();
              $xoopsMailer->setToEmails($contact['contact_mail']);
      Severity: Minor
      Found in class/ContactHandler.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 xoops_module_install_contact has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function xoops_module_install_contact(\XoopsModule $module)
      {
          require dirname(__DIR__, 3) . '/mainfile.php';
      
          $moduleDirName = \basename(\dirname(__DIR__));
      Severity: Minor
      Found in include/oninstall.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 ContactCorePreload extends \XoopsPreloadItem
        Severity: Minor
        Found in preloads/core.php by phpcodesniffer

        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

        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 display_dialog has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function display_dialog(id, bgiframe, modal, hide, show, height, width) {
        Severity: Major
        Found in assets/js/admin.js - About 50 mins to fix

          Method setOrder has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              function setOrder($bid, $title, $weight, $visible, $side, $bcachetime, $bmodule)
          Severity: Major
          Found in admin/blocksadmin.php - About 50 mins to fix

            Method isBlockCloned has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options = null)
            Severity: Major
            Found in admin/blocksadmin.php - About 50 mins to fix

              Avoid variables with short names like $id. Configured minimum length is 3.
              Open

                  public static function cloneRecord($tableName, $id_field, $id)
              Severity: Minor
              Found in class/Common/SysUtility.php by phpmd

              ShortVariable

              Since: 0.2

              Detects when a field, local, or parameter has a very short name.

              Example

              class Something {
                  private $q = 15; // VIOLATION - Field
                  public static function main( array $as ) { // VIOLATION - Formal
                      $r = 20 + $this->q; // VIOLATION - Local
                      for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                          $r += $this->q;
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#shortvariable

              Avoid variables with short names like $db. Configured minimum length is 3.
              Open

                      $db = \XoopsDatabaseFactory::getDatabaseConnection();
              Severity: Minor
              Found in admin/blocksadmin.php by phpmd

              ShortVariable

              Since: 0.2

              Detects when a field, local, or parameter has a very short name.

              Example

              class Something {
                  private $q = 15; // VIOLATION - Field
                  public static function main( array $as ) { // VIOLATION - Formal
                      $r = 20 + $this->q; // VIOLATION - Local
                      for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                          $r += $this->q;
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#shortvariable

              The parameter $id_field is not named in camelCase.
              Open

                  public static function cloneRecord($tableName, $id_field, $id)
                  {
                      $new_id = false;
                      $table  = $GLOBALS['xoopsDB']->prefix($tableName);
                      // copy content of the record you wish to clone 
              Severity: Minor
              Found in class/Common/SysUtility.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

              Avoid variables with short names like $id. Configured minimum length is 3.
              Open

                  public function contactGetAdminList($contact, $id)
              Severity: Minor
              Found in class/ContactHandler.php by phpmd

              ShortVariable

              Since: 0.2

              Detects when a field, local, or parameter has a very short name.

              Example

              class Something {
                  private $q = 15; // VIOLATION - Field
                  public static function main( array $as ) { // VIOLATION - Formal
                      $r = 20 + $this->q; // VIOLATION - Local
                      for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                          $r += $this->q;
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#shortvariable

              Avoid variables with short names like $db. Configured minimum length is 3.
              Open

                  private $db;
              Severity: Minor
              Found in class/Contact.php by phpmd

              ShortVariable

              Since: 0.2

              Detects when a field, local, or parameter has a very short name.

              Example

              class Something {
                  private $q = 15; // VIOLATION - Field
                  public static function main( array $as ) { // VIOLATION - Formal
                      $r = 20 + $this->q; // VIOLATION - Local
                      for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                          $r += $this->q;
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#shortvariable

              Avoid variables with short names like $db. Configured minimum length is 3.
              Open

                      $db = \XoopsDatabaseFactory::getDatabaseConnection();
              Severity: Minor
              Found in admin/blocksadmin.php by phpmd

              ShortVariable

              Since: 0.2

              Detects when a field, local, or parameter has a very short name.

              Example

              class Something {
                  private $q = 15; // VIOLATION - Field
                  public static function main( array $as ) { // VIOLATION - Formal
                      $r = 20 + $this->q; // VIOLATION - Local
                      for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                          $r += $this->q;
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#shortvariable

              Avoid variables with short names like $db. Configured minimum length is 3.
              Open

                      $db = \XoopsDatabaseFactory::getDatabaseConnection();
              Severity: Minor
              Found in admin/blocksadmin.php by phpmd

              ShortVariable

              Since: 0.2

              Detects when a field, local, or parameter has a very short name.

              Example

              class Something {
                  private $q = 15; // VIOLATION - Field
                  public static function main( array $as ) { // VIOLATION - Formal
                      $r = 20 + $this->q; // VIOLATION - Local
                      for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                          $r += $this->q;
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#shortvariable

              Severity
              Category
              Status
              Source
              Language