ImpressCMS/impresscms

View on GitHub

Showing 47,251 of 47,256 total issues

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

function icmsFormField( $name, $value, $label, $maxlength, $help = '' )
{
    $label = htmlspecialchars( $label );
    $name = htmlspecialchars( $name, ENT_QUOTES );
    $value = htmlspecialchars( $value, ENT_QUOTES );
Severity: Major
Found in upgrade/upd-icms-1.0-to-1.1/settings_trust_path.php and 2 other locations - About 2 hrs to fix
htdocs/install/page_dbsettings.php on lines 306..319
upgrade/upd-icms-1.0-to-1.1/settings_salt.php on lines 19..33

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

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 xoFormField($name, $value, $label, $maxlength, $help = '') {
    $label = htmlspecialchars($label);
    $name = htmlspecialchars($name, ENT_QUOTES);
    $value = htmlspecialchars($value, ENT_QUOTES);
    $maxlength = (int) ($maxlength);
Severity: Major
Found in htdocs/install/page_dbsettings.php and 2 other locations - About 2 hrs to fix
upgrade/upd-icms-1.0-to-1.1/settings_salt.php on lines 19..33
upgrade/upd-icms-1.0-to-1.1/settings_trust_path.php on lines 19..33

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

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 xoFormField( $name, $value, $label, $maxlength, $help = '' )
{
    $label = htmlspecialchars( $label );
    $name = htmlspecialchars( $name, ENT_QUOTES );
    $value = htmlspecialchars( $value, ENT_QUOTES );
Severity: Major
Found in upgrade/upd-icms-1.0-to-1.1/settings_salt.php and 2 other locations - About 2 hrs to fix
htdocs/install/page_dbsettings.php on lines 306..319
upgrade/upd-icms-1.0-to-1.1/settings_trust_path.php on lines 19..33

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    function min(iterator, context) {
        iterator = iterator || Prototype.K;
        var result;
        this.each(function(value, index) {
            value = iterator.call(context, value, index, this);
Severity: Major
Found in htdocs/install/prototype.js and 1 other location - About 2 hrs to fix
htdocs/install/prototype.js on lines 973..982

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    function max(iterator, context) {
        iterator = iterator || Prototype.K;
        var result;
        this.each(function(value, index) {
            value = iterator.call(context, value, index, this);
Severity: Major
Found in htdocs/install/prototype.js and 1 other location - About 2 hrs to fix
htdocs/install/prototype.js on lines 984..993

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

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

    private function buildFormats() {
        $this->adFormats['728x90_as'] = array(
            'caption' => '728 X 90 Leaderboard',
            'width' => 728,
            'height' => 90,
Severity: Major
Found in htdocs/modules/system/admin/adsense/class/adsense.php - About 2 hrs to fix

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

                            if (isset($config['options']) && is_array($config['options'])) {
                                foreach ($config['options'] as $key => $value) {
                                    $confop = &$config_handler->createConfigOption();
                                    $confop->setVar('confop_name', $key, TRUE);
                                    $confop->setVar('confop_value', $value, TRUE);
    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 1301..1310

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

    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 (isset($config['options']) && is_array($config['options'])) {
                            foreach ($config['options'] as $key => $value) {
                                $confop = &$config_handler->createConfigOption();
                                $confop->setVar('confop_name', $key, TRUE);
                                $confop->setVar('confop_value', $value, TRUE);
    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 414..423

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

    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

        Object.extend(methods, {
            recursivelyCollect:   recursivelyCollect,
            ancestors:            ancestors,
            descendants:          descendants,
            firstDescendant:      firstDescendant,
    Severity: Major
    Found in htdocs/install/prototype.js and 1 other location - About 2 hrs to fix
    htdocs/install/prototype.js on lines 4381..4400

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

    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

        Element.addMethods({
            getLayout:              getLayout,
            measure:                measure,
            getWidth:               getWidth,
            getHeight:              getHeight,
    Severity: Major
    Found in htdocs/install/prototype.js and 1 other location - About 2 hrs to fix
    htdocs/install/prototype.js on lines 2707..2728

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

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

        public function xoInit(): bool {
            if (!$this->checkAccess()) {
                return false;
            }
            if (@empty($_SERVER['REQUEST_URI'])) {
    Severity: Major
    Found in htdocs/install/class/IcmsInstallWizard.php - About 2 hrs to fix

      File update-13.php has 284 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * DataBase Update Functions for ImpressCMS 1.3 series
       *
       * @copyright    The ImpressCMS Project http://www.impresscms.org/
      Severity: Minor
      Found in htdocs/modules/system/include/update-13.php - About 2 hrs to fix

        Function scrollTo has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            $.fn.scrollTo = function( target, duration, settings ){
                if( typeof duration == 'object' ){
                    settings = duration;
                    duration = 0;
                }
        Severity: Major
        Found in htdocs/install/jquery.scrollTo.js - About 2 hrs to fix

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

                  if ( text2 == "l" || text2 == "L" ) {
                      text2 = " align=left";
                  } else if ( text2 == "r" || text2 == "R" ) {
                      text2 = " align=right";
                  } else if ( text2 == "c" || text2 == "C" ) {
          Severity: Major
          Found in htdocs/include/xoops.js and 1 other location - About 2 hrs to fix
          htdocs/include/xoops.js on lines 406..414

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

          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 ( text2 == "c" || text2 == "C" ) {
                      text2 = "_css";
                  } else if ( text2 == "j" || text2 == "J" ) {
                      text2 = "_js";
                  } else if ( text2 == "h" || text2 == "H" ) {
          Severity: Major
          Found in htdocs/include/xoops.js and 1 other location - About 2 hrs to fix
          htdocs/include/xoops.js on lines 272..280

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

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

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

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

                if( $icmsConfig['use_ext_date'] == true && defined ('_CALENDAR_TYPE') && _CALENDAR_TYPE == "jalali"){
                    switch($month_id) {
                        case 1:
                            return _CAL_FARVARDIN;
                            break;
            Severity: Major
            Found in htdocs/include/functions.php and 1 other location - About 2 hrs to fix
            htdocs/include/functions.php on lines 1311..1350

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                }else{
                    switch($month_id) {
                        case 1:
                            return _CAL_JANUARY;
                            break;
            Severity: Major
            Found in htdocs/include/functions.php and 1 other location - About 2 hrs to fix
            htdocs/include/functions.php on lines 1272..1350

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

            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 b_system_admin_warnings_show has 69 lines of code (exceeds 25 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: Major
            Found in htdocs/modules/system/blocks/system_admin_blocks.php - About 2 hrs to fix

              Function Enumerable has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

              var Enumerable = (function() {
                  function each(iterator, context) {
                      try {
                          this._each(iterator, context);
                      } catch (e) {
              Severity: Minor
              Found in htdocs/install/prototype.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

              Severity
              Category
              Status
              Source
              Language