}
if ($item["id"] != $item["parent"]) {
- $item = Item::selectFirstForUser($item_user, $fields, ['id' => $item["parent"]]);
+ $parent = Item::selectFirstForUser($item_user, $fields, ['id' => $item["parent"]]);
+ $item = $parent ?: $item;
}
$profiledata = display_fetchauthor($a, $item);
$is_remote_contact = false;
$item_uid = local_user();
- if (isset($item_parent_uri)) {
+ $parent = null;
+ if (!empty($item_parent_uri)) {
$parent = Item::selectFirst(['uid'], ['uri' => $item_parent_uri, 'wall' => true]);
- if (DBA::isResult($parent)) {
- $a->profile['uid'] = ($a->profile['uid'] ?? 0) ?: $parent['uid'];
- $a->profile['profile_uid'] = ($a->profile['profile_uid'] ?? 0) ?: $parent['uid'];
- $is_remote_contact = Session::getRemoteContactID($a->profile['profile_uid']);
- if ($is_remote_contact) {
- $item_uid = $parent['uid'];
- }
+ }
+
+ if (DBA::isResult($parent)) {
+ $a->profile['uid'] = ($a->profile['uid'] ?? 0) ?: $parent['uid'];
+ $a->profile['profile_uid'] = ($a->profile['profile_uid'] ?? 0) ?: $parent['uid'];
+ $is_remote_contact = Session::getRemoteContactID($a->profile['profile_uid']);
+ if ($is_remote_contact) {
+ $item_uid = $parent['uid'];
}
+ } else {
+ $a->profile = ['uid' => intval($item['uid']), 'profile_uid' => intval($item['uid'])];
}
$page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]);
$type = 'post';
$doesFederate = true;
- if ($_REQUEST['contact_allow']
- . $_REQUEST['group_allow']
- . $_REQUEST['contact_deny']
- . $_REQUEST['group_deny'])
+ $contact_allow = $_REQUEST['contact_allow'] ?? '';
+ $group_allow = $_REQUEST['group_allow'] ?? '';
+ $contact_deny = $_REQUEST['contact_deny'] ?? '';
+ $group_deny = $_REQUEST['group_deny'] ?? '';
+
+ if ($contact_allow
+ . $group_allow
+ . $contact_deny
+ . $group_deny)
{
- $contact_allow_list = $_REQUEST['contact_allow'] ? explode(',', $_REQUEST['contact_allow']) : [];
- $group_allow_list = $_REQUEST['group_allow'] ? explode(',', $_REQUEST['group_allow']) : [];
- $contact_deny_list = $_REQUEST['contact_deny'] ? explode(',', $_REQUEST['contact_deny']) : [];
- $group_deny_list = $_REQUEST['group_deny'] ? explode(',', $_REQUEST['group_deny']) : [];
+ $contact_allow_list = $contact_allow ? explode(',', $contact_allow) : [];
+ $group_allow_list = $group_allow ? explode(',', $group_allow) : [];
+ $contact_deny_list = $contact_deny ? explode(',', $contact_deny) : [];
+ $group_deny_list = $group_deny ? explode(',', $group_deny) : [];
}
break;