Code Duplication    Length = 23-23 lines in 2 locations

include/functions.php 2 locations

@@ 648-670 (lines=23) @@
645
}
646
647
// Find worst rated users overall
648
function Smallworld_worstratedusers()
649
{
650
    global $xoopsUser, $xoopsDB;
651
    $array = array();
652
    $counter = 1;
653
    $sql  = "SELECT owner, (";
654
    $sql .= "sum( up ) - sum( down )";
655
    $sql .= ") AS total";
656
    $sql .= " FROM ".$xoopsDB->prefix('smallworld_vote')."";
657
    $sql .= " GROUP BY owner ORDER by total ASC LIMIT 5";
658
    $result = $xoopsDB->queryF($sql);
659
    while ($row = $xoopsDB->fetchArray($result)) {
660
        $array[$counter]['counter'] = $counter;
661
        $array[$counter]['img'] = smallworld_getAvatarLink ($row["owner"], Smallworld_Gravatar($row["owner"]));
662
        $array[$counter]['user'] = $xoopsUser->getUnameFromId($row["owner"]);
663
        $array[$counter]['rating'] = $row["total"];
664
        $array[$counter]['user_link']  = "<a href = '".XOOPS_URL."/modules/smallworld/userprofile.php?username=".$array[$counter]['user']."'>";
665
        $array[$counter]['user_link'] .= $array[$counter]['user']." (".$array[$counter]['rating'].")</a>";
666
        $counter++;
667
    }
668
669
    return $array;
670
}
671
672
// Find best rated users overall
673
function Smallworld_topratedusers()
@@ 673-695 (lines=23) @@
670
}
671
672
// Find best rated users overall
673
function Smallworld_topratedusers()
674
{
675
    global $xoopsUser, $xoopsDB;
676
    $array = array();
677
    $counter = 1;
678
    $sql  = "SELECT owner, (";
679
    $sql .= "sum( up ) - sum( down )";
680
    $sql .= ") AS total";
681
    $sql .= " FROM ".$xoopsDB->prefix('smallworld_vote')."";
682
    $sql .= " GROUP BY owner ORDER by total DESC LIMIT 5";
683
    $result = $xoopsDB->queryF($sql);
684
    while ($row = $xoopsDB->fetchArray($result)) {
685
        $array[$counter]['counter'] = $counter;
686
        $array[$counter]['img'] = smallworld_getAvatarLink ($row["owner"], Smallworld_Gravatar($row["owner"]));
687
        $array[$counter]['user'] = $xoopsUser->getUnameFromId($row["owner"]);
688
        $array[$counter]['rating'] = $row["total"];
689
        $array[$counter]['user_link']  = "<a href = '".XOOPS_URL."/modules/smallworld/userprofile.php?username=".$array[$counter]['user']."'>";
690
        $array[$counter]['user_link'] .= $array[$counter]['user']." (".$array[$counter]['rating'].")</a>";
691
        $counter++;
692
    }
693
694
    return $array;
695
}
696
697
function smallworld_nextBirthdays()
698
{