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

@ -126,33 +126,3 @@ function remote_user()
return false;
}
/**
* Show an error message to user.
*
* This function save text in session, to be shown to the user at next page load
*
* @param string $s - Text of notice
*
* @return void
* @deprecated since version 2022.09, use \Friendica\Navigation\SystemMessages instead
*/
function notice(string $s)
{
\Friendica\DI::sysmsg()->addNotice($s);
}
/**
* Show an info message to user.
*
* This function save text in session, to be shown to the user at next page load
*
* @param string $s - Text of notice
*
* @return void
* @deprecated since version 2022.09, use \Friendica\Navigation\SystemMessages instead
*/
function info(string $s)
{
\Friendica\DI::sysmsg()->addInfo($s);
}

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;
}

View File

@ -397,7 +397,7 @@ abstract class BaseModule implements ICanHandleRequests
if (!self::checkFormSecurityToken($typename, $formname)) {
Logger::notice('checkFormSecurityToken failed: user ' . DI::app()->getLoggedInUserNickname() . ' - form element ' . $typename);
Logger::debug('checkFormSecurityToken failed', ['request' => $_REQUEST]);
notice(self::getFormSecurityStandardErrorMessage());
DI::sysmsg()->addNotice(self::getFormSecurityStandardErrorMessage());
DI::baseUrl()->redirect($err_redirect);
}
}

View File

@ -123,13 +123,13 @@ class UserImport
$account = json_decode(file_get_contents($file['tmp_name']), true);
if ($account === null) {
notice(DI::l10n()->t("Error decoding account file"));
DI::sysmsg()->addNotice(DI::l10n()->t("Error decoding account file"));
return;
}
if (empty($account['version'])) {
notice(DI::l10n()->t("Error! No version data in file! This is not a Friendica account file?"));
DI::sysmsg()->addNotice(DI::l10n()->t("Error! No version data in file! This is not a Friendica account file?"));
return;
}
@ -137,7 +137,7 @@ class UserImport
// check if username matches deleted account
if (DBA::exists('user', ['nickname' => $account['user']['nickname']])
|| DBA::exists('userd', ['username' => $account['user']['nickname']])) {
notice(DI::l10n()->t("User '%s' already exists on this server!", $account['user']['nickname']));
DI::sysmsg()->addNotice(DI::l10n()->t("User '%s' already exists on this server!", $account['user']['nickname']));
return;
}
@ -173,7 +173,7 @@ class UserImport
$r = self::dbImportAssoc('user', $account['user']);
if ($r === false) {
Logger::warning("uimport:insert user : ERROR : " . DBA::errorMessage());
notice(DI::l10n()->t("User creation error"));
DI::sysmsg()->addNotice(DI::l10n()->t("User creation error"));
return;
}
$newuid = self::lastInsertId();
@ -218,7 +218,7 @@ class UserImport
}
}
if ($errorcount > 0) {
notice(DI::l10n()->tt("%d contact not imported", "%d contacts not imported", $errorcount));
DI::sysmsg()->addNotice(DI::l10n()->tt("%d contact not imported", "%d contacts not imported", $errorcount));
}
foreach ($account['group'] as &$group) {
@ -271,7 +271,7 @@ class UserImport
if ($r === false) {
Logger::warning("uimport:insert profile: ERROR : " . DBA::errorMessage());
notice(DI::l10n()->t("User profile creation error"));
DI::sysmsg()->addNotice(DI::l10n()->t("User profile creation error"));
DBA::delete('user', ['uid' => $newuid]);
DBA::delete('profile_field', ['uid' => $newuid]);
return;
@ -324,7 +324,7 @@ class UserImport
// send relocate messages
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $newuid);
info(DI::l10n()->t("Done. You can now login with your username and password"));
DI::sysmsg()->addInfo(DI::l10n()->t("Done. You can now login with your username and password"));
DI::baseUrl()->redirect('login');
}
}

View File

@ -102,7 +102,7 @@ class Group
$group = DBA::selectFirst('group', ['deleted'], ['id' => $gid]);
if (DBA::isResult($group) && $group['deleted']) {
DBA::update('group', ['deleted' => 0], ['id' => $gid]);
notice(DI::l10n()->t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.'));
DI::sysmsg()->addNotice(DI::l10n()->t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.'));
}
return true;
}

View File

@ -865,7 +865,7 @@ class Profile
$a->setContactId($arr['visitor']['id']);
info(DI::l10n()->t('OpenWebAuth: %1$s welcomes %2$s', DI::baseUrl()->getHostname(), $visitor['name']));
DI::sysmsg()->addInfo(DI::l10n()->t('OpenWebAuth: %1$s welcomes %2$s', DI::baseUrl()->getHostname(), $visitor['name']));
Logger::info('OpenWebAuth: auth success from ' . $visitor['addr']);
}

View File

@ -62,7 +62,7 @@ class Details extends BaseAdmin
$addon = Strings::sanitizeFilePathItem($this->parameters['addon']);
if (!is_file("addon/$addon/$addon.php")) {
notice(DI::l10n()->t('Addon not found.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Addon not found.'));
Addon::uninstall($addon);
DI::baseUrl()->redirect('admin/addons');
}
@ -73,10 +73,10 @@ class Details extends BaseAdmin
// Toggle addon status
if (Addon::isEnabled($addon)) {
Addon::uninstall($addon);
info(DI::l10n()->t('Addon %s disabled.', $addon));
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s disabled.', $addon));
} else {
Addon::install($addon);
info(DI::l10n()->t('Addon %s enabled.', $addon));
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s enabled.', $addon));
}
DI::baseUrl()->redirect('admin/addons/' . $addon);

View File

@ -39,18 +39,18 @@ class Index extends BaseAdmin
switch ($_GET['action']) {
case 'reload':
Addon::reload();
info(DI::l10n()->t('Addons reloaded'));
DI::sysmsg()->addInfo(DI::l10n()->t('Addons reloaded'));
break;
case 'toggle' :
$addon = $_GET['addon'] ?? '';
if (Addon::isEnabled($addon)) {
Addon::uninstall($addon);
info(DI::l10n()->t('Addon %s disabled.', $addon));
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s disabled.', $addon));
} elseif (Addon::install($addon)) {
info(DI::l10n()->t('Addon %s enabled.', $addon));
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s enabled.', $addon));
} else {
notice(DI::l10n()->t('Addon %s failed to install.', $addon));
DI::sysmsg()->addNotice(DI::l10n()->t('Addon %s failed to install.', $addon));
}
break;

View File

@ -46,12 +46,12 @@ class Contact extends BaseAdmin
if (!empty($_POST['page_contactblock_block'])) {
$contact = Model\Contact::getByURL($contact_url, null, ['id', 'nurl']);
if (empty($contact)) {
notice(DI::l10n()->t('Could not find any contact entry for this URL (%s)', $contact_url));
DI::sysmsg()->addNotice(DI::l10n()->t('Could not find any contact entry for this URL (%s)', $contact_url));
DI::baseUrl()->redirect('admin/blocklist/contact');
}
if (Network::isLocalLink($contact['nurl'])) {
notice(DI::l10n()->t('You can\'t block a local contact, please block the user instead'));
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t block a local contact, please block the user instead'));
DI::baseUrl()->redirect('admin/blocklist/contact');
}
@ -63,14 +63,14 @@ class Contact extends BaseAdmin
}
}
info(DI::l10n()->t('The contact has been blocked from the node'));
DI::sysmsg()->addInfo(DI::l10n()->t('The contact has been blocked from the node'));
}
if (!empty($_POST['page_contactblock_unblock'])) {
foreach ($contacts as $uid) {
Model\Contact::unblock($uid);
}
info(DI::l10n()->tt('%s contact unblocked', '%s contacts unblocked', count($contacts)));
DI::sysmsg()->addInfo(DI::l10n()->tt('%s contact unblocked', '%s contacts unblocked', count($contacts)));
}
DI::baseUrl()->redirect('admin/blocklist/contact');

View File

@ -48,7 +48,7 @@ class DBSync extends BaseAdmin
DI::config()->set('system', 'build', intval($curr) + 1);
}
info(DI::l10n()->t('Update has been marked successful'));
DI::sysmsg()->addInfo(DI::l10n()->t('Update has been marked successful'));
}
break;

View File

@ -50,7 +50,7 @@ class Delete extends BaseAdmin
Item::markForDeletion(['guid' => $guid]);
}
info(DI::l10n()->t('Item marked for deletion.'));
DI::sysmsg()->addInfo(DI::l10n()->t('Item marked for deletion.'));
DI::baseUrl()->redirect('admin/item/delete');
}

View File

@ -44,7 +44,7 @@ class Settings extends BaseAdmin
if (is_file($logfile) &&
!is_writeable($logfile)) {
notice(DI::l10n()->t('The logfile \'%s\' is not writable. No logging possible', $logfile));
DI::sysmsg()->addNotice(DI::l10n()->t('The logfile \'%s\' is not writable. No logging possible', $logfile));
return;
}

View File

@ -43,7 +43,7 @@ class Storage extends BaseAdmin
/** @var ICanConfigureStorage|false $newStorageConfig */
$newStorageConfig = DI::storageManager()->getConfigurationByName($storagebackend);
} catch (InvalidClassStorageException $storageException) {
notice(DI::l10n()->t('Storage backend, %s is invalid.', $storagebackend));
DI::sysmsg()->addNotice(DI::l10n()->t('Storage backend, %s is invalid.', $storagebackend));
DI::baseUrl()->redirect('admin/storage');
}
@ -70,7 +70,7 @@ class Storage extends BaseAdmin
$storage_form_errors = $newStorageConfig->saveOptions($storage_opts_data);
if (count($storage_form_errors)) {
foreach ($storage_form_errors as $name => $err) {
notice(DI::l10n()->t('Storage backend %s error: %s', $storage_opts[$name][1], $err));
DI::sysmsg()->addNotice(DI::l10n()->t('Storage backend %s error: %s', $storage_opts[$name][1], $err));
}
DI::baseUrl()->redirect('admin/storage');
}
@ -81,10 +81,10 @@ class Storage extends BaseAdmin
$newstorage = DI::storageManager()->getWritableStorageByName($storagebackend);
if (!DI::storageManager()->setBackend($newstorage)) {
notice(DI::l10n()->t('Invalid storage backend setting value.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Invalid storage backend setting value.'));
}
} catch (InvalidClassStorageException $storageException) {
notice(DI::l10n()->t('Invalid storage backend setting value.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Invalid storage backend setting value.'));
}
}

View File

@ -36,7 +36,7 @@ class Details extends BaseAdmin
$theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
if (!is_dir("view/theme/$theme")) {
notice(DI::l10n()->t("Item not found."));
DI::sysmsg()->addNotice(DI::l10n()->t("Item not found."));
return '';
}
@ -54,11 +54,11 @@ class Details extends BaseAdmin
if ($isEnabled) {
Theme::uninstall($theme);
info(DI::l10n()->t('Theme %s disabled.', $theme));
DI::sysmsg()->addInfo(DI::l10n()->t('Theme %s disabled.', $theme));
} elseif (Theme::install($theme)) {
info(DI::l10n()->t('Theme %s successfully enabled.', $theme));
DI::sysmsg()->addInfo(DI::l10n()->t('Theme %s successfully enabled.', $theme));
} else {
notice(DI::l10n()->t('Theme %s failed to install.', $theme));
DI::sysmsg()->addNotice(DI::l10n()->t('Theme %s failed to install.', $theme));
}
DI::baseUrl()->redirect('admin/themes/' . $theme);

View File

@ -77,7 +77,7 @@ class Embed extends BaseAdmin
$theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
if (!is_dir("view/theme/$theme")) {
notice($this->t('Unknown theme.'));
DI::sysmsg()->addNotice($this->t('Unknown theme.'));
return '';
}

View File

@ -48,7 +48,7 @@ class Index extends BaseAdmin
}
Theme::setAllowedList($allowed_themes);
info(DI::l10n()->t('Themes reloaded'));
DI::sysmsg()->addInfo(DI::l10n()->t('Themes reloaded'));
break;
case 'toggle' :
@ -56,17 +56,17 @@ class Index extends BaseAdmin
if ($theme) {
$theme = Strings::sanitizeFilePathItem($theme);
if (!is_dir("view/theme/$theme")) {
notice(DI::l10n()->t('Item not found.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Item not found.'));
return '';
}
if (in_array($theme, Theme::getAllowedList())) {
Theme::uninstall($theme);
info(DI::l10n()->t('Theme %s disabled.', $theme));
DI::sysmsg()->addInfo(DI::l10n()->t('Theme %s disabled.', $theme));
} elseif (Theme::install($theme)) {
info(DI::l10n()->t('Theme %s successfully enabled.', $theme));
DI::sysmsg()->addInfo(DI::l10n()->t('Theme %s successfully enabled.', $theme));
} else {
notice(DI::l10n()->t('Theme %s failed to install.', $theme));
DI::sysmsg()->addNotice(DI::l10n()->t('Theme %s failed to install.', $theme));
}
}

View File

@ -42,7 +42,7 @@ class Active extends BaseUsers
foreach ($users as $uid) {
User::block($uid);
}
info(DI::l10n()->tt('%s user blocked', '%s users blocked', count($users)));
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user blocked', '%s users blocked', count($users)));
}
if (!empty($_POST['page_users_delete'])) {
@ -50,11 +50,11 @@ class Active extends BaseUsers
if (local_user() != $uid) {
User::remove($uid);
} else {
notice(DI::l10n()->t('You can\'t remove yourself'));
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
}
}
info(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
}
DI::baseUrl()->redirect(DI::args()->getQueryString());
@ -70,7 +70,7 @@ class Active extends BaseUsers
if ($uid) {
$user = User::getById($uid, ['username', 'blocked']);
if (!DBA::isResult($user)) {
notice(DI::l10n()->t('User not found'));
DI::sysmsg()->addNotice(DI::l10n()->t('User not found'));
DI::baseUrl()->redirect('admin/users');
return ''; // NOTREACHED
}
@ -83,9 +83,9 @@ class Active extends BaseUsers
// delete user
User::remove($uid);
notice(DI::l10n()->t('User "%s" deleted', $user['username']));
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" deleted', $user['username']));
} else {
notice(DI::l10n()->t('You can\'t remove yourself'));
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
}
DI::baseUrl()->redirect('admin/users/active');
@ -93,7 +93,7 @@ class Active extends BaseUsers
case 'block':
self::checkFormSecurityTokenRedirectOnError('admin/users/active', 'admin_users_active', 't');
User::block($uid);
notice(DI::l10n()->t('User "%s" blocked', $user['username']));
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" blocked', $user['username']));
DI::baseUrl()->redirect('admin/users/active');
break;
}

View File

