From 4ff7c37f85cdedb3f033bec92228c8ef22def574 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 17 Oct 2022 11:27:32 +0000 Subject: [PATCH] Replace "notice" calls --- mod/cal.php | 8 ++++---- mod/editpost.php | 6 +++--- mod/events.php | 8 ++++---- mod/follow.php | 16 ++++++++-------- mod/item.php | 12 ++++++------ mod/lostpass.php | 6 +++--- mod/match.php | 2 +- mod/message.php | 22 +++++++++++----------- mod/notes.php | 2 +- src/Module/Delegation.php | 2 +- 10 files changed, 42 insertions(+), 42 deletions(-) diff --git a/mod/cal.php b/mod/cal.php index 3f249da0ac..ec6df1f165 100644 --- a/mod/cal.php +++ b/mod/cal.php @@ -119,7 +119,7 @@ function cal_content(App $a) $is_owner = local_user() == $owner['uid']; 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; } @@ -262,7 +262,7 @@ function cal_content(App $a) if ($mode == 'export') { if (!$owner_uid) { - notice(DI::l10n()->t('User not found')); + DI::sysmsg()->addNotice(DI::l10n()->t('User not found')); return; } @@ -271,9 +271,9 @@ function cal_content(App $a) if (!$evexport["success"]) { 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 { - 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 diff --git a/mod/editpost.php b/mod/editpost.php index 3fb8c80ec0..8d2160fde0 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -35,14 +35,14 @@ function editpost_content(App $a) $o = ''; if (!local_user()) { - notice(DI::l10n()->t('Permission denied.')); + DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.')); return; } $post_id = ((DI::args()->getArgc() > 1) ? intval(DI::args()->getArgv()[1]) : 0); if (!$post_id) { - notice(DI::l10n()->t('Item not found')); + DI::sysmsg()->addNotice(DI::l10n()->t('Item not found')); return; } @@ -52,7 +52,7 @@ function editpost_content(App $a) $item = Post::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]); if (!DBA::isResult($item)) { - notice(DI::l10n()->t('Item not found')); + DI::sysmsg()->addNotice(DI::l10n()->t('Item not found')); return; } diff --git a/mod/events.php b/mod/events.php index eead66c010..f1d8a7ca60 100644 --- a/mod/events.php +++ b/mod/events.php @@ -121,7 +121,7 @@ function events_post(App $a) $onerror_path = 'events/' . $action . '?' . http_build_query($params, '', '&', PHP_QUERY_RFC3986); 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'])) { 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)) { - 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'])) { 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) { if (!local_user()) { - notice(DI::l10n()->t('Permission denied.')); + DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.')); return Login::form(); } @@ -531,7 +531,7 @@ function events_content(App $a) } 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'); diff --git a/mod/follow.php b/mod/follow.php index 818a1ae5e9..b6ffe2ef0a 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -53,7 +53,7 @@ function follow_content(App $a) $return_path = 'contact'; if (!local_user()) { - notice(DI::l10n()->t('Permission denied.')); + DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.')); DI::baseUrl()->redirect($return_path); // NOTREACHED } @@ -81,7 +81,7 @@ function follow_content(App $a) if (DBA::isResult($user_contact)) { 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 = ''; } } @@ -97,7 +97,7 @@ function follow_content(App $a) // Possibly it is a remote item and not an account 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 = ''; $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']); 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 = ''; } 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 = ''; } @@ -127,7 +127,7 @@ function follow_content(App $a) $owner = User::getOwnerDataById($uid); if (empty($owner)) { - notice(DI::l10n()->t('Permission denied.')); + DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.')); DI::baseUrl()->redirect($return_path); // NOTREACHED } @@ -181,14 +181,14 @@ function follow_process(App $a, string $url) follow_remote_item($url); if ($result['message']) { - notice($result['message']); + DI::sysmsg()->addNotice($result['message']); } DI::baseUrl()->redirect($return_path); } elseif ($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); } diff --git a/mod/item.php b/mod/item.php index 8f4494ca72..cc8e953858 100644 --- a/mod/item.php +++ b/mod/item.php @@ -129,7 +129,7 @@ function item_post(App $a) { } 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) { DI::baseUrl()->redirect($return_path); } @@ -179,7 +179,7 @@ function item_post(App $a) { // Now check that valid personal details have been provided 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']]); - notice(DI::l10n()->t('Permission denied.')); + DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.')); if ($return_path) { DI::baseUrl()->redirect($return_path); } @@ -335,7 +335,7 @@ function item_post(App $a) { System::jsonExit(['preview' => '']); } - notice(DI::l10n()->t('Empty post discarded.')); + DI::sysmsg()->addNotice(DI::l10n()->t('Empty post discarded.')); if ($return_path) { DI::baseUrl()->redirect($return_path); } @@ -685,7 +685,7 @@ function item_post(App $a) { $post_id = Item::insert($datarray); if (!$post_id) { - notice(DI::l10n()->t('Item wasn\'t stored.')); + DI::sysmsg()->addNotice(DI::l10n()->t('Item wasn\'t stored.')); if ($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]); if (!DBA::isResult($item)) { - notice(DI::l10n()->t('Item not found.')); + DI::sysmsg()->addNotice(DI::l10n()->t('Item not found.')); DI::baseUrl()->redirect('network'); } @@ -863,7 +863,7 @@ function drop_item(int $id, string $return = '') item_redirect_after_action($item, $return); } else { 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']); //NOTREACHED } diff --git a/mod/lostpass.php b/mod/lostpass.php index 6aa76e0cc6..150c170d7a 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -37,7 +37,7 @@ function lostpass_post(App $a) $condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0', $loginame, $loginame]; $user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'email', 'language'], $condition); 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(); } @@ -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)]); 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(); } @@ -110,7 +110,7 @@ function lostpass_content(App $a) ]; 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(); } diff --git a/mod/match.php b/mod/match.php index 02ee0c3339..5a5d3be93d 100644 --- a/mod/match.php +++ b/mod/match.php @@ -59,7 +59,7 @@ function match_content(App $a) return ''; } 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 ''; } diff --git a/mod/message.php b/mod/message.php index a07c8b4493..d1231b7c5d 100644 --- a/mod/message.php +++ b/mod/message.php @@ -66,7 +66,7 @@ function message_init(App $a) function message_post(App $a) { if (!local_user()) { - notice(DI::l10n()->t('Permission denied.')); + DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.')); return; } @@ -80,17 +80,17 @@ function message_post(App $a) switch ($ret) { case -1: - notice(DI::l10n()->t('No recipient selected.')); + DI::sysmsg()->addNotice(DI::l10n()->t('No recipient selected.')); $norecip = true; break; case -2: - notice(DI::l10n()->t('Unable to locate contact information.')); + DI::sysmsg()->addNotice(DI::l10n()->t('Unable to locate contact information.')); 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; } @@ -108,7 +108,7 @@ function message_content(App $a) Nav::setSelected('messages'); if (!local_user()) { - notice(DI::l10n()->t('Permission denied.')); + DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.')); return Login::form(); } @@ -143,12 +143,12 @@ function message_content(App $a) if ($cmd === 'drop') { $message = DBA::selectFirst('mail', ['convid'], ['id' => DI::args()->getArgv()[2], 'uid' => local_user()]); if(!DBA::isResult($message)){ - notice(DI::l10n()->t('Conversation not found.')); + DI::sysmsg()->addNotice(DI::l10n()->t('Conversation not found.')); DI::baseUrl()->redirect('message'); } 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()]); @@ -163,7 +163,7 @@ function message_content(App $a) $parent = $parentmail['parent-uri']; 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'); @@ -219,7 +219,7 @@ function message_content(App $a) $r = get_messages(local_user(), $pager->getStart(), $pager->getItemsPerPage()); if (!DBA::isResult($r)) { - notice(DI::l10n()->t('No messages.')); + DI::sysmsg()->addNotice(DI::l10n()->t('No messages.')); return $o; } @@ -275,7 +275,7 @@ function message_content(App $a) } if (!DBA::isResult($messages)) { - notice(DI::l10n()->t('Message not available.')); + DI::sysmsg()->addNotice(DI::l10n()->t('Message not available.')); return $o; } diff --git a/mod/notes.php b/mod/notes.php index b5bdbf870f..a30d807693 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -41,7 +41,7 @@ function notes_init(App $a) function notes_content(App $a, $update = false) { if (!local_user()) { - notice(DI::l10n()->t('Permission denied.')); + DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.')); return; } diff --git a/src/Module/Delegation.php b/src/Module/Delegation.php index c14573c8b3..146e9382b8 100644 --- a/src/Module/Delegation.php +++ b/src/Module/Delegation.php @@ -108,7 +108,7 @@ class Delegation extends BaseModule $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'); }