XoopsModules25x/xoopsinfo

View on GitHub

Showing 1,065 of 16,781 total issues

Avoid deeply nested control flow statements.
Open

                            switch ($bufferWB[$bi]['BatteryStatus']) {
                                case  1: $batstat = 'Discharging'; break;
                                case  2: $batstat = 'AC connected'; break;
                                case  3: $batstat = 'Fully Charged'; break;
                                case  4: $batstat = 'Low'; break;
Severity: Major
Found in phpsysinfo/plugins/bat/class.bat.inc.php - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                switch ($bufferWPB[$bi]['Chemistry']) {
                                    case 1: $techn = 'Other'; break;
                                    case 2: $techn = 'Unknown'; break;
                                    case 3: $techn = 'PbAc'; break;
                                    case 4: $techn = 'NiCd'; break;
    Severity: Major
    Found in phpsysinfo/plugins/bat/class.bat.inc.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if (($rfts_bi && ($infoitem!=='')) || ($rfts_bs && ($stateitem!==''))) {
                                      if (preg_match('/^\/proc\/acpi\/battery\/(.+)\/info$/', $batdevices[$i], $batname)) {
                                          if ($infoitem!=='') {
                                              $infoitem .= 'POWER_SUPPLY_NAME='.$batname[1]."\n";
                                          } else {
      Severity: Major
      Found in phpsysinfo/plugins/bat/class.bat.inc.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if (isset($bufferBS[$bi]['RemainingCapacity']) &&
                                       (($bufferBS[$bi]['RemainingCapacity']>0) || ($hasvolt && ($bufferBS[$bi]['RemainingCapacity']==0)))) {
                                        $buffer[$bi]['state'] .= 'POWER_SUPPLY_ENERGY_NOW='.($bufferBS[$bi]['RemainingCapacity']*1000)."\n";
                                        $capacity = '';
                                    }
        Severity: Major
        Found in phpsysinfo/plugins/bat/class.bat.inc.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if (isset($this->_result['devices'][$prefix.$details[2]])) {
                                          $this->_result['devices'][$prefix.$details[2]]['items'][$details[0]]['parentid'] = 1;
                                          $this->_result['devices'][$prefix.$details[2]]['items'][$details[0]]['type'] = 'disk';
                                          $this->_result['devices'][$prefix.$details[2]]['items'][$details[0]]['name'] = $details[0];
                                          if ($details[3] !== 'online') {
          Severity: Major
          Found in phpsysinfo/plugins/raid/class.raid.inc.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if ($rootoffset === false) { // first line means root
                                            $rootoffset = $offset;
                                            $this->_result['devices'][$group]['items'][$id]['name'] = "";//$fullbuff[0];
                                            if (count($fullbuff) > 1) {
                                                $this->_result['devices'][$group]['items'][$id]['status'] = $fullbuff[1];
            Severity: Major
            Found in phpsysinfo/plugins/raid/class.raid.inc.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if (preg_match('/^"?([^\."]*)\.?([^"]*)/', $line, $matches2)) {
              
                                      if (!defined('PSI_SYSTEM_CODEPAGE') && isset($matches2[2]) && !is_null($matches2[2]) && (trim($matches2[2]) != "")) { //also if not overloaded in phpsysinfo.ini
                                          define('PSI_SYSTEM_CODEPAGE', $matches2[2]);
                                      }
              Severity: Major
              Found in phpsysinfo/read_config.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                while (false !== ($sentry = readdir($shandle))) {
                                    if (($sentry!=".")&&($sentry!="..")) {
                                        $log_file=PSI_APP_ROOT.'/sample/distrotest/'.$entry.'/'.$sentry;
                                        echo "<tr>";
                                        echo "<td>".$entry.'/'.$sentry."</td>";
                Severity: Major
                Found in phpsysinfo/tools/checkdistro.php - About 45 mins to fix

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

                  function filemtime_override($dirname, $template, $theme = '', $block = false)
                  {
                      global $xoopsConfig;
                  
                      $themeset = '' == $theme ? $xoopsConfig['theme_set'] : $theme;
                  Severity: Minor
                  Found in modules/xoopsinfo/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 ($details[5] !== 'optimal') {
                                                  $this->_result['devices'][$prefix.$details[0]]['items'][$details[0]]['info'] = $details[5];
                                              }
                  Severity: Major
                  Found in phpsysinfo/plugins/raid/class.raid.inc.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                if ($lastparentids[$indent] >= 0) {
                                                    if (isset($this->_result['devices'][$group]['items'][$lastparentids[$indent]]['childs'])) {
                                                        $this->_result['devices'][$group]['items'][$lastparentids[$indent]]['childs']++;
                                                    } else {
                                                        $this->_result['devices'][$group]['items'][$lastparentids[$indent]]['childs'] = 1;
                    Severity: Major
                    Found in phpsysinfo/plugins/raid/class.raid.inc.php - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if ($offset < $rootoffset) { // some errors
                                                      continue;
                                                  }
                      Severity: Major
                      Found in phpsysinfo/plugins/raid/class.raid.inc.php - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                        if (!defined('PSI_SYSTEM_CODEPAGE')) {
                                            if (file_exists($vtfname = '/sys/module/vt/parameters/default_utf8')
                                               && (trim(@file_get_contents($vtfname)) === "1")) {
                                                    define('PSI_SYSTEM_CODEPAGE', 'UTF-8');
                                            } elseif (@exec($matches[1].' locale -k LC_CTYPE 2>/dev/null', $lines)) { //if not overloaded in phpsysinfo.ini
                        Severity: Major
                        Found in phpsysinfo/read_config.php - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                      if ($controller !== '') $this->_result['devices'][$prefix.$itemn]['controller'] = $controller;
                          Severity: Major
                          Found in phpsysinfo/plugins/raid/class.raid.inc.php - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                        if (count($fullbuff) > 1) {
                                                            $this->_result['devices'][$group]['items'][$id]['status'] = $fullbuff[1];
                                                        }
                            Severity: Major
                            Found in phpsysinfo/plugins/raid/class.raid.inc.php - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                              if (is_dir($dir)) {
                                                  if ($dh = opendir($dir)) {
                                                      while (false !== ($file = readdir($dh))) {
                                                          if ('dir' !== filetype($dir . '/' . $file) && 'index.html' !== $file) {
                                                              @unlink($dir . '/' . $file);
                              Severity: Major
                              Found in modules/xoopsinfo/admin/rescue.php - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                                if (($id != 0) && ($id != 255)) {
                                                                    switch ($id) {
                                                                        case 3:
                                                                            //raw16(avg16)
                                                                            $this->_filecontent[$_name] .= $id." ID".$id." 0x".substr("0".dechex($asdvs[$c+2]),-2).substr("0".dechex($asdvs[$c+1]),-2)." ".substr("00".$asdvs[$c+3],-3)." ".substr("00".$asdvs[$c+4],-3)." ".($asdvs[$c+5]+256*$asdvs[$c+6])."\n";
                                Severity: Major
                                Found in phpsysinfo/plugins/smart/class.smart.inc.php - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                              if (count($fullbuff) > 5) {
                                                                  $this->_result['devices'][$group]['items'][$id]['info'] = $fullbuff[5];
                                                              }
                                  Severity: Major
                                  Found in phpsysinfo/plugins/raid/class.raid.inc.php - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                    if (is_readable(PSI_APP_ROOT.'/data/languages.ini') && ($langdata = @parse_ini_file(PSI_APP_ROOT.'/data/languages.ini', true))) {
                                                        if (isset($langdata['Linux']['_'.$lines[0]])) {
                                                            $lang = $langdata['Linux']['_'.$lines[0]];
                                                        }
                                                    }
                                    Severity: Major
                                    Found in phpsysinfo/read_config.php - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                                  if ($controller !== '') $this->_result['devices'][$prefix.$details[0]]['controller'] = $controller;
                                      Severity: Major
                                      Found in phpsysinfo/plugins/raid/class.raid.inc.php - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language