aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-02-01 00:49:07 -0800
committerfriendica <info@friendica.com>2013-02-01 00:49:07 -0800
commit344b8593a818c9ea1d07a365b8a2496d699b1620 (patch)
tree9669c68a798c743b1ef860a9e73696740dad94ca /include/items.php
parent5ca88ca10a11a76237aa34d1d93ba3e878567767 (diff)
downloadvolse-hubzilla-344b8593a818c9ea1d07a365b8a2496d699b1620.tar.gz
volse-hubzilla-344b8593a818c9ea1d07a365b8a2496d699b1620.tar.bz2
volse-hubzilla-344b8593a818c9ea1d07a365b8a2496d699b1620.zip
sort out the rest of the nasty stuff in the attachment/file api - time to move on to something else
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/items.php b/include/items.php
index 6618fe876..5afb0816d 100755
--- a/include/items.php
+++ b/include/items.php
@@ -496,7 +496,7 @@ function get_item_elements($x) {
$arr['object'] = activity_sanitise($x['object']);
$arr['target'] = activity_sanitise($x['target']);
- $arr['attach'] = implode(',',activity_sanitise($x['attach']));
+ $arr['attach'] = activity_sanitise($x['attach']);
$arr['term'] = decode_tags($x['tags']);
$arr['item_private'] = ((array_key_exists('flags',$x) && is_array($x['flags']) && in_array('private',$x['flags'])) ? 1 : 0);
@@ -588,7 +588,7 @@ function encode_item($item) {
if($item['target'])
$x['target'] = json_decode($item['target'],true);
if($item['attach'])
- $x['attach'] = explode(',', $item['attach']);
+ $x['attach'] = json_decode($item['attach'],true);
if($y = encode_item_flags($item))
$x['flags'] = $y;
if($item['term'])
@@ -1260,6 +1260,11 @@ function item_store($arr,$force_parent = false) {
$arr['target'] = json_encode($arr['target']);
}
+ if((x($arr,'attach')) && is_array($arr['attach'])) {
+ activity_sanitise($arr['attach']);
+ $arr['attach'] = json_encode($arr['attach']);
+ }
+
$arr['aid'] = ((x($arr,'aid')) ? intval($arr['aid']) : 0);
$arr['uri'] = ((x($arr,'uri')) ? notags(trim($arr['uri'])) : random_string());
$arr['author_xchan'] = ((x($arr,'author_xchan')) ? notags(trim($arr['author_xchan'])) : '');