X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FContact.php;h=fe9869c6f88065386a8a918b11ac88e555e5096a;hb=bffdf96d8791db3f5c1aaede9b3f7416fb189f38;hp=f4d6f2af0eb2117ba5e7987a0ecca6cb24459c0b;hpb=541f8634c0658dbafdbc1c50598737f7be133aa6;p=friendica.git diff --git a/src/Model/Contact.php b/src/Model/Contact.php index f4d6f2af0e..fe9869c6f8 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -944,21 +944,36 @@ class Contact extends BaseObject 'name' => $data['name'], 'nick' => $data['nick']]; - // Only fill the pubkey if it was empty before. We have to prevent identity theft. - if (!empty($contact['pubkey'])) { - unset($contact['pubkey']); - } else { - $updated['pubkey'] = $data['pubkey']; - } - if ($data['keywords'] != '') { $updated['keywords'] = $data['keywords']; } if ($data['location'] != '') { $updated['location'] = $data['location']; } - if ($data['about'] != '') { - $updated['about'] = $data['about']; + + // Update the technical stuff as well - if filled + if ($data['notify'] != '') { + $updated['notify'] = $data['notify']; + } + if ($data['poll'] != '') { + $updated['poll'] = $data['poll']; + } + if ($data['batch'] != '') { + $updated['batch'] = $data['batch']; + } + if ($data['request'] != '') { + $updated['request'] = $data['request']; + } + if ($data['confirm'] != '') { + $updated['confirm'] = $data['confirm']; + } + if ($data['poco'] != '') { + $updated['poco'] = $data['poco']; + } + + // Only fill the pubkey if it had been empty before. We have to prevent identity theft. + if (empty($contact['pubkey'])) { + $updated['pubkey'] = $data['pubkey']; } if (($data["addr"] != $contact["addr"]) || ($data["alias"] != $contact["alias"])) { @@ -1040,24 +1055,26 @@ class Contact extends BaseObject } if (in_array($r[0]["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""])) { - $sql = "(`item`.`uid` = 0 OR (`item`.`uid` = %d AND NOT `item`.`global`))"; + $sql = "(`item`.`uid` = 0 OR (`item`.`uid` = ? AND NOT `item`.`global`))"; } else { - $sql = "`item`.`uid` = %d"; + $sql = "`item`.`uid` = ?"; } $author_id = intval($r[0]["author-id"]); $contact = ($r[0]["contact-type"] == ACCOUNT_TYPE_COMMUNITY ? 'owner-id' : 'author-id'); - $r = q(item_query(local_user()) . " AND `item`.`" . $contact . "` = %d AND " . $sql . - " AND `item`.`verb` = '%s' ORDER BY `item`.`created` DESC LIMIT %d, %d", - intval($author_id), intval(local_user()), dbesc(ACTIVITY_POST), - intval($a->pager['start']), intval($a->pager['itemspage']) - ); + $condition = ["`$contact` = ? AND `gravity` IN (?, ?) AND " . $sql, + $author_id, GRAVITY_PARENT, GRAVITY_COMMENT, local_user()]; + $params = ['order' => ['created' => true], + 'limit' => [$a->pager['start'], $a->pager['itemspage']]]; + $r = Item::selectForUser(local_user(), [], $condition, $params); + + $items = Item::inArray($r); - $o = conversation($a, $r, 'contact-posts', false); + $o = conversation($a, $items, 'contact-posts', false); - $o .= alt_pager($a, count($r)); + $o .= alt_pager($a, count($items)); return $o; }