1
0
Fork 0

The notice and info have been moved

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

View file

@ -49,7 +49,7 @@ function lostpass_post(App $a)
];
$result = DBA::update('user', $fields, ['uid' => $user['uid']]);
if ($result) {
info(DI::l10n()->t('Password reset request issued. Check your email.'));
DI::sysmsg()->addInfo(DI::l10n()->t('Password reset request issued. Check your email.'));
}
$sitename = DI::config()->get('config', 'sitename');
@ -152,7 +152,7 @@ function lostpass_generate_password($user)
'$newpass' => $new_password,
]);
info(DI::l10n()->t("Your password has been reset."));
DI::sysmsg()->addInfo(DI::l10n()->t("Your password has been reset."));
$sitename = DI::config()->get('config', 'sitename');
$preamble = Strings::deindent(DI::l10n()->t('

View file

@ -90,7 +90,7 @@ function match_content(App $a)
}
if (empty($entries)) {
info(DI::l10n()->t('No matches'));
DI::sysmsg()->addInfo(DI::l10n()->t('No matches'));
}
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');

View file

@ -30,7 +30,7 @@ use Friendica\Protocol\ActivityPub;
function ostatus_subscribe_content(App $a)
{
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect('ostatus_subscribe');
// NOTREACHED
}

View file

@ -157,14 +157,14 @@ function photos_post(App $a)
}
if (!$can_post) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
System::exit();
}
$owner_record = User::getOwnerDataById($page_owner_uid);
if (!$owner_record) {
notice(DI::l10n()->t('Contact information unavailable'));
DI::sysmsg()->addNotice(DI::l10n()->t('Contact information unavailable'));
DI::logger()->info('photos_post: unable to locate contact record for page owner. uid=' . $page_owner_uid);
System::exit();
}
@ -193,7 +193,7 @@ function photos_post(App $a)
$album = hex2bin(DI::args()->getArgv()[3]);
if (!DBA::exists('photo', ['album' => $album, 'uid' => $page_owner_uid, 'photo-type' => Photo::DEFAULT])) {
notice(DI::l10n()->t('Album not found.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Album not found.'));
DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album');
return; // NOTREACHED
}
@ -247,9 +247,9 @@ function photos_post(App $a)
// Update the photo albums cache
Photo::clearAlbumCache($page_owner_uid);
notice(DI::l10n()->t('Album successfully deleted'));
DI::sysmsg()->addNotice(DI::l10n()->t('Album successfully deleted'));
} else {
notice(DI::l10n()->t('Album was empty.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Album was empty.'));
}
}
@ -281,7 +281,7 @@ function photos_post(App $a)
// Update the photo albums cache
Photo::clearAlbumCache($page_owner_uid);
} else {
notice(DI::l10n()->t('Failed to delete the photo.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Failed to delete the photo.'));
DI::baseUrl()->redirect('photos/' . DI::args()->getArgv()[1] . '/image/' . DI::args()->getArgv()[3]);
}
@ -633,21 +633,21 @@ function photos_post(App $a)
if ($error !== UPLOAD_ERR_OK) {
switch ($error) {
case UPLOAD_ERR_INI_SIZE:
notice(DI::l10n()->t('Image exceeds size limit of %s', ini_get('upload_max_filesize')));
DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', ini_get('upload_max_filesize')));
break;
case UPLOAD_ERR_FORM_SIZE:
notice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($_REQUEST['MAX_FILE_SIZE'] ?? 0)));
DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($_REQUEST['MAX_FILE_SIZE'] ?? 0)));
break;
case UPLOAD_ERR_PARTIAL:
notice(DI::l10n()->t('Image upload didn\'t complete, please try again'));
DI::sysmsg()->addNotice(DI::l10n()->t('Image upload didn\'t complete, please try again'));
break;
case UPLOAD_ERR_NO_FILE:
notice(DI::l10n()->t('Image file is missing'));
DI::sysmsg()->addNotice(DI::l10n()->t('Image file is missing'));
break;
case UPLOAD_ERR_NO_TMP_DIR:
case UPLOAD_ERR_CANT_WRITE:
case UPLOAD_ERR_EXTENSION:
notice(DI::l10n()->t('Server can\'t accept new file upload at this time, please contact your administrator'));
DI::sysmsg()->addNotice(DI::l10n()->t('Server can\'t accept new file upload at this time, please contact your administrator'));
break;
}
@unlink($src);
@ -663,7 +663,7 @@ function photos_post(App $a)
$maximagesize = DI::config()->get('system', 'maximagesize');
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);
$foo = 0;
Hook::callAll('photo_post_end', $foo);
@ -671,7 +671,7 @@ function photos_post(App $a)
}
if (!$filesize) {
notice(DI::l10n()->t('Image file is empty.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Image file is empty.'));
@unlink($src);
$foo = 0;
Hook::callAll('photo_post_end', $foo);
@ -686,7 +686,7 @@ function photos_post(App $a)
if (!$image->isValid()) {
Logger::notice('unable to process image');
notice(DI::l10n()->t('Unable to process image.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to process image.'));
@unlink($src);
$foo = 0;
Hook::callAll('photo_post_end',$foo);
@ -712,7 +712,7 @@ function photos_post(App $a)
if (!$r) {
Logger::warning('image store failed');
notice(DI::l10n()->t('Image upload failed.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Image upload failed.'));
return;
}
@ -799,12 +799,12 @@ function photos_content(App $a)
}
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
notice(DI::l10n()->t('Public access denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Public access denied.'));
return;
}
if (empty($user)) {
notice(DI::l10n()->t('No photos selected'));
DI::sysmsg()->addNotice(DI::l10n()->t('No photos selected'));
return;
}
@ -873,7 +873,7 @@ function photos_content(App $a)
}
if ($user['hidewall'] && (local_user() != $owner_uid) && !$remote_contact) {
notice(DI::l10n()->t('Access to this item is restricted.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Access to this item is restricted.'));
return;
}
@ -888,7 +888,7 @@ function photos_content(App $a)
// Display upload form
if ($datatype === 'upload') {
if (!$can_post) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
@ -1088,9 +1088,9 @@ function photos_content(App $a)
if (!DBA::isResult($ph)) {
if (DBA::exists('photo', ['resource-id' => $datum, 'uid' => $owner_uid])) {
notice(DI::l10n()->t('Permission denied. Access to this item may be restricted.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied. Access to this item may be restricted.'));
} else {
notice(DI::l10n()->t('Photo not available'));
DI::sysmsg()->addNotice(DI::l10n()->t('Photo not available'));
}
return;
}

View file

@ -28,7 +28,7 @@ use Friendica\Model\Contact;
function repair_ostatus_content(App $a) {
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect('ostatus_repair');
// NOTREACHED
}

View file

@ -37,7 +37,7 @@ use Friendica\Protocol\Email;
function settings_init(App $a)
{
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
@ -47,7 +47,7 @@ function settings_init(App $a)
function settings_post(App $a)
{
if (!$a->isLoggedIn()) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
@ -119,7 +119,7 @@ function settings_post(App $a)
$mbox = Email::connect($mb, $mail_user, $dcrpass);
unset($dcrpass);
if (!$mbox) {
notice(DI::l10n()->t('Failed to connect with email account using the settings provided.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Failed to connect with email account using the settings provided.'));
}
}
}
@ -148,12 +148,12 @@ function settings_content(App $a)
Nav::setSelected('settings');
if (!local_user()) {
//notice(DI::l10n()->t('Permission denied.'));
//DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return Login::form();
}
if (!empty($_SESSION['submanage'])) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return '';
}

