diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-12-13 19:15:42 -0800 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-12-13 19:15:42 -0800 |
commit | fdd2da905a27fab838aa34ef7baf0ee2c5c3c5f7 (patch) | |
tree | 0b15e6b628627ddfd1ed2709bebc2e7e8a7e9e83 /mod | |
parent | 2cceca49e9a0666ceaeb5758603a6ec3e5d75171 (diff) | |
download | volse-hubzilla-fdd2da905a27fab838aa34ef7baf0ee2c5c3c5f7.tar.gz volse-hubzilla-fdd2da905a27fab838aa34ef7baf0ee2c5c3c5f7.tar.bz2 volse-hubzilla-fdd2da905a27fab838aa34ef7baf0ee2c5c3c5f7.zip |
more work on api media uploads
Diffstat (limited to 'mod')
-rw-r--r-- | mod/wall_attach.php | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/mod/wall_attach.php b/mod/wall_attach.php index 8677c2b83..f52a4f2e5 100644 --- a/mod/wall_attach.php +++ b/mod/wall_attach.php @@ -6,14 +6,16 @@ require_once('include/photos.php'); function wall_attach_post(&$a) { - if(argc() > 1) - $channel = get_channel_by_nick(argv(1)); - elseif($_FILES['media']) { - require_once('include/api.php'); - $user_info = api_get_user($a); + $using_api = false; + + if($a->data['api_info'] && array_key_exists('media',$_FILES)) { + $using_api = true; + $user_info = $a->data['api_info']; $nick = $user_info['screen_name']; $channel = get_channel_by_nick($user_info['screen_name']); - } + } + elseif(argc() > 1) + $channel = get_channel_by_nick(argv(1)); if(! $channel) killme(); @@ -49,12 +51,16 @@ function wall_attach_post(&$a) { } if(intval($r['data']['is_photo'])) { - echo "\n\n" . $r['body'] . "\n\n"; - if($using_api) - return; - killme(); + $s = "\n\n" . $r['body'] . "\n\n"; + } + else { + $s = "\n\n" . '[attachment]' . $r['data']['hash'] . ',' . $r['data']['revision'] . '[/attachment]' . "\n"; } - echo "\n\n" . '[attachment]' . $r['data']['hash'] . ',' . $r['data']['revision'] . '[/attachment]' . "\n"; + + if($using_api) + return $s; + + echo $s; killme(); } |