'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"])) {
if (!in_array($cmd, [Delivery::MAIL, Delivery::SUGGESTION, Delivery::RELOCATION])) {
$parent = $items[0];
- $thr_parent = q("SELECT `network`, `author-link`, `owner-link` FROM `item` WHERE `uri` = '%s' AND `uid` = %d",
- dbesc($target_item["thr-parent"]), intval($target_item["uid"]));
+ $fields = ['network', 'author-id', 'owner-id'];
+ $condition = ['uri' => $target_item["thr-parent"], 'uid' => $target_item["uid"]];
+ $thr_parent = dba::selectFirst('item', $fields, $condition);
- logger('GUID: '.$target_item["guid"].': Parent is '.$parent['network'].'. Thread parent is '.$thr_parent[0]['network'], LOGGER_DEBUG);
+ logger('GUID: '.$target_item["guid"].': Parent is '.$parent['network'].'. Thread parent is '.$thr_parent['network'], LOGGER_DEBUG);
// This is IMPORTANT!!!!
}
// Special treatment for forum posts
- if (($target_item['author-link'] != $target_item['owner-link']) &&
+ if (($target_item['author-id'] != $target_item['owner-id']) &&
($owner['id'] != $target_item['contact-id']) &&
($target_item['uri'] === $target_item['parent-uri'])) {
$target_item['deny_cid'].$target_item['deny_gid']) == 0))
$push_notify = true;
- if (($thr_parent && ($thr_parent[0]['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
+ if (($thr_parent && ($thr_parent['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
$push_notify = true;
if ($parent["network"] == NETWORK_OSTATUS) {
// If the thread parent is OStatus then do some magic to distribute the messages.
// We have not only to look at the parent, since it could be a Friendica thread.
- if (($thr_parent && ($thr_parent[0]['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
+ if (($thr_parent && ($thr_parent['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
$diaspora_delivery = false;
- logger('Some parent is OStatus for '.$target_item["guid"]." - Author: ".$thr_parent[0]['author-link']." - Owner: ".$thr_parent[0]['owner-link'], LOGGER_DEBUG);
+ logger('Some parent is OStatus for '.$target_item["guid"]." - Author: ".$thr_parent['author-id']." - Owner: ".$thr_parent['owner-id'], LOGGER_DEBUG);
// Send a salmon to the parent author
- $r = q("SELECT `url`, `notify` FROM `contact` WHERE `nurl`='%s' AND `uid` IN (0, %d) AND `notify` != ''",
- dbesc(normalise_link($thr_parent[0]['author-link'])),
- intval($uid));
- if (DBM::is_result($r)) {
- $probed_contact = $r[0];
- } else {
- $probed_contact = Probe::uri($thr_parent[0]['author-link']);
- }
-
- if ($probed_contact["notify"] != "") {
+ $probed_contact = dba::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]);
+ if (DBM::is_result($probed_contact) && !empty($probed_contact["notify"])) {
logger('Notify parent author '.$probed_contact["url"].': '.$probed_contact["notify"]);
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
}
// Send a salmon to the parent owner
- $r = q("SELECT `url`, `notify` FROM `contact` WHERE `nurl`='%s' AND `uid` IN (0, %d) AND `notify` != ''",
- dbesc(normalise_link($thr_parent[0]['owner-link'])),
- intval($uid));
- if (DBM::is_result($r)) {
- $probed_contact = $r[0];
- } else {
- $probed_contact = Probe::uri($thr_parent[0]['owner-link']);
- }
-
- if ($probed_contact["notify"] != "") {
+ $probed_contact = dba::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['owner-id']]);
+ if (DBM::is_result($probed_contact) && !empty($probed_contact["notify"])) {
logger('Notify parent owner '.$probed_contact["url"].': '.$probed_contact["notify"]);
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
}