Replace "notice" calls

This commit is contained in:
Michael 2022-10-17 11:27:32 +00:00
parent 62a0d55fc8
commit 4ff7c37f85
10 changed files with 42 additions and 42 deletions

View File

@ -119,7 +119,7 @@ function cal_content(App $a)
$is_owner = local_user() == $owner['uid']; $is_owner = local_user() == $owner['uid'];
if ($owner['hidewall'] && !$is_owner && !$remote_contact) { if ($owner['hidewall'] && !$is_owner && !$remote_contact) {
notice(DI::l10n()->t('Access to this profile has been restricted.')); DI::sysmsg()->addNotice(DI::l10n()->t('Access to this profile has been restricted.'));
return; return;
} }
@ -262,7 +262,7 @@ function cal_content(App $a)
if ($mode == 'export') { if ($mode == 'export') {
if (!$owner_uid) { if (!$owner_uid) {
notice(DI::l10n()->t('User not found')); DI::sysmsg()->addNotice(DI::l10n()->t('User not found'));
return; return;
} }
@ -271,9 +271,9 @@ function cal_content(App $a)
if (!$evexport["success"]) { if (!$evexport["success"]) {
if ($evexport["content"]) { if ($evexport["content"]) {
notice(DI::l10n()->t('This calendar format is not supported')); DI::sysmsg()->addNotice(DI::l10n()->t('This calendar format is not supported'));
} else { } else {
notice(DI::l10n()->t('No exportable data found')); DI::sysmsg()->addNotice(DI::l10n()->t('No exportable data found'));
} }
// If it the own calendar return to the events page // If it the own calendar return to the events page

View File

@ -35,14 +35,14 @@ function editpost_content(App $a)
$o = ''; $o = '';
if (!local_user()) { if (!local_user()) {
notice(DI::l10n()->t('Permission denied.')); DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return; return;
} }
$post_id = ((DI::args()->getArgc() > 1) ? intval(DI::args()->getArgv()[1]) : 0); $post_id = ((DI::args()->getArgc() > 1) ? intval(DI::args()->getArgv()[1]) : 0);
if (!$post_id) { if (!$post_id) {
notice(DI::l10n()->t('Item not found')); DI::sysmsg()->addNotice(DI::l10n()->t('Item not found'));
return; return;
} }
@ -52,7 +52,7 @@ function editpost_content(App $a)
$item = Post::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]); $item = Post::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
notice(DI::l10n()->t('Item not found')); DI::sysmsg()->addNotice(DI::l10n()->t('Item not found'));
return; return;
} }

View File

