ImpressCMS/impresscms

View on GitHub

Showing 47,251 of 47,256 total issues

Function easiestml has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function easiestml($s) {
    global $easiestml_lang, $icmsConfigMultilang;

    // all mode for debug (allowed to system admin only)
    if (is_object(icms::$user) && icms::$user->isAdmin(1) && ! empty($_GET['lang']) && $_GET['lang'] == 'all') {
Severity: Minor
Found in htdocs/include/im_multilanguage.php - About 2 hrs 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 modifyGroup has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function modifyGroup($g_id) {
    $userstart = $memstart = 0;
    if (!empty($_POST['userstart'])) {
        $userstart = (int) $_POST['userstart'];
    } elseif (!empty($_GET['userstart'])) {
Severity: Minor
Found in htdocs/modules/system/admin/groups/groups.php - About 2 hrs 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 SmilesAdmin has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function SmilesAdmin() {
    $db =& icms_db_Factory::instance();
    $url_smiles = ICMS_UPLOAD_URL;
    icms_cp_header();
    echo '<div class="CPbigTitle" style="background-image: url(' . ICMS_MODULES_URL . '/system/admin/smilies/images/smilies_big.png)">' . _AM_SMILESCONTROL . '</div><br />';
Severity: Minor
Found in htdocs/modules/system/admin/smilies/smilies.php - About 2 hrs 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 doRewrite has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    function doRewrite() {
        clearstatcache();
        if (! $file = fopen($this->path,"r")) {
            $this->error = true;
            return false;
Severity: Minor
Found in htdocs/install/class/mainfilemanager.php - About 2 hrs 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 Serializers has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Form.Element.Serializers = (function() {
    function input(element, value) {
        switch (element.type.toLowerCase()) {
            case 'checkbox':
            case 'radio':
Severity: Major
Found in htdocs/install/prototype.js - About 2 hrs to fix

    Method modifyUser has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function modifyUser($user) {
        global $icmsConfig, $icmsModule;
        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 />';
        $member_handler = icms::handler('icms_member');
    Severity: Major
    Found in htdocs/modules/system/admin/users/users.php - About 2 hrs to fix

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

              if (class_exists('icms_core_HTMLFilter')) {
                  $this->purifier = &icms_core_HTMLFilter::getInstance();
                  $this->method = 'htmlpurify';
              } else {
                  // use HTMLPurifier inside Protector
      htdocs/install/modules/protector/trust_path/modules/protector/filters_byconfig/postcommon_post_htmlpurify4everyone.php on lines 9..21

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

      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

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

          if (!$protector->check_sql_isolatedcommentin(@$conf['isocom_action'] & 1)) {
              if (($conf['isocom_action'] & 8) && $can_ban)
                  $protector->register_bad_ips();
              else if (($conf['isocom_action'] & 4) && $can_ban) $protector->register_bad_ips(time() + $protector->_conf['banip_time0']);
              $protector->output_log('ISOCOM', $uid, true, 32);
      htdocs/install/modules/protector/trust_path/modules/protector/include/postcheck_functions.php on lines 108..114

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

      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

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

          if (!$protector->check_sql_union(@$conf['union_action'] & 1)) {
              if (($conf['union_action'] & 8) && $can_ban)
                  $protector->register_bad_ips();
              else if (($conf['union_action'] & 4) && $can_ban) $protector->register_bad_ips(time() + $protector->_conf['banip_time0']);
              $protector->output_log('UNION', $uid, true, 32);
      htdocs/install/modules/protector/trust_path/modules/protector/include/postcheck_functions.php on lines 99..105

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

      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 (class_exists('icms_core_HTMLFilter')) {
                  $this->purifier = &icms_core_HTMLFilter::getInstance();
                  $this->method = 'htmlpurify';
              } else {
                  // use HTMLPurifier inside Protector
      htdocs/install/modules/protector/trust_path/modules/protector/filters_byconfig/postcommon_post_htmlpurify4guest.php on lines 14..26

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

      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 CHILD has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  "CHILD": function( type, what, argument, first, last ) {
                      var simple = type.slice( 0, 3 ) !== "nth",
                          forward = type.slice( -4 ) !== "last",
                          ofType = what === "of-type";
      
      
      Severity: Major
      Found in htdocs/install/prototype.js - About 2 hrs to fix

        Method xoops_header has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function xoops_header($closehead=true) {
            global $icmsConfig, $xoopsTheme, $icmsConfigPlugins, $icmsConfigMetaFooter;
            $myts =& icms_core_Textsanitizer::getInstance();
        
            if(!headers_sent())
        Severity: Major
        Found in htdocs/include/functions.php - About 2 hrs to fix

          Method imanager_updateimage has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function imanager_updateimage() {
              if (!icms::$security->check()) {
                  redirect_header('admin.php?fct=images', 3, implode('<br />', icms::$security->getErrors()));
              }
          
          
          Severity: Major
          Found in htdocs/modules/system/admin/images/main.php - About 2 hrs to fix

            File search.php has 265 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            // $Id: search.php 12313 2013-09-15 21:14:35Z skenow $
            //  ------------------------------------------------------------------------ //
            //                XOOPS - PHP Content Management System                      //
            //                    Copyright (c) 2000 XOOPS.org                           //
            Severity: Minor
            Found in htdocs/search.php - About 2 hrs to fix

              Method b_system_waiting_show has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function b_system_waiting_show($options) {
                  global $icmsConfig;
              
                  $userlang = $icmsConfig['language'] ;
              
              
              Severity: Major
              Found in htdocs/modules/system/blocks/system_waiting.php - About 2 hrs to fix

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

                    function pointerX(event) {
                        var docElement = document.documentElement,
                            body = document.body || { scrollLeft: 0 };
                
                        return event.pageX || (event.clientX +
                Severity: Major
                Found in htdocs/install/prototype.js and 1 other location - About 2 hrs to fix
                htdocs/install/prototype.js on lines 6804..6811

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

                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

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

                    function pointerY(event) {
                        var docElement = document.documentElement,
                            body = document.body || { scrollTop: 0 };
                
                        return  event.pageY || (event.clientY +
                Severity: Major
                Found in htdocs/install/prototype.js and 1 other location - About 2 hrs to fix
                htdocs/install/prototype.js on lines 6795..6802

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

                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

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    function isApplied()
                    {
                        if (!isset($_SESSION[__CLASS__]) || !is_array($_SESSION[__CLASS__])) {
                            $_SESSION[__CLASS__] = array();
                        }
                Severity: Major
                Found in upgrade/cnt-2.2.x-to-2.0.x/index.php and 2 other locations - About 2 hrs to fix
                upgrade/cnt-2.3.x-to-2.0.x/index.php on lines 19..32
                upgrade/upd-icms-1.0-to-1.1/index.php on lines 26..38

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

                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

                            } else {
                                $sig_tray = new icms_form_elements_Tray(_US_SIGNATURE, '<br />');
                                $sig_tarea = new icms_form_elements_Dhtmltextarea('', 'user_sig', icms::$user->getVar('user_sig', 'E'));
                                $sig_tray->addElement($sig_tarea);
                                $sig_cbox_value = icms::$user->getVar('attachsig') ? 1 : 0;
                Severity: Major
                Found in htdocs/edituser.php and 1 other location - About 2 hrs to fix
                htdocs/edituser.php on lines 345..361

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

                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

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                    public function isApplied() {
                        if (!isset($_SESSION[__CLASS__]) || !is_array($_SESSION[__CLASS__])) {
                            $_SESSION[__CLASS__] = array();
                        }
                        foreach ($this->tasks as $task) {
                Severity: Major
                Found in upgrade/upd-icms-1.0-to-1.1/index.php and 2 other locations - About 2 hrs to fix
                upgrade/cnt-2.2.x-to-2.0.x/index.php on lines 25..38
                upgrade/cnt-2.3.x-to-2.0.x/index.php on lines 19..32

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

                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

                Severity
                Category
                Status
                Source
                Language