forked from GNUsocial/gnu-social
Use $this->scoped in AvatarsettingsAction
This commit is contained in:
parent
952f68fed5
commit
bf34f730dd
@ -92,16 +92,6 @@ class AvatarsettingsAction extends SettingsAction
|
|||||||
|
|
||||||
function showUploadForm()
|
function showUploadForm()
|
||||||
{
|
{
|
||||||
$user = common_current_user();
|
|
||||||
|
|
||||||
$profile = $user->getProfile();
|
|
||||||
|
|
||||||
if (!$profile) {
|
|
||||||
common_log_db_error($user, 'SELECT', __FILE__);
|
|
||||||
// TRANS: Error message displayed when referring to a user without a profile.
|
|
||||||
$this->serverError(_('User has no profile.'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->elementStart('form', array('enctype' => 'multipart/form-data',
|
$this->elementStart('form', array('enctype' => 'multipart/form-data',
|
||||||
'method' => 'post',
|
'method' => 'post',
|
||||||
'id' => 'form_settings_avatar',
|
'id' => 'form_settings_avatar',
|
||||||
@ -116,7 +106,7 @@ class AvatarsettingsAction extends SettingsAction
|
|||||||
if (Event::handle('StartAvatarFormData', array($this))) {
|
if (Event::handle('StartAvatarFormData', array($this))) {
|
||||||
$this->elementStart('ul', 'form_data');
|
$this->elementStart('ul', 'form_data');
|
||||||
try {
|
try {
|
||||||
$original = Avatar::getUploaded($profile);
|
$original = Avatar::getUploaded($this->scoped);
|
||||||
|
|
||||||
$this->elementStart('li', array('id' => 'avatar_original',
|
$this->elementStart('li', array('id' => 'avatar_original',
|
||||||
'class' => 'avatar_view'));
|
'class' => 'avatar_view'));
|
||||||
@ -126,7 +116,7 @@ class AvatarsettingsAction extends SettingsAction
|
|||||||
$this->element('img', array('src' => $original->displayUrl(),
|
$this->element('img', array('src' => $original->displayUrl(),
|
||||||
'width' => $original->width,
|
'width' => $original->width,
|
||||||
'height' => $original->height,
|
'height' => $original->height,
|
||||||
'alt' => $user->nickname));
|
'alt' => $this->scoped->getNickname()));
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
} catch (NoAvatarException $e) {
|
} catch (NoAvatarException $e) {
|
||||||
@ -134,7 +124,7 @@ class AvatarsettingsAction extends SettingsAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
|
$avatar = $this->scoped->getAvatar(AVATAR_PROFILE_SIZE);
|
||||||
$this->elementStart('li', array('id' => 'avatar_preview',
|
$this->elementStart('li', array('id' => 'avatar_preview',
|
||||||
'class' => 'avatar_view'));
|
'class' => 'avatar_view'));
|
||||||
// TRANS: Header on avatar upload page for thumbnail of to be used rendition of uploaded avatar (h2).
|
// TRANS: Header on avatar upload page for thumbnail of to be used rendition of uploaded avatar (h2).
|
||||||
@ -143,7 +133,7 @@ class AvatarsettingsAction extends SettingsAction
|
|||||||
$this->element('img', array('src' => $avatar->displayUrl(),
|
$this->element('img', array('src' => $avatar->displayUrl(),
|
||||||
'width' => AVATAR_PROFILE_SIZE,
|
'width' => AVATAR_PROFILE_SIZE,
|
||||||
'height' => AVATAR_PROFILE_SIZE,
|
'height' => AVATAR_PROFILE_SIZE,
|
||||||
'alt' => $user->nickname));
|
'alt' => $this->scoped->getNickname()));
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
if (!empty($avatar->filename)) {
|
if (!empty($avatar->filename)) {
|
||||||
// TRANS: Button on avatar upload page to delete current avatar.
|
// TRANS: Button on avatar upload page to delete current avatar.
|
||||||
@ -180,16 +170,6 @@ class AvatarsettingsAction extends SettingsAction
|
|||||||
|
|
||||||
function showCropForm()
|
function showCropForm()
|
||||||
{
|
{
|
||||||
$user = common_current_user();
|
|
||||||
|
|
||||||
$profile = $user->getProfile();
|
|
||||||
|
|
||||||
if (!$profile) {
|
|
||||||
common_log_db_error($user, 'SELECT', __FILE__);
|
|
||||||
// TRANS: Error message displayed when referring to a user without a profile.
|
|
||||||
$this->serverError(_('User has no profile.'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->elementStart('form', array('method' => 'post',
|
$this->elementStart('form', array('method' => 'post',
|
||||||
'id' => 'form_settings_avatar',
|
'id' => 'form_settings_avatar',
|
||||||
'class' => 'form_settings',
|
'class' => 'form_settings',
|
||||||
@ -211,7 +191,7 @@ class AvatarsettingsAction extends SettingsAction
|
|||||||
$this->element('img', array('src' => Avatar::url($this->filedata['filename']),
|
$this->element('img', array('src' => Avatar::url($this->filedata['filename']),
|
||||||
'width' => $this->filedata['width'],
|
'width' => $this->filedata['width'],
|
||||||
'height' => $this->filedata['height'],
|
'height' => $this->filedata['height'],
|
||||||
'alt' => $user->nickname));
|
'alt' => $this->scoped->getNickname()));
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
|
|
||||||
@ -224,7 +204,7 @@ class AvatarsettingsAction extends SettingsAction
|
|||||||
$this->element('img', array('src' => Avatar::url($this->filedata['filename']),
|
$this->element('img', array('src' => Avatar::url($this->filedata['filename']),
|
||||||
'width' => AVATAR_PROFILE_SIZE,
|
'width' => AVATAR_PROFILE_SIZE,
|
||||||
'height' => AVATAR_PROFILE_SIZE,
|
'height' => AVATAR_PROFILE_SIZE,
|
||||||
'alt' => $user->nickname));
|
'alt' => $this->scoped->getNickname()));
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
|
|
||||||
foreach (array('avatar_crop_x', 'avatar_crop_y',
|
foreach (array('avatar_crop_x', 'avatar_crop_y',
|
||||||
|
Loading…
Reference in New Issue
Block a user