View file

@ -30,7 +30,7 @@ use Friendica\DI;
function uimport_post(App $a)
{
if ((DI::config()->get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !$a->isSiteAdmin()) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
@ -43,7 +43,7 @@ function uimport_post(App $a)
function uimport_content(App $a)
{
if ((DI::config()->get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !$a->isSiteAdmin()) {
notice(DI::l10n()->t('User imports on closed servers can only be done by an administrator.'));
DI::sysmsg()->addNotice(DI::l10n()->t('User imports on closed servers can only be done by an administrator.'));
return;
}
@ -52,7 +52,7 @@ function uimport_content(App $a)
$total = DBA::count('user', ["`register_date` > UTC_TIMESTAMP - INTERVAL 1 DAY"]);
if ($total >= $max_dailies) {
Logger::notice('max daily registrations exceeded.');
notice(DI::l10n()->t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.'));
DI::sysmsg()->addNotice(DI::l10n()->t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.'));
return;
}
}

View file

@ -32,7 +32,7 @@ use Friendica\Util\Strings;
function unfollow_post(App $a)
{
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect('login');
// NOTREACHED
}
@ -47,7 +47,7 @@ function unfollow_content(App $a)
$base_return_path = 'contact';
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect('login');
// NOTREACHED
}
@ -62,13 +62,13 @@ function unfollow_content(App $a)
$contact = DBA::selectFirst('contact', ['url', 'id', 'uid', 'network', 'addr', 'name'], $condition);
if (!DBA::isResult($contact)) {
notice(DI::l10n()->t("You aren't following this contact."));
DI::sysmsg()->addNotice(DI::l10n()->t("You aren't following this contact."));
DI::baseUrl()->redirect($base_return_path);
// NOTREACHED
}
if (!Protocol::supportsFollow($contact['network'])) {
notice(DI::l10n()->t('Unfollowing is currently not supported by your network.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Unfollowing is currently not supported by your network.'));
DI::baseUrl()->redirect($base_return_path . '/' . $contact['id']);
// NOTREACHED
}
@ -79,7 +79,7 @@ function unfollow_content(App $a)
$self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
if (!DBA::isResult($self)) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect($base_return_path);
// NOTREACHED
}
@ -131,7 +131,7 @@ function unfollow_process(string $url)
$contact = DBA::selectFirst('contact', [], $condition);
if (!DBA::isResult($contact)) {
notice(DI::l10n()->t("You aren't following this contact."));
DI::sysmsg()->addNotice(DI::l10n()->t("You aren't following this contact."));
DI::baseUrl()->redirect($base_return_path);
// NOTREACHED
}
@ -146,6 +146,6 @@ function unfollow_process(string $url)
$notice_message = DI::l10n()->t('Unable to unfollow this contact, please contact your administrator');
}
notice($notice_message);
DI::sysmsg()->addNotice($notice_message);
DI::baseUrl()->redirect($return_path);
}

View file

@ -66,7 +66,7 @@ function wall_attach_post(App $a) {
if ($r_json) {
System::jsonExit(['error' => DI::l10n()->t('Permission denied.')]);
}
notice(DI::l10n()->t('Permission denied.') . EOL );
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.') . EOL );
System::exit();
}
@ -95,7 +95,7 @@ function wall_attach_post(App $a) {
if ($r_json) {
System::jsonExit(['error' => $msg]);
} else {
notice($msg);
DI::sysmsg()->addNotice($msg);
}
System::exit();
}

View file

@ -88,7 +88,7 @@ function wall_upload_post(App $a, $desktopmode = true)
if ($r_json) {
System::jsonExit(['error' => DI::l10n()->t('Permission denied.')]);
}
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
System::exit();
}
@ -147,7 +147,7 @@ function wall_upload_post(App $a, $desktopmode = true)
if ($r_json) {
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
}
notice(DI::l10n()->t('Invalid request.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Invalid request.'));
System::exit();
}

