mambax7/publisher

View on GitHub

Showing 3,032 of 3,032 total issues

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

if ('start' === $op) {
    xoops_load('XoopsFormLoader');

    Utility::cpHeader();
    //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT);
Severity: Major
Found in admin/import/xnews.php and 1 other location - About 6 days to fix
admin/import/ams.php on lines 42..171

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

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 ('start' === $op) {
    xoops_load('XoopsFormLoader');

    Utility::cpHeader();
    //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT);
Severity: Major
Found in admin/import/ams.php and 1 other location - About 6 days to fix
admin/import/xnews.php on lines 41..171

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

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

File xoops_version.php has 1594 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php declare(strict_types=1);
/*
 You may not change or alter any portion of this comment or credits
 of supporting developers from this source code or any supporting source code
 which is considered copyrighted (c) material of the original comment or credit authors.
Severity: Major
Found in xoops_version.php - About 4 days to fix

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

    if ('start' === $op) {
        xoops_load('XoopsFormLoader');
    
        Utility::cpHeader();
        //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT);
    Severity: Major
    Found in admin/import/xfsection.php and 1 other location - About 3 days to fix
    admin/import/wfsection.php on lines 44..108

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

    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 ('start' === $op) {
        xoops_load('XoopsFormLoader');
    
        Utility::cpHeader();
        //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT);
    Severity: Major
    Found in admin/import/wfsection.php and 1 other location - About 3 days to fix
    admin/import/xfsection.php on lines 43..107

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

    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

    File thumb.php has 1190 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php declare(strict_types=1);
    /**
     * TimThumb by Ben Gillbanks and Mark Maunder
     * Based on work done by Tim McDaniels and Darren Hoyt
     * https://code.google.com/p/timthumb/
    Severity: Major
    Found in thumb.php - About 3 days to fix

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

              } elseif (Constants::RATING_LIKES === (int)$this->helper->getConfig('ratingbars')) {
                  // get count of "dislikes"
                  $criteria = new \CriteriaCompo();
                  $criteria->add(new \Criteria(static::IDENTIFIER, $itemId));
                  $criteria->add(new \Criteria(static::SOURCE, $source));
      Severity: Major
      Found in class/VoteHandler.php and 1 other location - About 2 days to fix
      class/VoteHandler.php on lines 305..351

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

      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 (Constants::RATING_LIKES === $ratingbarsValue) {
                  // get count of "dislikes"
                  $criteria = new \CriteriaCompo();
                  $criteria->add(new \Criteria(static::IDENTIFIER, $itemId));
                  $criteria->add(new \Criteria(static::SOURCE, $source));
      Severity: Major
      Found in class/VoteHandler.php and 1 other location - About 2 days to fix
      class/VoteHandler.php on lines 135..181

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

      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

      File Utility.php has 922 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php declare(strict_types=1);
      
      namespace XoopsModules\Publisher;
      
      /*
      Severity: Major
      Found in class/Utility.php - About 2 days to fix

        Method createElements has 413 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function createElements($obj)
            {
                $helper       = Helper::getInstance();
                $timeoffset   = null;
                $configurator = new Configurator();
        Severity: Major
        Found in class/Form/ItemForm.php - About 2 days to fix

          Function popeye has 391 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              $.fn.popeye = function (options) {
                  'use strict';
          
                  // build main options before element iteration
                  //----------------------------------------------------------------------
          Severity: Major
          Found in assets/js/jquery.popeye-2.1.js - About 1 day to fix

            File Item.php has 779 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php declare(strict_types=1);
            
            namespace XoopsModules\Publisher;
            
            /*
            Severity: Major
            Found in class/Item.php - About 1 day to fix

              Function processImageAndWriteToCache has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function processImageAndWriteToCache($localImage)
                  {
                      $sData    = getimagesize($localImage);
                      $origType = $sData[2];
                      $mimeType = $sData['mime'];
              Severity: Minor
              Found in thumb.php - About 1 day 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 createElements has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function createElements($obj)
                  {
                      $helper       = Helper::getInstance();
                      $timeoffset   = null;
                      $configurator = new Configurator();
              Severity: Minor
              Found in class/Form/ItemForm.php - About 1 day to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

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

                  public function &getCategoriesForSubmit()
                  {
                      global $theresult;
                      $ret      = [];
                      $criteria = new \CriteriaCompo();
              Severity: Major
              Found in class/CategoryHandler.php and 1 other location - About 1 day to fix
              class/CategoryHandler.php on lines 288..327

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

              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

                  public function getCategoriesForSearch()
                  {
                      global $theresult;
              
                      $ret      = [];
              Severity: Major
              Found in class/CategoryHandler.php and 1 other location - About 1 day to fix
              class/CategoryHandler.php on lines 245..283

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

              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

                              foreach ($mimetypes as $mime) {
                                  echo "<tr class='even'>
                              <td><input type='checkbox' name='mimes[]' value='" . $mime->getVar('mime_id') . "'>" . $mime->getVar('mime_id') . '</td>
                              <td>' . $mime->getVar('mime_name') . "</td>
                              <td align='center'>" . $mime->getVar('mime_ext') . "</td>
              Severity: Major
              Found in class/MimetypesUtility.php and 1 other location - About 1 day to fix
              class/MimetypesUtility.php on lines 453..471

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

              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

                      foreach ($mimetypes as $mime) {
                          echo "<tr class='even'>
                      <td><input type='checkbox' name='mimes[]' value='" . $mime->getVar('mime_id') . "'>" . $mime->getVar('mime_id') . '</td>
                      <td>' . $mime->getVar('mime_name') . "</td>
                      <td align='center'>" . $mime->getVar('mime_ext') . "</td>
              Severity: Major
              Found in class/MimetypesUtility.php and 1 other location - About 1 day to fix
              class/MimetypesUtility.php on lines 607..625

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

              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

                          while (false !== ($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles))) {
                              $filename = $GLOBALS['xoops']->path('uploads/xnews/attached/' . $arrFile['downloadname']);
                              if (file_exists($filename)) {
                                  if (copy($filename, $GLOBALS['xoops']->path('uploads/publisher/' . $arrFile['filerealname']))) {
                                      /** @var File $fileObj */
              Severity: Major
              Found in admin/import/xnews.php and 1 other location - About 1 day to fix
              admin/import/ams.php on lines 368..391

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

              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

                          while (false !== ($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles))) {
                              $filename = $GLOBALS['xoops']->path('uploads/AMS/attached/' . $arrFile['downloadname']);
                              if (file_exists($filename)) {
                                  if (copy($filename, $GLOBALS['xoops']->path('uploads/publisher/' . $arrFile['filerealname']))) {
                                      /** @var File $fileObj */
              Severity: Major
              Found in admin/import/ams.php and 1 other location - About 1 day to fix
              admin/import/xnews.php on lines 367..390

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

              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