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);
-}
];
$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');
'$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('
}
if (empty($entries)) {
- info(DI::l10n()->t('No matches'));
+ DI::sysmsg()->addInfo(DI::l10n()->t('No matches'));
}
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
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
}
}
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();
}
$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
}
// 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.'));
}
}
// 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]);
}
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);
$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);
}
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);
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);
if (!$r) {
Logger::warning('image store failed');
- notice(DI::l10n()->t('Image upload failed.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Image upload failed.'));
return;
}
}
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;
}
}
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;
}
// Display upload form
if ($datatype === 'upload') {
if (!$can_post) {
- notice(DI::l10n()->t('Permission denied.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
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;
}
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
}
function settings_init(App $a)
{
if (!local_user()) {
- notice(DI::l10n()->t('Permission denied.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
function settings_post(App $a)
{
if (!$a->isLoggedIn()) {
- notice(DI::l10n()->t('Permission denied.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
$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.'));
}
}
}
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 '';
}
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;
}
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;
}
$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;
}
}
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
}
$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
}
$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
}
$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
}
$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
}
$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);
}
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();
}
if ($r_json) {
System::jsonExit(['error' => $msg]);
} else {
- notice($msg);
+ DI::sysmsg()->addNotice($msg);
}
System::exit();
}
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();
}
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();
}
$replyto = Profile::getMyURL();
if (!$replyto) {
- notice(DI::l10n()->t('Permission denied.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
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;
}
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;
}
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;
}
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);
}
}
$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;
}
// 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;
}
$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();
}
}
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) {
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;
// 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');
}
}
$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;
}
$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']);
}
$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');
}
// 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);
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;
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');
}
}
}
- 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');
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;
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');
}
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;
}
/** @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');
}
$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');
}
$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.'));
}
}
$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 '';
}
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);
$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 '';
}
}
Theme::setAllowedList($allowed_themes);
- info(DI::l10n()->t('Themes reloaded'));
+ DI::sysmsg()->addInfo(DI::l10n()->t('Themes reloaded'));
break;
case 'toggle' :
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));
}
}
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'])) {
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());
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
}
// 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');
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;
}
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'])) {
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');
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
}
// 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;
}
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());
}
}
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'])) {
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());
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
}
// 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');
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;
}
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');
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
}
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;
}
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;
$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');
{
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 {
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 '';
}
}
}
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);
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;
}
if (!$r) {
- notice($this->t('Contact update failed.'));
+ DI::sysmsg()->addNotice($this->t('Contact update failed.'));
}
}
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;
}
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.'));
}
}
}
// @TODO: add $this->localRelationship->save($localRelationship);
- info($message);
+ DI::sysmsg()->addInfo($message);
}
if ($cmd === 'ignore') {
}
// @TODO: add $this->localRelationship->save($localRelationship);
- info($message);
+ DI::sysmsg()->addInfo($message);
}
$this->baseUrl->redirect('contact/' . $contact['id']);
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;
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']);
}
$items = self::getItems();
if (!DBA::isResult($items)) {
- notice(DI::l10n()->t('No results.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('No results.'));
return $o;
}
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'), [
'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();
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;
$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();
}
}
$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());
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;
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();
}
}
parent::post($request);
$uid = local_user();
if (!$uid) {
- notice(DI::l10n()->t('Permission denied.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
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;
// 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;
}
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
$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();
}
}
if (!local_user()) {
- notice(DI::l10n()->t('Permission denied.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
DI::baseUrl()->redirect();
}
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');
}
$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.'));
}
}
}
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()]);
}
}
// @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');
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');
}
$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;
}
$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
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;
}
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']);
}
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;
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();
}
$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 '';
}
$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 '';
}
$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 '';
}
$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 '';
}
}
$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));
}
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;
// 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');
}
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));
}
try {
$result = Model\User::create($arr);
} catch (\Exception $e) {
- notice($e->getMessage());
+ DI::sysmsg()->addNotice($e->getMessage());
return;
}
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');
}
);
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/');
$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();
}
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;
}
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;
}
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();
}
// 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;
}
if (empty($items)) {
if (empty($last_uriid)) {
- notice(DI::l10n()->t('No results.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('No results.'));
}
return $o;
}
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;
$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;
}
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;
if ($visitor_home) {
System::externalRedirect($visitor_home);
} else {
- info($this->t('Logged out.'));
+ DI::sysmsg()->addInfo($this->t('Logged out.'));
$this->baseUrl->redirect();
}
}
$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');
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;
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.'));
}
}
}
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;
$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':
$this->cookie->clear();
$this->session->clear();
- info($this->t('Logged out.'));
+ DI::sysmsg()->addInfo($this->t('Logged out.'));
$this->baseUrl->redirect();
break;
default:
$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();
}
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;
// 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]);
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);
}
if (strlen($err)) {
- notice($err);
+ DI::sysmsg()->addNotice($err);
return;
}
}
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
];
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);
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);
];
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);
]);
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);
// 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)]);
}
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']);
}
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);
}
$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 '';
}
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()]);
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');
}
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');
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');
}
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);
$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;
}
);
if (!$result) {
- notice(DI::l10n()->t('Profile couldn\'t be updated.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('Profile couldn\'t be updated.'));
return;
}
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();
}
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]));
}
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]));
}
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'));
}
}
// 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());
}
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;
}
$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;
}
$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;
}
$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'));
}
}
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;
}
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');
}
}
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;
}
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'));
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;
} catch (FoundException $exception) {
// Nothing to do here
} catch (\Exception $e) {
- notice(DI::l10n()->t($e->getMessage()));
+ DI::sysmsg()->addNotice(DI::l10n()->t($e->getMessage()));
}
}
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;
}
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');
}
}
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'));
}
}
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;
}
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');
}
}
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;
}
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'));
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;
}
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');
}
}
$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.'));
}
}
}
// 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();
}
$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());
}
}
);
} 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();
}
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');
}
}