@ -121,7 +121,7 @@ function events_post(App $a)
$onerror_path = 'events/' . $action . '?' . http_build_query($params, '', '&', PHP_QUERY_RFC3986); $onerror_path = 'events/' . $action . '?' . http_build_query($params, '', '&', PHP_QUERY_RFC3986);
if (strcmp($finish, $start) < 0 && !$nofinish) { if (strcmp($finish, $start) < 0 && !$nofinish) {
notice(DI::l10n()->t('Event can not end before it has started.')); DI::sysmsg()->addNotice(DI::l10n()->t('Event can not end before it has started.'));
if (intval($_REQUEST['preview'])) { if (intval($_REQUEST['preview'])) {
System::httpExit(DI::l10n()->t('Event can not end before it has started.')); System::httpExit(DI::l10n()->t('Event can not end before it has started.'));
} }
@ -129,7 +129,7 @@ function events_post(App $a)
} }
if (!$summary || ($start === DBA::NULL_DATETIME)) { if (!$summary || ($start === DBA::NULL_DATETIME)) {
notice(DI::l10n()->t('Event title and start time are required.')); DI::sysmsg()->addNotice(DI::l10n()->t('Event title and start time are required.'));
if (intval($_REQUEST['preview'])) { if (intval($_REQUEST['preview'])) {
System::httpExit(DI::l10n()->t('Event title and start time are required.')); System::httpExit(DI::l10n()->t('Event title and start time are required.'));
} }
@ -214,7 +214,7 @@ function events_post(App $a)
function events_content(App $a) function events_content(App $a)
{ {
if (!local_user()) { if (!local_user()) {
notice(DI::l10n()->t('Permission denied.')); DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return Login::form(); return Login::form();
} }
@ -531,7 +531,7 @@ function events_content(App $a)
} }
if (Post::exists(['id' => $ev[0]['itemid']])) { if (Post::exists(['id' => $ev[0]['itemid']])) {
notice(DI::l10n()->t('Failed to remove event')); DI::sysmsg()->addNotice(DI::l10n()->t('Failed to remove event'));
} }
DI::baseUrl()->redirect('events'); DI::baseUrl()->redirect('events');

View File

@ -53,7 +53,7 @@ function follow_content(App $a)
$return_path = 'contact'; $return_path = 'contact';
if (!local_user()) { if (!local_user()) {
notice(DI::l10n()->t('Permission denied.')); DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect($return_path); DI::baseUrl()->redirect($return_path);
// NOTREACHED // NOTREACHED
} }
@ -81,7 +81,7 @@ function follow_content(App $a)
if (DBA::isResult($user_contact)) { if (DBA::isResult($user_contact)) {
if ($user_contact['pending']) { if ($user_contact['pending']) {
notice(DI::l10n()->t('You already added this contact.')); DI::sysmsg()->addNotice(DI::l10n()->t('You already added this contact.'));
$submit = ''; $submit = '';
} }
} }
@ -97,7 +97,7 @@ function follow_content(App $a)
// Possibly it is a remote item and not an account // Possibly it is a remote item and not an account
follow_remote_item($url); follow_remote_item($url);
notice(DI::l10n()->t("The network type couldn't be detected. Contact can't be added.")); DI::sysmsg()->addNotice(DI::l10n()->t("The network type couldn't be detected. Contact can't be added."));
$submit = ''; $submit = '';
$contact = ['url' => $url, 'network' => Protocol::PHANTOM, 'name' => $url, 'keywords' => '']; $contact = ['url' => $url, 'network' => Protocol::PHANTOM, 'name' => $url, 'keywords' => ''];
} }
@ -105,12 +105,12 @@ function follow_content(App $a)
$protocol = Contact::getProtocol($contact['url'], $contact['network']); $protocol = Contact::getProtocol($contact['url'], $contact['network']);
if (($protocol == Protocol::DIASPORA) && !DI::config()->get('system', 'diaspora_enabled')) { if (($protocol == Protocol::DIASPORA) && !DI::config()->get('system', 'diaspora_enabled')) {
notice(DI::l10n()->t("Diaspora support isn't enabled. Contact can't be added.")); DI::sysmsg()->addNotice(DI::l10n()->t("Diaspora support isn't enabled. Contact can't be added."));
$submit = ''; $submit = '';
} }
if (($protocol == Protocol::OSTATUS) && DI::config()->get('system', 'ostatus_disabled')) { if (($protocol == Protocol::OSTATUS) && DI::config()->get('system', 'ostatus_disabled')) {
notice(DI::l10n()->t("OStatus support is disabled. Contact can't be added.")); DI::sysmsg()->addNotice(DI::l10n()->t("OStatus support is disabled. Contact can't be added."));
$submit = ''; $submit = '';
} }
@ -127,7 +127,7 @@ function follow_content(App $a)
$owner = User::getOwnerDataById($uid); $owner = User::getOwnerDataById($uid);
if (empty($owner)) { if (empty($owner)) {
notice(DI::l10n()->t('Permission denied.')); DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect($return_path); DI::baseUrl()->redirect($return_path);
// NOTREACHED // NOTREACHED
} }
@ -181,14 +181,14 @@ function follow_process(App $a, string $url)
follow_remote_item($url); follow_remote_item($url);
if ($result['message']) { if ($result['message']) {
notice($result['message']); DI::sysmsg()->addNotice($result['message']);
} }
DI::baseUrl()->redirect($return_path); DI::baseUrl()->redirect($return_path);
} elseif ($result['cid']) { } elseif ($result['cid']) {
DI::baseUrl()->redirect('contact/' . $result['cid']); DI::baseUrl()->redirect('contact/' . $result['cid']);
} }
notice(DI::l10n()->t('The contact could not be added.')); DI::sysmsg()->addNotice(DI::l10n()->t('The contact could not be added.'));
DI::baseUrl()->redirect($return_path); DI::baseUrl()->redirect($return_path);
} }

View File

