ImpressCMS/impresscms

View on GitHub

Showing 540 of 47,256 total issues

Avoid deeply nested control flow statements.
Open

                        if (false != $comments) {
                            $renderer =& icms_data_comment_Renderer::instance($xoopsTpl);
                            $renderer->setComments($comments);
                            $renderer->renderThreadView($top_comments[$i]->getVar('com_id'), $admin_view);
                        }
Severity: Major
Found in htdocs/include/comment_view.php - About 45 mins to fix

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

    function xoFormFieldCollation($name, $value, $label, $link, $charset, $help = '') {
    Severity: Minor
    Found in htdocs/install/page_dbsettings.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                             if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) {
                                 $results[$i]['link'] = "modules/" . $module->getVar('dirname') . "/" . $results[$i]['link'];
                             }
      Severity: Major
      Found in htdocs/userinfo.php - About 45 mins to fix

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

        function icms_get_base_domain($url)
        {
            $debug = 0;
            $base_domain = '';
        
        
        Severity: Minor
        Found in htdocs/include/functions.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 icms_getModuleName has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function icms_getModuleName($withLink = true, $forBreadCrumb = false, $moduleName = false) {
            if (!$moduleName) {
                $moduleName = icms::$module->getVar('dirname');
            }
            //$icmsModule = icms_getModuleInfo($moduleName);
        Severity: Minor
        Found in htdocs/include/functions.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($poster_id != 0) {$deleted_num[$poster_id] = !isset($deleted_num[$poster_id]) ? 1 : ($deleted_num[$poster_id] + 1);}
        Severity: Major
        Found in htdocs/include/functions.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

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

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

            function xoopsCodeTarea($textarea_id, $cols=60, $rows=15, $suffix=null)
            {
                icms_core_Debug::setDeprecated('icms_form_elements_Dhtmltextarea.', sprintf(_CORE_REMOVE_IN_VERSION, '2.0'));
                $hiddentext = isset($suffix) ? 'xoopsHiddenText'.trim($suffix) : 'xoopsHiddenText';
                //Hack for url, email ...., the anchor is for having a link on [_More...]
            Severity: Minor
            Found in htdocs/include/xoopscodes.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

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

            function xoFormBlockCollation($name, $value, $label, $link, $charset, $help = '') {
            Severity: Minor
            Found in htdocs/install/page_dbsettings.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if (empty($newbid)) {
                                              $newbid = $db->getInsertId();
                                          }
              Severity: Major
              Found in htdocs/install/modulesadmin.php - About 45 mins to fix

                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
                              Severity
                              Category
                              Status
                              Source
                              Language