diff options
Diffstat (limited to 'mod/item.php')
-rw-r--r-- | mod/item.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mod/item.php b/mod/item.php index 4dcf8edd7..5f45a248b 100644 --- a/mod/item.php +++ b/mod/item.php @@ -474,6 +474,7 @@ function item_post(&$a) { if($uid && $uid == $profile_uid && feature_enabled($uid,'markdown')) { require_once('include/bb2diaspora.php'); $body = escape_tags($body); + $body = str_replace("\n",'<br />', $body); $body = preg_replace_callback('/\[share(.*?)\]/ism','share_shield',$body); $body = diaspora2bb($body,true); $body = preg_replace_callback('/\[share(.*?)\]/ism','share_unshield',$body); @@ -607,6 +608,7 @@ function item_post(&$a) { if(preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) { $attachments = array(); + $i = 0; foreach($match[2] as $mtch) { $attach_link = ''; $hash = substr($mtch,0,strpos($mtch,',')); @@ -626,7 +628,8 @@ function item_post(&$a) { $attach_link = '[audio]' . z_root() . '/attach/' . $r['data']['hash'] . '/' . $r['data']['revision'] . (($ext) ? $ext : '') . '[/audio]'; elseif(strpos($r['data']['filetype'],'video/') !== false) $attach_link = '[video]' . z_root() . '/attach/' . $r['data']['hash'] . '/' . $r['data']['revision'] . (($ext) ? $ext : '') . '[/video]'; - $body = str_replace($match[1],$attach_link,$body); + $body = str_replace($match[1][$i],$attach_link,$body); + $i++; } } |