@ -129,7 +129,7 @@ function item_post(App $a) {
} }
if (!DBA::isResult($toplevel_item)) { if (!DBA::isResult($toplevel_item)) {
notice(DI::l10n()->t('Unable to locate original post.')); DI::sysmsg()->addNotice(DI::l10n()->t('Unable to locate original post.'));
if ($return_path) { if ($return_path) {
DI::baseUrl()->redirect($return_path); DI::baseUrl()->redirect($return_path);
} }
@ -179,7 +179,7 @@ function item_post(App $a) {
// Now check that valid personal details have been provided // Now check that valid personal details have been provided
if (!Security::canWriteToUserWall($profile_uid) && !$allow_comment) { if (!Security::canWriteToUserWall($profile_uid) && !$allow_comment) {
Logger::warning('Permission denied.', ['local' => local_user(), 'profile_uid' => $profile_uid, 'toplevel_item_id' => $toplevel_item_id, 'network' => $toplevel_item['network']]); Logger::warning('Permission denied.', ['local' => local_user(), 'profile_uid' => $profile_uid, 'toplevel_item_id' => $toplevel_item_id, 'network' => $toplevel_item['network']]);
notice(DI::l10n()->t('Permission denied.')); DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
if ($return_path) { if ($return_path) {
DI::baseUrl()->redirect($return_path); DI::baseUrl()->redirect($return_path);
} }
@ -335,7 +335,7 @@ function item_post(App $a) {
System::jsonExit(['preview' => '']); System::jsonExit(['preview' => '']);
} }
notice(DI::l10n()->t('Empty post discarded.')); DI::sysmsg()->addNotice(DI::l10n()->t('Empty post discarded.'));
if ($return_path) { if ($return_path) {
DI::baseUrl()->redirect($return_path); DI::baseUrl()->redirect($return_path);
} }
@ -685,7 +685,7 @@ function item_post(App $a) {
$post_id = Item::insert($datarray); $post_id = Item::insert($datarray);
if (!$post_id) { if (!$post_id) {
notice(DI::l10n()->t('Item wasn\'t stored.')); DI::sysmsg()->addNotice(DI::l10n()->t('Item wasn\'t stored.'));
if ($return_path) { if ($return_path) {
DI::baseUrl()->redirect($return_path); DI::baseUrl()->redirect($return_path);
} }
@ -841,7 +841,7 @@ function drop_item(int $id, string $return = '')
$item = Post::selectFirstForUser(local_user(), $fields, ['id' => $id]); $item = Post::selectFirstForUser(local_user(), $fields, ['id' => $id]);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
notice(DI::l10n()->t('Item not found.')); DI::sysmsg()->addNotice(DI::l10n()->t('Item not found.'));
DI::baseUrl()->redirect('network'); DI::baseUrl()->redirect('network');
} }
@ -863,7 +863,7 @@ function drop_item(int $id, string $return = '')
item_redirect_after_action($item, $return); item_redirect_after_action($item, $return);
} else { } else {
Logger::warning('Permission denied.', ['local' => local_user(), 'uid' => $item['uid'], 'cid' => $contact_id]); Logger::warning('Permission denied.', ['local' => local_user(), 'uid' => $item['uid'], 'cid' => $contact_id]);
notice(DI::l10n()->t('Permission denied.')); DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect('display/' . $item['guid']); DI::baseUrl()->redirect('display/' . $item['guid']);
//NOTREACHED //NOTREACHED
} }

View File

@ -37,7 +37,7 @@ function lostpass_post(App $a)
$condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0', $loginame, $loginame]; $condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0', $loginame, $loginame];
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'email', 'language'], $condition); $user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'email', 'language'], $condition);
if (!DBA::isResult($user)) { if (!DBA::isResult($user)) {
notice(DI::l10n()->t('No valid account found.')); DI::sysmsg()->addNotice(DI::l10n()->t('No valid account found.'));
DI::baseUrl()->redirect(); DI::baseUrl()->redirect();
} }
@ -97,7 +97,7 @@ function lostpass_content(App $a)
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'email', 'pwdreset_time', 'language'], ['pwdreset' => hash('sha256', $pwdreset_token)]); $user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'email', 'pwdreset_time', 'language'], ['pwdreset' => hash('sha256', $pwdreset_token)]);
if (!DBA::isResult($user)) { if (!DBA::isResult($user)) {
notice(DI::l10n()->t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed.")); DI::sysmsg()->addNotice(DI::l10n()->t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed."));
return lostpass_form(); return lostpass_form();
} }
@ -110,7 +110,7 @@ function lostpass_content(App $a)
]; ];
DBA::update('user', $fields, ['uid' => $user['uid']]); DBA::update('user', $fields, ['uid' => $user['uid']]);
notice(DI::l10n()->t('Request has expired, please make a new one.')); DI::sysmsg()->addNotice(DI::l10n()->t('Request has expired, please make a new one.'));
return lostpass_form(); return lostpass_form();
} }

View File

@ -59,7 +59,7 @@ function match_content(App $a)
return ''; return '';
} }
if (!$profile['pub_keywords'] && (!$profile['prv_keywords'])) { if (!$profile['pub_keywords'] && (!$profile['prv_keywords'])) {
notice(DI::l10n()->t('No keywords to match. Please add keywords to your profile.')); DI::sysmsg()->addNotice(DI::l10n()->t('No keywords to match. Please add keywords to your profile.'));
return ''; return '';
} }

View File

