From: Michael Vogel Date: Sat, 9 Aug 2014 07:17:28 +0000 (+0200) Subject: The GUID in the link to the items has to be encoded, since it could contain special... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b99737986d2a2e7deb8836ab887a77af24a4925e;p=friendica.git The GUID in the link to the items has to be encoded, since it could contain special characters --- diff --git a/include/diaspora.php b/include/diaspora.php index 0eeacc4879..8b85e7b955 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1423,8 +1423,7 @@ function diaspora_comment($importer,$xml,$msg) { 'to_email' => $importer['email'], 'uid' => $importer['uid'], 'item' => $datarray, - //'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id, - 'link' => $a->get_baseurl().'/display/'.$datarray['guid'], + 'link' => $a->get_baseurl().'/display/'.urlencode($datarray['guid']), 'source_name' => $datarray['author-name'], 'source_link' => $datarray['author-link'], 'source_photo' => $datarray['author-avatar'], @@ -1960,7 +1959,7 @@ EOT; $ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]'; $alink = '[url=' . $parent_item['author-link'] . ']' . $parent_item['author-name'] . '[/url]'; //$plink = '[url=' . $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $parent_item['id'] . ']' . $post_type . '[/url]'; - $plink = '[url='.$a->get_baseurl().'/display/'.$guid.']'.$post_type.'[/url]'; + $plink = '[url='.$a->get_baseurl().'/display/'.urlencode($guid).']'.$post_type.'[/url]'; $arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink ); $arr['app'] = 'Diaspora'; diff --git a/include/items.php b/include/items.php index 6a72320cd1..fbbc5e7aed 100644 --- a/include/items.php +++ b/include/items.php @@ -1117,7 +1117,7 @@ function item_store($arr,$force_parent = false) { if ($arr['plink'] == "") { $a = get_app(); - $arr['plink'] = $a->get_baseurl().'/display/'.$arr['guid']; + $arr['plink'] = $a->get_baseurl().'/display/'.urlencode($arr['guid']); } if ($arr['network'] == "") { @@ -1298,8 +1298,7 @@ function item_store($arr,$force_parent = false) { 'to_email' => $u[0]['email'], 'uid' => $u[0]['uid'], 'item' => $item[0], - //'link' => $a->get_baseurl().'/display/'.$u[0]['nickname'].'/'.$current_post, - 'link' => $a->get_baseurl().'/display/'.$arr['guid'], + 'link' => $a->get_baseurl().'/display/'.urlencode($arr['guid']), 'source_name' => $item[0]['author-name'], 'source_link' => $item[0]['author-link'], 'source_photo' => $item[0]['author-avatar'], @@ -1563,8 +1562,7 @@ function tag_deliver($uid,$item_id) { 'to_email' => $u[0]['email'], 'uid' => $u[0]['uid'], 'item' => $item, - //'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item['id'], - 'link' => $a->get_baseurl() . '/display/'.get_item_guid($item['id']), + 'link' => $a->get_baseurl() . '/display/'.urlencode(get_item_guid($item['id'])), 'source_name' => $item['author-name'], 'source_link' => $item['author-link'], 'source_photo' => $photo, @@ -3379,8 +3377,7 @@ function local_delivery($importer,$data) { 'to_email' => $importer['email'], 'uid' => $importer['importer_uid'], 'item' => $datarray, - //'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id, - 'link' => $a->get_baseurl().'/display/'.get_item_guid($posted_id), + 'link' => $a->get_baseurl().'/display/'.urlencode(get_item_guid($posted_id)), 'source_name' => stripslashes($datarray['author-name']), 'source_link' => $datarray['author-link'], 'source_photo' => ((link_compare($datarray['author-link'],$importer['url'])) @@ -3544,8 +3541,7 @@ function local_delivery($importer,$data) { 'to_email' => $importer['email'], 'uid' => $importer['importer_uid'], 'item' => $datarray, - //'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id, - 'link' => $a->get_baseurl().'/display/'.get_item_guid($posted_id), + 'link' => $a->get_baseurl().'/display/'.urlencode(get_item_guid($posted_id)), 'source_name' => stripslashes($datarray['author-name']), 'source_link' => $datarray['author-link'], 'source_photo' => ((link_compare($datarray['author-link'],$importer['url'])) @@ -3698,8 +3694,7 @@ function local_delivery($importer,$data) { 'to_email' => $importer['email'], 'uid' => $importer['importer_uid'], 'item' => $datarray, - //'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id, - 'link' => $a->get_baseurl().'/display/'.get_item_guid($posted_id), + 'link' => $a->get_baseurl().'/display/'.urlencode(get_item_guid($posted_id)), 'source_name' => stripslashes($datarray['author-name']), 'source_link' => $datarray['author-link'], 'source_photo' => ((link_compare($datarray['author-link'],$importer['url'])) diff --git a/mod/item.php b/mod/item.php index 901fb3385d..9be9de6688 100644 --- a/mod/item.php +++ b/mod/item.php @@ -847,8 +847,7 @@ function item_post(&$a) { 'to_email' => $user['email'], 'uid' => $user['uid'], 'item' => $datarray, - //'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id, - 'link' => $a->get_baseurl().'/display/'.$datarray['guid'], + 'link' => $a->get_baseurl().'/display/'.urlencode($datarray['guid']), 'source_name' => $datarray['author-name'], 'source_link' => $datarray['author-link'], 'source_photo' => $datarray['author-avatar'], @@ -876,8 +875,7 @@ function item_post(&$a) { 'to_email' => $user['email'], 'uid' => $user['uid'], 'item' => $datarray, - //'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id, - 'link' => $a->get_baseurl().'/display/'.$datarray['guid'], + 'link' => $a->get_baseurl().'/display/'.urlencode($datarray['guid']), 'source_name' => $datarray['author-name'], 'source_link' => $datarray['author-link'], 'source_photo' => $datarray['author-avatar'], @@ -896,8 +894,7 @@ function item_post(&$a) { WHERE `id` = %d", intval($parent), dbesc(($parent == $post_id) ? $uri : $parent_item['uri']), - //dbesc($a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id), - dbesc($a->get_baseurl().'/display/'.$datarray['guid']), + dbesc($a->get_baseurl().'/display/'.urlencode($datarray['guid'])), dbesc(datetime_convert()), intval($post_id) ); @@ -930,8 +927,7 @@ function item_post(&$a) { update_thread($parent); $datarray['id'] = $post_id; - //$datarray['plink'] = $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id; - $datarray['plink'] = $a->get_baseurl().'/display/'.$datarray['guid']; + $datarray['plink'] = $a->get_baseurl().'/display/'.urlencode($datarray['guid']); call_hooks('post_local_end', $datarray);