XoopsModules25x/mylinks

View on GitHub
extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php

Summary

Maintainability
F
6 days
Test Coverage

File system_blocks.php has 540 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
// $Id: system_blocks.php 8066 2011-11-06 05:09:33Z beckmi $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
Severity: Major
Found in extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php - About 1 day to fix

    Function b_system_waiting_show has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    function b_system_waiting_show()
    {
        global $xoopsUser;
        $xoopsDB        = XoopsDatabaseFactory::getDatabaseConnection();
        $moduleHandler = xoops_getHandler('module');
    Severity: Minor
    Found in extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.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

    Method b_system_waiting_show has 86 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function b_system_waiting_show()
    {
        global $xoopsUser;
        $xoopsDB        = XoopsDatabaseFactory::getDatabaseConnection();
        $moduleHandler = xoops_getHandler('module');
    Severity: Major
    Found in extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php - About 3 hrs to fix

      Function b_system_info_show has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      function b_system_info_show($options)
      {
          global $xoopsConfig, $xoopsUser;
          $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection();
          $myts    = MyTextSanitizer::getInstance();
      Severity: Minor
      Found in extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.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

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

      function b_system_main_show()
      {
          global $xoopsUser, $xoopsModule;
          $block               = array();
          $block['lang_home']  = _MB_SYSTEM_HOME;
      Severity: Minor
      Found in extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.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 b_system_comments_show has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function b_system_comments_show($options)
      {
          $block = array();
          include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
          $commentHandler = xoops_getHandler('comment');
      Severity: Major
      Found in extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php - About 2 hrs to fix

        Method b_system_info_show has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function b_system_info_show($options)
        {
            global $xoopsConfig, $xoopsUser;
            $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection();
            $myts    = MyTextSanitizer::getInstance();
        Severity: Minor
        Found in extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php - About 1 hr to fix

          Function b_system_online_show has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          function b_system_online_show()
          {
              global $xoopsUser, $xoopsModule;
              $onlineHandler = xoops_getHandler('online');
              mt_srand((double)microtime() * 1000000);
          Severity: Minor
          Found in extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php - About 1 hr 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 b_system_online_show has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function b_system_online_show()
          {
              global $xoopsUser, $xoopsModule;
              $onlineHandler = xoops_getHandler('online');
              mt_srand((double)microtime() * 1000000);
          Severity: Minor
          Found in extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php - About 1 hr to fix

            Method b_system_notification_show has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function b_system_notification_show()
            {
                global $xoopsConfig, $xoopsUser, $xoopsModule;
                include_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
                include_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/notification.php';
            Severity: Minor
            Found in extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php - About 1 hr to fix

              Method b_system_main_show has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function b_system_main_show()
              {
                  global $xoopsUser, $xoopsModule;
                  $block               = array();
                  $block['lang_home']  = _MB_SYSTEM_HOME;
              Severity: Minor
              Found in extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php - About 1 hr to fix

                Function b_system_comments_show has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                function b_system_comments_show($options)
                {
                    $block = array();
                    include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
                    $commentHandler = xoops_getHandler('comment');
                Severity: Minor
                Found in extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php - About 1 hr 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 b_system_notification_show has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                function b_system_notification_show()
                {
                    global $xoopsConfig, $xoopsUser, $xoopsModule;
                    include_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
                    include_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/notification.php';
                Severity: Minor
                Found in extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php - About 1 hr 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 b_system_topposters_edit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function b_system_topposters_edit($options)
                {
                    include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                    $inputtag = "<input type='text' name='options[]' value='" . (int)$options[0] . "'>";
                    $form     = sprintf(_MB_SYSTEM_DISPLAY, $inputtag);
                Severity: Minor
                Found in extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php - About 1 hr to fix

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

                  function b_system_topposters_edit($options)
                  {
                      include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
                      $inputtag = "<input type='text' name='options[]' value='" . (int)$options[0] . "'>";
                      $form     = sprintf(_MB_SYSTEM_DISPLAY, $inputtag);
                  Severity: Minor
                  Found in extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.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

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

                      if (xoops_isActiveModule('news') && $moduleHandler->getCount(new Criteria('dirname', 'news'))) {
                          $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('stories') . ' WHERE published=0');
                          if ($result) {
                              $block['modules'][0]['adminlink'] = XOOPS_URL . '/modules/news/admin/index.php?op=newarticle';
                              list($block['modules'][0]['pendingnum']) = $xoopsDB->fetchRow($result);
                  extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php on lines 279..286
                  extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php on lines 289..296
                  extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php on lines 299..306

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

                  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 (xoops_isActiveModule('TDMdownloads') && $moduleHandler->getCount(new Criteria('dirname', 'TDMDownloads'))) {
                          $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('tdmdownloads_downloads') . ' WHERE status=0');
                          if ($result) {
                              $block['modules'][8]['adminlink'] = XOOPS_URL . '/modules/TDMDownloads/admin/downloads.php?op=list&statut_display=0';
                              list($block['modules'][8]['pendingnum']) = $xoopsDB->fetchRow($result);
                  extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php on lines 214..221
                  extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php on lines 289..296
                  extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php on lines 299..306

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

                  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 (xoops_isActiveModule('smartsection') && $moduleHandler->getCount(new Criteria('dirname', 'smartsection'))) {
                          $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('smartsection_items') . ' WHERE status=1');
                          if ($result) {
                              $block['modules'][10]['adminlink'] = XOOPS_URL . '/modules/smartsection/admin/item.php';
                              list($block['modules'][10]['pendingnum']) = $xoopsDB->fetchRow($result);
                  extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php on lines 214..221
                  extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php on lines 279..286
                  extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php on lines 289..296

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

                  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 (xoops_isActiveModule('extgallery') && $moduleHandler->getCount(new Criteria('dirname', 'extgallery'))) {
                          $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('extgallery_publicphoto') . ' WHERE photo_approved=0');
                          if ($result) {
                              $block['modules'][9]['adminlink'] = XOOPS_URL . '/modules/extgallery/admin/photo.php#pending-photo';
                              list($block['modules'][9]['pendingnum']) = $xoopsDB->fetchRow($result);
                  extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php on lines 214..221
                  extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php on lines 279..286
                  extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php on lines 299..306

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

                  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 ($options[1] == 1) {
                              $block['users'][$i]['avatar'] = $newmembers[$i]->getVar('user_avatar') != 'blank.gif' ? XOOPS_UPLOAD_URL . '/' . $newmembers[$i]->getVar('user_avatar') : '';
                          } else {
                              $block['users'][$i]['avatar'] = '';
                          }
                  extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php on lines 419..423

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

                  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 ($options[1] == 1) {
                              $block['users'][$i]['avatar'] = $topposters[$i]->getVar('user_avatar') != 'blank.gif' ? XOOPS_UPLOAD_URL . '/' . $topposters[$i]->getVar('user_avatar') : '';
                          } else {
                              $block['users'][$i]['avatar'] = '';
                          }
                  extras/XOOPS_2.5.x/htdocs/modules/system/blocks/system_blocks.php on lines 385..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 95.

                  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

                  There are no issues that match your filters.

                  Category
                  Status