From: Roland Haeder Date: Wed, 21 Jan 2015 18:40:47 +0000 (+0100) Subject: Merge branch 'nightly' of gitorious.org:social/mainline into nightly X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ac5b7095b3c270c3a91a704afd7a47e0f4e180c1;p=quix0rs-gnu-social.git Merge branch 'nightly' of gitorious.org:social/mainline into nightly Signed-off-by: Roland Haeder Conflicts: actions/apimediaupload.php actions/register.php plugins/OStatus/scripts/update_ostatus_profiles.php plugins/OpportunisticQM/lib/opportunisticqueuemanager.php --- ac5b7095b3c270c3a91a704afd7a47e0f4e180c1 diff --cc actions/apimediaupload.php index 14c26d238f,2d81af157e..a3703fad06 --- a/actions/apimediaupload.php +++ b/actions/apimediaupload.php @@@ -53,18 -53,10 +53,10 @@@ class ApiMediaUploadAction extends ApiA * * @return void */ - function handle(array $args=array()) - protected function handle() ++ protected function handle(array $args=array()) { - parent::handle(); + parent::handle($args); - if ($_SERVER['REQUEST_METHOD'] != 'POST') { - $this->clientError( - // TRANS: Client error. POST is a HTTP command. It should not be translated. - _('This method requires a POST.'), - 400, $this->format - ); - } - // Workaround for PHP returning empty $_POST and $_FILES when POST // length > post_max_size in php.ini diff --cc plugins/OStatus/classes/Ostatus_profile.php index d698ba81a3,2fb869e2f3..4081edadaa --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@@ -1261,12 -1260,17 +1261,17 @@@ class Ostatus_profile extends Managed_D // @todo FIXME: This should be better encapsulated // ripped from oauthstore.php (for old OMB client) - $temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar'); + $temp_filename = tempnam(common_get_temp_dir(), 'listener_avatar'); try { - if (!copy($url, $temp_filename)) { + $client = new HTTPClient(); + $response = $client->get($url); + + if (!$response->isOk()) { // TRANS: Server exception. %s is a URL. - throw new ServerException(sprintf(_m('Unable to fetch avatar from %s.'), $url)); + throw new ServerException(sprintf(_m('Unable to fetch avatar from %s to %s.'), $url, $temp_filename)); } + // FIXME: make sure it's an image here instead of _after_ writing to a file? + file_put_contents($temp_filename, $response->getBody()); if ($this->isGroup()) { $id = $this->group_id;