diff options
author | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2015-12-14 18:55:43 +0100 |
---|---|---|
committer | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2015-12-14 18:55:43 +0100 |
commit | 3b1ab5e79cbbf2a8f65cb4dc388e2257a3e857af (patch) | |
tree | 84b87fb47a27035afd2a354d11c36e8259f4c18e /mod/wall_attach.php | |
parent | 565126a888d70dce853a2351b698bbc0695f0ba9 (diff) | |
parent | dcf7946673fd57325fc848df8f8cea7a84cc35b6 (diff) | |
download | volse-hubzilla-3b1ab5e79cbbf2a8f65cb4dc388e2257a3e857af.tar.gz volse-hubzilla-3b1ab5e79cbbf2a8f65cb4dc388e2257a3e857af.tar.bz2 volse-hubzilla-3b1ab5e79cbbf2a8f65cb4dc388e2257a3e857af.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'mod/wall_attach.php')
-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(); } |