@ -66,7 +66,7 @@ function message_init(App $a)
function message_post(App $a) function message_post(App $a)
{ {
if (!local_user()) { if (!local_user()) {
notice(DI::l10n()->t('Permission denied.')); DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return; return;
} }
@ -80,17 +80,17 @@ function message_post(App $a)
switch ($ret) { switch ($ret) {
case -1: case -1:
notice(DI::l10n()->t('No recipient selected.')); DI::sysmsg()->addNotice(DI::l10n()->t('No recipient selected.'));
$norecip = true; $norecip = true;
break; break;
case -2: case -2:
notice(DI::l10n()->t('Unable to locate contact information.')); DI::sysmsg()->addNotice(DI::l10n()->t('Unable to locate contact information.'));
break; break;
case -3: case -3:
notice(DI::l10n()->t('Message could not be sent.')); DI::sysmsg()->addNotice(DI::l10n()->t('Message could not be sent.'));
break; break;
case -4: case -4:
notice(DI::l10n()->t('Message collection failure.')); DI::sysmsg()->addNotice(DI::l10n()->t('Message collection failure.'));
break; break;
} }
@ -108,7 +108,7 @@ function message_content(App $a)
Nav::setSelected('messages'); Nav::setSelected('messages');
if (!local_user()) { if (!local_user()) {
notice(DI::l10n()->t('Permission denied.')); DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return Login::form(); return Login::form();
} }
@ -143,12 +143,12 @@ function message_content(App $a)
if ($cmd === 'drop') { if ($cmd === 'drop') {
$message = DBA::selectFirst('mail', ['convid'], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]); $message = DBA::selectFirst('mail', ['convid'], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]);
if(!DBA::isResult($message)){ if(!DBA::isResult($message)){
notice(DI::l10n()->t('Conversation not found.')); DI::sysmsg()->addNotice(DI::l10n()->t('Conversation not found.'));
DI::baseUrl()->redirect('message'); DI::baseUrl()->redirect('message');
} }
if (!DBA::delete('mail', ['id' => DI::args()->getArgv()[2], 'uid' => local_user()])) { if (!DBA::delete('mail', ['id' => DI::args()->getArgv()[2], 'uid' => local_user()])) {
notice(DI::l10n()->t('Message was not deleted.')); DI::sysmsg()->addNotice(DI::l10n()->t('Message was not deleted.'));
} }
$conversation = DBA::selectFirst('mail', ['id'], ['convid' => $message['convid'], 'uid' => local_user()]); $conversation = DBA::selectFirst('mail', ['id'], ['convid' => $message['convid'], 'uid' => local_user()]);
@ -163,7 +163,7 @@ function message_content(App $a)
$parent = $parentmail['parent-uri']; $parent = $parentmail['parent-uri'];
if (!DBA::delete('mail', ['parent-uri' => $parent, 'uid' => local_user()])) { if (!DBA::delete('mail', ['parent-uri' => $parent, 'uid' => local_user()])) {
notice(DI::l10n()->t('Conversation was not removed.')); DI::sysmsg()->addNotice(DI::l10n()->t('Conversation was not removed.'));
} }
} }
DI::baseUrl()->redirect('message'); DI::baseUrl()->redirect('message');
@ -219,7 +219,7 @@ function message_content(App $a)
$r = get_messages(local_user(), $pager->getStart(), $pager->getItemsPerPage()); $r = get_messages(local_user(), $pager->getStart(), $pager->getItemsPerPage());
if (!DBA::isResult($r)) { if (!DBA::isResult($r)) {
notice(DI::l10n()->t('No messages.')); DI::sysmsg()->addNotice(DI::l10n()->t('No messages.'));
return $o; return $o;
} }
@ -275,7 +275,7 @@ function message_content(App $a)
} }
if (!DBA::isResult($messages)) { if (!DBA::isResult($messages)) {
notice(DI::l10n()->t('Message not available.')); DI::sysmsg()->addNotice(DI::l10n()->t('Message not available.'));
return $o; return $o;
} }

View File

@ -41,7 +41,7 @@ function notes_init(App $a)
function notes_content(App $a, $update = false) function notes_content(App $a, $update = false)
{ {
if (!local_user()) { if (!local_user()) {
notice(DI::l10n()->t('Permission denied.')); DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return; return;
} }

View File

@ -108,7 +108,7 @@ class Delegation extends BaseModule
$ret = []; $ret = [];
Hook::callAll('home_init', $ret); Hook::callAll('home_init', $ret);
notice($this->t('You are now logged in as %s', $user['username'])); DI::sysmsg()->addNotice($this->t('You are now logged in as %s', $user['username']));
DI::baseUrl()->redirect('network'); DI::baseUrl()->redirect('network');
} }