ImpressCMS/impresscms

View on GitHub

Showing 47,251 of 47,256 total issues

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

        foreach ($grps as $k => $v) {
            $stararr = explode('-', $icmsConfig['startpage'][$k]);
            if (count($stararr) > 0) {
                if ($module->getVar('mid') == $stararr[0]) {
                    return "<p>" . sprintf(_MD_AM_FAILDEACT, "<strong>" . $module->getVar('name') . "</strong>") . "&nbsp;" . _MD_AM_ERRORSC . "<br /> - " . _MD_AM_STRTNO . "</p>";
Severity: Major
Found in htdocs/modules/system/admin/modulesadmin/modulesadmin.php and 1 other location - About 2 hrs to fix
htdocs/modules/system/admin/modulesadmin/modulesadmin.php on lines 649..656

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

        foreach ($grps as $k => $v) {
            $stararr = explode('-', $icmsConfig['startpage'][$k]);
            if (count($stararr) > 0) {
                if ($module->getVar('mid') == $stararr[0]) {
                    return "<p>" . sprintf(_MD_AM_FAILDEACT, "<strong>" . $module->getVar('name') . "</strong>") . "&nbsp;" . _MD_AM_ERRORSC . "<br /> - " . _MD_AM_STRTNO . "</p>";
Severity: Major
Found in htdocs/modules/system/admin/modulesadmin/modulesadmin.php and 1 other location - About 2 hrs to fix
htdocs/modules/system/admin/modulesadmin/modulesadmin.php on lines 891..898

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

            if ($icmsConfigUser['allow_htsig'] == 0) {
                $sig_tray = new icms_form_elements_Tray(_US_SIGNATURE, '<br />');
                $sig_tarea = new icms_form_elements_Textarea('', '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 353..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

    function isApplied()
    {
        if (!isset($_SESSION[__CLASS__]) || !is_array($_SESSION[__CLASS__])) {
            $_SESSION[__CLASS__] = array();
        }
Severity: Major
Found in upgrade/cnt-2.3.x-to-2.0.x/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/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

Consider simplifying this complex logical expression.
Open

    if ( text != null && text != "" ) {
        if (enterCodeLangPhrase == null) {
            enterCodeLangPhrase = "Now, enter the language of your code.";
        }
        if (CodeLangTypePhrase == null) {
Severity: Critical
Found in htdocs/include/xoops.js - About 2 hrs to fix

    Consider simplifying this complex logical expression.
    Open

                                if ( forward && useCache ) {
                                    outerCache = parent[ expando ] || (parent[ expando ] = {});
                                    cache = outerCache[ type ] || [];
                                    nodeIndex = cache[0] === dirruns && cache[1];
                                    diff = cache[0] === dirruns && cache[2];
    Severity: Critical
    Found in htdocs/install/prototype.js - About 2 hrs to fix

      Method blocks_engine_upgrade has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function blocks_engine_upgrade() {
              echo '<h2>Updating blocks engine </h2>';
              if (!$this->table_exists('block_positions')) {
                  $xoopsDB = $GLOBALS['xoopsDB'];
                  $query = "CREATE TABLE `" . $xoopsDB->prefix('block_positions') . "` (
      Severity: Major
      Found in upgrade/upd-2.0.18-to-impresscms-1.0/index.php - About 2 hrs to fix

        Method xoops_module_list has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function xoops_module_list() {
            global $icmsAdminTpl, $icmsConfig;
        
            $icmsAdminTpl->assign('lang_madmin', _MD_AM_MODADMIN);
            $icmsAdminTpl->assign('lang_module', _MD_AM_MODULE);
        Severity: Major
        Found in htdocs/modules/system/admin/modulesadmin/modulesadmin.php - About 2 hrs to fix

          Method SmilesAdmin has 57 lines of code (exceeds 25 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: Major
          Found in htdocs/modules/system/admin/smilies/smilies.php - About 2 hrs to fix

            Method b_system_admin_modules_show has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function b_system_admin_modules_show() {
                $block['mods'] = array();
                $module_handler = icms::handler('icms_module');
                $moduleperm_handler = icms::handler('icms_member_groupperm');
                $criteria = new icms_db_criteria_Compo();
            Severity: Major
            Found in htdocs/modules/system/blocks/system_admin_blocks.php - About 2 hrs to fix

              Method imanager_updatecat has 57 lines of code (exceeds 25 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: Major
              Found in htdocs/modules/system/admin/images/main.php - About 2 hrs to fix

                Function xoopsValidate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                function xoopsValidate(subjectId, textareaId, submitId, plzCompletePhrase, msgTooLongPhrase, allowedCharPhrase, currCharPhrase) {
                    var maxchars = 65535;
                    var subjectDom = xoopsGetElementById(subjectId);
                    var textareaDom = xoopsGetElementById(textareaId);
                    var submitDom = xoopsGetElementById(submitId);
                Severity: Minor
                Found in htdocs/include/xoops.js - 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 apply_0523patch has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    function apply_0523patch() {
                        $patchCode = "
                    foreach ( array('GLOBALS', '_SESSION', 'HTTP_SESSION_VARS', '_GET', 'HTTP_GET_VARS', '_POST', 'HTTP_POST_VARS', '_COOKIE', 'HTTP_COOKIE_VARS', '_REQUEST', '_SERVER', 'HTTP_SERVER_VARS', '_ENV', 'HTTP_ENV_VARS', '_FILES', 'HTTP_POST_FILES', 'xoopsDB', 'xoopsUser', 'xoopsUserId', 'xoopsUserGroups', 'xoopsUserIsAdmin', 'xoopsConfig', 'xoopsOption', 'xoopsModule', 'xoopsModuleConfig', 'xoopsRequestUri') as \$bad_global) {
                        if (isset( \$_REQUEST[\$bad_global] )) {
                            header( 'Location: '.XOOPS_URL.'/' );
                Severity: Minor
                Found in upgrade/upd-2.0.13-to-2.0.14/index.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 xoopsCodeCode has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                function xoopsCodeCode(id, enterCodePhrase, enterCodeLangPhrase, CodeLangTypePhrase, errorCodeLangPhrase){
                    if (enterCodePhrase == null) {
                        enterCodePhrase = "Enter the codes that you want to add.";
                    }
                    var text = prompt(enterCodePhrase, "");
                Severity: Minor
                Found in htdocs/include/xoops.js - 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

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

                            'right': function(element) {
                                var offset = element.positionedOffset(),
                                    parent = element.getOffsetParent(),
                                    pWidth = parent.measure('width');
                
                
                Severity: Major
                Found in htdocs/install/prototype.js and 1 other location - About 2 hrs to fix
                htdocs/install/prototype.js on lines 3874..3882

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

                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

                            'bottom': function(element) {
                                var offset = element.positionedOffset(),
                                    parent = element.getOffsetParent(),
                                    pHeight = parent.measure('height');
                
                
                Severity: Major
                Found in htdocs/install/prototype.js and 1 other location - About 2 hrs to fix
                htdocs/install/prototype.js on lines 3889..3897

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

                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

                Method apply_0523patch has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function apply_0523patch() {
                        $patchCode = "
                    foreach ( array('GLOBALS', '_SESSION', 'HTTP_SESSION_VARS', '_GET', 'HTTP_GET_VARS', '_POST', 'HTTP_POST_VARS', '_COOKIE', 'HTTP_COOKIE_VARS', '_REQUEST', '_SERVER', 'HTTP_SERVER_VARS', '_ENV', 'HTTP_ENV_VARS', '_FILES', 'HTTP_POST_FILES', 'xoopsDB', 'xoopsUser', 'xoopsUserId', 'xoopsUserGroups', 'xoopsUserIsAdmin', 'xoopsConfig', 'xoopsOption', 'xoopsModule', 'xoopsModuleConfig', 'xoopsRequestUri') as \$bad_global) {
                        if (isset( \$_REQUEST[\$bad_global] )) {
                            header( 'Location: '.XOOPS_URL.'/' );
                Severity: Major
                Found in upgrade/upd-2.0.13-to-2.0.14/index.php - About 2 hrs to fix

                  Method protector_prepare has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function protector_prepare() {
                      // check the access is from install/index.php
                      if (defined('_INSTALL_CHARSET') && !defined("XOOPS_MAINFILE_INCLUDED")) die('To use installer, remove the following plugin first: /plugins/preload/protector.php');
                  
                      // Protector class

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

                    function imanager_updateimage() {
                        /* because we are using a function, the GET/POST variables are not in scope */
                        global $image_id, $image_display, $image_weight, $image_nicename, $imgcat_id;
                    
                        if (!icms::$security->check()) {
                    Severity: Major
                    Found in htdocs/modules/system/admin/images/browser.php - About 2 hrs to fix

                      File misc.php has 260 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      // $Id: misc.php 12399 2014-01-25 17:02:01Z skenow $
                      //  ------------------------------------------------------------------------ //
                      //                XOOPS - PHP Content Management System                      //
                      //                    Copyright (c) 2000 XOOPS.org                           //
                      Severity: Minor
                      Found in htdocs/misc.php - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language