Fix avatar erros

This commit is contained in:
Celestina Rempai 2021-02-06 20:38:39 +00:00 committed by Alma Armas
parent 19000c2f03
commit 574f4918e5
3 changed files with 11 additions and 15 deletions

View file

@ -40,10 +40,8 @@ class Club extends RowModel
function getAvatarUrl(): string
{
$url = ((!empty($_SERVER['HTTPS'])) ? 'https' : 'http') . '://' . $_SERVER['SERVER_NAME'] . '/';
$url = explode('?', $url);
$serverUrl = $url[0];
$avPhoto = $this->getAvatarPhoto();
$serverUrl = ovk_scheme(true) . $_SERVER["SERVER_NAME"];
$avPhoto = $this->getAvatarPhoto();
return is_null($avPhoto) ? "$serverUrl/assets/packages/static/openvk/img/camera_200.png" : $avPhoto->getURL();
}

View file

@ -103,9 +103,7 @@ class User extends RowModel
function getAvatarUrl(): string
{
$url = ((!empty($_SERVER['HTTPS'])) ? 'https' : 'http') . '://' . $_SERVER['SERVER_NAME'];
$url = explode('?', $url);
$serverUrl = $url[0];
$serverUrl = ovk_scheme(true) . $_SERVER["SERVER_NAME"];
if($this->getRecord()->deleted)
return "$serverUrl/assets/packages/static/openvk/img/camera_200.png";
@ -370,20 +368,16 @@ class User extends RowModel
if(!$this->getRecord()->status) {
$unfilled[] = "status";
$incompleteness += 10;
$incompleteness += 15;
}
if(!$this->getRecord()->telegram) {
$unfilled[] = "telegram";
$incompleteness += 10;
$incompleteness += 15;
}
if(!$this->getRecord()->email) {
$unfilled[] = "email";
$incompleteness += 20;
}
if(!$this->getRecord()->phone) {
$unfilled[] = "phone";
$incompleteness += 20;
}
if(!$this->getRecord()->city) {
$unfilled[] = "city";
$incompleteness += 20;

View file

@ -156,9 +156,13 @@ function ovk_is_ssl(): bool
return $GLOBALS["requestIsSSL"];
}
function ovk_scheme(): string
function ovk_scheme(bool $with_slashes = false): string
{
return ovk_is_ssl() ? "https" : "http";
$scheme = ovk_is_ssl() ? "https" : "http";
if($with_slashes)
$scheme .= "://";
return $scheme;
}
return (function() {