mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-09 02:24:33 +02:00
Merge branch 'develop' into rewrite/gravity-constants
This commit is contained in:
commit
26e0469de7
181 changed files with 2408 additions and 2405 deletions
|
@ -62,7 +62,7 @@ class Details extends BaseAdmin
|
|||
|
||||
$addon = Strings::sanitizeFilePathItem($this->parameters['addon']);
|
||||
if (!is_file("addon/$addon/$addon.php")) {
|
||||
notice(DI::l10n()->t('Addon not found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Addon not found.'));
|
||||
Addon::uninstall($addon);
|
||||
DI::baseUrl()->redirect('admin/addons');
|
||||
}
|
||||
|
@ -73,10 +73,10 @@ class Details extends BaseAdmin
|
|||
// Toggle addon status
|
||||
if (Addon::isEnabled($addon)) {
|
||||
Addon::uninstall($addon);
|
||||
info(DI::l10n()->t('Addon %s disabled.', $addon));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s disabled.', $addon));
|
||||
} else {
|
||||
Addon::install($addon);
|
||||
info(DI::l10n()->t('Addon %s enabled.', $addon));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s enabled.', $addon));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/addons/' . $addon);
|
||||
|
|
|
@ -39,18 +39,18 @@ class Index extends BaseAdmin
|
|||
switch ($_GET['action']) {
|
||||
case 'reload':
|
||||
Addon::reload();
|
||||
info(DI::l10n()->t('Addons reloaded'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Addons reloaded'));
|
||||
break;
|
||||
|
||||
case 'toggle' :
|
||||
$addon = $_GET['addon'] ?? '';
|
||||
if (Addon::isEnabled($addon)) {
|
||||
Addon::uninstall($addon);
|
||||
info(DI::l10n()->t('Addon %s disabled.', $addon));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s disabled.', $addon));
|
||||
} elseif (Addon::install($addon)) {
|
||||
info(DI::l10n()->t('Addon %s enabled.', $addon));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Addon %s enabled.', $addon));
|
||||
} else {
|
||||
notice(DI::l10n()->t('Addon %s failed to install.', $addon));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Addon %s failed to install.', $addon));
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -46,12 +46,12 @@ class Contact extends BaseAdmin
|
|||
if (!empty($_POST['page_contactblock_block'])) {
|
||||
$contact = Model\Contact::getByURL($contact_url, null, ['id', 'nurl']);
|
||||
if (empty($contact)) {
|
||||
notice(DI::l10n()->t('Could not find any contact entry for this URL (%s)', $contact_url));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Could not find any contact entry for this URL (%s)', $contact_url));
|
||||
DI::baseUrl()->redirect('admin/blocklist/contact');
|
||||
}
|
||||
|
||||
if (Network::isLocalLink($contact['nurl'])) {
|
||||
notice(DI::l10n()->t('You can\'t block a local contact, please block the user instead'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t block a local contact, please block the user instead'));
|
||||
DI::baseUrl()->redirect('admin/blocklist/contact');
|
||||
}
|
||||
|
||||
|
@ -59,18 +59,18 @@ class Contact extends BaseAdmin
|
|||
|
||||
if ($block_purge) {
|
||||
foreach (Model\Contact::selectToArray(['id'], ['nurl' => $contact['nurl']]) as $contact) {
|
||||
Worker::add(PRIORITY_LOW, 'Contact\RemoveContent', $contact['id']);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'Contact\RemoveContent', $contact['id']);
|
||||
}
|
||||
}
|
||||
|
||||
info(DI::l10n()->t('The contact has been blocked from the node'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('The contact has been blocked from the node'));
|
||||
}
|
||||
|
||||
if (!empty($_POST['page_contactblock_unblock'])) {
|
||||
foreach ($contacts as $uid) {
|
||||
Model\Contact::unblock($uid);
|
||||
}
|
||||
info(DI::l10n()->tt('%s contact unblocked', '%s contacts unblocked', count($contacts)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s contact unblocked', '%s contacts unblocked', count($contacts)));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/blocklist/contact');
|
||||
|
|
|
@ -82,7 +82,7 @@ class Add extends BaseAdmin
|
|||
if (!empty($request['purge'])) {
|
||||
$gservers = GServer::listByDomainPattern($pattern);
|
||||
foreach (Contact::selectToArray(['id'], ['gsid' => array_column($gservers, 'id')]) as $contact) {
|
||||
Worker::add(PRIORITY_LOW, 'Contact\RemoveContent', $contact['id']);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'Contact\RemoveContent', $contact['id']);
|
||||
}
|
||||
|
||||
$this->sysmsg->addInfo($this->l10n->tt('%s server scheduled to be purged.', '%s servers scheduled to be purged.', count($gservers)));
|
||||
|
|
|
@ -48,7 +48,7 @@ class DBSync extends BaseAdmin
|
|||
DI::config()->set('system', 'build', intval($curr) + 1);
|
||||
}
|
||||
|
||||
info(DI::l10n()->t('Update has been marked successful'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Update has been marked successful'));
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace Friendica\Module\Admin;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -202,7 +203,7 @@ class Federation extends BaseAdmin
|
|||
'$page' => DI::l10n()->t('Federation Statistics'),
|
||||
'$intro' => $intro,
|
||||
'$counts' => $counts,
|
||||
'$version' => FRIENDICA_VERSION,
|
||||
'$version' => App::VERSION,
|
||||
'$legendtext' => DI::l10n()->tt('Currently this node is aware of %2$s node (%3$s active users last month, %4$s active users last six months, %5$s registered users in total) from the following platforms:', 'Currently this node is aware of %2$s nodes (%3$s active users last month, %4$s active users last six months, %5$s registered users in total) from the following platforms:', $total, number_format($total), number_format($month), number_format($halfyear), number_format($users)),
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ class Delete extends BaseAdmin
|
|||
Item::markForDeletion(['guid' => $guid]);
|
||||
}
|
||||
|
||||
info(DI::l10n()->t('Item marked for deletion.'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Item marked for deletion.'));
|
||||
DI::baseUrl()->redirect('admin/item/delete');
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class Settings extends BaseAdmin
|
|||
|
||||
if (is_file($logfile) &&
|
||||
!is_writeable($logfile)) {
|
||||
notice(DI::l10n()->t('The logfile \'%s\' is not writable. No logging possible', $logfile));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('The logfile \'%s\' is not writable. No logging possible', $logfile));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
namespace Friendica\Module\Admin;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Relocate;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Search;
|
||||
use Friendica\Core\System;
|
||||
|
@ -33,12 +32,11 @@ use Friendica\DI;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\BaseAdmin;
|
||||
use Friendica\Module\Conversation\Community;
|
||||
use Friendica\Module\Register;
|
||||
use Friendica\Protocol\Relay;
|
||||
use Friendica\Util\BasePath;
|
||||
use Friendica\Util\EMailer\MailBuilder;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Worker\Delivery;
|
||||
|
||||
require_once __DIR__ . '/../../../boot.php';
|
||||
|
||||
|
@ -53,7 +51,7 @@ class Site extends BaseAdmin
|
|||
$a = DI::app();
|
||||
|
||||
if (!empty($_POST['republish_directory'])) {
|
||||
Worker::add(PRIORITY_LOW, 'Directory');
|
||||
Worker::add(Worker::PRIORITY_LOW, 'Directory');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -150,7 +148,7 @@ class Site extends BaseAdmin
|
|||
// Has the directory url changed? If yes, then resubmit the existing profiles there
|
||||
if ($global_directory != DI::config()->get('system', 'directory') && ($global_directory != '')) {
|
||||
DI::config()->set('system', 'directory', $global_directory);
|
||||
Worker::add(PRIORITY_LOW, 'Directory');
|
||||
Worker::add(Worker::PRIORITY_LOW, 'Directory');
|
||||
}
|
||||
|
||||
if (DI::baseUrl()->getUrlPath() != "") {
|
||||
|
@ -364,11 +362,11 @@ class Site extends BaseAdmin
|
|||
|
||||
/* Community page style */
|
||||
$community_page_style_choices = [
|
||||
CP_NO_INTERNAL_COMMUNITY => DI::l10n()->t('No community page for local users'),
|
||||
CP_NO_COMMUNITY_PAGE => DI::l10n()->t('No community page'),
|
||||
CP_USERS_ON_SERVER => DI::l10n()->t('Public postings from users of this site'),
|
||||
CP_GLOBAL_COMMUNITY => DI::l10n()->t('Public postings from the federated network'),
|
||||
CP_USERS_AND_GLOBAL => DI::l10n()->t('Public postings from local users and the federated network')
|
||||
Community::DISABLED => DI::l10n()->t('No community page'),
|
||||
Community::DISABLED_VISITOR => DI::l10n()->t('No community page for visitors'),
|
||||
Community::LOCAL => DI::l10n()->t('Public postings from users of this site'),
|
||||
Community::GLOBAL => DI::l10n()->t('Public postings from the federated network'),
|
||||
Community::LOCAL_AND_GLOBAL => DI::l10n()->t('Public postings from local users and the federated network')
|
||||
];
|
||||
|
||||
/* get user names to make the install a personal install of X */
|
||||
|
|
|
@ -43,7 +43,7 @@ class Storage extends BaseAdmin
|
|||
/** @var ICanConfigureStorage|false $newStorageConfig */
|
||||
$newStorageConfig = DI::storageManager()->getConfigurationByName($storagebackend);
|
||||
} catch (InvalidClassStorageException $storageException) {
|
||||
notice(DI::l10n()->t('Storage backend, %s is invalid.', $storagebackend));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Storage backend, %s is invalid.', $storagebackend));
|
||||
DI::baseUrl()->redirect('admin/storage');
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ class Storage extends BaseAdmin
|
|||
$storage_form_errors = $newStorageConfig->saveOptions($storage_opts_data);
|
||||
if (count($storage_form_errors)) {
|
||||
foreach ($storage_form_errors as $name => $err) {
|
||||
notice(DI::l10n()->t('Storage backend %s error: %s', $storage_opts[$name][1], $err));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Storage backend %s error: %s', $storage_opts[$name][1], $err));
|
||||
}
|
||||
DI::baseUrl()->redirect('admin/storage');
|
||||
}
|
||||
|
@ -81,10 +81,10 @@ class Storage extends BaseAdmin
|
|||
$newstorage = DI::storageManager()->getWritableStorageByName($storagebackend);
|
||||
|
||||
if (!DI::storageManager()->setBackend($newstorage)) {
|
||||
notice(DI::l10n()->t('Invalid storage backend setting value.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Invalid storage backend setting value.'));
|
||||
}
|
||||
} catch (InvalidClassStorageException $storageException) {
|
||||
notice(DI::l10n()->t('Invalid storage backend setting value.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Invalid storage backend setting value.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace Friendica\Module\Admin;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config\ValueObject\Cache;
|
||||
use Friendica\Core\Logger;
|
||||
|
@ -79,8 +80,8 @@ class Summary extends BaseAdmin
|
|||
// the local version of Friendica. Check is opt-in, source may be stable or develop branch
|
||||
if (DI::config()->get('system', 'check_new_version_url', 'none') != 'none') {
|
||||
$gitversion = DI::config()->get('system', 'git_friendica_version');
|
||||
if (version_compare(FRIENDICA_VERSION, $gitversion) < 0) {
|
||||
$warningtext[] = DI::l10n()->t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s', FRIENDICA_VERSION, $gitversion);
|
||||
if (version_compare(App::VERSION, $gitversion) < 0) {
|
||||
$warningtext[] = DI::l10n()->t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s', App::VERSION, $gitversion);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,9 +237,9 @@ class Summary extends BaseAdmin
|
|||
'$users' => [DI::l10n()->t('Registered users'), $users],
|
||||
'$accounts' => $accounts,
|
||||
'$pending' => [DI::l10n()->t('Pending registrations'), $pending],
|
||||
'$version' => [DI::l10n()->t('Version'), FRIENDICA_VERSION],
|
||||
'$platform' => FRIENDICA_PLATFORM,
|
||||
'$codename' => FRIENDICA_CODENAME,
|
||||
'$version' => [DI::l10n()->t('Version'), App::VERSION],
|
||||
'$platform' => App::PLATFORM,
|
||||
'$codename' => App::CODENAME,
|
||||
'$build' => DI::config()->get('system', 'build'),
|
||||
'$addons' => [DI::l10n()->t('Active addons'), Addon::getEnabledList()],
|
||||
'$serversettings' => $server_settings,
|
||||
|
|
|
@ -36,7 +36,7 @@ class Details extends BaseAdmin
|
|||
|
||||
$theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
|
||||
if (!is_dir("view/theme/$theme")) {
|
||||
notice(DI::l10n()->t("Item not found."));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("Item not found."));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -54,11 +54,11 @@ class Details extends BaseAdmin
|
|||
|
||||
if ($isEnabled) {
|
||||
Theme::uninstall($theme);
|
||||
info(DI::l10n()->t('Theme %s disabled.', $theme));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Theme %s disabled.', $theme));
|
||||
} elseif (Theme::install($theme)) {
|
||||
info(DI::l10n()->t('Theme %s successfully enabled.', $theme));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Theme %s successfully enabled.', $theme));
|
||||
} else {
|
||||
notice(DI::l10n()->t('Theme %s failed to install.', $theme));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Theme %s failed to install.', $theme));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/themes/' . $theme);
|
||||
|
|
|
@ -77,7 +77,7 @@ class Embed extends BaseAdmin
|
|||
|
||||
$theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
|
||||
if (!is_dir("view/theme/$theme")) {
|
||||
notice($this->t('Unknown theme.'));
|
||||
DI::sysmsg()->addNotice($this->t('Unknown theme.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class Index extends BaseAdmin
|
|||
}
|
||||
Theme::setAllowedList($allowed_themes);
|
||||
|
||||
info(DI::l10n()->t('Themes reloaded'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Themes reloaded'));
|
||||
break;
|
||||
|
||||
case 'toggle' :
|
||||
|
@ -56,17 +56,17 @@ class Index extends BaseAdmin
|
|||
if ($theme) {
|
||||
$theme = Strings::sanitizeFilePathItem($theme);
|
||||
if (!is_dir("view/theme/$theme")) {
|
||||
notice(DI::l10n()->t('Item not found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Item not found.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
if (in_array($theme, Theme::getAllowedList())) {
|
||||
Theme::uninstall($theme);
|
||||
info(DI::l10n()->t('Theme %s disabled.', $theme));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Theme %s disabled.', $theme));
|
||||
} elseif (Theme::install($theme)) {
|
||||
info(DI::l10n()->t('Theme %s successfully enabled.', $theme));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Theme %s successfully enabled.', $theme));
|
||||
} else {
|
||||
notice(DI::l10n()->t('Theme %s failed to install.', $theme));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Theme %s failed to install.', $theme));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class Active extends BaseUsers
|
|||
foreach ($users as $uid) {
|
||||
User::block($uid);
|
||||
}
|
||||
info(DI::l10n()->tt('%s user blocked', '%s users blocked', count($users)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user blocked', '%s users blocked', count($users)));
|
||||
}
|
||||
|
||||
if (!empty($_POST['page_users_delete'])) {
|
||||
|
@ -50,11 +50,11 @@ class Active extends BaseUsers
|
|||
if (local_user() != $uid) {
|
||||
User::remove($uid);
|
||||
} else {
|
||||
notice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
}
|
||||
}
|
||||
|
||||
info(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect(DI::args()->getQueryString());
|
||||
|
@ -70,7 +70,7 @@ class Active extends BaseUsers
|
|||
if ($uid) {
|
||||
$user = User::getById($uid, ['username', 'blocked']);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice(DI::l10n()->t('User not found'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User not found'));
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
|
@ -83,9 +83,9 @@ class Active extends BaseUsers
|
|||
// delete user
|
||||
User::remove($uid);
|
||||
|
||||
notice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||
} else {
|
||||
notice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/users/active');
|
||||
|
@ -93,7 +93,7 @@ class Active extends BaseUsers
|
|||
case 'block':
|
||||
self::checkFormSecurityTokenRedirectOnError('admin/users/active', 'admin_users_active', 't');
|
||||
User::block($uid);
|
||||
notice(DI::l10n()->t('User "%s" blocked', $user['username']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" blocked', $user['username']));
|
||||
DI::baseUrl()->redirect('admin/users/active');
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class Blocked extends BaseUsers
|
|||
foreach ($users as $uid) {
|
||||
User::block($uid, false);
|
||||
}
|
||||
info(DI::l10n()->tt('%s user unblocked', '%s users unblocked', count($users)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user unblocked', '%s users unblocked', count($users)));
|
||||
}
|
||||
|
||||
if (!empty($_POST['page_users_delete'])) {
|
||||
|
@ -51,11 +51,11 @@ class Blocked extends BaseUsers
|
|||
if (local_user() != $uid) {
|
||||
User::remove($uid);
|
||||
} else {
|
||||
notice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
}
|
||||
}
|
||||
|
||||
info(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/users/blocked');
|
||||
|
@ -71,7 +71,7 @@ class Blocked extends BaseUsers
|
|||
if ($uid) {
|
||||
$user = User::getById($uid, ['username', 'blocked']);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice(DI::l10n()->t('User not found'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User not found'));
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
|
@ -84,16 +84,16 @@ class Blocked extends BaseUsers
|
|||
// delete user
|
||||
User::remove($uid);
|
||||
|
||||
notice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||
} else {
|
||||
notice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
}
|
||||
DI::baseUrl()->redirect('admin/users/blocked');
|
||||
break;
|
||||
case 'unblock':
|
||||
self::checkFormSecurityTokenRedirectOnError('/admin/users/blocked', 'admin_users_blocked', 't');
|
||||
User::block($uid, false);
|
||||
notice(DI::l10n()->t('User "%s" unblocked', $user['username']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" unblocked', $user['username']));
|
||||
DI::baseUrl()->redirect('admin/users/blocked');
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class Create extends BaseUsers
|
|||
User::createMinimal($nu_name, $nu_email, $nu_nickname, $nu_language);
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
} catch (\Exception $ex) {
|
||||
notice($ex->getMessage());
|
||||
DI::sysmsg()->addNotice($ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,14 +42,14 @@ class Index extends BaseUsers
|
|||
foreach ($users as $uid) {
|
||||
User::block($uid);
|
||||
}
|
||||
info(DI::l10n()->tt('%s user blocked', '%s users blocked', count($users)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user blocked', '%s users blocked', count($users)));
|
||||
}
|
||||
|
||||
if (!empty($_POST['page_users_unblock'])) {
|
||||
foreach ($users as $uid) {
|
||||
User::block($uid, false);
|
||||
}
|
||||
info(DI::l10n()->tt('%s user unblocked', '%s users unblocked', count($users)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user unblocked', '%s users unblocked', count($users)));
|
||||
}
|
||||
|
||||
if (!empty($_POST['page_users_delete'])) {
|
||||
|
@ -57,11 +57,11 @@ class Index extends BaseUsers
|
|||
if (local_user() != $uid) {
|
||||
User::remove($uid);
|
||||
} else {
|
||||
notice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
}
|
||||
}
|
||||
|
||||
info(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect(DI::args()->getQueryString());
|
||||
|
@ -77,7 +77,7 @@ class Index extends BaseUsers
|
|||
if ($uid) {
|
||||
$user = User::getById($uid, ['username', 'blocked']);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice(DI::l10n()->t('User not found'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User not found'));
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
|
@ -90,9 +90,9 @@ class Index extends BaseUsers
|
|||
// delete user
|
||||
User::remove($uid);
|
||||
|
||||
notice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" deleted', $user['username']));
|
||||
} else {
|
||||
notice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You can\'t remove yourself'));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
|
@ -100,13 +100,13 @@ class Index extends BaseUsers
|
|||
case 'block':
|
||||
self::checkFormSecurityTokenRedirectOnError('admin/users', 'admin_users', 't');
|
||||
User::block($uid);
|
||||
notice(DI::l10n()->t('User "%s" blocked', $user['username']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" blocked', $user['username']));
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
break;
|
||||
case 'unblock':
|
||||
self::checkFormSecurityTokenRedirectOnError('admin/users', 'admin_users', 't');
|
||||
User::block($uid, false);
|
||||
notice(DI::l10n()->t('User "%s" unblocked', $user['username']));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User "%s" unblocked', $user['username']));
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -45,14 +45,14 @@ class Pending extends BaseUsers
|
|||
foreach ($pending as $hash) {
|
||||
User::allow($hash);
|
||||
}
|
||||
info(DI::l10n()->tt('%s user approved', '%s users approved', count($pending)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s user approved', '%s users approved', count($pending)));
|
||||
}
|
||||
|
||||
if (!empty($_POST['page_users_deny'])) {
|
||||
foreach ($pending as $hash) {
|
||||
User::deny($hash);
|
||||
}
|
||||
info(DI::l10n()->tt('%s registration revoked', '%s registrations revoked', count($pending)));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%s registration revoked', '%s registrations revoked', count($pending)));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('admin/users/pending');
|
||||
|
@ -68,7 +68,7 @@ class Pending extends BaseUsers
|
|||
if ($uid) {
|
||||
$user = User::getById($uid, ['username', 'blocked']);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice(DI::l10n()->t('User not found'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User not found'));
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
|
@ -78,13 +78,13 @@ class Pending extends BaseUsers
|
|||
case 'allow':
|
||||
self::checkFormSecurityTokenRedirectOnError('/admin/users/pending', 'admin_users_pending', 't');
|
||||
User::allow(Register::getPendingForUser($uid)['hash'] ?? '');
|
||||
notice(DI::l10n()->t('Account approved.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Account approved.'));
|
||||
DI::baseUrl()->redirect('admin/users/pending');
|
||||
break;
|
||||
case 'deny':
|
||||
self::checkFormSecurityTokenRedirectOnError('/admin/users/pending', 'admin_users_pending', 't');
|
||||
User::deny(Register::getPendingForUser($uid)['hash'] ?? '');
|
||||
notice(DI::l10n()->t('Registration revoked'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Registration revoked'));
|
||||
DI::baseUrl()->redirect('admin/users/pending');
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ class Create extends BaseApi
|
|||
$item = ['network' => Protocol::DFRN, 'protocol' => Conversation::PARCEL_DIRECT, 'direction' => Conversation::PUSH];
|
||||
$item = Event::getItemArrayForId($event_id, $item);
|
||||
if (Item::insert($item)) {
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, (int)$item['uri-id'], $uid);
|
||||
Worker::add(Worker::PRIORITY_HIGH, "Notifier", Delivery::POST, (int)$item['uri-id'], $uid);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,9 +53,8 @@ class Config extends BaseApi
|
|||
'sslserver' => null,
|
||||
'ssl' => DI::config()->get('system', 'ssl_policy') == App\BaseURL::SSL_POLICY_FULL ? 'always' : '0',
|
||||
'friendica' => [
|
||||
'FRIENDICA_PLATFORM' => FRIENDICA_PLATFORM,
|
||||
'FRIENDICA_VERSION' => FRIENDICA_VERSION,
|
||||
'DFRN_PROTOCOL_VERSION' => DFRN_PROTOCOL_VERSION,
|
||||
'FRIENDICA_PLATFORM' => App::PLATFORM,
|
||||
'FRIENDICA_VERSION' => App::VERSION,
|
||||
'DB_UPDATE_VERSION' => DB_UPDATE_VERSION,
|
||||
]
|
||||
],
|
||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\App\Router;
|
|||
use Friendica\Content\Text\Markdown;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -204,7 +205,7 @@ class Statuses extends BaseApi
|
|||
if (!empty($request['scheduled_at'])) {
|
||||
$item['guid'] = Item::guid($item, true);
|
||||
$item['uri'] = Item::newURI($item['guid']);
|
||||
$id = Post\Delayed::add($item['uri'], $item, PRIORITY_HIGH, Post\Delayed::PREPARED, $request['scheduled_at']);
|
||||
$id = Post\Delayed::add($item['uri'], $item, Worker::PRIORITY_HIGH, Post\Delayed::PREPARED, $request['scheduled_at']);
|
||||
if (empty($id)) {
|
||||
DI::mstdnError()->InternalError();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Content\Nav;
|
|||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Profiler;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
|
@ -51,7 +52,7 @@ class Apps extends BaseModule
|
|||
$apps = Nav::getAppMenu();
|
||||
|
||||
if (count($apps) == 0) {
|
||||
notice($this->t('No installed applications.'));
|
||||
DI::sysmsg()->addNotice($this->t('No installed applications.'));
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('apps.tpl');
|
||||
|
|
|
@ -54,7 +54,7 @@ abstract class BaseAdmin extends BaseModule
|
|||
{
|
||||
if (!local_user()) {
|
||||
if ($interactive) {
|
||||
notice(DI::l10n()->t('Please login to continue.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Please login to continue.'));
|
||||
Session::set('return_path', DI::args()->getQueryString());
|
||||
DI::baseUrl()->redirect('login');
|
||||
} else {
|
||||
|
|
|
@ -116,7 +116,7 @@ class BaseSearch extends BaseModule
|
|||
protected static function printResult(ResultList $results, Pager $pager, string $header = ''): string
|
||||
{
|
||||
if ($results->getTotal() == 0) {
|
||||
notice(DI::l10n()->t('No matches'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No matches'));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ class Contact extends BaseModule
|
|||
}
|
||||
}
|
||||
if ($count_actions > 0) {
|
||||
info(DI::l10n()->tt('%d contact edited.', '%d contacts edited.', $count_actions));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%d contact edited.', '%d contacts edited.', $count_actions));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect($redirectUrl);
|
||||
|
@ -126,9 +126,9 @@ class Contact extends BaseModule
|
|||
}
|
||||
|
||||
// pull feed and consume it, which should subscribe to the hub.
|
||||
Worker::add(PRIORITY_HIGH, 'OnePoll', $contact_id, 'force');
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'OnePoll', $contact_id, 'force');
|
||||
} else {
|
||||
Worker::add(PRIORITY_HIGH, 'UpdateContact', $contact_id);
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'UpdateContact', $contact_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ use Friendica\Core\Protocol;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Module\Contact;
|
||||
use Friendica\Module\Response;
|
||||
|
@ -96,7 +97,7 @@ class Advanced extends BaseModule
|
|||
}
|
||||
|
||||
if (!$r) {
|
||||
notice($this->t('Contact update failed.'));
|
||||
DI::sysmsg()->addNotice($this->t('Contact update failed.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Module;
|
||||
|
@ -124,7 +125,7 @@ class Profile extends BaseModule
|
|||
}
|
||||
|
||||
if (!Contact::update($fields, ['id' => $cdata['user'], 'uid' => local_user()])) {
|
||||
notice($this->t('Failed to update contact record.'));
|
||||
DI::sysmsg()->addNotice($this->t('Failed to update contact record.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +183,7 @@ class Profile extends BaseModule
|
|||
}
|
||||
|
||||
// @TODO: add $this->localRelationship->save($localRelationship);
|
||||
info($message);
|
||||
DI::sysmsg()->addInfo($message);
|
||||
}
|
||||
|
||||
if ($cmd === 'ignore') {
|
||||
|
@ -198,7 +199,7 @@ class Profile extends BaseModule
|
|||
}
|
||||
|
||||
// @TODO: add $this->localRelationship->save($localRelationship);
|
||||
info($message);
|
||||
DI::sysmsg()->addInfo($message);
|
||||
}
|
||||
|
||||
$this->baseUrl->redirect('contact/' . $contact['id']);
|
||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Module\Contact;
|
||||
use Friendica\Module\Response;
|
||||
|
@ -87,7 +88,7 @@ class Revoke extends BaseModule
|
|||
|
||||
Model\Contact::revokeFollow($this->contact);
|
||||
|
||||
notice($this->t('Follow was successfully revoked.'));
|
||||
DI::sysmsg()->addNotice($this->t('Follow was successfully revoked.'));
|
||||
|
||||
$this->baseUrl->redirect('contact/' . $this->parameters['id']);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,21 @@ use Friendica\Network\HTTPException;
|
|||
|
||||
class Community extends BaseModule
|
||||
{
|
||||
/**
|
||||
* @name CP
|
||||
*
|
||||
* Type of the community page
|
||||
* @{
|
||||
*/
|
||||
const DISABLED = -2;
|
||||
const DISABLED_VISITOR = -1;
|
||||
const LOCAL = 0;
|
||||
const GLOBAL = 1;
|
||||
const LOCAL_AND_GLOBAL = 2;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
protected static $page_style;
|
||||
protected static $content;
|
||||
protected static $accountTypeString;
|
||||
|
@ -69,7 +84,7 @@ class Community extends BaseModule
|
|||
if (empty($_GET['mode']) || ($_GET['mode'] != 'raw')) {
|
||||
$tabs = [];
|
||||
|
||||
if ((Session::isAuthenticated() || in_array(self::$page_style, [CP_USERS_AND_GLOBAL, CP_USERS_ON_SERVER])) && empty(DI::config()->get('system', 'singleuser'))) {
|
||||
if ((Session::isAuthenticated() || in_array(self::$page_style, [self::LOCAL_AND_GLOBAL, self::LOCAL])) && empty(DI::config()->get('system', 'singleuser'))) {
|
||||
$tabs[] = [
|
||||
'label' => DI::l10n()->t('Local Community'),
|
||||
'url' => 'community/local',
|
||||
|
@ -80,7 +95,7 @@ class Community extends BaseModule
|
|||
];
|
||||
}
|
||||
|
||||
if (Session::isAuthenticated() || in_array(self::$page_style, [CP_USERS_AND_GLOBAL, CP_GLOBAL_COMMUNITY])) {
|
||||
if (Session::isAuthenticated() || in_array(self::$page_style, [self::LOCAL_AND_GLOBAL, self::GLOBAL])) {
|
||||
$tabs[] = [
|
||||
'label' => DI::l10n()->t('Global Community'),
|
||||
'url' => 'community/global',
|
||||
|
@ -140,7 +155,7 @@ class Community extends BaseModule
|
|||
$items = self::getItems();
|
||||
|
||||
if (!DBA::isResult($items)) {
|
||||
notice(DI::l10n()->t('No results.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No results.'));
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
@ -177,7 +192,7 @@ class Community extends BaseModule
|
|||
|
||||
self::$page_style = DI::config()->get('system', 'community_page_style');
|
||||
|
||||
if (self::$page_style == CP_NO_INTERNAL_COMMUNITY) {
|
||||
if (self::$page_style == self::DISABLED) {
|
||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
|
||||
}
|
||||
|
||||
|
@ -191,7 +206,7 @@ class Community extends BaseModule
|
|||
self::$content = 'global';
|
||||
} else {
|
||||
// When only the global community is allowed, we use this as default
|
||||
self::$content = self::$page_style == CP_GLOBAL_COMMUNITY ? 'global' : 'local';
|
||||
self::$content = self::$page_style == self::GLOBAL ? 'global' : 'local';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,14 +216,14 @@ class Community extends BaseModule
|
|||
|
||||
// Check if we are allowed to display the content to visitors
|
||||
if (!Session::isAuthenticated()) {
|
||||
$available = self::$page_style == CP_USERS_AND_GLOBAL;
|
||||
$available = self::$page_style == self::LOCAL_AND_GLOBAL;
|
||||
|
||||
if (!$available) {
|
||||
$available = (self::$page_style == CP_USERS_ON_SERVER) && (self::$content == 'local');
|
||||
$available = (self::$page_style == self::LOCAL) && (self::$content == 'local');
|
||||
}
|
||||
|
||||
if (!$available) {
|
||||
$available = (self::$page_style == CP_GLOBAL_COMMUNITY) && (self::$content == 'global');
|
||||
$available = (self::$page_style == self::GLOBAL) && (self::$content == 'global');
|
||||
}
|
||||
|
||||
if (!$available) {
|
||||
|
|
|
@ -170,7 +170,7 @@ class Network extends BaseModule
|
|||
if (self::$groupId) {
|
||||
$group = DBA::selectFirst('group', ['name'], ['id' => self::$groupId, 'uid' => local_user()]);
|
||||
if (!DBA::isResult($group)) {
|
||||
notice(DI::l10n()->t('No such group'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No such group'));
|
||||
}
|
||||
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [
|
||||
|
@ -184,7 +184,7 @@ class Network extends BaseModule
|
|||
'id' => DI::args()->get(0),
|
||||
]) . $o;
|
||||
} else {
|
||||
notice(DI::l10n()->t('Invalid contact.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Invalid contact.'));
|
||||
}
|
||||
} elseif (!DI::config()->get('theme', 'hide_eventlist')) {
|
||||
$o .= Profile::getBirthdays();
|
||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\App;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests;
|
||||
|
@ -48,7 +49,7 @@ class Feed extends BaseModule
|
|||
$this->httpClient = $httpClient;
|
||||
|
||||
if (!local_user()) {
|
||||
notice($this->t('You must be logged in to use this module'));
|
||||
DI::sysmsg()->addNotice($this->t('You must be logged in to use this module'));
|
||||
$baseUrl->redirect();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class Delegation extends BaseModule
|
|||
$ret = [];
|
||||
Hook::callAll('home_init', $ret);
|
||||
|
||||
notice($this->t('You are now logged in as %s', $user['username']));
|
||||
DI::sysmsg()->addNotice($this->t('You are now logged in as %s', $user['username']));
|
||||
|
||||
DI::baseUrl()->redirect('network');
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ class Directory extends BaseModule
|
|||
$profiles = Profile::searchProfiles($pager->getStart(), $pager->getItemsPerPage(), $search);
|
||||
|
||||
if ($profiles['total'] === 0) {
|
||||
notice(DI::l10n()->t('No entries (some entries may be hidden).'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No entries (some entries may be hidden).'));
|
||||
} else {
|
||||
foreach ($profiles['entries'] as $entry) {
|
||||
$contact = Model\Contact::getByURLForUser($entry['url'], local_user());
|
||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
@ -43,7 +44,7 @@ class SaveTag extends BaseModule
|
|||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||
|
||||
if (!local_user()) {
|
||||
notice($this->t('You must be logged in to use this module'));
|
||||
DI::sysmsg()->addNotice($this->t('You must be logged in to use this module'));
|
||||
$baseUrl->redirect();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ class FollowConfirm extends BaseModule
|
|||
parent::post($request);
|
||||
$uid = local_user();
|
||||
if (!$uid) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Core\Protocol;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact as ContactModel;
|
||||
use Friendica\Network\HTTPException\ForbiddenException;
|
||||
use Friendica\Network\HTTPException\NotFoundException;
|
||||
|
@ -78,7 +79,7 @@ class FriendSuggest extends BaseModule
|
|||
// We do query the "uid" as well to ensure that it is our contact
|
||||
$contact = $this->dba->selectFirst('contact', ['name', 'url', 'request', 'avatar'], ['id' => $suggest_contact_id, 'uid' => local_user()]);
|
||||
if (empty($contact)) {
|
||||
notice($this->t('Suggested contact not found.'));
|
||||
DI::sysmsg()->addNotice($this->t('Suggested contact not found.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -94,9 +95,9 @@ class FriendSuggest extends BaseModule
|
|||
$note
|
||||
));
|
||||
|
||||
Worker::add(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
|
||||
|
@ -105,7 +106,7 @@ class FriendSuggest extends BaseModule
|
|||
|
||||
$contact = $this->dba->selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
|
||||
if (empty($contact)) {
|
||||
notice($this->t('Contact not found.'));
|
||||
DI::sysmsg()->addNotice($this->t('Contact not found.'));
|
||||
$this->baseUrl->redirect();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Hook;
|
||||
|
@ -96,7 +97,7 @@ class Friendica extends BaseModule
|
|||
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'about' => DI::l10n()->t('This is Friendica, version %s that is running at the web location %s. The database version is %s, the post update version is %s.',
|
||||
'<strong>' . FRIENDICA_VERSION . '</strong>',
|
||||
'<strong>' . App::VERSION . '</strong>',
|
||||
DI::baseUrl()->get(),
|
||||
'<strong>' . $config->get('system', 'build') . '/' . DB_UPDATE_VERSION . '</strong>',
|
||||
'<strong>' . $config->get('system', 'post_update_version') . '/' . PostUpdate::VERSION . '</strong>'),
|
||||
|
@ -169,7 +170,7 @@ class Friendica extends BaseModule
|
|||
}
|
||||
|
||||
$data = [
|
||||
'version' => FRIENDICA_VERSION,
|
||||
'version' => App::VERSION,
|
||||
'url' => DI::baseUrl()->get(),
|
||||
'addons' => $visible_addons,
|
||||
'locked_features' => $locked_features,
|
||||
|
@ -178,7 +179,7 @@ class Friendica extends BaseModule
|
|||
'register_policy' => $register_policy,
|
||||
'admin' => $admin,
|
||||
'site_name' => $config->get('config', 'sitename'),
|
||||
'platform' => strtolower(FRIENDICA_PLATFORM),
|
||||
'platform' => strtolower(App::PLATFORM),
|
||||
'info' => $config->get('config', 'info'),
|
||||
'no_scrape_url' => DI::baseUrl()->get() . '/noscrape',
|
||||
];
|
||||
|
|
|
@ -39,7 +39,7 @@ class Group extends BaseModule
|
|||
}
|
||||
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ class Group extends BaseModule
|
|||
DI::baseUrl()->redirect('group/' . $r);
|
||||
}
|
||||
} else {
|
||||
notice(DI::l10n()->t('Could not create group.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Could not create group.'));
|
||||
}
|
||||
DI::baseUrl()->redirect('group');
|
||||
}
|
||||
|
@ -66,13 +66,13 @@ class Group extends BaseModule
|
|||
|
||||
$group = DBA::selectFirst('group', ['id', 'name'], ['id' => DI::args()->getArgv()[1], 'uid' => local_user()]);
|
||||
if (!DBA::isResult($group)) {
|
||||
notice(DI::l10n()->t('Group not found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Group not found.'));
|
||||
DI::baseUrl()->redirect('contact');
|
||||
}
|
||||
$groupname = trim($_POST['groupname']);
|
||||
if (strlen($groupname) && ($groupname != $group['name'])) {
|
||||
if (!Model\Group::update($group['id'], $groupname)) {
|
||||
notice(DI::l10n()->t('Group name was not changed.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Group name was not changed.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,10 +132,10 @@ class Group extends BaseModule
|
|||
throw new \Exception(DI::l10n()->t('Bad request.'), 400);
|
||||
}
|
||||
|
||||
info($message);
|
||||
DI::sysmsg()->addInfo($message);
|
||||
System::jsonExit(['status' => 'OK', 'message' => $message]);
|
||||
} catch (\Exception $e) {
|
||||
notice($e->getMessage());
|
||||
DI::sysmsg()->addNotice($e->getMessage());
|
||||
System::jsonError($e->getCode(), ['status' => 'error', 'message' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
@ -212,12 +212,12 @@ class Group extends BaseModule
|
|||
// @TODO: Replace with parameter from router
|
||||
if (intval(DI::args()->getArgv()[2])) {
|
||||
if (!Model\Group::exists(DI::args()->getArgv()[2], local_user())) {
|
||||
notice(DI::l10n()->t('Group not found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Group not found.'));
|
||||
DI::baseUrl()->redirect('contact');
|
||||
}
|
||||
|
||||
if (!Model\Group::remove(DI::args()->getArgv()[2])) {
|
||||
notice(DI::l10n()->t('Unable to remove group.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to remove group.'));
|
||||
}
|
||||
}
|
||||
DI::baseUrl()->redirect('group');
|
||||
|
@ -236,7 +236,7 @@ class Group extends BaseModule
|
|||
if ((DI::args()->getArgc() > 1) && intval(DI::args()->getArgv()[1])) {
|
||||
$group = DBA::selectFirst('group', ['id', 'name'], ['id' => DI::args()->getArgv()[1], 'uid' => local_user(), 'deleted' => false]);
|
||||
if (!DBA::isResult($group)) {
|
||||
notice(DI::l10n()->t('Group not found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Group not found.'));
|
||||
DI::baseUrl()->redirect('contact');
|
||||
}
|
||||
|
||||
|
|
|
@ -337,7 +337,7 @@ class Install extends BaseModule
|
|||
|
||||
if (count($this->installer->getChecks()) == 0) {
|
||||
$txt = '<p style="font-size: 130%;">';
|
||||
$txt .= $this->t('Your Friendica site database has been installed.') . EOL;
|
||||
$txt .= $this->t('Your Friendica site database has been installed.') . '<br />';
|
||||
$db_return_text .= $txt;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class Invite extends BaseModule
|
|||
$recipient = trim($recipient);
|
||||
|
||||
if (!filter_var($recipient, FILTER_VALIDATE_EMAIL)) {
|
||||
notice(DI::l10n()->t('%s : Not a valid email address.', $recipient));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('%s : Not a valid email address.', $recipient));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -114,15 +114,15 @@ class Invite extends BaseModule
|
|||
$current_invites++;
|
||||
DI::pConfig()->set(local_user(), 'system', 'sent_invites', $current_invites);
|
||||
if ($current_invites > $max_invites) {
|
||||
notice(DI::l10n()->t('Invitation limit exceeded. Please contact your site administrator.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Invitation limit exceeded. Please contact your site administrator.'));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
notice(DI::l10n()->t('%s : Message delivery failed.', $recipient));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('%s : Message delivery failed.', $recipient));
|
||||
}
|
||||
|
||||
}
|
||||
info(DI::l10n()->tt('%d message sent.', '%d messages sent.', $total));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->tt('%d message sent.', '%d messages sent.', $total));
|
||||
}
|
||||
|
||||
protected function content(array $request = []): string
|
||||
|
|
|
@ -22,10 +22,14 @@
|
|||
namespace Friendica\Module\Item;
|
||||
|
||||
use DateTime;
|
||||
use Friendica\App;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Theme;
|
||||
use Friendica\Database\DBA;
|
||||
|
@ -33,13 +37,44 @@ use Friendica\DI;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Module\Security\Login;
|
||||
use Friendica\Navigation\SystemMessages;
|
||||
use Friendica\Network\HTTPException\NotImplementedException;
|
||||
use Friendica\Util\ACLFormatter;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\Profiler;
|
||||
use Friendica\Util\Temporal;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Compose extends BaseModule
|
||||
{
|
||||
/** @var SystemMessages */
|
||||
private $systemMessages;
|
||||
|
||||
/** @var ACLFormatter */
|
||||
private $ACLFormatter;
|
||||
|
||||
/** @var App\Page */
|
||||
private $page;
|
||||
|
||||
/** @var IManagePersonalConfigValues */
|
||||
private $pConfig;
|
||||
|
||||
/** @var IManageConfigValues */
|
||||
private $config;
|
||||
|
||||
public function __construct(IManageConfigValues $config, IManagePersonalConfigValues $pConfig, App\Page $page, ACLFormatter $ACLFormatter, SystemMessages $systemMessages, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
|
||||
{
|
||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||
|
||||
$this->systemMessages = $systemMessages;
|
||||
$this->ACLFormatter = $ACLFormatter;
|
||||
$this->page = $page;
|
||||
$this->pConfig = $pConfig;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
if (!empty($_REQUEST['body'])) {
|
||||
|
@ -47,23 +82,22 @@ class Compose extends BaseModule
|
|||
require_once 'mod/item.php';
|
||||
item_post(DI::app());
|
||||
} else {
|
||||
notice(DI::l10n()->t('Please enter a post body.'));
|
||||
$this->systemMessages->addNotice($this->l10n->t('Please enter a post body.'));
|
||||
}
|
||||
}
|
||||
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
if (!local_user()) {
|
||||
return Login::form('compose', false);
|
||||
return Login::form('compose');
|
||||
}
|
||||
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->getCurrentTheme() !== 'frio') {
|
||||
throw new NotImplementedException(DI::l10n()->t('This feature is only available with the frio theme.'));
|
||||
throw new NotImplementedException($this->l10n->t('This feature is only available with the frio theme.'));
|
||||
}
|
||||
|
||||
/// @TODO Retrieve parameter from router
|
||||
$posttype = $this->parameters['type'] ?? Item::PT_ARTICLE;
|
||||
if (!in_array($posttype, [Item::PT_ARTICLE, Item::PT_PERSONAL_NOTE])) {
|
||||
switch ($posttype) {
|
||||
|
@ -78,16 +112,14 @@ class Compose extends BaseModule
|
|||
|
||||
$user = User::getById(local_user(), ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'default-location']);
|
||||
|
||||
$aclFormatter = DI::aclFormatter();
|
||||
|
||||
$contact_allow_list = $aclFormatter->expand($user['allow_cid']);
|
||||
$group_allow_list = $aclFormatter->expand($user['allow_gid']);
|
||||
$contact_deny_list = $aclFormatter->expand($user['deny_cid']);
|
||||
$group_deny_list = $aclFormatter->expand($user['deny_gid']);
|
||||
$contact_allow_list = $this->ACLFormatter->expand($user['allow_cid']);
|
||||
$group_allow_list = $this->ACLFormatter->expand($user['allow_gid']);
|
||||
$contact_deny_list = $this->ACLFormatter->expand($user['deny_cid']);
|
||||
$group_deny_list = $this->ACLFormatter->expand($user['deny_gid']);
|
||||
|
||||
switch ($posttype) {
|
||||
case Item::PT_PERSONAL_NOTE:
|
||||
$compose_title = DI::l10n()->t('Compose new personal note');
|
||||
$compose_title = $this->l10n->t('Compose new personal note');
|
||||
$type = 'note';
|
||||
$doesFederate = false;
|
||||
$contact_allow_list = [$a->getContactId()];
|
||||
|
@ -96,7 +128,7 @@ class Compose extends BaseModule
|
|||
$group_deny_list = [];
|
||||
break;
|
||||
default:
|
||||
$compose_title = DI::l10n()->t('Compose new post');
|
||||
$compose_title = $this->l10n->t('Compose new post');
|
||||
$type = 'post';
|
||||
$doesFederate = true;
|
||||
|
||||
|
@ -129,13 +161,13 @@ class Compose extends BaseModule
|
|||
Hook::callAll('jot_tool', $jotplugins);
|
||||
|
||||
// Output
|
||||
DI::page()->registerFooterScript(Theme::getPathForFile('js/ajaxupload.js'));
|
||||
DI::page()->registerFooterScript(Theme::getPathForFile('js/linkPreview.js'));
|
||||
DI::page()->registerFooterScript(Theme::getPathForFile('js/compose.js'));
|
||||
$this->page->registerFooterScript(Theme::getPathForFile('js/ajaxupload.js'));
|
||||
$this->page->registerFooterScript(Theme::getPathForFile('js/linkPreview.js'));
|
||||
$this->page->registerFooterScript(Theme::getPathForFile('js/compose.js'));
|
||||
|
||||
$contact = Contact::getById($a->getContactId());
|
||||
|
||||
if (DI::config()->get(local_user(), 'system', 'set_creation_date')) {
|
||||
if ($this->pConfig->get(local_user(), 'system', 'set_creation_date')) {
|
||||
$created_at = Temporal::getDateTimeField(
|
||||
new \DateTime(DBA::NULL_DATETIME),
|
||||
new \DateTime('now'),
|
||||
|
@ -149,39 +181,45 @@ class Compose extends BaseModule
|
|||
|
||||
$tpl = Renderer::getMarkupTemplate('item/compose.tpl');
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'$compose_title'=> $compose_title,
|
||||
'$visibility_title'=> DI::l10n()->t('Visibility'),
|
||||
'$l10n' => [
|
||||
'compose_title' => $compose_title,
|
||||
'default' => '',
|
||||
'visibility_title' => $this->l10n->t('Visibility'),
|
||||
'mytitle' => $this->l10n->t('This is you'),
|
||||
'submit' => $this->l10n->t('Submit'),
|
||||
'edbold' => $this->l10n->t('Bold'),
|
||||
'editalic' => $this->l10n->t('Italic'),
|
||||
'eduline' => $this->l10n->t('Underline'),
|
||||
'edquote' => $this->l10n->t('Quote'),
|
||||
'edcode' => $this->l10n->t('Code'),
|
||||
'edimg' => $this->l10n->t('Image'),
|
||||
'edurl' => $this->l10n->t('Link'),
|
||||
'edattach' => $this->l10n->t('Link or Media'),
|
||||
'prompttext' => $this->l10n->t('Please enter a image/video/audio/webpage URL:'),
|
||||
'preview' => $this->l10n->t('Preview'),
|
||||
'location_set' => $this->l10n->t('Set your location'),
|
||||
'location_clear' => $this->l10n->t('Clear the location'),
|
||||
'location_unavailable' => $this->l10n->t('Location services are unavailable on your device'),
|
||||
'location_disabled' => $this->l10n->t('Location services are disabled. Please check the website\'s permissions on your device'),
|
||||
'wait' => $this->l10n->t('Please wait'),
|
||||
'placeholdertitle' => $this->l10n->t('Set title'),
|
||||
'placeholdercategory' => Feature::isEnabled(local_user(),'categories') ? $this->l10n->t('Categories (comma-separated list)') : '',
|
||||
'always_open_compose' => $this->pConfig->get(local_user(), 'frio', 'always_open_compose',
|
||||
$this->config->get('frio', 'always_open_compose', false)) ? '' :
|
||||
$this->l10n->t('You can make this page always open when you use the New Post button in the <a href="/settings/display">Theme Customization settings</a>.'),
|
||||
],
|
||||
|
||||
'$id' => 0,
|
||||
'$posttype' => $posttype,
|
||||
'$type' => $type,
|
||||
'$wall' => $wall,
|
||||
'$default' => '',
|
||||
'$mylink' => DI::baseUrl()->remove($contact['url']),
|
||||
'$mytitle' => DI::l10n()->t('This is you'),
|
||||
'$myphoto' => DI::baseUrl()->remove($contact['thumb']),
|
||||
'$submit' => DI::l10n()->t('Submit'),
|
||||
'$edbold' => DI::l10n()->t('Bold'),
|
||||
'$editalic' => DI::l10n()->t('Italic'),
|
||||
'$eduline' => DI::l10n()->t('Underline'),
|
||||
'$edquote' => DI::l10n()->t('Quote'),
|
||||
'$edcode' => DI::l10n()->t('Code'),
|
||||
'$edimg' => DI::l10n()->t('Image'),
|
||||
'$edurl' => DI::l10n()->t('Link'),
|
||||
'$edattach' => DI::l10n()->t('Link or Media'),
|
||||
'$prompttext' => DI::l10n()->t('Please enter a image/video/audio/webpage URL:'),
|
||||
'$preview' => DI::l10n()->t('Preview'),
|
||||
'$location_set' => DI::l10n()->t('Set your location'),
|
||||
'$location_clear' => DI::l10n()->t('Clear the location'),
|
||||
'$location_unavailable' => DI::l10n()->t('Location services are unavailable on your device'),
|
||||
'$location_disabled' => DI::l10n()->t('Location services are disabled. Please check the website\'s permissions on your device'),
|
||||
'$wait' => DI::l10n()->t('Please wait'),
|
||||
'$placeholdertitle' => DI::l10n()->t('Set title'),
|
||||
'$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? DI::l10n()->t('Categories (comma-separated list)') : ''),
|
||||
'$mylink' => $this->baseUrl->remove($contact['url']),
|
||||
'$myphoto' => $this->baseUrl->remove($contact['thumb']),
|
||||
'$scheduled_at' => Temporal::getDateTimeField(
|
||||
new DateTime(),
|
||||
new DateTime('now + 6 months'),
|
||||
null,
|
||||
DI::l10n()->t('Scheduled at'),
|
||||
$this->l10n->t('Scheduled at'),
|
||||
'scheduled_at'
|
||||
),
|
||||
'$created_at' => $created_at,
|
||||
|
@ -197,7 +235,7 @@ class Compose extends BaseModule
|
|||
|
||||
'$jotplugins' => $jotplugins,
|
||||
'$rand_num' => Crypto::randomDigits(12),
|
||||
'$acl_selector' => ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId(), $doesFederate, [
|
||||
'$acl_selector' => ACL::getFullSelectorHTML($this->page, $a->getLoggedInUserId(), $doesFederate, [
|
||||
'allow_cid' => $contact_allow_list,
|
||||
'allow_gid' => $group_allow_list,
|
||||
'deny_cid' => $contact_deny_list,
|
||||
|
|
|
@ -53,7 +53,7 @@ class NodeInfo110 extends BaseModule
|
|||
'version' => '1.0',
|
||||
'software' => [
|
||||
'name' => 'friendica',
|
||||
'version' => FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
|
||||
'version' => App::VERSION . '-' . DB_UPDATE_VERSION,
|
||||
],
|
||||
'protocols' => [
|
||||
'inbound' => [
|
||||
|
|
|
@ -53,7 +53,7 @@ class NodeInfo120 extends BaseModule
|
|||
'version' => '2.0',
|
||||
'software' => [
|
||||
'name' => 'friendica',
|
||||
'version' => FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
|
||||
'version' => App::VERSION . '-' . DB_UPDATE_VERSION,
|
||||
],
|
||||
'protocols' => ['dfrn', 'activitypub'],
|
||||
'services' => Nodeinfo::getServices(),
|
||||
|
|
|
@ -55,7 +55,7 @@ class NodeInfo210 extends BaseModule
|
|||
'baseUrl' => $this->baseUrl->get(),
|
||||
'name' => $this->config->get('config', 'sitename'),
|
||||
'software' => 'friendica',
|
||||
'version' => FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
|
||||
'version' => App::VERSION . '-' . DB_UPDATE_VERSION,
|
||||
],
|
||||
'organization' => Nodeinfo::getOrganization($this->config),
|
||||
'protocols' => ['dfrn', 'activitypub'],
|
||||
|
|
|
@ -30,6 +30,7 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\BaseNotifications;
|
||||
use Friendica\Module\Response;
|
||||
|
@ -211,7 +212,7 @@ class Introductions extends BaseNotifications
|
|||
}
|
||||
|
||||
if (count($notifications['notifications']) == 0) {
|
||||
notice($this->t('No introductions.'));
|
||||
DI::sysmsg()->addNotice($this->t('No introductions.'));
|
||||
$notificationNoContent = $this->t('No more %s notifications.', $notifications['ident']);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ use Friendica\Contact\Introduction\Repository\Introduction;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Module\Security\Login;
|
||||
|
@ -131,7 +132,7 @@ class Notification extends BaseModule
|
|||
protected function content(array $request = []): string
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice($this->l10n->t('You must be logged in to show this page.'));
|
||||
DI::sysmsg()->addNotice($this->l10n->t('You must be logged in to show this page.'));
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
|
|
|
@ -338,7 +338,7 @@ class Photo extends BaseModule
|
|||
}
|
||||
if ($update) {
|
||||
Logger::info('Invalid file, contact update initiated', ['cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
|
||||
Worker::add(PRIORITY_LOW, 'UpdateContact', $id);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'UpdateContact', $id);
|
||||
} else {
|
||||
Logger::info('Invalid file', ['cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ class Profile extends BaseProfile
|
|||
$o = self::getTabsHTML($a, 'profile', $is_owner, $profile['nickname'], $profile['hide-friends']);
|
||||
|
||||
if (!empty($profile['hidewall']) && !$is_owner && !$remote_contact_id) {
|
||||
notice(DI::l10n()->t('Access to this profile has been restricted.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Access to this profile has been restricted.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ class Status extends BaseProfile
|
|||
$last_updated_key = "profile:" . $profile['uid'] . ":" . local_user() . ":" . $remote_contact;
|
||||
|
||||
if (!empty($profile['hidewall']) && !$is_owner && !$remote_contact) {
|
||||
notice(DI::l10n()->t('Access to this profile has been restricted.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Access to this profile has been restricted.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
@ -74,20 +74,20 @@ class Register extends BaseModule
|
|||
$block = DI::config()->get('system', 'block_extended_register');
|
||||
|
||||
if (local_user() && $block) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
if (local_user()) {
|
||||
$user = DBA::selectFirst('user', ['parent-uid'], ['uid' => local_user()]);
|
||||
if (!empty($user['parent-uid'])) {
|
||||
notice(DI::l10n()->t('Only parent users can create additional accounts.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Only parent users can create additional accounts.'));
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
if (!local_user() && (intval(DI::config()->get('config', 'register_policy')) === self::CLOSED)) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ class Register extends BaseModule
|
|||
$count = DBA::count('user', ['`register_date` > UTC_TIMESTAMP - INTERVAL 1 day']);
|
||||
if ($count >= $max_dailies) {
|
||||
Logger::notice('max daily registrations exceeded.');
|
||||
notice(DI::l10n()->t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.'));
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@ -203,19 +203,19 @@ class Register extends BaseModule
|
|||
$additional_account = false;
|
||||
|
||||
if (!local_user() && !empty($arr['post']['parent_password'])) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
} elseif (local_user() && !empty($arr['post']['parent_password'])) {
|
||||
try {
|
||||
Model\User::getIdFromPasswordAuthentication(local_user(), $arr['post']['parent_password']);
|
||||
} catch (\Exception $ex) {
|
||||
notice(DI::l10n()->t("Password doesn't match."));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t("Password doesn't match."));
|
||||
$regdata = ['nickname' => $arr['post']['nickname'], 'username' => $arr['post']['username']];
|
||||
DI::baseUrl()->redirect('register?' . http_build_query($regdata));
|
||||
}
|
||||
$additional_account = true;
|
||||
} elseif (local_user()) {
|
||||
notice(DI::l10n()->t('Please enter your password.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Please enter your password.'));
|
||||
$regdata = ['nickname' => $arr['post']['nickname'], 'username' => $arr['post']['username']];
|
||||
DI::baseUrl()->redirect('register?' . http_build_query($regdata));
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ class Register extends BaseModule
|
|||
case self::CLOSED:
|
||||
default:
|
||||
if (empty($_SESSION['authenticated']) && empty($_SESSION['administrator'])) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
$blocked = 1;
|
||||
|
@ -257,14 +257,14 @@ class Register extends BaseModule
|
|||
// Is there text in the tar pit?
|
||||
if (!empty($arr['email'])) {
|
||||
Logger::info('Tar pit', $arr);
|
||||
notice(DI::l10n()->t('You have entered too much information.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You have entered too much information.'));
|
||||
DI::baseUrl()->redirect('register/');
|
||||
}
|
||||
|
||||
if ($additional_account) {
|
||||
$user = DBA::selectFirst('user', ['email'], ['uid' => local_user()]);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice(DI::l10n()->t('User not found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('User not found.'));
|
||||
DI::baseUrl()->redirect('register');
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ class Register extends BaseModule
|
|||
|
||||
if ($arr['email'] != $arr['repeat']) {
|
||||
Logger::info('Mail mismatch', $arr);
|
||||
notice(DI::l10n()->t('Please enter the identical mail address in the second field.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Please enter the identical mail address in the second field.'));
|
||||
$regdata = ['email' => $arr['email'], 'nickname' => $arr['nickname'], 'username' => $arr['username']];
|
||||
DI::baseUrl()->redirect('register?' . http_build_query($regdata));
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ class Register extends BaseModule
|
|||
try {
|
||||
$result = Model\User::create($arr);
|
||||
} catch (\Exception $e) {
|
||||
notice($e->getMessage());
|
||||
DI::sysmsg()->addNotice($e->getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -302,12 +302,12 @@ class Register extends BaseModule
|
|||
|
||||
if ($netpublish && intval(DI::config()->get('config', 'register_policy')) !== self::APPROVE) {
|
||||
$url = $base_url . '/profile/' . $user['nickname'];
|
||||
Worker::add(PRIORITY_LOW, 'Directory', $url);
|
||||
Worker::add(Worker::PRIORITY_LOW, 'Directory', $url);
|
||||
}
|
||||
|
||||
if ($additional_account) {
|
||||
DBA::update('user', ['parent-uid' => local_user()], ['uid' => $user['uid']]);
|
||||
info(DI::l10n()->t('The additional account was created.'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('The additional account was created.'));
|
||||
DI::baseUrl()->redirect('delegation');
|
||||
}
|
||||
|
||||
|
@ -332,28 +332,28 @@ class Register extends BaseModule
|
|||
);
|
||||
|
||||
if ($res) {
|
||||
info(DI::l10n()->t('Registration successful. Please check your email for further instructions.'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Registration successful. Please check your email for further instructions.'));
|
||||
DI::baseUrl()->redirect();
|
||||
} else {
|
||||
notice(
|
||||
DI::sysmsg()->addNotice(
|
||||
DI::l10n()->t('Failed to send email message. Here your accout details:<br> login: %s<br> password: %s<br><br>You can change your password after login.',
|
||||
$user['email'],
|
||||
$result['password'])
|
||||
);
|
||||
}
|
||||
} else {
|
||||
info(DI::l10n()->t('Registration successful.'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Registration successful.'));
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
} elseif (intval(DI::config()->get('config', 'register_policy')) === self::APPROVE) {
|
||||
if (!strlen(DI::config()->get('config', 'admin_email'))) {
|
||||
notice(DI::l10n()->t('Your registration can not be processed.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Your registration can not be processed.'));
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
// Check if the note to the admin is actually filled out
|
||||
if (empty($_POST['permonlybox'])) {
|
||||
notice(DI::l10n()->t('You have to leave a request note for the admin.')
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You have to leave a request note for the admin.')
|
||||
. DI::l10n()->t('Your registration can not be processed.'));
|
||||
|
||||
DI::baseUrl()->redirect('register/');
|
||||
|
@ -399,7 +399,7 @@ class Register extends BaseModule
|
|||
$result['password']
|
||||
);
|
||||
|
||||
info(DI::l10n()->t('Your registration is pending approval by the site owner.'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Your registration is pending approval by the site owner.'));
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ use Friendica\Core\Protocol;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Search;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\User;
|
||||
|
@ -68,25 +69,25 @@ class RemoteFollow extends BaseModule
|
|||
}
|
||||
|
||||
if (empty($this->owner)) {
|
||||
notice($this->t('Profile unavailable.'));
|
||||
DI::sysmsg()->addNotice($this->t('Profile unavailable.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$url = Probe::cleanURI($_POST['dfrn_url']);
|
||||
if (!strlen($url)) {
|
||||
notice($this->t("Invalid locator"));
|
||||
DI::sysmsg()->addNotice($this->t("Invalid locator"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Detect the network, make sure the provided URL is valid
|
||||
$data = Contact::getByURL($url);
|
||||
if (!$data) {
|
||||
notice($this->t("The provided profile link doesn't seem to be valid"));
|
||||
DI::sysmsg()->addNotice($this->t("The provided profile link doesn't seem to be valid"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($data['subscribe'])) {
|
||||
notice($this->t("Remote subscription can't be done for your network. Please subscribe directly on your system."));
|
||||
DI::sysmsg()->addNotice($this->t("Remote subscription can't be done for your network. Please subscribe directly on your system."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class Directory extends BaseSearch
|
|||
protected function content(array $request = []): string
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('Permission denied.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ class Index extends BaseSearch
|
|||
// Tags don't look like an URL and the fulltext search does only work with natural words
|
||||
if (parse_url($search, PHP_URL_SCHEME) && parse_url($search, PHP_URL_HOST)) {
|
||||
Logger::info('Skipping tag and fulltext search since the search looks like a URL.', ['q' => $search]);
|
||||
notice(DI::l10n()->t('No results.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No results.'));
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ class Index extends BaseSearch
|
|||
|
||||
if (empty($items)) {
|
||||
if (empty($last_uriid)) {
|
||||
notice(DI::l10n()->t('No results.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No results.'));
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Search;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Util\Profiler;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
@ -55,16 +56,16 @@ class Saved extends BaseModule
|
|||
$fields = ['uid' => local_user(), 'term' => $search];
|
||||
if (!$this->dba->exists('search', $fields)) {
|
||||
if (!$this->dba->insert('search', $fields)) {
|
||||
notice($this->t('Search term was not saved.'));
|
||||
DI::sysmsg()->addNotice($this->t('Search term was not saved.'));
|
||||
}
|
||||
} else {
|
||||
notice($this->t('Search term already saved.'));
|
||||
DI::sysmsg()->addNotice($this->t('Search term already saved.'));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'remove':
|
||||
if (!$this->dba->delete('search', ['uid' => local_user(), 'term' => $search])) {
|
||||
notice($this->t('Search term was not removed.'));
|
||||
DI::sysmsg()->addNotice($this->t('Search term was not removed.'));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Session\Capability\IHandleSessions;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\User\Cookie;
|
||||
use Friendica\Module\Response;
|
||||
|
@ -80,7 +81,7 @@ class Logout extends BaseModule
|
|||
if ($visitor_home) {
|
||||
System::externalRedirect($visitor_home);
|
||||
} else {
|
||||
info($this->t('Logged out.'));
|
||||
DI::sysmsg()->addInfo($this->t('Logged out.'));
|
||||
$this->baseUrl->redirect();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,9 +87,9 @@ class OpenID extends BaseModule
|
|||
$session->set('openid_server', $open_id_obj->discover($open_id_obj->identity));
|
||||
|
||||
if (intval(DI::config()->get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED) {
|
||||
notice($l10n->t('Account not found. Please login to your existing account to add the OpenID to it.'));
|
||||
DI::sysmsg()->addNotice($l10n->t('Account not found. Please login to your existing account to add the OpenID to it.'));
|
||||
} else {
|
||||
notice($l10n->t('Account not found. Please register a new account or login to your existing account to add the OpenID to it.'));
|
||||
DI::sysmsg()->addNotice($l10n->t('Account not found. Please register a new account or login to your existing account to add the OpenID to it.'));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('login');
|
||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session\Capability\IHandleSessions;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Security\Authentication;
|
||||
|
@ -70,13 +71,13 @@ class Recovery extends BaseModule
|
|||
if (RecoveryCode::existsForUser(local_user(), $recovery_code)) {
|
||||
RecoveryCode::markUsedForUser(local_user(), $recovery_code);
|
||||
$this->session->set('2fa', true);
|
||||
info($this->t('Remaining recovery codes: %d', RecoveryCode::countValidForUser(local_user())));
|
||||
DI::sysmsg()->addInfo($this->t('Remaining recovery codes: %d', RecoveryCode::countValidForUser(local_user())));
|
||||
|
||||
$this->auth->setForUser($this->app, User::getById($this->app->getLoggedInUserId()), true, true);
|
||||
|
||||
$this->baseUrl->redirect($this->session->pop('return_path', ''));
|
||||
} else {
|
||||
notice($this->t('Invalid code, please retry.'));
|
||||
DI::sysmsg()->addNotice($this->t('Invalid code, please retry.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session\Capability\IHandleSessions;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User\Cookie;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Network\HTTPException\NotFoundException;
|
||||
|
@ -75,7 +76,7 @@ class SignOut extends BaseModule
|
|||
$this->cookie->reset(['2fa_cookie_hash' => $trusted]);
|
||||
$this->session->clear();
|
||||
|
||||
info($this->t('Logged out.'));
|
||||
DI::sysmsg()->addInfo($this->t('Logged out.'));
|
||||
$this->baseUrl->redirect();
|
||||
break;
|
||||
case 'sign_out':
|
||||
|
@ -83,7 +84,7 @@ class SignOut extends BaseModule
|
|||
$this->cookie->clear();
|
||||
$this->session->clear();
|
||||
|
||||
info($this->t('Logged out.'));
|
||||
DI::sysmsg()->addInfo($this->t('Logged out.'));
|
||||
$this->baseUrl->redirect();
|
||||
break;
|
||||
default:
|
||||
|
@ -105,14 +106,14 @@ class SignOut extends BaseModule
|
|||
$this->cookie->reset(['2fa_cookie_hash' => $trusted]);
|
||||
$this->session->clear();
|
||||
|
||||
info($this->t('Logged out.'));
|
||||
DI::sysmsg()->addInfo($this->t('Logged out.'));
|
||||
$this->baseUrl->redirect();
|
||||
}
|
||||
} catch (TwoFactor\Exception\TrustedBrowserNotFoundException $exception) {
|
||||
$this->cookie->clear();
|
||||
$this->session->clear();
|
||||
|
||||
info($this->t('Logged out.'));
|
||||
DI::sysmsg()->addInfo($this->t('Logged out.'));
|
||||
$this->baseUrl->redirect();
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session\Capability\IHandleSessions;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Model\User\Cookie;
|
||||
use Friendica\Module\Response;
|
||||
|
@ -92,7 +93,7 @@ class Trust extends BaseModule
|
|||
|
||||
// The string is sent to the browser to be sent back with each request
|
||||
if (!$this->cookie->set('2fa_cookie_hash', $trustedBrowser->cookie_hash)) {
|
||||
notice($this->t('Couldn\'t save browser to Cookie.'));
|
||||
DI::sysmsg()->addNotice($this->t('Couldn\'t save browser to Cookie.'));
|
||||
};
|
||||
} catch (TrustedBrowserPersistenceException $exception) {
|
||||
$this->logger->warning('Unexpected error when saving the trusted browser.', ['trustedBrowser' => $trustedBrowser, 'exception' => $exception]);
|
||||
|
|
|
@ -75,10 +75,10 @@ class Account extends BaseSettings
|
|||
throw new Exception(DI::l10n()->t('Password update failed. Please try again.'));
|
||||
}
|
||||
|
||||
info(DI::l10n()->t('Password changed.'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Password changed.'));
|
||||
} catch (Exception $e) {
|
||||
notice($e->getMessage());
|
||||
notice(DI::l10n()->t('Password unchanged.'));
|
||||
DI::sysmsg()->addNotice($e->getMessage());
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Password unchanged.'));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect($redirectUrl);
|
||||
|
@ -123,7 +123,7 @@ class Account extends BaseSettings
|
|||
}
|
||||
|
||||
if (strlen($err)) {
|
||||
notice($err);
|
||||
DI::sysmsg()->addNotice($err);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ class Account extends BaseSettings
|
|||
}
|
||||
|
||||
if (!User::update($fields, local_user())) {
|
||||
notice(DI::l10n()->t('Settings were not updated.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Settings were not updated.'));
|
||||
}
|
||||
|
||||
// clear session language
|
||||
|
@ -198,7 +198,7 @@ class Account extends BaseSettings
|
|||
];
|
||||
|
||||
if (!User::update($fields, local_user()) || !Profile::update($profile_fields, local_user())) {
|
||||
notice(DI::l10n()->t('Settings were not updated.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Settings were not updated.'));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect($redirectUrl);
|
||||
|
@ -218,7 +218,7 @@ class Account extends BaseSettings
|
|||
DI::pConfig()->set(local_user(), 'expire', 'network_only', $expire_network_only);
|
||||
|
||||
if (!User::update(['expire' => $expire], local_user())) {
|
||||
notice(DI::l10n()->t('Settings were not updated.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Settings were not updated.'));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect($redirectUrl);
|
||||
|
@ -302,7 +302,7 @@ class Account extends BaseSettings
|
|||
];
|
||||
|
||||
if (!User::update($fields, local_user())) {
|
||||
notice(DI::l10n()->t('Settings were not updated.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Settings were not updated.'));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect($redirectUrl);
|
||||
|
@ -351,7 +351,7 @@ class Account extends BaseSettings
|
|||
]);
|
||||
|
||||
if (!User::update($fields, local_user()) || !empty($profile_fields) && !Profile::update($profile_fields, local_user())) {
|
||||
notice(DI::l10n()->t('Settings were not updated.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Settings were not updated.'));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect($redirectUrl);
|
||||
|
@ -363,7 +363,7 @@ class Account extends BaseSettings
|
|||
// was there an error
|
||||
if ($_FILES['importcontact-filename']['error'] > 0) {
|
||||
Logger::notice('Contact CSV file upload error', ['error' => $_FILES['importcontact-filename']['error']]);
|
||||
notice(DI::l10n()->t('Contact CSV file upload error'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Contact CSV file upload error'));
|
||||
} else {
|
||||
$csvArray = array_map('str_getcsv', file($_FILES['importcontact-filename']['tmp_name']));
|
||||
Logger::notice('Import started', ['lines' => count($csvArray)]);
|
||||
|
@ -375,14 +375,14 @@ class Account extends BaseSettings
|
|||
// "http" or "@" to be present in the string.
|
||||
// All other fields from the row will be ignored
|
||||
if ((strpos($csvRow[0], '@') !== false) || Network::isValidHttpUrl($csvRow[0])) {
|
||||
Worker::add(PRIORITY_MEDIUM, 'AddContact', local_user(), $csvRow[0]);
|
||||
Worker::add(Worker::PRIORITY_MEDIUM, 'AddContact', local_user(), $csvRow[0]);
|
||||
} else {
|
||||
Logger::notice('Invalid account', ['url' => $csvRow[0]]);
|
||||
}
|
||||
}
|
||||
Logger::notice('Import done');
|
||||
|
||||
info(DI::l10n()->t('Importing Contacts done'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Importing Contacts done'));
|
||||
// delete temp file
|
||||
unlink($_FILES['importcontact-filename']['tmp_name']);
|
||||
}
|
||||
|
@ -394,8 +394,8 @@ class Account extends BaseSettings
|
|||
}
|
||||
|
||||
if (!empty($request['relocate-submit'])) {
|
||||
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, local_user());
|
||||
info(DI::l10n()->t("Relocate message has been send to your contacts"));
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, local_user());
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t("Relocate message has been send to your contacts"));
|
||||
DI::baseUrl()->redirect($redirectUrl);
|
||||
}
|
||||
|
||||
|
@ -412,7 +412,7 @@ class Account extends BaseSettings
|
|||
|
||||
$profile = DBA::selectFirst('profile', [], ['uid' => local_user()]);
|
||||
if (!DBA::isResult($profile)) {
|
||||
notice(DI::l10n()->t('Unable to find your profile. Please contact your admin.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to find your profile. Please contact your admin.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
@ -50,13 +50,13 @@ class Delegation extends BaseSettings
|
|||
if ($parent_uid != 0) {
|
||||
try {
|
||||
User::getIdFromPasswordAuthentication($parent_uid, $parent_password);
|
||||
info(DI::l10n()->t('Delegation successfully granted.'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Delegation successfully granted.'));
|
||||
} catch (\Exception $ex) {
|
||||
notice(DI::l10n()->t('Parent user not found, unavailable or password doesn\'t match.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Parent user not found, unavailable or password doesn\'t match.'));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
info(DI::l10n()->t('Delegation successfully revoked.'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Delegation successfully revoked.'));
|
||||
}
|
||||
|
||||
DBA::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);
|
||||
|
@ -78,7 +78,7 @@ class Delegation extends BaseSettings
|
|||
|
||||
if ($action === 'add' && $user_id) {
|
||||
if (Session::get('submanage')) {
|
||||
notice(DI::l10n()->t('Delegated administrators can view but not change delegation permissions.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Delegated administrators can view but not change delegation permissions.'));
|
||||
DI::baseUrl()->redirect('settings/delegation');
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ class Delegation extends BaseSettings
|
|||
DBA::insert('manage', ['uid' => $user_id, 'mid' => local_user()]);
|
||||
}
|
||||
} else {
|
||||
notice(DI::l10n()->t('Delegate user not found.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Delegate user not found.'));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect('settings/delegation');
|
||||
|
@ -100,7 +100,7 @@ class Delegation extends BaseSettings
|
|||
|
||||
if ($action === 'remove' && $user_id) {
|
||||
if (Session::get('submanage')) {
|
||||
notice(DI::l10n()->t('Delegated administrators can view but not change delegation permissions.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Delegated administrators can view but not change delegation permissions.'));
|
||||
DI::baseUrl()->redirect('settings/delegation');
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ class Display extends BaseSettings
|
|||
DBA::update('user', ['theme' => $theme], ['uid' => local_user()]);
|
||||
}
|
||||
} else {
|
||||
notice(DI::l10n()->t('The theme you chose isn\'t available.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('The theme you chose isn\'t available.'));
|
||||
}
|
||||
|
||||
Hook::callAll('display_settings_post', $_POST);
|
||||
|
|
|
@ -80,7 +80,7 @@ class Index extends BaseSettings
|
|||
|
||||
$name = trim($_POST['name'] ?? '');
|
||||
if (!strlen($name)) {
|
||||
notice(DI::l10n()->t('Profile Name is required.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Profile Name is required.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ class Index extends BaseSettings
|
|||
);
|
||||
|
||||
if (!$result) {
|
||||
notice(DI::l10n()->t('Profile couldn\'t be updated.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Profile couldn\'t be updated.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ class Index extends BaseSettings
|
|||
protected function content(array $request = []): string
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(DI::l10n()->t('You must be logged in to use this module'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('You must be logged in to use this module'));
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ class Crop extends BaseSettings
|
|||
Photo::USER_AVATAR
|
||||
);
|
||||
if ($r === false) {
|
||||
notice(DI::l10n()->t('Image size reduction [%s] failed.', '300'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Image size reduction [%s] failed.', '300'));
|
||||
} else {
|
||||
Photo::update(['profile' => true], array_merge($condition, ['scale' => 4]));
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ class Crop extends BaseSettings
|
|||
Photo::USER_AVATAR
|
||||
);
|
||||
if ($r === false) {
|
||||
notice(DI::l10n()->t('Image size reduction [%s] failed.', '80'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Image size reduction [%s] failed.', '80'));
|
||||
} else {
|
||||
Photo::update(['profile' => true], array_merge($condition, ['scale' => 5]));
|
||||
}
|
||||
|
@ -141,19 +141,19 @@ class Crop extends BaseSettings
|
|||
Photo::USER_AVATAR
|
||||
);
|
||||
if ($r === false) {
|
||||
notice(DI::l10n()->t('Image size reduction [%s] failed.', '48'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Image size reduction [%s] failed.', '48'));
|
||||
} else {
|
||||
Photo::update(['profile' => true], array_merge($condition, ['scale' => 6]));
|
||||
}
|
||||
|
||||
Contact::updateSelfFromUserID(local_user(), true);
|
||||
|
||||
info(DI::l10n()->t('Shift-reload the page or clear browser cache if the new photo does not display immediately.'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Shift-reload the page or clear browser cache if the new photo does not display immediately.'));
|
||||
|
||||
// Update global directory in background
|
||||
Profile::publishUpdate(local_user());
|
||||
} else {
|
||||
notice(DI::l10n()->t('Unable to process image'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to process image'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ class Crop extends BaseSettings
|
|||
// Update global directory in background
|
||||
Profile::publishUpdate(local_user());
|
||||
|
||||
info(DI::l10n()->t('Profile picture successfully updated.'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Profile picture successfully updated.'));
|
||||
|
||||
DI::baseUrl()->redirect('profile/' . DI::app()->getLoggedInUserNickname());
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class Index extends BaseSettings
|
|||
self::checkFormSecurityTokenRedirectOnError('/settings/profile/photo', 'settings_profile_photo');
|
||||
|
||||
if (empty($_FILES['userfile'])) {
|
||||
notice(DI::l10n()->t('Missing uploaded image.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Missing uploaded image.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ class Index extends BaseSettings
|
|||
$maximagesize = DI::config()->get('system', 'maximagesize', 0);
|
||||
|
||||
if ($maximagesize && $filesize > $maximagesize) {
|
||||
notice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)));
|
||||
@unlink($src);
|
||||
return;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ class Index extends BaseSettings
|
|||
$Image = new Image($imagedata, $filetype);
|
||||
|
||||
if (!$Image->isValid()) {
|
||||
notice(DI::l10n()->t('Unable to process image.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Unable to process image.'));
|
||||
@unlink($src);
|
||||
return;
|
||||
}
|
||||
|
@ -93,13 +93,13 @@ class Index extends BaseSettings
|
|||
$filename = '';
|
||||
|
||||
if (!Photo::store($Image, local_user(), 0, $resource_id, $filename, DI::l10n()->t(Photo::PROFILE_PHOTOS), 0, Photo::USER_AVATAR)) {
|
||||
notice(DI::l10n()->t('Image upload failed.'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Image upload failed.'));
|
||||
}
|
||||
|
||||
if ($width > 640 || $height > 640) {
|
||||
$Image->scaleDown(640);
|
||||
if (!Photo::store($Image, local_user(), 0, $resource_id, $filename, DI::l10n()->t(Photo::PROFILE_PHOTOS), 1, Photo::USER_AVATAR)) {
|
||||
notice(DI::l10n()->t('Image size reduction [%s] failed.', '640'));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Image size reduction [%s] failed.', '640'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\App;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Security\TwoFactor\Model\AppSpecificPassword;
|
||||
use Friendica\Module\BaseSettings;
|
||||
|
@ -61,7 +62,7 @@ class AppSpecific extends BaseSettings
|
|||
}
|
||||
|
||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
||||
notice($this->t('Please enter your password to access this page.'));
|
||||
DI::sysmsg()->addNotice($this->t('Please enter your password to access this page.'));
|
||||
$this->baseUrl->redirect('settings/2fa');
|
||||
}
|
||||
}
|
||||
|
@ -79,20 +80,20 @@ class AppSpecific extends BaseSettings
|
|||
case 'generate':
|
||||
$description = $_POST['description'] ?? '';
|
||||
if (empty($description)) {
|
||||
notice($this->t('App-specific password generation failed: The description is empty.'));
|
||||
DI::sysmsg()->addNotice($this->t('App-specific password generation failed: The description is empty.'));
|
||||
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
} elseif (AppSpecificPassword::checkDuplicateForUser(local_user(), $description)) {
|
||||
notice($this->t('App-specific password generation failed: This description already exists.'));
|
||||
DI::sysmsg()->addNotice($this->t('App-specific password generation failed: This description already exists.'));
|
||||
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
} else {
|
||||
$this->appSpecificPassword = AppSpecificPassword::generateForUser(local_user(), $_POST['description'] ?? '');
|
||||
info($this->t('New app-specific password generated.'));
|
||||
DI::sysmsg()->addInfo($this->t('New app-specific password generated.'));
|
||||
}
|
||||
|
||||
break;
|
||||
case 'revoke_all' :
|
||||
AppSpecificPassword::deleteAllForUser(local_user());
|
||||
info($this->t('App-specific passwords successfully revoked.'));
|
||||
DI::sysmsg()->addInfo($this->t('App-specific passwords successfully revoked.'));
|
||||
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
break;
|
||||
}
|
||||
|
@ -102,7 +103,7 @@ class AppSpecific extends BaseSettings
|
|||
self::checkFormSecurityTokenRedirectOnError('settings/2fa/app_specific', 'settings_2fa_app_specific');
|
||||
|
||||
if (AppSpecificPassword::deleteForUser(local_user(), $_POST['revoke_id'])) {
|
||||
info($this->t('App-specific password successfully revoked.'));
|
||||
DI::sysmsg()->addInfo($this->t('App-specific password successfully revoked.'));
|
||||
}
|
||||
|
||||
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
|
|
|
@ -66,7 +66,7 @@ class Index extends BaseSettings
|
|||
DI::pConfig()->delete(local_user(), '2fa', 'verified');
|
||||
Session::remove('2fa');
|
||||
|
||||
info(DI::l10n()->t('Two-factor authentication successfully disabled.'));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('Two-factor authentication successfully disabled.'));
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
}
|
||||
break;
|
||||
|
@ -98,7 +98,7 @@ class Index extends BaseSettings
|
|||
} catch (FoundException $exception) {
|
||||
// Nothing to do here
|
||||
} catch (\Exception $e) {
|
||||
notice(DI::l10n()->t($e->getMessage()));
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t($e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\App;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Security\TwoFactor\Model\RecoveryCode;
|
||||
use Friendica\Module\BaseSettings;
|
||||
|
@ -59,7 +60,7 @@ class Recovery extends BaseSettings
|
|||
}
|
||||
|
||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
||||
notice($this->t('Please enter your password to access this page.'));
|
||||
DI::sysmsg()->addNotice($this->t('Please enter your password to access this page.'));
|
||||
$this->baseUrl->redirect('settings/2fa');
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +76,7 @@ class Recovery extends BaseSettings
|
|||
|
||||
if ($_POST['action'] == 'regenerate') {
|
||||
RecoveryCode::regenerateForUser(local_user());
|
||||
info($this->t('New recovery codes successfully generated.'));
|
||||
DI::sysmsg()->addInfo($this->t('New recovery codes successfully generated.'));
|
||||
$this->baseUrl->redirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\App;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseSettings;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Security\TwoFactor;
|
||||
|
@ -62,7 +63,7 @@ class Trusted extends BaseSettings
|
|||
}
|
||||
|
||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
||||
notice($this->t('Please enter your password to access this page.'));
|
||||
DI::sysmsg()->addNotice($this->t('Please enter your password to access this page.'));
|
||||
$this->baseUrl->redirect('settings/2fa');
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +80,7 @@ class Trusted extends BaseSettings
|
|||
switch ($_POST['action']) {
|
||||
case 'remove_all':
|
||||
$this->trustedBrowserRepo->removeAllForUser(local_user());
|
||||
info($this->t('Trusted browsers successfully removed.'));
|
||||
DI::sysmsg()->addInfo($this->t('Trusted browsers successfully removed.'));
|
||||
$this->baseUrl->redirect('settings/2fa/trusted?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
break;
|
||||
}
|
||||
|
@ -89,7 +90,7 @@ class Trusted extends BaseSettings
|
|||
self::checkFormSecurityTokenRedirectOnError('settings/2fa/trusted', 'settings_2fa_trusted');
|
||||
|
||||
if ($this->trustedBrowserRepo->removeForUser(local_user(), $_POST['remove_id'])) {
|
||||
info($this->t('Trusted browser successfully removed.'));
|
||||
DI::sysmsg()->addInfo($this->t('Trusted browser successfully removed.'));
|
||||
}
|
||||
|
||||
$this->baseUrl->redirect('settings/2fa/trusted?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
|
|
|
@ -30,6 +30,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseSettings;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Module\Security\Login;
|
||||
|
@ -65,7 +66,7 @@ class Verify extends BaseSettings
|
|||
}
|
||||
|
||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
||||
notice($this->t('Please enter your password to access this page.'));
|
||||
DI::sysmsg()->addNotice($this->t('Please enter your password to access this page.'));
|
||||
$this->baseUrl->redirect('settings/2fa');
|
||||
}
|
||||
}
|
||||
|
@ -87,11 +88,11 @@ class Verify extends BaseSettings
|
|||
$this->pConfig->set(local_user(), '2fa', 'verified', true);
|
||||
Session::set('2fa', true);
|
||||
|
||||
info($this->t('Two-factor authentication successfully activated.'));
|
||||
DI::sysmsg()->addInfo($this->t('Two-factor authentication successfully activated.'));
|
||||
|
||||
$this->baseUrl->redirect('settings/2fa');
|
||||
} else {
|
||||
notice($this->t('Invalid code, please retry.'));
|
||||
DI::sysmsg()->addNotice($this->t('Invalid code, please retry.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
|
||||
namespace Friendica\Module\Settings;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
|
@ -253,7 +253,7 @@ class UserExport extends BaseSettings
|
|||
);
|
||||
|
||||
$output = [
|
||||
'version' => FRIENDICA_VERSION,
|
||||
'version' => App::VERSION,
|
||||
'schema' => DB_UPDATE_VERSION,
|
||||
'baseurl' => DI::baseUrl(),
|
||||
'user' => $user,
|
||||
|
|
|
@ -69,8 +69,8 @@ class Statistics extends BaseModule
|
|||
|
||||
$statistics = array_merge([
|
||||
'name' => $this->config->get('config', 'sitename'),
|
||||
'network' => FRIENDICA_PLATFORM,
|
||||
'version' => FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
|
||||
'network' => App::PLATFORM,
|
||||
'version' => App::VERSION . '-' . DB_UPDATE_VERSION,
|
||||
'registrations_open' => $registration_open,
|
||||
'total_users' => $this->config->get('nodeinfo', 'total_users'),
|
||||
'active_users_halfyear' => $this->config->get('nodeinfo', 'active_users_halfyear'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue