Merge pull request #1069 from annando/master
Solved (possible) encoding problem, encoding of URLs with GUID
This commit is contained in:
commit
d28c1febc7
5 changed files with 14 additions and 24 deletions
|
@ -21,7 +21,7 @@ function diaspora2bb($s) {
|
||||||
$s = str_replace("\r","",$s);
|
$s = str_replace("\r","",$s);
|
||||||
|
|
||||||
// <br/> is invalid. Replace it with the valid expression
|
// <br/> is invalid. Replace it with the valid expression
|
||||||
$s = str_replace(array("<br/>", "</p>", "<p>"),array("<br />", "<br />", "<br />"),$s);
|
$s = str_replace(array("<br/>", "</p>", "<p>", '<p dir="ltr">'),array("<br />", "<br />", "<br />", "<br />"),$s);
|
||||||
|
|
||||||
$s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s);
|
$s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s);
|
||||||
|
|
||||||
|
|
|
@ -1076,7 +1076,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
$doc->preserveWhiteSpace = false;
|
$doc->preserveWhiteSpace = false;
|
||||||
|
|
||||||
//$Text = mb_convert_encoding($Text, 'HTML-ENTITIES', "UTF-8");
|
$Text = mb_convert_encoding($Text, 'HTML-ENTITIES', "UTF-8");
|
||||||
|
|
||||||
$doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">';
|
$doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">';
|
||||||
$encoding = '<?xml encoding="UTF-8">';
|
$encoding = '<?xml encoding="UTF-8">';
|
||||||
|
|
|
@ -1423,8 +1423,7 @@ function diaspora_comment($importer,$xml,$msg) {
|
||||||
'to_email' => $importer['email'],
|
'to_email' => $importer['email'],
|
||||||
'uid' => $importer['uid'],
|
'uid' => $importer['uid'],
|
||||||
'item' => $datarray,
|
'item' => $datarray,
|
||||||
//'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id,
|
'link' => $a->get_baseurl().'/display/'.urlencode($datarray['guid']),
|
||||||
'link' => $a->get_baseurl().'/display/'.$datarray['guid'],
|
|
||||||
'source_name' => $datarray['author-name'],
|
'source_name' => $datarray['author-name'],
|
||||||
'source_link' => $datarray['author-link'],
|
'source_link' => $datarray['author-link'],
|
||||||
'source_photo' => $datarray['author-avatar'],
|
'source_photo' => $datarray['author-avatar'],
|
||||||
|
@ -1960,7 +1959,7 @@ EOT;
|
||||||
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
|
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
|
||||||
$alink = '[url=' . $parent_item['author-link'] . ']' . $parent_item['author-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/' . $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['body'] = sprintf( $bodyverb, $ulink, $alink, $plink );
|
||||||
|
|
||||||
$arr['app'] = 'Diaspora';
|
$arr['app'] = 'Diaspora';
|
||||||
|
|
|
@ -1117,7 +1117,7 @@ function item_store($arr,$force_parent = false) {
|
||||||
|
|
||||||
if ($arr['plink'] == "") {
|
if ($arr['plink'] == "") {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$arr['plink'] = $a->get_baseurl().'/display/'.$arr['guid'];
|
$arr['plink'] = $a->get_baseurl().'/display/'.urlencode($arr['guid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($arr['network'] == "") {
|
if ($arr['network'] == "") {
|
||||||
|
@ -1298,8 +1298,7 @@ function item_store($arr,$force_parent = false) {
|
||||||
'to_email' => $u[0]['email'],
|
'to_email' => $u[0]['email'],
|
||||||
'uid' => $u[0]['uid'],
|
'uid' => $u[0]['uid'],
|
||||||
'item' => $item[0],
|
'item' => $item[0],
|
||||||
//'link' => $a->get_baseurl().'/display/'.$u[0]['nickname'].'/'.$current_post,
|
'link' => $a->get_baseurl().'/display/'.urlencode($arr['guid']),
|
||||||
'link' => $a->get_baseurl().'/display/'.$arr['guid'],
|
|
||||||
'source_name' => $item[0]['author-name'],
|
'source_name' => $item[0]['author-name'],
|
||||||
'source_link' => $item[0]['author-link'],
|
'source_link' => $item[0]['author-link'],
|
||||||
'source_photo' => $item[0]['author-avatar'],
|
'source_photo' => $item[0]['author-avatar'],
|
||||||
|
@ -1563,8 +1562,7 @@ function tag_deliver($uid,$item_id) {
|
||||||
'to_email' => $u[0]['email'],
|
'to_email' => $u[0]['email'],
|
||||||
'uid' => $u[0]['uid'],
|
'uid' => $u[0]['uid'],
|
||||||
'item' => $item,
|
'item' => $item,
|
||||||
//'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item['id'],
|
'link' => $a->get_baseurl() . '/display/'.urlencode(get_item_guid($item['id'])),
|
||||||
'link' => $a->get_baseurl() . '/display/'.get_item_guid($item['id']),
|
|
||||||
'source_name' => $item['author-name'],
|
'source_name' => $item['author-name'],
|
||||||
'source_link' => $item['author-link'],
|
'source_link' => $item['author-link'],
|
||||||
'source_photo' => $photo,
|
'source_photo' => $photo,
|
||||||
|
@ -3379,8 +3377,7 @@ function local_delivery($importer,$data) {
|
||||||
'to_email' => $importer['email'],
|
'to_email' => $importer['email'],
|
||||||
'uid' => $importer['importer_uid'],
|
'uid' => $importer['importer_uid'],
|
||||||
'item' => $datarray,
|
'item' => $datarray,
|
||||||
//'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
|
'link' => $a->get_baseurl().'/display/'.urlencode(get_item_guid($posted_id)),
|
||||||
'link' => $a->get_baseurl().'/display/'.get_item_guid($posted_id),
|
|
||||||
'source_name' => stripslashes($datarray['author-name']),
|
'source_name' => stripslashes($datarray['author-name']),
|
||||||
'source_link' => $datarray['author-link'],
|
'source_link' => $datarray['author-link'],
|
||||||
'source_photo' => ((link_compare($datarray['author-link'],$importer['url']))
|
'source_photo' => ((link_compare($datarray['author-link'],$importer['url']))
|
||||||
|
@ -3544,8 +3541,7 @@ function local_delivery($importer,$data) {
|
||||||
'to_email' => $importer['email'],
|
'to_email' => $importer['email'],
|
||||||
'uid' => $importer['importer_uid'],
|
'uid' => $importer['importer_uid'],
|
||||||
'item' => $datarray,
|
'item' => $datarray,
|
||||||
//'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
|
'link' => $a->get_baseurl().'/display/'.urlencode(get_item_guid($posted_id)),
|
||||||
'link' => $a->get_baseurl().'/display/'.get_item_guid($posted_id),
|
|
||||||
'source_name' => stripslashes($datarray['author-name']),
|
'source_name' => stripslashes($datarray['author-name']),
|
||||||
'source_link' => $datarray['author-link'],
|
'source_link' => $datarray['author-link'],
|
||||||
'source_photo' => ((link_compare($datarray['author-link'],$importer['url']))
|
'source_photo' => ((link_compare($datarray['author-link'],$importer['url']))
|
||||||
|
@ -3698,8 +3694,7 @@ function local_delivery($importer,$data) {
|
||||||
'to_email' => $importer['email'],
|
'to_email' => $importer['email'],
|
||||||
'uid' => $importer['importer_uid'],
|
'uid' => $importer['importer_uid'],
|
||||||
'item' => $datarray,
|
'item' => $datarray,
|
||||||
//'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
|
'link' => $a->get_baseurl().'/display/'.urlencode(get_item_guid($posted_id)),
|
||||||
'link' => $a->get_baseurl().'/display/'.get_item_guid($posted_id),
|
|
||||||
'source_name' => stripslashes($datarray['author-name']),
|
'source_name' => stripslashes($datarray['author-name']),
|
||||||
'source_link' => $datarray['author-link'],
|
'source_link' => $datarray['author-link'],
|
||||||
'source_photo' => ((link_compare($datarray['author-link'],$importer['url']))
|
'source_photo' => ((link_compare($datarray['author-link'],$importer['url']))
|
||||||
|
|
12
mod/item.php
12
mod/item.php
|
@ -847,8 +847,7 @@ function item_post(&$a) {
|
||||||
'to_email' => $user['email'],
|
'to_email' => $user['email'],
|
||||||
'uid' => $user['uid'],
|
'uid' => $user['uid'],
|
||||||
'item' => $datarray,
|
'item' => $datarray,
|
||||||
//'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
|
'link' => $a->get_baseurl().'/display/'.urlencode($datarray['guid']),
|
||||||
'link' => $a->get_baseurl().'/display/'.$datarray['guid'],
|
|
||||||
'source_name' => $datarray['author-name'],
|
'source_name' => $datarray['author-name'],
|
||||||
'source_link' => $datarray['author-link'],
|
'source_link' => $datarray['author-link'],
|
||||||
'source_photo' => $datarray['author-avatar'],
|
'source_photo' => $datarray['author-avatar'],
|
||||||
|
@ -876,8 +875,7 @@ function item_post(&$a) {
|
||||||
'to_email' => $user['email'],
|
'to_email' => $user['email'],
|
||||||
'uid' => $user['uid'],
|
'uid' => $user['uid'],
|
||||||
'item' => $datarray,
|
'item' => $datarray,
|
||||||
//'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
|
'link' => $a->get_baseurl().'/display/'.urlencode($datarray['guid']),
|
||||||
'link' => $a->get_baseurl().'/display/'.$datarray['guid'],
|
|
||||||
'source_name' => $datarray['author-name'],
|
'source_name' => $datarray['author-name'],
|
||||||
'source_link' => $datarray['author-link'],
|
'source_link' => $datarray['author-link'],
|
||||||
'source_photo' => $datarray['author-avatar'],
|
'source_photo' => $datarray['author-avatar'],
|
||||||
|
@ -896,8 +894,7 @@ function item_post(&$a) {
|
||||||
WHERE `id` = %d",
|
WHERE `id` = %d",
|
||||||
intval($parent),
|
intval($parent),
|
||||||
dbesc(($parent == $post_id) ? $uri : $parent_item['uri']),
|
dbesc(($parent == $post_id) ? $uri : $parent_item['uri']),
|
||||||
//dbesc($a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id),
|
dbesc($a->get_baseurl().'/display/'.urlencode($datarray['guid'])),
|
||||||
dbesc($a->get_baseurl().'/display/'.$datarray['guid']),
|
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($post_id)
|
intval($post_id)
|
||||||
);
|
);
|
||||||
|
@ -930,8 +927,7 @@ function item_post(&$a) {
|
||||||
update_thread($parent);
|
update_thread($parent);
|
||||||
|
|
||||||
$datarray['id'] = $post_id;
|
$datarray['id'] = $post_id;
|
||||||
//$datarray['plink'] = $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id;
|
$datarray['plink'] = $a->get_baseurl().'/display/'.urlencode($datarray['guid']);
|
||||||
$datarray['plink'] = $a->get_baseurl().'/display/'.$datarray['guid'];
|
|
||||||
|
|
||||||
call_hooks('post_local_end', $datarray);
|
call_hooks('post_local_end', $datarray);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue