From: Michael Vogel Date: Wed, 3 Jun 2015 19:03:46 +0000 (+0200) Subject: Removed bad plink detection. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ba3691034392167f21e2c13a1b7bfacd058435ac;p=friendica.git Removed bad plink detection. --- diff --git a/include/items.php b/include/items.php index 809d9dcd6d..3fe624b001 100644 --- a/include/items.php +++ b/include/items.php @@ -208,7 +208,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0, call_hooks('atom_feed_end', $atom); - $atom .= ''."\r\n"; + $atom .= '' . "\r\n"; return $atom; } @@ -235,7 +235,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0, call_hooks('atom_feed_end', $atom); - $atom .= ''."\r\n"; + $atom .= '' . "\r\n"; return $atom; } @@ -250,18 +250,18 @@ function construct_verb($item) { function construct_activity_object($item) { if($item['object']) { - $o = ''."\r\n"; + $o = '' . "\r\n"; $r = parse_xml_string($item['object'],false); if(! $r) return ''; if($r->type) - $o .= '' . xmlify($r->type) . ''."\r\n"; + $o .= '' . xmlify($r->type) . '' . "\r\n"; if($r->id) - $o .= '' . xmlify($r->id) . ''."\r\n"; + $o .= '' . xmlify($r->id) . '' . "\r\n"; if($r->title) - $o .= '' . xmlify($r->title) . ''."\r\n"; + $o .= '' . xmlify($r->title) . '' . "\r\n"; if($r->link) { if(substr($r->link,0,1) === '<') { // patch up some facebook "like" activity objects that got stored incorrectly @@ -273,11 +273,11 @@ function construct_activity_object($item) { $o .= $r->link; } else - $o .= ''."\r\n"; + $o .= '' . "\r\n"; } if($r->content) - $o .= '' . xmlify(bbcode($r->content)) . ''."\r\n"; - $o .= ''."\r\n"; + $o .= '' . xmlify(bbcode($r->content)) . '' . "\r\n"; + $o .= '' . "\r\n"; return $o; } @@ -287,16 +287,16 @@ function construct_activity_object($item) { function construct_activity_target($item) { if($item['target']) { - $o = ''."\r\n"; + $o = '' . "\r\n"; $r = parse_xml_string($item['target'],false); if(! $r) return ''; if($r->type) - $o .= '' . xmlify($r->type) . ''."\r\n"; + $o .= '' . xmlify($r->type) . '' . "\r\n"; if($r->id) - $o .= '' . xmlify($r->id) . ''."\r\n"; + $o .= '' . xmlify($r->id) . '' . "\r\n"; if($r->title) - $o .= '' . xmlify($r->title) . ''."\r\n"; + $o .= '' . xmlify($r->title) . '' . "\r\n"; if($r->link) { if(substr($r->link,0,1) === '<') { if(strstr($r->link,'&') && (! strstr($r->link,'&'))) @@ -305,11 +305,11 @@ function construct_activity_target($item) { $o .= $r->link; } else - $o .= ''."\r\n"; + $o .= '' . "\r\n"; } if($r->content) - $o .= '' . xmlify(bbcode($r->content)) . ''."\r\n"; - $o .= ''."\r\n"; + $o .= '' . xmlify(bbcode($r->content)) . '' . "\r\n"; + $o .= '' . "\r\n"; return $o; } @@ -894,9 +894,9 @@ function get_atom_elements($feed, $item, $contact = array()) { if ($conversation["rel"] == "ostatus:conversation") { $res["ostatus_conversation"] = ostatus_convert_href($conversation["href"]); logger('get_atom_elements: found conversation url '.$res["ostatus_conversation"]); - } elseif ($conversation["rel"] == "alternate") { - $res["plink"] = $conversation["href"]; - logger('get_atom_elements: found plink '.$res["plink"]); + //} elseif ($conversation["rel"] == "alternate") { + // $res["plink"] = $conversation["href"]; + // logger('get_atom_elements: found plink '.$res["plink"]); } }; } @@ -1187,18 +1187,6 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa } } - // If there is no guid then take the same guid that was taken before for the same plink - if ((trim($arr['guid']) == "") AND (trim($arr['plink']) != "") AND (trim($arr['network']) != "")) { - logger('item_store: checking for an existing guid for plink '.$arr['plink'], LOGGER_DEBUG); - $r = q("SELECT `guid` FROM `guid` WHERE `plink` = '%s' AND `network` = '%s' LIMIT 1", - dbesc(trim($arr['plink'])), dbesc(trim($arr['network']))); - - if(count($r)) { - $arr['guid'] = $r[0]["guid"]; - logger('item_store: found guid '.$arr['guid'].' for plink '.$arr['plink'], LOGGER_DEBUG); - } - } - // Shouldn't happen but we want to make absolutely sure it doesn't leak from a plugin. // Deactivated, since the bbcode parser can handle with it - and it destroys posts with some smileys that contain "<" //if((strpos($arr['body'],'<') !== false) || (strpos($arr['body'],'>') !== false)) @@ -1415,16 +1403,6 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa return 0; } - $r = q("SELECT `id` FROM `item` WHERE `plink` = '%s' AND `network` = '%s' AND `uid` = %d LIMIT 1", - dbesc($arr['plink']), - dbesc($arr['network']), - intval($arr['uid']) - ); - if($r && count($r)) { - logger('duplicated item with the same plink found. ' . print_r($arr,true)); - return 0; - } - // Check for an existing post with the same content. There seems to be a problem with OStatus. $r = q("SELECT `id` FROM `item` WHERE `body` = '%s' AND `network` = '%s' AND `created` = '%s' AND `contact-id` = %d AND `uid` = %d LIMIT 1", dbesc($arr['body']), @@ -4321,8 +4299,8 @@ function atom_author($tag,$name,$uri,$h,$w,$photo) { $o .= "<$tag>\r\n"; $o .= "$name\r\n"; $o .= "$uri\r\n"; - $o .= ''."\r\n"; - $o .= ''."\r\n"; + $o .= '' . "\r\n"; + $o .= '' . "\r\n"; call_hooks('atom_author', $o); @@ -4338,7 +4316,7 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) { return; if($item['deleted']) - return ''."\r\n"; + return '' . "\r\n"; if($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid']) @@ -4346,87 +4324,69 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) { else $body = $item['body']; - $htmlbody = $body; - - if ($item['title'] != "") - $htmlbody = "[b]".$item['title']."[/b]\n\n".$htmlbody; - - $htmlbody = bbcode(bb_remove_share_information($htmlbody), false, false, 7); $o = "\r\n\r\n\r\n"; - // OStatus stuff - $o .= "\t".'' . xmlify($item['uri']) . ''."\r\n"; - $o .= "\t".'' . xmlify($item['title']) . ''."\r\n"; - $o .= "\t".'' . xmlify((($type === 'html') ? $htmlbody : $body)) . ''."\r\n"; - $o .= "\t".''."\r\n"; - - $verb = construct_verb($item); - $o .= "\t".''.xmlify($verb).''."\r\n"; - $o .= "\t".'' . xmlify($verb) . ''."\r\n"; - - $o .= "\t".'' . xmlify(datetime_convert('UTC','UTC',$item['created'] . '+00:00',ATOM_TIME)) . ''."\r\n"; - $o .= "\t".'' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . ''."\r\n"; if(is_array($author)) $o .= atom_author('author',$author['name'],$author['url'],80,80,$author['thumb']); else $o .= atom_author('author',(($item['author-name']) ? $item['author-name'] : $item['name']),(($item['author-link']) ? $item['author-link'] : $item['url']),80,80,(($item['author-avatar']) ? $item['author-avatar'] : $item['thumb'])); + if(strlen($item['owner-name'])) + $o .= atom_author('dfrn:owner',$item['owner-name'],$item['owner-link'],80,80,$item['owner-avatar']); if(($item['parent'] != $item['id']) || ($item['parent-uri'] !== $item['uri']) || (($item['thr-parent'] !== '') && ($item['thr-parent'] !== $item['uri']))) { $parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']); - $o .= "\t".''."\r\n"; - $o .= "\t".''."\r\n"; + $o .= '' . "\r\n"; } - $o .= "\t".''."\r\n"; - - $o .= item_getfeedattach($item); - - $mentioned = get_mentions($item); - if($mentioned) - $o .= $mentioned; + $htmlbody = $body; - $o .= "\t".''."\r\n"; - $o .= "\t".''."\r\n"; - $o .= "\t".''."\r\n"; + if ($item['title'] != "") + $htmlbody = "[b]".$item['title']."[/b]\n\n".$htmlbody; - // DFRN stuff - if(strlen($item['owner-name'])) - $o .= atom_author('dfrn:owner',$item['owner-name'],$item['owner-link'],80,80,$item['owner-avatar']); + $htmlbody = bbcode(bb_remove_share_information($htmlbody), false, false, 7); - $o .= "\t".'' . base64url_encode($body, true) . ''."\r\n"; + $o .= '' . xmlify($item['uri']) . '' . "\r\n"; + $o .= '' . xmlify($item['title']) . '' . "\r\n"; + $o .= '' . xmlify(datetime_convert('UTC','UTC',$item['created'] . '+00:00',ATOM_TIME)) . '' . "\r\n"; + $o .= '' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '' . "\r\n"; + $o .= '' . base64url_encode($body, true) . '' . "\r\n"; + $o .= '' . xmlify((($type === 'html') ? $htmlbody : $body)) . '' . "\r\n"; + $o .= '' . "\r\n"; if($comment) - $o .= "\t".'' . intval($item['last-child']) . ''."\r\n"; + $o .= '' . intval($item['last-child']) . '' . "\r\n"; if($item['location']) { - $o .= "\t".'' . xmlify($item['location']) . ''."\r\n"; - $o .= "\t".'' . xmlify($item['location']) . ''."\r\n"; + $o .= '' . xmlify($item['location']) . '' . "\r\n"; + $o .= '' . xmlify($item['location']) . '' . "\r\n"; } if($item['coord']) - $o .= "\t".'' . xmlify($item['coord']) . ''."\r\n"; + $o .= '' . xmlify($item['coord']) . '' . "\r\n"; if(($item['private']) || strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) - $o .= "\t".'' . (($item['private']) ? $item['private'] : 1) . ''."\r\n"; + $o .= '' . (($item['private']) ? $item['private'] : 1) . '' . "\r\n"; if($item['extid']) - $o .= "\t".'' . xmlify($item['extid']) . ''."\r\n"; + $o .= '' . xmlify($item['extid']) . '' . "\r\n"; if($item['bookmark']) - $o .= "\t".'true'."\r\n"; + $o .= 'true' . "\r\n"; if($item['app']) - $o .= "\t".''."\r\n"; + $o .= '' . "\r\n"; if($item['guid']) - $o .= "\t".'' . $item['guid'] . ''."\r\n"; + $o .= '' . $item['guid'] . '' . "\r\n"; if($item['signed_text']) { $sign = base64_encode(json_encode(array('signed_text' => $item['signed_text'],'signature' => $item['signature'],'signer' => $item['signer']))); - $o .= "\t".'' . xmlify($sign) . ''."\r\n"; + $o .= '' . xmlify($sign) . '' . "\r\n"; } + $verb = construct_verb($item); + $o .= '' . xmlify($verb) . '' . "\r\n"; $actobj = construct_activity_object($item); if(strlen($actobj)) $o .= $actobj; @@ -4437,13 +4397,19 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) { $tags = item_getfeedtags($item); if(count($tags)) { foreach($tags as $t) { - $o .= "\t".''."\r\n"; + $o .= '' . "\r\n"; } } + $o .= item_getfeedattach($item); + + $mentioned = get_mentions($item); + if($mentioned) + $o .= $mentioned; + call_hooks('atom_entry', $o); - $o .= ''."\r\n"; + $o .= '' . "\r\n"; return $o; } @@ -4625,7 +4591,7 @@ function item_getfeedattach($item) { $ret .= 'length="' . intval($matches[2]) . '" '; if($matches[4] !== ' ') $ret .= 'title="' . xmlify(trim($matches[4])) . '" '; - $ret .= ' />'."\r\n"; + $ret .= ' />' . "\r\n"; } } } diff --git a/mod/item.php b/mod/item.php index f38b632d76..184920d4ce 100644 --- a/mod/item.php +++ b/mod/item.php @@ -594,8 +594,6 @@ function item_post(&$a) { if (!in_array($toplevel_contact,$tags)) $tags[] = $toplevel_contact; - - logger("OStatus tags ".print_r($tags, true), LOGGER_DEBUG); } $tagged = array();