Code Duplication    Length = 31-31 lines in 2 locations

class/utility.php 1 location

@@ 145-175 (lines=31) @@
142
     * @param  integer $name   :  0 Use Usenamer 1 Use realname
143
     * @return string
144
     */
145
    public static function getLinkedUnameFromId($userid = 0, $name = 0)
146
    {
147
        if (!is_numeric($userid)) {
148
            return $userid;
149
        }
150
        $myts   = MyTextSanitizer::getInstance();
151
        $userid = (int)$userid;
152
        if ($userid > 0) {
153
            $memberHandler = xoops_getHandler('member');
154
            $user          = $memberHandler->getUser($userid);
155
156
            if (is_object($user)) {
157
                $username  = $user->getVar('uname');
158
                $usernameu = $user->getVar('name');
159
160
                if ($name && !empty($usernameu)) {
161
                    $username = $user->getVar('name');
162
                }
163
                if (!empty($usernameu)) {
164
                    $linkeduser = $myts->htmlSpecialChars($usernameu) . " [<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $myts->htmlSpecialChars($username) . '</a>]';
165
                } else {
166
                    //                    $linkeduser = "<a href='".XOOPS_URL."/userinfo.php?uid=".$userid."'>". ucfirst($ts->htmlSpecialChars($username)) .'</a>';
167
                    $linkeduser = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $myts->htmlSpecialChars($username) . '</a>';
168
                }
169
170
                return $linkeduser;
171
            }
172
        }
173
174
        return $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']);
175
    }
176
177
    /*
178
    public static function displayimage($image = 'blank.gif', $path = '', $imgsource = '', $alttext = '')

include/functions.php 1 location

@@ 30-60 (lines=31) @@
27
 * @param  integer $name   :  0 Use Usenamer 1 Use realname
28
 * @return string
29
 */
30
function getLinkedUnameFromId($userid = 0, $name = 0)
31
{
32
    if (!is_numeric($userid)) {
33
        return $userid;
34
    }
35
    $myts   = MyTextSanitizer::getInstance();
36
    $userid = (int)$userid;
37
    if ($userid > 0) {
38
        $memberHandler = xoops_getHandler('member');
39
        $user          = $memberHandler->getUser($userid);
40
41
        if (is_object($user)) {
42
            $username  = $user->getVar('uname');
43
            $usernameu = $user->getVar('name');
44
45
            if ($name && !empty($usernameu)) {
46
                $username = $user->getVar('name');
47
            }
48
            if (!empty($usernameu)) {
49
                $linkeduser = $myts->htmlSpecialChars($usernameu) . " [<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $myts->htmlSpecialChars($username) . '</a>]';
50
            } else {
51
                //                    $linkeduser = "<a href='".XOOPS_URL."/userinfo.php?uid=".$userid."'>". ucfirst($ts->htmlSpecialChars($username)) .'</a>';
52
                $linkeduser = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $myts->htmlSpecialChars($username) . '</a>';
53
            }
54
55
            return $linkeduser;
56
        }
57
    }
58
59
    return $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']);
60
}
61
62
/*
63
function displayimage($image = 'blank.gif', $path = '', $imgsource = '', $alttext = '')