From 344b8593a818c9ea1d07a365b8a2496d699b1620 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 1 Feb 2013 00:49:07 -0800 Subject: sort out the rest of the nasty stuff in the attachment/file api - time to move on to something else --- mod/item.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'mod/item.php') diff --git a/mod/item.php b/mod/item.php index c482f3ea9..8d01a12f8 100644 --- a/mod/item.php +++ b/mod/item.php @@ -471,14 +471,19 @@ function item_post(&$a) { $match = false; if(preg_match_all('/(\[attachment\](.*?)\[\/attachment\])/',$body,$match)) { + $attachments = array(); foreach($match[2] as $mtch) { $hash = substr($mtch,0,strpos($mtch,',')); $rev = intval(substr($mtch,strpos($mtch,','))); $r = attach_by_hash_nodata($hash,$rev); if($r['success']) { - if(strlen($attachments)) - $attachments .= ','; - $attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r['data']['hash'] . '" length="' . $r['data']['filesize'] . '" type="' . $r['data']['filetype'] . '" title="' . urlencode($r['data']['filename']) . '" revision="' . $r['data']['revision'] . '"[/attach]'; + $attachments[] = array( + 'href' => $a->get_baseurl() . '/attach/' . $r['data']['hash'], + 'length' => $r['data']['filesize'], + 'type' => $r['data']['filetype'], + 'title' => urlencode($r['data']['filename']), + 'revision' => $r['data']['revision'] + ); } $body = str_replace($match[1],'',$body); } -- cgit v1.2.3