From 96a9378fd74eb45599ef2152d55286293968b298 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 3 Sep 2014 21:14:24 -0700 Subject: this is turning into a wretched mess. It's going to get worse before it gets better, but I'm trying to do this incrementally so I don't break the whole shebang for a few days. It will get better once all the bbcode translation is done in a single place (cross fingers), and we can just sign the post once when we submit it and be done with it. If Diaspora ever implements editing of existing posts we'll have to go back and do the whole wretched mess over again. --- include/diaspora.php | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'include/diaspora.php') diff --git a/include/diaspora.php b/include/diaspora.php index fabcafa79..ae2c1184a 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -2278,20 +2278,29 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) { $body = str_replace("\n\n\n", "\n\n", $body); } while ($oldbody != $body); + if($item['diaspora_meta']) { + $j = json_decode($item['diaspora_meta'],true); + if($j && $j['body']) { + $body = xmlify($j['body']); + } + } + else { + $body = xmlify(html_entity_decode(bb2diaspora($body))); - // convert to markdown - $body = xmlify(html_entity_decode(bb2diaspora($body))); - // Adding the title - if(strlen($title)) - $body = "## ".html_entity_decode($title)."\n\n".$body; + // convert to markdown - if($item['attach']) { - $cnt = preg_match_all('/href=\"(.*?)\"(.*?)title=\"(.*?)\"/ism',$item['attach'],$matches,PREG_SET_ORDER); - if(cnt) { - $body .= "\n" . t('Attachments:') . "\n"; - foreach($matches as $mtch) { - $body .= '[' . $mtch[3] . '](' . $mtch[1] . ')' . "\n"; + // Adding the title + if(strlen($title)) + $body = "## ".html_entity_decode($title)."\n\n".$body; + + if($item['attach']) { + $cnt = preg_match_all('/href=\"(.*?)\"(.*?)title=\"(.*?)\"/ism',$item['attach'],$matches,PREG_SET_ORDER); + if(cnt) { + $body .= "\n" . t('Attachments:') . "\n"; + foreach($matches as $mtch) { + $body .= '[' . $mtch[3] . '](' . $mtch[1] . ')' . "\n"; + } } } } -- cgit v1.2.3