ImpressCMS/impresscms

View on GitHub

Showing 47,251 of 47,256 total issues

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

<?php
// 08/2008 Updated and adapted for ImpressCMS by evoc - webmaster of www.impresscms.it
// Published by ImpressCMS Italian Official Support Site - www.impresscms.it
// Updated by Ianez - Xoops Italia Staff
// Original translation by Marco Ragogna (blueangel)
Severity: Major
Found in htdocs/modules/system/language/italiano/admin/avatars.php and 7 other locations - About 1 hr to fix
htdocs/modules/system/language/english/admin/avatars.php on lines 1..14
htdocs/modules/system/language/english/admin/comments.php on lines 1..14
htdocs/modules/system/language/francais/admin/avatars.php on lines 1..13
htdocs/modules/system/language/francais/admin/comments.php on lines 1..12
htdocs/modules/system/language/italiano/admin/comments.php on lines 1..18
htdocs/modules/system/language/nederlands/admin/avatars.php on lines 1..13
htdocs/modules/system/language/nederlands/admin/comments.php on lines 1..12

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

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 ($items_atasks as $task) {
                $taskID = (int) $task->getVar('sat_addon_id');
                $atasks[$taskID]['enabled'] = $task->getVar('sat_enabled');
                $atasks[$taskID]['repeat'] = $task->getVar('sat_repeat');
                $atasks[$taskID]['interval'] = $task->getVar('sat_interval');
Severity: Major
Found in htdocs/modules/system/admin/modulesadmin/modulesadmin.php and 1 other location - About 1 hr to fix
htdocs/install/modulesadmin.php on lines 838..844

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

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 (!empty($not_config['lookup_file'])) {
                        $lookup_file = ICMS_ROOT_PATH . '/modules/' . $module->getVar('dirname') . '/' . $not_config['lookup_file'];
                        if (file_exists($lookup_file)) {
                            include_once $lookup_file;
                            if (!empty($not_config['lookup_func']) && function_exists($not_config['lookup_func'])) {
Severity: Major
Found in htdocs/notifications.php and 1 other location - About 1 hr to fix
htdocs/modules/system/blocks/system_blocks.php on lines 667..675

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

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

                        } elseif ($files[$i]->getVar('tpl_type') == 'module') {
                            $path = $tplset . '/templates/' . $files[$i]->getVar('tpl_module') . '/' . $files[$i]->getVar('tpl_file');
                            $xml .= "\r\n    <template name=\"" . $files[$i]->getVar('tpl_file') . "\">\r\n      <module>" . $files[$i]->getVar('tpl_module') . "</module>\r\n      <type>module</type>\r\n      <lastModified>" . $files[$i]->getVar('tpl_lastmodified') . "</lastModified>\r\n    </template>";
                        }
Severity: Major
Found in htdocs/modules/system/admin/tplsets/main.php and 1 other location - About 1 hr to fix
htdocs/modules/system/admin/tplsets/main.php on lines 687..693

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

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 (!empty($not_config['lookup_file'])) {
                $lookup_file = ICMS_MODULES_PATH . '/' . $module->getVar('dirname') . '/' . $not_config['lookup_file'];
                if (file_exists($lookup_file)) {
                    include_once $lookup_file;
                    if (!empty($not_config['lookup_func']) && function_exists($not_config['lookup_func'])) {
Severity: Major
Found in htdocs/modules/system/blocks/system_blocks.php and 1 other location - About 1 hr to fix
htdocs/notifications.php on lines 119..127

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

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

<?php
// $Id: comments.php 11344 2011-08-30 16:33:29Z phoenyx $
//%%%%%% Comment Manager %%%%%
define('_MD_AM_COMMMAN','Comment Manager');

Severity: Major
Found in htdocs/modules/system/language/english/admin/comments.php and 7 other locations - About 1 hr to fix
htdocs/modules/system/language/english/admin/avatars.php on lines 1..14
htdocs/modules/system/language/francais/admin/avatars.php on lines 1..13
htdocs/modules/system/language/francais/admin/comments.php on lines 1..12
htdocs/modules/system/language/italiano/admin/avatars.php on lines 1..19
htdocs/modules/system/language/italiano/admin/comments.php on lines 1..18
htdocs/modules/system/language/nederlands/admin/avatars.php on lines 1..13
htdocs/modules/system/language/nederlands/admin/comments.php on lines 1..12

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

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

    request: function(url) {
        this.url = url;
        this.method = this.options.method;
        var params = Object.isString(this.options.parameters) ?
            this.options.parameters :
Severity: Minor
Found in htdocs/install/prototype.js - About 1 hr to fix

    Method load_invite_code has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function load_invite_code($code) {
        // validate if code is of valid length.
        if (empty($code) || strlen($code) != 8) {
            header('Location: invite.php');
            // redirect_header('invite.php', 0, _US_INVITENONE);
    Severity: Minor
    Found in htdocs/include/checkinvite.php - About 1 hr to fix

      Method apply_config has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function apply_config()
          {
              $db = $GLOBALS['xoopsDB'];
              // remove configuration items
              $db->queryF("DELETE FROM `" . $db->prefix('config') . "` WHERE conf_name='cpanel'");
      Severity: Minor
      Found in upgrade/cnt-2.3.x-to-2.0.x/index.php - About 1 hr to fix

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

                for (i=0;i<=Filters.length-1;i++){
                    if (Filters[i].value == value){
                        var filter = Filters[i];
                    }
                }
        Severity: Major
        Found in htdocs/modules/system/admin/images/js/imanager.js and 1 other location - About 1 hr to fix
        htdocs/modules/system/admin/images/js/imanager.js on lines 139..143

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

        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

            for (i=0;i<=Filters.length-1;i++){
                if (Filters[i].value == filter){
                    var filterdata = Filters[i];
                }
            }
        Severity: Major
        Found in htdocs/modules/system/admin/images/js/imanager.js and 1 other location - About 1 hr to fix
        htdocs/modules/system/admin/images/js/imanager.js on lines 112..116

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

        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 (file_exists($module_plugin_file)) {
                // module side (1st priority)
                $lang_files = array(
                ICMS_MODULES_PATH . "/$dirname/language/$language/waiting.php" ,
                ICMS_MODULES_PATH . "/$dirname/language/english/waiting.php" ,
        Severity: Major
        Found in htdocs/modules/system/blocks/system_waiting.php and 1 other location - About 1 hr to fix
        htdocs/modules/system/blocks/system_waiting.php on lines 167..196

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

        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

            } else if (! empty($mytrustdirname) && file_exists($d3module_plugin_file)) {
                // D3 module's plugin under xoops_trust_path (2nd priority)
                $lang_files = array(
                XOOPS_TRUST_PATH . "/modules/$mytrustdirname/language/$language/waiting.php" ,
                XOOPS_TRUST_PATH . "/modules/$mytrustdirname/language/english/waiting.php" ,
        Severity: Major
        Found in htdocs/modules/system/blocks/system_waiting.php and 1 other location - About 1 hr to fix
        htdocs/modules/system/blocks/system_waiting.php on lines 148..196

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

        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

        Avoid using undefined variables such as '$register_id' which will lead to PHP notices.
        Open

            if (empty($invite_to) || !empty($register_id) || (int) ($invite_date) < time() - 3 * 86400) {
        Severity: Minor
        Found in htdocs/include/checkinvite.php by phpmd

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$body' which will lead to PHP notices.
        Open

                strip_tags($body, implode('', $aAllowedTags))
        Severity: Minor
        Found in htdocs/include/functions.php by phpmd

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$column' which will lead to PHP notices.
        Open

                            $column[] = $sortarray['title'];
        Severity: Minor
        Found in htdocs/include/cp_functions.php by phpmd

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$urls' which will lead to PHP notices.
        Open

                    : icms::$urls['previouspage'];
        Severity: Minor
        Found in htdocs/include/functions.php by phpmd

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$monthy_timestamp' which will lead to PHP notices.
        Open

                        if (!isset($monthy_timestamp)) {
        Severity: Minor
        Found in htdocs/include/functions.php by phpmd

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$monthy_timestamp' which will lead to PHP notices.
        Open

                        if ($usertimestamp >= $monthy_timestamp[0] && $usertimestamp < $monthy_timestamp[1]) {
        Severity: Minor
        Found in htdocs/include/functions.php by phpmd

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Avoid using undefined variables such as '$monthy_timestamp' which will lead to PHP notices.
        Open

                        if ($usertimestamp >= $monthy_timestamp[0] && $usertimestamp < $monthy_timestamp[1]) {
        Severity: Minor
        Found in htdocs/include/functions.php by phpmd

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

        Source https://phpmd.org/rules/cleancode.html#undefinedvariable

        Severity
        Category
        Status
        Source
        Language