Code Duplication    Length = 29-29 lines in 2 locations

class/wall.php 1 location

@@ 132-160 (lines=29) @@
129
     * @param  int    $uid
130
     * @return string
131
     */
132
    public function Gravatar($uid)
133
    {
134
        global $xoopsUser, $xoopsDB;
135
        $image='';
136
        $sql = "SELECT userimage FROM ".$xoopsDB->prefix('smallworld_user')." WHERE userid = '".$uid."'";
137
        $result = $xoopsDB->queryF($sql);
138
        while ($r = $xoopsDB->fetchArray($result)) {
139
            $image = $r['userimage'];
140
        }
141
        
142
        $image = ($image == '' || $image == 'blank.gif') ? smallworld_getAvatarLink($uid, $image) : $image;
143
        
144
        $type = Array(
145
                    1 => 'jpg',
146
                    2 => 'jpeg',
147
                    3 => 'png',
148
                    4 => 'gif'
149
                );
150
        
151
        $ext = explode(".",$image);
152
        
153
        if (@!in_array(strtolower ($ext[1]), $type) || $image == '') {
154
            $avatar = '';
155
        } else {
156
            $avatar = $image;
157
        }
158
159
        return $avatar;
160
    }
161
    
162
    /**
163
     * @Insert update

include/functions.php 1 location

@@ 583-611 (lines=29) @@
580
    return $nu;
581
}
582
//Avatar Image
583
function Smallworld_Gravatar($uid)
584
{
585
    global $xoopsUser, $xoopsDB;
586
    $image='';
587
    $sql = "SELECT userimage FROM ".$xoopsDB->prefix('smallworld_user')." WHERE userid = '".$uid."'";
588
    $result = $xoopsDB->queryF($sql);
589
    while ($r = $xoopsDB->fetchArray($result)) {
590
        $image = $r['userimage'];
591
    }
592
    
593
    $image = ($image == '' || $image == 'blank.gif') ? smallworld_getAvatarLink($uid, $image) : $image;
594
    
595
    $type = Array(
596
                1 => 'jpg',
597
                2 => 'jpeg',
598
                3 => 'png',
599
                4 => 'gif'
600
            );
601
    
602
    $ext = explode(".",$image);
603
    
604
    if (@!in_array(strtolower ($ext[1]), $type) || $image == '') {
605
        $avatar = '';
606
    } else {
607
        $avatar = $image;
608
    }
609
610
    return $avatar;
611
}
612
    
613
// find user with most posted messages
614
function Smallworld_mostactiveusers_allround()