summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2009-08-10 07:00:59 +0000
committerZach Copley <zach@controlyourself.ca>2009-08-10 07:00:59 +0000
commit27548c690350bdf0376d846a5e8e86477359297d (patch)
tree2f6d617d3256a70e8612456fcbcda346e505c476 /lib
parentfa8433308f5ba1209ec490d6c0835d28da18eacb (diff)
I forgot that we don't do database upgrades for point releases. So I've
changed Twitter OAuth to store token and token secret in the same field in foreign_link (credentials). This should be changed in 0.9.
Diffstat (limited to 'lib')
-rw-r--r--lib/oauthclient.php2
-rw-r--r--lib/twitter.php4
-rw-r--r--lib/twitteroauthclient.php17
3 files changed, 20 insertions, 3 deletions
diff --git a/lib/oauthclient.php b/lib/oauthclient.php
index 878e47091..b66a24be4 100644
--- a/lib/oauthclient.php
+++ b/lib/oauthclient.php
@@ -121,8 +121,6 @@ class OAuthClient
$authorize_url .= '&oauth_callback=' . urlencode($oauth_callback);
}
- common_debug("$authorize_url");
-
return $authorize_url;
}
diff --git a/lib/twitter.php b/lib/twitter.php
index 4e2f67c66..280cdb0a3 100644
--- a/lib/twitter.php
+++ b/lib/twitter.php
@@ -160,7 +160,9 @@ function broadcast_twitter($notice)
// XXX: Hack to get around PHP cURL's use of @ being a a meta character
$statustxt = preg_replace('/^@/', ' @', $notice->content);
- $client = new TwitterOAuthClient($flink->token, $flink->credentials);
+ $token = TwitterOAuthClient::unpackToken($flink->credentials);
+
+ $client = new TwitterOAuthClient($token->key, $token->secret);
$status = null;
diff --git a/lib/twitteroauthclient.php b/lib/twitteroauthclient.php
index c798ac877..b7dc4a80c 100644
--- a/lib/twitteroauthclient.php
+++ b/lib/twitteroauthclient.php
@@ -64,6 +64,23 @@ class TwitterOAuthClient extends OAuthClient
$oauth_token, $oauth_token_secret);
}
+ // XXX: the following two functions are to support the horrible hack
+ // of using the credentils field in Foreign_link to store both
+ // the access token and token secret. This hack should go away with
+ // 0.9, in which we can make DB changes and add a new column for the
+ // token itself.
+
+ static function packToken($token)
+ {
+ return implode(chr(0), array($token->key, $token->secret));
+ }
+
+ static function unpackToken($str)
+ {
+ $vals = explode(chr(0), $str);
+ return new OAuthToken($vals[0], $vals[1]);
+ }
+
/**
* Builds a link to Twitter's endpoint for authorizing a request token
*