*/
class ApiAccountVerifyCredentialsAction extends ApiAuthAction
{
- protected function handle()
+ /**
+ * Handle the request
+ *
+ * Check whether the credentials are valid and output the result
+ *
+ * @param array $args $_REQUEST data (unused)
+ * @return void
+ */
- function handle(array $args=array())
++ protected function handle(array $args=array())
{
- parent::handle();
+ parent::handle($args);
if (!in_array($this->format, array('xml', 'json'))) {
// TRANS: Client error displayed when coming across a non-supported API method.
*
* @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
var $page = null;
var $notice;
- var $userProfile = null;
+
+ protected $stream = null;
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
*
* @return void
*/
- function handle(array $args=array())
- protected function handle()
++ protected function handle(array $args=array())
{
- parent::handle($args);
+ parent::handle();
$this->showPage();
}
// @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;