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
8ddf3295
Commit
8ddf3295
authored
Oct 18, 2014
by
Son Nguyen
Committed by
Gerrit Code Review
Oct 18, 2014
Browse files
Merge "Fix the parameters for remote_avatar_url(). Bug 1380433"
parents
91c9e3c3
da977d00
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/user.php
View file @
8ddf3295
...
...
@@ -2672,23 +2672,28 @@ function anonymous_icon_url($maxwidth=40, $maxheight=40, $email=null) {
* If the avatar does not exist, return anonymous avatar
*
* @param string $email Email address of the user
* @param
object
$size
Maximum s
ize of the image
* @param
mixed
$size
S
ize of the image
* @returns string $url The remote avatar URL
*/
function
remote_avatar_url
(
$email
,
$size
)
{
global
$THEME
;
$s
=
100
;
$newsize
=
image_get_new_dimensions
(
$s
,
$s
,
$size
);
if
(
$newsize
)
{
$s
=
min
(
$newsize
[
'w'
],
$newsize
[
'h'
]);
}
// Available sizes of the 'no_userphoto' image:
$allowedsizes
=
array
(
16
,
20
,
25
,
40
,
50
,
60
,
100
);
if
(
!
in_array
(
$s
ize
,
$allowedsizes
))
{
if
(
!
in_array
(
$s
,
$allowedsizes
))
{
log_warn
(
'remote_avatar_url: size should be in ('
.
join
(
', '
,
$allowedsizes
)
.
')'
);
}
else
{
$s
ize
=
40
;
$s
=
40
;
}
$notfound
=
$THEME
->
get_url
(
'images/no_userphoto'
.
$s
ize
.
'.png'
);
$notfound
=
$THEME
->
get_url
(
'images/no_userphoto'
.
$s
.
'.png'
);
if
(
!
empty
(
$email
)
&&
get_config
(
'remoteavatars'
))
{
return
remote_avatar
(
$email
,
$s
ize
,
$notfound
);
return
remote_avatar
(
$email
,
$s
,
$notfound
);
}
return
$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