| @@ 142-170 (lines=29) @@ | ||
| 139 | * @param int $uid |
|
| 140 | * @return string |
|
| 141 | */ |
|
| 142 | public function Gravatar($uid) |
|
| 143 | { |
|
| 144 | global $xoopsUser, $xoopsDB; |
|
| 145 | $image = ''; |
|
| 146 | $sql = 'SELECT userimage FROM ' . $xoopsDB->prefix('smallworld_user') . " WHERE userid = '" . $uid . "'"; |
|
| 147 | $result = $xoopsDB->queryF($sql); |
|
| 148 | while (false !== ($r = $xoopsDB->fetchArray($result))) { |
|
| 149 | $image = $r['userimage']; |
|
| 150 | } |
|
| 151 | ||
| 152 | $image = ('' == $image || 'blank.gif' === $image) ? smallworld_getAvatarLink($uid, $image) : $image; |
|
| 153 | ||
| 154 | $type = [ |
|
| 155 | 1 => 'jpg', |
|
| 156 | 2 => 'jpeg', |
|
| 157 | 3 => 'png', |
|
| 158 | 4 => 'gif', |
|
| 159 | ]; |
|
| 160 | ||
| 161 | $ext = explode('.', $image); |
|
| 162 | ||
| 163 | if (@!in_array(mb_strtolower($ext[1]), $type) || '' == $image) { |
|
| 164 | $avatar = ''; |
|
| 165 | } else { |
|
| 166 | $avatar = $image; |
|
| 167 | } |
|
| 168 | ||
| 169 | return $avatar; |
|
| 170 | } |
|
| 171 | ||
| 172 | /** |
|
| 173 | * @Insert update |
|
| @@ 678-706 (lines=29) @@ | ||
| 675 | * @param $uid |
|
| 676 | * @return string |
|
| 677 | */ |
|
| 678 | function smallworld_Gravatar($uid) |
|
| 679 | { |
|
| 680 | global $xoopsUser, $xoopsDB; |
|
| 681 | $image = ''; |
|
| 682 | $sql = 'SELECT userimage FROM ' . $xoopsDB->prefix('smallworld_user') . " WHERE userid = '" . $uid . "'"; |
|
| 683 | $result = $xoopsDB->queryF($sql); |
|
| 684 | while (false !== ($r = $xoopsDB->fetchArray($result))) { |
|
| 685 | $image = $r['userimage']; |
|
| 686 | } |
|
| 687 | ||
| 688 | $image = ('' == $image || 'blank.gif' === $image) ? smallworld_getAvatarLink($uid, $image) : $image; |
|
| 689 | ||
| 690 | $type = [ |
|
| 691 | 1 => 'jpg', |
|
| 692 | 2 => 'jpeg', |
|
| 693 | 3 => 'png', |
|
| 694 | 4 => 'gif', |
|
| 695 | ]; |
|
| 696 | ||
| 697 | $ext = explode('.', $image); |
|
| 698 | ||
| 699 | if (@!in_array(mb_strtolower($ext[1]), $type) || '' == $image) { |
|
| 700 | $avatar = ''; |
|
| 701 | } else { |
|
| 702 | $avatar = $image; |
|
| 703 | } |
|
| 704 | ||
| 705 | return $avatar; |
|
| 706 | } |
|
| 707 | ||
| 708 | // find user with most posted messages |
|
| 709 | /** |
|