ImpressCMS/impresscms

View on GitHub

Showing 540 of 47,256 total issues

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

    public function insert($table, $query) {
        $this->db->connect();
        $table = $this->db->prefix($table);
        $query = 'INSERT INTO '.$table.' '.$query;
        if (!$this->db->queryF($query)) {
Severity: Minor
Found in htdocs/install/class/dbmanager.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 (! $tpl_updated && $config->getVar('conf_catid') == ICMS_CONF && $config->getVar('conf_name') == 'template_set') {
                        // clear cached/compiled files and regenerate them if default theme has been changed
                        if ($icmsConfig['template_set'] != ${$config->getVar('conf_name')}) {
                            $newtplset = ${$config->getVar('conf_name')};
                            // clear all compiled and cachedfiles
Severity: Major
Found in htdocs/modules/system/admin/preferences/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/autotasks/class/autotasks.php - About 45 mins to fix

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

      function SmilesEdit($id) {
          $db = &icms_db_Factory::instance();
          icms_cp_header();
          echo '<a href="admin.php?fct=smilies">' . _AM_SMILESCONTROL . '</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;' . _AM_EDITSMILE . '<br /><br />';
          if ($getsmiles = $db->query("SELECT * FROM " . $db->prefix("smiles") . " WHERE id = '" . (int) $id . "'")) {
      Severity: Minor
      Found in htdocs/modules/system/admin/smilies/smilies.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 (file_exists($lookup_file)) {
                                  include_once $lookup_file;
                                  if (!empty($not_config['lookup_func']) && function_exists($not_config['lookup_func'])) {
                                      $lookup_func = $not_config['lookup_func'];
                                  }
      Severity: Major
      Found in htdocs/notifications.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if (!@unlink($src)) {
                                $error[] = sprintf(_MD_FAILUNLINK, $i);
                            }
        Severity: Major
        Found in htdocs/modules/system/admin/images/main.php - About 45 mins to fix

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

          function b_system_topposters_edit($options) {
              $inputtag = "<input type='text' name='options[]' value='" . (int) $options[0] . "' />";
              $form = sprintf(_MB_SYSTEM_DISPLAY, $inputtag);
              $form .= "<br />" . _MB_SYSTEM_DISPLAYA . "&nbsp;<input type='radio' id='options[]' name='options[]' value='1'";
              if ($options[1] == 1) {
          Severity: Minor
          Found in htdocs/modules/system/blocks/system_blocks.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 (!copy($src, $dest)) {
                                  $error[] = sprintf(_FAILSAVEIMG, $image_id[$i]);
                              }
          Severity: Major
          Found in htdocs/modules/system/admin/images/browser.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if (!empty($results[$i]['uid'])) {
                                            $uname = icms_member_user_Object::getUnameFromId($results[$i]['uid']);
                                            $results[$i]['processed_user_name'] = $uname;
                                            $results[$i]['processed_user_url'] = ICMS_URL . "/userinfo.php?uid=" . $results[$i]['uid'];
                                        }
            Severity: Major
            Found in htdocs/search.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if ($files[$i]->getVar('tpl_type') == 'block') {
                                          $path = $tplset . '/templates/' . $files[$i]->getVar('tpl_module') . '/blocks/' . $files[$i]->getVar('tpl_file');
                                          $xml .= "\r\n    <template name=\"" . $files[$i]->getVar('tpl_file') . "\">\r\n      <module>" . $files[$i]->getVar('tpl_module') . "</module>\r\n      <type>block</type>\r\n      <lastModified>" . $files[$i]->getVar('tpl_lastmodified') . "</lastModified>\r\n    </template>";
                                      } elseif ($files[$i]->getVar('tpl_type') == 'module') {
                                          $path = $tplset . '/templates/' . $files[$i]->getVar('tpl_module') . '/' . $files[$i]->getVar('tpl_file');
              Severity: Major
              Found in htdocs/modules/system/admin/tplsets/main.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/" . $moddir . "/" . $results[$i]['link'];
                                            }
                Severity: Major
                Found in htdocs/search.php - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if (!copy($src, $dest)) {
                                          $error[] = sprintf(_FAILSAVEIMG, $image_id[$i]);
                                      }
                  Severity: Major
                  Found in htdocs/modules/system/admin/images/main.php - About 45 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if (/\d/.test(value) && element && element.runtimeStyle && !(isPercentage && isViewport)) {
                                var style = element.style.left, rStyle = element.runtimeStyle.left;
                                element.runtimeStyle.left = element.currentStyle.left;
                                element.style.left = value || 0;
                                value = element.style.pixelLeft;
                    Severity: Major
                    Found in htdocs/install/prototype.js - About 40 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if ( support.matchesSelector && documentIsHTML &&
                                  ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
                                  ( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
                      
                                  try {
                      Severity: Major
                      Found in htdocs/install/prototype.js - About 40 mins to fix

                        Consider simplifying this complex logical expression.
                        Open

                                        if ( matcher[ expando ] ) {
                                            j = ++i;
                                            for ( ; j < len; j++ ) {
                                                if ( Expr.relative[ tokens[j].type ] ) {
                                                    break;
                        Severity: Major
                        Found in htdocs/install/prototype.js - About 40 mins to fix

                          Consider simplifying this complex logical expression.
                          Open

                                      if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
                                          (classNames && classNames.all(function(name) {
                                              return !name.toString().blank() && cn.include(' ' + name + ' ');
                                          }))))
                                          elements.push(Element.extend(child));
                          Severity: Major
                          Found in htdocs/install/prototype.js - About 40 mins to fix

                            Consider simplifying this complex logical expression.
                            Open

                                if(defined('SID') && SID && (!isset($_COOKIE[session_name()]) || ($icmsConfig['use_mysession'] && $icmsConfig['session_name'] != '' && !isset($_COOKIE[$icmsConfig['session_name']]))))
                                {
                                    if(!strstr($url, '?')) {$url .= '?' . SID;}
                                    else {$url .= '&amp;'.SID;}
                                }
                            Severity: Major
                            Found in htdocs/include/functions.php - About 40 mins to fix

                              Consider simplifying this complex logical expression.
                              Open

                              if (!empty($_POST)) {
                                  if (isset($_POST['com_dopost'])) {
                                      $op = 'post';
                                  } elseif (isset($_POST['com_dopreview'])) {
                                      $op = 'preview';
                              Severity: Major
                              Found in htdocs/include/comment_post.php - About 40 mins to fix

                                Consider simplifying this complex logical expression.
                                Open

                                    if ($edituser->getVar('uname') != $uname && $member_handler->getUserCount(new icms_db_criteria_Item('uname', $uname)) > 0 || $edituser->getVar('login_name') != $login_name && $member_handler->getUserCount(new icms_db_criteria_Item('login_name', $login_name)) > 0) {
                                        icms_cp_header();
                                        echo '<div class="CPbigTitle" style="background-image: url(' . ICMS_MODULES_URL . '/system/admin/users/images/users_big.png)">' . _MD_AM_USER . '</div><br />';
                                        echo _AM_UNAME . ' ' . $uname . ' ' . _AM_ALREADY_EXISTS;
                                        icms_cp_footer();
                                Severity: Major
                                Found in htdocs/modules/system/admin/users/users.php - About 40 mins to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                                      if ($password == $username || $password == icms_core_DataFilter::utf8_strrev($username, TRUE)
                                                          || strripos($password, $username) === TRUE || $password == $login_name
                                                          || $password == icms_core_Datafilter::utf8_strrev($login_name, TRUE)
                                                          || strripos($password, $login_name) === TRUE
                                                      ) {
                                  Severity: Major
                                  Found in htdocs/modules/system/admin/users/main.php - About 40 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language