XoopsModules25x/wfdownloads

View on GitHub

Showing 279 of 279 total issues

Method largeDownload has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function largeDownload($filePath, $fileMimetype)
    {
        /* You may need these ini settings too */
        \set_time_limit(0);
        \ini_set('memory_limit', '512M');
Severity: Major
Found in class/Utility.php - About 2 hrs to fix

    Method render has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function render($alphaCount = null, $howmanyother = null)
        {
            $moduleDirName      = \basename(dirname(__DIR__, 2));
            $moduleDirNameUpper = mb_strtoupper($moduleDirName);
            \xoops_loadLanguage('common', $moduleDirName);
    Severity: Major
    Found in class/Common/LetterChoice.php - About 2 hrs to fix

      Function searchSwishe has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function searchSwishe($swisheQueryWords)
          {
              /**
               * @param $str
               * @param $num_chars
      Severity: Minor
      Found in class/Utility.php - 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

      Method __construct has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct($id = null)
          {
              parent::__construct();
              $this->initVar('requestid', \XOBJ_DTYPE_INT);
      
      
      Severity: Major
      Found in class/Modification.php - About 2 hrs to fix

        Method render has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function render()
            {
                $ele_name = $this->getName();
                $ret      = '';
                $ret      .= "<form name='{$ele_name}' id='{$ele_name}' action='{$this->getAction()}' method='{$this->getMethod()}' onsubmit='return xoopsFormValidate_{$ele_name}();' {$this->getExtra()} >" . NWLINE;
        Severity: Major
        Found in class/MulticolumnsThemeForm.php - About 2 hrs to fix

          Method __construct has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function __construct($id = null)
              {
                  /** @var \XoopsModules\Wfdownloads\Helper $this ->helper */
                  $this->helper = Helper::getInstance();
                  $this->db     = \XoopsDatabaseFactory::getDatabaseConnection();
          Severity: Major
          Found in class/Download.php - About 2 hrs to fix

            Method isBlockCloned has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options = null)
                {
                    xoops_loadLanguage('admin', 'system');
                    xoops_loadLanguage('admin/blocksadmin', 'system');
                    xoops_loadLanguage('admin/groups', 'system');
            Severity: Major
            Found in admin/blocksadmin.php - About 2 hrs to fix

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

                      if ($this->isNew()) {
                          $butt_create = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_MIME_CREATE, 'submit');
                          $butt_create->setExtra('onclick="this.form.elements.op.value=\'mimetype.save\'"');
                          $buttonTray->addElement($butt_create);
                          $butt_clear = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_MIME_CLEAR, 'reset');
              Severity: Major
              Found in class/Mimetype.php and 1 other location - About 2 hrs to fix
              class/Review.php on lines 112..131

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

              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 ($this->isNew()) {
                          $butt_create = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_BSAVE, 'submit');
                          $butt_create->setExtra('onclick="this.form.elements.op.value=\'review.save\'"');
                          $buttonTray->addElement($butt_create);
                          $butt_clear = new \XoopsFormButton('', '', \_AM_WFDOWNLOADS_BRESET, 'reset');
              Severity: Major
              Found in class/Review.php and 1 other location - About 2 hrs to fix
              class/Mimetype.php on lines 113..130

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

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

                  public function getForm()
                  {
                      require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
                      $uid = !empty($GLOBALS['xoopsUser']) ? (int)$GLOBALS['xoopsUser']->getVar('uid') : 0;
              
              
              Severity: Major
              Found in class/Review.php - About 2 hrs to fix

                Method xoops_module_update_wfdownloads has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function xoops_module_update_wfdownloads(XoopsModule $module, $previousVersion = null)
                {
                    $moduleDirName      = basename(dirname(__DIR__));
                    $moduleDirNameUpper = mb_strtoupper($moduleDirName);
                
                
                Severity: Major
                Found in include/onupdate.php - About 2 hrs to fix

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

                              if (Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) {
                                  $catSelect = $categoryObjsTree->makeSelectElement('cid', 'title', '--', $this->getVar('cid'), true, 0, '', \_MD_WFDOWNLOADS_CATEGORYC);
                                  $sform->addElement($catSelect);
                              } else {
                                  $sform->addElement(new \XoopsFormLabel(\_MD_WFDOWNLOADS_CATEGORYC, $categoryObjsTree->makeSelBox('cid', 'title', '-', $this->getVar('cid', 'e'))));
                  Severity: Major
                  Found in class/Download.php and 2 other locations - About 2 hrs to fix
                  class/Download.php on lines 724..729
                  class/Download.php on lines 1031..1036

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

                  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

                          if (Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) {
                              $catSelect = $categoryObjsTree->makeSelectElement('cid', 'title', '-', $this->getVar('cid'), true, 0, '', \_MD_WFDOWNLOADS_CATEGORYC);
                              $sform->addElement($catSelect);
                          } else {
                              $sform->addElement(new \XoopsFormLabel(\_MD_WFDOWNLOADS_CATEGORYC, $categoryObjsTree->makeSelBox('cid', 'title', '-', $this->getVar('cid', 'e'))));
                  Severity: Major
                  Found in class/Download.php and 2 other locations - About 2 hrs to fix
                  class/Download.php on lines 483..488
                  class/Download.php on lines 724..729

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

                  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

                      if (Utility::checkModule('wf' . 'downloads') >= 320) {
                          $sql = "INSERT INTO {$destination['downloads']} (";
                          $sql .= ' `cid`, `old_lid`, `old_cid`, `title`, `url`, `filename`, `filetype`, `homepage`, `version`, `size`, `platform`, `screenshot`, `screenshot2`, `screenshot3`, `screenshot4`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `license`, `mirror`, `price`, `paypalemail`, `features`, `requirements`, `homepagetitle`, `forumid`, `limitations`, `versiontypes`, `dhistory`, `published`, `expired`, `updated`, `offline`, `summary`, `description`, `ipaddress`, `notifypub`, `formulize_idreq`';
                          $sql .= ' ) SELECT ';
                          $sql .= ' 0,     `lid`,     `cid`,     `title`, `url`, `filename`, `filetype`, `homepage`, `version`, `size`, `platform`, `screenshot`, `screenshot2`, `screenshot3`, `screenshot4`, `submitter`, `publisher`, `status`, `date`, `hits`, `rating`, `votes`, `comments`, `license`, `mirror`, `price`, `paypalemail`, `features`, `requirements`, `homepagetitle`, `forumid`, `limitations`, `versiontypes`, `dhistory`, `published`, `expired`, `updated`, `offline`, `summary`, `description`, `ipaddress`, `notifypub`, `formulize_idreq`';
                  Severity: Major
                  Found in admin/import.php and 2 other locations - About 2 hrs to fix
                  admin/import.php on lines 343..355
                  admin/import.php on lines 389..401

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

                  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

                      if (Utility::checkModule('wf' . 'downloads') >= 320) {
                          $sql = "INSERT INTO {$destination['cat']} (";
                          $sql .= ' `old_cid`, `old_pid`, `title`, `imgurl`, `description`, `total`, `summary`, `spotlighttop`, `spotlighthis`, `dohtml`, `dosmiley`, `doxcode`, `doimage`, `dobr`, `weight`, `formulize_fid`';
                          $sql .= ' ) SELECT ';
                          $sql .= ' `cid`,     `pid`,     `title`, `imgurl`, `description`, `total`, `summary`, `spotlighttop`, `spotlighthis`, `dohtml`, `dosmiley`, `doxcode`, `doimage`, `dobr`, `weight`, `formulize_fid`';
                  Severity: Major
                  Found in admin/import.php and 2 other locations - About 2 hrs to fix
                  admin/import.php on lines 360..372
                  admin/import.php on lines 389..401

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

                  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

                          if (Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) {
                              $catSelect = $categoryObjsTree->makeSelectElement('cid', 'title', '--', $this->getVar('cid'), true, 0, '', \_AM_WFDOWNLOADS_FILE_CATEGORY);
                              $sform->addElement($catSelect);
                          } else {
                              $sform->addElement(new \XoopsFormLabel(\_AM_WFDOWNLOADS_FILE_CATEGORY, $categoryObjsTree->makeSelBox('cid', 'title', '-', $this->getVar('cid', 'e'))));
                  Severity: Major
                  Found in class/Download.php and 2 other locations - About 2 hrs to fix
                  class/Download.php on lines 483..488
                  class/Download.php on lines 1031..1036

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

                  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

                      if (Utility::checkModule('wf' . 'downloads') >= 320) {
                          $sql = "INSERT INTO {$destination['reviews']} (";
                          $sql .= ' `lid`, `title`, `review`, `submit`, `date`, `uid`, `rate`';
                          $sql .= ' ) SELECT';
                          $sql .= ' `lid`, `title`, `review`, `submit`, `date`, `uid`, `rate`';
                  Severity: Major
                  Found in admin/import.php and 2 other locations - About 2 hrs to fix
                  admin/import.php on lines 343..355
                  admin/import.php on lines 360..372

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

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

                      public function getForm()
                      {
                          require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
                          $uid = !empty($GLOBALS['xoopsUser']) ? (int)$GLOBALS['xoopsUser']->getVar('uid') : 0;
                  
                  
                  Severity: Major
                  Found in class/Mirror.php - About 2 hrs to fix

                    Consider simplifying this complex logical expression.
                    Open

                    if (!is_object($GLOBALS['xoopsUser']) && true === $use_mirrors
                        && (_WFDOWNLOADS_ANONPOST_MIRROR == $helper->getConfig('anonpost')
                            || _WFDOWNLOADS_ANONPOST_BOTH == $helper->getConfig('anonpost'))
                        && (_WFDOWNLOADS_SUBMISSIONS_MIRROR == $helper->getConfig('submissions')
                            || _WFDOWNLOADS_SUBMISSIONS_BOTH == $helper->getConfig('submissions'))) {
                    Severity: Critical
                    Found in singlefile.php - About 2 hrs to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if (!\is_object($GLOBALS['xoopsUser'])
                                  && (\_WFDOWNLOADS_ANONPOST_MIRROR == $this->helper->getConfig('anonpost')
                                      || \_WFDOWNLOADS_ANONPOST_BOTH == $this->helper->getConfig('anonpost'))
                                  && (\_WFDOWNLOADS_SUBMISSIONS_MIRROR == $this->helper->getConfig('submissions')
                                      || \_WFDOWNLOADS_SUBMISSIONS_BOTH == $this->helper->getConfig('submissions'))
                      Severity: Critical
                      Found in class/Download.php - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language