Browse Source

Some precaution to avoid overwriting of existing data with blanks

pull/1750/head
Michael Vogel 6 years ago
parent
commit
0ac75deee1
3 changed files with 15 additions and 2 deletions
  1. +11
    -1
      include/follow.php
  2. +1
    -1
      include/items.php
  3. +3
    -0
      object/Item.php

+ 11
- 1
include/follow.php View File

@ -1,7 +1,12 @@
<?php
function update_contact($id) {
$r = q("SELECT `url`, `network` FROM `contact` WHERE `id` = %d", intval($id));
/*
Warning: Never ever fetch the public key via probe_url and write it into the contacts.
This will reliably kill your communication with Friendica contacts.
*/
$r = q("SELECT `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `network` FROM `contact` WHERE `id` = %d", intval($id));
if (!$r)
return;
@ -11,6 +16,11 @@ function update_contact($id) {
if ($ret["network"] != $r[0]["network"])
return;
// make sure to not overwrite existing values with blank entries
foreach ($ret AS $key => $val)
if (isset($r[0][$key]) AND ($r[0][$key] != "") AND ($val == ""))
$ret[$key] = $r[0][$key];
q("UPDATE `contact` SET `url` = '%s', `nurl` = '%s', `addr` = '%s', `alias` = '%s', `batch` = '%s', `notify` = '%s', `poll` = '%s', `poco` = '%s', `name` = '%s', `nick` = '%s' WHERE `id` = %d",
dbesc($ret['url']),
dbesc(normalise_link($ret['url'])),


+ 1
- 1
include/items.php View File

@ -2076,7 +2076,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$final_dfrn_id = substr($final_dfrn_id,2);
if($final_dfrn_id != $orig_id) {
logger('dfrn_deliver: wrong dfrn_id. Original: '.$orig_id.' Target: '.$final_dfrn_id.' Test: '.$test);
logger('dfrn_deliver: wrong dfrn_id.');
// did not decode properly - cannot trust this site
return 3;
}


+ 3
- 0
object/Item.php View File

@ -308,6 +308,9 @@ class Item extends BaseObject {
if (($item["item_network"] == NETWORK_FACEBOOK) AND ($indent == 'comment') AND isset($buttons["like"]))
unset($buttons["like"]);
// Likes don't federate at OStatus
if (($item["item_network"] == NETWORK_OSTATUS) AND isset($buttons["like"]))
unset($buttons["like"]);
$tmp_item = array(
'template' => $this->get_template(),


Loading…
Cancel
Save