From eb2ec89bc724f52d93d4ad438a3facbb5ebfb9a6 Mon Sep 17 00:00:00 2001 From: Matthew Andersen Date: Mon, 17 Jun 2013 15:29:16 -0700 Subject: [PATCH] * Fixed scoping issue with function call to `pkcs5pad`. * Fix for for when the user logged in with an email address, photos would not be returned because fetch() wasn't using the real username. --- snaphax.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/snaphax.php b/snaphax.php index e783cdc..608e2cb 100644 --- a/snaphax.php +++ b/snaphax.php @@ -74,6 +74,9 @@ function login() { !empty($out['auth_token'])) { $this->auth_token = $out['auth_token']; } + if ( is_array($out) && !empty($out['username']) ) { + $this->options['username'] = $out['username']; + } return $out; } function friend($action, $friend, $display=NULL) { @@ -234,11 +237,11 @@ function pkcs5pad($data) { } function decrypt($data) { - return mcrypt_decrypt('rijndael-128', $this->options['blob_enc_key'], pkcs5pad($data), 'ecb'); + return mcrypt_decrypt('rijndael-128', $this->options['blob_enc_key'], SnaphaxApi::pkcs5pad($data), 'ecb'); } function encrypt($data) { - return mcrypt_encrypt('rijndael-128', $this->options['blob_enc_key'], pkcs5pad($data), 'ecb'); + return mcrypt_encrypt('rijndael-128', $this->options['blob_enc_key'], SnaphaxApi::pkcs5pad($data), 'ecb'); } public function postCall($endpoint, $post_data, $param1, $param2, $json=1, $headers=false) {