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
1 changed files with 64 additions and 47 deletions
|
@ -1456,10 +1456,12 @@ class dfrn {
|
|||
update_contact_avatar($author["avatar"], $importer["uid"], $contact["id"],
|
||||
(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
|
||||
// that was relayed over several servers can overwrite contact
|
||||
// data that we received directly.
|
||||
/*
|
||||
* 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
|
||||
* that was relayed over several servers can overwrite contact
|
||||
* data that we received directly.
|
||||
*/
|
||||
|
||||
$poco["generation"] = 2;
|
||||
$poco["photo"] = $author["avatar"];
|
||||
|
@ -1811,6 +1813,7 @@ class dfrn {
|
|||
|
||||
update_contact_avatar($relocate["avatar"], $importer["importer_uid"], $importer["id"], true);
|
||||
|
||||
/// @TODO decide to use dbm::is_result() here
|
||||
if ($x === false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1833,10 +1836,13 @@ class dfrn {
|
|||
$n, dbesc($f[1]),
|
||||
$n, dbesc($f[0]),
|
||||
intval($importer["importer_uid"]));
|
||||
if ($x === false)
|
||||
|
||||
/// @TODO decide to use dbm::is_result() here
|
||||
if ($x === false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @TODO
|
||||
/// merge with current record, current contents have priority
|
||||
|
@ -1853,6 +1859,7 @@ class dfrn {
|
|||
* @param array $item the new item record
|
||||
* @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?
|
||||
* @todo set proper type-hints (array?)
|
||||
*/
|
||||
private static function update_content($current, $item, $importer, $entrytype) {
|
||||
$changed = false;
|
||||
|
@ -1860,8 +1867,9 @@ class dfrn {
|
|||
if (edited_timestamp_is_newer($current, $item)) {
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `tag` = '%s', `edited` = '%s', `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
|
||||
dbesc($item["title"]),
|
||||
|
@ -1906,6 +1914,7 @@ class dfrn {
|
|||
* @param array $item the new item record
|
||||
*
|
||||
* @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) {
|
||||
if ($item["parent-uri"] != $item["uri"]) {
|
||||
|
@ -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
|
||||
// valid community action. Also forum_mode makes it valid for sure.
|
||||
// If neither, it's not.
|
||||
/*
|
||||
* 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
|
||||
* 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 ((!$r[0]["forum_mode"]) && (!$r[0]["wall"])) {
|
||||
$is_a_remote_action = false;
|
||||
|
@ -1963,7 +1975,6 @@ class dfrn {
|
|||
} else {
|
||||
return DFRN_REPLY;
|
||||
}
|
||||
|
||||
} else {
|
||||
return DFRN_TOP_LEVEL;
|
||||
}
|
||||
|
@ -1976,6 +1987,7 @@ class dfrn {
|
|||
* @param array $item the new item record
|
||||
* @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
|
||||
* @todo set proper type-hints (array?)
|
||||
*/
|
||||
private static function do_poke($item, $importer, $posted_id) {
|
||||
$verb = urldecode(substr($item["verb"],strpos($item["verb"], "#")+1));
|
||||
|
@ -2032,6 +2044,7 @@ class dfrn {
|
|||
* @param bool $is_like Is the verb a "like"?
|
||||
*
|
||||
* @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) {
|
||||
|
||||
|
@ -2141,7 +2154,7 @@ class dfrn {
|
|||
*
|
||||
* @param object $links link elements
|
||||
* @param array $item the item record
|
||||
* @todo Add type-hints
|
||||
* @todo set proper type-hints
|
||||
*/
|
||||
private static function parse_links($links, &$item) {
|
||||
$rel = "";
|
||||
|
@ -2501,10 +2514,12 @@ class dfrn {
|
|||
}
|
||||
} else { // $entrytype == DFRN_TOP_LEVEL
|
||||
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 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.
|
||||
/*
|
||||
* 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 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);
|
||||
$item["owner-name"] = $importer["senderName"];
|
||||
$item["owner-link"] = $importer["url"];
|
||||
|
@ -2535,6 +2550,7 @@ class dfrn {
|
|||
* @param object $xpath XPath object
|
||||
* @param object $deletion deletion elements
|
||||
* @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) {
|
||||
|
||||
|
@ -2685,6 +2701,7 @@ class dfrn {
|
|||
* @param text $xml The DFRN message
|
||||
* @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
|
||||
* @todo set proper type-hints
|
||||
*/
|
||||
public static function import($xml,$importer, $sort_by_date = false) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue