]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - actions/requesttoken.php
Merge branch '0.9.x' into activityexport
[quix0rs-gnu-social.git] / actions / requesttoken.php
1 <?php
2
3 /**
4  * Request token action class.
5  *
6  * PHP version 5
7  *
8  * @category Action
9  * @package  StatusNet
10  * @author   Evan Prodromou <evan@status.net>
11  * @author   Robin Millette <millette@status.net>
12  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
13  * @link     http://status.net/
14  *
15  * StatusNet - the distributed open-source microblogging tool
16  * Copyright (C) 2008, 2009, StatusNet, Inc.
17  *
18  * This program is free software: you can redistribute it and/or modify
19  * it under the terms of the GNU Affero General Public License as published by
20  * the Free Software Foundation, either version 3 of the License, or
21  * (at your option) any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26  * GNU Affero General Public License for more details.
27  *
28  * You should have received a copy of the GNU Affero General Public License
29  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
30  */
31
32 if (!defined('STATUSNET') && !defined('LACONICA')) {
33     exit(1);
34 }
35
36 require_once INSTALLDIR.'/lib/omb.php';
37 require_once INSTALLDIR.'/extlib/libomb/service_provider.php';
38
39 /**
40  * Request token action class.
41  *
42  * @category Action
43  * @package  StatusNet
44  * @author   Evan Prodromou <evan@status.net>
45  * @author   Robin Millette <millette@status.net>
46  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
47  * @link     http://status.net/
48  */
49 class RequesttokenAction extends Action
50 {
51      /**
52      * Is read only?
53      *
54      * @return boolean false
55      */
56     function isReadOnly()
57     {
58         return false;
59     }
60
61     /**
62      * Class handler.
63      *
64      * @param array $args array of arguments
65      *
66      * @return void
67      */
68     function handle($args)
69     {
70         parent::handle($args);
71         try {
72             $srv = new OMB_Service_Provider(null, omb_oauth_datastore(),
73                                             omb_oauth_server());
74             $srv->writeRequestToken();
75         } catch (Exception $e) {
76             $this->serverError($e->getMessage());
77         }
78     }
79 }
80 ?>