aboutsummaryrefslogtreecommitdiffstats
path: root/include/api.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-11-04 20:50:43 -0800
committerredmatrix <redmatrix@redmatrix.me>2015-11-04 20:50:43 -0800
commitf7468ab473f49b9594095d29a50f8e921d0b15af (patch)
tree755114561d4d94963e63df0cc5f7521410a5edc6 /include/api.php
parent1213893a71377237807ab9609bdc103d61701744 (diff)
downloadvolse-hubzilla-f7468ab473f49b9594095d29a50f8e921d0b15af.tar.gz
volse-hubzilla-f7468ab473f49b9594095d29a50f8e921d0b15af.tar.bz2
volse-hubzilla-f7468ab473f49b9594095d29a50f8e921d0b15af.zip
re-arrange file api calls so the api pathnames don't shadow each other
Diffstat (limited to 'include/api.php')
-rw-r--r--include/api.php46
1 files changed, 25 insertions, 21 deletions
diff --git a/include/api.php b/include/api.php
index 4ac4dabba..3862ba7eb 100644
--- a/include/api.php
+++ b/include/api.php
@@ -628,28 +628,7 @@ 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) {
- if($r[0]['is_dir'])
- $r[0]['data'] = '';
- elseif(intval($r[0]['os_storage']))
- $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_file_meta(&$a,$type) {
@@ -709,6 +688,31 @@ require_once('include/attach.php');
api_register_func('api/red/filedata', 'api_file_data', 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) {
+ if($r[0]['is_dir'])
+ $r[0]['data'] = '';
+ elseif(intval($r[0]['os_storage']))
+ $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()));
}