mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Fixed an potential exception on user info page, when user has no email set.
This commit is contained in:
parent
a516879258
commit
74fb21686c
1 changed files with 5 additions and 1 deletions
|
@ -250,8 +250,12 @@ class UserController extends AdminPages\BaseAdminController
|
|||
* @return string containing either just a URL or a complete image tag
|
||||
* @source https://gravatar.com/site/implement/images/php/
|
||||
*/
|
||||
public function getGravatar(string $email, int $s = 80, string $d = 'mm', string $r = 'g', bool $img = false, array $atts = array())
|
||||
public function getGravatar(?string $email, int $s = 80, string $d = 'mm', string $r = 'g', bool $img = false, array $atts = array())
|
||||
{
|
||||
if ($email === null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
$url = 'https://www.gravatar.com/avatar/';
|
||||
$url .= md5(strtolower(trim($email)));
|
||||
$url .= "?s=$s&d=$d&r=$r";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue