*/
public function __construct(Database $dba, IManageConfigValues $config, LoggerInterface $logger, EventDispatcherInterface $eventDispatcher, L10n $l10n, bool $includeAddon = true)
{
- $this->dba = $dba;
- $this->config = $config;
- $this->logger = $logger;
+ $this->dba = $dba;
+ $this->config = $config;
+ $this->logger = $logger;
$this->eventDispatcher = $eventDispatcher;
- $this->l10n = $l10n;
- $this->validBackends = $config->get('storage', 'backends', self::DEFAULT_BACKENDS);
+ $this->l10n = $l10n;
+ $this->validBackends = $config->get('storage', 'backends', self::DEFAULT_BACKENDS);
$currentName = $this->config->get('storage', 'name');
$hook_data = [
'rendered-html' => $item['rendered-html'],
'rendered-hash' => $item['rendered-hash'],
- 'item' => $item,
+ 'item' => $item,
];
$eventDispatcher = DI::eventDispatcher();
$hook_data = [
'profile' => &$profile,
- 'entry' => &$o,
+ 'entry' => &$o,
];
$hook_data = $eventDispatcher->dispatch(
)->getArray();
$profile = $hook_data['profile'] ?? $profile;
- $o = $hook_data['entry'] ?? $o;
+ $o = $hook_data['entry'] ?? $o;
return $o;
}
$this->baseUrl->redirect('contact/' . $contact['id']);
}
- $vcard_widget = Widget\VCard::getHTML($contact);
+ $vcard_widget = Widget\VCard::getHTML($contact);
$circles_widget = '';
if (!in_array($localRelationship->rel, [ContactModel::NOTHING, ContactModel::SELF])) {
]);
switch ($localRelationship->rel) {
- case ContactModel::FRIEND: $relation_text = $this->t('You are mutual friends with %s', $contact['name']); 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;
+ case ContactModel::FRIEND:
+ $relation_text = $this->t('You are mutual friends with %s', $contact['name']);
+ 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:
$relation_text = '';
}
$this->logger->notice('Empty gsid for contact', ['contact' => $contact]);
}
- $serverIgnored =
- $contact['gsid'] &&
+ $serverIgnored = $contact['gsid'] &&
$this->userGServer->isIgnoredByUser($this->session->getLocalUserId(), $contact['gsid']) ?
$this->t('This contact is on a server you ignored.')
: '';
$hook_data = [
'contact' => $contact,
- 'output' => $o,
+ 'output' => $o,
];
$hook_data = $this->eventDispatcher->dispatch(
use Friendica\Core\ACL;
use Friendica\Core\Cache\Capability\ICanCache;
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\Content\Nav;
use Friendica\Content\Pager;
use Friendica\Content\Widget;
-use Friendica\Core\Hook;
use Friendica\Core\Renderer;
use Friendica\Core\Search;
use Friendica\DI;
DI::page()['aside'] .= Widget::follow();
}
- $output = '';
+ $output = '';
$entries = [];
Nav::setSelected('directory');
$search = trim(rawurldecode($_REQUEST['search'] ?? ''));
$gDirPath = '';
- $dirURL = Search::getGlobalDirectory();
+ $dirURL = Search::getGlobalDirectory();
if (strlen($dirURL)) {
$gDirPath = OpenWebAuth::getZrlUrl($dirURL, true);
}
$hook_data = [
'contact' => $contact,
- 'entry' => $entry,
+ 'entry' => $entry,
];
$hook_data = $eventDispatcher->dispatch(
) {
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
- $this->config = $config;
- $this->keyValue = $keyValue;
- $this->session = $session;
+ $this->config = $config;
+ $this->keyValue = $keyValue;
+ $this->session = $session;
$this->eventDispatcher = $eventDispatcher;
- $this->addonHelper = $addonHelper;
+ $this->addonHelper = $addonHelper;
}
protected function content(array $request = []): string
) {
parent::__construct($page, $appHelper, $systemMessages, $session, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
- $this->database = $database;
+ $this->database = $database;
$this->eventDispatcher = $eventDispatcher;
}
];
$hook_data = [
- 'tabs' => $tabs,
+ 'tabs' => $tabs,
'selectedTab' => $selectedTab,
];
{
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
- $this->userSession = $userSession;
+ $this->userSession = $userSession;
$this->eventDispatcher = $eventDispatcher;
}
throw new \Friendica\Network\HTTPException\ForbiddenException();
}
- $format = '';
- $title = '';
+ $format = '';
+ $title = '';
$description = '';
- $ret = ['success' => false, 'contentType' => ''];
+ $ret = ['success' => false, 'contentType' => ''];
if (!empty($_GET['binurl']) && Util\Strings::isHex($_GET['binurl'])) {
$url = trim(hex2bin($_GET['binurl']));
}
$hook_data = [
- 'url' => $url,
+ 'url' => $url,
'format' => $format,
- 'text' => null,
+ 'text' => null,
];
$hook_data = $this->eventDispatcher->dispatch(
}
$ret['contentType'] = $content_type;
- $ret['data'] = ['url' => $url];
- $ret['success'] = true;
+ $ret['data'] = ['url' => $url];
+ $ret['success'] = true;
} else {
unset($siteinfo['keywords']);
- $ret['data'] = $siteinfo;
+ $ret['data'] = $siteinfo;
$ret['contentType'] = 'attachment';
- $ret['success'] = true;
+ $ret['success'] = true;
}
$this->jsonExit($ret);
) {
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
- $this->dba = $dba;
- $this->aclFormatter = $aclFormatter;
- $this->session = $session;
- $this->config = $config;
- $this->permissionSet = $permissionSet;
+ $this->dba = $dba;
+ $this->aclFormatter = $aclFormatter;
+ $this->session = $session;
+ $this->config = $config;
+ $this->permissionSet = $permissionSet;
$this->eventDispatcher = $eventDispatcher;
}
protected function rawContent(array $request = [])
{
- $type = $this->parameters['type'];
+ $type = $this->parameters['type'];
$referenceId = $this->parameters['id'];
$expectedTypes = ['item', 'photo', 'event'];
$condition = ['id' => $referenceId, 'uid' => [0, $this->session->getLocalUserId()]];
if ($type == 'item') {
$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)) {
- $permissionSet = $this->permissionSet->selectOneById($model['psid'], $model['uid']);
+ $permissionSet = $this->permissionSet->selectOneById($model['psid'], $model['uid']);
$model['allow_cid'] = $permissionSet->allow_cid;
$model['allow_gid'] = $permissionSet->allow_gid;
$model['deny_cid'] = $permissionSet->deny_cid;
$model['deny_gid'] = [];
}
} else {
- $fields = ['uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'];
- $model = $this->dba->selectFirst($type, $fields, $condition);
+ $fields = ['uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'];
+ $model = $this->dba->selectFirst($type, $fields, $condition);
$model['allow_cid'] = $this->aclFormatter->expand($model['allow_cid']);
$model['allow_gid'] = $this->aclFormatter->expand($model['allow_gid']);
$model['deny_cid'] = $this->aclFormatter->expand($model['deny_cid']);
$model = $hook_data['model'] ?? $model;
- $aclReceivers = new Entity\AclReceivers();
+ $aclReceivers = new Entity\AclReceivers();
$addressedReceivers = new Entity\AddressedReceivers();
if (!empty($model['allow_cid']) || !empty($model['allow_gid']) || !empty($model['deny_cid']) || !empty($model['deny_gid'])) {
$aclReceivers = $this->fetchReceiversFromACL($model);
$privacy = '';
switch ($model['private'] ?? null) {
- case Model\Item::PUBLIC: $privacy = $this->t('Public'); break;
- case Model\Item::UNLISTED: $privacy = $this->t('Unlisted'); break;
- case Model\Item::PRIVATE: $privacy = $this->t('Limited/Private'); break;
+ case Model\Item::PUBLIC:
+ $privacy = $this->t('Public');
+ 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.');
exit;
}
- $tpl = Renderer::getMarkupTemplate('privacy/permission_tooltip.tpl');
+ $tpl = Renderer::getMarkupTemplate('privacy/permission_tooltip.tpl');
$output = Renderer::replaceMacros($tpl, [
'$l10n' => [
'visible_to' => $this->t('Visible to:'),
- 'to' => $this->t('To:'),
- 'cc' => $this->t('CC:'),
- 'bcc' => $this->t('BCC:'),
- 'audience' => $this->t('Audience:'),
+ 'to' => $this->t('To:'),
+ 'cc' => $this->t('CC:'),
+ 'bcc' => $this->t('BCC:'),
+ 'audience' => $this->t('Audience:'),
'attributed' => $this->t('Attributed To:'),
],
- '$aclReceivers' => $aclReceivers,
+ '$aclReceivers' => $aclReceivers,
'$addressedReceivers' => $addressedReceivers,
- '$privacy' => $privacy,
+ '$privacy' => $privacy,
]);
$this->httpExit($output);
private function fetchAddressedReceivers(int $uriId): Entity\AddressedReceivers
{
$own_url = '';
- $uid = $this->session->getLocalUserId();
+ $uid = $this->session->getLocalUserId();
if ($uid) {
$owner = Model\User::getOwnerDataById($uid);
if (!empty($owner['url'])) {
$receivers[$receiver['type']][] = $this->t('Collection (%s)', $receiver['name']);
break;
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']);
break;
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'];
break;
default:
}
foreach ($receivers as $type => $receiver) {
- $max = $this->config->get('system', 'max_receivers');
+ $max = $this->config->get('system', 'max_receivers');
$total = count($receiver);
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);
}
}
return new Entity\AddressedReceivers(
- $receivers[Model\Tag::TO] ?? [],
- $receivers[Model\Tag::CC] ?? [],
- $receivers[Model\Tag::BCC] ?? [],
- $receivers[Model\Tag::AUDIENCE] ?? [],
+ $receivers[Model\Tag::TO] ?? [],
+ $receivers[Model\Tag::CC] ?? [],
+ $receivers[Model\Tag::BCC] ?? [],
+ $receivers[Model\Tag::AUDIENCE] ?? [],
$receivers[Model\Tag::ATTRIBUTED] ?? [],
);
}
) {
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
- $this->session = $session;
- $this->page = $page;
- $this->config = $config;
- $this->appHelper = $appHelper;
- $this->database = $database;
- $this->systemMessages = $systemMessages;
- $this->aclFormatter = $aclFormatter;
+ $this->session = $session;
+ $this->page = $page;
+ $this->config = $config;
+ $this->appHelper = $appHelper;
+ $this->database = $database;
+ $this->systemMessages = $systemMessages;
+ $this->aclFormatter = $aclFormatter;
$this->eventDispatcher = $eventDispatcher;
$owner = Profile::load($this->appHelper, $this->parameters['nickname'] ?? '', false);
if ($visibility === 'public') {
// 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 = '';
- } 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
// 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
}
$hook_data = [
- 'src' => '',
+ 'src' => '',
'filename' => '',
'filesize' => 0,
- 'type' => '',
+ 'type' => '',
];
$hook_data = $this->eventDispatcher->dispatch(
$type = $_FILES['userfile']['type'];
$error = $_FILES['userfile']['error'];
} else {
- $error = UPLOAD_ERR_NO_FILE;
+ $error = UPLOAD_ERR_NO_FILE;
}
if ($error !== UPLOAD_ERR_OK) {
$arr['visible'] = $visible;
$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);
// Update the photo albums cache
$pager->getItemsPerPage()
));
- $photos = array_map(function ($photo){
+ $photos = array_map(function ($photo) {
return [
'id' => $photo['id'],
'link' => 'photos/' . $this->owner['nickname'] . '/image/' . $photo['resource-id'],
) {
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
- $this->database = $database;
- $this->appHelper = $appHelper;
- $this->session = $session;
- $this->config = $config;
- $this->page = $page;
- $this->profileField = $profileField;
+ $this->database = $database;
+ $this->appHelper = $appHelper;
+ $this->session = $session;
+ $this->config = $config;
+ $this->page = $page;
+ $this->profileField = $profileField;
$this->eventDispatcher = $eventDispatcher;
}
}
$tpl = Renderer::getMarkupTemplate('profile/profile.tpl');
- $o .= Renderer::replaceMacros($tpl, [
+ $o .= Renderer::replaceMacros($tpl, [
'$title' => $this->t('Profile'),
'$yourself' => $this->t('Yourself'),
'$view_as_contacts' => $view_as_contacts,
'title' => '',
'label' => $this->t('Edit profile')
],
- '$viewas_link' => [
+ '$viewas_link' => [
'url' => $this->args->getQueryString() . '#viewas',
'title' => '',
'label' => $this->t('View as')
$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 . '/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";
header('Link: <' . $this->baseUrl . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
$this->tos = new Tos($l10n, $baseUrl, $args, $logger, $profiler, $response, $config, $server, $parameters);
- $this->session = $session;
+ $this->session = $session;
$this->eventDispatcher = $eventDispatcher;
}
) {
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
- $this->session = $session;
- $this->database = $database;
+ $this->session = $session;
+ $this->database = $database;
$this->eventDispatcher = $eventDispatcher;
}
private function regularContactSearch(array $request, string $type): array
{
- $start = $request['start'] ?? 0;
- $count = $request['count'] ?? 100;
- $search = $request['search'] ?? '';
+ $start = $request['start'] ?? 0;
+ $count = $request['count'] ?? 100;
+ $search = $request['search'] ?? '';
$conv_id = $request['conversation'] ?? null;
// For use with jquery.textcomplete for private mail completion
$condition_circle = ["`uid` = ? AND NOT `deleted`", $this->session->getLocalUserId()];
if ($search != '') {
- $sql_extra = "AND `name` LIKE '%%" . $this->database->escape($search) . "%%'";
- $condition = DBA::mergeConditions($condition, ["(`attag` LIKE ? OR `name` LIKE ? OR `nick` LIKE ?)",
- '%' . $search . '%', '%' . $search . '%', '%' . $search . '%']);
+ $sql_extra = "AND `name` LIKE '%%" . $this->database->escape($search) . "%%'";
+ $condition = DBA::mergeConditions($condition, ["(`attag` LIKE ? OR `name` LIKE ? OR `nick` LIKE ?)",
+ '%' . $search . '%', '%' . $search . '%', '%' . $search . '%']);
$condition_circle = DBA::mergeConditions($condition_circle, ["`name` LIKE ?", '%' . $search . '%']);
}
switch ($type) {
case self::TYPE_MENTION_CONTACT_CIRCLE:
case self::TYPE_MENTION_CONTACT:
- $condition = DBA::mergeConditions($condition,
+ $condition = DBA::mergeConditions(
+ $condition,
["NOT `self` AND NOT `blocked`",
- ]);
+ ]
+ );
break;
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
- ]);
+ ]
+ );
break;
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
- ]);
+ ]
+ );
break;
}
if ($type == self::TYPE_MENTION_CONTACT_CIRCLE || $type == self::TYPE_MENTION_CIRCLE) {
/// @todo We should cache this query.
// 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`
INNER JOIN `group_member` AS `circle_member` ON `circle_member`.`gid` = `circle`.`id`
WHERE NOT `circle`.`deleted` AND `circle`.`uid` = ?
if (strpos($dob, '0000-') === 0 || strpos($dob, '0001-') === 0) {
$ignore_year = true;
- $dob = substr($dob, 5);
+ $dob = substr($dob, 5);
}
if ($ignore_year) {
$this->session->getLocalUserId(),
false,
['allow_cid' => []],
- ['network' => Protocol::DFRN],
+ ['network' => Protocol::DFRN],
'profile_field[new]'
),
],
'miscellaneous_section' => $this->t('Miscellaneous'),
'custom_fields_section' => $this->t('Custom Profile Fields'),
'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>Reorder by dragging the field title.</p>
<p>Empty the label field to remove a custom field.</p>
$hook_data = [
'profile' => $owner,
- 'entry' => $o,
+ 'entry' => $o,
];
$hook_data = $this->eventDispatcher->dispatch(
EventDispatcherInterface $eventDispatcher,
Factory\Notify $factory = null
) {
- $this->l10n = $l10n;
- $this->baseUrl = $baseUrl;
- $this->config = $config;
- $this->pConfig = $pConfig;
- $this->emailer = $emailer;
- $this->notification = $notification;
+ $this->l10n = $l10n;
+ $this->baseUrl = $baseUrl;
+ $this->config = $config;
+ $this->pConfig = $pConfig;
+ $this->emailer = $emailer;
+ $this->notification = $notification;
$this->eventDispatcher = $eventDispatcher;
parent::__construct($database, $logger, $factory ?? new Factory\Notify($logger));
$this->l10n,
false
);
- $storage = $storageManager->getWritableStorageByName($name);
+ $storage = $storageManager->getWritableStorageByName($name);
$storageManager->move($storage);
$photos = $this->database->select('photo', ['backend-ref', 'backend-class', 'id', 'data']);
$this->l10n,
false
);
- $storage = $storageManager->getWritableStorageByName(SystemResource::getName());
+ $storage = $storageManager->getWritableStorageByName(SystemResource::getName());
$storageManager->move($storage);
}
}