From e45beccd5b7f5f56f3bda9f09e77e4c0f9669fcd Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 25 Jul 2013 05:04:52 -0700 Subject: fix media uploads in api (specifically friendica for android) --- include/api.php | 14 +++++++++++--- include/zot.php | 34 ---------------------------------- 2 files changed, 11 insertions(+), 37 deletions(-) (limited to 'include') diff --git a/include/api.php b/include/api.php index ac86178a6..a49258d18 100644 --- a/include/api.php +++ b/include/api.php @@ -610,6 +610,15 @@ require_once('include/photos.php'); return false; } + logger('api_statuses_update: REQUEST ' . print_r($_REQUEST,true)); + logger('api_statuses_update: FILES ' . print_r($_FILES,true)); + + + // set this so that the item_post() function is quiet and doesn't redirect or emit json + + $_REQUEST['api_source'] = true; + + $user_info = api_get_user($a); // convert $_POST array items to the form we use for web posts. @@ -655,7 +664,9 @@ require_once('include/photos.php'); $_REQUEST['type'] = 'net-comment'; else { $_REQUEST['type'] = 'wall'; + if(x($_FILES,'media')) { + $_FILES['userfile'] = $_FILES['media']; // upload the image if we have one $_REQUEST['silent']='1'; //tell wall_upload function to return img info instead of echo require_once('mod/wall_upload.php'); @@ -665,9 +676,6 @@ require_once('include/photos.php'); } } - // set this so that the item_post() function is quiet and doesn't redirect or emit json - - $_REQUEST['api_source'] = true; // call out normal post function diff --git a/include/zot.php b/include/zot.php index 256f5587d..609107936 100644 --- a/include/zot.php +++ b/include/zot.php @@ -47,40 +47,6 @@ function zot_get_hubloc($arr,$primary = false) { } -/** - * obsolete - -function zot_notify($channel,$url,$type = 'notify',$recipients = null, $remote_key = null) { - - $params = array( - 'type' => $type, - 'sender' => json_encode(array( - 'guid' => $channel['channel_guid'], - 'guid_sig' => base64url_encode(rsa_sign($channel['channel_guid'],$channel['channel_prvkey'])), - 'url' => z_root(), - 'url_sig' => base64url_encode(rsa_sign(z_root(),$channel['channel_prvkey'])) - )), - 'callback' => '/post', - 'version' => ZOT_REVISION - ); - - - if($recipients) - $params['recipients'] = json_encode($recipients); - - // Hush-hush ultra top-secret mode - - if($remote_key) { - $params = aes_encapsulate($params,$remote_key); - } - - $x = z_post_url($url,$params); - return($x); -} -*/ - - - /* * * zot_build_packet builds a notification packet that you can either -- cgit v1.2.3