ImpressCMS/impresscms

View on GitHub

Showing 47,251 of 47,256 total issues

Function icms_getModuleConfig has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function &icms_getModuleConfig($moduleName = false)
{
    static $icmsConfigs;
    if(isset ($icmsConfigs[$moduleName]))
    {
Severity: Minor
Found in htdocs/include/functions.php - About 1 hr 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 __construct has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    function __construct() {
        if (isset( $_SESSION['settings']['ROOT_PATH'] )) {
            $this->xoopsRootPath = $_SESSION['settings']['ROOT_PATH'];
        } else {
            $path = str_replace( "\\", "/", @realpath( '../' ) );
Severity: Minor
Found in htdocs/install/page_pathsettings.php - About 1 hr 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 AllowedMimeTypes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function AllowedMimeTypes() {
        $GrantedItems =  $this->UserCanUpload();
        $array = array();
        $grantedItemValues = array_values($GrantedItems);
        if (!empty($grantedItemValues)) {
Severity: Minor
Found in htdocs/modules/system/admin/mimetype/class/mimetype.php - About 1 hr 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_login_show has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function b_system_login_show() {
    global $icmsConfig, $icmsConfigAuth, $icmsConfigUser;
    if (!icms::$user) {
        $block = array();
        $block['lang_username'] = _USERNAME;
Severity: Minor
Found in htdocs/modules/system/blocks/system_blocks.php - About 1 hr 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_updatecat has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function imanager_updatecat() {
    /* because we are using a function, the GET/POST variables are not in scope */
    global $imgcat_id, $imgcat_name, $imgcat_display, $imgcat_maxsize, $imgcat_maxwidth, $imgcat_maxheight, $imgcat_weight, $readgroup, $writegroup;
    if (!icms::$security->check() || $imgcat_id <= 0) {
        redirect_header('admin.php?fct=images', 1, implode('<br />', icms::$security->getErrors()));
Severity: Minor
Found in htdocs/modules/system/admin/images/main.php - About 1 hr 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_reordercateg has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function imanager_reordercateg() {
    if (!icms::$security->check()) {
        redirect_header('admin.php?fct=images', 1, implode('<br />', icms::$security->getErrors()));
    }
    $count = count($_POST['imgcat_weight']);
Severity: Minor
Found in htdocs/modules/system/admin/images/main.php - About 1 hr 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 xoFormFieldCharset has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function xoFormFieldCharset($name, $value, $label, $link, $help = '') {
    if (version_compare(getDBVersion($link), "4.1.0", "lt")) {
        return "";
    }
    if (!$chars = getDbCharsets($link)) {
Severity: Minor
Found in htdocs/install/page_dbsettings.php - About 1 hr to fix

    Method Generate_PDF has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Generate_PDF ($content, $doc_title, $doc_keywords) {
        global $icmsConfig;
        require_once ICMS_PDF_LIB_PATH.'/tcpdf.php';
        icms_loadLanguageFile('core', 'pdf');
        $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
    Severity: Minor
    Found in htdocs/include/pdf.php - About 1 hr to fix

      Method makeWritable has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function makeWritable( $path, $group = false, $recurse = false) {
              if (!file_exists( $path )) {
                  return false;
              }
              $perm = @is_dir( $path ) ? 6 : 7;
      Severity: Minor
      Found in htdocs/install/page_pathsettings.php - About 1 hr to fix

        Method getHtml4Assign has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function getHtml4Assign() {
                $as_md5 = $this->getMd5();
                $as_md5array = preg_split('//', $as_md5, -1, PREG_SPLIT_NO_EMPTY);
                $as_md5shuffle = array ();
                foreach ($as_md5array as $key => $val) {

          Method imanager_delfileok has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function imanager_delfileok($image_id, $redir = NULL) {
              if (!icms::$security->check()) {
                  redirect_header('admin.php?fct=images', 3, implode('<br />', icms::$security->getErrors()));
              }
          
          
          Severity: Minor
          Found in htdocs/modules/system/admin/images/main.php - About 1 hr to fix

            Method imanager_editcat has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function imanager_editcat($imgcat_id) {
                if ($imgcat_id <= 0) {
                    redirect_header('admin.php?fct=images', 1);
                }
                $imgcat_handler = icms::handler('icms_image_category');
            Severity: Minor
            Found in htdocs/modules/system/admin/images/main.php - About 1 hr to fix

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

                                  if (!$gperm_handler->insert($mperm)) {
                                      $msgs[] = sprintf('&nbsp;&nbsp;<span style="color:#ff0000;">' . _MD_AM_ADMIN_PERM_ADD_FAIL . '</span>', '<strong>' . icms_conv_nr2local($mygroup) . '</strong>');
                                  } else {
                                      $msgs[] = sprintf('&nbsp;&nbsp;' . _MD_AM_ADMIN_PERM_ADDED, '<strong>' . icms_conv_nr2local($mygroup) . '</strong>');
                                  }
              Severity: Major
              Found in htdocs/modules/system/admin/modulesadmin/modulesadmin.php and 1 other location - About 1 hr to fix
              htdocs/modules/system/admin/modulesadmin/modulesadmin.php on lines 466..470

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

              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

                          if (count($system_catids) > 0) {
                              array_push($admin_mids, 1);
                              foreach ($system_catids as $s_cid) {
              
                                  $sysperm =& $gperm_handler->create();
              Severity: Major
              Found in htdocs/modules/system/admin/groups/main.php and 1 other location - About 1 hr to fix
              htdocs/modules/system/admin/groups/main.php on lines 117..129

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

              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

                              if (!$gperm_handler->insert($mperm)) {
                                  $msgs[] = sprintf('&nbsp;&nbsp;<span style="color:#ff0000;">' . _MD_AM_USER_PERM_ADD_FAIL . '</span>', '<strong>' . icms_conv_nr2local($mygroup) . '</strong>');
                              } else {
                                  $msgs[] = sprintf('&nbsp;&nbsp;' . _MD_AM_USER_PERM_ADDED, '<strong>' . icms_conv_nr2local($mygroup) . '</strong>');
                              }
              Severity: Major
              Found in htdocs/modules/system/admin/modulesadmin/modulesadmin.php and 1 other location - About 1 hr to fix
              htdocs/modules/system/admin/modulesadmin/modulesadmin.php on lines 454..458

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

              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

                          if (count($system_catids) > 0) {
                              array_push($admin_mids, 1);
                              foreach ($system_catids as $s_cid) {
              
                                  $sysperm =& $gperm_handler->create();
              Severity: Major
              Found in htdocs/modules/system/admin/groups/main.php and 1 other location - About 1 hr to fix
              htdocs/modules/system/admin/groups/main.php on lines 234..245

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

              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

              Function getElementsByClassName has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
                  function iter(name) {
                      return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
                  }
              
              
              Severity: Minor
              Found in htdocs/install/prototype.js - About 1 hr to fix

                Function addMethods has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function addMethods(source) {
                        var ancestor   = this.superclass && this.superclass.prototype,
                            properties = Object.keys(source);
                
                        if (IS_DONTENUM_BUGGY) {
                Severity: Minor
                Found in htdocs/install/prototype.js - About 1 hr to fix

                  Method icms_purifyText has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function icms_purifyText($text, $keyword = false) {
                      $text = str_replace('&nbsp;', ' ', $text);
                      $text = str_replace('<br />', ' ', $text);
                      $text = str_replace('<br/>', ' ', $text);
                      $text = str_replace('<br', ' ', $text);
                  Severity: Minor
                  Found in htdocs/include/functions.php - About 1 hr to fix

                    Method xoops_comment_delete has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function xoops_comment_delete($module_id, $item_id)
                    {
                        if( (int) ($module_id) > 0 && (int) ($item_id) > 0)
                        {
                            $comment_handler = icms::handler('icms_data_comment');
                    Severity: Minor
                    Found in htdocs/include/functions.php - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language