Fix code style
This commit is contained in:
parent
b2bbcc4965
commit
02fae146e6
17 changed files with 134 additions and 118 deletions
|
@ -76,12 +76,12 @@ class StorageManager
|
||||||
*/
|
*/
|
||||||
public function __construct(Database $dba, IManageConfigValues $config, LoggerInterface $logger, EventDispatcherInterface $eventDispatcher, L10n $l10n, bool $includeAddon = true)
|
public function __construct(Database $dba, IManageConfigValues $config, LoggerInterface $logger, EventDispatcherInterface $eventDispatcher, L10n $l10n, bool $includeAddon = true)
|
||||||
{
|
{
|
||||||
$this->dba = $dba;
|
$this->dba = $dba;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->l10n = $l10n;
|
$this->l10n = $l10n;
|
||||||
$this->validBackends = $config->get('storage', 'backends', self::DEFAULT_BACKENDS);
|
$this->validBackends = $config->get('storage', 'backends', self::DEFAULT_BACKENDS);
|
||||||
|
|
||||||
$currentName = $this->config->get('storage', 'name');
|
$currentName = $this->config->get('storage', 'name');
|
||||||
|
|
||||||
|
|
|
@ -3051,7 +3051,7 @@ class Item
|
||||||
$hook_data = [
|
$hook_data = [
|
||||||
'rendered-html' => $item['rendered-html'],
|
'rendered-html' => $item['rendered-html'],
|
||||||
'rendered-hash' => $item['rendered-hash'],
|
'rendered-hash' => $item['rendered-hash'],
|
||||||
'item' => $item,
|
'item' => $item,
|
||||||
];
|
];
|
||||||
|
|
||||||
$eventDispatcher = DI::eventDispatcher();
|
$eventDispatcher = DI::eventDispatcher();
|
||||||
|
|
|
@ -480,7 +480,7 @@ class Profile
|
||||||
|
|
||||||
$hook_data = [
|
$hook_data = [
|
||||||
'profile' => &$profile,
|
'profile' => &$profile,
|
||||||
'entry' => &$o,
|
'entry' => &$o,
|
||||||
];
|
];
|
||||||
|
|
||||||
$hook_data = $eventDispatcher->dispatch(
|
$hook_data = $eventDispatcher->dispatch(
|
||||||
|
@ -488,7 +488,7 @@ class Profile
|
||||||
)->getArray();
|
)->getArray();
|
||||||
|
|
||||||
$profile = $hook_data['profile'] ?? $profile;
|
$profile = $hook_data['profile'] ?? $profile;
|
||||||
$o = $hook_data['entry'] ?? $o;
|
$o = $hook_data['entry'] ?? $o;
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,7 +265,7 @@ class Profile extends BaseModule
|
||||||
$this->baseUrl->redirect('contact/' . $contact['id']);
|
$this->baseUrl->redirect('contact/' . $contact['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$vcard_widget = Widget\VCard::getHTML($contact);
|
$vcard_widget = Widget\VCard::getHTML($contact);
|
||||||
$circles_widget = '';
|
$circles_widget = '';
|
||||||
|
|
||||||
if (!in_array($localRelationship->rel, [ContactModel::NOTHING, ContactModel::SELF])) {
|
if (!in_array($localRelationship->rel, [ContactModel::NOTHING, ContactModel::SELF])) {
|
||||||
|
@ -283,9 +283,15 @@ class Profile extends BaseModule
|
||||||
]);
|
]);
|
||||||
|
|
||||||
switch ($localRelationship->rel) {
|
switch ($localRelationship->rel) {
|
||||||
case ContactModel::FRIEND: $relation_text = $this->t('You are mutual friends with %s', $contact['name']); break;
|
case ContactModel::FRIEND:
|
||||||
case ContactModel::FOLLOWER: $relation_text = $this->t('You are sharing with %s', $contact['name']); break;
|
$relation_text = $this->t('You are mutual friends with %s', $contact['name']);
|
||||||
case ContactModel::SHARING: $relation_text = $this->t('%s is sharing with you', $contact['name']); break;
|
break;
|
||||||
|
case ContactModel::FOLLOWER:
|
||||||
|
$relation_text = $this->t('You are sharing with %s', $contact['name']);
|
||||||
|
break;
|
||||||
|
case ContactModel::SHARING:
|
||||||
|
$relation_text = $this->t('%s is sharing with you', $contact['name']);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$relation_text = '';
|
$relation_text = '';
|
||||||
}
|
}
|
||||||
|
@ -308,8 +314,7 @@ class Profile extends BaseModule
|
||||||
$this->logger->notice('Empty gsid for contact', ['contact' => $contact]);
|
$this->logger->notice('Empty gsid for contact', ['contact' => $contact]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$serverIgnored =
|
$serverIgnored = $contact['gsid'] &&
|
||||||
$contact['gsid'] &&
|
|
||||||
$this->userGServer->isIgnoredByUser($this->session->getLocalUserId(), $contact['gsid']) ?
|
$this->userGServer->isIgnoredByUser($this->session->getLocalUserId(), $contact['gsid']) ?
|
||||||
$this->t('This contact is on a server you ignored.')
|
$this->t('This contact is on a server you ignored.')
|
||||||
: '';
|
: '';
|
||||||
|
@ -475,7 +480,7 @@ class Profile extends BaseModule
|
||||||
|
|
||||||
$hook_data = [
|
$hook_data = [
|
||||||
'contact' => $contact,
|
'contact' => $contact,
|
||||||
'output' => $o,
|
'output' => $o,
|
||||||
];
|
];
|
||||||
|
|
||||||
$hook_data = $this->eventDispatcher->dispatch(
|
$hook_data = $this->eventDispatcher->dispatch(
|
||||||
|
|
|
@ -31,7 +31,6 @@ use Friendica\Content\Widget\TrendingTags;
|
||||||
use Friendica\Core\ACL;
|
use Friendica\Core\ACL;
|
||||||
use Friendica\Core\Cache\Capability\ICanCache;
|
use Friendica\Core\Cache\Capability\ICanCache;
|
||||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||||
use Friendica\Core\Hook;
|
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
|
|
|
@ -11,7 +11,6 @@ use Friendica\BaseModule;
|
||||||
use Friendica\Content\Nav;
|
use Friendica\Content\Nav;
|
||||||
use Friendica\Content\Pager;
|
use Friendica\Content\Pager;
|
||||||
use Friendica\Content\Widget;
|
use Friendica\Content\Widget;
|
||||||
use Friendica\Core\Hook;
|
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\Search;
|
use Friendica\Core\Search;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
@ -40,7 +39,7 @@ class Directory extends BaseModule
|
||||||
DI::page()['aside'] .= Widget::follow();
|
DI::page()['aside'] .= Widget::follow();
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
$entries = [];
|
$entries = [];
|
||||||
|
|
||||||
Nav::setSelected('directory');
|
Nav::setSelected('directory');
|
||||||
|
@ -48,7 +47,7 @@ class Directory extends BaseModule
|
||||||
$search = trim(rawurldecode($_REQUEST['search'] ?? ''));
|
$search = trim(rawurldecode($_REQUEST['search'] ?? ''));
|
||||||
|
|
||||||
$gDirPath = '';
|
$gDirPath = '';
|
||||||
$dirURL = Search::getGlobalDirectory();
|
$dirURL = Search::getGlobalDirectory();
|
||||||
if (strlen($dirURL)) {
|
if (strlen($dirURL)) {
|
||||||
$gDirPath = OpenWebAuth::getZrlUrl($dirURL, true);
|
$gDirPath = OpenWebAuth::getZrlUrl($dirURL, true);
|
||||||
}
|
}
|
||||||
|
@ -166,7 +165,7 @@ class Directory extends BaseModule
|
||||||
|
|
||||||
$hook_data = [
|
$hook_data = [
|
||||||
'contact' => $contact,
|
'contact' => $contact,
|
||||||
'entry' => $entry,
|
'entry' => $entry,
|
||||||
];
|
];
|
||||||
|
|
||||||
$hook_data = $eventDispatcher->dispatch(
|
$hook_data = $eventDispatcher->dispatch(
|
||||||
|
|
|
@ -58,11 +58,11 @@ class Friendica extends BaseModule
|
||||||
) {
|
) {
|
||||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||||
|
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->keyValue = $keyValue;
|
$this->keyValue = $keyValue;
|
||||||
$this->session = $session;
|
$this->session = $session;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->addonHelper = $addonHelper;
|
$this->addonHelper = $addonHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function content(array $request = []): string
|
protected function content(array $request = []): string
|
||||||
|
|
|
@ -52,7 +52,7 @@ abstract class BaseUsers extends BaseModeration
|
||||||
) {
|
) {
|
||||||
parent::__construct($page, $appHelper, $systemMessages, $session, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
parent::__construct($page, $appHelper, $systemMessages, $session, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||||
|
|
||||||
$this->database = $database;
|
$this->database = $database;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ abstract class BaseUsers extends BaseModeration
|
||||||
];
|
];
|
||||||
|
|
||||||
$hook_data = [
|
$hook_data = [
|
||||||
'tabs' => $tabs,
|
'tabs' => $tabs,
|
||||||
'selectedTab' => $selectedTab,
|
'selectedTab' => $selectedTab,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class ParseUrl extends BaseModule
|
||||||
{
|
{
|
||||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||||
|
|
||||||
$this->userSession = $userSession;
|
$this->userSession = $userSession;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,10 +41,10 @@ class ParseUrl extends BaseModule
|
||||||
throw new \Friendica\Network\HTTPException\ForbiddenException();
|
throw new \Friendica\Network\HTTPException\ForbiddenException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$format = '';
|
$format = '';
|
||||||
$title = '';
|
$title = '';
|
||||||
$description = '';
|
$description = '';
|
||||||
$ret = ['success' => false, 'contentType' => ''];
|
$ret = ['success' => false, 'contentType' => ''];
|
||||||
|
|
||||||
if (!empty($_GET['binurl']) && Util\Strings::isHex($_GET['binurl'])) {
|
if (!empty($_GET['binurl']) && Util\Strings::isHex($_GET['binurl'])) {
|
||||||
$url = trim(hex2bin($_GET['binurl']));
|
$url = trim(hex2bin($_GET['binurl']));
|
||||||
|
@ -85,9 +85,9 @@ class ParseUrl extends BaseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
$hook_data = [
|
$hook_data = [
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
'format' => $format,
|
'format' => $format,
|
||||||
'text' => null,
|
'text' => null,
|
||||||
];
|
];
|
||||||
|
|
||||||
$hook_data = $this->eventDispatcher->dispatch(
|
$hook_data = $this->eventDispatcher->dispatch(
|
||||||
|
@ -119,14 +119,14 @@ class ParseUrl extends BaseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret['contentType'] = $content_type;
|
$ret['contentType'] = $content_type;
|
||||||
$ret['data'] = ['url' => $url];
|
$ret['data'] = ['url' => $url];
|
||||||
$ret['success'] = true;
|
$ret['success'] = true;
|
||||||
} else {
|
} else {
|
||||||
unset($siteinfo['keywords']);
|
unset($siteinfo['keywords']);
|
||||||
|
|
||||||
$ret['data'] = $siteinfo;
|
$ret['data'] = $siteinfo;
|
||||||
$ret['contentType'] = 'attachment';
|
$ret['contentType'] = 'attachment';
|
||||||
$ret['success'] = true;
|
$ret['success'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->jsonExit($ret);
|
$this->jsonExit($ret);
|
||||||
|
|
|
@ -58,17 +58,17 @@ class PermissionTooltip extends BaseModule
|
||||||
) {
|
) {
|
||||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||||
|
|
||||||
$this->dba = $dba;
|
$this->dba = $dba;
|
||||||
$this->aclFormatter = $aclFormatter;
|
$this->aclFormatter = $aclFormatter;
|
||||||
$this->session = $session;
|
$this->session = $session;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->permissionSet = $permissionSet;
|
$this->permissionSet = $permissionSet;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function rawContent(array $request = [])
|
protected function rawContent(array $request = [])
|
||||||
{
|
{
|
||||||
$type = $this->parameters['type'];
|
$type = $this->parameters['type'];
|
||||||
$referenceId = $this->parameters['id'];
|
$referenceId = $this->parameters['id'];
|
||||||
|
|
||||||
$expectedTypes = ['item', 'photo', 'event'];
|
$expectedTypes = ['item', 'photo', 'event'];
|
||||||
|
@ -79,10 +79,10 @@ class PermissionTooltip extends BaseModule
|
||||||
$condition = ['id' => $referenceId, 'uid' => [0, $this->session->getLocalUserId()]];
|
$condition = ['id' => $referenceId, 'uid' => [0, $this->session->getLocalUserId()]];
|
||||||
if ($type == 'item') {
|
if ($type == 'item') {
|
||||||
$fields = ['uid', 'psid', 'private', 'uri-id', 'origin', 'network'];
|
$fields = ['uid', 'psid', 'private', 'uri-id', 'origin', 'network'];
|
||||||
$model = Model\Post::selectFirst($fields, $condition, ['order' => ['uid' => true]]);
|
$model = Model\Post::selectFirst($fields, $condition, ['order' => ['uid' => true]]);
|
||||||
|
|
||||||
if ($model['origin'] || ($model['network'] != Protocol::ACTIVITYPUB)) {
|
if ($model['origin'] || ($model['network'] != Protocol::ACTIVITYPUB)) {
|
||||||
$permissionSet = $this->permissionSet->selectOneById($model['psid'], $model['uid']);
|
$permissionSet = $this->permissionSet->selectOneById($model['psid'], $model['uid']);
|
||||||
$model['allow_cid'] = $permissionSet->allow_cid;
|
$model['allow_cid'] = $permissionSet->allow_cid;
|
||||||
$model['allow_gid'] = $permissionSet->allow_gid;
|
$model['allow_gid'] = $permissionSet->allow_gid;
|
||||||
$model['deny_cid'] = $permissionSet->deny_cid;
|
$model['deny_cid'] = $permissionSet->deny_cid;
|
||||||
|
@ -94,8 +94,8 @@ class PermissionTooltip extends BaseModule
|
||||||
$model['deny_gid'] = [];
|
$model['deny_gid'] = [];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$fields = ['uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'];
|
$fields = ['uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'];
|
||||||
$model = $this->dba->selectFirst($type, $fields, $condition);
|
$model = $this->dba->selectFirst($type, $fields, $condition);
|
||||||
$model['allow_cid'] = $this->aclFormatter->expand($model['allow_cid']);
|
$model['allow_cid'] = $this->aclFormatter->expand($model['allow_cid']);
|
||||||
$model['allow_gid'] = $this->aclFormatter->expand($model['allow_gid']);
|
$model['allow_gid'] = $this->aclFormatter->expand($model['allow_gid']);
|
||||||
$model['deny_cid'] = $this->aclFormatter->expand($model['deny_cid']);
|
$model['deny_cid'] = $this->aclFormatter->expand($model['deny_cid']);
|
||||||
|
@ -116,7 +116,7 @@ class PermissionTooltip extends BaseModule
|
||||||
|
|
||||||
$model = $hook_data['model'] ?? $model;
|
$model = $hook_data['model'] ?? $model;
|
||||||
|
|
||||||
$aclReceivers = new Entity\AclReceivers();
|
$aclReceivers = new Entity\AclReceivers();
|
||||||
$addressedReceivers = new Entity\AddressedReceivers();
|
$addressedReceivers = new Entity\AddressedReceivers();
|
||||||
if (!empty($model['allow_cid']) || !empty($model['allow_gid']) || !empty($model['deny_cid']) || !empty($model['deny_gid'])) {
|
if (!empty($model['allow_cid']) || !empty($model['allow_gid']) || !empty($model['deny_cid']) || !empty($model['deny_gid'])) {
|
||||||
$aclReceivers = $this->fetchReceiversFromACL($model);
|
$aclReceivers = $this->fetchReceiversFromACL($model);
|
||||||
|
@ -126,30 +126,35 @@ class PermissionTooltip extends BaseModule
|
||||||
|
|
||||||
$privacy = '';
|
$privacy = '';
|
||||||
switch ($model['private'] ?? null) {
|
switch ($model['private'] ?? null) {
|
||||||
case Model\Item::PUBLIC: $privacy = $this->t('Public'); break;
|
case Model\Item::PUBLIC:
|
||||||
case Model\Item::UNLISTED: $privacy = $this->t('Unlisted'); break;
|
$privacy = $this->t('Public');
|
||||||
case Model\Item::PRIVATE: $privacy = $this->t('Limited/Private'); break;
|
break;
|
||||||
|
case Model\Item::UNLISTED:
|
||||||
|
$privacy = $this->t('Unlisted');
|
||||||
|
break;
|
||||||
|
case Model\Item::PRIVATE:
|
||||||
|
$privacy = $this->t('Limited/Private');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aclReceivers->isEmpty() && $addressedReceivers->isEmpty() && empty($privacy))
|
if ($aclReceivers->isEmpty() && $addressedReceivers->isEmpty() && empty($privacy)) {
|
||||||
{
|
|
||||||
echo $this->t('Remote privacy information not available.');
|
echo $this->t('Remote privacy information not available.');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tpl = Renderer::getMarkupTemplate('privacy/permission_tooltip.tpl');
|
$tpl = Renderer::getMarkupTemplate('privacy/permission_tooltip.tpl');
|
||||||
$output = Renderer::replaceMacros($tpl, [
|
$output = Renderer::replaceMacros($tpl, [
|
||||||
'$l10n' => [
|
'$l10n' => [
|
||||||
'visible_to' => $this->t('Visible to:'),
|
'visible_to' => $this->t('Visible to:'),
|
||||||
'to' => $this->t('To:'),
|
'to' => $this->t('To:'),
|
||||||
'cc' => $this->t('CC:'),
|
'cc' => $this->t('CC:'),
|
||||||
'bcc' => $this->t('BCC:'),
|
'bcc' => $this->t('BCC:'),
|
||||||
'audience' => $this->t('Audience:'),
|
'audience' => $this->t('Audience:'),
|
||||||
'attributed' => $this->t('Attributed To:'),
|
'attributed' => $this->t('Attributed To:'),
|
||||||
],
|
],
|
||||||
'$aclReceivers' => $aclReceivers,
|
'$aclReceivers' => $aclReceivers,
|
||||||
'$addressedReceivers' => $addressedReceivers,
|
'$addressedReceivers' => $addressedReceivers,
|
||||||
'$privacy' => $privacy,
|
'$privacy' => $privacy,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->httpExit($output);
|
$this->httpExit($output);
|
||||||
|
@ -223,7 +228,7 @@ class PermissionTooltip extends BaseModule
|
||||||
private function fetchAddressedReceivers(int $uriId): Entity\AddressedReceivers
|
private function fetchAddressedReceivers(int $uriId): Entity\AddressedReceivers
|
||||||
{
|
{
|
||||||
$own_url = '';
|
$own_url = '';
|
||||||
$uid = $this->session->getLocalUserId();
|
$uid = $this->session->getLocalUserId();
|
||||||
if ($uid) {
|
if ($uid) {
|
||||||
$owner = Model\User::getOwnerDataById($uid);
|
$owner = Model\User::getOwnerDataById($uid);
|
||||||
if (!empty($owner['url'])) {
|
if (!empty($owner['url'])) {
|
||||||
|
@ -246,11 +251,11 @@ class PermissionTooltip extends BaseModule
|
||||||
$receivers[$receiver['type']][] = $this->t('Collection (%s)', $receiver['name']);
|
$receivers[$receiver['type']][] = $this->t('Collection (%s)', $receiver['name']);
|
||||||
break;
|
break;
|
||||||
case Model\Tag::FOLLOWER_COLLECTION:
|
case Model\Tag::FOLLOWER_COLLECTION:
|
||||||
$apcontact = $this->dba->selectFirst('apcontact', ['name'], ['followers' => $receiver['url']]);
|
$apcontact = $this->dba->selectFirst('apcontact', ['name'], ['followers' => $receiver['url']]);
|
||||||
$receivers[$receiver['type']][] = $this->t('Followers (%s)', $apcontact['name'] ?? $receiver['name']);
|
$receivers[$receiver['type']][] = $this->t('Followers (%s)', $apcontact['name'] ?? $receiver['name']);
|
||||||
break;
|
break;
|
||||||
case Model\Tag::ACCOUNT:
|
case Model\Tag::ACCOUNT:
|
||||||
$apcontact = Model\APContact::getByURL($receiver['url'], false);
|
$apcontact = Model\APContact::getByURL($receiver['url'], false);
|
||||||
$receivers[$receiver['type']][] = $apcontact['name'] ?? $receiver['name'];
|
$receivers[$receiver['type']][] = $apcontact['name'] ?? $receiver['name'];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -260,19 +265,19 @@ class PermissionTooltip extends BaseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($receivers as $type => $receiver) {
|
foreach ($receivers as $type => $receiver) {
|
||||||
$max = $this->config->get('system', 'max_receivers');
|
$max = $this->config->get('system', 'max_receivers');
|
||||||
$total = count($receiver);
|
$total = count($receiver);
|
||||||
if ($total > $max) {
|
if ($total > $max) {
|
||||||
$receivers[$type] = array_slice($receiver, 0, $max);
|
$receivers[$type] = array_slice($receiver, 0, $max);
|
||||||
$receivers[$type][] = $this->t('%d more', $total - $max);
|
$receivers[$type][] = $this->t('%d more', $total - $max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Entity\AddressedReceivers(
|
return new Entity\AddressedReceivers(
|
||||||
$receivers[Model\Tag::TO] ?? [],
|
$receivers[Model\Tag::TO] ?? [],
|
||||||
$receivers[Model\Tag::CC] ?? [],
|
$receivers[Model\Tag::CC] ?? [],
|
||||||
$receivers[Model\Tag::BCC] ?? [],
|
$receivers[Model\Tag::BCC] ?? [],
|
||||||
$receivers[Model\Tag::AUDIENCE] ?? [],
|
$receivers[Model\Tag::AUDIENCE] ?? [],
|
||||||
$receivers[Model\Tag::ATTRIBUTED] ?? [],
|
$receivers[Model\Tag::ATTRIBUTED] ?? [],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,13 +77,13 @@ class Photos extends \Friendica\Module\BaseProfile
|
||||||
) {
|
) {
|
||||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||||
|
|
||||||
$this->session = $session;
|
$this->session = $session;
|
||||||
$this->page = $page;
|
$this->page = $page;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->appHelper = $appHelper;
|
$this->appHelper = $appHelper;
|
||||||
$this->database = $database;
|
$this->database = $database;
|
||||||
$this->systemMessages = $systemMessages;
|
$this->systemMessages = $systemMessages;
|
||||||
$this->aclFormatter = $aclFormatter;
|
$this->aclFormatter = $aclFormatter;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
|
|
||||||
$owner = Profile::load($this->appHelper, $this->parameters['nickname'] ?? '', false);
|
$owner = Profile::load($this->appHelper, $this->parameters['nickname'] ?? '', false);
|
||||||
|
@ -109,7 +109,7 @@ class Photos extends \Friendica\Module\BaseProfile
|
||||||
if ($visibility === 'public') {
|
if ($visibility === 'public') {
|
||||||
// The ACL selector introduced in version 2019.12 sends ACL input data even when the Public visibility is selected
|
// The ACL selector introduced in version 2019.12 sends ACL input data even when the Public visibility is selected
|
||||||
$str_contact_allow = $str_circle_allow = $str_contact_deny = $str_circle_deny = '';
|
$str_contact_allow = $str_circle_allow = $str_contact_deny = $str_circle_deny = '';
|
||||||
} else if ($visibility === 'custom') {
|
} elseif ($visibility === 'custom') {
|
||||||
// Since we know from the visibility parameter the item should be private, we have to prevent the empty ACL
|
// Since we know from the visibility parameter the item should be private, we have to prevent the empty ACL
|
||||||
// case that would make it public. So we always append the author's contact id to the allowed contacts.
|
// case that would make it public. So we always append the author's contact id to the allowed contacts.
|
||||||
// See https://github.com/friendica/friendica/issues/9672
|
// See https://github.com/friendica/friendica/issues/9672
|
||||||
|
@ -155,10 +155,10 @@ class Photos extends \Friendica\Module\BaseProfile
|
||||||
}
|
}
|
||||||
|
|
||||||
$hook_data = [
|
$hook_data = [
|
||||||
'src' => '',
|
'src' => '',
|
||||||
'filename' => '',
|
'filename' => '',
|
||||||
'filesize' => 0,
|
'filesize' => 0,
|
||||||
'type' => '',
|
'type' => '',
|
||||||
];
|
];
|
||||||
|
|
||||||
$hook_data = $this->eventDispatcher->dispatch(
|
$hook_data = $this->eventDispatcher->dispatch(
|
||||||
|
@ -183,7 +183,7 @@ class Photos extends \Friendica\Module\BaseProfile
|
||||||
$type = $_FILES['userfile']['type'];
|
$type = $_FILES['userfile']['type'];
|
||||||
$error = $_FILES['userfile']['error'];
|
$error = $_FILES['userfile']['error'];
|
||||||
} else {
|
} else {
|
||||||
$error = UPLOAD_ERR_NO_FILE;
|
$error = UPLOAD_ERR_NO_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error !== UPLOAD_ERR_OK) {
|
if ($error !== UPLOAD_ERR_OK) {
|
||||||
|
@ -314,7 +314,7 @@ class Photos extends \Friendica\Module\BaseProfile
|
||||||
$arr['visible'] = $visible;
|
$arr['visible'] = $visible;
|
||||||
$arr['origin'] = 1;
|
$arr['origin'] = 1;
|
||||||
|
|
||||||
$arr['body'] = Images::getBBCodeByResource($resource_id, $this->owner['nickname'], $preview, $image->getExt());
|
$arr['body'] = Images::getBBCodeByResource($resource_id, $this->owner['nickname'], $preview, $image->getExt());
|
||||||
|
|
||||||
$item_id = Item::insert($arr);
|
$item_id = Item::insert($arr);
|
||||||
// Update the photo albums cache
|
// Update the photo albums cache
|
||||||
|
@ -383,7 +383,7 @@ class Photos extends \Friendica\Module\BaseProfile
|
||||||
$pager->getItemsPerPage()
|
$pager->getItemsPerPage()
|
||||||
));
|
));
|
||||||
|
|
||||||
$photos = array_map(function ($photo){
|
$photos = array_map(function ($photo) {
|
||||||
return [
|
return [
|
||||||
'id' => $photo['id'],
|
'id' => $photo['id'],
|
||||||
'link' => 'photos/' . $this->owner['nickname'] . '/image/' . $photo['resource-id'],
|
'link' => 'photos/' . $this->owner['nickname'] . '/image/' . $photo['resource-id'],
|
||||||
|
|
|
@ -78,12 +78,12 @@ class Profile extends BaseProfile
|
||||||
) {
|
) {
|
||||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||||
|
|
||||||
$this->database = $database;
|
$this->database = $database;
|
||||||
$this->appHelper = $appHelper;
|
$this->appHelper = $appHelper;
|
||||||
$this->session = $session;
|
$this->session = $session;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->page = $page;
|
$this->page = $page;
|
||||||
$this->profileField = $profileField;
|
$this->profileField = $profileField;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ class Profile extends BaseProfile
|
||||||
}
|
}
|
||||||
|
|
||||||
$tpl = Renderer::getMarkupTemplate('profile/profile.tpl');
|
$tpl = Renderer::getMarkupTemplate('profile/profile.tpl');
|
||||||
$o .= Renderer::replaceMacros($tpl, [
|
$o .= Renderer::replaceMacros($tpl, [
|
||||||
'$title' => $this->t('Profile'),
|
'$title' => $this->t('Profile'),
|
||||||
'$yourself' => $this->t('Yourself'),
|
'$yourself' => $this->t('Yourself'),
|
||||||
'$view_as_contacts' => $view_as_contacts,
|
'$view_as_contacts' => $view_as_contacts,
|
||||||
|
@ -293,7 +293,7 @@ class Profile extends BaseProfile
|
||||||
'title' => '',
|
'title' => '',
|
||||||
'label' => $this->t('Edit profile')
|
'label' => $this->t('Edit profile')
|
||||||
],
|
],
|
||||||
'$viewas_link' => [
|
'$viewas_link' => [
|
||||||
'url' => $this->args->getQueryString() . '#viewas',
|
'url' => $this->args->getQueryString() . '#viewas',
|
||||||
'title' => '',
|
'title' => '',
|
||||||
'label' => $this->t('View as')
|
'label' => $this->t('View as')
|
||||||
|
@ -362,7 +362,7 @@ class Profile extends BaseProfile
|
||||||
$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $nickname . '/" title="' . $this->t('%s\'s posts', htmlspecialchars($profile['name'], ENT_COMPAT, 'UTF-8', true)) . '"/>' . "\n";
|
$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $nickname . '/" title="' . $this->t('%s\'s posts', htmlspecialchars($profile['name'], ENT_COMPAT, 'UTF-8', true)) . '"/>' . "\n";
|
||||||
$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $nickname . '/comments" title="' . $this->t('%s\'s comments', htmlspecialchars($profile['name'], ENT_COMPAT, 'UTF-8', true)) . '"/>' . "\n";
|
$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $nickname . '/comments" title="' . $this->t('%s\'s comments', htmlspecialchars($profile['name'], ENT_COMPAT, 'UTF-8', true)) . '"/>' . "\n";
|
||||||
$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $nickname . '/activity" title="' . $this->t('%s\'s timeline', htmlspecialchars($profile['name'], ENT_COMPAT, 'UTF-8', true)) . '"/>' . "\n";
|
$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $nickname . '/activity" title="' . $this->t('%s\'s timeline', htmlspecialchars($profile['name'], ENT_COMPAT, 'UTF-8', true)) . '"/>' . "\n";
|
||||||
$uri = urlencode('acct:' . $profile['nickname'] . '@' . $this->baseUrl->getHost() . ($this->baseUrl->getPath() ? '/' . $this->baseUrl->getPath() : ''));
|
$uri = urlencode('acct:' . $profile['nickname'] . '@' . $this->baseUrl->getHost() . ($this->baseUrl->getPath() ? '/' . $this->baseUrl->getPath() : ''));
|
||||||
$htmlhead .= '<link rel="lrdd" type="application/xrd+xml" href="' . $this->baseUrl . '/xrd/?uri=' . $uri . '" />' . "\n";
|
$htmlhead .= '<link rel="lrdd" type="application/xrd+xml" href="' . $this->baseUrl . '/xrd/?uri=' . $uri . '" />' . "\n";
|
||||||
header('Link: <' . $this->baseUrl . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
header('Link: <' . $this->baseUrl . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ class Register extends BaseModule
|
||||||
|
|
||||||
$this->tos = new Tos($l10n, $baseUrl, $args, $logger, $profiler, $response, $config, $server, $parameters);
|
$this->tos = new Tos($l10n, $baseUrl, $args, $logger, $profiler, $response, $config, $server, $parameters);
|
||||||
|
|
||||||
$this->session = $session;
|
$this->session = $session;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,8 @@ class Acl extends BaseModule
|
||||||
) {
|
) {
|
||||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||||
|
|
||||||
$this->session = $session;
|
$this->session = $session;
|
||||||
$this->database = $database;
|
$this->database = $database;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,9 +118,9 @@ class Acl extends BaseModule
|
||||||
|
|
||||||
private function regularContactSearch(array $request, string $type): array
|
private function regularContactSearch(array $request, string $type): array
|
||||||
{
|
{
|
||||||
$start = $request['start'] ?? 0;
|
$start = $request['start'] ?? 0;
|
||||||
$count = $request['count'] ?? 100;
|
$count = $request['count'] ?? 100;
|
||||||
$search = $request['search'] ?? '';
|
$search = $request['search'] ?? '';
|
||||||
$conv_id = $request['conversation'] ?? null;
|
$conv_id = $request['conversation'] ?? null;
|
||||||
|
|
||||||
// For use with jquery.textcomplete for private mail completion
|
// For use with jquery.textcomplete for private mail completion
|
||||||
|
@ -138,9 +138,9 @@ class Acl extends BaseModule
|
||||||
$condition_circle = ["`uid` = ? AND NOT `deleted`", $this->session->getLocalUserId()];
|
$condition_circle = ["`uid` = ? AND NOT `deleted`", $this->session->getLocalUserId()];
|
||||||
|
|
||||||
if ($search != '') {
|
if ($search != '') {
|
||||||
$sql_extra = "AND `name` LIKE '%%" . $this->database->escape($search) . "%%'";
|
$sql_extra = "AND `name` LIKE '%%" . $this->database->escape($search) . "%%'";
|
||||||
$condition = DBA::mergeConditions($condition, ["(`attag` LIKE ? OR `name` LIKE ? OR `nick` LIKE ?)",
|
$condition = DBA::mergeConditions($condition, ["(`attag` LIKE ? OR `name` LIKE ? OR `nick` LIKE ?)",
|
||||||
'%' . $search . '%', '%' . $search . '%', '%' . $search . '%']);
|
'%' . $search . '%', '%' . $search . '%', '%' . $search . '%']);
|
||||||
$condition_circle = DBA::mergeConditions($condition_circle, ["`name` LIKE ?", '%' . $search . '%']);
|
$condition_circle = DBA::mergeConditions($condition_circle, ["`name` LIKE ?", '%' . $search . '%']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,21 +156,27 @@ class Acl extends BaseModule
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case self::TYPE_MENTION_CONTACT_CIRCLE:
|
case self::TYPE_MENTION_CONTACT_CIRCLE:
|
||||||
case self::TYPE_MENTION_CONTACT:
|
case self::TYPE_MENTION_CONTACT:
|
||||||
$condition = DBA::mergeConditions($condition,
|
$condition = DBA::mergeConditions(
|
||||||
|
$condition,
|
||||||
["NOT `self` AND NOT `blocked`",
|
["NOT `self` AND NOT `blocked`",
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case self::TYPE_MENTION_GROUP:
|
case self::TYPE_MENTION_GROUP:
|
||||||
$condition = DBA::mergeConditions($condition,
|
$condition = DBA::mergeConditions(
|
||||||
|
$condition,
|
||||||
["NOT `self` AND NOT `blocked` AND (NOT `ap-posting-restricted` OR `ap-posting-restricted` IS NULL) AND `contact-type` = ?", Contact::TYPE_COMMUNITY
|
["NOT `self` AND NOT `blocked` AND (NOT `ap-posting-restricted` OR `ap-posting-restricted` IS NULL) AND `contact-type` = ?", Contact::TYPE_COMMUNITY
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case self::TYPE_PRIVATE_MESSAGE:
|
case self::TYPE_PRIVATE_MESSAGE:
|
||||||
$condition = DBA::mergeConditions($condition,
|
$condition = DBA::mergeConditions(
|
||||||
|
$condition,
|
||||||
["NOT `self` AND NOT `blocked` AND `network` IN (?, ?, ?)", Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA
|
["NOT `self` AND NOT `blocked` AND `network` IN (?, ?, ?)", Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +190,8 @@ class Acl extends BaseModule
|
||||||
if ($type == self::TYPE_MENTION_CONTACT_CIRCLE || $type == self::TYPE_MENTION_CIRCLE) {
|
if ($type == self::TYPE_MENTION_CONTACT_CIRCLE || $type == self::TYPE_MENTION_CIRCLE) {
|
||||||
/// @todo We should cache this query.
|
/// @todo We should cache this query.
|
||||||
// This can be done when we can delete cache entries via wildcard
|
// This can be done when we can delete cache entries via wildcard
|
||||||
$circles = $this->database->toArray($this->database->p("SELECT `circle`.`id`, `circle`.`name`, GROUP_CONCAT(DISTINCT `circle_member`.`contact-id` SEPARATOR ',') AS uids
|
$circles = $this->database->toArray($this->database->p(
|
||||||
|
"SELECT `circle`.`id`, `circle`.`name`, GROUP_CONCAT(DISTINCT `circle_member`.`contact-id` SEPARATOR ',') AS uids
|
||||||
FROM `group` AS `circle`
|
FROM `group` AS `circle`
|
||||||
INNER JOIN `group_member` AS `circle_member` ON `circle_member`.`gid` = `circle`.`id`
|
INNER JOIN `group_member` AS `circle_member` ON `circle_member`.`gid` = `circle`.`id`
|
||||||
WHERE NOT `circle`.`deleted` AND `circle`.`uid` = ?
|
WHERE NOT `circle`.`deleted` AND `circle`.`uid` = ?
|
||||||
|
|
|
@ -111,7 +111,7 @@ class Index extends BaseSettings
|
||||||
|
|
||||||
if (strpos($dob, '0000-') === 0 || strpos($dob, '0001-') === 0) {
|
if (strpos($dob, '0000-') === 0 || strpos($dob, '0001-') === 0) {
|
||||||
$ignore_year = true;
|
$ignore_year = true;
|
||||||
$dob = substr($dob, 5);
|
$dob = substr($dob, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ignore_year) {
|
if ($ignore_year) {
|
||||||
|
@ -245,7 +245,7 @@ class Index extends BaseSettings
|
||||||
$this->session->getLocalUserId(),
|
$this->session->getLocalUserId(),
|
||||||
false,
|
false,
|
||||||
['allow_cid' => []],
|
['allow_cid' => []],
|
||||||
['network' => Protocol::DFRN],
|
['network' => Protocol::DFRN],
|
||||||
'profile_field[new]'
|
'profile_field[new]'
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -278,7 +278,8 @@ class Index extends BaseSettings
|
||||||
'miscellaneous_section' => $this->t('Miscellaneous'),
|
'miscellaneous_section' => $this->t('Miscellaneous'),
|
||||||
'custom_fields_section' => $this->t('Custom Profile Fields'),
|
'custom_fields_section' => $this->t('Custom Profile Fields'),
|
||||||
'profile_photo' => $this->t('Upload Profile Photo'),
|
'profile_photo' => $this->t('Upload Profile Photo'),
|
||||||
'custom_fields_description' => $this->t('<p>Custom fields appear on <a href="%s">your profile page</a>.</p>
|
'custom_fields_description' => $this->t(
|
||||||
|
'<p>Custom fields appear on <a href="%s">your profile page</a>.</p>
|
||||||
<p>You can use BBCodes in the field values.</p>
|
<p>You can use BBCodes in the field values.</p>
|
||||||
<p>Reorder by dragging the field title.</p>
|
<p>Reorder by dragging the field title.</p>
|
||||||
<p>Empty the label field to remove a custom field.</p>
|
<p>Empty the label field to remove a custom field.</p>
|
||||||
|
@ -314,7 +315,7 @@ class Index extends BaseSettings
|
||||||
|
|
||||||
$hook_data = [
|
$hook_data = [
|
||||||
'profile' => $owner,
|
'profile' => $owner,
|
||||||
'entry' => $o,
|
'entry' => $o,
|
||||||
];
|
];
|
||||||
|
|
||||||
$hook_data = $this->eventDispatcher->dispatch(
|
$hook_data = $this->eventDispatcher->dispatch(
|
||||||
|
|
|
@ -74,12 +74,12 @@ class Notify extends BaseRepository
|
||||||
EventDispatcherInterface $eventDispatcher,
|
EventDispatcherInterface $eventDispatcher,
|
||||||
Factory\Notify $factory = null
|
Factory\Notify $factory = null
|
||||||
) {
|
) {
|
||||||
$this->l10n = $l10n;
|
$this->l10n = $l10n;
|
||||||
$this->baseUrl = $baseUrl;
|
$this->baseUrl = $baseUrl;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->pConfig = $pConfig;
|
$this->pConfig = $pConfig;
|
||||||
$this->emailer = $emailer;
|
$this->emailer = $emailer;
|
||||||
$this->notification = $notification;
|
$this->notification = $notification;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
|
|
||||||
parent::__construct($database, $logger, $factory ?? new Factory\Notify($logger));
|
parent::__construct($database, $logger, $factory ?? new Factory\Notify($logger));
|
||||||
|
|
|
@ -376,7 +376,7 @@ class StorageManagerTest extends DatabaseTestCase
|
||||||
$this->l10n,
|
$this->l10n,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
$storage = $storageManager->getWritableStorageByName($name);
|
$storage = $storageManager->getWritableStorageByName($name);
|
||||||
$storageManager->move($storage);
|
$storageManager->move($storage);
|
||||||
|
|
||||||
$photos = $this->database->select('photo', ['backend-ref', 'backend-class', 'id', 'data']);
|
$photos = $this->database->select('photo', ['backend-ref', 'backend-class', 'id', 'data']);
|
||||||
|
@ -407,7 +407,7 @@ class StorageManagerTest extends DatabaseTestCase
|
||||||
$this->l10n,
|
$this->l10n,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
$storage = $storageManager->getWritableStorageByName(SystemResource::getName());
|
$storage = $storageManager->getWritableStorageByName(SystemResource::getName());
|
||||||
$storageManager->move($storage);
|
$storageManager->move($storage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue