XoopsModules25x/xoopspoll

View on GitHub

Showing 4,407 of 4,407 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    public function __construct()
    {
        //$this->ArtObject("bb_posts");
        $this->initVar('post_id', XOBJ_DTYPE_INT);
        $this->initVar('topic_id', XOBJ_DTYPE_INT, 0, true);
Severity: Major
Found in extras/newbb_4x/trunk_4_00/class/post.php and 1 other location - About 2 days to fix
extras/newbb_5x/trunk_5_00/class/Post.php on lines 32..57

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 421.

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    public function __construct()
    {
        //$this->ArtObject("bb_posts");
        $this->initVar('post_id', XOBJ_DTYPE_INT);
        $this->initVar('topic_id', XOBJ_DTYPE_INT, 0, true);
Severity: Major
Found in extras/newbb_5x/trunk_5_00/class/Post.php and 1 other location - About 2 days to fix
extras/newbb_4x/trunk_4_00/class/post.php on lines 27..52

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 421.

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        if ($post->isNew()) {
            if (!$topic_id = $post->getVar('topic_id')) {
                $topic_obj->setVar('topic_title', $post->getVar('subject', 'n'));
                $topic_obj->setVar('topic_poster', $post->getVar('uid'));
                $topic_obj->setVar('forum_id', $post->getVar('forum_id'));
Severity: Major
Found in extras/newbb_5x/trunk_5_00/class/Post.php and 1 other location - About 2 days to fix
extras/newbb_4x/trunk_4_00/class/post.php on lines 764..834

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 415.

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        if ($post->isNew()) {
            if (!$topic_id = $post->getVar('topic_id')) {
                $topic_obj->setVar('topic_title', $post->getVar('subject', 'n'));
                $topic_obj->setVar('topic_poster', $post->getVar('uid'));
                $topic_obj->setVar('forum_id', $post->getVar('forum_id'));
Severity: Major
Found in extras/newbb_4x/trunk_4_00/class/post.php and 1 other location - About 2 days to fix
extras/newbb_5x/trunk_5_00/class/Post.php on lines 762..832

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 415.

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

File post.php has 808 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Newbb module
 *
 * You may not change or alter any portion of this comment or credits
Severity: Major
Found in extras/newbb_4x/trunk_4_00/class/post.php - About 1 day to fix

    File Post.php has 777 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Newbb module
     *
     * You may not change or alter any portion of this comment or credits
    Severity: Major
    Found in extras/newbb_5x/trunk_5_00/class/Post.php - About 1 day to fix

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

              if (!empty($poll_obj) && $poll_obj instanceof \XoopspollPoll) {
      
                  /* check to see if user has rights to view the results */
                  $vis_return = $poll_obj->isResultVisible();
                  $isVisible  = (true === $vis_return) ? true : false;
      Severity: Major
      Found in extras/newbb_4x/trunk_4_00/viewtopic.php and 1 other location - About 1 day to fix
      extras/newbb_4x/irmtfan/viewtopic.php on lines 495..540

      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 354.

      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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

                  if (!empty($poll_obj) && $poll_obj instanceof \XoopspollPoll) {
      
                      /* check to see if user has rights to view the results */
                      $vis_return = $poll_obj->isResultVisible();
                      $isVisible  = (true === $vis_return) ? true : false;
      Severity: Major
      Found in extras/newbb_4x/irmtfan/viewtopic.php and 1 other location - About 1 day to fix
      extras/newbb_4x/trunk_4_00/viewtopic.php on lines 391..427

      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 354.

      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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

              if (!empty($poll_obj) && $poll_obj instanceof Xoopspoll\Poll) {
                  /* check to see if user has rights to view the results */
                  $vis_return = $poll_obj->isResultVisible();
                  $isVisible  = true === $vis_return;
                  $visibleMsg = $isVisible ? '' : $vis_return;
      Severity: Major
      Found in extras/newbb_5x/trunk_5_00/viewtopic.php and 1 other location - About 1 day to fix
      extras/newbb_5x/irmtfan/viewtopic.php on lines 503..546

      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 342.

      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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

                  if (!empty($poll_obj) && $poll_obj instanceof Xoopspoll\Poll) {
                      /* check to see if user has rights to view the results */
                      $vis_return = $poll_obj->isResultVisible();
                      $isVisible  = true === $vis_return;
                      $visibleMsg = $isVisible ? '' : $vis_return;
      Severity: Major
      Found in extras/newbb_5x/irmtfan/viewtopic.php and 1 other location - About 1 day to fix
      extras/newbb_5x/trunk_5_00/viewtopic.php on lines 397..431

      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 342.

      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

      File viewtopic.php has 668 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /*------------------------------------------------------------------------
                      XOOPS - PHP Content Management System
                          Copyright (c) 2000-2016 XOOPS.org
                             <http://xoops.org/>
      Severity: Major
      Found in extras/newbb_4x/irmtfan/viewtopic.php - About 1 day to fix

        File viewtopic.php has 665 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /*------------------------------------------------------------------------
                        XOOPS - PHP Content Management System
                            Copyright (c) 2000-2020 XOOPS.org
                               <https://xoops.org>
        Severity: Major
        Found in extras/newbb_5x/irmtfan/viewtopic.php - About 1 day to fix

          Function _delete has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
          Open

              private function _delete(&$post, $force = false)
              {
                  if ((!$post instanceof Post) || (0 === $post->getVar('post_id'))) {
                      return false;
                  }
          Severity: Minor
          Found in extras/newbb_4x/irmtfan/class/post.php - About 1 day 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 _delete has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
          Open

              private function _delete($post, $force = false)
              {
                  if ((!$post instanceof Post) || (0 === $post->getVar('post_id'))) {
                      return false;
                  }
          Severity: Minor
          Found in extras/newbb_5x/irmtfan/class/PostHandler.php - About 1 day 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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  if (!$pollObj->hasExpired()) {
                      $msg = _MD_XOOPSPOLL_MUSTLOGIN;
                      //@todo:: add $url to all redirects
                      //            $url = $GLOBALS['xoops']->buildUrl("index.php", array('poll_id' => $poll_id));
                      if ($pollObj->isAllowedToVote()) {
          Severity: Major
          Found in extras/newbb_4x/irmtfan/votepolls.php and 1 other location - About 1 day to fix
          extras/newbb_4x/trunk_4_00/votepolls.php on lines 66..101

          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 303.

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              if (!$pollObj->hasExpired()) {
                  $msg = _MD_XOOPSPOLL_MUSTLOGIN;
                  //@todo:: add $url to all redirects
                  //        $url = $GLOBALS['xoops']->buildUrl("index.php", array('poll_id' => $poll_id));
                  if ($pollObj->isAllowedToVote()) {
          Severity: Major
          Found in extras/newbb_4x/trunk_4_00/votepolls.php and 1 other location - About 1 day to fix
          extras/newbb_4x/irmtfan/votepolls.php on lines 83..118

          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 303.

          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

              if (!$pollObj->hasExpired()) {
                  $msg = _MD_XOOPSPOLL_MUSTLOGIN;
                  //@todo:: add $url to all redirects
                  //        $url = $GLOBALS['xoops']->buildUrl("index.php", array('poll_id' => $poll_id));
                  if ($pollObj->isAllowedToVote()) {
          Severity: Major
          Found in extras/newbb_5x/trunk_5_00/votepolls.php and 2 other locations - About 1 day to fix
          extras/newbb_5x/irmtfan/votepolls.php on lines 78..112
          index.php on lines 179..213

          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 290.

          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

                  if (!$pollObj->hasExpired()) {
                      $msg = _MD_XOOPSPOLL_MUSTLOGIN;
                      //@todo:: add $url to all redirects
                      //            $url = $GLOBALS['xoops']->buildUrl("index.php", array('poll_id' => $pollId));
                      if ($pollObj->isAllowedToVote()) {
          Severity: Major
          Found in index.php and 2 other locations - About 1 day to fix
          extras/newbb_5x/irmtfan/votepolls.php on lines 78..112
          extras/newbb_5x/trunk_5_00/votepolls.php on lines 70..104

          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 290.

          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

                  if (!$pollObj->hasExpired()) {
                      $msg = _MD_XOOPSPOLL_MUSTLOGIN;
                      //@todo:: add $url to all redirects
                      //            $url = $GLOBALS['xoops']->buildUrl("index.php", array('poll_id' => $poll_id));
                      if ($pollObj->isAllowedToVote()) {
          Severity: Major
          Found in extras/newbb_5x/irmtfan/votepolls.php and 2 other locations - About 1 day to fix
          extras/newbb_5x/trunk_5_00/votepolls.php on lines 70..104
          index.php on lines 179..213

          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 290.

          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

          File main.php has 587 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /*
                         XOOPS - PHP Content Management System
                             Copyright (c) 2000-2020 XOOPS.org
                                <https://xoops.org>
          Severity: Major
          Found in admin/main.php - About 1 day to fix
            Severity
            Category
            Status
            Source
            Language