]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/requesttoken.php
Update copyright dates in files modified in 2009
[quix0rs-gnu-social.git] / actions / requesttoken.php
index 731d260ffd2b36ca5d7314373f409bb931eecd1b..8d1e3f004342ea399a9a35efb80386b57063bc58 100644 (file)
@@ -1,7 +1,19 @@
 <?php
-/*
+
+/**
+ * Request token action class.
+ *
+ * PHP version 5
+ *
+ * @category Action
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Robin Millette <millette@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link     http://laconi.ca/
+ *
  * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+ * Copyright (C) 2008, 2009, Control Yourself, 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
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
 
-class RequesttokenAction extends Action {
-       function handle($args) {
-               parent::handle($args);
-               common_server_error(_t('Not yet implemented.'));
-       }
+require_once INSTALLDIR.'/lib/omb.php';
+
+/**
+ * Request token action class.
+ *
+ * @category Action
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Robin Millette <millette@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link     http://laconi.ca/
+ */
+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;
+        } catch (OAuthException $e) {
+            $this->serverError($e->getMessage());
+        }
+    }
 }
+