From 81ee35e03bc45bc80aaabb9416bdee2968b8f504 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 23 Sep 2014 20:55:22 -0700 Subject: fix url mismatches of a single trailing slash for feed author/owner comparisons; update diaspora_compat --- include/bb2diaspora.php | 6 ++---- include/follow.php | 3 +++ include/items.php | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index e60f72add..089838e97 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -131,10 +131,8 @@ function diaspora2bb($s,$use_zrl = false) { // $s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s); // first try plustags - // nope don't do it. This will cause mis-attributed messages and runaway delivery chains - - // Diaspora doesn't have sufficient delivery loop detection. - // Leave the next line commented and leave this description here so future readers will know why. - // $s = preg_replace_callback('/\@\{(.+?)\; (.+?)\@(.+?)\}\+/','diaspora_mention_callback',$s); + + $s = preg_replace_callback('/\@\{(.+?)\; (.+?)\@(.+?)\}\+/','diaspora_mention_callback',$s); $s = preg_replace_callback('/\@\{(.+?)\; (.+?)\@(.+?)\}/','diaspora_mention_callback',$s); diff --git a/include/follow.php b/include/follow.php index 38525982e..a967386e9 100644 --- a/include/follow.php +++ b/include/follow.php @@ -19,6 +19,9 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false) $is_red = false; $is_http = ((strpos($url,'://') !== false) ? true : false); + if($is_http && substr($url,-1,1) === '/') + $url = substr($url,0,-1); + if(! allowed_url($url)) { $result['message'] = t('Channel is blocked on this site.'); return $result; diff --git a/include/items.php b/include/items.php index dbea5779c..d972a1ce9 100755 --- a/include/items.php +++ b/include/items.php @@ -1424,6 +1424,9 @@ function get_atom_elements($feed,$item,&$author) { $author['author_link'] = unxmlify($feed->get_permalink()); } + if(substr($author['author_link'],-1,1) == '/') + $author['author_link'] = substr($author['author_link'],0,-1); + $res['mid'] = base64url_encode(unxmlify($item->get_id())); $res['title'] = unxmlify($item->get_title()); $res['body'] = unxmlify($item->get_content()); -- cgit v1.2.3