diff options
author | kondou <kondou@ts.unde.re> | 2013-08-17 11:01:47 +0200 |
---|---|---|
committer | kondou <kondou@ts.unde.re> | 2013-08-25 21:05:40 +0200 |
commit | 9c12da6a94578002aef016d7196a78acf2623eb7 (patch) | |
tree | 603c0a43ba7374eb8951272d879edc8df0774f55 /lib | |
parent | d7e6c77e208f561f994ce7b9f2274fb30b75049f (diff) | |
download | nextcloud-server-9c12da6a94578002aef016d7196a78acf2623eb7.tar.gz nextcloud-server-9c12da6a94578002aef016d7196a78acf2623eb7.zip |
Several improvements
- Don't use gravatars default avatars
- Use "profile image" instead of "avatar"
- Use <p> instead of tables
- Ease updateAvatar()
- Actually return something in \OCP\Avatar
Diffstat (limited to 'lib')
-rw-r--r-- | lib/avatar.php | 15 | ||||
-rw-r--r-- | lib/public/avatar.php | 4 |
2 files changed, 12 insertions, 7 deletions
diff --git a/lib/avatar.php b/lib/avatar.php index 49c82709154..f503d01304d 100644 --- a/lib/avatar.php +++ b/lib/avatar.php @@ -86,16 +86,19 @@ class OC_Avatar { * @param $user string which user to get the gravatar for * @param size integer size in px of the avatar, defaults to 64 * @return string link to the gravatar, or \OC_Image with the default avatar + * @todo work on hashing userstrings, so one can't guess usernames */ public static function getGravatar ($user, $size = 64) { $email = \OC_Preferences::getValue($user, 'settings', 'email'); if ($email !== null) { $emailhash = md5(strtolower(trim($email))); - $url = "http://www.gravatar.com/avatar/".$emailhash."?s=".$size; - return $url; - } else { - return self::getDefaultAvatar($size); + $url = "http://secure.gravatar.com/avatar/".$emailhash."?d=404&s=".$size; + $headers = get_headers($url, 1); + if (strpos($headers[0], "404 Not Found") === false) { + return $url; + } } + return self::getDefaultAvatar($size); } /** @@ -121,7 +124,7 @@ class OC_Avatar { } /** - * + * @todo todo */ public static function getCustomAvatar($user, $size) { // TODO @@ -129,8 +132,10 @@ class OC_Avatar { /** * @brief gets the default avatar + * @todo when custom default images arive @param $user string which user to get the avatar for * @param $size integer size of the avatar in px, defaults to 64 * @return \OC_Image containing the default avatar + * @todo use custom default images, when they arive */ public static function getDefaultAvatar ($size = 64) { $default = new OC_Image(OC::$SERVERROOT."/core/img/defaultavatar.png"); diff --git a/lib/public/avatar.php b/lib/public/avatar.php index 5d432f07cce..768d292346f 100644 --- a/lib/public/avatar.php +++ b/lib/public/avatar.php @@ -10,10 +10,10 @@ namespace OCP; class Avatar { public static function get ($user, $size = 64) { - \OC_Avatar::get($user, $size); + return \OC_Avatar::get($user, $size); } public static function getMode () { - \OC_Avatar::getMode(); + return \OC_Avatar::getMode(); } } |