ImpressCMS/impresscms

View on GitHub

Showing 47,251 of 47,256 total issues

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

<?php
// $Id: smilies.php 8535 2009-04-11 10:08:35Z icmsunderdog $
//%%%%%%    Admin Module Name  Smilies     %%%%%
define('_AM_DBUPDATED','Database Updated Successfully!');

Severity: Major
Found in htdocs/modules/system/language/english/admin/smilies.php and 5 other locations - About 6 hrs to fix
htdocs/modules/system/language/english/plugins.php on lines 1..24
htdocs/modules/system/language/francais/plugins.php on lines 1..25
htdocs/modules/system/language/italiano/plugins.php on lines 1..23
htdocs/modules/system/language/nederlands/admin/smilies.php on lines 1..22
htdocs/modules/system/language/nederlands/plugins.php on lines 1..24

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

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

function imanager_index($imgcat_id = NULL) {
    global $icmsTpl, $icmsConfig, $target, $type, $limit;

    if (!is_object(icms::$user)) {
        $groups = array(ICMS_GROUP_ANONYMOUS);
Severity: Major
Found in htdocs/modules/system/admin/images/browser.php - About 6 hrs to fix

    Function protector_onupdate_base has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
    Open

        function protector_onupdate_base($module, $mydirname) {
            // transations on module update
            global $msgs; // TODO :-D
    
            if (!is_array($msgs)) $msgs = array ();

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

        function apply_block()
        {
            global $xoopsDB;
            $xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
    
    
    Severity: Major
    Found in upgrade/cnt-2.2.x-to-2.0.x/index.php - About 6 hrs to fix

      Function disable_features has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          function disable_features() {
      
              // disable "Notice: Undefined index: ..."
              $error_reporting_level = error_reporting(0);
      
      

      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

              if ($this->no_php5) {
                  $this->pagesTitles[] = NO_PHP5_TITLE;
              } elseif ($this->safe_mode) {
                  $this->pagesTitles[] = SAFE_MODE_TITLE;
              } else {
      Severity: Major
      Found in htdocs/install/class/IcmsInstallWizard.php and 1 other location - About 6 hrs to fix
      htdocs/install/class/IcmsInstallWizard.php on lines 60..77

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

      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 ($this->no_php5) {
                  $this->pagesNames[] = NO_PHP5;
              } elseif ($this->safe_mode) {
                  $this->pagesNames[] = SAFE_MODE;
              } else {
      Severity: Major
      Found in htdocs/install/class/IcmsInstallWizard.php and 1 other location - About 6 hrs to fix
      htdocs/install/class/IcmsInstallWizard.php on lines 79..96

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

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

          private function apply_conf() {
              $db = $GLOBALS['xoopsDB'];
              if (getDbValue($db, 'configcategory', 'confcat_id', ' confcat_name="_MD_AM_CONTMANAGER"') != 0){return true;}
              $db->queryF(" INSERT INTO " . $db->prefix("configcategory") . " (confcat_id, confcat_name) VALUES ('9', '_MD_AM_CONTMANAGER')");
              if (getDbValue($db, 'configcategory', 'confcat_id', ' confcat_name="_MD_AM_PERSON"') != 0){return true;}
      Severity: Major
      Found in upgrade/upd-icms-1.0-to-1.1/index.php - About 6 hrs to fix

        Function apply_block has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

            function apply_block()
            {
                global $xoopsDB;
                $xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1");
        
        
        Severity: Minor
        Found in upgrade/cnt-2.2.x-to-2.0.x/index.php - About 6 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 separateStringsInSQL has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
        Open

            function separateStringsInSQL($sql) {
                $sql = trim($sql);
                $sql_len = strlen($sql);
                $char = '';
                $string_start = '';

        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

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

             '".addslashes(serialize(array('a.class', 'a.href', 'a.id', 'a.name', 'a.rev', 'a.style', 'a.title', 'a.target', 'a.rel', 'abbr.title', 'acronym.title',
                                           'blockquote.cite', 'div.align', 'div.style', 'div.class', 'div.id', 'font.size', 'font.color', 'h1.style', 'h2.style', 'h3.style', 'h4.style', 'h5.style', 'h6.style', 'img.src', 'img.alt', 'img.title', 'img.class', 'img.align', 'img.style', 'img.height', 'img.width', 'li.style', 'ol.style', 'p.style', 'span.style', 'span.class', 'span.id', 'table.class', 'table.id', 'table.border', 'table.cellpadding', 'table.cellspacing', 'table.style', 'table.width', 'td.abbr', 'td.align', 'td.class', 'td.id', 'td.colspan', 'td.rowspan', 'td.style', 'td.valign', 'tr.align', 'tr.class', 'tr.id', 'tr.style', 'tr.valign', 'th.abbr', 'th.align', 'th.class', 'th.id', 'th.colspan', 'th.rowspan', 'th.style', 'th.valign', 'ul.style')))."',
        Severity: Major
        Found in htdocs/install/makedata.php and 1 other location - About 5 hrs to fix
        htdocs/modules/system/include/update-112-to-122.php on lines 375..375

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

        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

                $HTML_Allowed_Attr = array('a.class', 'a.href', 'a.id', 'a.name', 'a.rev', 'a.style', 'a.title', 'a.target', 'a.rel', 'abbr.title', 'acronym.title', 'blockquote.cite', 'div.align', 'div.style', 'div.class', 'div.id', 'font.size', 'font.color', 'h1.style', 'h2.style', 'h3.style', 'h4.style', 'h5.style', 'h6.style', 'img.src', 'img.alt', 'img.title', 'img.class', 'img.align', 'img.style', 'img.height', 'img.width', 'li.style', 'ol.style', 'p.style', 'span.style', 'span.class', 'span.id', 'table.class', 'table.id', 'table.border', 'table.cellpadding', 'table.cellspacing', 'table.style', 'table.width', 'td.abbr', 'td.align', 'td.class', 'td.id', 'td.colspan', 'td.rowspan', 'td.style', 'td.valign', 'tr.align', 'tr.class', 'tr.id', 'tr.style', 'tr.valign', 'th.abbr', 'th.align', 'th.class', 'th.id', 'th.colspan', 'th.rowspan', 'th.style', 'th.valign', 'ul.style');
        Severity: Major
        Found in htdocs/modules/system/include/update-112-to-122.php and 1 other location - About 5 hrs to fix
        htdocs/install/makedata.php on lines 638..639

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

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

        function formatTimestamp($time, $format = "l", $timeoffset = null)
        {
            global $icmsConfig;
        
            $format_copy = $format;
        Severity: Major
        Found in htdocs/include/functions.php - About 5 hrs to fix

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

          function xoopsmakecenter(id,enterHiddenPhrase){
              if (enterHiddenPhrase == null) {
                  enterHiddenPhrase = "Enter The Text To Be Aligned On The Center Side:";
              }
              var text = prompt(enterHiddenPhrase, "");
          Severity: Major
          Found in htdocs/include/xoops.js and 1 other location - About 5 hrs to fix
          htdocs/include/xoops.js on lines 367..383

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

          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 xoopsmakeright(id,enterHiddenPhrase){
              if (enterHiddenPhrase == null) {
                  enterHiddenPhrase = "Enter The Text To Be Aligned On The Right Side:";
              }
              var text = prompt(enterHiddenPhrase, "");
          Severity: Major
          Found in htdocs/include/xoops.js and 1 other location - About 5 hrs to fix
          htdocs/include/xoops.js on lines 350..366

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

          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

          Protector has 42 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Protector {
              var $mydirname;
              var $_conn = null;
              var $_conf = array();
              var $_conf_serialized = '';

            Method xoops_module_update_system has 141 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function xoops_module_update_system(&$module, $oldversion = null, $dbVersion = null) {
                global $xoTheme;
            
                $from_112 = $abortUpdate = false;
            
            
            Severity: Major
            Found in htdocs/modules/system/include/update.php - About 5 hrs to fix

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

                      if ($options[1] == 1) {
                          if ($topposters[$i]->getVar('user_avatar') && $topposters[$i]->getVar('user_avatar') != 'blank.gif' && $topposters[$i]->getVar('user_avatar') != '') {
                              $block['users'][$i]['avatar'] = ICMS_UPLOAD_URL . '/' . $topposters[$i]->getVar('user_avatar');
                          } elseif ($icmsConfigUser['avatar_allow_gravatar'] == 1) {
                              $block['users'][$i]['avatar'] = $topposters[$i]->gravatar('G', $icmsConfigUser['avatar_width']);
              Severity: Major
              Found in htdocs/modules/system/blocks/system_blocks.php and 1 other location - About 5 hrs to fix
              htdocs/modules/system/blocks/system_blocks.php on lines 273..283

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

              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) {
                          if ($newmembers[$i]->getVar('user_avatar') && $newmembers[$i]->getVar('user_avatar') != 'blank.gif' && $newmembers[$i]->getVar('user_avatar') != '') {
                              $block['users'][$i]['avatar'] = ICMS_UPLOAD_URL . '/' . $newmembers[$i]->getVar('user_avatar');
                          } elseif ($icmsConfigUser['avatar_allow_gravatar'] == 1) {
                              $block['users'][$i]['avatar'] = $newmembers[$i]->gravatar('G', $icmsConfigUser['avatar_width']);
              Severity: Major
              Found in htdocs/modules/system/blocks/system_blocks.php and 1 other location - About 5 hrs to fix
              htdocs/modules/system/blocks/system_blocks.php on lines 324..334

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

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

              function imanager_updateimage() {
                  if (!icms::$security->check()) {
                      redirect_header('admin.php?fct=images', 3, implode('<br />', icms::$security->getErrors()));
                  }
              
              
              Severity: Minor
              Found in htdocs/modules/system/admin/images/main.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

              Severity
              Category
              Status
              Source
              Language