XoopsModules25x/lexikon

View on GitHub

Showing 316 of 316 total issues

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

    public static function isUtf8($Str)
    { # by bmorel at ssi dot fr
        for ($i = 0, $iMax = mb_strlen($Str); $i < $iMax; ++$i) {
            if (\ord($Str[$i]) < 0x80) {
                continue;
Severity: Minor
Found in class/Utility.php - About 1 hr to fix

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

        public static function getSummary()
        {
            global $xoopsDB;
    
            $summary = [];
    Severity: Minor
    Found in class/Utility.php - About 1 hr to fix

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

          public static function getServiceLinksNew($variable)
          {
              global $xoopsUser, $xoopsDB, $xoopsModule, $xoopsConfig, $myts;
      
              $helper    = Helper::getInstance();
      Severity: Minor
      Found in class/Utility.php - About 1 hr to fix

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

                if ($xoopsUser) {
                    if ($xoopsUser->isAdmin()) {
                        $srvlinks .= '<a TITLE="'
                                     . _EDIT
                                     . '" href="admin/entry.php?op=mod&entryID='
        Severity: Major
        Found in class/Utility.php and 1 other location - About 1 hr to fix
        include/functions.php on lines 273..293

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 104.

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

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

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

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

        Refactorings

        Further Reading

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

            if ($xoopsUser) {
                if ($xoopsUser->isAdmin()) {
                    $srvlinks .= '<a title="'
                                 . _EDIT
                                 . '" href="admin/entry.php?op=mod&entryID='
        Severity: Major
        Found in include/functions.php and 1 other location - About 1 hr to fix
        class/Utility.php on lines 316..336

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 104.

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

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

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

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

        Refactorings

        Further Reading

        Method lx_serviceLinksnew has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function lx_serviceLinksnew($variable)
        {
            global $xoopsUser, $xoopsDB, $xoopsModule, $xoopsModuleConfig, $xoopsConfig, $myts;
            $srvlinks2 = '<a title="'
                         . _MD_LEXIKON_PRINTTERM
        Severity: Minor
        Found in include/functions.php - About 1 hr to fix

          Method getServerStats has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getServerStats()
              {
                  //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
                  $moduleDirName      = \basename(\dirname(__DIR__, 2));
                  $moduleDirNameUpper = mb_strtoupper($moduleDirName);
          Severity: Minor
          Found in class/Common/ServerStats.php - About 1 hr to fix

            Method updateBlock has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups)
            Severity: Major
            Found in admin/blocksadmin.php - About 1 hr to fix

              Method FormImport has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function FormImport()
              {
                  global $xoopsConfig, $xoopsDB, $xoopsModule;
                  //lx_importMenu(9);
                  echo "<strong style='color: #2F5376; margin-top:6px; font-size:medium'>" . _AM_LEXIKON_IMPORT_GLOSSAIRE . '</strong><br><br>';
              Severity: Minor
              Found in admin/importglossaire.php - About 1 hr to fix

                Method FormImport has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function FormImport()
                {
                    global $xoopsConfig, $xoopsDB, $xoopsModule;
                    //lx_importMenu(9);
                    echo "<strong style='color: #2F5376; margin-top:6px; font-size:medium'>" . _AM_LEXIKON_IMPORT_WIWIMOD . '</strong><br><br>';
                Severity: Minor
                Found in admin/importwiwimod.php - About 1 hr to fix

                  Method lx_AuthorProfile has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function lx_AuthorProfile($uid)
                  {
                      require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
                      global $authortermstotal, $xoopsTpl, $xoopsDB, $xoopsUser, $xoopsModuleConfig;
                      $myts = \MyTextSanitizer::getInstance();
                  Severity: Minor
                  Found in include/functions.php - About 1 hr to fix

                    Method FormImport has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function FormImport()
                    {
                        global $xoopsConfig, $xoopsDB, $xoopsModule;
                        //lx_importMenu(9);
                        echo "<strong style='color: #2F5376; margin-top:6px; font-size:medium'>" . _AM_LEXIKON_IMPORT_WORDBOOK . '</strong><br><br>';
                    Severity: Minor
                    Found in admin/importwordbook.php - About 1 hr to fix

                      Method FormImport has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function FormImport()
                      {
                          global $xoopsConfig, $xoopsDB, $xoopsModule;
                          //lx_importMenu(9);
                          echo "<strong style='color: #2F5376; margin-top:6px; font-size:medium'>" . _AM_LEXIKON_IMPORT_DICTIONARY . '</strong><br><br>';
                      Severity: Minor
                      Found in admin/importdictionary.php - About 1 hr to fix

                        Method lx_showSearchForm has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function lx_showSearchForm()
                        {
                            global $xoopsUser, $xoopsDB, $xoopsModule, $xoopsModuleConfig, $xoopsConfig;
                            /** @var \XoopsGroupPermHandler $grouppermHandler */
                            $grouppermHandler = xoops_getHandler('groupperm');
                        Severity: Minor
                        Found in include/functions.php - About 1 hr to fix

                          Method FormImport has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function FormImport()
                          {
                              global $xoopsConfig, $xoopsDB, $xoopsModule;
                              //lx_importMenu(9);
                              echo "<strong style='color: #2F5376; margin-top:6px; font-size:medium'>" . _AM_LEXIKON_IMPORT_XWORDS . '</strong><br><br>';
                          Severity: Minor
                          Found in admin/importxwords.php - About 1 hr to fix

                            Method getFormFilter has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function getFormFilter()
                                {
                                    global $xoopsUser, $xoopsDB, $xoopsModule, $xoopsConfig;
                            
                                    $helper = Helper::getInstance();
                            Severity: Minor
                            Found in class/Entries.php - About 1 hr to fix

                              Method getFormSearch has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public static function getFormSearch($type = '3', $categoryID = '0', $term = '')
                                  {
                                      global $xoopsUser, $xoopsDB, $xoopsModule, $xoopsConfig;
                              
                                      $helper = Helper::getInstance();
                              Severity: Minor
                              Found in class/Utility.php - About 1 hr to fix

                                Function check_browser_can_use_spaw has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function check_browser_can_use_spaw()
                                {
                                    $browser = $_SERVER['HTTP_USER_AGENT'];
                                    // check if msie
                                    if (preg_match('/MSIE[^;]*/i', $browser, $msie)) {
                                Severity: Minor
                                Found in admin/myblockform.php - About 1 hr 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 _loadAllChildItemIds has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function _loadAllChildItemIds($itemId, &$childIds)
                                    {
                                        if (!empty($this->_itemTree[$itemId]['children'])) {
                                            $first_child = $this->_itemTree[$itemId]['children'];
                                            foreach ($first_child as $fcid) {
                                Severity: Minor
                                Found in class/GroupPermForm.php - About 1 hr 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 b_lxentries_new_edit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function b_lxentries_new_edit($options)
                                {
                                    $form = "<table style='width:100%;' class='bg2'>";
                                    $form .= "<tr><th style='width:50%'>" . _OPTIONS . "</th><th style='width:50%'>" . _MB_LEXIKON_SETTINGS . '</th></tr>';
                                    $form .= "<tr><td class='even'>" . _MB_LEXIKON_ORDER . "</td><td class='odd'>";
                                Severity: Minor
                                Found in blocks/entries_new.php - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language