use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact as ContactModel;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact as ContactModel;
if (local_user() && $a->argc > 2 && $a->argv[2] === 'view') {
self::$which = $a->user['nickname'];
self::$profile = filter_var($a->argv[1], FILTER_SANITIZE_NUMBER_INT);
if (local_user() && $a->argc > 2 && $a->argv[2] === 'view') {
self::$which = $a->user['nickname'];
self::$profile = filter_var($a->argv[1], FILTER_SANITIZE_NUMBER_INT);
{
if (ActivityPub::isRequest()) {
$user = DBA::selectFirst('user', ['uid'], ['nickname' => self::$which]);
{
if (ActivityPub::isRequest()) {
$user = DBA::selectFirst('user', ['uid'], ['nickname' => self::$which]);
- if (!empty($data)) {
- System::jsonExit($data, 'application/activity+json');
- } elseif (DBA::exists('userd', ['username' => self::$which])) {
+ if (DBA::exists('userd', ['username' => self::$which])) {
// Known deleted user
$data = ActivityPub\Transmitter::getDeletedUser(self::$which);
System::jsonError(410, $data);
} else {
// Any other case (unknown, blocked, unverified, expired, no profile, no self contact)
// Known deleted user
$data = ActivityPub\Transmitter::getDeletedUser(self::$which);
System::jsonError(410, $data);
} else {
// Any other case (unknown, blocked, unverified, expired, no profile, no self contact)
- $blocked = !local_user() && !remote_user() && Config::get('system', 'block_public');
- $userblock = !local_user() && !remote_user() && $a->profile['hidewall'];
+ $a->page['htmlhead'] .= "\n";
+
+ $blocked = !local_user() && !Session::getRemoteContactID($a->profile['profile_uid']) && Config::get('system', 'block_public');
+ $userblock = !local_user() && !Session::getRemoteContactID($a->profile['profile_uid']) && $a->profile['hidewall'];
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . self::$which . '" title="DFRN: ' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . self::$which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . self::$which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . self::$which . '" title="DFRN: ' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . self::$which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . self::$which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\n";
- $last_updated_key = "profile:" . $a->profile['profile_uid'] . ":" . local_user() . ":" . remote_user();
-
- if ($remote_contact) {
- $cdata = ContactModel::getPublicAndUserContacID(remote_user(), $a->profile['profile_uid']);
- if (!empty($cdata['user'])) {
- $groups = Group::getIdsByContactId($cdata['user']);
- $remote_cid = $cdata['user'];
- }
- }
+ $last_updated_key = "profile:" . $a->profile['profile_uid'] . ":" . local_user() . ":" . $remote_contact;
if (!empty($a->profile['hidewall']) && !$is_owner && !$remote_contact) {
notice(L10n::t('Access to this profile has been restricted.') . EOL);
if (!empty($a->profile['hidewall']) && !$is_owner && !$remote_contact) {
notice(L10n::t('Access to this profile has been restricted.') . EOL);
// If the page user is the owner of the page we should query for unseen
// items. Otherwise use a timestamp of the last succesful update request.
// If the page user is the owner of the page we should query for unseen
// items. Otherwise use a timestamp of the last succesful update request.
- $sql_extra2 .= Strings::protectSprintf(sprintf(" AND `thread`.`created` <= '%s' ", DBA::escape(DateTimeFormat::convert($datequery, 'UTC', date_default_timezone_get()))));
+ $sql_extra2 .= Strings::protectSprintf(sprintf(" AND `thread`.`received` <= '%s' ", DBA::escape(DateTimeFormat::convert($datequery, 'UTC', date_default_timezone_get()))));
- $sql_extra2 .= Strings::protectSprintf(sprintf(" AND `thread`.`created` >= '%s' ", DBA::escape(DateTimeFormat::convert($datequery2, 'UTC', date_default_timezone_get()))));
+ $sql_extra2 .= Strings::protectSprintf(sprintf(" AND `thread`.`received` >= '%s' ", DBA::escape(DateTimeFormat::convert($datequery2, 'UTC', date_default_timezone_get()))));
// Set a time stamp for this page. We will make use of it when we
// search for new items (update routine)
// Set a time stamp for this page. We will make use of it when we
// search for new items (update routine)
if ($is_owner && !$update && !Config::get('theme', 'hide_eventlist')) {
$o .= ProfileModel::getBirthdays();
if ($is_owner && !$update && !Config::get('theme', 'hide_eventlist')) {
$o .= ProfileModel::getBirthdays();
- $o .= conversation($a, $items, $pager, 'profile', $update, false, 'created', $a->profile['profile_uid']);
+ $o .= conversation($a, $items, $pager, 'profile', $update, false, 'received', $a->profile['profile_uid']);