The notice and info have been moved

This commit is contained in:
Michael 2022-10-17 18:55:22 +00:00
parent 20291ddc2b
commit fdfa1f8630
73 changed files with 273 additions and 284 deletions

View file

@ -80,7 +80,7 @@ class Index extends BaseSettings
$name = trim($_POST['name'] ?? '');
if (!strlen($name)) {
notice(DI::l10n()->t('Profile Name is required.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Profile Name is required.'));
return;
}
@ -128,7 +128,7 @@ class Index extends BaseSettings
);
if (!$result) {
notice(DI::l10n()->t('Profile couldn\'t be updated.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Profile couldn\'t be updated.'));
return;
}
@ -138,7 +138,7 @@ class Index extends BaseSettings
protected function content(array $request = []): string
{
if (!local_user()) {
notice(DI::l10n()->t('You must be logged in to use this module'));
DI::sysmsg()->addNotice(DI::l10n()->t('You must be logged in to use this module'));
return Login::form();
}

View file

@ -105,7 +105,7 @@ class Crop extends BaseSettings
Photo::USER_AVATAR
);
if ($r === false) {
notice(DI::l10n()->t('Image size reduction [%s] failed.', '300'));
DI::sysmsg()->addNotice(DI::l10n()->t('Image size reduction [%s] failed.', '300'));
} else {
Photo::update(['profile' => true], array_merge($condition, ['scale' => 4]));
}
@ -123,7 +123,7 @@ class Crop extends BaseSettings
Photo::USER_AVATAR
);
if ($r === false) {
notice(DI::l10n()->t('Image size reduction [%s] failed.', '80'));
DI::sysmsg()->addNotice(DI::l10n()->t('Image size reduction [%s] failed.', '80'));
} else {
Photo::update(['profile' => true], array_merge($condition, ['scale' => 5]));
}
@ -141,19 +141,19 @@ class Crop extends BaseSettings
Photo::USER_AVATAR
);
if ($r === false) {
notice(DI::l10n()->t('Image size reduction [%s] failed.', '48'));
DI::sysmsg()->addNotice(DI::l10n()->t('Image size reduction [%s] failed.', '48'));
} else {
Photo::update(['profile' => true], array_merge($condition, ['scale' => 6]));
}
Contact::updateSelfFromUserID(local_user(), true);
info(DI::l10n()->t('Shift-reload the page or clear browser cache if the new photo does not display immediately.'));
DI::sysmsg()->addInfo(DI::l10n()->t('Shift-reload the page or clear browser cache if the new photo does not display immediately.'));
// Update global directory in background
Profile::publishUpdate(local_user());
} else {
notice(DI::l10n()->t('Unable to process image'));
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to process image'));
}
}
@ -194,7 +194,7 @@ class Crop extends BaseSettings
// Update global directory in background
Profile::publishUpdate(local_user());
info(DI::l10n()->t('Profile picture successfully updated.'));
DI::sysmsg()->addInfo(DI::l10n()->t('Profile picture successfully updated.'));
DI::baseUrl()->redirect('profile/' . DI::app()->getLoggedInUserNickname());
}

View file

@ -43,7 +43,7 @@ class Index extends BaseSettings
self::checkFormSecurityTokenRedirectOnError('/settings/profile/photo', 'settings_profile_photo');
if (empty($_FILES['userfile'])) {
notice(DI::l10n()->t('Missing uploaded image.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Missing uploaded image.'));
return;
}
@ -57,7 +57,7 @@ class Index extends BaseSettings
$maximagesize = DI::config()->get('system', 'maximagesize', 0);
if ($maximagesize && $filesize > $maximagesize) {
notice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));
DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));
@unlink($src);
return;
}
@ -66,7 +66,7 @@ class Index extends BaseSettings
$Image = new Image($imagedata, $filetype);
if (!$Image->isValid()) {
notice(DI::l10n()->t('Unable to process image.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to process image.'));
@unlink($src);
return;
}
@ -93,13 +93,13 @@ class Index extends BaseSettings
$filename = '';
if (!Photo::store($Image, local_user(), 0, $resource_id, $filename, DI::l10n()->t(Photo::PROFILE_PHOTOS), 0, Photo::USER_AVATAR)) {
notice(DI::l10n()->t('Image upload failed.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Image upload failed.'));
}
if ($width > 640 || $height > 640) {
$Image->scaleDown(640);
if (!Photo::store($Image, local_user(), 0, $resource_id, $filename, DI::l10n()->t(Photo::PROFILE_PHOTOS), 1, Photo::USER_AVATAR)) {
notice(DI::l10n()->t('Image size reduction [%s] failed.', '640'));
DI::sysmsg()->addNotice(DI::l10n()->t('Image size reduction [%s] failed.', '640'));
}
}