XoopsModules25x/xoopspoll

View on GitHub

Showing 4,407 of 4,407 total issues

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

        if ($newbbModule instanceof \XoopsModule && $newbbModule->isactive()) {
            /** @var Newbb\TopicHandler $topicHandler */
            $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic');
            $tFields      = ['topic_id', 'poll_id'];
            $tArray       = $topicHandler->getAll(new \Criteria('topic_haspoll', 0, '>'), $tFields, false);
Severity: Major
Found in blocks/singlepoll.php and 1 other location - About 4 hrs to fix
index.php on lines 100..116

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

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 &getByLimit($topic_id, $limit, $approved = 1)
    {
        $sql    = 'SELECT p.*, t.*, tp.topic_status FROM ' . $this->db->prefix('bb_posts') . ' p LEFT JOIN ' . $this->db->prefix('bb_posts_text') . ' t ON p.post_id=t.post_id LEFT JOIN ' . $this->db->prefix('bb_topics')
                  . ' tp ON tp.topic_id=p.topic_id WHERE p.topic_id=' . $topic_id . ' AND p.approved =' . $approved . ' ORDER BY p.post_time DESC';
        $result = $this->db->query($sql, $limit, 0);
Severity: Major
Found in extras/newbb_4x/irmtfan/class/post.php and 1 other location - About 4 hrs to fix
extras/newbb_4x/trunk_4_00/class/post.php on lines 616..640

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

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 2 locations. Consider refactoring.
Open

        if ($newforum > 0) {
            $topic_obj = $topicHandler->get($topic_id);
            $topic_obj->loadFilters('update');
            $topic_obj->setVar('forum_id', $newforum, true);
            $topicHandler->insert($topic_obj, true);
Severity: Major
Found in extras/newbb_5x/trunk_5_00/topicmanager.php and 1 other location - About 4 hrs to fix
extras/newbb_4x/trunk_4_00/topicmanager.php on lines 140..156

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

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 2 locations. Consider refactoring.
Open

        if ($newforum > 0) {
            $topic_obj = $topicHandler->get($topic_id);
            $topic_obj->loadFilters('update');
            $topic_obj->setVar('forum_id', $newforum, true);
            $topicHandler->insert($topic_obj, true);
Severity: Major
Found in extras/newbb_4x/trunk_4_00/topicmanager.php and 1 other location - About 4 hrs to fix
extras/newbb_5x/trunk_5_00/topicmanager.php on lines 147..163

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

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

Method xoopspollBlockSinglepollShow has 114 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function xoopspollBlockSinglepollShow($options)
{
    $block = [];

    $configHandler      = xoops_getHandler('config');
Severity: Major
Found in blocks/singlepoll.php - About 4 hrs to fix

    Method xoopspollBlockMultiShow has 114 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function xoopspollBlockMultiShow($options)
    {
        $block           = [];
        $pollOptionArray = [];
        /** @var \XoopsModuleHandler $moduleHandler */
    Severity: Major
    Found in blocks/multipoll.php - About 4 hrs to fix

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

          public static function getHostByAddrWithCache(&$ipAddr)
          {
              static $ipArray = [];
              $retVal  = &$ipAddr;
              $options = ['flags' => \FILTER_FLAG_NO_PRIV_RANGE, \FILTER_FLAG_NO_RES_RANGE];
      Severity: Major
      Found in class/Utility.php and 1 other location - About 4 hrs to fix
      class/PollUtility.php on lines 40..60

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

      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 ($topicHandler->getPermission($forum_obj, $topic_obj->getVar('topic_status'), 'post')) {
          $xoopsTpl->assign('forum_post_or_register', "<a href=\"newtopic.php?forum={$forum_id}\">{$t_new}</a>");
      } elseif (!empty($GLOBALS['xoopsModuleConfig']['show_reg'])) {
          if ($topic_obj->getVar('topic_status')) {
              $xoopsTpl->assign('forum_post_or_register', _MD_TOPICLOCKED);
      Severity: Major
      Found in extras/newbb_5x/trunk_5_00/viewtopic.php and 1 other location - About 4 hrs to fix
      extras/newbb_4x/trunk_4_00/viewtopic.php on lines 168..178

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

      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 ($topicHandler->getPermission($forum_obj, $topic_obj->getVar('topic_status'), 'post')) {
          $xoopsTpl->assign('forum_post_or_register', "<a href=\"newtopic.php?forum={$forum_id}\">{$t_new}</a>");
      } elseif (!empty($GLOBALS['xoopsModuleConfig']['show_reg'])) {
          if ($topic_obj->getVar('topic_status')) {
              $xoopsTpl->assign('forum_post_or_register', _MD_TOPICLOCKED);
      Severity: Major
      Found in extras/newbb_4x/trunk_4_00/viewtopic.php and 1 other location - About 4 hrs to fix
      extras/newbb_5x/trunk_5_00/viewtopic.php on lines 175..185

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

      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 static function getHostByAddrWithCache(&$ipAddr)
          {
              static $ipArray = [];
              $retVal  = &$ipAddr;
              $options = ['flags' => \FILTER_FLAG_NO_PRIV_RANGE, \FILTER_FLAG_NO_RES_RANGE];
      Severity: Major
      Found in class/PollUtility.php and 1 other location - About 4 hrs to fix
      class/Utility.php on lines 17..37

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

      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

      Function updateBlock has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups)
          {
              $myblock = new XoopsBlock($bid);
              $myblock->setVar('title', $btitle);
              $myblock->setVar('weight', $bweight);
      Severity: Minor
      Found in admin/blocksadmin.php - About 4 hrs 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 strictParse has 107 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              var strictParse = function (f, s, o) {
      
                  // pattern for standard and localized AM/PM markers
                  var getPatternAmpm = function (amNames, pmNames) {
                      var markers = [];
      Severity: Major
      Found in assets/js/jquery-ui-timepicker-addon.js - About 4 hrs to fix

        Method _delete has 106 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function _delete($post, $force = false)
            {
                if ((!$post instanceof Post) || (0 === $post->getVar('post_id'))) {
                    return false;
                }
        Severity: Major
        Found in extras/newbb_5x/irmtfan/class/PostHandler.php - About 4 hrs to fix

          Method render has 106 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function render()
              {
                  static $included = false;
          
                  $ele_name  = $this->getName();
          Severity: Major
          Found in class/FormDateTimePicker.php - About 4 hrs to fix

            Method xoopspollBlockSinglepollEdit has 106 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function xoopspollBlockSinglepollEdit($options)
            {
                /**
                 * Options[]
                 *            0 = show expired polls in block
            Severity: Major
            Found in blocks/singlepoll.php - About 4 hrs to fix

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

                      foreach ($option_text as $optxt) {
                          $optxt = trim($optxt);
                          if ('' !== $optxt) {
                              if ('xoopspoll' === $pollmodules) {
                                  $option_obj = $xpOptHandler->create();
              Severity: Major
              Found in extras/newbb_4x/irmtfan/polls.php and 1 other location - About 4 hrs to fix
              extras/newbb_5x/irmtfan/polls.php on lines 600..619

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

              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

                      foreach ($option_text as $optxt) {
                          $optxt = trim($optxt);
                          if ('' !== $optxt) {
                              if ('xoopspoll' === $pollmodules) {
                                  $option_obj = $xpOptHandler->create();
              Severity: Major
              Found in extras/newbb_5x/irmtfan/polls.php and 1 other location - About 4 hrs to fix
              extras/newbb_4x/irmtfan/polls.php on lines 609..628

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

              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

              Function _onTimeChange has 103 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      _onTimeChange: function () {
                          if (!this._defaults.showTimepicker) {
                                              return;
                          }
                          var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,
              Severity: Major
              Found in assets/js/jquery-ui-timepicker-addon.js - About 4 hrs to fix

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

                if ($infobox['show'] > 0) {
                    // irmtfan - remove icon_path and use newbb_displayImage
                    $infobox['icon'] = [
                        'expand'   => $iconHandler->getImageSource('less'),
                        'collapse' => $iconHandler->getImageSource('more'),
                Severity: Major
                Found in extras/newbb_5x/irmtfan/viewtopic.php and 1 other location - About 4 hrs to fix
                extras/newbb_4x/irmtfan/viewtopic.php on lines 192..208

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

                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 ($infobox['show'] > 0) {
                    // irmtfan - remove icon_path and use newbb_displayImage
                    $infobox['icon'] = [
                        'expand'   => $iconHandler->getImageSource('less'),
                        'collapse' => $iconHandler->getImageSource('more')
                Severity: Major
                Found in extras/newbb_4x/irmtfan/viewtopic.php and 1 other location - About 4 hrs to fix
                extras/newbb_5x/irmtfan/viewtopic.php on lines 202..218

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

                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

                Severity
                Category
                Status
                Source
                Language