diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-08-10 07:00:59 +0000 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-08-10 07:00:59 +0000 |
commit | 27548c690350bdf0376d846a5e8e86477359297d (patch) | |
tree | 2f6d617d3256a70e8612456fcbcda346e505c476 /lib/twitteroauthclient.php | |
parent | fa8433308f5ba1209ec490d6c0835d28da18eacb (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/twitteroauthclient.php')
-rw-r--r-- | lib/twitteroauthclient.php | 17 |
1 files changed, 17 insertions, 0 deletions
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 * |