XoopsModules25x/xoopstube

View on GitHub

Showing 2,792 of 2,792 total issues

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

        $vidsource_array  = [
            0   => _MD_XOOPSTUBE_YOUTUBE,
            1   => _MD_XOOPSTUBE_METACAFE,
            2   => _MD_XOOPSTUBE_IFILM,
            3   => _MD_XOOPSTUBE_PHOTOBUCKET,
Severity: Major
Found in submit.php and 1 other location - About 2 hrs to fix
admin/main.php on lines 125..142

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

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

    $vidsource_array  = [
        0   => _AM_XOOPSTUBE_YOUTUBE,
        1   => _AM_XOOPSTUBE_METACAFE,
        2   => _AM_XOOPSTUBE_IFILM,
        3   => _AM_XOOPSTUBE_PHOTOBUCKET,
Severity: Major
Found in admin/main.php and 1 other location - About 2 hrs to fix
submit.php on lines 245..262

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

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 getSpotlightVideos has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getSpotlightVideos($options)
{
    require_once dirname(__DIR__) . '/include/video.php';
    $block = [];
    /** @var \XoopsModuleHandler $moduleHandler */
Severity: Major
Found in blocks/xoopstube_top.php - About 2 hrs to fix

    Function xtubeShowVideo has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    function xtubeShowVideo($vidid, $source, $screenshot, $picurl)
    {
        global $xoopsModule;
        $showvideo = '';
        $autoplay  = $GLOBALS['xoopsModuleConfig']['autoplay'];
    Severity: Minor
    Found in include/video.php - About 2 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 resizeThumbnail has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        public function resizeThumbnail()
        {
            // Get image size and scale ratio
            $scale = \min($this->img_width / $this->_img_info[0], $this->img_height / $this->_img_info[1]);
            // If the image is larger than the max shrink it
    Severity: Minor
    Found in class/Thumbnails.php - About 2 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

    Method truncateHtml has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
        {
            if ($considerHtml) {
                // if the plain text is shorter than the maximum length, return the whole text
                if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
    Severity: Major
    Found in class/Common/SysUtility.php - About 2 hrs to fix

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

                  if ($htmlbanner) {
                      $bannerobject = $htmlcode;
                  } else {
                      $bannerobject = '<div align="center"><a href="' . XOOPS_URL . '/banners.php?op=click&bid=' . $bid . '" target="_blank">';
                      if (false !== mb_stripos($imageurl, '.swf')) {
      Severity: Major
      Found in class/Utility.php and 1 other location - About 2 hrs to fix
      class/Utility.php on lines 2802..2821

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

      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 ($htmlbanner) {
                      $bannerobject = $htmlcode;
                  } else {
                      $bannerobject = '<div align="center"><a href="' . XOOPS_URL . '/banners.php?op=click&bid=' . $bid . '" target="_blank">';
                      if (false !== mb_stripos($imageurl, '.swf')) {
      Severity: Major
      Found in class/Utility.php and 1 other location - About 2 hrs to fix
      class/Utility.php on lines 2740..2759

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

      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 showTopVideoBlock has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function showTopVideoBlock($options)
      {
          $moduleDirName = \basename(\dirname(__DIR__));
          $block         = [];
          /** @var \XoopsModuleHandler $moduleHandler */
      Severity: Major
      Found in blocks/xoopstube_top.php - About 2 hrs to fix

        Function showTopVideoBlock has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        function showTopVideoBlock($options)
        {
            $moduleDirName = \basename(\dirname(__DIR__));
            $block         = [];
            /** @var \XoopsModuleHandler $moduleHandler */
        Severity: Minor
        Found in blocks/xoopstube_top.php - About 2 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 deleteDirectory has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function deleteDirectory($src)
            {
                // Only continue if user is a 'global' Admin
                if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                    return false;
        Severity: Minor
        Found in class/Common/FilesManagement.php - About 2 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 getSpotlightVideos has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        function getSpotlightVideos($options)
        {
            require_once dirname(__DIR__) . '/include/video.php';
            $block = [];
            /** @var \XoopsModuleHandler $moduleHandler */
        Severity: Minor
        Found in blocks/xoopstube_top.php - About 2 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

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

            public function render($alphaCount = null, $howmanyother = null)
            {
                $moduleDirName      = \basename(\dirname(__DIR__, 2));
                $moduleDirNameUpper = mb_strtoupper($moduleDirName);
                \xoops_loadLanguage('common', $moduleDirName);
        Severity: Major
        Found in class/Common/LetterChoice.php - About 2 hrs to fix

          Method fetchMedia has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function fetchMedia($media_name, $index = null)
              {
                  global $_FILES;
          
                  if (!isset($_FILES[$media_name])) {
          Severity: Major
          Found in class/MediaUploader.php - About 2 hrs to fix

            Function getBannerFromClientId has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function getBannerFromClientId($client_id)
                {
                    ###### Hack by www.stefanosilvestrini.com ######
                    $db      = \XoopsDatabaseFactory::getDatabaseConnection();
                    $bresult = $db->query('SELECT COUNT(*) FROM ' . $db->prefix('banner') . ' WHERE cid=' . $client_id);
            Severity: Minor
            Found in class/Utility.php - About 2 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 getTotalItems has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function getTotalItems($sel_id = 0, $get_child = 0, $return_sql = 0)
                {
                    global $mytree, $_check_array;
            
                    if ($sel_id > 0) {
            Severity: Minor
            Found in class/Utility.php - About 2 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 xtubeReturnSource has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            function xtubeReturnSource($returnsource)
            {
                switch ($returnsource) {
                    case 0:
                        $returnsource = _AM_XOOPSTUBE_YOUTUBE;
            Severity: Minor
            Found in include/video.php - About 2 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 getBannerFromBannerId has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function getBannerFromBannerId($banner_id)
                {
                    ###### Hack by www.stefanosilvestrini.com ######
                    $db      = \XoopsDatabaseFactory::getDatabaseConnection();
                    $bresult = $db->query('SELECT COUNT(*) FROM ' . $db->prefix('banner') . ' WHERE bid=' . $banner_id);
            Severity: Minor
            Found in class/Utility.php - About 2 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 fileChecks has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function fileChecks()
                {
                    echo '<fieldset>';
                    echo '<legend style="color: #990000; font-weight: bold;">' . \_AM_XOOPSTUBE_FILECHECKS . '</legend>';
            
            
            Severity: Minor
            Found in class/Utility.php - About 2 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

            Method createMetaKeywords has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function createMetaKeywords($content)
                {
                    $keywordscount = self::getModuleOption('metagen_maxwords');
                    $keywordsorder = self::getModuleOption('metagen_order');
            
            
            Severity: Major
            Found in class/Utility.php - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language