aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-01-31 23:56:46 -0800
committerfriendica <info@friendica.com>2013-01-31 23:56:46 -0800
commit5ca88ca10a11a76237aa34d1d93ba3e878567767 (patch)
tree01f0ed98ea409e8183469bf616c572cd9046cee7 /include
parent6b3d36c36d9a1c2da3e338ef7802c77b5fd82167 (diff)
downloadvolse-hubzilla-5ca88ca10a11a76237aa34d1d93ba3e878567767.tar.gz
volse-hubzilla-5ca88ca10a11a76237aa34d1d93ba3e878567767.tar.bz2
volse-hubzilla-5ca88ca10a11a76237aa34d1d93ba3e878567767.zip
debugging of file attachment api - somewhat functional but the attachment info structure in the item table needs to be re-done.
Diffstat (limited to 'include')
-rw-r--r--include/attach.php13
-rwxr-xr-xinclude/items.php4
2 files changed, 9 insertions, 8 deletions
diff --git a/include/attach.php b/include/attach.php
index 3775d840c..b2c57f36f 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -1,5 +1,6 @@
<?php
+require_once('include/permissions.php');
function z_mime_content_type($filename) {
@@ -255,7 +256,7 @@ function attach_store($channel,$observer_hash,$options = '',$arr = null) {
$channel_id = $channel['channel_id'];
$sql_options = '';
- if(! perm_is_allowed($channel_id,$observer_hash(),'write_storage')) {
+ if(! perm_is_allowed($channel_id,get_observer_hash(),'write_storage')) {
$ret['message'] = t('Permission denied.');
return $ret;
}
@@ -299,7 +300,7 @@ function attach_store($channel,$observer_hash,$options = '',$arr = null) {
if($options === 'update' && $arr && array_key_exists('revision',$arr))
$sql_options = " and revision = " . intval($arr['revision']) . " ";
- $x =q("select id, aid, uid, hash, revision, created, edited, allow_cid, allow_gid, deny_cid, deny_gid from attach where hash = '%s' and uid = %d $sql_options limit 1",
+ $x =q("select id, aid, uid, filename, filetype, filesize, hash, revision, created, edited, allow_cid, allow_gid, deny_cid, deny_gid from attach where hash = '%s' and uid = %d $sql_options limit 1",
dbesc($arr['hash']),
intval($channel_id)
);
@@ -397,10 +398,10 @@ function attach_store($channel,$observer_hash,$options = '',$arr = null) {
dbesc(@file_get_contents($src)),
dbesc($created),
dbesc($created),
- dbesc((array_key_exists('allow_cid',$arr)) ? $arr['allow_cid'] : '<' . $channel['channel_hash'] . '>'),
- dbesc((array_key_exists('allow_gid',$arr)) ? $arr['allow_gid'] : ''),
- dbesc((array_key_exists('deny_cid',$arr)) ? $arr['deny_cid'] : ''),
- dbesc((array_key_exists('deny_gid',$arr)) ? $arr['deny_gid'] : '')
+ dbesc(($arr && array_key_exists('allow_cid',$arr)) ? $arr['allow_cid'] : '<' . $channel['channel_hash'] . '>'),
+ dbesc(($arr && array_key_exists('allow_gid',$arr)) ? $arr['allow_gid'] : ''),
+ dbesc(($arr && array_key_exists('deny_cid',$arr)) ? $arr['deny_cid'] : ''),
+ dbesc(($arr && array_key_exists('deny_gid',$arr)) ? $arr['deny_gid'] : '')
);
}
diff --git a/include/items.php b/include/items.php
index 92e256ea9..6618fe876 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'] = activity_sanitise($x['attach']);
+ $arr['attach'] = implode(',',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'] = json_decode($item['attach'],true);
+ $x['attach'] = explode(',', $item['attach']);
if($y = encode_item_flags($item))
$x['flags'] = $y;
if($item['term'])