diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-10-12 23:37:35 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-10-12 23:37:35 -0700 |
commit | 75fe9f9cc4321fcc1e51f679861a2e470e5e41ca (patch) | |
tree | f4c487c3d689f5babecfe0c7e8f57aa50dc0eefa /include | |
parent | 91895c52ca38971e6007691f48c6186b9ecceb2f (diff) | |
parent | 73dad85867b1d55a7da7fea99c90c6364b85b399 (diff) | |
download | volse-hubzilla-75fe9f9cc4321fcc1e51f679861a2e470e5e41ca.tar.gz volse-hubzilla-75fe9f9cc4321fcc1e51f679861a2e470e5e41ca.tar.bz2 volse-hubzilla-75fe9f9cc4321fcc1e51f679861a2e470e5e41ca.zip |
Merge https://github.com/redmatrix/redmatrix into pending_merge
Diffstat (limited to 'include')
-rw-r--r-- | include/api.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/api.php b/include/api.php index cb4b525b3..da612b2b2 100644 --- a/include/api.php +++ b/include/api.php @@ -627,6 +627,30 @@ require_once('include/attach.php'); api_register_func('api/red/files','api_attach_list', true); + function api_file_detail(&$a,$type) { + if (api_user()===false) return false; + if(! $_REQUEST['file_id']) return false; + $r = q("select * from attach where uid = %d and hash = '%s' limit 1", + intval(api_user()), + dbesc($_REQUEST['file_id']) + ); + if($r) { + $data = dbunescbin($r[0]['data']); + if($r[0]['flags'] & ATTACH_FLAG_DIR) + $r[0]['is_dir'] = '1'; + if($r[0]['flags'] & ATTACH_FLAG_OS) + $r[0]['data'] = base64_encode(file_get_contents(dbunescbin($r[0]['data']))); + else + $r[0]['data'] = base64_encode(dbunescbin($r[0]['data'])); + + $ret = array('attach' => $r[0]); + json_return_and_die($ret); + } + killme(); + } + + api_register_func('api/red/file', 'api_file_detail', true); + function api_albums(&$a,$type) { json_return_and_die(photos_albums_list($a->get_channel(),$a->get_observer())); |