@ -43,7 +43,7 @@ class Blocked extends BaseUsers
foreach ($users as $uid) {
User::block($uid, false);
}
info(DI::l10n()->tt('%s user unblocked', '%s users unblocked', count($users)));
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user unblocked', '%s users unblocked', count($users)));
}
if (!empty($_POST['page_users_delete'])) {
@ -51,11 +51,11 @@ class Blocked extends BaseUsers
if (local_user() != $uid) {
User::remove($uid);
} else {
notice(DI::l10n()->t('You can\'t remove yourself'));
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
}
}
info(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
}
DI::baseUrl()->redirect('admin/users/blocked');
@ -71,7 +71,7 @@ class Blocked extends BaseUsers
if ($uid) {
$user = User::getById($uid, ['username', 'blocked']);
if (!DBA::isResult($user)) {
notice(DI::l10n()->t('User not found'));
DI::sysmsg()->addNotice(DI::l10n()->t('User not found'));
DI::baseUrl()->redirect('admin/users');
return ''; // NOTREACHED
}
@ -84,16 +84,16 @@ class Blocked extends BaseUsers
// delete user
User::remove($uid);
notice(DI::l10n()->t('User "%s" deleted', $user['username']));
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" deleted', $user['username']));
} else {
notice(DI::l10n()->t('You can\'t remove yourself'));
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
}
DI::baseUrl()->redirect('admin/users/blocked');
break;
case 'unblock':
self::checkFormSecurityTokenRedirectOnError('/admin/users/blocked', 'admin_users_blocked', 't');
User::block($uid, false);
notice(DI::l10n()->t('User "%s" unblocked', $user['username']));
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" unblocked', $user['username']));
DI::baseUrl()->redirect('admin/users/blocked');
break;
}

View File

@ -44,7 +44,7 @@ class Create extends BaseUsers
User::createMinimal($nu_name, $nu_email, $nu_nickname, $nu_language);
DI::baseUrl()->redirect('admin/users');
} catch (\Exception $ex) {
notice($ex->getMessage());
DI::sysmsg()->addNotice($ex->getMessage());
}
}

View File

@ -42,14 +42,14 @@ class Index extends BaseUsers
foreach ($users as $uid) {
User::block($uid);
}
info(DI::l10n()->tt('%s user blocked', '%s users blocked', count($users)));
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user blocked', '%s users blocked', count($users)));
}
if (!empty($_POST['page_users_unblock'])) {
foreach ($users as $uid) {
User::block($uid, false);
}
info(DI::l10n()->tt('%s user unblocked', '%s users unblocked', count($users)));
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user unblocked', '%s users unblocked', count($users)));
}
if (!empty($_POST['page_users_delete'])) {
@ -57,11 +57,11 @@ class Index extends BaseUsers
if (local_user() != $uid) {
User::remove($uid);
} else {
notice(DI::l10n()->t('You can\'t remove yourself'));
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
}
}
info(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
}
DI::baseUrl()->redirect(DI::args()->getQueryString());
@ -77,7 +77,7 @@ class Index extends BaseUsers
if ($uid) {
$user = User::getById($uid, ['username', 'blocked']);
if (!DBA::isResult($user)) {
notice(DI::l10n()->t('User not found'));
DI::sysmsg()->addNotice(DI::l10n()->t('User not found'));
DI::baseUrl()->redirect('admin/users');
return ''; // NOTREACHED
}
@ -90,9 +90,9 @@ class Index extends BaseUsers
// delete user
User::remove($uid);
notice(DI::l10n()->t('User "%s" deleted', $user['username']));
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" deleted', $user['username']));
} else {
notice(DI::l10n()->t('You can\'t remove yourself'));
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
}
DI::baseUrl()->redirect('admin/users');
@ -100,13 +100,13 @@ class Index extends BaseUsers
case 'block':
self::checkFormSecurityTokenRedirectOnError('admin/users', 'admin_users', 't');
User::block($uid);
notice(DI::l10n()->t('User "%s" blocked', $user['username']));
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" blocked', $user['username']));
DI::baseUrl()->redirect('admin/users');
break;
case 'unblock':
self::checkFormSecurityTokenRedirectOnError('admin/users', 'admin_users', 't');
User::block($uid, false);
notice(DI::l10n()->t('User "%s" unblocked', $user['username']));
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" unblocked', $user['username']));
DI::baseUrl()->redirect('admin/users');
break;
}

View File

@ -45,14 +45,14 @@ class Pending extends BaseUsers
foreach ($pending as $hash) {
User::allow($hash);
}
info(DI::l10n()->tt('%s user approved', '%s users approved', count($pending)));
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user approved', '%s users approved', count($pending)));
}
if (!empty($_POST['page_users_deny'])) {
foreach ($pending as $hash) {
User::deny($hash);
}
info(DI::l10n()->tt('%s registration revoked', '%s registrations revoked', count($pending)));
DI::sysmsg()->addInfo(DI::l10n()->tt('%s registration revoked', '%s registrations revoked', count($pending)));
}
DI::baseUrl()->redirect('admin/users/pending');
@ -68,7 +68,7 @@ class Pending extends BaseUsers
if ($uid) {
$user = User::getById($uid, ['username', 'blocked']);
if (!DBA::isResult($user)) {
notice(DI::l10n()->t('User not found'));
DI::sysmsg()->addNotice(DI::l10n()->t('User not found'));
DI::baseUrl()->redirect('admin/users');
return ''; // NOTREACHED
}
@ -78,13 +78,13 @@ class Pending extends BaseUsers
case 'allow':
self::checkFormSecurityTokenRedirectOnError('/admin/users/pending', 'admin_users_pending', 't');
User::allow(Register::getPendingForUser($uid)['hash'] ?? '');
notice(DI::l10n()->t('Account approved.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Account approved.'));
DI::baseUrl()->redirect('admin/users/pending');
break;
case 'deny':
self::checkFormSecurityTokenRedirectOnError('/admin/users/pending', 'admin_users_pending', 't');
User::deny(Register::getPendingForUser($uid)['hash'] ?? '');
notice(DI::l10n()->t('Registration revoked'));
DI::sysmsg()->addNotice(DI::l10n()->t('Registration revoked'));
DI::baseUrl()->redirect('admin/users/pending');
break;
}

View File

@ -28,6 +28,7 @@ use Friendica\Content\Nav;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
@ -51,7 +52,7 @@ class Apps extends BaseModule
$apps = Nav::getAppMenu();
if (count($apps) == 0) {
notice($this->t('No installed applications.'));
DI::sysmsg()->addNotice($this->t('No installed applications.'));
}
$tpl = Renderer::getMarkupTemplate('apps.tpl');

View File

@ -54,7 +54,7 @@ abstract class BaseAdmin extends BaseModule
{
if (!local_user()) {
if ($interactive) {
notice(DI::l10n()->t('Please login to continue.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Please login to continue.'));
Session::set('return_path', DI::args()->getQueryString());
DI::baseUrl()->redirect('login');
} else {

View File

@ -116,7 +116,7 @@ class BaseSearch extends BaseModule
protected static function printResult(ResultList $results, Pager $pager, string $header = ''): string
{
if ($results->getTotal() == 0) {
notice(DI::l10n()->t('No matches'));
DI::sysmsg()->addNotice(DI::l10n()->t('No matches'));
return '';
}

View File

@ -85,7 +85,7 @@ class Contact extends BaseModule
}
}
if ($count_actions > 0) {
info(DI::l10n()->tt('%d contact edited.', '%d contacts edited.', $count_actions));
DI::sysmsg()->addInfo(DI::l10n()->tt('%d contact edited.', '%d contacts edited.', $count_actions));
}
DI::baseUrl()->redirect($redirectUrl);

View File

@ -30,6 +30,7 @@ use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\Database\Database;
use Friendica\DI;
use Friendica\Model;
use Friendica\Module\Contact;
use Friendica\Module\Response;
@ -96,7 +97,7 @@ class Advanced extends BaseModule
}
if (!$r) {
notice($this->t('Contact update failed.'));
DI::sysmsg()->addNotice($this->t('Contact update failed.'));
}
}

