ImpressCMS/impresscms

View on GitHub

Showing 47,251 of 47,256 total issues

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

                    for ($j = 0; $j < $opcount; $j++) {
                        $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value');
                        $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name');
                        $ele->addOption($optval, $optkey);
                    }
Severity: Major
Found in htdocs/modules/system/admin/preferences/main.php and 3 other locations - About 3 hrs to fix
htdocs/modules/system/admin/preferences/main.php on lines 164..172
htdocs/modules/system/admin/preferences/main.php on lines 469..473
htdocs/modules/system/admin/preferences/main.php on lines 480..484

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

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

                    for ($j = 0; $j < $opcount; $j++) {
                        $optval = defined($options[$j]->getVar('confop_value'))
                            ? constant($options[$j]->getVar('confop_value'))
                            : $options[$j]->getVar('confop_value');
                        $optkey = defined($options[$j]->getVar('confop_name'))
Severity: Major
Found in htdocs/modules/system/admin/preferences/main.php and 3 other locations - About 3 hrs to fix
htdocs/modules/system/admin/preferences/main.php on lines 153..157
htdocs/modules/system/admin/preferences/main.php on lines 469..473
htdocs/modules/system/admin/preferences/main.php on lines 480..484

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

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

<?php
// $Id: install2.php 595 2006-06-30 02:43:38Z skalpa $
define("_INSTALL_WEBMASTER","Webmasters");
define("_INSTALL_WEBMASTERD","Webmasters di questo sito");
define("_INSTALL_REGUSERS","Utenti registrati");
Severity: Major
Found in htdocs/install/language/italiano/install2.php and 2 other locations - About 3 hrs to fix
htdocs/install/language/english/install2.php on lines 1..84
htdocs/install/language/nederlands/install2.php on lines 1..84

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

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

                    for ($j = 0; $j < $opcount; $j++) {
                        $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value');
                        $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name');
                        $ele->addOption($optval, $optkey);
                    }
Severity: Major
Found in htdocs/modules/system/admin/preferences/main.php and 3 other locations - About 3 hrs to fix
htdocs/modules/system/admin/preferences/main.php on lines 153..157
htdocs/modules/system/admin/preferences/main.php on lines 164..172
htdocs/modules/system/admin/preferences/main.php on lines 469..473

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

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

                    for ($j = 0; $j < $opcount; $j++) {
                        $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value');
                        $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name');
                        $ele->addOption($optval, $optkey);
                    }
Severity: Major
Found in htdocs/modules/system/admin/preferences/main.php and 3 other locations - About 3 hrs to fix
htdocs/modules/system/admin/preferences/main.php on lines 153..157
htdocs/modules/system/admin/preferences/main.php on lines 164..172
htdocs/modules/system/admin/preferences/main.php on lines 480..484

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

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

<?php
// $Id: install2.php 9920 2010-03-27 17:46:23Z skenow $
define("_INSTALL_WEBMASTER","Webmasters");
define("_INSTALL_WEBMASTERD","Webmasters of this site");
define("_INSTALL_REGUSERS","Registered Users");
Severity: Major
Found in htdocs/install/language/english/install2.php and 2 other locations - About 3 hrs to fix
htdocs/install/language/italiano/install2.php on lines 1..56
htdocs/install/language/nederlands/install2.php on lines 1..84

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

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

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

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

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

Refactorings

Further Reading

File page_pathsettings.php has 295 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Installer paths configuration page
 *
 * See the enclosed file license.txt for licensing information.
Severity: Minor
Found in htdocs/install/page_pathsettings.php - About 3 hrs to fix

    Method protector_oninstall_base has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function protector_oninstall_base($module, $mydirname) {
            // transations on module install
            global $ret; // TODO :-D
    
            if (!is_array($ret)) $ret = array ();

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

      if ($op == 'update_ok') {
          $ret = array();
          $ret[] = icms_module_update($module);
          $contents = impresscms_get_adminmenu();
          if (!xoops_module_write_admin_menu($contents)) {
      Severity: Major
      Found in htdocs/modules/system/admin/modulesadmin/main.php and 1 other location - About 3 hrs to fix
      htdocs/modules/system/admin/modulesadmin/main.php on lines 276..294

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

      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 ($op == 'uninstall_ok') {
          $ret = array();
          $ret[] = xoops_module_uninstall($module);
          $contents = impresscms_get_adminmenu();
          if (!xoops_module_write_admin_menu($contents)) {
      Severity: Major
      Found in htdocs/modules/system/admin/modulesadmin/main.php and 1 other location - About 3 hrs to fix
      htdocs/modules/system/admin/modulesadmin/main.php on lines 321..339

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

      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

          $("input#trustpath").change(function () {
              $.ajax({
                  url: 'page_pathsettings.php',
                  data: "action=checktrustpath&path=" + $('input#trustpath').val(),
                  dataType: "html",
      Severity: Major
      Found in htdocs/install/pathsettings.js and 1 other location - About 3 hrs to fix
      htdocs/install/pathsettings.js on lines 9..18

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

      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

          $("input#rootpath").change(function () {
              $.ajax({
                  url: 'page_pathsettings.php',
                  data: "action=checkrootpath&path=" + $('input#rootpath').val(),
                  dataType: "html",
      Severity: Major
      Found in htdocs/install/pathsettings.js and 1 other location - About 3 hrs to fix
      htdocs/install/pathsettings.js on lines 30..39

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

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

          function Sizzle( selector, context, results, seed ) {
              var match, elem, m, nodeType,
                  i, groups, old, nid, newContext, newSelector;
      
              if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
      Severity: Major
      Found in htdocs/install/prototype.js - About 3 hrs to fix

        Method updateUser has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function updateUser($uid, $uname, $login_name, $name, $url, $email, $user_icq, $user_aim, $user_yim,
                            $user_msnm, $user_from, $user_occ, $user_intrest, $user_viewemail, $user_avatar,
                            $user_sig, $attachsig, $theme, $pass, $pass2, $rank, $bio, $uorder, $umode, $notify_method,
                            $notify_mode, $timezone_offset, $user_mailok, $language,
                            $pass_expired, $groups = array()
        Severity: Major
        Found in htdocs/modules/system/admin/users/users.php - About 3 hrs to fix

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

          if ($pos !== FALSE) {
              $icmsLocation = substr(ICMS_URL, strpos(ICMS_URL, '://') + 3);
              if (substr($redirect, $pos + 3, strlen($icmsLocation)) != $icmsLocation) {
                  $redirect = ICMS_URL;
              } elseif (substr($redirect, $pos + 3, strlen($icmsLocation) + 1) == $icmsLocation . '.') {
          Severity: Major
          Found in htdocs/include/checklogin.php and 1 other location - About 3 hrs to fix
          htdocs/user.php on lines 51..58

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

          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 ($pos !== FALSE) {
                  $icmsLocation = substr(ICMS_URL, strpos(ICMS_URL, '://') + 3);
                  if (substr($redirect, $pos + 3, strlen($icmsLocation)) != $icmsLocation) {
                      $redirect = ICMS_URL;
                  } elseif (substr($redirect, $pos + 3, strlen($icmsLocation) + 1) == $icmsLocation . '.') {
          Severity: Major
          Found in htdocs/user.php and 1 other location - About 3 hrs to fix
          htdocs/include/checklogin.php on lines 69..76

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

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

          function AdMenu(id) { this.type = "horizontal"; this.position = { "level1": { "top": 0, "left": 0}, "levelX": { "top": 0, "left": 0}
          }
          this.zIndex = { "visible": 1, "hidden": -1
          }
          this.arrow1 = null; this.arrow2 = null; this.browser = { "ie": Boolean(document.body.currentStyle), "ie5": (navigator.appVersion.indexOf("MSIE 5.5") != -1 || navigator.appVersion.indexOf("MSIE 5.0") != -1)
          Severity: Major
          Found in htdocs/include/icms_rtl.js - About 2 hrs to fix

            Function impresscms_get_adminmenu has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

            function impresscms_get_adminmenu() {
                $admin_menu = array();
                $modules_menu = array();
                $systemadm = false;
            
            
            Severity: Minor
            Found in htdocs/include/cp_functions.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 intval_allrequestsendid has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                function intval_allrequestsendid() {
                    if ($this->_done_intval)
                        return true;
                    else
                        $this->_done_intval = true;

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

                public function AllowedModules($mimetype, $module) {
                    $mimetypeid_allowed = $dirname_allowed = FALSE;
                    $GrantedItems = $this->UserCanUpload();
                    $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('types', '%' . $mimetype . '%', 'LIKE'));
            
            
            Severity: Minor
            Found in htdocs/modules/system/admin/mimetype/class/mimetype.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

            Severity
            Category
            Status
            Source
            Language