XoopsModules25x/xoopstube

View on GitHub

Showing 2,792 of 2,792 total issues

Function displayIcons has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    public static function displayIcons($time, $status = 0, $counter = 0)
    {
        global $xoopsModule;

        $new = '';
Severity: Minor
Found in class/Utility.php - About 5 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

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

function checkBlockGroups($cid = 0, $permType = 'XTubeCatPerm', $redirect = false)
{
    $moduleDirName = \basename(\dirname(__DIR__));
    $groups        = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
    /** @var \XoopsGroupPermHandler $grouppermHandler */
Severity: Major
Found in blocks/xoopstube_top.php and 1 other location - About 5 hrs to fix
include/search.inc.php on lines 26..48

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

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

function xtubeCheckSearchGroups($cid = 0, $permType = 'XTubeCatPerm', $redirect = false)
{
    $moduleDirName = \basename(\dirname(__DIR__));
    //    $modulePath = dirname(__DIR__);

Severity: Major
Found in include/search.inc.php and 1 other location - About 5 hrs to fix
blocks/xoopstube_top.php on lines 33..51

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

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 category.php has 380 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Module: XoopsTube
 *
 * You may not change or alter any portion of this comment or credits
Severity: Minor
Found in admin/category.php - About 5 hrs to fix

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

        if (class_exists('XoopsFormEditor')) {
            $options['name']   = 'description';
            $options['value']  = $description;
            $options['rows']   = 5;
            $options['cols']   = '100%';
    Severity: Major
    Found in admin/category.php and 3 other locations - About 4 hrs to fix
    admin/indexpage.php on lines 111..123
    admin/main.php on lines 177..189
    submit.php on lines 308..320

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

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

            if (class_exists('XoopsFormEditor')) {
                $options['name']   = 'indexheader';
                $options['value']  = $indexheader;
                $options['rows']   = 5;
                $options['cols']   = '100%';
    Severity: Major
    Found in admin/indexpage.php and 3 other locations - About 4 hrs to fix
    admin/category.php on lines 135..147
    admin/main.php on lines 177..189
    submit.php on lines 308..320

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

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

        if (class_exists('XoopsFormEditor')) {
            $options['name']   = 'descriptionb';
            $options['value']  = $descriptionb;
            $options['rows']   = 5;
            $options['cols']   = '100%';
    Severity: Major
    Found in admin/main.php and 3 other locations - About 4 hrs to fix
    admin/category.php on lines 135..147
    admin/indexpage.php on lines 111..123
    submit.php on lines 308..320

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

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

            if (class_exists('XoopsFormEditor')) {
                $options['name']   = 'descriptionb';
                $options['value']  = $descriptionb;
                $options['rows']   = 5;
                $options['cols']   = '100%';
    Severity: Major
    Found in submit.php and 3 other locations - About 4 hrs to fix
    admin/category.php on lines 135..147
    admin/indexpage.php on lines 111..123
    admin/main.php on lines 177..189

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

    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 (isset($options[4]) && ($options[4] > 0)) {
            $result2 = $GLOBALS['xoopsDB']->query(
                'SELECT lid, cid, title, vidid, screenshot, published, vidsource, picurl FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published > 0
                                        AND published<=' . time() . '
                                        AND (expired=0 OR expired>' . time() . ')
    Severity: Major
    Found in blocks/xoopstube_top.php and 1 other location - About 4 hrs to fix
    blocks/xoopstube_top.php on lines 335..352

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

    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 (isset($options[4]) && ($options[4] > 0)) {
            $result2 = $GLOBALS['xoopsDB']->query(
                'SELECT lid, cid, title, vidid, screenshot, published, vidsource, picurl FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published > 0
                                        AND published<=' . time() . '
                                        AND (expired=0 OR expired>' . time() . ')
    Severity: Major
    Found in blocks/xoopstube_top.php and 1 other location - About 4 hrs to fix
    blocks/xoopstube_top.php on lines 404..421

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

    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 xoopstube_top.php has 352 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Module: XoopsTube
     *
     * You may not change or alter any portion of this comment or credits
    Severity: Minor
    Found in blocks/xoopstube_top.php - About 4 hrs to fix

      Method xtubeShowVideo has 108 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function xtubeShowVideo($vidid, $source, $screenshot, $picurl)
      {
          global $xoopsModule;
          $showvideo = '';
          $autoplay  = $GLOBALS['xoopsModuleConfig']['autoplay'];
      Severity: Major
      Found in include/video.php - About 4 hrs to fix

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

            case 'setdirperm':
                if (\Xmf\Request::hasVar('path', 'POST')) {
                    $path = $_POST['path'];
                }
                if (\Xmf\Request::hasVar('redirect', 'POST')) {
        Severity: Major
        Found in class/Common/DirectoryChecker.php and 1 other location - About 4 hrs to fix
        class/Common/FileChecker.php on lines 147..159

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

        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

            case 'copyfile':
                if (\Xmf\Request::hasVar('original_file_path', 'POST')) {
                    $original_file_path = $_POST['original_file_path'];
                }
                if (\Xmf\Request::hasVar('file_path', 'POST')) {
        Severity: Major
        Found in class/Common/FileChecker.php and 1 other location - About 4 hrs to fix
        class/Common/DirectoryChecker.php on lines 148..160

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

        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

                for ($a = 48; $a < (48 + 10); ++$a) {
                    $letterlinks             = [];
                    $initial                 = unichr($a);
                    $sql                     = $xoopsDB->query('SELECT entryID FROM ' . $xoopsDB->prefix('lxentries') . " WHERE init = '$initial' AND submit = '0' AND offline ='0' AND request = '0' " . $catperms . ' ');
                    $howmany                 = $xoopsDB->getRowsNum($sql);
        Severity: Major
        Found in class/Utility.php and 1 other location - About 3 hrs to fix
        class/Utility.php on lines 3313..3323

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

        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

                for ($a = 65; $a < (65 + 26); ++$a) {
                    $letterlinks             = [];
                    $initial                 = unichr($a);
                    $sql                     = $xoopsDB->query('SELECT entryID FROM ' . $xoopsDB->prefix('lxentries') . " WHERE init = '$initial' AND submit = '0' AND offline ='0' AND request = '0' " . $catperms . ' ');
                    $howmany                 = $xoopsDB->getRowsNum($sql);
        Severity: Major
        Found in class/Utility.php and 1 other location - About 3 hrs to fix
        class/Utility.php on lines 3302..3312

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

        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 25 (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 3 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

        The class MediaUploader has an overall complexity of 63 which is very high. The configured complexity threshold is 50.
        Open

        class MediaUploader
        {
            public $mediaName;
            public $mediaType;
            public $mediaSize;
        Severity: Minor
        Found in class/MediaUploader.php by phpmd

        The class Thumbnails has an overall complexity of 67 which is very high. The configured complexity threshold is 50.
        Open

        class Thumbnails
        {
            public $_imgName      = 'blank.gif';
            public $_img_path     = 'uploads';
            public $_img_savepath = 'thumbs';
        Severity: Minor
        Found in class/Thumbnails.php by phpmd

        The class Utility has 55 public methods. Consider refactoring Utility to keep number of public methods under 10.
        Open

        class Utility extends Common\SysUtility
        {
            //--------------- Custom module methods -----------------------------
        
            public const MODULE_NAME = 'xoopstube';
        Severity: Minor
        Found in class/Utility.php by phpmd

        TooManyPublicMethods

        Since: 0.1

        A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

        By default it ignores methods starting with 'get' or 'set'.

        Example

        Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

        Severity
        Category
        Status
        Source
        Language