View File

@ -35,6 +35,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Module;
@ -124,7 +125,7 @@ class Profile extends BaseModule
}
if (!Contact::update($fields, ['id' => $cdata['user'], 'uid' => local_user()])) {
notice($this->t('Failed to update contact record.'));
DI::sysmsg()->addNotice($this->t('Failed to update contact record.'));
}
}
@ -182,7 +183,7 @@ class Profile extends BaseModule
}
// @TODO: add $this->localRelationship->save($localRelationship);
info($message);
DI::sysmsg()->addInfo($message);
}
if ($cmd === 'ignore') {
@ -198,7 +199,7 @@ class Profile extends BaseModule
}
// @TODO: add $this->localRelationship->save($localRelationship);
info($message);
DI::sysmsg()->addInfo($message);
}
$this->baseUrl->redirect('contact/' . $contact['id']);

View File

@ -28,6 +28,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Database\Database;
use Friendica\DI;
use Friendica\Model;
use Friendica\Module\Contact;
use Friendica\Module\Response;
@ -87,7 +88,7 @@ class Revoke extends BaseModule
Model\Contact::revokeFollow($this->contact);
notice($this->t('Follow was successfully revoked.'));
DI::sysmsg()->addNotice($this->t('Follow was successfully revoked.'));
$this->baseUrl->redirect('contact/' . $this->parameters['id']);
}

View File

@ -155,7 +155,7 @@ class Community extends BaseModule
$items = self::getItems();
if (!DBA::isResult($items)) {
notice(DI::l10n()->t('No results.'));
DI::sysmsg()->addNotice(DI::l10n()->t('No results.'));
return $o;
}

View File

@ -170,7 +170,7 @@ class Network extends BaseModule
if (self::$groupId) {
$group = DBA::selectFirst('group', ['name'], ['id' => self::$groupId, 'uid' => local_user()]);
if (!DBA::isResult($group)) {
notice(DI::l10n()->t('No such group'));
DI::sysmsg()->addNotice(DI::l10n()->t('No such group'));
}
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [
@ -184,7 +184,7 @@ class Network extends BaseModule
'id' => DI::args()->get(0),
]) . $o;
} else {
notice(DI::l10n()->t('Invalid contact.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Invalid contact.'));
}
} elseif (!DI::config()->get('theme', 'hide_eventlist')) {
$o .= Profile::getBirthdays();

View File

@ -25,6 +25,7 @@ use Friendica\App;
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Model;
use Friendica\Module\Response;
use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests;
@ -48,7 +49,7 @@ class Feed extends BaseModule
$this->httpClient = $httpClient;
if (!local_user()) {
notice($this->t('You must be logged in to use this module'));
DI::sysmsg()->addNotice($this->t('You must be logged in to use this module'));
$baseUrl->redirect();
}
}

View File

@ -72,7 +72,7 @@ class Directory extends BaseModule
$profiles = Profile::searchProfiles($pager->getStart(), $pager->getItemsPerPage(), $search);
if ($profiles['total'] === 0) {
notice(DI::l10n()->t('No entries (some entries may be hidden).'));
DI::sysmsg()->addNotice(DI::l10n()->t('No entries (some entries may be hidden).'));
} else {
foreach ($profiles['entries'] as $entry) {
$contact = Model\Contact::getByURLForUser($entry['url'], local_user());

View File

@ -26,6 +26,7 @@ use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model;
use Friendica\Module\Response;
use Friendica\Network\HTTPException;
@ -43,7 +44,7 @@ class SaveTag extends BaseModule
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
if (!local_user()) {
notice($this->t('You must be logged in to use this module'));
DI::sysmsg()->addNotice($this->t('You must be logged in to use this module'));
$baseUrl->redirect();
}
}

View File

@ -35,7 +35,7 @@ class FollowConfirm extends BaseModule
parent::post($request);
$uid = local_user();
if (!$uid) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}

View File

@ -28,6 +28,7 @@ use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\Worker;
use Friendica\Database\Database;
use Friendica\DI;
use Friendica\Model\Contact as ContactModel;
use Friendica\Network\HTTPException\ForbiddenException;
use Friendica\Network\HTTPException\NotFoundException;
@ -78,7 +79,7 @@ class FriendSuggest extends BaseModule
// We do query the "uid" as well to ensure that it is our contact
$contact = $this->dba->selectFirst('contact', ['name', 'url', 'request', 'avatar'], ['id' => $suggest_contact_id, 'uid' => local_user()]);
if (empty($contact)) {
notice($this->t('Suggested contact not found.'));
DI::sysmsg()->addNotice($this->t('Suggested contact not found.'));
return;
}
@ -96,7 +97,7 @@ class FriendSuggest extends BaseModule
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::SUGGESTION, $suggest->id);
info($this->t('Friend suggestion sent.'));
DI::sysmsg()->addInfo($this->t('Friend suggestion sent.'));
}
protected function content(array $request = []): string
@ -105,7 +106,7 @@ class FriendSuggest extends BaseModule
$contact = $this->dba->selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
if (empty($contact)) {
notice($this->t('Contact not found.'));
DI::sysmsg()->addNotice($this->t('Contact not found.'));
$this->baseUrl->redirect();
}

View File

@ -39,7 +39,7 @@ class Group extends BaseModule
}
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect();
}
@ -55,7 +55,7 @@ class Group extends BaseModule
DI::baseUrl()->redirect('group/' . $r);
}
} else {
notice(DI::l10n()->t('Could not create group.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Could not create group.'));
}
DI::baseUrl()->redirect('group');
}
@ -66,13 +66,13 @@ class Group extends BaseModule
$group = DBA::selectFirst('group', ['id', 'name'], ['id' => DI::args()->getArgv()[1], 'uid' => local_user()]);
if (!DBA::isResult($group)) {
notice(DI::l10n()->t('Group not found.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Group not found.'));
DI::baseUrl()->redirect('contact');
}
$groupname = trim($_POST['groupname']);
if (strlen($groupname) && ($groupname != $group['name'])) {
if (!Model\Group::update($group['id'], $groupname)) {
notice(DI::l10n()->t('Group name was not changed.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Group name was not changed.'));
}
}
}
@ -132,10 +132,10 @@ class Group extends BaseModule
throw new \Exception(DI::l10n()->t('Bad request.'), 400);
}
info($message);
DI::sysmsg()->addInfo($message);
System::jsonExit(['status' => 'OK', 'message' => $message]);
} catch (\Exception $e) {
notice($e->getMessage());
DI::sysmsg()->addNotice($e->getMessage());
System::jsonError($e->getCode(), ['status' => 'error', 'message' => $e->getMessage()]);
}
}
@ -212,12 +212,12 @@ class Group extends BaseModule
// @TODO: Replace with parameter from router
if (intval(DI::args()->getArgv()[2])) {
if (!Model\Group::exists(DI::args()->getArgv()[2], local_user())) {
notice(DI::l10n()->t('Group not found.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Group not found.'));
DI::baseUrl()->redirect('contact');
}
if (!Model\Group::remove(DI::args()->getArgv()[2])) {
notice(DI::l10n()->t('Unable to remove group.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to remove group.'));
}
}
DI::baseUrl()->redirect('group');
@ -236,7 +236,7 @@ class Group extends BaseModule
if ((DI::args()->getArgc() > 1) && intval(DI::args()->getArgv()[1])) {
$group = DBA::selectFirst('group', ['id', 'name'], ['id' => DI::args()->getArgv()[1], 'uid' => local_user(), 'deleted' => false]);
if (!DBA::isResult($group)) {
notice(DI::l10n()->t('Group not found.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Group not found.'));
DI::baseUrl()->redirect('contact');
}

View File

@ -79,7 +79,7 @@ class Invite extends BaseModule
$recipient = trim($recipient);
if (!filter_var($recipient, FILTER_VALIDATE_EMAIL)) {
notice(DI::l10n()->t('%s : Not a valid email address.', $recipient));
DI::sysmsg()->addNotice(DI::l10n()->t('%s : Not a valid email address.', $recipient));
continue;
}
@ -114,15 +114,15 @@ class Invite extends BaseModule
$current_invites++;
DI::pConfig()->set(local_user(), 'system', 'sent_invites', $current_invites);
if ($current_invites > $max_invites) {
notice(DI::l10n()->t('Invitation limit exceeded. Please contact your site administrator.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Invitation limit exceeded. Please contact your site administrator.'));
return;
}
} else {
notice(DI::l10n()->t('%s : Message delivery failed.', $recipient));
DI::sysmsg()->addNotice(DI::l10n()->t('%s : Message delivery failed.', $recipient));
}
}
info(DI::l10n()->tt('%d message sent.', '%d messages sent.', $total));
DI::sysmsg()->addInfo(DI::l10n()->tt('%d message sent.', '%d messages sent.', $total));
}
protected function content(array $request = []): string

View File

@ -30,6 +30,7 @@ use Friendica\Content\Text\BBCode;
use Friendica\Core\L10n;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Model\User;
use Friendica\Module\BaseNotifications;
use Friendica\Module\Response;
@ -211,7 +212,7 @@ class Introductions extends BaseNotifications
}
if (count($notifications['notifications']) == 0) {
notice($this->t('No introductions.'));
DI::sysmsg()->addNotice($this->t('No introductions.'));
$notificationNoContent = $this->t('No more %s notifications.', $notifications['ident']);
}

View File

@ -27,6 +27,7 @@ use Friendica\Contact\Introduction\Repository\Introduction;
use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\System;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Module\Response;
use Friendica\Module\Security\Login;
@ -131,7 +132,7 @@ class Notification extends BaseModule
protected function content(array $request = []): string
{
if (!local_user()) {
notice($this->l10n->t('You must be logged in to show this page.'));
DI::sysmsg()->addNotice($this->l10n->t('You must be logged in to show this page.'));
return Login::form();
}

View File

@ -106,7 +106,7 @@ class Profile extends BaseProfile
$o = self::getTabsHTML($a, 'profile', $is_owner, $profile['nickname'], $profile['hide-friends']);
if (!empty($profile['hidewall']) && !$is_owner && !$remote_contact_id) {
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 '';
}

View File

@ -107,7 +107,7 @@ class Status extends BaseProfile
$last_updated_key = "profile:" . $profile['uid'] . ":" . local_user() . ":" . $remote_contact;
if (!empty($profile['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 '';
}

View File

@ -74,20 +74,20 @@ class Register extends BaseModule
$block = DI::config()->get('system', 'block_extended_register');
if (local_user() && $block) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return '';
}
if (local_user()) {
$user = DBA::selectFirst('user', ['parent-uid'], ['uid' => local_user()]);
if (!empty($user['parent-uid'])) {
notice(DI::l10n()->t('Only parent users can create additional accounts.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Only parent users can create additional accounts.'));
return '';
}
}
if (!local_user() && (intval(DI::config()->get('config', 'register_policy')) === self::CLOSED)) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return '';
}
@ -96,7 +96,7 @@ class Register extends BaseModule
$count = DBA::count('user', ['`register_date` > UTC_TIMESTAMP - INTERVAL 1 day']);
if ($count >= $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 '';
}
}
@ -203,19 +203,19 @@ class Register extends BaseModule
$additional_account = false;
if (!local_user() && !empty($arr['post']['parent_password'])) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
} elseif (local_user() && !empty($arr['post']['parent_password'])) {
try {
Model\User::getIdFromPasswordAuthentication(local_user(), $arr['post']['parent_password']);
} catch (\Exception $ex) {
notice(DI::l10n()->t("Password doesn't match."));
DI::sysmsg()->addNotice(DI::l10n()->t("Password doesn't match."));
$regdata = ['nickname' => $arr['post']['nickname'], 'username' => $arr['post']['username']];
DI::baseUrl()->redirect('register?' . http_build_query($regdata));
}
$additional_account = true;
} elseif (local_user()) {
notice(DI::l10n()->t('Please enter your password.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Please enter your password.'));
$regdata = ['nickname' => $arr['post']['nickname'], 'username' => $arr['post']['username']];
DI::baseUrl()->redirect('register?' . http_build_query($regdata));
}
@ -242,7 +242,7 @@ class Register extends BaseModule
case self::CLOSED:
default:
if (empty($_SESSION['authenticated']) && empty($_SESSION['administrator'])) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
$blocked = 1;
@ -257,14 +257,14 @@ class Register extends BaseModule
// Is there text in the tar pit?
if (!empty($arr['email'])) {
Logger::info('Tar pit', $arr);
notice(DI::l10n()->t('You have entered too much information.'));
DI::sysmsg()->addNotice(DI::l10n()->t('You have entered too much information.'));
DI::baseUrl()->redirect('register/');
}
if ($additional_account) {
$user = DBA::selectFirst('user', ['email'], ['uid' => local_user()]);
if (!DBA::isResult($user)) {
notice(DI::l10n()->t('User not found.'));
DI::sysmsg()->addNotice(DI::l10n()->t('User not found.'));
DI::baseUrl()->redirect('register');
}
@ -280,7 +280,7 @@ class Register extends BaseModule
if ($arr['email'] != $arr['repeat']) {
Logger::info('Mail mismatch', $arr);
notice(DI::l10n()->t('Please enter the identical mail address in the second field.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Please enter the identical mail address in the second field.'));
$regdata = ['email' => $arr['email'], 'nickname' => $arr['nickname'], 'username' => $arr['username']];
DI::baseUrl()->redirect('register?' . http_build_query($regdata));
}
@ -292,7 +292,7 @@ class Register extends BaseModule
try {
$result = Model\User::create($arr);
} catch (\Exception $e) {
notice($e->getMessage());
DI::sysmsg()->addNotice($e->getMessage());
return;
}
@ -307,7 +307,7 @@ class Register extends BaseModule
if ($additional_account) {
DBA::update('user', ['parent-uid' => local_user()], ['uid' => $user['uid']]);
info(DI::l10n()->t('The additional account was created.'));
DI::sysmsg()->addInfo(DI::l10n()->t('The additional account was created.'));
DI::baseUrl()->redirect('delegation');
}
@ -332,28 +332,28 @@ class Register extends BaseModule
);
if ($res) {
info(DI::l10n()->t('Registration successful. Please check your email for further instructions.'));
DI::sysmsg()->addInfo(DI::l10n()->t('Registration successful. Please check your email for further instructions.'));
DI::baseUrl()->redirect();
} else {
notice(
DI::sysmsg()->addNotice(
DI::l10n()->t('Failed to send email message. Here your accout details:<br> login: %s<br> password: %s<br><br>You can change your password after login.',
$user['email'],
$result['password'])
);
}
} else {
info(DI::l10n()->t('Registration successful.'));
DI::sysmsg()->addInfo(DI::l10n()->t('Registration successful.'));
DI::baseUrl()->redirect();
}
} elseif (intval(DI::config()->get('config', 'register_policy')) === self::APPROVE) {
if (!strlen(DI::config()->get('config', 'admin_email'))) {
notice(DI::l10n()->t('Your registration can not be processed.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Your registration can not be processed.'));
DI::baseUrl()->redirect();
}
// Check if the note to the admin is actually filled out
if (empty($_POST['permonlybox'])) {
notice(DI::l10n()->t('You have to leave a request note for the admin.')
DI::sysmsg()->addNotice(DI::l10n()->t('You have to leave a request note for the admin.')
. DI::l10n()->t('Your registration can not be processed.'));
DI::baseUrl()->redirect('register/');
@ -399,7 +399,7 @@ class Register extends BaseModule
$result['password']
);
info(DI::l10n()->t('Your registration is pending approval by the site owner.'));
DI::sysmsg()->addInfo(DI::l10n()->t('Your registration is pending approval by the site owner.'));
DI::baseUrl()->redirect();
}

View File

@ -31,6 +31,7 @@ use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\Search;
use Friendica\Core\System;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
use Friendica\Model\User;
@ -68,25 +69,25 @@ class RemoteFollow extends BaseModule
}
if (empty($this->owner)) {
notice($this->t('Profile unavailable.'));
DI::sysmsg()->addNotice($this->t('Profile unavailable.'));
return;
}
$url = Probe::cleanURI($_POST['dfrn_url']);
if (!strlen($url)) {
notice($this->t("Invalid locator"));
DI::sysmsg()->addNotice($this->t("Invalid locator"));
return;
}
// Detect the network, make sure the provided URL is valid
$data = Contact::getByURL($url);
if (!$data) {
notice($this->t("The provided profile link doesn't seem to be valid"));
DI::sysmsg()->addNotice($this->t("The provided profile link doesn't seem to be valid"));
return;
}
if (empty($data['subscribe'])) {
notice($this->t("Remote subscription can't be done for your network. Please subscribe directly on your system."));
DI::sysmsg()->addNotice($this->t("Remote subscription can't be done for your network. Please subscribe directly on your system."));
return;
}

View File

@ -34,7 +34,7 @@ class Directory extends BaseSearch
protected function content(array $request = []): string
{
if (!local_user()) {
notice(DI::l10n()->t('Permission denied.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return Login::form();
}

View File

@ -149,7 +149,7 @@ class Index extends BaseSearch
// Tags don't look like an URL and the fulltext search does only work with natural words
if (parse_url($search, PHP_URL_SCHEME) && parse_url($search, PHP_URL_HOST)) {
Logger::info('Skipping tag and fulltext search since the search looks like a URL.', ['q' => $search]);
notice(DI::l10n()->t('No results.'));
DI::sysmsg()->addNotice(DI::l10n()->t('No results.'));
return $o;
}
@ -191,7 +191,7 @@ class Index extends BaseSearch
if (empty($items)) {
if (empty($last_uriid)) {
notice(DI::l10n()->t('No results.'));
DI::sysmsg()->addNotice(DI::l10n()->t('No results.'));
}
return $o;
}

View File

@ -26,6 +26,7 @@ use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Search;
use Friendica\Database\Database;
use Friendica\DI;
use Friendica\Module\Response;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
@ -55,16 +56,16 @@ class Saved extends BaseModule
$fields = ['uid' => local_user(), 'term' => $search];
if (!$this->dba->exists('search', $fields)) {
if (!$this->dba->insert('search', $fields)) {
notice($this->t('Search term was not saved.'));
DI::sysmsg()->addNotice($this->t('Search term was not saved.'));
}
} else {
notice($this->t('Search term already saved.'));
DI::sysmsg()->addNotice($this->t('Search term already saved.'));
}
break;
case 'remove':
if (!$this->dba->delete('search', ['uid' => local_user(), 'term' => $search])) {
notice($this->t('Search term was not removed.'));
DI::sysmsg()->addNotice($this->t('Search term was not removed.'));
}
break;
}

View File

@ -28,6 +28,7 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Session\Capability\IHandleSessions;
use Friendica\Core\System;
use Friendica\DI;
use Friendica\Model\Profile;
use Friendica\Model\User\Cookie;
use Friendica\Module\Response;
@ -80,7 +81,7 @@ class Logout extends BaseModule
if ($visitor_home) {
System::externalRedirect($visitor_home);
} else {
info($this->t('Logged out.'));
DI::sysmsg()->addInfo($this->t('Logged out.'));
$this->baseUrl->redirect();
}
}

View File

@ -87,9 +87,9 @@ class OpenID extends BaseModule
$session->set('openid_server', $open_id_obj->discover($open_id_obj->identity));
if (intval(DI::config()->get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED) {
notice($l10n->t('Account not found. Please login to your existing account to add the OpenID to it.'));
DI::sysmsg()->addNotice($l10n->t('Account not found. Please login to your existing account to add the OpenID to it.'));
} else {
notice($l10n->t('Account not found. Please register a new account or login to your existing account to add the OpenID to it.'));
DI::sysmsg()->addNotice($l10n->t('Account not found. Please register a new account or login to your existing account to add the OpenID to it.'));
}
DI::baseUrl()->redirect('login');

View File

@ -26,6 +26,7 @@ use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\Session\Capability\IHandleSessions;
use Friendica\DI;
use Friendica\Model\User;
use Friendica\Module\Response;
use Friendica\Security\Authentication;
@ -70,13 +71,13 @@ class Recovery extends BaseModule
if (RecoveryCode::existsForUser(local_user(), $recovery_code)) {
RecoveryCode::markUsedForUser(local_user(), $recovery_code);
$this->session->set('2fa', true);
info($this->t('Remaining recovery codes: %d', RecoveryCode::countValidForUser(local_user())));
DI::sysmsg()->addInfo($this->t('Remaining recovery codes: %d', RecoveryCode::countValidForUser(local_user())));
$this->auth->setForUser($this->app, User::getById($this->app->getLoggedInUserId()), true, true);
$this->baseUrl->redirect($this->session->pop('return_path', ''));
} else {
notice($this->t('Invalid code, please retry.'));
DI::sysmsg()->addNotice($this->t('Invalid code, please retry.'));
}
}
}

View File

@ -26,6 +26,7 @@ use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\Session\Capability\IHandleSessions;
use Friendica\DI;
use Friendica\Model\User\Cookie;
use Friendica\Module\Response;
use Friendica\Network\HTTPException\NotFoundException;
@ -75,7 +76,7 @@ class SignOut extends BaseModule
$this->cookie->reset(['2fa_cookie_hash' => $trusted]);
$this->session->clear();
info($this->t('Logged out.'));
DI::sysmsg()->addInfo($this->t('Logged out.'));
$this->baseUrl->redirect();
break;
case 'sign_out':
@ -83,7 +84,7 @@ class SignOut extends BaseModule
$this->cookie->clear();
$this->session->clear();
info($this->t('Logged out.'));
DI::sysmsg()->addInfo($this->t('Logged out.'));
$this->baseUrl->redirect();
break;
default:
@ -105,14 +106,14 @@ class SignOut extends BaseModule
$this->cookie->reset(['2fa_cookie_hash' => $trusted]);
$this->session->clear();
info($this->t('Logged out.'));
DI::sysmsg()->addInfo($this->t('Logged out.'));
$this->baseUrl->redirect();
}
} catch (TwoFactor\Exception\TrustedBrowserNotFoundException $exception) {
$this->cookie->clear();
$this->session->clear();
info($this->t('Logged out.'));
DI::sysmsg()->addInfo($this->t('Logged out.'));
$this->baseUrl->redirect();
}

