The notice and info have been moved
This commit is contained in:
parent
20291ddc2b
commit
fdfa1f8630
30
boot.php
30
boot.php
|
@ -126,33 +126,3 @@ function remote_user()
|
||||||
|
|
||||||
return false;
|
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);
|
|
||||||
}
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ function lostpass_post(App $a)
|
||||||
];
|
];
|
||||||
$result = DBA::update('user', $fields, ['uid' => $user['uid']]);
|
$result = DBA::update('user', $fields, ['uid' => $user['uid']]);
|
||||||
if ($result) {
|
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');
|
$sitename = DI::config()->get('config', 'sitename');
|
||||||
|
@ -152,7 +152,7 @@ function lostpass_generate_password($user)
|
||||||
'$newpass' => $new_password,
|
'$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');
|
$sitename = DI::config()->get('config', 'sitename');
|
||||||
$preamble = Strings::deindent(DI::l10n()->t('
|
$preamble = Strings::deindent(DI::l10n()->t('
|
||||||
|
|
|
@ -90,7 +90,7 @@ function match_content(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($entries)) {
|
if (empty($entries)) {
|
||||||
info(DI::l10n()->t('No matches'));
|
DI::sysmsg()->addInfo(DI::l10n()->t('No matches'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
|
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
|
||||||
|
|
|
@ -30,7 +30,7 @@ use Friendica\Protocol\ActivityPub;
|
||||||
function ostatus_subscribe_content(App $a)
|
function ostatus_subscribe_content(App $a)
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
DI::baseUrl()->redirect('ostatus_subscribe');
|
DI::baseUrl()->redirect('ostatus_subscribe');
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,14 +157,14 @@ function photos_post(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$can_post) {
|
if (!$can_post) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
System::exit();
|
System::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$owner_record = User::getOwnerDataById($page_owner_uid);
|
$owner_record = User::getOwnerDataById($page_owner_uid);
|
||||||
|
|
||||||
if (!$owner_record) {
|
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);
|
DI::logger()->info('photos_post: unable to locate contact record for page owner. uid=' . $page_owner_uid);
|
||||||
System::exit();
|
System::exit();
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ function photos_post(App $a)
|
||||||
$album = hex2bin(DI::args()->getArgv()[3]);
|
$album = hex2bin(DI::args()->getArgv()[3]);
|
||||||
|
|
||||||
if (!DBA::exists('photo', ['album' => $album, 'uid' => $page_owner_uid, 'photo-type' => Photo::DEFAULT])) {
|
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');
|
DI::baseUrl()->redirect('photos/' . $user['nickname'] . '/album');
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
}
|
}
|
||||||
|
@ -247,9 +247,9 @@ function photos_post(App $a)
|
||||||
|
|
||||||
// Update the photo albums cache
|
// Update the photo albums cache
|
||||||
Photo::clearAlbumCache($page_owner_uid);
|
Photo::clearAlbumCache($page_owner_uid);
|
||||||
notice(DI::l10n()->t('Album successfully deleted'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Album successfully deleted'));
|
||||||
} else {
|
} 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
|
// Update the photo albums cache
|
||||||
Photo::clearAlbumCache($page_owner_uid);
|
Photo::clearAlbumCache($page_owner_uid);
|
||||||
} else {
|
} 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]);
|
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) {
|
if ($error !== UPLOAD_ERR_OK) {
|
||||||
switch ($error) {
|
switch ($error) {
|
||||||
case UPLOAD_ERR_INI_SIZE:
|
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;
|
break;
|
||||||
case UPLOAD_ERR_FORM_SIZE:
|
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;
|
break;
|
||||||
case UPLOAD_ERR_PARTIAL:
|
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;
|
break;
|
||||||
case UPLOAD_ERR_NO_FILE:
|
case UPLOAD_ERR_NO_FILE:
|
||||||
notice(DI::l10n()->t('Image file is missing'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Image file is missing'));
|
||||||
break;
|
break;
|
||||||
case UPLOAD_ERR_NO_TMP_DIR:
|
case UPLOAD_ERR_NO_TMP_DIR:
|
||||||
case UPLOAD_ERR_CANT_WRITE:
|
case UPLOAD_ERR_CANT_WRITE:
|
||||||
case UPLOAD_ERR_EXTENSION:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
@unlink($src);
|
@unlink($src);
|
||||||
|
@ -663,7 +663,7 @@ function photos_post(App $a)
|
||||||
$maximagesize = DI::config()->get('system', 'maximagesize');
|
$maximagesize = DI::config()->get('system', 'maximagesize');
|
||||||
|
|
||||||
if ($maximagesize && ($filesize > $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);
|
@unlink($src);
|
||||||
$foo = 0;
|
$foo = 0;
|
||||||
Hook::callAll('photo_post_end', $foo);
|
Hook::callAll('photo_post_end', $foo);
|
||||||
|
@ -671,7 +671,7 @@ function photos_post(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$filesize) {
|
if (!$filesize) {
|
||||||
notice(DI::l10n()->t('Image file is empty.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Image file is empty.'));
|
||||||
@unlink($src);
|
@unlink($src);
|
||||||
$foo = 0;
|
$foo = 0;
|
||||||
Hook::callAll('photo_post_end', $foo);
|
Hook::callAll('photo_post_end', $foo);
|
||||||
|
@ -686,7 +686,7 @@ function photos_post(App $a)
|
||||||
|
|
||||||
if (!$image->isValid()) {
|
if (!$image->isValid()) {
|
||||||
Logger::notice('unable to process image');
|
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);
|
@unlink($src);
|
||||||
$foo = 0;
|
$foo = 0;
|
||||||
Hook::callAll('photo_post_end',$foo);
|
Hook::callAll('photo_post_end',$foo);
|
||||||
|
@ -712,7 +712,7 @@ function photos_post(App $a)
|
||||||
|
|
||||||
if (!$r) {
|
if (!$r) {
|
||||||
Logger::warning('image store failed');
|
Logger::warning('image store failed');
|
||||||
notice(DI::l10n()->t('Image upload failed.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Image upload failed.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -799,12 +799,12 @@ function photos_content(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($user)) {
|
if (empty($user)) {
|
||||||
notice(DI::l10n()->t('No photos selected'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('No photos selected'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -873,7 +873,7 @@ function photos_content(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user['hidewall'] && (local_user() != $owner_uid) && !$remote_contact) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -888,7 +888,7 @@ function photos_content(App $a)
|
||||||
// Display upload form
|
// Display upload form
|
||||||
if ($datatype === 'upload') {
|
if ($datatype === 'upload') {
|
||||||
if (!$can_post) {
|
if (!$can_post) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1088,9 +1088,9 @@ function photos_content(App $a)
|
||||||
|
|
||||||
if (!DBA::isResult($ph)) {
|
if (!DBA::isResult($ph)) {
|
||||||
if (DBA::exists('photo', ['resource-id' => $datum, 'uid' => $owner_uid])) {
|
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 {
|
} else {
|
||||||
notice(DI::l10n()->t('Photo not available'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Photo not available'));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ use Friendica\Model\Contact;
|
||||||
function repair_ostatus_content(App $a) {
|
function repair_ostatus_content(App $a) {
|
||||||
|
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
DI::baseUrl()->redirect('ostatus_repair');
|
DI::baseUrl()->redirect('ostatus_repair');
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ use Friendica\Protocol\Email;
|
||||||
function settings_init(App $a)
|
function settings_init(App $a)
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ function settings_init(App $a)
|
||||||
function settings_post(App $a)
|
function settings_post(App $a)
|
||||||
{
|
{
|
||||||
if (!$a->isLoggedIn()) {
|
if (!$a->isLoggedIn()) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ function settings_post(App $a)
|
||||||
$mbox = Email::connect($mb, $mail_user, $dcrpass);
|
$mbox = Email::connect($mb, $mail_user, $dcrpass);
|
||||||
unset($dcrpass);
|
unset($dcrpass);
|
||||||
if (!$mbox) {
|
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');
|
Nav::setSelected('settings');
|
||||||
|
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
//notice(DI::l10n()->t('Permission denied.'));
|
//DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
return Login::form();
|
return Login::form();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_SESSION['submanage'])) {
|
if (!empty($_SESSION['submanage'])) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ use Friendica\DI;
|
||||||
function uimport_post(App $a)
|
function uimport_post(App $a)
|
||||||
{
|
{
|
||||||
if ((DI::config()->get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !$a->isSiteAdmin()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ function uimport_post(App $a)
|
||||||
function uimport_content(App $a)
|
function uimport_content(App $a)
|
||||||
{
|
{
|
||||||
if ((DI::config()->get('config', 'register_policy') != \Friendica\Module\Register::OPEN) && !$a->isSiteAdmin()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ function uimport_content(App $a)
|
||||||
$total = DBA::count('user', ["`register_date` > UTC_TIMESTAMP - INTERVAL 1 DAY"]);
|
$total = DBA::count('user', ["`register_date` > UTC_TIMESTAMP - INTERVAL 1 DAY"]);
|
||||||
if ($total >= $max_dailies) {
|
if ($total >= $max_dailies) {
|
||||||
Logger::notice('max daily registrations exceeded.');
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ use Friendica\Util\Strings;
|
||||||
function unfollow_post(App $a)
|
function unfollow_post(App $a)
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
DI::baseUrl()->redirect('login');
|
DI::baseUrl()->redirect('login');
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ function unfollow_content(App $a)
|
||||||
$base_return_path = 'contact';
|
$base_return_path = 'contact';
|
||||||
|
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
DI::baseUrl()->redirect('login');
|
DI::baseUrl()->redirect('login');
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
@ -62,13 +62,13 @@ function unfollow_content(App $a)
|
||||||
$contact = DBA::selectFirst('contact', ['url', 'id', 'uid', 'network', 'addr', 'name'], $condition);
|
$contact = DBA::selectFirst('contact', ['url', 'id', 'uid', 'network', 'addr', 'name'], $condition);
|
||||||
|
|
||||||
if (!DBA::isResult($contact)) {
|
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);
|
DI::baseUrl()->redirect($base_return_path);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Protocol::supportsFollow($contact['network'])) {
|
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']);
|
DI::baseUrl()->redirect($base_return_path . '/' . $contact['id']);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ function unfollow_content(App $a)
|
||||||
$self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
|
$self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
|
||||||
|
|
||||||
if (!DBA::isResult($self)) {
|
if (!DBA::isResult($self)) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
DI::baseUrl()->redirect($base_return_path);
|
DI::baseUrl()->redirect($base_return_path);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ function unfollow_process(string $url)
|
||||||
$contact = DBA::selectFirst('contact', [], $condition);
|
$contact = DBA::selectFirst('contact', [], $condition);
|
||||||
|
|
||||||
if (!DBA::isResult($contact)) {
|
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);
|
DI::baseUrl()->redirect($base_return_path);
|
||||||
// NOTREACHED
|
// 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_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);
|
DI::baseUrl()->redirect($return_path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ function wall_attach_post(App $a) {
|
||||||
if ($r_json) {
|
if ($r_json) {
|
||||||
System::jsonExit(['error' => DI::l10n()->t('Permission denied.')]);
|
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();
|
System::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ function wall_attach_post(App $a) {
|
||||||
if ($r_json) {
|
if ($r_json) {
|
||||||
System::jsonExit(['error' => $msg]);
|
System::jsonExit(['error' => $msg]);
|
||||||
} else {
|
} else {
|
||||||
notice($msg);
|
DI::sysmsg()->addNotice($msg);
|
||||||
}
|
}
|
||||||
System::exit();
|
System::exit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ function wall_upload_post(App $a, $desktopmode = true)
|
||||||
if ($r_json) {
|
if ($r_json) {
|
||||||
System::jsonExit(['error' => DI::l10n()->t('Permission denied.')]);
|
System::jsonExit(['error' => DI::l10n()->t('Permission denied.')]);
|
||||||
}
|
}
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
System::exit();
|
System::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ function wall_upload_post(App $a, $desktopmode = true)
|
||||||
if ($r_json) {
|
if ($r_json) {
|
||||||
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
||||||
}
|
}
|
||||||
notice(DI::l10n()->t('Invalid request.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Invalid request.'));
|
||||||
System::exit();
|
System::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ function wallmessage_post(App $a) {
|
||||||
|
|
||||||
$replyto = Profile::getMyURL();
|
$replyto = Profile::getMyURL();
|
||||||
if (!$replyto) {
|
if (!$replyto) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,13 +53,13 @@ function wallmessage_post(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user['unkmail']) {
|
if (!$user['unkmail']) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$total = DBA::count('mail', ["`uid` = ? AND `created` > ? AND `unknown`", $user['uid'], DateTimeFormat::utc('now - 1 day')]);
|
$total = DBA::count('mail', ["`uid` = ? AND `created` > ? AND `unknown`", $user['uid'], DateTimeFormat::utc('now - 1 day')]);
|
||||||
if ($total > $user['cntunkmail']) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,16 +67,16 @@ function wallmessage_post(App $a) {
|
||||||
|
|
||||||
switch ($ret) {
|
switch ($ret) {
|
||||||
case -1:
|
case -1:
|
||||||
notice(DI::l10n()->t('No recipient selected.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('No recipient selected.'));
|
||||||
break;
|
break;
|
||||||
case -2:
|
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;
|
break;
|
||||||
case -3:
|
case -3:
|
||||||
notice(DI::l10n()->t('Message could not be sent.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Message could not be sent.'));
|
||||||
break;
|
break;
|
||||||
case -4:
|
case -4:
|
||||||
notice(DI::l10n()->t('Message collection failure.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Message collection failure.'));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,33 +87,33 @@ function wallmessage_post(App $a) {
|
||||||
function wallmessage_content(App $a) {
|
function wallmessage_content(App $a) {
|
||||||
|
|
||||||
if (!Profile::getMyURL()) {
|
if (!Profile::getMyURL()) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$recipient = ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : '');
|
$recipient = ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : '');
|
||||||
|
|
||||||
if (!$recipient) {
|
if (!$recipient) {
|
||||||
notice(DI::l10n()->t('No recipient.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('No recipient.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = User::getByNickname($recipient);
|
$user = User::getByNickname($recipient);
|
||||||
|
|
||||||
if (empty($user)) {
|
if (empty($user)) {
|
||||||
notice(DI::l10n()->t('No recipient.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('No recipient.'));
|
||||||
Logger::notice('wallmessage: no recipient');
|
Logger::notice('wallmessage: no recipient');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user['unkmail']) {
|
if (!$user['unkmail']) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$total = DBA::count('mail', ["`uid` = ? AND `created` > ? AND `unknown`", $user['uid'], DateTimeFormat::utc('now - 1 day')]);
|
$total = DBA::count('mail', ["`uid` = ? AND `created` > ? AND `unknown`", $user['uid'], DateTimeFormat::utc('now - 1 day')]);
|
||||||
if ($total > $user['cntunkmail']) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -397,7 +397,7 @@ abstract class BaseModule implements ICanHandleRequests
|
||||||
if (!self::checkFormSecurityToken($typename, $formname)) {
|
if (!self::checkFormSecurityToken($typename, $formname)) {
|
||||||
Logger::notice('checkFormSecurityToken failed: user ' . DI::app()->getLoggedInUserNickname() . ' - form element ' . $typename);
|
Logger::notice('checkFormSecurityToken failed: user ' . DI::app()->getLoggedInUserNickname() . ' - form element ' . $typename);
|
||||||
Logger::debug('checkFormSecurityToken failed', ['request' => $_REQUEST]);
|
Logger::debug('checkFormSecurityToken failed', ['request' => $_REQUEST]);
|
||||||
notice(self::getFormSecurityStandardErrorMessage());
|
DI::sysmsg()->addNotice(self::getFormSecurityStandardErrorMessage());
|
||||||
DI::baseUrl()->redirect($err_redirect);
|
DI::baseUrl()->redirect($err_redirect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,13 +123,13 @@ class UserImport
|
||||||
|
|
||||||
$account = json_decode(file_get_contents($file['tmp_name']), true);
|
$account = json_decode(file_get_contents($file['tmp_name']), true);
|
||||||
if ($account === null) {
|
if ($account === null) {
|
||||||
notice(DI::l10n()->t("Error decoding account file"));
|
DI::sysmsg()->addNotice(DI::l10n()->t("Error decoding account file"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (empty($account['version'])) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ class UserImport
|
||||||
// check if username matches deleted account
|
// check if username matches deleted account
|
||||||
if (DBA::exists('user', ['nickname' => $account['user']['nickname']])
|
if (DBA::exists('user', ['nickname' => $account['user']['nickname']])
|
||||||
|| DBA::exists('userd', ['username' => $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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ class UserImport
|
||||||
$r = self::dbImportAssoc('user', $account['user']);
|
$r = self::dbImportAssoc('user', $account['user']);
|
||||||
if ($r === false) {
|
if ($r === false) {
|
||||||
Logger::warning("uimport:insert user : ERROR : " . DBA::errorMessage());
|
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;
|
return;
|
||||||
}
|
}
|
||||||
$newuid = self::lastInsertId();
|
$newuid = self::lastInsertId();
|
||||||
|
@ -218,7 +218,7 @@ class UserImport
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($errorcount > 0) {
|
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) {
|
foreach ($account['group'] as &$group) {
|
||||||
|
@ -271,7 +271,7 @@ class UserImport
|
||||||
|
|
||||||
if ($r === false) {
|
if ($r === false) {
|
||||||
Logger::warning("uimport:insert profile: ERROR : " . DBA::errorMessage());
|
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('user', ['uid' => $newuid]);
|
||||||
DBA::delete('profile_field', ['uid' => $newuid]);
|
DBA::delete('profile_field', ['uid' => $newuid]);
|
||||||
return;
|
return;
|
||||||
|
@ -324,7 +324,7 @@ class UserImport
|
||||||
// send relocate messages
|
// send relocate messages
|
||||||
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $newuid);
|
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');
|
DI::baseUrl()->redirect('login');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ class Group
|
||||||
$group = DBA::selectFirst('group', ['deleted'], ['id' => $gid]);
|
$group = DBA::selectFirst('group', ['deleted'], ['id' => $gid]);
|
||||||
if (DBA::isResult($group) && $group['deleted']) {
|
if (DBA::isResult($group) && $group['deleted']) {
|
||||||
DBA::update('group', ['deleted' => 0], ['id' => $gid]);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -865,7 +865,7 @@ class Profile
|
||||||
|
|
||||||
$a->setContactId($arr['visitor']['id']);
|
$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']);
|
Logger::info('OpenWebAuth: auth success from ' . $visitor['addr']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ class Details extends BaseAdmin
|
||||||
|
|
||||||
$addon = Strings::sanitizeFilePathItem($this->parameters['addon']);
|
$addon = Strings::sanitizeFilePathItem($this->parameters['addon']);
|
||||||
if (!is_file("addon/$addon/$addon.php")) {
|
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);
|
Addon::uninstall($addon);
|
||||||
DI::baseUrl()->redirect('admin/addons');
|
DI::baseUrl()->redirect('admin/addons');
|
||||||
}
|
}
|
||||||
|
@ -73,10 +73,10 @@ class Details extends BaseAdmin
|
||||||
// Toggle addon status
|
// Toggle addon status
|
||||||
if (Addon::isEnabled($addon)) {
|
if (Addon::isEnabled($addon)) {
|
||||||
Addon::uninstall($addon);
|
Addon::uninstall($addon);
|
||||||
info(DI::l10n()->t('Addon %s disabled.', $addon));
|
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s disabled.', $addon));
|
||||||
} else {
|
} else {
|
||||||
Addon::install($addon);
|
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);
|
DI::baseUrl()->redirect('admin/addons/' . $addon);
|
||||||
|
|
|
@ -39,18 +39,18 @@ class Index extends BaseAdmin
|
||||||
switch ($_GET['action']) {
|
switch ($_GET['action']) {
|
||||||
case 'reload':
|
case 'reload':
|
||||||
Addon::reload();
|
Addon::reload();
|
||||||
info(DI::l10n()->t('Addons reloaded'));
|
DI::sysmsg()->addInfo(DI::l10n()->t('Addons reloaded'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'toggle' :
|
case 'toggle' :
|
||||||
$addon = $_GET['addon'] ?? '';
|
$addon = $_GET['addon'] ?? '';
|
||||||
if (Addon::isEnabled($addon)) {
|
if (Addon::isEnabled($addon)) {
|
||||||
Addon::uninstall($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)) {
|
} elseif (Addon::install($addon)) {
|
||||||
info(DI::l10n()->t('Addon %s enabled.', $addon));
|
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s enabled.', $addon));
|
||||||
} else {
|
} else {
|
||||||
notice(DI::l10n()->t('Addon %s failed to install.', $addon));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Addon %s failed to install.', $addon));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -46,12 +46,12 @@ class Contact extends BaseAdmin
|
||||||
if (!empty($_POST['page_contactblock_block'])) {
|
if (!empty($_POST['page_contactblock_block'])) {
|
||||||
$contact = Model\Contact::getByURL($contact_url, null, ['id', 'nurl']);
|
$contact = Model\Contact::getByURL($contact_url, null, ['id', 'nurl']);
|
||||||
if (empty($contact)) {
|
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');
|
DI::baseUrl()->redirect('admin/blocklist/contact');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Network::isLocalLink($contact['nurl'])) {
|
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');
|
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'])) {
|
if (!empty($_POST['page_contactblock_unblock'])) {
|
||||||
foreach ($contacts as $uid) {
|
foreach ($contacts as $uid) {
|
||||||
Model\Contact::unblock($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::baseUrl()->redirect('admin/blocklist/contact');
|
||||||
|
|
|
@ -48,7 +48,7 @@ class DBSync extends BaseAdmin
|
||||||
DI::config()->set('system', 'build', intval($curr) + 1);
|
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;
|
break;
|
||||||
|
|
|
@ -50,7 +50,7 @@ class Delete extends BaseAdmin
|
||||||
Item::markForDeletion(['guid' => $guid]);
|
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');
|
DI::baseUrl()->redirect('admin/item/delete');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Settings extends BaseAdmin
|
||||||
|
|
||||||
if (is_file($logfile) &&
|
if (is_file($logfile) &&
|
||||||
!is_writeable($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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Storage extends BaseAdmin
|
||||||
/** @var ICanConfigureStorage|false $newStorageConfig */
|
/** @var ICanConfigureStorage|false $newStorageConfig */
|
||||||
$newStorageConfig = DI::storageManager()->getConfigurationByName($storagebackend);
|
$newStorageConfig = DI::storageManager()->getConfigurationByName($storagebackend);
|
||||||
} catch (InvalidClassStorageException $storageException) {
|
} 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');
|
DI::baseUrl()->redirect('admin/storage');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ class Storage extends BaseAdmin
|
||||||
$storage_form_errors = $newStorageConfig->saveOptions($storage_opts_data);
|
$storage_form_errors = $newStorageConfig->saveOptions($storage_opts_data);
|
||||||
if (count($storage_form_errors)) {
|
if (count($storage_form_errors)) {
|
||||||
foreach ($storage_form_errors as $name => $err) {
|
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');
|
DI::baseUrl()->redirect('admin/storage');
|
||||||
}
|
}
|
||||||
|
@ -81,10 +81,10 @@ class Storage extends BaseAdmin
|
||||||
$newstorage = DI::storageManager()->getWritableStorageByName($storagebackend);
|
$newstorage = DI::storageManager()->getWritableStorageByName($storagebackend);
|
||||||
|
|
||||||
if (!DI::storageManager()->setBackend($newstorage)) {
|
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) {
|
} catch (InvalidClassStorageException $storageException) {
|
||||||
notice(DI::l10n()->t('Invalid storage backend setting value.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Invalid storage backend setting value.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Details extends BaseAdmin
|
||||||
|
|
||||||
$theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
|
$theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
|
||||||
if (!is_dir("view/theme/$theme")) {
|
if (!is_dir("view/theme/$theme")) {
|
||||||
notice(DI::l10n()->t("Item not found."));
|
DI::sysmsg()->addNotice(DI::l10n()->t("Item not found."));
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,11 +54,11 @@ class Details extends BaseAdmin
|
||||||
|
|
||||||
if ($isEnabled) {
|
if ($isEnabled) {
|
||||||
Theme::uninstall($theme);
|
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)) {
|
} 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 {
|
} 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);
|
DI::baseUrl()->redirect('admin/themes/' . $theme);
|
||||||
|
|
|
@ -77,7 +77,7 @@ class Embed extends BaseAdmin
|
||||||
|
|
||||||
$theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
|
$theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
|
||||||
if (!is_dir("view/theme/$theme")) {
|
if (!is_dir("view/theme/$theme")) {
|
||||||
notice($this->t('Unknown theme.'));
|
DI::sysmsg()->addNotice($this->t('Unknown theme.'));
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Index extends BaseAdmin
|
||||||
}
|
}
|
||||||
Theme::setAllowedList($allowed_themes);
|
Theme::setAllowedList($allowed_themes);
|
||||||
|
|
||||||
info(DI::l10n()->t('Themes reloaded'));
|
DI::sysmsg()->addInfo(DI::l10n()->t('Themes reloaded'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'toggle' :
|
case 'toggle' :
|
||||||
|
@ -56,17 +56,17 @@ class Index extends BaseAdmin
|
||||||
if ($theme) {
|
if ($theme) {
|
||||||
$theme = Strings::sanitizeFilePathItem($theme);
|
$theme = Strings::sanitizeFilePathItem($theme);
|
||||||
if (!is_dir("view/theme/$theme")) {
|
if (!is_dir("view/theme/$theme")) {
|
||||||
notice(DI::l10n()->t('Item not found.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Item not found.'));
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($theme, Theme::getAllowedList())) {
|
if (in_array($theme, Theme::getAllowedList())) {
|
||||||
Theme::uninstall($theme);
|
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)) {
|
} 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 {
|
} else {
|
||||||
notice(DI::l10n()->t('Theme %s failed to install.', $theme));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Theme %s failed to install.', $theme));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ class Active extends BaseUsers
|
||||||
foreach ($users as $uid) {
|
foreach ($users as $uid) {
|
||||||
User::block($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 (!empty($_POST['page_users_delete'])) {
|
||||||
|
@ -50,11 +50,11 @@ class Active extends BaseUsers
|
||||||
if (local_user() != $uid) {
|
if (local_user() != $uid) {
|
||||||
User::remove($uid);
|
User::remove($uid);
|
||||||
} else {
|
} 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());
|
DI::baseUrl()->redirect(DI::args()->getQueryString());
|
||||||
|
@ -70,7 +70,7 @@ class Active extends BaseUsers
|
||||||
if ($uid) {
|
if ($uid) {
|
||||||
$user = User::getById($uid, ['username', 'blocked']);
|
$user = User::getById($uid, ['username', 'blocked']);
|
||||||
if (!DBA::isResult($user)) {
|
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');
|
DI::baseUrl()->redirect('admin/users');
|
||||||
return ''; // NOTREACHED
|
return ''; // NOTREACHED
|
||||||
}
|
}
|
||||||
|
@ -83,9 +83,9 @@ class Active extends BaseUsers
|
||||||
// delete user
|
// delete user
|
||||||
User::remove($uid);
|
User::remove($uid);
|
||||||
|
|
||||||
notice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||||
} else {
|
} 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');
|
DI::baseUrl()->redirect('admin/users/active');
|
||||||
|
@ -93,7 +93,7 @@ class Active extends BaseUsers
|
||||||
case 'block':
|
case 'block':
|
||||||
self::checkFormSecurityTokenRedirectOnError('admin/users/active', 'admin_users_active', 't');
|
self::checkFormSecurityTokenRedirectOnError('admin/users/active', 'admin_users_active', 't');
|
||||||
User::block($uid);
|
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');
|
DI::baseUrl()->redirect('admin/users/active');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Blocked extends BaseUsers
|
||||||
foreach ($users as $uid) {
|
foreach ($users as $uid) {
|
||||||
User::block($uid, false);
|
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 (!empty($_POST['page_users_delete'])) {
|
||||||
|
@ -51,11 +51,11 @@ class Blocked extends BaseUsers
|
||||||
if (local_user() != $uid) {
|
if (local_user() != $uid) {
|
||||||
User::remove($uid);
|
User::remove($uid);
|
||||||
} else {
|
} 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');
|
DI::baseUrl()->redirect('admin/users/blocked');
|
||||||
|
@ -71,7 +71,7 @@ class Blocked extends BaseUsers
|
||||||
if ($uid) {
|
if ($uid) {
|
||||||
$user = User::getById($uid, ['username', 'blocked']);
|
$user = User::getById($uid, ['username', 'blocked']);
|
||||||
if (!DBA::isResult($user)) {
|
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');
|
DI::baseUrl()->redirect('admin/users');
|
||||||
return ''; // NOTREACHED
|
return ''; // NOTREACHED
|
||||||
}
|
}
|
||||||
|
@ -84,16 +84,16 @@ class Blocked extends BaseUsers
|
||||||
// delete user
|
// delete user
|
||||||
User::remove($uid);
|
User::remove($uid);
|
||||||
|
|
||||||
notice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||||
} else {
|
} 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');
|
DI::baseUrl()->redirect('admin/users/blocked');
|
||||||
break;
|
break;
|
||||||
case 'unblock':
|
case 'unblock':
|
||||||
self::checkFormSecurityTokenRedirectOnError('/admin/users/blocked', 'admin_users_blocked', 't');
|
self::checkFormSecurityTokenRedirectOnError('/admin/users/blocked', 'admin_users_blocked', 't');
|
||||||
User::block($uid, false);
|
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');
|
DI::baseUrl()->redirect('admin/users/blocked');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Create extends BaseUsers
|
||||||
User::createMinimal($nu_name, $nu_email, $nu_nickname, $nu_language);
|
User::createMinimal($nu_name, $nu_email, $nu_nickname, $nu_language);
|
||||||
DI::baseUrl()->redirect('admin/users');
|
DI::baseUrl()->redirect('admin/users');
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
notice($ex->getMessage());
|
DI::sysmsg()->addNotice($ex->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,14 +42,14 @@ class Index extends BaseUsers
|
||||||
foreach ($users as $uid) {
|
foreach ($users as $uid) {
|
||||||
User::block($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'])) {
|
if (!empty($_POST['page_users_unblock'])) {
|
||||||
foreach ($users as $uid) {
|
foreach ($users as $uid) {
|
||||||
User::block($uid, false);
|
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 (!empty($_POST['page_users_delete'])) {
|
||||||
|
@ -57,11 +57,11 @@ class Index extends BaseUsers
|
||||||
if (local_user() != $uid) {
|
if (local_user() != $uid) {
|
||||||
User::remove($uid);
|
User::remove($uid);
|
||||||
} else {
|
} 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());
|
DI::baseUrl()->redirect(DI::args()->getQueryString());
|
||||||
|
@ -77,7 +77,7 @@ class Index extends BaseUsers
|
||||||
if ($uid) {
|
if ($uid) {
|
||||||
$user = User::getById($uid, ['username', 'blocked']);
|
$user = User::getById($uid, ['username', 'blocked']);
|
||||||
if (!DBA::isResult($user)) {
|
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');
|
DI::baseUrl()->redirect('admin/users');
|
||||||
return ''; // NOTREACHED
|
return ''; // NOTREACHED
|
||||||
}
|
}
|
||||||
|
@ -90,9 +90,9 @@ class Index extends BaseUsers
|
||||||
// delete user
|
// delete user
|
||||||
User::remove($uid);
|
User::remove($uid);
|
||||||
|
|
||||||
notice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||||
} else {
|
} 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');
|
DI::baseUrl()->redirect('admin/users');
|
||||||
|
@ -100,13 +100,13 @@ class Index extends BaseUsers
|
||||||
case 'block':
|
case 'block':
|
||||||
self::checkFormSecurityTokenRedirectOnError('admin/users', 'admin_users', 't');
|
self::checkFormSecurityTokenRedirectOnError('admin/users', 'admin_users', 't');
|
||||||
User::block($uid);
|
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');
|
DI::baseUrl()->redirect('admin/users');
|
||||||
break;
|
break;
|
||||||
case 'unblock':
|
case 'unblock':
|
||||||
self::checkFormSecurityTokenRedirectOnError('admin/users', 'admin_users', 't');
|
self::checkFormSecurityTokenRedirectOnError('admin/users', 'admin_users', 't');
|
||||||
User::block($uid, false);
|
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');
|
DI::baseUrl()->redirect('admin/users');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,14 +45,14 @@ class Pending extends BaseUsers
|
||||||
foreach ($pending as $hash) {
|
foreach ($pending as $hash) {
|
||||||
User::allow($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'])) {
|
if (!empty($_POST['page_users_deny'])) {
|
||||||
foreach ($pending as $hash) {
|
foreach ($pending as $hash) {
|
||||||
User::deny($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');
|
DI::baseUrl()->redirect('admin/users/pending');
|
||||||
|
@ -68,7 +68,7 @@ class Pending extends BaseUsers
|
||||||
if ($uid) {
|
if ($uid) {
|
||||||
$user = User::getById($uid, ['username', 'blocked']);
|
$user = User::getById($uid, ['username', 'blocked']);
|
||||||
if (!DBA::isResult($user)) {
|
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');
|
DI::baseUrl()->redirect('admin/users');
|
||||||
return ''; // NOTREACHED
|
return ''; // NOTREACHED
|
||||||
}
|
}
|
||||||
|
@ -78,13 +78,13 @@ class Pending extends BaseUsers
|
||||||
case 'allow':
|
case 'allow':
|
||||||
self::checkFormSecurityTokenRedirectOnError('/admin/users/pending', 'admin_users_pending', 't');
|
self::checkFormSecurityTokenRedirectOnError('/admin/users/pending', 'admin_users_pending', 't');
|
||||||
User::allow(Register::getPendingForUser($uid)['hash'] ?? '');
|
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');
|
DI::baseUrl()->redirect('admin/users/pending');
|
||||||
break;
|
break;
|
||||||
case 'deny':
|
case 'deny':
|
||||||
self::checkFormSecurityTokenRedirectOnError('/admin/users/pending', 'admin_users_pending', 't');
|
self::checkFormSecurityTokenRedirectOnError('/admin/users/pending', 'admin_users_pending', 't');
|
||||||
User::deny(Register::getPendingForUser($uid)['hash'] ?? '');
|
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');
|
DI::baseUrl()->redirect('admin/users/pending');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Content\Nav;
|
||||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Util\Profiler;
|
use Friendica\Util\Profiler;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ class Apps extends BaseModule
|
||||||
$apps = Nav::getAppMenu();
|
$apps = Nav::getAppMenu();
|
||||||
|
|
||||||
if (count($apps) == 0) {
|
if (count($apps) == 0) {
|
||||||
notice($this->t('No installed applications.'));
|
DI::sysmsg()->addNotice($this->t('No installed applications.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$tpl = Renderer::getMarkupTemplate('apps.tpl');
|
$tpl = Renderer::getMarkupTemplate('apps.tpl');
|
||||||
|
|
|
@ -54,7 +54,7 @@ abstract class BaseAdmin extends BaseModule
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
if ($interactive) {
|
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());
|
Session::set('return_path', DI::args()->getQueryString());
|
||||||
DI::baseUrl()->redirect('login');
|
DI::baseUrl()->redirect('login');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -116,7 +116,7 @@ class BaseSearch extends BaseModule
|
||||||
protected static function printResult(ResultList $results, Pager $pager, string $header = ''): string
|
protected static function printResult(ResultList $results, Pager $pager, string $header = ''): string
|
||||||
{
|
{
|
||||||
if ($results->getTotal() == 0) {
|
if ($results->getTotal() == 0) {
|
||||||
notice(DI::l10n()->t('No matches'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('No matches'));
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ class Contact extends BaseModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($count_actions > 0) {
|
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);
|
DI::baseUrl()->redirect($redirectUrl);
|
||||||
|
|
|
@ -30,6 +30,7 @@ use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\Session;
|
use Friendica\Core\Session;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model;
|
use Friendica\Model;
|
||||||
use Friendica\Module\Contact;
|
use Friendica\Module\Contact;
|
||||||
use Friendica\Module\Response;
|
use Friendica\Module\Response;
|
||||||
|
@ -96,7 +97,7 @@ class Advanced extends BaseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$r) {
|
if (!$r) {
|
||||||
notice($this->t('Contact update failed.'));
|
DI::sysmsg()->addNotice($this->t('Contact update failed.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Group;
|
use Friendica\Model\Group;
|
||||||
use Friendica\Module;
|
use Friendica\Module;
|
||||||
|
@ -124,7 +125,7 @@ class Profile extends BaseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Contact::update($fields, ['id' => $cdata['user'], 'uid' => local_user()])) {
|
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);
|
// @TODO: add $this->localRelationship->save($localRelationship);
|
||||||
info($message);
|
DI::sysmsg()->addInfo($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cmd === 'ignore') {
|
if ($cmd === 'ignore') {
|
||||||
|
@ -198,7 +199,7 @@ class Profile extends BaseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO: add $this->localRelationship->save($localRelationship);
|
// @TODO: add $this->localRelationship->save($localRelationship);
|
||||||
info($message);
|
DI::sysmsg()->addInfo($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->baseUrl->redirect('contact/' . $contact['id']);
|
$this->baseUrl->redirect('contact/' . $contact['id']);
|
||||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model;
|
use Friendica\Model;
|
||||||
use Friendica\Module\Contact;
|
use Friendica\Module\Contact;
|
||||||
use Friendica\Module\Response;
|
use Friendica\Module\Response;
|
||||||
|
@ -87,7 +88,7 @@ class Revoke extends BaseModule
|
||||||
|
|
||||||
Model\Contact::revokeFollow($this->contact);
|
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']);
|
$this->baseUrl->redirect('contact/' . $this->parameters['id']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ class Community extends BaseModule
|
||||||
$items = self::getItems();
|
$items = self::getItems();
|
||||||
|
|
||||||
if (!DBA::isResult($items)) {
|
if (!DBA::isResult($items)) {
|
||||||
notice(DI::l10n()->t('No results.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('No results.'));
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ class Network extends BaseModule
|
||||||
if (self::$groupId) {
|
if (self::$groupId) {
|
||||||
$group = DBA::selectFirst('group', ['name'], ['id' => self::$groupId, 'uid' => local_user()]);
|
$group = DBA::selectFirst('group', ['name'], ['id' => self::$groupId, 'uid' => local_user()]);
|
||||||
if (!DBA::isResult($group)) {
|
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'), [
|
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [
|
||||||
|
@ -184,7 +184,7 @@ class Network extends BaseModule
|
||||||
'id' => DI::args()->get(0),
|
'id' => DI::args()->get(0),
|
||||||
]) . $o;
|
]) . $o;
|
||||||
} else {
|
} else {
|
||||||
notice(DI::l10n()->t('Invalid contact.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Invalid contact.'));
|
||||||
}
|
}
|
||||||
} elseif (!DI::config()->get('theme', 'hide_eventlist')) {
|
} elseif (!DI::config()->get('theme', 'hide_eventlist')) {
|
||||||
$o .= Profile::getBirthdays();
|
$o .= Profile::getBirthdays();
|
||||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\App;
|
||||||
use Friendica\BaseModule;
|
use Friendica\BaseModule;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model;
|
use Friendica\Model;
|
||||||
use Friendica\Module\Response;
|
use Friendica\Module\Response;
|
||||||
use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests;
|
use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests;
|
||||||
|
@ -48,7 +49,7 @@ class Feed extends BaseModule
|
||||||
$this->httpClient = $httpClient;
|
$this->httpClient = $httpClient;
|
||||||
|
|
||||||
if (!local_user()) {
|
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();
|
$baseUrl->redirect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ class Directory extends BaseModule
|
||||||
$profiles = Profile::searchProfiles($pager->getStart(), $pager->getItemsPerPage(), $search);
|
$profiles = Profile::searchProfiles($pager->getStart(), $pager->getItemsPerPage(), $search);
|
||||||
|
|
||||||
if ($profiles['total'] === 0) {
|
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 {
|
} else {
|
||||||
foreach ($profiles['entries'] as $entry) {
|
foreach ($profiles['entries'] as $entry) {
|
||||||
$contact = Model\Contact::getByURLForUser($entry['url'], local_user());
|
$contact = Model\Contact::getByURLForUser($entry['url'], local_user());
|
||||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\BaseModule;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model;
|
use Friendica\Model;
|
||||||
use Friendica\Module\Response;
|
use Friendica\Module\Response;
|
||||||
use Friendica\Network\HTTPException;
|
use Friendica\Network\HTTPException;
|
||||||
|
@ -43,7 +44,7 @@ class SaveTag extends BaseModule
|
||||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||||
|
|
||||||
if (!local_user()) {
|
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();
|
$baseUrl->redirect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class FollowConfirm extends BaseModule
|
||||||
parent::post($request);
|
parent::post($request);
|
||||||
$uid = local_user();
|
$uid = local_user();
|
||||||
if (!$uid) {
|
if (!$uid) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\Contact as ContactModel;
|
use Friendica\Model\Contact as ContactModel;
|
||||||
use Friendica\Network\HTTPException\ForbiddenException;
|
use Friendica\Network\HTTPException\ForbiddenException;
|
||||||
use Friendica\Network\HTTPException\NotFoundException;
|
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
|
// 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()]);
|
$contact = $this->dba->selectFirst('contact', ['name', 'url', 'request', 'avatar'], ['id' => $suggest_contact_id, 'uid' => local_user()]);
|
||||||
if (empty($contact)) {
|
if (empty($contact)) {
|
||||||
notice($this->t('Suggested contact not found.'));
|
DI::sysmsg()->addNotice($this->t('Suggested contact not found.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +97,7 @@ class FriendSuggest extends BaseModule
|
||||||
|
|
||||||
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::SUGGESTION, $suggest->id);
|
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
|
protected function content(array $request = []): string
|
||||||
|
@ -105,7 +106,7 @@ class FriendSuggest extends BaseModule
|
||||||
|
|
||||||
$contact = $this->dba->selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
|
$contact = $this->dba->selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
|
||||||
if (empty($contact)) {
|
if (empty($contact)) {
|
||||||
notice($this->t('Contact not found.'));
|
DI::sysmsg()->addNotice($this->t('Contact not found.'));
|
||||||
$this->baseUrl->redirect();
|
$this->baseUrl->redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Group extends BaseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
DI::baseUrl()->redirect();
|
DI::baseUrl()->redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class Group extends BaseModule
|
||||||
DI::baseUrl()->redirect('group/' . $r);
|
DI::baseUrl()->redirect('group/' . $r);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
notice(DI::l10n()->t('Could not create group.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Could not create group.'));
|
||||||
}
|
}
|
||||||
DI::baseUrl()->redirect('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()]);
|
$group = DBA::selectFirst('group', ['id', 'name'], ['id' => DI::args()->getArgv()[1], 'uid' => local_user()]);
|
||||||
if (!DBA::isResult($group)) {
|
if (!DBA::isResult($group)) {
|
||||||
notice(DI::l10n()->t('Group not found.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Group not found.'));
|
||||||
DI::baseUrl()->redirect('contact');
|
DI::baseUrl()->redirect('contact');
|
||||||
}
|
}
|
||||||
$groupname = trim($_POST['groupname']);
|
$groupname = trim($_POST['groupname']);
|
||||||
if (strlen($groupname) && ($groupname != $group['name'])) {
|
if (strlen($groupname) && ($groupname != $group['name'])) {
|
||||||
if (!Model\Group::update($group['id'], $groupname)) {
|
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);
|
throw new \Exception(DI::l10n()->t('Bad request.'), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
info($message);
|
DI::sysmsg()->addInfo($message);
|
||||||
System::jsonExit(['status' => 'OK', 'message' => $message]);
|
System::jsonExit(['status' => 'OK', 'message' => $message]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
notice($e->getMessage());
|
DI::sysmsg()->addNotice($e->getMessage());
|
||||||
System::jsonError($e->getCode(), ['status' => 'error', 'message' => $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
|
// @TODO: Replace with parameter from router
|
||||||
if (intval(DI::args()->getArgv()[2])) {
|
if (intval(DI::args()->getArgv()[2])) {
|
||||||
if (!Model\Group::exists(DI::args()->getArgv()[2], local_user())) {
|
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');
|
DI::baseUrl()->redirect('contact');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Model\Group::remove(DI::args()->getArgv()[2])) {
|
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');
|
DI::baseUrl()->redirect('group');
|
||||||
|
@ -236,7 +236,7 @@ class Group extends BaseModule
|
||||||
if ((DI::args()->getArgc() > 1) && intval(DI::args()->getArgv()[1])) {
|
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]);
|
$group = DBA::selectFirst('group', ['id', 'name'], ['id' => DI::args()->getArgv()[1], 'uid' => local_user(), 'deleted' => false]);
|
||||||
if (!DBA::isResult($group)) {
|
if (!DBA::isResult($group)) {
|
||||||
notice(DI::l10n()->t('Group not found.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Group not found.'));
|
||||||
DI::baseUrl()->redirect('contact');
|
DI::baseUrl()->redirect('contact');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ class Invite extends BaseModule
|
||||||
$recipient = trim($recipient);
|
$recipient = trim($recipient);
|
||||||
|
|
||||||
if (!filter_var($recipient, FILTER_VALIDATE_EMAIL)) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,15 +114,15 @@ class Invite extends BaseModule
|
||||||
$current_invites++;
|
$current_invites++;
|
||||||
DI::pConfig()->set(local_user(), 'system', 'sent_invites', $current_invites);
|
DI::pConfig()->set(local_user(), 'system', 'sent_invites', $current_invites);
|
||||||
if ($current_invites > $max_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;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
protected function content(array $request = []): string
|
||||||
|
|
|
@ -30,6 +30,7 @@ use Friendica\Content\Text\BBCode;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Module\BaseNotifications;
|
use Friendica\Module\BaseNotifications;
|
||||||
use Friendica\Module\Response;
|
use Friendica\Module\Response;
|
||||||
|
@ -211,7 +212,7 @@ class Introductions extends BaseNotifications
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($notifications['notifications']) == 0) {
|
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']);
|
$notificationNoContent = $this->t('No more %s notifications.', $notifications['ident']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ use Friendica\Contact\Introduction\Repository\Introduction;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Module\Response;
|
use Friendica\Module\Response;
|
||||||
use Friendica\Module\Security\Login;
|
use Friendica\Module\Security\Login;
|
||||||
|
@ -131,7 +132,7 @@ class Notification extends BaseModule
|
||||||
protected function content(array $request = []): string
|
protected function content(array $request = []): string
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
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();
|
return Login::form();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ class Profile extends BaseProfile
|
||||||
$o = self::getTabsHTML($a, 'profile', $is_owner, $profile['nickname'], $profile['hide-friends']);
|
$o = self::getTabsHTML($a, 'profile', $is_owner, $profile['nickname'], $profile['hide-friends']);
|
||||||
|
|
||||||
if (!empty($profile['hidewall']) && !$is_owner && !$remote_contact_id) {
|
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 '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ class Status extends BaseProfile
|
||||||
$last_updated_key = "profile:" . $profile['uid'] . ":" . local_user() . ":" . $remote_contact;
|
$last_updated_key = "profile:" . $profile['uid'] . ":" . local_user() . ":" . $remote_contact;
|
||||||
|
|
||||||
if (!empty($profile['hidewall']) && !$is_owner && !$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 '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,20 +74,20 @@ class Register extends BaseModule
|
||||||
$block = DI::config()->get('system', 'block_extended_register');
|
$block = DI::config()->get('system', 'block_extended_register');
|
||||||
|
|
||||||
if (local_user() && $block) {
|
if (local_user() && $block) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (local_user()) {
|
if (local_user()) {
|
||||||
$user = DBA::selectFirst('user', ['parent-uid'], ['uid' => local_user()]);
|
$user = DBA::selectFirst('user', ['parent-uid'], ['uid' => local_user()]);
|
||||||
if (!empty($user['parent-uid'])) {
|
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 '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!local_user() && (intval(DI::config()->get('config', 'register_policy')) === self::CLOSED)) {
|
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 '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ class Register extends BaseModule
|
||||||
$count = DBA::count('user', ['`register_date` > UTC_TIMESTAMP - INTERVAL 1 day']);
|
$count = DBA::count('user', ['`register_date` > UTC_TIMESTAMP - INTERVAL 1 day']);
|
||||||
if ($count >= $max_dailies) {
|
if ($count >= $max_dailies) {
|
||||||
Logger::notice('max daily registrations exceeded.');
|
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 '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,19 +203,19 @@ class Register extends BaseModule
|
||||||
$additional_account = false;
|
$additional_account = false;
|
||||||
|
|
||||||
if (!local_user() && !empty($arr['post']['parent_password'])) {
|
if (!local_user() && !empty($arr['post']['parent_password'])) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
return;
|
return;
|
||||||
} elseif (local_user() && !empty($arr['post']['parent_password'])) {
|
} elseif (local_user() && !empty($arr['post']['parent_password'])) {
|
||||||
try {
|
try {
|
||||||
Model\User::getIdFromPasswordAuthentication(local_user(), $arr['post']['parent_password']);
|
Model\User::getIdFromPasswordAuthentication(local_user(), $arr['post']['parent_password']);
|
||||||
} catch (\Exception $ex) {
|
} 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']];
|
$regdata = ['nickname' => $arr['post']['nickname'], 'username' => $arr['post']['username']];
|
||||||
DI::baseUrl()->redirect('register?' . http_build_query($regdata));
|
DI::baseUrl()->redirect('register?' . http_build_query($regdata));
|
||||||
}
|
}
|
||||||
$additional_account = true;
|
$additional_account = true;
|
||||||
} elseif (local_user()) {
|
} 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']];
|
$regdata = ['nickname' => $arr['post']['nickname'], 'username' => $arr['post']['username']];
|
||||||
DI::baseUrl()->redirect('register?' . http_build_query($regdata));
|
DI::baseUrl()->redirect('register?' . http_build_query($regdata));
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ class Register extends BaseModule
|
||||||
case self::CLOSED:
|
case self::CLOSED:
|
||||||
default:
|
default:
|
||||||
if (empty($_SESSION['authenticated']) && empty($_SESSION['administrator'])) {
|
if (empty($_SESSION['authenticated']) && empty($_SESSION['administrator'])) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$blocked = 1;
|
$blocked = 1;
|
||||||
|
@ -257,14 +257,14 @@ class Register extends BaseModule
|
||||||
// Is there text in the tar pit?
|
// Is there text in the tar pit?
|
||||||
if (!empty($arr['email'])) {
|
if (!empty($arr['email'])) {
|
||||||
Logger::info('Tar pit', $arr);
|
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/');
|
DI::baseUrl()->redirect('register/');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($additional_account) {
|
if ($additional_account) {
|
||||||
$user = DBA::selectFirst('user', ['email'], ['uid' => local_user()]);
|
$user = DBA::selectFirst('user', ['email'], ['uid' => local_user()]);
|
||||||
if (!DBA::isResult($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');
|
DI::baseUrl()->redirect('register');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ class Register extends BaseModule
|
||||||
|
|
||||||
if ($arr['email'] != $arr['repeat']) {
|
if ($arr['email'] != $arr['repeat']) {
|
||||||
Logger::info('Mail mismatch', $arr);
|
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']];
|
$regdata = ['email' => $arr['email'], 'nickname' => $arr['nickname'], 'username' => $arr['username']];
|
||||||
DI::baseUrl()->redirect('register?' . http_build_query($regdata));
|
DI::baseUrl()->redirect('register?' . http_build_query($regdata));
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ class Register extends BaseModule
|
||||||
try {
|
try {
|
||||||
$result = Model\User::create($arr);
|
$result = Model\User::create($arr);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
notice($e->getMessage());
|
DI::sysmsg()->addNotice($e->getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ class Register extends BaseModule
|
||||||
|
|
||||||
if ($additional_account) {
|
if ($additional_account) {
|
||||||
DBA::update('user', ['parent-uid' => local_user()], ['uid' => $user['uid']]);
|
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');
|
DI::baseUrl()->redirect('delegation');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,28 +332,28 @@ class Register extends BaseModule
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($res) {
|
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();
|
DI::baseUrl()->redirect();
|
||||||
} else {
|
} 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.',
|
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'],
|
$user['email'],
|
||||||
$result['password'])
|
$result['password'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
info(DI::l10n()->t('Registration successful.'));
|
DI::sysmsg()->addInfo(DI::l10n()->t('Registration successful.'));
|
||||||
DI::baseUrl()->redirect();
|
DI::baseUrl()->redirect();
|
||||||
}
|
}
|
||||||
} elseif (intval(DI::config()->get('config', 'register_policy')) === self::APPROVE) {
|
} elseif (intval(DI::config()->get('config', 'register_policy')) === self::APPROVE) {
|
||||||
if (!strlen(DI::config()->get('config', 'admin_email'))) {
|
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();
|
DI::baseUrl()->redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the note to the admin is actually filled out
|
// Check if the note to the admin is actually filled out
|
||||||
if (empty($_POST['permonlybox'])) {
|
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::l10n()->t('Your registration can not be processed.'));
|
||||||
|
|
||||||
DI::baseUrl()->redirect('register/');
|
DI::baseUrl()->redirect('register/');
|
||||||
|
@ -399,7 +399,7 @@ class Register extends BaseModule
|
||||||
$result['password']
|
$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();
|
DI::baseUrl()->redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\Search;
|
use Friendica\Core\Search;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
|
@ -68,25 +69,25 @@ class RemoteFollow extends BaseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->owner)) {
|
if (empty($this->owner)) {
|
||||||
notice($this->t('Profile unavailable.'));
|
DI::sysmsg()->addNotice($this->t('Profile unavailable.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = Probe::cleanURI($_POST['dfrn_url']);
|
$url = Probe::cleanURI($_POST['dfrn_url']);
|
||||||
if (!strlen($url)) {
|
if (!strlen($url)) {
|
||||||
notice($this->t("Invalid locator"));
|
DI::sysmsg()->addNotice($this->t("Invalid locator"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect the network, make sure the provided URL is valid
|
// Detect the network, make sure the provided URL is valid
|
||||||
$data = Contact::getByURL($url);
|
$data = Contact::getByURL($url);
|
||||||
if (!$data) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($data['subscribe'])) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Directory extends BaseSearch
|
||||||
protected function content(array $request = []): string
|
protected function content(array $request = []): string
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
notice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
return Login::form();
|
return Login::form();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
// 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)) {
|
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]);
|
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;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ class Index extends BaseSearch
|
||||||
|
|
||||||
if (empty($items)) {
|
if (empty($items)) {
|
||||||
if (empty($last_uriid)) {
|
if (empty($last_uriid)) {
|
||||||
notice(DI::l10n()->t('No results.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('No results.'));
|
||||||
}
|
}
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\BaseModule;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Search;
|
use Friendica\Core\Search;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Module\Response;
|
use Friendica\Module\Response;
|
||||||
use Friendica\Util\Profiler;
|
use Friendica\Util\Profiler;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
@ -55,16 +56,16 @@ class Saved extends BaseModule
|
||||||
$fields = ['uid' => local_user(), 'term' => $search];
|
$fields = ['uid' => local_user(), 'term' => $search];
|
||||||
if (!$this->dba->exists('search', $fields)) {
|
if (!$this->dba->exists('search', $fields)) {
|
||||||
if (!$this->dba->insert('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 {
|
} else {
|
||||||
notice($this->t('Search term already saved.'));
|
DI::sysmsg()->addNotice($this->t('Search term already saved.'));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'remove':
|
case 'remove':
|
||||||
if (!$this->dba->delete('search', ['uid' => local_user(), 'term' => $search])) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Core\Hook;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Session\Capability\IHandleSessions;
|
use Friendica\Core\Session\Capability\IHandleSessions;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Model\User\Cookie;
|
use Friendica\Model\User\Cookie;
|
||||||
use Friendica\Module\Response;
|
use Friendica\Module\Response;
|
||||||
|
@ -80,7 +81,7 @@ class Logout extends BaseModule
|
||||||
if ($visitor_home) {
|
if ($visitor_home) {
|
||||||
System::externalRedirect($visitor_home);
|
System::externalRedirect($visitor_home);
|
||||||
} else {
|
} else {
|
||||||
info($this->t('Logged out.'));
|
DI::sysmsg()->addInfo($this->t('Logged out.'));
|
||||||
$this->baseUrl->redirect();
|
$this->baseUrl->redirect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,9 +87,9 @@ class OpenID extends BaseModule
|
||||||
$session->set('openid_server', $open_id_obj->discover($open_id_obj->identity));
|
$session->set('openid_server', $open_id_obj->discover($open_id_obj->identity));
|
||||||
|
|
||||||
if (intval(DI::config()->get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED) {
|
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 {
|
} 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');
|
DI::baseUrl()->redirect('login');
|
||||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\BaseModule;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\Session\Capability\IHandleSessions;
|
use Friendica\Core\Session\Capability\IHandleSessions;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Module\Response;
|
use Friendica\Module\Response;
|
||||||
use Friendica\Security\Authentication;
|
use Friendica\Security\Authentication;
|
||||||
|
@ -70,13 +71,13 @@ class Recovery extends BaseModule
|
||||||
if (RecoveryCode::existsForUser(local_user(), $recovery_code)) {
|
if (RecoveryCode::existsForUser(local_user(), $recovery_code)) {
|
||||||
RecoveryCode::markUsedForUser(local_user(), $recovery_code);
|
RecoveryCode::markUsedForUser(local_user(), $recovery_code);
|
||||||
$this->session->set('2fa', true);
|
$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->auth->setForUser($this->app, User::getById($this->app->getLoggedInUserId()), true, true);
|
||||||
|
|
||||||
$this->baseUrl->redirect($this->session->pop('return_path', ''));
|
$this->baseUrl->redirect($this->session->pop('return_path', ''));
|
||||||
} else {
|
} else {
|
||||||
notice($this->t('Invalid code, please retry.'));
|
DI::sysmsg()->addNotice($this->t('Invalid code, please retry.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\BaseModule;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\Session\Capability\IHandleSessions;
|
use Friendica\Core\Session\Capability\IHandleSessions;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\User\Cookie;
|
use Friendica\Model\User\Cookie;
|
||||||
use Friendica\Module\Response;
|
use Friendica\Module\Response;
|
||||||
use Friendica\Network\HTTPException\NotFoundException;
|
use Friendica\Network\HTTPException\NotFoundException;
|
||||||
|
@ -75,7 +76,7 @@ class SignOut extends BaseModule
|
||||||
$this->cookie->reset(['2fa_cookie_hash' => $trusted]);
|
$this->cookie->reset(['2fa_cookie_hash' => $trusted]);
|
||||||
$this->session->clear();
|
$this->session->clear();
|
||||||
|
|
||||||
info($this->t('Logged out.'));
|
DI::sysmsg()->addInfo($this->t('Logged out.'));
|
||||||
$this->baseUrl->redirect();
|
$this->baseUrl->redirect();
|
||||||
break;
|
break;
|
||||||
case 'sign_out':
|
case 'sign_out':
|
||||||
|
@ -83,7 +84,7 @@ class SignOut extends BaseModule
|
||||||
$this->cookie->clear();
|
$this->cookie->clear();
|
||||||
$this->session->clear();
|
$this->session->clear();
|
||||||
|
|
||||||
info($this->t('Logged out.'));
|
DI::sysmsg()->addInfo($this->t('Logged out.'));
|
||||||
$this->baseUrl->redirect();
|
$this->baseUrl->redirect();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -105,14 +106,14 @@ class SignOut extends BaseModule
|
||||||
$this->cookie->reset(['2fa_cookie_hash' => $trusted]);
|
$this->cookie->reset(['2fa_cookie_hash' => $trusted]);
|
||||||
$this->session->clear();
|
$this->session->clear();
|
||||||
|
|
||||||
info($this->t('Logged out.'));
|
DI::sysmsg()->addInfo($this->t('Logged out.'));
|
||||||
$this->baseUrl->redirect();
|
$this->baseUrl->redirect();
|
||||||
}
|
}
|
||||||
} catch (TwoFactor\Exception\TrustedBrowserNotFoundException $exception) {
|
} catch (TwoFactor\Exception\TrustedBrowserNotFoundException $exception) {
|
||||||
$this->cookie->clear();
|
$this->cookie->clear();
|
||||||
$this->session->clear();
|
$this->session->clear();
|
||||||
|
|
||||||
info($this->t('Logged out.'));
|
DI::sysmsg()->addInfo($this->t('Logged out.'));
|
||||||
$this->baseUrl->redirect();
|
$this->baseUrl->redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\BaseModule;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\Session\Capability\IHandleSessions;
|
use Friendica\Core\Session\Capability\IHandleSessions;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Model\User\Cookie;
|
use Friendica\Model\User\Cookie;
|
||||||
use Friendica\Module\Response;
|
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
|
// The string is sent to the browser to be sent back with each request
|
||||||
if (!$this->cookie->set('2fa_cookie_hash', $trustedBrowser->cookie_hash)) {
|
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) {
|
} catch (TrustedBrowserPersistenceException $exception) {
|
||||||
$this->logger->warning('Unexpected error when saving the trusted browser.', ['trustedBrowser' => $trustedBrowser, 'exception' => $exception]);
|
$this->logger->warning('Unexpected error when saving the trusted browser.', ['trustedBrowser' => $trustedBrowser, 'exception' => $exception]);
|
||||||
|
|
|
@ -75,10 +75,10 @@ class Account extends BaseSettings
|
||||||
throw new Exception(DI::l10n()->t('Password update failed. Please try again.'));
|
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) {
|
} catch (Exception $e) {
|
||||||
notice($e->getMessage());
|
DI::sysmsg()->addNotice($e->getMessage());
|
||||||
notice(DI::l10n()->t('Password unchanged.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Password unchanged.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
DI::baseUrl()->redirect($redirectUrl);
|
DI::baseUrl()->redirect($redirectUrl);
|
||||||
|
@ -123,7 +123,7 @@ class Account extends BaseSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($err)) {
|
if (strlen($err)) {
|
||||||
notice($err);
|
DI::sysmsg()->addNotice($err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ class Account extends BaseSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!User::update($fields, local_user())) {
|
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
|
// clear session language
|
||||||
|
@ -198,7 +198,7 @@ class Account extends BaseSettings
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!User::update($fields, local_user()) || !Profile::update($profile_fields, local_user())) {
|
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::baseUrl()->redirect($redirectUrl);
|
||||||
|
@ -218,7 +218,7 @@ class Account extends BaseSettings
|
||||||
DI::pConfig()->set(local_user(), 'expire', 'network_only', $expire_network_only);
|
DI::pConfig()->set(local_user(), 'expire', 'network_only', $expire_network_only);
|
||||||
|
|
||||||
if (!User::update(['expire' => $expire], local_user())) {
|
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);
|
DI::baseUrl()->redirect($redirectUrl);
|
||||||
|
@ -302,7 +302,7 @@ class Account extends BaseSettings
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!User::update($fields, local_user())) {
|
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);
|
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())) {
|
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);
|
DI::baseUrl()->redirect($redirectUrl);
|
||||||
|
@ -363,7 +363,7 @@ class Account extends BaseSettings
|
||||||
// was there an error
|
// was there an error
|
||||||
if ($_FILES['importcontact-filename']['error'] > 0) {
|
if ($_FILES['importcontact-filename']['error'] > 0) {
|
||||||
Logger::notice('Contact CSV file upload error', ['error' => $_FILES['importcontact-filename']['error']]);
|
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 {
|
} else {
|
||||||
$csvArray = array_map('str_getcsv', file($_FILES['importcontact-filename']['tmp_name']));
|
$csvArray = array_map('str_getcsv', file($_FILES['importcontact-filename']['tmp_name']));
|
||||||
Logger::notice('Import started', ['lines' => count($csvArray)]);
|
Logger::notice('Import started', ['lines' => count($csvArray)]);
|
||||||
|
@ -382,7 +382,7 @@ class Account extends BaseSettings
|
||||||
}
|
}
|
||||||
Logger::notice('Import done');
|
Logger::notice('Import done');
|
||||||
|
|
||||||
info(DI::l10n()->t('Importing Contacts done'));
|
DI::sysmsg()->addInfo(DI::l10n()->t('Importing Contacts done'));
|
||||||
// delete temp file
|
// delete temp file
|
||||||
unlink($_FILES['importcontact-filename']['tmp_name']);
|
unlink($_FILES['importcontact-filename']['tmp_name']);
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ class Account extends BaseSettings
|
||||||
|
|
||||||
if (!empty($request['relocate-submit'])) {
|
if (!empty($request['relocate-submit'])) {
|
||||||
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, local_user());
|
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);
|
DI::baseUrl()->redirect($redirectUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ class Account extends BaseSettings
|
||||||
|
|
||||||
$profile = DBA::selectFirst('profile', [], ['uid' => local_user()]);
|
$profile = DBA::selectFirst('profile', [], ['uid' => local_user()]);
|
||||||
if (!DBA::isResult($profile)) {
|
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 '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,13 +50,13 @@ class Delegation extends BaseSettings
|
||||||
if ($parent_uid != 0) {
|
if ($parent_uid != 0) {
|
||||||
try {
|
try {
|
||||||
User::getIdFromPasswordAuthentication($parent_uid, $parent_password);
|
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) {
|
} 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;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} 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()]);
|
DBA::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);
|
||||||
|
@ -78,7 +78,7 @@ class Delegation extends BaseSettings
|
||||||
|
|
||||||
if ($action === 'add' && $user_id) {
|
if ($action === 'add' && $user_id) {
|
||||||
if (Session::get('submanage')) {
|
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');
|
DI::baseUrl()->redirect('settings/delegation');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class Delegation extends BaseSettings
|
||||||
DBA::insert('manage', ['uid' => $user_id, 'mid' => local_user()]);
|
DBA::insert('manage', ['uid' => $user_id, 'mid' => local_user()]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
notice(DI::l10n()->t('Delegate user not found.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Delegate user not found.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
DI::baseUrl()->redirect('settings/delegation');
|
DI::baseUrl()->redirect('settings/delegation');
|
||||||
|
@ -100,7 +100,7 @@ class Delegation extends BaseSettings
|
||||||
|
|
||||||
if ($action === 'remove' && $user_id) {
|
if ($action === 'remove' && $user_id) {
|
||||||
if (Session::get('submanage')) {
|
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');
|
DI::baseUrl()->redirect('settings/delegation');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ class Display extends BaseSettings
|
||||||
DBA::update('user', ['theme' => $theme], ['uid' => local_user()]);
|
DBA::update('user', ['theme' => $theme], ['uid' => local_user()]);
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
Hook::callAll('display_settings_post', $_POST);
|
||||||
|
|
|
@ -80,7 +80,7 @@ class Index extends BaseSettings
|
||||||
|
|
||||||
$name = trim($_POST['name'] ?? '');
|
$name = trim($_POST['name'] ?? '');
|
||||||
if (!strlen($name)) {
|
if (!strlen($name)) {
|
||||||
notice(DI::l10n()->t('Profile Name is required.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Profile Name is required.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ class Index extends BaseSettings
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
notice(DI::l10n()->t('Profile couldn\'t be updated.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Profile couldn\'t be updated.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ class Index extends BaseSettings
|
||||||
protected function content(array $request = []): string
|
protected function content(array $request = []): string
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
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();
|
return Login::form();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ class Crop extends BaseSettings
|
||||||
Photo::USER_AVATAR
|
Photo::USER_AVATAR
|
||||||
);
|
);
|
||||||
if ($r === false) {
|
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 {
|
} else {
|
||||||
Photo::update(['profile' => true], array_merge($condition, ['scale' => 4]));
|
Photo::update(['profile' => true], array_merge($condition, ['scale' => 4]));
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ class Crop extends BaseSettings
|
||||||
Photo::USER_AVATAR
|
Photo::USER_AVATAR
|
||||||
);
|
);
|
||||||
if ($r === false) {
|
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 {
|
} else {
|
||||||
Photo::update(['profile' => true], array_merge($condition, ['scale' => 5]));
|
Photo::update(['profile' => true], array_merge($condition, ['scale' => 5]));
|
||||||
}
|
}
|
||||||
|
@ -141,19 +141,19 @@ class Crop extends BaseSettings
|
||||||
Photo::USER_AVATAR
|
Photo::USER_AVATAR
|
||||||
);
|
);
|
||||||
if ($r === false) {
|
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 {
|
} else {
|
||||||
Photo::update(['profile' => true], array_merge($condition, ['scale' => 6]));
|
Photo::update(['profile' => true], array_merge($condition, ['scale' => 6]));
|
||||||
}
|
}
|
||||||
|
|
||||||
Contact::updateSelfFromUserID(local_user(), true);
|
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
|
// Update global directory in background
|
||||||
Profile::publishUpdate(local_user());
|
Profile::publishUpdate(local_user());
|
||||||
} else {
|
} 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
|
// Update global directory in background
|
||||||
Profile::publishUpdate(local_user());
|
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());
|
DI::baseUrl()->redirect('profile/' . DI::app()->getLoggedInUserNickname());
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Index extends BaseSettings
|
||||||
self::checkFormSecurityTokenRedirectOnError('/settings/profile/photo', 'settings_profile_photo');
|
self::checkFormSecurityTokenRedirectOnError('/settings/profile/photo', 'settings_profile_photo');
|
||||||
|
|
||||||
if (empty($_FILES['userfile'])) {
|
if (empty($_FILES['userfile'])) {
|
||||||
notice(DI::l10n()->t('Missing uploaded image.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Missing uploaded image.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class Index extends BaseSettings
|
||||||
$maximagesize = DI::config()->get('system', 'maximagesize', 0);
|
$maximagesize = DI::config()->get('system', 'maximagesize', 0);
|
||||||
|
|
||||||
if ($maximagesize && $filesize > $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);
|
@unlink($src);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ class Index extends BaseSettings
|
||||||
$Image = new Image($imagedata, $filetype);
|
$Image = new Image($imagedata, $filetype);
|
||||||
|
|
||||||
if (!$Image->isValid()) {
|
if (!$Image->isValid()) {
|
||||||
notice(DI::l10n()->t('Unable to process image.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to process image.'));
|
||||||
@unlink($src);
|
@unlink($src);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -93,13 +93,13 @@ class Index extends BaseSettings
|
||||||
$filename = '';
|
$filename = '';
|
||||||
|
|
||||||
if (!Photo::store($Image, local_user(), 0, $resource_id, $filename, DI::l10n()->t(Photo::PROFILE_PHOTOS), 0, Photo::USER_AVATAR)) {
|
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) {
|
if ($width > 640 || $height > 640) {
|
||||||
$Image->scaleDown(640);
|
$Image->scaleDown(640);
|
||||||
if (!Photo::store($Image, local_user(), 0, $resource_id, $filename, DI::l10n()->t(Photo::PROFILE_PHOTOS), 1, Photo::USER_AVATAR)) {
|
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'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\App;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Module\Response;
|
use Friendica\Module\Response;
|
||||||
use Friendica\Security\TwoFactor\Model\AppSpecificPassword;
|
use Friendica\Security\TwoFactor\Model\AppSpecificPassword;
|
||||||
use Friendica\Module\BaseSettings;
|
use Friendica\Module\BaseSettings;
|
||||||
|
@ -61,7 +62,7 @@ class AppSpecific extends BaseSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
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->baseUrl->redirect('settings/2fa');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,20 +80,20 @@ class AppSpecific extends BaseSettings
|
||||||
case 'generate':
|
case 'generate':
|
||||||
$description = $_POST['description'] ?? '';
|
$description = $_POST['description'] ?? '';
|
||||||
if (empty($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'));
|
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||||
} elseif (AppSpecificPassword::checkDuplicateForUser(local_user(), $description)) {
|
} 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'));
|
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||||
} else {
|
} else {
|
||||||
$this->appSpecificPassword = AppSpecificPassword::generateForUser(local_user(), $_POST['description'] ?? '');
|
$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;
|
break;
|
||||||
case 'revoke_all' :
|
case 'revoke_all' :
|
||||||
AppSpecificPassword::deleteAllForUser(local_user());
|
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'));
|
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +103,7 @@ class AppSpecific extends BaseSettings
|
||||||
self::checkFormSecurityTokenRedirectOnError('settings/2fa/app_specific', 'settings_2fa_app_specific');
|
self::checkFormSecurityTokenRedirectOnError('settings/2fa/app_specific', 'settings_2fa_app_specific');
|
||||||
|
|
||||||
if (AppSpecificPassword::deleteForUser(local_user(), $_POST['revoke_id'])) {
|
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'));
|
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Index extends BaseSettings
|
||||||
DI::pConfig()->delete(local_user(), '2fa', 'verified');
|
DI::pConfig()->delete(local_user(), '2fa', 'verified');
|
||||||
Session::remove('2fa');
|
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');
|
DI::baseUrl()->redirect('settings/2fa');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -98,7 +98,7 @@ class Index extends BaseSettings
|
||||||
} catch (FoundException $exception) {
|
} catch (FoundException $exception) {
|
||||||
// Nothing to do here
|
// Nothing to do here
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
notice(DI::l10n()->t($e->getMessage()));
|
DI::sysmsg()->addNotice(DI::l10n()->t($e->getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\App;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Module\Response;
|
use Friendica\Module\Response;
|
||||||
use Friendica\Security\TwoFactor\Model\RecoveryCode;
|
use Friendica\Security\TwoFactor\Model\RecoveryCode;
|
||||||
use Friendica\Module\BaseSettings;
|
use Friendica\Module\BaseSettings;
|
||||||
|
@ -59,7 +60,7 @@ class Recovery extends BaseSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
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->baseUrl->redirect('settings/2fa');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +76,7 @@ class Recovery extends BaseSettings
|
||||||
|
|
||||||
if ($_POST['action'] == 'regenerate') {
|
if ($_POST['action'] == 'regenerate') {
|
||||||
RecoveryCode::regenerateForUser(local_user());
|
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'));
|
$this->baseUrl->redirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\App;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Module\BaseSettings;
|
use Friendica\Module\BaseSettings;
|
||||||
use Friendica\Module\Response;
|
use Friendica\Module\Response;
|
||||||
use Friendica\Security\TwoFactor;
|
use Friendica\Security\TwoFactor;
|
||||||
|
@ -62,7 +63,7 @@ class Trusted extends BaseSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
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->baseUrl->redirect('settings/2fa');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +80,7 @@ class Trusted extends BaseSettings
|
||||||
switch ($_POST['action']) {
|
switch ($_POST['action']) {
|
||||||
case 'remove_all':
|
case 'remove_all':
|
||||||
$this->trustedBrowserRepo->removeAllForUser(local_user());
|
$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'));
|
$this->baseUrl->redirect('settings/2fa/trusted?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +90,7 @@ class Trusted extends BaseSettings
|
||||||
self::checkFormSecurityTokenRedirectOnError('settings/2fa/trusted', 'settings_2fa_trusted');
|
self::checkFormSecurityTokenRedirectOnError('settings/2fa/trusted', 'settings_2fa_trusted');
|
||||||
|
|
||||||
if ($this->trustedBrowserRepo->removeForUser(local_user(), $_POST['remove_id'])) {
|
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'));
|
$this->baseUrl->redirect('settings/2fa/trusted?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||||
|
|
|
@ -30,6 +30,7 @@ use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\Session;
|
use Friendica\Core\Session;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Module\BaseSettings;
|
use Friendica\Module\BaseSettings;
|
||||||
use Friendica\Module\Response;
|
use Friendica\Module\Response;
|
||||||
use Friendica\Module\Security\Login;
|
use Friendica\Module\Security\Login;
|
||||||
|
@ -65,7 +66,7 @@ class Verify extends BaseSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
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->baseUrl->redirect('settings/2fa');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,11 +88,11 @@ class Verify extends BaseSettings
|
||||||
$this->pConfig->set(local_user(), '2fa', 'verified', true);
|
$this->pConfig->set(local_user(), '2fa', 'verified', true);
|
||||||
Session::set('2fa', 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');
|
$this->baseUrl->redirect('settings/2fa');
|
||||||
} else {
|
} else {
|
||||||
notice($this->t('Invalid code, please retry.'));
|
DI::sysmsg()->addNotice($this->t('Invalid code, please retry.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,7 +223,7 @@ class Authentication
|
||||||
|
|
||||||
// if it's an email address or doesn't resolve to a URL, fail.
|
// if it's an email address or doesn't resolve to a URL, fail.
|
||||||
if ($noid || strpos($openid_url, '@') || !Network::isUrlValid($openid_url)) {
|
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();
|
$this->baseUrl->redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ class Authentication
|
||||||
$openid->optional = ['namePerson/friendly', 'contact/email', 'namePerson', 'namePerson/first', 'media/image/aspect11', 'media/image/default'];
|
$openid->optional = ['namePerson/friendly', 'contact/email', 'namePerson', 'namePerson/first', 'media/image/aspect11', 'media/image/default'];
|
||||||
System::externalRedirect($openid->authUrl());
|
System::externalRedirect($openid->authUrl());
|
||||||
} catch (Exception $e) {
|
} 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) {
|
} catch (Exception $e) {
|
||||||
$this->logger->warning('authenticate: failed login attempt', ['action' => 'login', 'username' => $username, 'ip' => $this->remoteAddress]);
|
$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();
|
$this->baseUrl->redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,8 +379,8 @@ class Authentication
|
||||||
|
|
||||||
if ($interactive) {
|
if ($interactive) {
|
||||||
if ($user_record['login_date'] <= DBA::NULL_DATETIME) {
|
if ($user_record['login_date'] <= DBA::NULL_DATETIME) {
|
||||||
info($this->l10n->t('Welcome %s', $user_record['username']));
|
DI::sysmsg()->addInfo($this->l10n->t('Welcome %s', $user_record['username']));
|
||||||
info($this->l10n->t('Please upload a profile photo.'));
|
DI::sysmsg()->addInfo($this->l10n->t('Please upload a profile photo.'));
|
||||||
$this->baseUrl->redirect('settings/profile/photo/new');
|
$this->baseUrl->redirect('settings/profile/photo/new');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user