X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Frequesttoken.php;h=a17efcdd50abaf55dbc5bc21b2f7daf52cd33a0d;hb=dcca9fbec0cea9c5e15c4d58a8e9870514dfdbdd;hp=76019a92995126db827b7394ed55bf3588235166;hpb=29146a13f295a13a4ee4470cffaaa7fde6858689;p=quix0rs-gnu-social.git diff --git a/actions/requesttoken.php b/actions/requesttoken.php index 76019a9299..a17efcdd50 100644 --- a/actions/requesttoken.php +++ b/actions/requesttoken.php @@ -1,7 +1,19 @@ + * @author Robin Millette + * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 + * @link http://status.net/ + * + * StatusNet - the distributed open-source microblogging tool + * Copyright (C) 2008, 2009, StatusNet, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -17,26 +29,53 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { + exit(1); +} -require_once(INSTALLDIR.'/lib/omb.php'); +require_once INSTALLDIR.'/lib/omb.php'; -class RequesttokenAction extends Action { - - function is_readonly() { - return false; - } - - function handle($args) { - parent::handle($args); - try { - common_remove_magic_from_request(); - $req = OAuthRequest::from_request(); - $server = omb_oauth_server(); - $token = $server->fetch_request_token($req); - print $token; - } catch (OAuthException $e) { - common_server_error($e->getMessage()); - } - } +/** + * Request token action class. + * + * @category Action + * @package StatusNet + * @author Evan Prodromou + * @author Robin Millette + * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 + * @link http://status.net/ + */ +class RequesttokenAction extends Action +{ + /** + * Is read only? + * + * @return boolean false + */ + function isReadOnly($args) + { + return false; + } + + /** + * Class handler. + * + * @param array $args array of arguments + * + * @return void + */ + function handle($args) + { + parent::handle($args); + try { + common_remove_magic_from_request(); + $req = OAuthRequest::from_request('POST', common_local_url('requesttoken')); + $server = omb_oauth_server(); + $token = $server->fetch_request_token($req); + print $token.'&omb_version='.OMB_VERSION_01; + } catch (OAuthException $e) { + $this->serverError($e->getMessage()); + } + } } +