View File

@ -26,6 +26,7 @@ use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\Session\Capability\IHandleSessions;
use Friendica\DI;
use Friendica\Model\User;
use Friendica\Model\User\Cookie;
use Friendica\Module\Response;
@ -92,7 +93,7 @@ class Trust extends BaseModule
// The string is sent to the browser to be sent back with each request
if (!$this->cookie->set('2fa_cookie_hash', $trustedBrowser->cookie_hash)) {
notice($this->t('Couldn\'t save browser to Cookie.'));
DI::sysmsg()->addNotice($this->t('Couldn\'t save browser to Cookie.'));
};
} catch (TrustedBrowserPersistenceException $exception) {
$this->logger->warning('Unexpected error when saving the trusted browser.', ['trustedBrowser' => $trustedBrowser, 'exception' => $exception]);

View File

@ -75,10 +75,10 @@ class Account extends BaseSettings
throw new Exception(DI::l10n()->t('Password update failed. Please try again.'));
}
info(DI::l10n()->t('Password changed.'));
DI::sysmsg()->addInfo(DI::l10n()->t('Password changed.'));
} catch (Exception $e) {
notice($e->getMessage());
notice(DI::l10n()->t('Password unchanged.'));
DI::sysmsg()->addNotice($e->getMessage());
DI::sysmsg()->addNotice(DI::l10n()->t('Password unchanged.'));
}
DI::baseUrl()->redirect($redirectUrl);
@ -123,7 +123,7 @@ class Account extends BaseSettings
}
if (strlen($err)) {
notice($err);
DI::sysmsg()->addNotice($err);
return;
}
@ -146,7 +146,7 @@ class Account extends BaseSettings
}
if (!User::update($fields, local_user())) {
notice(DI::l10n()->t('Settings were not updated.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Settings were not updated.'));
}
// clear session language
@ -198,7 +198,7 @@ class Account extends BaseSettings
];
if (!User::update($fields, local_user()) || !Profile::update($profile_fields, local_user())) {
notice(DI::l10n()->t('Settings were not updated.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Settings were not updated.'));
}
DI::baseUrl()->redirect($redirectUrl);
@ -218,7 +218,7 @@ class Account extends BaseSettings
DI::pConfig()->set(local_user(), 'expire', 'network_only', $expire_network_only);
if (!User::update(['expire' => $expire], local_user())) {
notice(DI::l10n()->t('Settings were not updated.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Settings were not updated.'));
}
DI::baseUrl()->redirect($redirectUrl);
@ -302,7 +302,7 @@ class Account extends BaseSettings
];
if (!User::update($fields, local_user())) {
notice(DI::l10n()->t('Settings were not updated.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Settings were not updated.'));
}
DI::baseUrl()->redirect($redirectUrl);
@ -351,7 +351,7 @@ class Account extends BaseSettings
]);
if (!User::update($fields, local_user()) || !empty($profile_fields) && !Profile::update($profile_fields, local_user())) {
notice(DI::l10n()->t('Settings were not updated.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Settings were not updated.'));
}
DI::baseUrl()->redirect($redirectUrl);
@ -363,7 +363,7 @@ class Account extends BaseSettings
// was there an error
if ($_FILES['importcontact-filename']['error'] > 0) {
Logger::notice('Contact CSV file upload error', ['error' => $_FILES['importcontact-filename']['error']]);
notice(DI::l10n()->t('Contact CSV file upload error'));
DI::sysmsg()->addNotice(DI::l10n()->t('Contact CSV file upload error'));
} else {
$csvArray = array_map('str_getcsv', file($_FILES['importcontact-filename']['tmp_name']));
Logger::notice('Import started', ['lines' => count($csvArray)]);
@ -382,7 +382,7 @@ class Account extends BaseSettings
}
Logger::notice('Import done');
info(DI::l10n()->t('Importing Contacts done'));
DI::sysmsg()->addInfo(DI::l10n()->t('Importing Contacts done'));
// delete temp file
unlink($_FILES['importcontact-filename']['tmp_name']);
}
@ -395,7 +395,7 @@ class Account extends BaseSettings
if (!empty($request['relocate-submit'])) {
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, local_user());
info(DI::l10n()->t("Relocate message has been send to your contacts"));
DI::sysmsg()->addInfo(DI::l10n()->t("Relocate message has been send to your contacts"));
DI::baseUrl()->redirect($redirectUrl);
}
@ -412,7 +412,7 @@ class Account extends BaseSettings
$profile = DBA::selectFirst('profile', [], ['uid' => local_user()]);
if (!DBA::isResult($profile)) {
notice(DI::l10n()->t('Unable to find your profile. Please contact your admin.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to find your profile. Please contact your admin.'));
return '';
}

View File

@ -50,13 +50,13 @@ class Delegation extends BaseSettings
if ($parent_uid != 0) {
try {
User::getIdFromPasswordAuthentication($parent_uid, $parent_password);
info(DI::l10n()->t('Delegation successfully granted.'));
DI::sysmsg()->addInfo(DI::l10n()->t('Delegation successfully granted.'));
} catch (\Exception $ex) {
notice(DI::l10n()->t('Parent user not found, unavailable or password doesn\'t match.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Parent user not found, unavailable or password doesn\'t match.'));
return;
}
} else {
info(DI::l10n()->t('Delegation successfully revoked.'));
DI::sysmsg()->addInfo(DI::l10n()->t('Delegation successfully revoked.'));
}
DBA::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);
@ -78,7 +78,7 @@ class Delegation extends BaseSettings
if ($action === 'add' && $user_id) {
if (Session::get('submanage')) {
notice(DI::l10n()->t('Delegated administrators can view but not change delegation permissions.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Delegated administrators can view but not change delegation permissions.'));
DI::baseUrl()->redirect('settings/delegation');
}
@ -92,7 +92,7 @@ class Delegation extends BaseSettings
DBA::insert('manage', ['uid' => $user_id, 'mid' => local_user()]);
}
} else {
notice(DI::l10n()->t('Delegate user not found.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Delegate user not found.'));
}
DI::baseUrl()->redirect('settings/delegation');
@ -100,7 +100,7 @@ class Delegation extends BaseSettings
if ($action === 'remove' && $user_id) {
if (Session::get('submanage')) {
notice(DI::l10n()->t('Delegated administrators can view but not change delegation permissions.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Delegated administrators can view but not change delegation permissions.'));
DI::baseUrl()->redirect('settings/delegation');
}

View File

@ -104,7 +104,7 @@ class Display extends BaseSettings
DBA::update('user', ['theme' => $theme], ['uid' => local_user()]);
}
} else {
notice(DI::l10n()->t('The theme you chose isn\'t available.'));
DI::sysmsg()->addNotice(DI::l10n()->t('The theme you chose isn\'t available.'));
}
Hook::callAll('display_settings_post', $_POST);

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'));
}
}

View File

