<?php
/**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
*/
function match_content(App $a)
{
- if (!local_user()) {
+ if (!DI::userSession()->getLocalUserId()) {
return '';
}
$_SESSION['return_path'] = DI::args()->getCommand();
- $profile = Profile::getByUID(local_user());
+ $profile = Profile::getByUID(DI::userSession()->getLocalUserId());
if (!DBA::isResult($profile)) {
return '';
}
if (!$profile['pub_keywords'] && (!$profile['prv_keywords'])) {
- notice(DI::l10n()->t('No keywords to match. Please add keywords to your profile.'));
+ DI::sysmsg()->addNotice(DI::l10n()->t('No keywords to match. Please add keywords to your profile.'));
return '';
}
$tags = trim($profile['pub_keywords'] . ' ' . $profile['prv_keywords']);
if (DI::mode()->isMobile()) {
- $limit = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
+ $limit = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_mobile_network',
DI::config()->get('system', 'itemspage_network_mobile'));
} else {
- $limit = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
+ $limit = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_network',
DI::config()->get('system', 'itemspage_network'));
}
continue;
}
- $msearch = json_decode(DI::httpRequest()->post($server . '/msearch', $params)->getBody());
+ $msearch = json_decode(DI::httpClient()->post($server . '/msearch', $params)->getBody());
if (!empty($msearch)) {
$entries = match_get_contacts($msearch, $entries, $limit);
}
}
if (empty($entries)) {
- info(DI::l10n()->t('No matches'));
+ DI::sysmsg()->addInfo(DI::l10n()->t('No matches'));
}
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
}
// Already known contact
- $contact = Contact::getByURL($profile->url, null, ['rel'], local_user());
+ $contact = Contact::getByURL($profile->url, null, ['rel'], DI::userSession()->getLocalUserId());
if (!empty($contact) && in_array($contact['rel'], [Contact::FRIEND, Contact::SHARING])) {
continue;
}
- $contact = Contact::getByURLForUser($profile->url, local_user());
+ $contact = Contact::getByURLForUser($profile->url, DI::userSession()->getLocalUserId());
if (!empty($contact)) {
$entries[$contact['id']] = ModuleContact::getContactTemplateVars($contact);
}