mambax7/tdmdownloads

View on GitHub

Showing 207 of 207 total issues

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

if (is_object($helper->getModule())) {
    $pathModIcon16 = $helper->getModule()->getInfo('modicons16');
    $pathModIcon32 = $helper->getModule()->getInfo('modicons32');
    $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16);
    $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32);
Severity: Major
Found in admin/modified.php and 4 other locations - About 55 mins to fix
admin/broken.php on lines 109..114
admin/category.php on lines 420..425
admin/downloads.php on lines 774..779
admin/field.php on lines 219..224

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

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

if (is_object($helper->getModule())) {
    $pathModIcon16 = $helper->getModule()->getInfo('modicons16');
    $pathModIcon32 = $helper->getModule()->getInfo('modicons32');
    $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16);
    $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32);
Severity: Major
Found in admin/category.php and 4 other locations - About 55 mins to fix
admin/broken.php on lines 109..114
admin/downloads.php on lines 774..779
admin/field.php on lines 219..224
admin/modified.php on lines 314..319

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

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 static function metaKeywords(string $content): void
    {
        global $xoopsTpl, $xoTheme;
        $myts    = \MyTextSanitizer::getInstance();
        $content = $myts->undoHtmlSpecialChars($myts->displayTarea($content));
Severity: Minor
Found in class/Common/SysUtility.php and 1 other location - About 55 mins to fix
class/Common/SysUtility.php on lines 112..122

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

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 static function metaDescription(string $content): void
    {
        global $xoopsTpl, $xoTheme;
        $myts    = \MyTextSanitizer::getInstance();
        $content = $myts->undoHtmlSpecialChars($myts->displayTarea($content));
Severity: Minor
Found in class/Common/SysUtility.php and 1 other location - About 55 mins to fix
class/Common/SysUtility.php on lines 100..110

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

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

if (is_object($helper->getModule())) {
    $pathModIcon16 = $helper->getModule()->getInfo('modicons16');
    $pathModIcon32 = $helper->getModule()->getInfo('modicons32');
    $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16);
    $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32);
Severity: Major
Found in admin/broken.php and 4 other locations - About 55 mins to fix
admin/category.php on lines 420..425
admin/downloads.php on lines 774..779
admin/field.php on lines 219..224
admin/modified.php on lines 314..319

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

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

if (is_object($helper->getModule())) {
    $pathModIcon16 = $helper->getModule()->getInfo('modicons16');
    $pathModIcon32 = $helper->getModule()->getInfo('modicons32');
    $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16);
    $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32);
Severity: Major
Found in admin/downloads.php and 4 other locations - About 55 mins to fix
admin/broken.php on lines 109..114
admin/category.php on lines 420..425
admin/field.php on lines 219..224
admin/modified.php on lines 314..319

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

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 setOrder has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function setOrder($bid, $title, $weight, $visible, $side, $bcachetime, $bmodule): void
Severity: Major
Found in class/Common/Blocksadmin.php - About 50 mins to fix

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

                    if (1 == $downloads_field[$i]->getVar('fid')) {
                        //page d'accueil
                        if (1 == $downloads_field[$i]->getVar('status')) {
                            $form->addElement(new \XoopsFormText(_AM_TDMDOWNLOADS_FORMHOMEPAGE, 'homepage', 50, 255, $this->getVar('homepage')));
                        } else {
    Severity: Minor
    Found in class/Downloads.php and 1 other location - About 50 mins to fix
    class/Downloads.php on lines 155..162

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

    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 (2 == $downloads_field[$i]->getVar('fid')) {
                        //version
                        if (1 == $downloads_field[$i]->getVar('status')) {
                            $form->addElement(new \XoopsFormText(_AM_TDMDOWNLOADS_FORMVERSION, 'version', 10, 255, $this->getVar('version')));
                        } else {
    Severity: Minor
    Found in class/Downloads.php and 1 other location - About 50 mins to fix
    class/Downloads.php on lines 147..154

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

    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 deeply nested control flow statements.
    Open

                        if (1 == $helper->getConfig('permission_download')) {
                            /** @var \XoopsGroupPermHandler $grouppermHandler */
                            $grouppermHandler = xoops_getHandler('groupperm');
                            $criteria         = new \CriteriaCompo();
                            $criteria->add(new \Criteria('gperm_itemid', $lidDownloads, '='));
    Severity: Major
    Found in submit.php - About 45 mins to fix

      Method resizeAndCrop has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function resizeAndCrop($src_url, $src_mimetype, $dest_url, $dest_w, $dest_h, $quality = 90)
      Severity: Minor
      Found in class/Common/ImageResizer.php - About 45 mins to fix

        Method getImagesCriteria has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            private function getImagesCriteria($crImages, $albId, $start, $limit, $sort, $order)
        Severity: Minor
        Found in class/Common/ImagesHandler.php - About 45 mins to fix

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

                  if ($wmTargetL) {
                      $imgWm = $this->pathUpload . '/large/' . $this->imageNameLarge;
                      $resWm = $watermarksHandler->watermarkImage($wmId, $imgWm, $imgWm);
                      if (true !== $resWm) {
                          return ['error' => \sprintf(\constant($moduleDirNameUpper . '_' . 'FAILSAVEWM_LARGE'), $this->imageNicename, $resWm)];
          Severity: Minor
          Found in class/Common/FineimpuploadHandler.php and 1 other location - About 40 mins to fix
          class/Common/FineimpuploadHandler.php on lines 193..199

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

          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 ($wmTargetM) {
                      $imgWm = $this->pathUpload . '/medium/' . $this->imageName;
                      $resWm = $watermarksHandler->watermarkImage($wmId, $imgWm, $imgWm);
                      if (true !== $resWm) {
                          return ['error' => \sprintf(\constant($moduleDirNameUpper . '_' . 'FAILSAVEWM_MEDIUM'), $this->imageNicename, $resWm)];
          Severity: Minor
          Found in class/Common/FineimpuploadHandler.php and 1 other location - About 40 mins to fix
          class/Common/FineimpuploadHandler.php on lines 185..191

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

          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 getPathTree has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static function getPathTree($mytree, $key, $category_array, $title, $prefix = '')
          Severity: Minor
          Found in class/Utilities.php - About 35 mins to fix

            Method openCollapsableBar has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public static function openCollapsableBar($tablename = '', $iconname = '', $tabletitle = '', $tabledsc = '', $open = true)
            Severity: Minor
            Found in class/Utility.php - About 35 mins to fix

              Method makeArrayTreeOptions has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  protected function makeArrayTreeOptions($fieldName, $key, &$ret, $prefix_orig, $prefix_curr = '')
              Severity: Minor
              Found in class/Tree.php - About 35 mins to fix

                Method getCountImages has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function getCountImages($albId = 0, $start = 0, $limit = 0, $sort = 'img_id ASC, img_name', $order = 'ASC')
                Severity: Minor
                Found in class/Common/ImagesHandler.php - About 35 mins to fix

                  Method truncateHtml has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          string $text,
                          ?int $length = 100,
                          string $ending = '...',
                          bool $exact = false,
                          bool $considerHtml = true
                  Severity: Minor
                  Found in class/Common/SysUtility.php - About 35 mins to fix

                    Method getPathTree has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public static function getPathTree($mytree, $key, $category_array, $title, $prefix = '')
                    Severity: Minor
                    Found in class/Utility.php - About 35 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language