@ -25,6 +25,7 @@ use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Module\Response;
use Friendica\Security\TwoFactor\Model\AppSpecificPassword;
use Friendica\Module\BaseSettings;
@ -61,7 +62,7 @@ class AppSpecific extends BaseSettings
}
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice($this->t('Please enter your password to access this page.'));
DI::sysmsg()->addNotice($this->t('Please enter your password to access this page.'));
$this->baseUrl->redirect('settings/2fa');
}
}
@ -79,20 +80,20 @@ class AppSpecific extends BaseSettings
case 'generate':
$description = $_POST['description'] ?? '';
if (empty($description)) {
notice($this->t('App-specific password generation failed: The description is empty.'));
DI::sysmsg()->addNotice($this->t('App-specific password generation failed: The description is empty.'));
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
} elseif (AppSpecificPassword::checkDuplicateForUser(local_user(), $description)) {
notice($this->t('App-specific password generation failed: This description already exists.'));
DI::sysmsg()->addNotice($this->t('App-specific password generation failed: This description already exists.'));
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
} else {
$this->appSpecificPassword = AppSpecificPassword::generateForUser(local_user(), $_POST['description'] ?? '');
info($this->t('New app-specific password generated.'));
DI::sysmsg()->addInfo($this->t('New app-specific password generated.'));
}
break;
case 'revoke_all' :
AppSpecificPassword::deleteAllForUser(local_user());
info($this->t('App-specific passwords successfully revoked.'));
DI::sysmsg()->addInfo($this->t('App-specific passwords successfully revoked.'));
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
break;
}
@ -102,7 +103,7 @@ class AppSpecific extends BaseSettings
self::checkFormSecurityTokenRedirectOnError('settings/2fa/app_specific', 'settings_2fa_app_specific');
if (AppSpecificPassword::deleteForUser(local_user(), $_POST['revoke_id'])) {
info($this->t('App-specific password successfully revoked.'));
DI::sysmsg()->addInfo($this->t('App-specific password successfully revoked.'));
}
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));

View File

@ -66,7 +66,7 @@ class Index extends BaseSettings
DI::pConfig()->delete(local_user(), '2fa', 'verified');
Session::remove('2fa');
info(DI::l10n()->t('Two-factor authentication successfully disabled.'));
DI::sysmsg()->addInfo(DI::l10n()->t('Two-factor authentication successfully disabled.'));
DI::baseUrl()->redirect('settings/2fa');
}
break;
@ -98,7 +98,7 @@ class Index extends BaseSettings
} catch (FoundException $exception) {
// Nothing to do here
} catch (\Exception $e) {
notice(DI::l10n()->t($e->getMessage()));
DI::sysmsg()->addNotice(DI::l10n()->t($e->getMessage()));
}
}

View File

@ -25,6 +25,7 @@ use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Module\Response;
use Friendica\Security\TwoFactor\Model\RecoveryCode;
use Friendica\Module\BaseSettings;
@ -59,7 +60,7 @@ class Recovery extends BaseSettings
}
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice($this->t('Please enter your password to access this page.'));
DI::sysmsg()->addNotice($this->t('Please enter your password to access this page.'));
$this->baseUrl->redirect('settings/2fa');
}
}
@ -75,7 +76,7 @@ class Recovery extends BaseSettings
if ($_POST['action'] == 'regenerate') {
RecoveryCode::regenerateForUser(local_user());
info($this->t('New recovery codes successfully generated.'));
DI::sysmsg()->addInfo($this->t('New recovery codes successfully generated.'));
$this->baseUrl->redirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
}
}

View File

@ -25,6 +25,7 @@ use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Module\BaseSettings;
use Friendica\Module\Response;
use Friendica\Security\TwoFactor;
@ -62,7 +63,7 @@ class Trusted extends BaseSettings
}
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice($this->t('Please enter your password to access this page.'));
DI::sysmsg()->addNotice($this->t('Please enter your password to access this page.'));
$this->baseUrl->redirect('settings/2fa');
}
}
@ -79,7 +80,7 @@ class Trusted extends BaseSettings
switch ($_POST['action']) {
case 'remove_all':
$this->trustedBrowserRepo->removeAllForUser(local_user());
info($this->t('Trusted browsers successfully removed.'));
DI::sysmsg()->addInfo($this->t('Trusted browsers successfully removed.'));
$this->baseUrl->redirect('settings/2fa/trusted?t=' . self::getFormSecurityToken('settings_2fa_password'));
break;
}
@ -89,7 +90,7 @@ class Trusted extends BaseSettings
self::checkFormSecurityTokenRedirectOnError('settings/2fa/trusted', 'settings_2fa_trusted');
if ($this->trustedBrowserRepo->removeForUser(local_user(), $_POST['remove_id'])) {
info($this->t('Trusted browser successfully removed.'));
DI::sysmsg()->addInfo($this->t('Trusted browser successfully removed.'));
}
$this->baseUrl->redirect('settings/2fa/trusted?t=' . self::getFormSecurityToken('settings_2fa_password'));

View File

@ -30,6 +30,7 @@ use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\DI;
use Friendica\Module\BaseSettings;
use Friendica\Module\Response;
use Friendica\Module\Security\Login;
@ -65,7 +66,7 @@ class Verify extends BaseSettings
}
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice($this->t('Please enter your password to access this page.'));
DI::sysmsg()->addNotice($this->t('Please enter your password to access this page.'));
$this->baseUrl->redirect('settings/2fa');
}
}
@ -87,11 +88,11 @@ class Verify extends BaseSettings
$this->pConfig->set(local_user(), '2fa', 'verified', true);
Session::set('2fa', true);
info($this->t('Two-factor authentication successfully activated.'));
DI::sysmsg()->addInfo($this->t('Two-factor authentication successfully activated.'));
$this->baseUrl->redirect('settings/2fa');
} else {
notice($this->t('Invalid code, please retry.'));
DI::sysmsg()->addNotice($this->t('Invalid code, please retry.'));
}
}
}

View File

@ -223,7 +223,7 @@ class Authentication
// if it's an email address or doesn't resolve to a URL, fail.
if ($noid || strpos($openid_url, '@') || !Network::isUrlValid($openid_url)) {
notice($this->l10n->t('Login failed.'));
DI::sysmsg()->addNotice($this->l10n->t('Login failed.'));
$this->baseUrl->redirect();
}
@ -237,7 +237,7 @@ class Authentication
$openid->optional = ['namePerson/friendly', 'contact/email', 'namePerson', 'namePerson/first', 'media/image/aspect11', 'media/image/default'];
System::externalRedirect($openid->authUrl());
} catch (Exception $e) {
notice($this->l10n->t('We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.') . '<br /><br >' . $this->l10n->t('The error message was:') . ' ' . $e->getMessage());
DI::sysmsg()->addNotice($this->l10n->t('We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.') . '<br /><br >' . $this->l10n->t('The error message was:') . ' ' . $e->getMessage());
}
}
@ -268,7 +268,7 @@ class Authentication
);
} catch (Exception $e) {
$this->logger->warning('authenticate: failed login attempt', ['action' => 'login', 'username' => $username, 'ip' => $this->remoteAddress]);
notice($this->l10n->t('Login failed. Please check your credentials.'));
DI::sysmsg()->addNotice($this->l10n->t('Login failed. Please check your credentials.'));
$this->baseUrl->redirect();
}
@ -379,8 +379,8 @@ class Authentication
if ($interactive) {
if ($user_record['login_date'] <= DBA::NULL_DATETIME) {
info($this->l10n->t('Welcome %s', $user_record['username']));
info($this->l10n->t('Please upload a profile photo.'));
DI::sysmsg()->addInfo($this->l10n->t('Welcome %s', $user_record['username']));
DI::sysmsg()->addInfo($this->l10n->t('Please upload a profile photo.'));
$this->baseUrl->redirect('settings/profile/photo/new');
}
}