ImpressCMS/impresscms

View on GitHub

Showing 47,251 of 47,256 total issues

File preferences.php has 361 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
// fichier:  .../modules/install/makedata.php
//              .../modules/system//include/update.php
//Gestion des pr�f�rences des modules syst�me, param�tres g�n�raux etc...
define("_AM_DBUPDATED","Base de donn&eacute;es mise &agrave; jour avec succ&egrave;s !");
Severity: Minor
Found in htdocs/modules/system/language/francais/admin/preferences.php - About 4 hrs to fix

    Function convert_table has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        private function convert_table($tables, $charset, $collation) {
            // Initialize vars.
            $string_querys = array();
            $binary_querys = array();
            $gen_index_querys = array();
    Severity: Minor
    Found in upgrade/upd-icms-1.0-to-1.1/index.php - About 4 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 xoops_header has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

    function xoops_header($closehead=true) {
        global $icmsConfig, $xoopsTheme, $icmsConfigPlugins, $icmsConfigMetaFooter;
        $myts =& icms_core_Textsanitizer::getInstance();
    
        if(!headers_sent())
    Severity: Minor
    Found in htdocs/include/functions.php - About 4 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 protector_prepare has a Cognitive Complexity of 31 (exceeds 5 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

    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 updateUser has a Cognitive Complexity of 31 (exceeds 5 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: Minor
    Found in htdocs/modules/system/admin/users/users.php - About 4 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_updateimage has a Cognitive Complexity of 31 (exceeds 5 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: Minor
    Found in htdocs/modules/system/admin/images/browser.php - About 4 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

    File comment_post.php has 357 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      File index.php has 355 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Upgrader from 2.2.* to 2.0.x
       *
       * @copyright   The XOOPS project http://www.xoops.org/
      Severity: Minor
      Found in upgrade/cnt-2.2.x-to-2.0.x/index.php - About 4 hrs to fix

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

                                $sql = "INSERT INTO " . $db->prefix("newblocks") . " (bid, mid, func_num, options, name, title, content, side, weight, visible, block_type, c_type, isactive, dirname, func_file, show_func, edit_func, template, bcachetime, last_modified) VALUES ('" . (int) $newbid . "', '" . (int) $newmid . "', '" . (int) $blockkey . "', '$options', '" . $block_name . "', '" . $block_name . "', '', '1', '0', '0', 'M', 'H', '1', '" . addslashes($dirname) . "', '" . addslashes(trim($block['file'])) . "', '" . addslashes(trim($block['show_func'])) . "', '" . addslashes($edit_func) . "', '" . $template . "', '0', '" . time() . "')";
        Severity: Major
        Found in htdocs/modules/system/admin/modulesadmin/modulesadmin.php and 1 other location - About 4 hrs to fix
        htdocs/install/modulesadmin.php on lines 186..186

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

        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

                                $sql = "INSERT INTO ".$db->prefix("newblocks")." (bid, mid, func_num, options, name, title, content, side, weight, visible, block_type, c_type, isactive, dirname, func_file, show_func, edit_func, template, bcachetime, last_modified) VALUES ('". (int) ($newbid)."', '". (int) ($newmid)."', '". (int) ($blockkey)."', '$options', '".$block_name."','".$block_name."', '', '1', '0', '0', 'M', 'H', '1', '".addslashes($dirname)."', '".addslashes(trim($block['file']))."', '".addslashes(trim($block['show_func']))."', '".addslashes($edit_func)."', '".$template."', '0', '".time()."')";
        Severity: Major
        Found in htdocs/install/modulesadmin.php and 1 other location - About 4 hrs to fix
        htdocs/modules/system/admin/modulesadmin/modulesadmin.php on lines 305..305

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

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

        function make_data(&$dbm, &$cm, $adminname, $adminlogin_name, $adminpass, $adminmail, $language, $gruops) {
        
            $tables = array();
        
            // data for table 'groups_users_link'
        Severity: Minor
        Found in htdocs/install/makedata.php - About 4 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_modules_show has a Cognitive Complexity of 30 (exceeds 5 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: Minor
        Found in htdocs/modules/system/blocks/system_admin_blocks.php - About 4 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

                    while ($counter <= $totalpages) {
                        if ($counter == $currentpage) {
                            $hiddenform .= "<strong>" . $counter . "</strong> ";
                        } elseif (($counter > $currentpage - 4 && $counter < $currentpage + 4) || $counter == 1 || $counter == $totalpages) {
                            if ($counter == $totalpages && $currentpage < $totalpages - 4) {
        Severity: Major
        Found in htdocs/modules/system/admin/findusers/main.php and 1 other location - About 4 hrs to fix
        htdocs/include/findusers.php on lines 571..586

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

        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

                        while ($counter <= $totalpages) {
                            if ($counter == $currentpage) {
        
                                $hiddenform .= "<strong>" . $counter . "</strong> ";
                            } elseif (($counter > $currentpage - 4 && $counter < $currentpage + 4) || $counter == 1 || $counter == $totalpages) {
        Severity: Major
        Found in htdocs/include/findusers.php and 1 other location - About 4 hrs to fix
        htdocs/modules/system/admin/findusers/main.php on lines 522..535

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

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

        jQuery.cookie = function(name, value, options) {
            if (typeof value != 'undefined') { // name and value given, set cookie
                options = options || {};
                if (value === null) {
                    value = '';
        Severity: Minor
        Found in htdocs/themes/reflex/js/cookie.js - About 4 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_getMonthNameById has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

        function Icms_getMonthNameById($month_id) {
            global $icmsConfig;
            icms_loadLanguageFile('core', 'calendar');
            $month_id = icms_conv_local2nr($month_id);
            if( $icmsConfig['use_ext_date'] == true && defined ('_CALENDAR_TYPE') && _CALENDAR_TYPE == "jalali"){
        Severity: Minor
        Found in htdocs/include/functions.php - About 4 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 checkSql has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            function checkSql($sql) {
                list($sql_wo_strings, $strings) = $this->separateStringsInSQL($sql);
        
                // stage1: addslashes() processed or not
                foreach ($this->doubtful_requests as $request) {

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

                if (getDbValue ( icms::$xoopsDB, 'newblocks', 'show_func', 'show_func="b_content_show"' ) == FALSE) {
                    $sql = "SELECT bid FROM `" . icms::$xoopsDB->prefix ( 'newblocks' ) . "` WHERE show_func='b_content_show'";
                    $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, 0);" );
        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 287..293
        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

                if (getDbValue ( icms::$xoopsDB, 'newblocks', 'show_func', 'show_func="b_content_menu_show"' ) == FALSE) {
                    $sql = "SELECT bid FROM `" . icms::$xoopsDB->prefix ( 'newblocks' ) . "` WHERE show_func='b_content_menu_show'";
                    $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, 0);" );
        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 287..293
        htdocs/modules/system/include/update-to-112.php on lines 295..301
        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

                if (getDbValue ( icms::$xoopsDB, 'newblocks', 'show_func', 'show_func="b_content_relmenu_show"' ) == FALSE) {
                    $sql = "SELECT bid FROM `" . icms::$xoopsDB->prefix ( 'newblocks' ) . "` WHERE show_func='b_content_relmenu_show'";
                    $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, 0);" );
        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 287..293
        htdocs/modules/system/include/update-to-112.php on lines 295..301
        htdocs/modules/system/include/update-to-112.php on lines 303..309

        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

        Severity
        Category
        Status
        Source
        Language