ImpressCMS/impresscms

View on GitHub

Showing 47,251 of 47,256 total issues

Function system_get_plugin_info has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

function system_get_plugin_info($dirname , $language = 'english') {
    // get $mytrustdirname for D3 modules
    $mytrustdirname = '' ;
    if (defined('XOOPS_TRUST_PATH') && file_exists(ICMS_MODULES_PATH . "/" . $dirname . "/mytrustdirname.php")) {
        @include ICMS_MODULES_PATH . "/" . $dirname . "/mytrustdirname.php" ;
Severity: Minor
Found in htdocs/modules/system/blocks/system_waiting.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_bookmarks_show has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

function b_system_bookmarks_show() {
    global $icmsConfig;
    $block = array();
    icms_loadLanguageFile('core', 'notification');
    // User must be logged in
Severity: Minor
Found in 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 imanager_index has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

function imanager_index($imgcat_id = NULL) {
    global $icmsAdminTpl, $icmsConfig, $limit;

    if (!is_object(icms::$user)) {
        $groups = array(ICMS_GROUP_ANONYMOUS);
Severity: Minor
Found in htdocs/modules/system/admin/images/main.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

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

    function cleaning_write_folders() {
        $dir = array();
        $dir['templates_c'] = ICMS_COMPILE_PATH . "/";
        $dir['cache'] = ICMS_CACHE_PATH . "/";

Severity: Major
Found in upgrade/upd-2.0.18-to-impresscms-1.0/index.php and 1 other location - About 3 hrs to fix
upgrade/upd-icms-1.0-to-1.1/index.php on lines 50..68

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

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

            $title =(! defined($config[$i]->getVar('conf_desc')) || constant($config[$i]->getVar('conf_desc')) == '') ? constant($config[$i]->getVar('conf_title')) : constant($config[$i]->getVar('conf_title')) . '<img class="helptip" src="'. ICMS_IMAGES_SET_URL . '/actions/acp_help.png" alt="' . _MD_AM_HELP_TIP . '" title="' . _MD_AM_HELP_TIP . '" /><span class="helptext">' . constant($config[$i]->getVar('conf_desc')) . '</span>';
Severity: Major
Found in htdocs/modules/system/admin/preferences/main.php and 1 other location - About 3 hrs to fix
htdocs/modules/system/admin/preferences/main.php on lines 115..115

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

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

    private function cleaning_write_folders() {
        $dir = array();
        $dir['templates_c'] = XOOPS_ROOT_PATH . "/templates_c/";
        $dir['cache'] = XOOPS_ROOT_PATH . "/cache/";

Severity: Major
Found in upgrade/upd-icms-1.0-to-1.1/index.php and 1 other location - About 3 hrs to fix
upgrade/upd-2.0.18-to-impresscms-1.0/index.php on lines 17..35

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

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

            $title =(! defined($config[$i]->getVar('conf_desc')) || constant($config[$i]->getVar('conf_desc')) == '') ? constant($config[$i]->getVar('conf_title')) : constant($config[$i]->getVar('conf_title')) . '<img class="helptip" src="'. ICMS_IMAGES_SET_URL . '/actions/acp_help.png" alt="' . _MD_AM_HELP_TIP . '" title="' . _MD_AM_HELP_TIP . '" /><span class="helptext">' . constant($config[$i]->getVar('conf_desc')) . '</span>';
Severity: Major
Found in htdocs/modules/system/admin/preferences/main.php and 1 other location - About 3 hrs to fix
htdocs/modules/system/admin/preferences/main.php on lines 444..444

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

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

function displayUsers() {
    global $icmsConfig, $icmsModule, $icmsConfigUser;
    $userstart = isset($_GET['userstart']) ? (int) $_GET['userstart'] : 0;

    icms_cp_header();
Severity: Major
Found in htdocs/modules/system/admin/users/users.php - About 3 hrs to fix

    upgrade_impcms06 has 29 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class upgrade_impcms06 {
    
        public $usedFiles = array ();
        private $tasks = array(
            'table1', 'table2', 'table3', 'table4', 'conf',
    Severity: Minor
    Found in upgrade/upd-icms-1.0-to-1.1/index.php - About 3 hrs to fix

      File page_dbsettings.php has 311 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

        Method modifyGroup has 85 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function modifyGroup($g_id) {
            $userstart = $memstart = 0;
            if (!empty($_POST['userstart'])) {
                $userstart = (int) $_POST['userstart'];
            } elseif (!empty($_GET['userstart'])) {
        Severity: Major
        Found in htdocs/modules/system/admin/groups/groups.php - About 3 hrs to fix

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

                          if (file_exists($physical_file)) {
                              $mtime = filemtime($physical_file);
                              if ($last_imported < $mtime) {
                                  if ($mtime > $last_modified) {
                                      $bg = '#ff9999';
          Severity: Major
          Found in htdocs/modules/system/admin/tplsets/main.php and 1 other location - About 3 hrs to fix
          htdocs/modules/system/admin/tplsets/main.php on lines 291..305

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

          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 ($fp = fopen($welcome_webmaster_filename, 'r')) {
                  $tplsource = fread($fp, filesize('language/' . $language . '/welcome_webmaster.tpl'));
                  fclose($fp);
                  $newbid = $dbm->insert('newblocks', " VALUES (0, 0, 0, '', 'Custom Block (Auto Format + smilies)', '" . addslashes(WELCOME_WEBMASTER) . "', '" . addslashes($tplsource) . "', 4, 0, 1, 'C', 'S', 1, '', '', '', '', '', 0, ".$time.")");
                  $dbm->insert("group_permission", " VALUES (0, ".$gruops['XOOPS_GROUP_ADMIN'].", ".$newbid.", 1, 'block_read')");
          Severity: Major
          Found in htdocs/install/makedata.php and 1 other location - About 3 hrs to fix
          htdocs/install/makedata.php on lines 184..189

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

          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 (file_exists($physical_file)) {
                              $mtime = filemtime($physical_file);
                              if ($last_imported < $mtime) {
                                  if ($mtime > $last_modified) {
                                      $bg = '#ff9999';
          Severity: Major
          Found in htdocs/modules/system/admin/tplsets/main.php and 1 other location - About 3 hrs to fix
          htdocs/modules/system/admin/tplsets/main.php on lines 212..229

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

          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 ($fp = fopen($welcome_anonymous_filename, 'r')) {
                  $tplsource = fread($fp, filesize('language/' . $language . '/welcome_anonymous.tpl'));
                  fclose($fp);
                  $newbid = $dbm->insert('newblocks', " VALUES (0, 0, 0, '', 'Custom Block (Auto Format + smilies)', '" . addslashes(WELCOME_ANONYMOUS) . "', '" . addslashes($tplsource) . "', 4, 0, 1, 'C', 'S', 1, '', '', '', '', '', 0, ".$time.")");
                  $dbm->insert("group_permission", " VALUES (0, ".$gruops['XOOPS_GROUP_ANONYMOUS'].", ".$newbid.", 1, 'block_read')");
          Severity: Major
          Found in htdocs/install/makedata.php and 1 other location - About 3 hrs to fix
          htdocs/install/makedata.php on lines 173..178

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

          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

          TextSanitizer has 28 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class TextSanitizer {
          
              /*
               * Constructor of this class
               * Gets allowed html tags from admin config settings
          Severity: Minor
          Found in htdocs/install/class/textsanitizer.php - About 3 hrs to fix

            The class upgrade_impcms06 has 27 non-getter- and setter-methods. Consider refactoring upgrade_impcms06 to keep number of methods under 25.
            Open

            class upgrade_impcms06 {
            
                public $usedFiles = array ();
                private $tasks = array(
                    'table1', 'table2', 'table3', 'table4', 'conf',
            Severity: Minor
            Found in upgrade/upd-icms-1.0-to-1.1/index.php by phpmd

            TooManyMethods

            Since: 0.1

            A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

            By default it ignores methods starting with 'get' or 'set'.

            The default was changed from 10 to 25 in PHPMD 2.3.

            Example

            Source https://phpmd.org/rules/codesize.html#toomanymethods

            The class upgrade_220 has 11 public methods. Consider refactoring upgrade_220 to keep number of public methods under 10.
            Open

            class upgrade_220
            {
                var $usedFiles = array ();
                var $tasks = array('config', 'profile', 'block', 'pm');
                var $updater;
            Severity: Minor
            Found in upgrade/cnt-2.2.x-to-2.0.x/index.php by phpmd

            TooManyPublicMethods

            Since: 0.1

            A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

            By default it ignores methods starting with 'get' or 'set'.

            Example

            Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

            The class upgrade_impcms05 has 13 public methods. Consider refactoring upgrade_impcms05 to keep number of public methods under 10.
            Open

            class upgrade_impcms05 {
                var $usedFiles = array ();
                function isApplied() {
                    return ($this->check_conf_config());
                }

            TooManyPublicMethods

            Since: 0.1

            A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

            By default it ignores methods starting with 'get' or 'set'.

            Example

            Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

            The class upgrade_220 has an overall complexity of 56 which is very high. The configured complexity threshold is 50.
            Open

            class upgrade_220
            {
                var $usedFiles = array ();
                var $tasks = array('config', 'profile', 'block', 'pm');
                var $updater;
            Severity: Minor
            Found in upgrade/cnt-2.2.x-to-2.0.x/index.php by phpmd
            Severity
            Category
            Status
            Source
            Language