XoopsModules25x/smallworld

View on GitHub
include/functions.php

Summary

Maintainability
F
2 wks
Test Coverage

File functions.php has 1026 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
 * 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 include/functions.php - About 2 days to fix

    Method smallworld_includeScripts has 140 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function smallworld_includeScripts()
    {
        /** @var \XoopsModules\Smallworld\Helper $helper */
        $helper = Helper::getInstance();
        $page = basename($_SERVER['PHP_SELF'], '.php');
    Severity: Major
    Found in include/functions.php - About 5 hrs to fix

      Function smallworld_time_stamp has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

      function smallworld_time_stamp($session_time)
      {
          $time_difference = time() - $session_time;
          $seconds         = $time_difference;
          $minutes         = round($time_difference / 60);
      Severity: Minor
      Found in include/functions.php - About 3 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 smallworld_time_stamp has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function smallworld_time_stamp($session_time)
      {
          $time_difference = time() - $session_time;
          $seconds         = $time_difference;
          $minutes         = round($time_difference / 60);
      Severity: Minor
      Found in include/functions.php - About 1 hr to fix

        Method smallworld_SetCoreScript has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function smallworld_SetCoreScript()
        {
            /** @var \XoopsModules\Smallworld\Helper $helper */
            $helper = Helper::getInstance();
        
        
        Severity: Minor
        Found in include/functions.php - About 1 hr to fix

          Method smallworld_sociallinks has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function smallworld_sociallinks($num, $name)
          {
              /** @var \XoopsModules\Smallworld\Helper $helper */
              $helper = Helper::getInstance();
              switch ($num) {
          Severity: Minor
          Found in include/functions.php - About 1 hr to fix

            Function smallworld_GetModuleOption has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            function smallworld_GetModuleOption($option = null, $repmodule = 'smallworld', $flushFirst = false)
            {
                static $modOptions = [];
                if ($flushFirst) { // clears the 'cache', forces reload of configs
                    $modOptions = [];
            Severity: Minor
            Found in include/functions.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 smallworld_getAvatarLink has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function smallworld_getAvatarLink($userid, $image)
            {
                $depMsg = __FUNCTION__ . " is deprecated use SwUserHandler::getAvatarLink() instead.";
                if (isset($GLOBALS['xoopsLogger'])) {
                    $GLOBALS['xoopsLogger']->addDeprecated($depMsg);
            Severity: Minor
            Found in include/functions.php - About 1 hr to fix

              Method smallworld_tolink has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function smallworld_tolink($text, $uid)
              {
                  $helper = Helper::getInstance();
                  $ext        = mb_substr($text, -4, 4);
                  $ext2       = mb_substr($text, -5, 5);
              Severity: Minor
              Found in include/functions.php - About 1 hr to fix

                Function smallworld_includeScripts has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                function smallworld_includeScripts()
                {
                    /** @var \XoopsModules\Smallworld\Helper $helper */
                    $helper = Helper::getInstance();
                    $page = basename($_SERVER['PHP_SELF'], '.php');
                Severity: Minor
                Found in include/functions.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 smallworld_sociallinks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                function smallworld_sociallinks($num, $name)
                {
                    /** @var \XoopsModules\Smallworld\Helper $helper */
                    $helper = Helper::getInstance();
                    switch ($num) {
                Severity: Minor
                Found in include/functions.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 smallworld_getAvatarLink has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                function smallworld_getAvatarLink($userid, $image)
                {
                    $depMsg = __FUNCTION__ . " is deprecated use SwUserHandler::getAvatarLink() instead.";
                    if (isset($GLOBALS['xoopsLogger'])) {
                        $GLOBALS['xoopsLogger']->addDeprecated($depMsg);
                Severity: Minor
                Found in include/functions.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 smallworld_mostactiveusers_allround has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function smallworld_mostactiveusers_allround()
                {
                    $msg     = [];
                    $sql     = 'SELECT uid_fk, COUNT( * ) as cnt ';
                    $sql     .= 'FROM ( ';
                Severity: Minor
                Found in include/functions.php - About 1 hr to fix

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

                  function smallworld_nextBirthdays()
                  {
                      $swUserHandler = Helper::getInstance()->getHandler('SwUser');
                      $now       = date('d-m');
                      $res       = [];
                  Severity: Minor
                  Found in include/functions.php - About 1 hr to fix

                    Method smallworld_getImageSize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function smallworld_getImageSize($w, $h, $url)
                    {
                        $bn        = basename($url);
                        $w         = (int)$w;
                        $h         = (int)$h;
                    Severity: Minor
                    Found in include/functions.php - About 1 hr to fix

                      Method smallworld_GetModuleOption has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function smallworld_GetModuleOption($option = null, $repmodule = 'smallworld', $flushFirst = false)
                      {
                          static $modOptions = [];
                          if ($flushFirst) { // clears the 'cache', forces reload of configs
                              $modOptions = [];
                      Severity: Minor
                      Found in include/functions.php - About 1 hr to fix

                        Function smallworld_getImageSize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function smallworld_getImageSize($w, $h, $url)
                        {
                            $bn        = basename($url);
                            $w         = (int)$w;
                            $h         = (int)$h;
                        Severity: Minor
                        Found in include/functions.php - About 55 mins 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

                        Avoid too many return statements within this method.
                        Open

                                    return null;
                        Severity: Major
                        Found in include/functions.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                              return null;
                          Severity: Major
                          Found in include/functions.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return $modOptions[$repmodule][$option];
                            Severity: Major
                            Found in include/functions.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return $modOptions[$repmodule];
                              Severity: Major
                              Found in include/functions.php - About 30 mins to fix

                                Function smallworld_Gravatar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function smallworld_Gravatar($uid)
                                {
                                    $depMsg = __FUNCTION__ . " is deprecated use SwUserHandler::gravatar() instead.";
                                    if (isset($GLOBALS['xoopsLogger'])) {
                                        $GLOBALS['xoopsLogger']->addDeprecated($depMsg);
                                Severity: Minor
                                Found in include/functions.php - About 25 mins 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 smallworld_array_flatten has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function smallworld_array_flatten($array, $preserve_keys = 1, &$newArray = [])
                                {
                                    foreach ($array as $key => $child) {
                                        if (is_array($child)) {
                                            $newArray = smallworld_array_flatten($child, $preserve_keys, $newArray);
                                Severity: Minor
                                Found in include/functions.php - About 25 mins 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 smallworld_tolink has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function smallworld_tolink($text, $uid)
                                {
                                    $helper = Helper::getInstance();
                                    $ext        = mb_substr($text, -4, 4);
                                    $ext2       = mb_substr($text, -5, 5);
                                Severity: Minor
                                Found in include/functions.php - About 25 mins 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 smallworld_getTagUsers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function smallworld_getTagUsers($txt, $sender, $permalink = '')
                                {
                                    $dBase = new Smallworld\SwDatabase();
                                    $mail  = new Smallworld\Mail();
                                    preg_match_all('/@([a-zA-Z0-9]+|\\[[a-zA-Z0-9]+\\])/', $txt, $matches);
                                Severity: Minor
                                Found in include/functions.php - About 25 mins 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

                                function smallworld_topratedusers()
                                {
                                    $swUserHandler = Helper::getInstance()->getHandler('SwUser');
                                    $array   = [];
                                    $counter = 1;
                                Severity: Major
                                Found in include/functions.php and 1 other location - About 1 day to fix
                                include/functions.php on lines 860..882

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

                                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 smallworld_worstratedusers()
                                {
                                    $swUserHandler = Helper::getInstance()->getHandler('SwUser');
                                    $array   = [];
                                    $counter = 1;
                                Severity: Major
                                Found in include/functions.php and 1 other location - About 1 day to fix
                                include/functions.php on lines 888..910

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

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

                                        case 'register':
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.colorbox.js'));
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.validate.js'));
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.validation.functions.js'));
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.stepy.js'));
                                Severity: Major
                                Found in include/functions.php and 3 other locations - About 6 hrs to fix
                                include/functions.php on lines 1428..1441
                                include/functions.php on lines 1442..1454
                                include/functions.php on lines 1510..1523

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

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

                                        case 'permalink':
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.oembed.js'));
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/wall.js'));
                                            $GLOBALS['xoTheme']->addStylesheet($helper->url('assets/css/oembed.css'));
                                            $GLOBALS['xoTheme']->addStylesheet($helper->url('assets/css/smallworld.css'));
                                Severity: Major
                                Found in include/functions.php and 3 other locations - About 6 hrs to fix
                                include/functions.php on lines 1414..1427
                                include/functions.php on lines 1428..1441
                                include/functions.php on lines 1510..1523

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

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

                                        case 'publicindex':
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.oembed.js'));
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.elastic.source.js'));
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/wall.js'));
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/ajaxupload.3.5.js'));
                                Severity: Major
                                Found in include/functions.php and 3 other locations - About 6 hrs to fix
                                include/functions.php on lines 1414..1427
                                include/functions.php on lines 1442..1454
                                include/functions.php on lines 1510..1523

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

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

                                        case 'editprofile':
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.colorbox.js'));
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.validate.js'));
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.validation.functions.js'));
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.stepy.js'));
                                Severity: Major
                                Found in include/functions.php and 3 other locations - About 6 hrs to fix
                                include/functions.php on lines 1414..1427
                                include/functions.php on lines 1428..1441
                                include/functions.php on lines 1442..1454

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

                                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

                                        case 'smallworldshare':
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.oembed.js'));
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/wall.js'));
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.innerfade.js'));
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/jssocials.min.js'));
                                Severity: Major
                                Found in include/functions.php and 1 other location - About 4 hrs to fix
                                include/functions.php on lines 1498..1509

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

                                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

                                        case 'friends':
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/apprise-1.5.full.js'));
                                            $GLOBALS['xoTheme']->addStylesheet($helper->url('assets/css/jquery.fileupload-ui.css'));
                                            $GLOBALS['xoTheme']->addStylesheet($helper->url('assets/css/oembed.css'));
                                            $GLOBALS['xoTheme']->addScript($helper->url('assets/js/jquery.oembed.js'));
                                Severity: Major
                                Found in include/functions.php and 1 other location - About 4 hrs to fix
                                include/functions.php on lines 1524..1535

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

                                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 smallworldCheckPriv($id)
                                {
                                    $public = 'SELECT priv FROM ' . $GLOBALS['xoopsDB']->prefix('smallworld_messages') . ' WHERE msg_id = ' . $id . '';
                                    $result = $GLOBALS['xoopsDB']->queryF($public);
                                    while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
                                Severity: Minor
                                Found in include/functions.php and 1 other location - About 30 mins to fix
                                class/Mail.php on lines 232..241

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

                                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 smallworld_UsToEuroDate($stringDate)
                                {
                                    if (0 != $stringDate || '' != $stringDate) {
                                        $theData = explode('-', trim($stringDate));
                                        $ret     = $theData[2] . '-' . $theData[1] . '-' . $theData[0];
                                Severity: Minor
                                Found in include/functions.php and 1 other location - About 30 mins to fix
                                include/functions.php on lines 958..968

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

                                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 smallworld_euroToUsDate($stringDate)
                                {
                                    if (0 != $stringDate || '' != $stringDate) {
                                        $theData = explode('-', trim($stringDate));
                                        $ret     = $theData[2] . '-' . $theData[1] . '-' . $theData[0];
                                Severity: Minor
                                Found in include/functions.php and 1 other location - About 30 mins to fix
                                include/functions.php on lines 979..989

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

                                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

                                There are no issues that match your filters.

                                Category
                                Status