View file

@ -34,7 +34,7 @@ function wallmessage_post(App $a) {
$replyto = Profile::getMyURL();
if (!$replyto) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
@ -53,13 +53,13 @@ function wallmessage_post(App $a) {
}
if (!$user['unkmail']) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
$total = DBA::count('mail', ["`uid` = ? AND `created` > ? AND `unknown`", $user['uid'], DateTimeFormat::utc('now - 1 day')]);
if ($total > $user['cntunkmail']) {
notice(DI::l10n()->t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']));
DI::sysmsg()->addNotice(DI::l10n()->t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']));
return;
}
@ -67,16 +67,16 @@ function wallmessage_post(App $a) {
switch ($ret) {
case -1:
notice(DI::l10n()->t('No recipient selected.'));
DI::sysmsg()->addNotice(DI::l10n()->t('No recipient selected.'));
break;
case -2:
notice(DI::l10n()->t('Unable to check your home location.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to check your home location.'));
break;
case -3:
notice(DI::l10n()->t('Message could not be sent.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Message could not be sent.'));
break;
case -4:
notice(DI::l10n()->t('Message collection failure.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Message collection failure.'));
break;
}
@ -87,33 +87,33 @@ function wallmessage_post(App $a) {
function wallmessage_content(App $a) {
if (!Profile::getMyURL()) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
$recipient = ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : '');
if (!$recipient) {
notice(DI::l10n()->t('No recipient.'));
DI::sysmsg()->addNotice(DI::l10n()->t('No recipient.'));
return;
}
$user = User::getByNickname($recipient);
if (empty($user)) {
notice(DI::l10n()->t('No recipient.'));
DI::sysmsg()->addNotice(DI::l10n()->t('No recipient.'));
Logger::notice('wallmessage: no recipient');
return;
}
if (!$user['unkmail']) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
$total = DBA::count('mail', ["`uid` = ? AND `created` > ? AND `unknown`", $user['uid'], DateTimeFormat::utc('now - 1 day')]);
if ($total > $user['cntunkmail']) {
notice(DI::l10n()->t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']));
DI::sysmsg()->addNotice(DI::l10n()->t('Number of daily wall messages for %s exceeded. Message failed.', $user['username']));
return;
}