XoopsModules25x/xoopspoll

View on GitHub
extras/newbb_5x/irmtfan/topicmanager.php

Summary

Maintainability
F
3 days
Test Coverage

File topicmanager.php has 309 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php declare(strict_types=1);
/*
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code
 * which is considered copyrighted (c) material of the original comment or credit authors.
Severity: Minor
Found in extras/newbb_5x/irmtfan/topicmanager.php - About 3 hrs to fix

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

    if (Request::hasVar('submit', 'POST')) {
        $mode = $_POST['mode'];
    
        if ('delete' === $mode) {
            foreach ($topic_id as $tid) {
    Severity: Major
    Found in extras/newbb_5x/irmtfan/topicmanager.php and 1 other location - About 2 days to fix
    extras/newbb_5x/trunk_5_00/topicmanager.php on lines 83..232

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

    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

            echo $action[$mode]['msg']
                 . "<p><a href='"
                 . XOOPS_URL
                 . '/modules/'
                 . $xoopsModule->getVar('dirname')
    Severity: Major
    Found in extras/newbb_5x/irmtfan/topicmanager.php and 1 other location - About 1 hr to fix
    extras/newbb_5x/irmtfan/topicmanager.php on lines 236..253

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

    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

            echo $action[$mode]['msg']
                 . "<p><a href='"
                 . XOOPS_URL
                 . '/modules/'
                 . $xoopsModule->getVar('dirname')
    Severity: Major
    Found in extras/newbb_5x/irmtfan/topicmanager.php and 1 other location - About 1 hr to fix
    extras/newbb_5x/irmtfan/topicmanager.php on lines 141..158

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

    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 ($action_array as $_action) {
        $action[$_action] = [
            'name'   => $_action,
            'desc'   => constant(mb_strtoupper("_MD_DESC_{$_action}")),
            'submit' => constant(mb_strtoupper("_MD_{$_action}")),
    Severity: Minor
    Found in extras/newbb_5x/irmtfan/topicmanager.php and 1 other location - About 55 mins to fix
    extras/newbb_5x/trunk_5_00/topicmanager.php on lines 64..72

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

    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

    Line exceeds 120 characters; contains 127 characters
    Open

                redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum=$forum&amp;topic_id=$topic_id", 2, _MD_ERROR_BACK);

    Line exceeds 120 characters; contains 138 characters
    Open

                $sql = sprintf('UPDATE `%s` SET ' . $action[$mode]['sql'] . ' WHERE topic_id = %u', $xoopsDB->prefix('bb_topics'), $topic_id);

    Line exceeds 120 characters; contains 241 characters
    Open

            echo $action[$mode]['msg'] . "<p><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/viewforum.php?forum=$forum'>" . _MD_RETURNTOTHEFORUM . "</a></p><p><a href='index.php'>" . _MD_RETURNFORUMINDEX . '</a></p>';

    Line exceeds 120 characters; contains 191 characters
    Open

                    redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?forum=$forum&amp;topic_id=$topic_id&amp;order=$order&amp;viewmode=$viewmode", 2, _MD_ERROR_BACK . '<br>sql:' . $sql);

    Line exceeds 120 characters; contains 132 characters
    Open

                $sql = sprintf('UPDATE `%s` SET forum_id = %u WHERE topic_id = %u', $xoopsDB->prefix('bb_posts'), $newforum, $topic_id);

    Line exceeds 120 characters; contains 138 characters
    Open

                $sql    = sprintf('UPDATE `%s` SET forum_topics = forum_topics-1 WHERE forum_id = %u', $xoopsDB->prefix('bb_forums'), $forum);

    Line exceeds 120 characters; contains 299 characters
    Open

                echo $action[$mode]['msg'] . "<p><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/viewtopic.php?topic_id=$topic_id&amp;forum=$newforum'>" . _MD_GOTONEWFORUM . "</a></p><p><a href='" . XOOPS_URL . "/modules/newbb/index.php'>" . _MD_RETURNFORUMINDEX . '</a></p>';

    There are no issues that match your filters.

    Category
    Status