ImpressCMS/impresscms

View on GitHub

Showing 47,251 of 47,256 total issues

Avoid deeply nested control flow statements.
Open

                            if ($template != '') {
                                $tplfile =& $tplfile_handler->create();
                                $tplfile->setVar('tpl_module', $dirname);
                                $tplfile->setVar('tpl_refid', (int) ($newbid));
                                $tplfile->setVar('tpl_source', $content, true);
Severity: Major
Found in htdocs/install/modulesadmin.php - About 45 mins to fix

    Method jmaketime has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function jmaketime($hour,$minute,$second,$jmonth,$jday,$jyear) {
    Severity: Minor
    Found in htdocs/include/jalali.php - About 45 mins to fix

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

      function jalali_to_gregorian($j_y, $j_m, $j_d) {
          $g_days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
          $j_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
      
          $jy = $j_y-979;
      Severity: Minor
      Found in htdocs/include/jalali.php - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Avoid deeply nested control flow statements.
      Open

                              if ($counter == 1 && $currentpage > 5) {
                                  $hiddenform .= "... ";
                              }
      Severity: Major
      Found in htdocs/include/findusers.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                        while ($row = fetch_assoc($result)) {
                            $collations[$row["Variable_name"]] = $row["Value"];
                        }
        Severity: Major
        Found in htdocs/install/page_dbsettings.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if ($counter == $totalpages && $currentpage < $totalpages - 4) {
                                      $hiddenform .= "... ";
                                  }
          Severity: Major
          Found in htdocs/include/findusers.php - About 45 mins to fix

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

            function getDbCharsets($link) {
                static $charsets = array( );
                if ($charsets) {
                    return $charsets;
                }
            Severity: Minor
            Found in htdocs/install/page_dbsettings.php - About 45 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

            function validateDbCharset($link, &$charset, &$collation) {
                $error = null;
            
                if (empty ($charset)) {
                    $collation = "";
            Severity: Minor
            Found in htdocs/install/page_dbsettings.php - About 45 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Avoid deeply nested control flow statements.
            Open

                                            for ($k = 0; $k < $btcount; $k++) {
                                                if (!$tplfile_handler->delete($tplfiles[$k])) {
                                                    $msgs[] = '&nbsp;&nbsp;<span style="color:#ff0000;">ERROR: Could not remove deprecated block template. (ID: <b>'.$tplfiles[$k]->getVar('tpl_id').'</b>)</span>';
                                                } else {
                                                    $msgs[] = '&nbsp;&nbsp;Block template <b>'.$tplfiles[$k]->getVar('tpl_file').'</b> deprecated.';
            Severity: Major
            Found in htdocs/install/modulesadmin.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if ($counter == 1 && $currentpage > 5) {
                                          $hiddenform .= "... ";
                                      }
              Severity: Major
              Found in htdocs/include/findusers.php - About 45 mins to fix

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

                    function check_sql_union($sanitize = true) {
                        if ($this->_done_union)
                            return $this->_safe_union;
                        else
                            $this->_done_union = 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

                Avoid deeply nested control flow statements.
                Open

                                    if (!$lang_updated && $config->getVar('conf_catid') == ICMS_CONF && $config->getVar('conf_name') == 'language') {
                                        $icmsConfig['language'] = ${$config->getVar('conf_name')};
                                        $lang_updated = TRUE;
                                    }
                Severity: Major
                Found in htdocs/modules/system/admin/preferences/main.php - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if (!$theme_updated && $config->getVar('conf_catid') == ICMS_CONF && $config->getVar('conf_name') == 'theme_set') {
                                          $member_handler = icms::handler('icms_member');
                                          $member_handler->updateUsersByField('theme', ${$config->getVar('conf_name')});
                                          $theme_updated = TRUE;
                                      }
                  Severity: Major
                  Found in htdocs/modules/system/admin/preferences/main.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if ($counter == 1 && $currentpage > 5) {
                                            $hiddenform .= "... ";
                                        }
                    Severity: Major
                    Found in htdocs/modules/system/admin/findusers/main.php - About 45 mins to fix

                      Method getForm has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public function getForm($form_caption, $form_name, $form_action = FALSE, $submit_button_caption = _CO_ICMS_SUBMIT, $cancel_js_action = FALSE, $captcha = FALSE) {
                      Severity: Minor
                      Found in htdocs/modules/system/admin/blocksadmin/class/blocksadmin.php - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    if ($template != '') {
                                                        $tplfile = &$tplfile_handler->find('default', 'block', $fblock['bid']);
                                                        if (count($tplfile) == 0) {
                                                            $tplfile_new = &$tplfile_handler->create();
                                                            $tplfile_new->setVar('tpl_module', $dirname);
                        Severity: Major
                        Found in htdocs/modules/system/admin/modulesadmin/modulesadmin.php - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                          for ($k = 0; $k < $btcount; $k++ ) {
                                                              if (!$tplfile_handler->delete($tplfiles[$k])) {
                                                                  $msgs[] = sprintf('&nbsp;&nbsp;<span style="color:#ff0000;">' . _MD_AM_BLOCK_TMPLT_DELETE_FAILED . '</span>', '<strong>' . $tplfiles[$k]->getVar('tpl_file') . '</strong>', '<strong>' . $tplfiles[$k]->getVar('tpl_id') . '</strong>');
                                                              } else {
                                                                  $msgs[] = sprintf('&nbsp;&nbsp;' . _MD_AM_BLOCK_TMPLT_DELETED, '<strong>' . $tplfiles[$k]->getVar('tpl_file') . '</strong>', '<strong>' . $tplfiles[$k]->getVar('tpl_id') . '</strong>');
                          Severity: Major
                          Found in htdocs/modules/system/admin/modulesadmin/modulesadmin.php - About 45 mins to fix

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

                                function get_bad_ips($with_jailed_time = false) {
                                    list($bad_ips_serialized) = @file(self::get_filepath4badips());
                                    $bad_ips = empty($bad_ips_serialized) ? array() : @unserialize($bad_ips_serialized);
                                    if (!is_array($bad_ips) || isset($bad_ips[0])) $bad_ips = 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

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

                            function displayGroups() {
                                icms_cp_header();
                                echo '<div class="CPbigTitle" style="background-image: url(' . ICMS_MODULES_URL . '/system/admin/groups/images/groups_big.png)">' . _AM_EDITADG . '</div><br />';
                                $member_handler = icms::handler('icms_member');
                                $groups = $member_handler->getGroups();
                            Severity: Minor
                            Found in htdocs/modules/system/admin/groups/groups.php - About 45 mins to fix

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

                            Avoid deeply nested control flow statements.
                            Open

                                                if (!$encryption_updated && $config->getVar('conf_catid') == ICMS_CONF_USER && $config->getVar('conf_name') == 'enc_type') {
                                                    if ($icmsConfig['closesite'] !== 1) {
                                                        $member_handler = icms::handler('icms_member');
                                                        $member_handler->updateUsersByField('pass_expired', 1);
                                                        $encryption_updated = TRUE;
                            Severity: Major
                            Found in htdocs/modules/system/admin/preferences/main.php - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language