Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
5be710bd
Commit
5be710bd
authored
Jul 12, 2010
by
Francois Marier
Browse files
gravatar images: add basic support for compatible avatar servers
Signed-off-by:
Francois Marier
<
francois@catalyst.net.nz
>
parent
6f74a19c
Changes
3
Hide whitespace changes
Inline
Side-by-side
htdocs/lang/en.utf8/help/forms/siteoptions.remoteavatars.html
View file @
5be710bd
...
...
@@ -17,3 +17,10 @@ Gravatar in such an environment would simply add extra delays.</p>
<p>
Also, for
<b>
sites delivered over https
</b>
, enabling Gravatar profile
icons might trigger security warnings on some browsers. This is due to the
fact that Gravatar images are served via normal unencrypted http.
</p>
<h4>
Custom avatar server
</h4>
<p>
If you have a custom avatar server which implements the Gravatar
protocol, you may specify its base url in your config.php file:
</p>
<p><code>
$cfg->remoteavatarbaseurl = 'http://example.com/avatar/';
</code></p>
htdocs/lib/config-defaults.php
View file @
5be710bd
...
...
@@ -222,4 +222,7 @@ $cfg->maxrunage = 300;
// if importing Leap2A over an xmlrpc mnet connection, set this to something higher than 0 to log import information
// see the constants in import/leap/lib.php
$cfg
->
leapovermnetloglevel
=
0
;
?>
// base URL of avatar server (with the trailing slash)
// This should normally be set to http://www.gravatar.com/avatar/
//$cfg->remoteavatarbaseurl = 'http://www.gravatar.com/avatar/';
htdocs/lib/user.php
View file @
5be710bd
...
...
@@ -1817,7 +1817,7 @@ function profile_icon_url($user, $maxwidth=40, $maxheight=40) {
return
$thumb
.
'?type=profileiconbyid&'
.
$sizeparams
.
'&id='
.
$user
->
profileicon
;
}
else
if
(
get_config
(
'remoteavatars'
))
{
return
g
ravatar
_icon
(
$user
->
email
,
array
(
'maxw'
=>
$maxwidth
,
'maxh'
=>
$maxheight
),
$notfound
);
return
r
emote_
avatar
(
$user
->
email
,
array
(
'maxw'
=>
$maxwidth
,
'maxh'
=>
$maxheight
),
$notfound
);
}
return
$notfound
;
}
...
...
@@ -1831,7 +1831,7 @@ function profile_icon_url($user, $maxwidth=40, $maxheight=40) {
*
* @returns string The URL of the image or FALSE if none was found
*/
function
g
ravatar
_icon
(
$email
,
$size
,
$notfound
)
{
function
r
emote_
avatar
(
$email
,
$size
,
$notfound
)
{
if
(
!
get_config
(
'remoteavatars'
))
{
return
false
;
}
...
...
@@ -1845,7 +1845,11 @@ function gravatar_icon($email, $size, $notfound) {
$s
=
min
(
$newsize
[
'w'
],
$newsize
[
'h'
]);
}
return
"http://www.gravatar.com/avatar/
{
$md5sum
}
.jpg?r=g&s=
$s
&d="
.
urlencode
(
$notfound
);
$baseurl
=
'http://www.gravatar.com/avatar/'
;
if
(
get_config
(
'remoteavatarbaseurl'
))
{
$baseurl
=
get_config
(
'remoteavatarbaseurl'
);
}
return
"
{
$baseurl
}{
$md5sum
}
.jpg?r=g&s=
$s
&d="
.
urlencode
(
$notfound
);
}
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment