From ff3e303af72c9b57e9bfcab32b34569bf0754c55 Mon Sep 17 00:00:00 2001
From: Andrew Dolgov
Date: Mon, 22 Nov 2010 16:32:07 +0300
Subject: [PATCH] add twitter register/callback server
---
twitter.php | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 119 insertions(+)
create mode 100644 twitter.php
diff --git a/twitter.php b/twitter.php
new file mode 100644
index 000000000..0cf9fd8a7
--- /dev/null
+++ b/twitter.php
@@ -0,0 +1,119 @@
+getAccessToken($_REQUEST['oauth_verifier']);
+
+ /* If HTTP response is 200 continue otherwise send to connect page to retry */
+ if ($connection->http_code == 200) {
+ $access_token = db_escape_string(json_encode($access_token));
+
+ db_query($link, "UPDATE ttrss_users SET twitter_oauth = '$access_token'
+ WHERE id = ".$_SESSION['uid']);
+
+ } else {
+ header('Location: twitter.php?op=clear');
+ return;
+ }
+
+ }
+
+ if ($op == 'register') {
+
+ /* Build TwitterOAuth object with client credentials. */
+ $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
+
+ /* Get temporary credentials. */
+ $request_token = $connection->getRequestToken($callback_url);
+
+ /* Save temporary credentials to session. */
+ $_SESSION['oauth_token'] = $token = $request_token['oauth_token'];
+ $_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
+
+ if ($connection->http_code == 200) {
+ $url = $connection->getAuthorizeURL($token);
+ header('Location: ' . $url);
+ return;
+ }
+ }
+?>
+
+
+
+Register with Twitter
+
+
+
+
+
+
+Register with Twitter
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+