diff options
author | Craig Andrews <candrews@integralblue.com> | 2010-10-14 15:27:17 -0400 |
---|---|---|
committer | Craig Andrews <candrews@integralblue.com> | 2010-10-14 15:27:17 -0400 |
commit | 0721d8d3e257709d27994eb4ab4bbe60abc93e2e (patch) | |
tree | 58cb9e3b5f8df089353617b498c340ad9276519b /lib/oauthstore.php | |
parent | f79dbaf9a76c10969dbc45fd43a0bb26f5f64ed4 (diff) | |
parent | fc6711327bcb2319139171ad3353603753f13eaa (diff) |
Merge remote branch 'statusnet/0.9.x' into 1.0.x
Diffstat (limited to 'lib/oauthstore.php')
-rw-r--r-- | lib/oauthstore.php | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/lib/oauthstore.php b/lib/oauthstore.php index f3ee629fd..1c8e72500 100644 --- a/lib/oauthstore.php +++ b/lib/oauthstore.php @@ -55,6 +55,17 @@ class StatusNetOAuthDataStore extends OAuthDataStore } } + function getTokenByKey($token_key) + { + $t = new Token(); + $t->tok = $token_key; + if ($t->find(true)) { + return $t; + } else { + return null; + } + } + // http://oauth.net/core/1.0/#nonce // "The Consumer SHALL then generate a Nonce value that is unique for // all requests with that timestamp." @@ -317,13 +328,18 @@ class StatusNetOAuthDataStore extends OAuthDataStore function add_avatar($profile, $url) { $temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar'); - copy($url, $temp_filename); - $imagefile = new ImageFile($profile->id, $temp_filename); - $filename = Avatar::filename($profile->id, - image_type_to_extension($imagefile->type), - null, - common_timestamp()); - rename($temp_filename, Avatar::path($filename)); + try { + copy($url, $temp_filename); + $imagefile = new ImageFile($profile->id, $temp_filename); + $filename = Avatar::filename($profile->id, + image_type_to_extension($imagefile->type), + null, + common_timestamp()); + rename($temp_filename, Avatar::path($filename)); + } catch (Exception $e) { + unlink($temp_filename); + throw $e; + } return $profile->setOriginal($filename); } |