ImpressCMS/impresscms

View on GitHub

Showing 47,251 of 47,256 total issues

Avoid excessively long variable names like $imagecategoryperm_handler. Keep variable name length under 20.
Open

    $imagecategoryperm_handler = icms::handler('icms_member_groupperm');

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $imagecategoryperm_handler. Keep variable name length under 20.
Open

    $imagecategoryperm_handler = icms::handler('icms_member_groupperm');

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $imagecategoryperm_handler. Keep variable name length under 20.
Open

    $imagecategoryperm_handler = icms::handler('icms_member_groupperm');

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $icms_mimetype_handler. Keep variable name length under 20.
Open

    global $icms_mimetype_handler, $icmsAdminTpl;

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $icms_userrank_handler. Keep variable name length under 20.
Open

    global $icms_userrank_handler, $icmsAdminTpl, $rank_id;

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

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

                if (function_exists('xoops_module_install_'.$ModName)) {
                    $func = 'xoops_module_install_'.$ModName;
                    if (!( $lastmsg = $func($module) )) {
                        $msgs[] = sprintf(_MD_AM_FAIL_EXEC, '<strong>' . $func . '</strong>');
                    } else {
Severity: Major
Found in htdocs/install/modulesadmin.php and 1 other location - About 1 hr to fix
htdocs/install/modulesadmin.php on lines 415..425

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

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

                } elseif (function_exists('icms_module_install_'.$ModName)) {
                    $func = 'icms_module_install_'.$ModName;
                    if (!( $lastmsg = $func($module) )) {
                        $msgs[] = sprintf(_MD_AM_FAIL_EXEC, '<strong>' . $func . '</strong>');
                    } else {
Severity: Major
Found in htdocs/install/modulesadmin.php and 1 other location - About 1 hr to fix
htdocs/install/modulesadmin.php on lines 405..425

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

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

    private function write_mainfile($vars) {
        if (empty($vars)) {
            return false;
        }

Severity: Minor
Found in upgrade/upd-icms-1.0-to-1.1/index.php - About 1 hr to fix

    Method b_system_social_show has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function b_system_social_show($options) {
        $block = array();
        $block['provider'] = array();
    
        $i = 0;
    Severity: Minor
    Found in htdocs/modules/system/blocks/system_blocks.php - About 1 hr to fix

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

          for (i=0; i<divs.length;i++){
              if (/opt_divs/.test(divs[i].className)){
                  divs[i].style.display = 'none';
              }
          }
      Severity: Major
      Found in htdocs/modules/system/admin/images/js/imanager.js and 1 other location - About 1 hr to fix
      htdocs/include/xoops.js on lines 515..519

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

      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 (i=0; i<divs.length;i++){
              if (/classname/.test(divs[i].className)){
                  divs[i].style.display = 'none';
              }
          }
      Severity: Major
      Found in htdocs/include/xoops.js and 1 other location - About 1 hr to fix
      htdocs/modules/system/admin/images/js/imanager.js on lines 3..7

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

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

      if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
          function iter(name) {
              return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
          }
      
      
      Severity: Minor
      Found in htdocs/install/prototype.js - 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 icms_getModuleInfo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      function &icms_getModuleInfo($moduleName = false)
      {
          static $icmsModules;
          if(isset($icmsModules[$moduleName]))
          {
      Severity: Minor
      Found in htdocs/include/functions.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 blocks_engine_upgrade has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          function blocks_engine_upgrade() {
              echo '<h2>Updating blocks engine </h2>';
              if (!$this->table_exists('block_positions')) {
                  $xoopsDB = $GLOBALS['xoopsDB'];
                  $query = "CREATE TABLE `" . $xoopsDB->prefix('block_positions') . "` (
      Severity: Minor
      Found in upgrade/upd-2.0.18-to-impresscms-1.0/index.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_main_show has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      function b_system_main_show() {
          global $icmsConfigUser;
      
          $block = array();
          $block['lang_home'] = _MB_SYSTEM_HOME;
      Severity: Minor
      Found in 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

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

                  if (!empty($mail_lastlog_min)) {
                      $f_mail_lastlog_min = trim($mail_lastlog_min);
                      $time = mktime(0, 0, 0, substr($f_mail_lastlog_min, 5, 2), substr($f_mail_lastlog_min, 8, 2), substr($f_mail_lastlog_min, 0, 4));
                      if ($time > 0) {
                          $criteria[] = "last_login > $time";
      Severity: Major
      Found in htdocs/modules/system/admin/mailusers/main.php and 3 other locations - About 1 hr to fix
      htdocs/modules/system/admin/mailusers/main.php on lines 143..149
      htdocs/modules/system/admin/mailusers/main.php on lines 168..174
      htdocs/modules/system/admin/mailusers/main.php on lines 176..182

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 112.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                  if (!empty($mail_lastlog_max)) {
                      $f_mail_lastlog_max = trim($mail_lastlog_max);
                      $time = mktime(0, 0, 0, substr($f_mail_lastlog_max, 5, 2), substr($f_mail_lastlog_max, 8, 2), substr($f_mail_lastlog_max, 0, 4));
                      if ($time > 0) {
                          $criteria[] = "last_login < $time";
      Severity: Major
      Found in htdocs/modules/system/admin/mailusers/main.php and 3 other locations - About 1 hr to fix
      htdocs/modules/system/admin/mailusers/main.php on lines 136..142
      htdocs/modules/system/admin/mailusers/main.php on lines 168..174
      htdocs/modules/system/admin/mailusers/main.php on lines 176..182

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 112.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              if (!empty($mail_regd_max)) {
                  $f_mail_regd_max = trim($mail_regd_max);
                  $time = mktime(0, 0, 0, substr($f_mail_regd_max, 5, 2), substr($f_mail_regd_max, 8, 2), substr($f_mail_regd_max, 0, 4));
                  if ($time > 0) {
                      $criteria[] = "user_regdate < $time";
      Severity: Major
      Found in htdocs/modules/system/admin/mailusers/main.php and 3 other locations - About 1 hr to fix
      htdocs/modules/system/admin/mailusers/main.php on lines 136..142
      htdocs/modules/system/admin/mailusers/main.php on lines 143..149
      htdocs/modules/system/admin/mailusers/main.php on lines 168..174

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 112.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              if (!empty($mail_regd_min)) {
                  $f_mail_regd_min = trim($mail_regd_min);
                  $time = mktime(0, 0, 0, substr($f_mail_regd_min, 5, 2), substr($f_mail_regd_min, 8, 2), substr($f_mail_regd_min, 0, 4));
                  if ($time > 0) {
                      $criteria[] = "user_regdate > $time";
      Severity: Major
      Found in htdocs/modules/system/admin/mailusers/main.php and 3 other locations - About 1 hr to fix
      htdocs/modules/system/admin/mailusers/main.php on lines 136..142
      htdocs/modules/system/admin/mailusers/main.php on lines 143..149
      htdocs/modules/system/admin/mailusers/main.php on lines 176..182

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 112.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function selFilter has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function selFilter(id,value){
          var div_arg1 = xoopsGetElementById(id+'_arg1');
          var div_arg2 = xoopsGetElementById(id+'_arg2');
          var div_arg3 = xoopsGetElementById(id+'_arg3');
          
      Severity: Minor
      Found in htdocs/modules/system/admin/images/js/imanager.js - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language