From 9ffc6f389702360adf7bf7aecd6d3f7fdce0fa52 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 4 Apr 2014 11:07:19 +0200 Subject: [PATCH] fbpost: When posting comments, now links don't disappear anymore --- fbpost/fbpost.php | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/fbpost/fbpost.php b/fbpost/fbpost.php index 919e0f8f6..839c42b33 100644 --- a/fbpost/fbpost.php +++ b/fbpost/fbpost.php @@ -207,7 +207,7 @@ function fbpost_content(&$a) { $a->page['htmlhead'] .= '' . "\r\n"; - $o .= '

' . t('Facebook') . '

'; + $o .= '

' . t('Facebook Export/Mirror') . '

'; if(! $fb_installed) { $o .= '
'; @@ -293,7 +293,7 @@ function fbpost_content(&$a) { function fbpost_plugin_settings(&$a,&$b) { $b .= ''; } @@ -634,22 +634,32 @@ function fbpost_post_hook(&$a,&$b) { logger('fbpost_post_hook: original msg=' . $msg, LOGGER_DATA); - // To-Do: if it is a reply, then only do a simple bbcode2plain conversion - $msgarr = fbpost_createmsg($b); - $msg = $msgarr["msg"]; - $link = $msgarr["link"]; - $image = $msgarr["image"]; - $linkname = $msgarr["linkname"]; + if ($toplevel) { + $msgarr = fbpost_createmsg($b); + $msg = $msgarr["msg"]; + $link = $msgarr["link"]; + $image = $msgarr["image"]; + $linkname = $msgarr["linkname"]; - // Fallback - if message is empty - if(!strlen($msg)) - $msg = $linkname; + // Fallback - if message is empty + if(!strlen($msg)) + $msg = $linkname; - if(!strlen($msg)) - $msg = $link; + if(!strlen($msg)) + $msg = $link; - if(!strlen($msg)) - $msg = $image; + if(!strlen($msg)) + $msg = $image; + } else { + require_once("include/bbcode.php"); + require_once("include/html2plain.php"); + $msg = bb_CleanPictureLinks($msg); + $msg = bbcode($msg, false, false, 2, true); + $msg = trim(html2plain($msg, 0)); + $link = ""; + $image = ""; + $linkname = ""; + } // If there is nothing to post then exit if(!strlen($msg)) @@ -1106,7 +1116,7 @@ function fbpost_fetchwall($a, $uid) { } if ($content) - $_REQUEST["body"] .= "\n\n"; + $_REQUEST["body"] .= "\n"; if ($type) $_REQUEST["body"] .= "[class=type-".$type."]";