XoopsModules25x/smallworld

View on GitHub

Showing 1,838 of 1,838 total issues

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

            if (0 != smallworldGetValfromArray('streetadress', 'smallworldusethesefields')) {
                $adress = $item->input('adress', 'adress', 'adress', $size = '50', $preset = stripslashes($r['adress']));
                $xoopsTpl->append('adress', $adress);
            } else {
                $xoopsTpl->assign('show_adress', 'no');
Severity: Minor
Found in editprofile.php and 1 other location - About 30 mins to fix
editprofile.php on lines 111..116

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

    if (0 != smallworldGetValfromArray('birthplace', 'smallworldusethesefields')) {
        $birthplace = $item->input('birthplace', 'birthplace', 'birthplace', $size = '50', $preset = null);
        $GLOBALS['xoopsTpl']->append('birthplace', $birthplace);
    } else {
        $GLOBALS['xoopsTpl']->assign('show_birthplace', 'no');
Severity: Minor
Found in register.php and 2 other locations - About 30 mins to fix
register.php on lines 118..126
register.php on lines 195..200

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

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

    public function getOwnerUpdateFromMsgID($msgid)
    {
        $sql    = 'SELECT message FROM ' . $GLOBALS['xoopsDB']->prefix('smallworld_messages') . " WHERE msg_id = '" . $msgid . "'";
        $result = $GLOBALS['xoopsDB']->queryF($sql);
        while (false !== ($r = $GLOBALS['xoopsDB']->fetchArray($result))) {
Severity: Minor
Found in class/Mail.php and 1 other location - About 30 mins to fix
include/functions.php on lines 1005..1014

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

    if (0 != smallworldGetValfromArray('streetadress', 'smallworldusethesefields')) {
        $adress = $item->input('adress', 'adress', 'adress', $size = '50', $preset = null);
        $GLOBALS['xoopsTpl']->append('adress', $adress);
    } else {
        $GLOBALS['xoopsTpl']->assign('show_adress', 'no');
Severity: Minor
Found in register.php and 2 other locations - About 30 mins to fix
register.php on lines 118..126
register.php on lines 129..134

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

    if (0 != smallworldGetValfromArray('birthday', 'smallworldusethesefields')) {
        //$birthEle = new \XoopsFormText('', 'birthday', 12, 12);
        //$birthEle->setExtra("class='birthday smallworld_select'");
        //$birthday = $birthEle->render();
        $birthday = $item->input('birthday', 'birthday', 'birthday', $size = '12', $preset = null);
Severity: Minor
Found in register.php and 2 other locations - About 30 mins to fix
register.php on lines 129..134
register.php on lines 195..200

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

            if (0 != smallworldGetValfromArray('birthplace', 'smallworldusethesefields')) {
                $birthplace = $item->input('birthplace', 'birthplace', 'birthplace', $size = '50', $preset = stripslashes($r['birthplace']));
                $xoopsTpl->append('birthplace', $birthplace);
            } else {
                $xoopsTpl->assign('show_birthplace', 'no');
Severity: Minor
Found in editprofile.php and 1 other location - About 30 mins to fix
editprofile.php on lines 194..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 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

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 following_or has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function following_or($userId, $friendId)
    {
        $respons = [0 => 0]; // init the array
        if ($userId != $friendId) {
            $sql    = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('smallworld_followers') . " WHERE me = '" . (int)$userId . "' AND you = '" . (int)$friendId . "'";
Severity: Minor
Found in class/User.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 post has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function post($print_response = true)
    {
        if (isset($_REQUEST['_method']) && 'DELETE' === $_REQUEST['_method']) {
            return $this->delete($print_response);
        }
Severity: Minor
Found in class/UploadHandler.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 Gravatar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

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

    public function Gravatar($uid)
    {
        $depMsg = get_class() . __FUNCTION__ . " is deprecated use SwUserHandler::gravatar() instead.";
        if (isset($GLOBALS['xoopsLogger'])) {
            $GLOBALS['xoopsLogger']->addDeprecated($depMsg);
Severity: Minor
Found in class/WallUpdates.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 convertIPAddresses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function convertIPAddresses($tableName, $columnName)
    {
        if ($this->tableHandler->useTable($tableName)) {
            $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName);
            if (false !== mb_strpos($attributes, ' int(')) {
Severity: Minor
Found in class/Common/Migrate.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 getAvatarLink has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAvatarLink($userId, $image)
    {
        $swUser = $this->getByUserId($userId);
        $gender = (false !== $swUser) ? $swUser->getVar('gender') : Constants::GENDER_UNKNOWN;
        $link   = (preg_match('/avatars/i', $image)) ? XOOPS_UPLOAD_URL . '/' . $image : $image;
Severity: Minor
Found in class/SwUserHandler.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

Severity
Category
Status
Source
Language