Continued:
- converted multiple single-line comments into one multi-line comment (please stop abusing programming languages!) - added more TODO tags for type-hints (upcoming rewrite) - opps, one space was only fixed in develop branch, not in this PR branch Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
parent
db1c2e4041
commit
d45e79dfe9
111
include/dfrn.php
111
include/dfrn.php
|
@ -967,8 +967,8 @@ class dfrn {
|
||||||
$rino = intval($rino);
|
$rino = intval($rino);
|
||||||
|
|
||||||
// use RINO1 if mcrypt isn't installed and RINO2 was selected
|
// use RINO1 if mcrypt isn't installed and RINO2 was selected
|
||||||
if ($rino==2 and !function_exists('mcrypt_create_iv')) {
|
if ($rino == 2 and !function_exists('mcrypt_create_iv')) {
|
||||||
$rino=1;
|
$rino = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger("Local rino version: ". $rino, LOGGER_DEBUG);
|
logger("Local rino version: ". $rino, LOGGER_DEBUG);
|
||||||
|
@ -976,7 +976,7 @@ class dfrn {
|
||||||
$ssl_val = intval(get_config('system','ssl_policy'));
|
$ssl_val = intval(get_config('system','ssl_policy'));
|
||||||
$ssl_policy = '';
|
$ssl_policy = '';
|
||||||
|
|
||||||
switch($ssl_val){
|
switch ($ssl_val) {
|
||||||
case SSL_POLICY_FULL:
|
case SSL_POLICY_FULL:
|
||||||
$ssl_policy = 'full';
|
$ssl_policy = 'full';
|
||||||
break;
|
break;
|
||||||
|
@ -1095,13 +1095,13 @@ class dfrn {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($rino>0 && $rino_remote_version>0 && (! $dissolve)) {
|
if ($rino > 0 && $rino_remote_version > 0 && (! $dissolve)) {
|
||||||
logger('rino version: '. $rino_remote_version);
|
logger('rino version: '. $rino_remote_version);
|
||||||
|
|
||||||
switch($rino_remote_version) {
|
switch ($rino_remote_version) {
|
||||||
case 1:
|
case 1:
|
||||||
// Deprecated rino version!
|
// Deprecated rino version!
|
||||||
$key = substr(random_string(),0,16);
|
$key = substr(random_string(), 0, 16);
|
||||||
$data = aes_encrypt($postvars['data'],$key);
|
$data = aes_encrypt($postvars['data'],$key);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -1298,19 +1298,19 @@ class dfrn {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dbm::is_result($r) AND !$onlyfetch) {
|
if (dbm::is_result($r) AND !$onlyfetch) {
|
||||||
logger("Check if contact details for contact ".$r[0]["id"]." (".$r[0]["nick"].") have to be updated.", LOGGER_DEBUG);
|
logger("Check if contact details for contact " . $r[0]["id"] . " (" . $r[0]["nick"] . ") have to be updated.", LOGGER_DEBUG);
|
||||||
|
|
||||||
$poco = array("url" => $contact["url"]);
|
$poco = array("url" => $contact["url"]);
|
||||||
|
|
||||||
// When was the last change to name or uri?
|
// When was the last change to name or uri?
|
||||||
$name_element = $xpath->query($element."/atom:name", $context)->item(0);
|
$name_element = $xpath->query($element . "/atom:name", $context)->item(0);
|
||||||
foreach ($name_element->attributes AS $attributes) {
|
foreach ($name_element->attributes AS $attributes) {
|
||||||
if ($attributes->name == "updated") {
|
if ($attributes->name == "updated") {
|
||||||
$poco["name-date"] = $attributes->textContent;
|
$poco["name-date"] = $attributes->textContent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$link_element = $xpath->query($element."/atom:link", $context)->item(0);
|
$link_element = $xpath->query($element . "/atom:link", $context)->item(0);
|
||||||
foreach ($link_element->attributes AS $attributes) {
|
foreach ($link_element->attributes AS $attributes) {
|
||||||
if ($attributes->name == "updated") {
|
if ($attributes->name == "updated") {
|
||||||
$poco["uri-date"] = $attributes->textContent;
|
$poco["uri-date"] = $attributes->textContent;
|
||||||
|
@ -1318,33 +1318,33 @@ class dfrn {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update contact data
|
// Update contact data
|
||||||
$value = $xpath->evaluate($element."/dfrn:handle/text()", $context)->item(0)->nodeValue;
|
$value = $xpath->evaluate($element . "/dfrn:handle/text()", $context)->item(0)->nodeValue;
|
||||||
if ($value != "") {
|
if ($value != "") {
|
||||||
$poco["addr"] = $value;
|
$poco["addr"] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = $xpath->evaluate($element."/poco:displayName/text()", $context)->item(0)->nodeValue;
|
$value = $xpath->evaluate($element . "/poco:displayName/text()", $context)->item(0)->nodeValue;
|
||||||
if ($value != "") {
|
if ($value != "") {
|
||||||
$poco["name"] = $value;
|
$poco["name"] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = $xpath->evaluate($element."/poco:preferredUsername/text()", $context)->item(0)->nodeValue;
|
$value = $xpath->evaluate($element . "/poco:preferredUsername/text()", $context)->item(0)->nodeValue;
|
||||||
if ($value != "") {
|
if ($value != "") {
|
||||||
$poco["nick"] = $value;
|
$poco["nick"] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = $xpath->evaluate($element."/poco:note/text()", $context)->item(0)->nodeValue;
|
$value = $xpath->evaluate($element . "/poco:note/text()", $context)->item(0)->nodeValue;
|
||||||
if ($value != "") {
|
if ($value != "") {
|
||||||
$poco["about"] = $value;
|
$poco["about"] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = $xpath->evaluate($element."/poco:address/poco:formatted/text()", $context)->item(0)->nodeValue;
|
$value = $xpath->evaluate($element . "/poco:address/poco:formatted/text()", $context)->item(0)->nodeValue;
|
||||||
if ($value != "") {
|
if ($value != "") {
|
||||||
$poco["location"] = $value;
|
$poco["location"] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @todo Only search for elements with "poco:type" = "xmpp"
|
/// @todo Only search for elements with "poco:type" = "xmpp"
|
||||||
$value = $xpath->evaluate($element."/poco:ims/poco:value/text()", $context)->item(0)->nodeValue;
|
$value = $xpath->evaluate($element . "/poco:ims/poco:value/text()", $context)->item(0)->nodeValue;
|
||||||
if ($value != "") {
|
if ($value != "") {
|
||||||
$poco["xmpp"] = $value;
|
$poco["xmpp"] = $value;
|
||||||
}
|
}
|
||||||
|
@ -1357,9 +1357,9 @@ class dfrn {
|
||||||
/// - poco:country
|
/// - poco:country
|
||||||
|
|
||||||
// If the "hide" element is present then the profile isn't searchable.
|
// If the "hide" element is present then the profile isn't searchable.
|
||||||
$hide = intval($xpath->evaluate($element."/dfrn:hide/text()", $context)->item(0)->nodeValue == "true");
|
$hide = intval($xpath->evaluate($element . "/dfrn:hide/text()", $context)->item(0)->nodeValue == "true");
|
||||||
|
|
||||||
logger("Hidden status for contact ".$contact["url"].": ".$hide, LOGGER_DEBUG);
|
logger("Hidden status for contact " . $contact["url"] . ": " . $hide, LOGGER_DEBUG);
|
||||||
|
|
||||||
// If the contact isn't searchable then set the contact to "hidden".
|
// If the contact isn't searchable then set the contact to "hidden".
|
||||||
// Problem: This can be manually overridden by the user.
|
// Problem: This can be manually overridden by the user.
|
||||||
|
@ -1369,7 +1369,7 @@ class dfrn {
|
||||||
|
|
||||||
// Save the keywords into the contact table
|
// Save the keywords into the contact table
|
||||||
$tags = array();
|
$tags = array();
|
||||||
$tagelements = $xpath->evaluate($element."/poco:tags/text()", $context);
|
$tagelements = $xpath->evaluate($element . "/poco:tags/text()", $context);
|
||||||
foreach ($tagelements AS $tag) {
|
foreach ($tagelements AS $tag) {
|
||||||
$tags[$tag->nodeValue] = $tag->nodeValue;
|
$tags[$tag->nodeValue] = $tag->nodeValue;
|
||||||
}
|
}
|
||||||
|
@ -1381,7 +1381,7 @@ class dfrn {
|
||||||
// "dfrn:birthday" contains the birthday converted to UTC
|
// "dfrn:birthday" contains the birthday converted to UTC
|
||||||
$old_bdyear = $contact["bdyear"];
|
$old_bdyear = $contact["bdyear"];
|
||||||
|
|
||||||
$birthday = $xpath->evaluate($element."/dfrn:birthday/text()", $context)->item(0)->nodeValue;
|
$birthday = $xpath->evaluate($element . "/dfrn:birthday/text()", $context)->item(0)->nodeValue;
|
||||||
|
|
||||||
if (strtotime($birthday) > time()) {
|
if (strtotime($birthday) > time()) {
|
||||||
$bd_timestamp = strtotime($birthday);
|
$bd_timestamp = strtotime($birthday);
|
||||||
|
@ -1390,7 +1390,7 @@ class dfrn {
|
||||||
}
|
}
|
||||||
|
|
||||||
// "poco:birthday" is the birthday in the format "yyyy-mm-dd"
|
// "poco:birthday" is the birthday in the format "yyyy-mm-dd"
|
||||||
$value = $xpath->evaluate($element."/poco:birthday/text()", $context)->item(0)->nodeValue;
|
$value = $xpath->evaluate($element . "/poco:birthday/text()", $context)->item(0)->nodeValue;
|
||||||
|
|
||||||
if (!in_array($value, array("", "0000-00-00"))) {
|
if (!in_array($value, array("", "0000-00-00"))) {
|
||||||
$bdyear = date("Y");
|
$bdyear = date("Y");
|
||||||
|
@ -1427,20 +1427,20 @@ class dfrn {
|
||||||
$datefields = array("name-date", "uri-date");
|
$datefields = array("name-date", "uri-date");
|
||||||
foreach ($datefields AS $field) {
|
foreach ($datefields AS $field) {
|
||||||
if (strtotime($contact[$field]) > strtotime($r[0][$field])) {
|
if (strtotime($contact[$field]) > strtotime($r[0][$field])) {
|
||||||
logger("Difference for contact ".$contact["id"]." in field '".$field."'. New value: '".$contact[$field]."', old value '".$r[0][$field]."'", LOGGER_DEBUG);
|
logger("Difference for contact " . $contact["id"] . " in field '" . $field . "'. New value: '" . $contact[$field] . "', old value '" . $r[0][$field] . "'", LOGGER_DEBUG);
|
||||||
$update = true;
|
$update = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($fields AS $field => $data) {
|
foreach ($fields AS $field => $data) {
|
||||||
if ($contact[$field] != $r[0][$field]) {
|
if ($contact[$field] != $r[0][$field]) {
|
||||||
logger("Difference for contact ".$contact["id"]." in field '".$field."'. New value: '".$contact[$field]."', old value '".$r[0][$field]."'", LOGGER_DEBUG);
|
logger("Difference for contact " . $contact["id"] . " in field '" . $field . "'. New value: '" . $contact[$field] . "', old value '" . $r[0][$field] . "'", LOGGER_DEBUG);
|
||||||
$update = true;
|
$update = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($update) {
|
if ($update) {
|
||||||
logger("Update contact data for contact ".$contact["id"]." (".$contact["nick"].")", LOGGER_DEBUG);
|
logger("Update contact data for contact " . $contact["id"] . " (" . $contact["nick"] . ")", LOGGER_DEBUG);
|
||||||
|
|
||||||
q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `about` = '%s', `location` = '%s',
|
q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `about` = '%s', `location` = '%s',
|
||||||
`addr` = '%s', `keywords` = '%s', `bdyear` = '%s', `bd` = '%s', `hidden` = %d,
|
`addr` = '%s', `keywords` = '%s', `bdyear` = '%s', `bd` = '%s', `hidden` = %d,
|
||||||
|
@ -1456,10 +1456,12 @@ class dfrn {
|
||||||
update_contact_avatar($author["avatar"], $importer["uid"], $contact["id"],
|
update_contact_avatar($author["avatar"], $importer["uid"], $contact["id"],
|
||||||
(strtotime($contact["avatar-date"]) > strtotime($r[0]["avatar-date"])));
|
(strtotime($contact["avatar-date"]) > strtotime($r[0]["avatar-date"])));
|
||||||
|
|
||||||
// The generation is a sign for the reliability of the provided data.
|
/*
|
||||||
// It is used in the socgraph.php to prevent that old contact data
|
* The generation is a sign for the reliability of the provided data.
|
||||||
// that was relayed over several servers can overwrite contact
|
* It is used in the socgraph.php to prevent that old contact data
|
||||||
// data that we received directly.
|
* that was relayed over several servers can overwrite contact
|
||||||
|
* data that we received directly.
|
||||||
|
*/
|
||||||
|
|
||||||
$poco["generation"] = 2;
|
$poco["generation"] = 2;
|
||||||
$poco["photo"] = $author["avatar"];
|
$poco["photo"] = $author["avatar"];
|
||||||
|
@ -1811,6 +1813,7 @@ class dfrn {
|
||||||
|
|
||||||
update_contact_avatar($relocate["avatar"], $importer["importer_uid"], $importer["id"], true);
|
update_contact_avatar($relocate["avatar"], $importer["importer_uid"], $importer["id"], true);
|
||||||
|
|
||||||
|
/// @TODO decide to use dbm::is_result() here
|
||||||
if ($x === false) {
|
if ($x === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1822,7 +1825,7 @@ class dfrn {
|
||||||
'author-link' => array($old["url"], $relocate["url"]),
|
'author-link' => array($old["url"], $relocate["url"]),
|
||||||
//'owner-avatar' => array($old["photo"], $relocate["photo"]),
|
//'owner-avatar' => array($old["photo"], $relocate["photo"]),
|
||||||
//'author-avatar' => array($old["photo"], $relocate["photo"]),
|
//'author-avatar' => array($old["photo"], $relocate["photo"]),
|
||||||
);
|
);
|
||||||
foreach ($fields as $n=>$f) {
|
foreach ($fields as $n=>$f) {
|
||||||
$r = q("SELECT `id` FROM `item` WHERE `%s` = '%s' AND `uid` = %d LIMIT 1",
|
$r = q("SELECT `id` FROM `item` WHERE `%s` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
$n, dbesc($f[0]),
|
$n, dbesc($f[0]),
|
||||||
|
@ -1833,8 +1836,11 @@ class dfrn {
|
||||||
$n, dbesc($f[1]),
|
$n, dbesc($f[1]),
|
||||||
$n, dbesc($f[0]),
|
$n, dbesc($f[0]),
|
||||||
intval($importer["importer_uid"]));
|
intval($importer["importer_uid"]));
|
||||||
if ($x === false)
|
|
||||||
|
/// @TODO decide to use dbm::is_result() here
|
||||||
|
if ($x === false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1853,6 +1859,7 @@ class dfrn {
|
||||||
* @param array $item the new item record
|
* @param array $item the new item record
|
||||||
* @param array $importer Record of the importer user mixed with contact of the content
|
* @param array $importer Record of the importer user mixed with contact of the content
|
||||||
* @param int $entrytype Is it a toplevel entry, a comment or a relayed comment?
|
* @param int $entrytype Is it a toplevel entry, a comment or a relayed comment?
|
||||||
|
* @todo set proper type-hints (array?)
|
||||||
*/
|
*/
|
||||||
private static function update_content($current, $item, $importer, $entrytype) {
|
private static function update_content($current, $item, $importer, $entrytype) {
|
||||||
$changed = false;
|
$changed = false;
|
||||||
|
@ -1860,8 +1867,9 @@ class dfrn {
|
||||||
if (edited_timestamp_is_newer($current, $item)) {
|
if (edited_timestamp_is_newer($current, $item)) {
|
||||||
|
|
||||||
// do not accept (ignore) an earlier edit than one we currently have.
|
// do not accept (ignore) an earlier edit than one we currently have.
|
||||||
if(datetime_convert("UTC","UTC",$item["edited"]) < $current["edited"])
|
if (datetime_convert("UTC","UTC",$item["edited"]) < $current["edited"]) {
|
||||||
return(false);
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s', `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
|
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s', `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
|
||||||
dbesc($item["title"]),
|
dbesc($item["title"]),
|
||||||
|
@ -1906,12 +1914,13 @@ class dfrn {
|
||||||
* @param array $item the new item record
|
* @param array $item the new item record
|
||||||
*
|
*
|
||||||
* @return int Is it a toplevel entry, a comment or a relayed comment?
|
* @return int Is it a toplevel entry, a comment or a relayed comment?
|
||||||
|
* @todo set proper type-hints (array?)
|
||||||
*/
|
*/
|
||||||
private static function get_entry_type($importer, $item) {
|
private static function get_entry_type($importer, $item) {
|
||||||
if ($item["parent-uri"] != $item["uri"]) {
|
if ($item["parent-uri"] != $item["uri"]) {
|
||||||
$community = false;
|
$community = false;
|
||||||
|
|
||||||
if($importer["page-flags"] == PAGE_COMMUNITY || $importer["page-flags"] == PAGE_PRVGROUP) {
|
if ($importer["page-flags"] == PAGE_COMMUNITY || $importer["page-flags"] == PAGE_PRVGROUP) {
|
||||||
$sql_extra = "";
|
$sql_extra = "";
|
||||||
$community = true;
|
$community = true;
|
||||||
logger("possible community action");
|
logger("possible community action");
|
||||||
|
@ -1946,11 +1955,14 @@ class dfrn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does this have the characteristics of a community or private group action?
|
/*
|
||||||
// If it's an action to a wall post on a community/prvgroup page it's a
|
* Does this have the characteristics of a community or private group action?
|
||||||
// valid community action. Also forum_mode makes it valid for sure.
|
* If it's an action to a wall post on a community/prvgroup page it's a
|
||||||
// If neither, it's not.
|
* valid community action. Also forum_mode makes it valid for sure.
|
||||||
|
* If neither, it's not.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// @TODO Maybe merge these if() blocks into one?
|
||||||
if ($is_a_remote_action && $community) {
|
if ($is_a_remote_action && $community) {
|
||||||
if ((!$r[0]["forum_mode"]) && (!$r[0]["wall"])) {
|
if ((!$r[0]["forum_mode"]) && (!$r[0]["wall"])) {
|
||||||
$is_a_remote_action = false;
|
$is_a_remote_action = false;
|
||||||
|
@ -1963,7 +1975,6 @@ class dfrn {
|
||||||
} else {
|
} else {
|
||||||
return DFRN_REPLY;
|
return DFRN_REPLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return DFRN_TOP_LEVEL;
|
return DFRN_TOP_LEVEL;
|
||||||
}
|
}
|
||||||
|
@ -1976,6 +1987,7 @@ class dfrn {
|
||||||
* @param array $item the new item record
|
* @param array $item the new item record
|
||||||
* @param array $importer Record of the importer user mixed with contact of the content
|
* @param array $importer Record of the importer user mixed with contact of the content
|
||||||
* @param int $posted_id The record number of item record that was just posted
|
* @param int $posted_id The record number of item record that was just posted
|
||||||
|
* @todo set proper type-hints (array?)
|
||||||
*/
|
*/
|
||||||
private static function do_poke($item, $importer, $posted_id) {
|
private static function do_poke($item, $importer, $posted_id) {
|
||||||
$verb = urldecode(substr($item["verb"],strpos($item["verb"], "#")+1));
|
$verb = urldecode(substr($item["verb"],strpos($item["verb"], "#")+1));
|
||||||
|
@ -1989,7 +2001,7 @@ class dfrn {
|
||||||
// somebody was poked/prodded. Was it me?
|
// somebody was poked/prodded. Was it me?
|
||||||
foreach ($xo->link as $l) {
|
foreach ($xo->link as $l) {
|
||||||
$atts = $l->attributes();
|
$atts = $l->attributes();
|
||||||
switch($atts["rel"]) {
|
switch ($atts["rel"]) {
|
||||||
case "alternate":
|
case "alternate":
|
||||||
$Blink = $atts["href"];
|
$Blink = $atts["href"];
|
||||||
break;
|
break;
|
||||||
|
@ -1998,7 +2010,7 @@ class dfrn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($Blink && link_compare($Blink,App::get_baseurl()."/profile/".$importer["nickname"])) {
|
if ($Blink && link_compare($Blink, App::get_baseurl() . "/profile/" . $importer["nickname"])) {
|
||||||
|
|
||||||
// send a notification
|
// send a notification
|
||||||
notification(array(
|
notification(array(
|
||||||
|
@ -2032,6 +2044,7 @@ class dfrn {
|
||||||
* @param bool $is_like Is the verb a "like"?
|
* @param bool $is_like Is the verb a "like"?
|
||||||
*
|
*
|
||||||
* @return bool Should the processing of the entries be continued?
|
* @return bool Should the processing of the entries be continued?
|
||||||
|
* @todo set proper type-hints (array?)
|
||||||
*/
|
*/
|
||||||
private static function process_verbs($entrytype, $importer, &$item, &$is_like) {
|
private static function process_verbs($entrytype, $importer, &$item, &$is_like) {
|
||||||
|
|
||||||
|
@ -2141,7 +2154,7 @@ class dfrn {
|
||||||
*
|
*
|
||||||
* @param object $links link elements
|
* @param object $links link elements
|
||||||
* @param array $item the item record
|
* @param array $item the item record
|
||||||
* @todo Add type-hints
|
* @todo set proper type-hints
|
||||||
*/
|
*/
|
||||||
private static function parse_links($links, &$item) {
|
private static function parse_links($links, &$item) {
|
||||||
$rel = "";
|
$rel = "";
|
||||||
|
@ -2501,10 +2514,12 @@ class dfrn {
|
||||||
}
|
}
|
||||||
} else { // $entrytype == DFRN_TOP_LEVEL
|
} else { // $entrytype == DFRN_TOP_LEVEL
|
||||||
if (!link_compare($item["owner-link"],$importer["url"])) {
|
if (!link_compare($item["owner-link"],$importer["url"])) {
|
||||||
// The item owner info is not our contact. It's OK and is to be expected if this is a tgroup delivery,
|
/*
|
||||||
// but otherwise there's a possible data mixup on the sender's system.
|
* The item owner info is not our contact. It's OK and is to be expected if this is a tgroup delivery,
|
||||||
// the tgroup delivery code called from item_store will correct it if it's a forum,
|
* but otherwise there's a possible data mixup on the sender's system.
|
||||||
// but we're going to unconditionally correct it here so that the post will always be owned by our contact.
|
* the tgroup delivery code called from item_store will correct it if it's a forum,
|
||||||
|
* but we're going to unconditionally correct it here so that the post will always be owned by our contact.
|
||||||
|
*/
|
||||||
logger('Correcting item owner.', LOGGER_DEBUG);
|
logger('Correcting item owner.', LOGGER_DEBUG);
|
||||||
$item["owner-name"] = $importer["senderName"];
|
$item["owner-name"] = $importer["senderName"];
|
||||||
$item["owner-link"] = $importer["url"];
|
$item["owner-link"] = $importer["url"];
|
||||||
|
@ -2535,6 +2550,7 @@ class dfrn {
|
||||||
* @param object $xpath XPath object
|
* @param object $xpath XPath object
|
||||||
* @param object $deletion deletion elements
|
* @param object $deletion deletion elements
|
||||||
* @param array $importer Record of the importer user mixed with contact of the content
|
* @param array $importer Record of the importer user mixed with contact of the content
|
||||||
|
* @todo set proper type-hints
|
||||||
*/
|
*/
|
||||||
private static function process_deletion($xpath, $deletion, $importer) {
|
private static function process_deletion($xpath, $deletion, $importer) {
|
||||||
|
|
||||||
|
@ -2617,7 +2633,7 @@ class dfrn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
q("UPDATE `item` SET `tag` = '%s' WHERE `id` = %d",
|
q("UPDATE `item` SET `tag` = '%s' WHERE `id` = %d",
|
||||||
dbesc(implode(',',$newtags)),
|
dbesc(implode(',', $newtags)),
|
||||||
intval($i[0]["id"])
|
intval($i[0]["id"])
|
||||||
);
|
);
|
||||||
create_tags_from_item($i[0]["id"]);
|
create_tags_from_item($i[0]["id"]);
|
||||||
|
@ -2626,7 +2642,7 @@ class dfrn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($entrytype == DFRN_TOP_LEVEL) {
|
if ($entrytype == DFRN_TOP_LEVEL) {
|
||||||
$r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s',
|
$r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s',
|
||||||
`body` = '', `title` = ''
|
`body` = '', `title` = ''
|
||||||
WHERE `parent-uri` = '%s' AND `uid` = %d",
|
WHERE `parent-uri` = '%s' AND `uid` = %d",
|
||||||
|
@ -2672,7 +2688,7 @@ class dfrn {
|
||||||
// if this is a relayed delete, propagate it to other recipients
|
// if this is a relayed delete, propagate it to other recipients
|
||||||
|
|
||||||
if ($entrytype == DFRN_REPLY_RC) {
|
if ($entrytype == DFRN_REPLY_RC) {
|
||||||
logger("Notifying followers about deletion of post ".$item["id"], LOGGER_DEBUG);
|
logger("Notifying followers about deletion of post " . $item["id"], LOGGER_DEBUG);
|
||||||
proc_run(PRIORITY_HIGH, "include/notifier.php","drop", $item["id"]);
|
proc_run(PRIORITY_HIGH, "include/notifier.php","drop", $item["id"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2685,6 +2701,7 @@ class dfrn {
|
||||||
* @param text $xml The DFRN message
|
* @param text $xml The DFRN message
|
||||||
* @param array $importer Record of the importer user mixed with contact of the content
|
* @param array $importer Record of the importer user mixed with contact of the content
|
||||||
* @param bool $sort_by_date Is used when feeds are polled
|
* @param bool $sort_by_date Is used when feeds are polled
|
||||||
|
* @todo set proper type-hints
|
||||||
*/
|
*/
|
||||||
public static function import($xml,$importer, $sort_by_date = false) {
|
public static function import($xml,$importer, $sort_by_date = false) {
|
||||||
|
|
||||||
|
@ -2800,6 +2817,6 @@ class dfrn {
|
||||||
self::process_entry($header, $xpath, $entry, $importer);
|
self::process_entry($header, $xpath, $entry, $importer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger("Import done for user ".$importer["uid"]." from contact ".$importer["id"], LOGGER_DEBUG);
|
logger("Import done for user " . $importer["uid"] . " from contact " . $importer["id"], LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue