ImpressCMS/impresscms

View on GitHub

Showing 47,251 of 47,256 total issues

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

        if (getDbValue ( icms::$xoopsDB, 'newblocks', 'show_func', 'show_func="b_social_bookmarks"' ) == FALSE) {
            $sql = "SELECT bid FROM `" . icms::$xoopsDB->prefix ( 'newblocks' ) . "` WHERE show_func='b_social_bookmarks'";
            $result = icms::$xoopsDB->query ( $sql );
            list ( $new_block_id ) = icms::$xoopsDB->FetchRow ( $result );
            icms::$xoopsDB->queryF ( " INSERT INTO " . icms::$xoopsDB->prefix ( "block_module_link" ) . " VALUES (" . $new_block_id . ", 0, 1);" );
Severity: Major
Found in htdocs/modules/system/include/update-to-112.php and 3 other locations - About 4 hrs to fix
htdocs/modules/system/include/update-to-112.php on lines 295..301
htdocs/modules/system/include/update-to-112.php on lines 303..309
htdocs/modules/system/include/update-to-112.php on lines 311..317

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

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 4 locations. Consider refactoring.
Open

  $.keynav.goLeft = function () {
      var cur = $.keynav.getCurrent();
      var quad = $.keynav.quad(cur,function (dx,dy) { 
                                        if((dy >= 0) && (Math.abs(dx) - dy) <= 0)
                                            return true;    
Severity: Major
Found in htdocs/themes/reflex/js/jquery.keynav.js and 3 other locations - About 4 hrs to fix
htdocs/themes/reflex/js/jquery.keynav.js on lines 133..142
htdocs/themes/reflex/js/jquery.keynav.js on lines 144..153
htdocs/themes/reflex/js/jquery.keynav.js on lines 155..164

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

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 4 locations. Consider refactoring.
Open

  $.keynav.goRight = function () {
      var cur = $.keynav.getCurrent();
      var quad = $.keynav.quad(cur,function (dx,dy) { 
                                        if((dy <= 0) && (Math.abs(dx) + dy) <= 0)
                                            return true;    
Severity: Major
Found in htdocs/themes/reflex/js/jquery.keynav.js and 3 other locations - About 4 hrs to fix
htdocs/themes/reflex/js/jquery.keynav.js on lines 123..132
htdocs/themes/reflex/js/jquery.keynav.js on lines 144..153
htdocs/themes/reflex/js/jquery.keynav.js on lines 155..164

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

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 4 locations. Consider refactoring.
Open

  $.keynav.goUp = function () {
      var cur = $.keynav.getCurrent();
      var quad = $.keynav.quad(cur,function (dx,dy) { 
                                        if((dx >= 0) && (Math.abs(dy) - dx) <= 0)
                                            return true;    
Severity: Major
Found in htdocs/themes/reflex/js/jquery.keynav.js and 3 other locations - About 4 hrs to fix
htdocs/themes/reflex/js/jquery.keynav.js on lines 123..132
htdocs/themes/reflex/js/jquery.keynav.js on lines 133..142
htdocs/themes/reflex/js/jquery.keynav.js on lines 155..164

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

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 4 locations. Consider refactoring.
Open

  $.keynav.goDown = function () {
      var cur = $.keynav.getCurrent();
      var quad = $.keynav.quad(cur,function (dx,dy) { 
                                        if((dx <= 0) && (Math.abs(dy) + dx) <= 0)
                                            return true;    
Severity: Major
Found in htdocs/themes/reflex/js/jquery.keynav.js and 3 other locations - About 4 hrs to fix
htdocs/themes/reflex/js/jquery.keynav.js on lines 123..132
htdocs/themes/reflex/js/jquery.keynav.js on lines 133..142
htdocs/themes/reflex/js/jquery.keynav.js on lines 144..153

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

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

function impresscms_get_adminmenu() {
    $admin_menu = array();
    $modules_menu = array();
    $systemadm = false;

Severity: Major
Found in htdocs/include/cp_functions.php - About 4 hrs to fix

    Method protector_postcommon has 100 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function protector_postcommon() {
        global $xoopsModule;
    
        // configs writable check
        if (@$_SERVER['REQUEST_URI'] == '/admin.php' && !is_writable(dirname(__DIR__) . '/configs')) {

      File icms_version.php has 333 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      // language file (modinfo.php)
      if (file_exists(__DIR__ . '/language/' . @$GLOBALS['icmsConfig']['language'] . '/modinfo.php')) {
          include __DIR__ . '/language/' . @$GLOBALS['icmsConfig']['language'] . '/modinfo.php';

        Function Hash has 99 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var Hash = Class.create(Enumerable, (function() {
            function initialize(object) {
                this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
            }
        
        
        Severity: Major
        Found in htdocs/install/prototype.js - About 3 hrs to fix

          Method updateUser has 31 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function updateUser($uid, $uname, $login_name, $name, $url, $email, $user_icq, $user_aim, $user_yim,
                              $user_msnm, $user_from, $user_occ, $user_intrest, $user_viewemail, $user_avatar,
                              $user_sig, $attachsig, $theme, $pass, $pass2, $rank, $bio, $uorder, $umode, $notify_method,
                              $notify_mode, $timezone_offset, $user_mailok, $language,
                              $pass_expired, $groups = array()
          Severity: Major
          Found in htdocs/modules/system/admin/users/users.php - About 3 hrs to fix

            Function Class has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

            var Class = (function() {
            
                var IS_DONTENUM_BUGGY = (function(){
                    for (var p in { toString: 1 }) {
                        if (p === 'toString') return false;
            Severity: Minor
            Found in htdocs/install/prototype.js - About 3 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 icms_getModuleHandler has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

            function &icms_getModuleHandler($name = null, $module_dir = null, $module_basename = null, $optional = false) {
                static $handlers;
                // if $module_dir is not specified
                if (!isset($module_dir)) {
                    //if a module is loaded
            Severity: Minor
            Found in htdocs/include/functions.php - About 3 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 redirect_header has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

            function redirect_header($url, $time = 3, $message = '', $addredirect = true, $allowExternalLink = false)
            {
                global $icmsConfig, $icmsConfigPersona;
                if(preg_match("/[\\0-\\31]|about:|script:/i", $url))
                {
            Severity: Minor
            Found in htdocs/include/functions.php - About 3 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 b_system_admin_warnings_show has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

            function b_system_admin_warnings_show() {
                $block = array();
                $block['msg'] = array();
            
                // Check if PDO is being used - if not, issue a warning, because it is being removed from PHP
            Severity: Minor
            Found in htdocs/modules/system/blocks/system_admin_blocks.php - About 3 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

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

                        if ($oldavatar && preg_match("/^cavt/", strtolower($oldavatar))) {
                            $avatars =& $avt_handler->getObjects(new icms_db_criteria_Item('avatar_file', $oldavatar));
                            if (!empty($avatars) && count($avatars) == 1 && is_object($avatars[0])) {
                                $avt_handler->delete($avatars[0]);
                                $oldavatar_path = str_replace("\\", "/", realpath(ICMS_UPLOAD_PATH . '/' . $oldavatar));
            Severity: Major
            Found in htdocs/edituser.php and 1 other location - About 3 hrs to fix
            htdocs/edituser.php on lines 514..523

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

            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 (!empty($oldavatar) && preg_match("/^cavt/", strtolower($oldavatar))) {
                                        $avatars =& $avt_handler->getObjects(new icms_db_criteria_Item('avatar_file', $oldavatar));
                                        if (!empty($avatars) && count($avatars) == 1 && is_object($avatars[0])) {
                                            $avt_handler->delete($avatars[0]);
                                            $oldavatar_path = str_replace("\\", "/", realpath(ICMS_UPLOAD_PATH . '/' . $oldavatar));
            Severity: Major
            Found in htdocs/edituser.php and 1 other location - About 3 hrs to fix
            htdocs/edituser.php on lines 581..590

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

            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

                        switch ($this->_conf['dos_f5action']) {
                            default:
                            case 'exit':
                                $this->output_log($this->last_error_type, $uid, true, 16);
                                exit();
            htdocs/install/modules/protector/trust_path/modules/protector/class/protector.php on lines 805..825

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

            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

                        switch ($this->_conf['dos_craction']) {
                            default:
                            case 'exit':
                                $this->output_log($this->last_error_type, $uid, true, 16);
                                exit();
            htdocs/install/modules/protector/trust_path/modules/protector/class/protector.php on lines 759..779

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

            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 addItem has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

            function addItem(itemurl, name, target, cat, url, type) {
                var win = opener;
                var campo = win.document.getElementById(target);
                var opcoes = win.document.getElementById('img_cat_'+cat);
                var imagem = win.document.getElementById(target+'_img');
            Severity: Minor
            Found in htdocs/modules/system/admin/images/js/imanager.js - About 3 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 imanager_index has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

            function imanager_index($imgcat_id = NULL) {
                global $icmsTpl, $icmsConfig, $target, $type, $limit;
            
                if (!is_object(icms::$user)) {
                    $groups = array(ICMS_GROUP_ANONYMOUS);
            Severity: Minor
            Found in htdocs/modules/system/admin/images/browser.php - About 3 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

            Severity
            Category
            Status
            Source
            Language