XoopsModules25x/news

View on GitHub

Showing 310 of 310 total issues

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

        $limit = 0,
        $start = 0,
        $checkRight = false,
        $topic = 0,
        $ihome = 0,
Severity: Major
Found in class/NewsStory.php - About 50 mins to fix

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

            $fromdate,
            $todate,
            $topicslist,
            $usetopicsdef,
            &$tbltopics,
    Severity: Major
    Found in class/NewsStory.php - About 50 mins to fix

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

              $limit = 0,
              $start = 0,
              $checkRight = false,
              $topic = 0,
              $ihome = 0,
      Severity: Major
      Found in class/NewsStory.php - About 50 mins to fix

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                if (0 != (int)$topic) {
                    if (!\is_array($topic)) {
                        $sql .= ' AND topicid=' . (int)$topic . ' AND (ihome=1 OR ihome=0)';
                    } elseif (\count($topic) > 0) {
                        $sql .= ' AND topicid IN (' . \implode(',', $topic) . ')';
        Severity: Major
        Found in class/NewsStory.php and 2 other locations - About 50 mins to fix
        class/NewsStory.php on lines 236..271
        class/NewsStory.php on lines 1306..1335

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

        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 ($topic_id > 0) { // Edit mode
                $groups_ids                      = $grouppermHandler->getGroupIds('news_submit', $topic_id, $xoopsModule->getVar('mid'));
                $groups_ids                      = array_values($groups_ids);
                $groups_news_can_submit_checkbox = new \XoopsFormCheckBox(_AM_SUBMITFORM, 'groups_news_can_submit[]', $groups_ids);
            } else { // Creation mode
        Severity: Major
        Found in admin/index.php and 2 other locations - About 50 mins to fix
        admin/index.php on lines 1202..1208
        admin/index.php on lines 1224..1230

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

        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 (0 != $topic) {
                    if (!\is_array($topic)) {
                        if ($checkRight) {
                            $topics = Utility::getMyItemIds('news_view');
                            if (!\in_array($topic, $topics, true)) {
        Severity: Major
        Found in class/NewsStory.php and 2 other locations - About 50 mins to fix
        class/NewsStory.php on lines 236..271
        class/NewsStory.php on lines 368..389

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

        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 ($topic_id > 0) { // Edit mode
                $groups_ids                       = $grouppermHandler->getGroupIds('news_approve', $topic_id, $xoopsModule->getVar('mid'));
                $groups_ids                       = array_values($groups_ids);
                $groups_news_can_approve_checkbox = new \XoopsFormCheckBox(_AM_APPROVEFORM, 'groups_news_can_approve[]', $groups_ids);
            } else { // Creation mode
        Severity: Major
        Found in admin/index.php and 2 other locations - About 50 mins to fix
        admin/index.php on lines 1213..1219
        admin/index.php on lines 1224..1230

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

        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 ($topic_id > 0) { // Edit mode
                $groups_ids                    = $grouppermHandler->getGroupIds('news_view', $topic_id, $xoopsModule->getVar('mid'));
                $groups_ids                    = array_values($groups_ids);
                $groups_news_can_view_checkbox = new \XoopsFormCheckBox(_AM_VIEWFORM, 'groups_news_can_view[]', $groups_ids);
            } else { // Creation mode
        Severity: Major
        Found in admin/index.php and 2 other locations - About 50 mins to fix
        admin/index.php on lines 1202..1208
        admin/index.php on lines 1213..1219

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

        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 (0 != $topic) {
                    if (!\is_array($topic)) {
                        if ($checkRight) {
                            $topics = Utility::getMyItemIds('news_view');
                            if (!\in_array($topic, $topics, true)) {
        Severity: Major
        Found in class/NewsStory.php and 2 other locations - About 50 mins to fix
        class/NewsStory.php on lines 368..389
        class/NewsStory.php on lines 1306..1335

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

        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

            foreach ($biggestcontributors as $uid => $count) {
                $url   = XOOPS_URL . '/userinfo.php?uid=' . $uid;
                $class = ('even' === $class) ? 'odd' : 'even';
                printf("<tr class='" . $class . "'><td align='left'><a href='%s' target ='_blank'>%s</a></td><td align='right'>%u</td></tr>\n", $url, htmlspecialchars($news->uname($uid), ENT_QUOTES | ENT_HTML5), $count);
            }
        Severity: Major
        Found in admin/index.php and 2 other locations - About 45 mins to fix
        admin/index.php on lines 1631..1635
        admin/index.php on lines 1642..1646

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

        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

            foreach ($bestratedauthors as $uid => $rating) {
                $url   = XOOPS_URL . '/userinfo.php?uid=' . $uid;
                $class = ('even' === $class) ? 'odd' : 'even';
                printf("<tr class='" . $class . "'><td align='left'><a href='%s' target ='_blank'>%s</a></td><td align='right'>%u</td></tr>\n", $url, htmlspecialchars($news->uname($uid), ENT_QUOTES | ENT_HTML5), $rating);
            }
        Severity: Major
        Found in admin/index.php and 2 other locations - About 45 mins to fix
        admin/index.php on lines 1631..1635
        admin/index.php on lines 1653..1657

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

        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

            foreach ($mostreadedauthors as $uid => $reads) {
                $url   = XOOPS_URL . '/userinfo.php?uid=' . $uid;
                $class = ('even' === $class) ? 'odd' : 'even';
                printf("<tr class='" . $class . "'><td align='left'><a href='%s' target ='_blank'>%s</a></td><td align='right'>%u</td></tr>\n", $url, htmlspecialchars($news->uname($uid), ENT_QUOTES | ENT_HTML5), $reads);
            }
        Severity: Major
        Found in admin/index.php and 2 other locations - About 45 mins to fix
        admin/index.php on lines 1642..1646
        admin/index.php on lines 1653..1657

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

        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 newSubmissions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function newSubmissions(): void
        {
            global $dateformat, $pathIcon16;
            $start       = Request::getInt('startnew', 0, 'GET');
            $newsubcount = NewsStory::getAllStoriesCount(3, false);
        Severity: Minor
        Found in admin/index.php - About 45 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

        Method news_getWysiwygForm has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function news_getWysiwygForm($caption, $name, $value = '', $width = '100%', $height = '400px', $supplemental = '')
        Severity: Minor
        Found in include/functions.php - About 45 mins to fix

          Method news_resizePicture has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              $src_path,
              $dst_path,
              $param_width,
              $param_height,
              $keep_original = false,
          Severity: Minor
          Found in include/functions.php - About 45 mins to fix

            Function replace has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function replace($replace_matches)
                {
                    $patterns = [];
                    if ($this->singlewords) {
                        $keywords = \explode(' ', $this->preg_keywords);
            Severity: Minor
            Found in class/Keyhighlighter.php - About 45 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

            Method makeMySelBox has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function makeMySelBox($title, $order = '', $preset_id = 0, $none = 0, $sel_name = '', $onchange = ''): void
            Severity: Minor
            Found in class/XoopsTree.php - About 45 mins to fix

              Method makeMyTopicSelBox has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      $none = 0,
                      $seltopic = -1,
                      $selname = '',
                      $onchange = '',
                      $checkRight = false,
              Severity: Minor
              Found in class/NewsTopic.php - About 45 mins to fix

                Method makeSelBoxOptions has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    protected function makeSelBoxOptions($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr = ''): void
                Severity: Minor
                Found in class/ObjectTree.php - About 45 mins to fix

                  Method getWysiwygForm has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public static function getWysiwygForm($caption, $name, $value = '', $width = '100%', $height = '400px', $supplemental = '')
                  Severity: Minor
                  Found in class/Utility.php - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language