diff options
author | tailor <cygnus@janrain.com> | 2006-01-13 21:51:26 +0000 |
---|---|---|
committer | tailor <cygnus@janrain.com> | 2006-01-13 21:51:26 +0000 |
commit | 9f50b7803eb8292628d0fca287076b072bf13c1e (patch) | |
tree | a524c74d7badfe220042ba624c9178aebf1be267 | |
parent | 20c18d8e48e3a93f94865279255b9c64fc61ccce (diff) | |
download | php-openid-9f50b7803eb8292628d0fca287076b072bf13c1e.zip php-openid-9f50b7803eb8292628d0fca287076b072bf13c1e.tar.gz php-openid-9f50b7803eb8292628d0fca287076b072bf13c1e.tar.bz2 |
[project @ Updated consumer to un-mangle PHP CGI data]
-rw-r--r-- | Net/OpenID/Consumer/Consumer.php | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/Net/OpenID/Consumer/Consumer.php b/Net/OpenID/Consumer/Consumer.php index 0fbe335..616b330 100644 --- a/Net/OpenID/Consumer/Consumer.php +++ b/Net/OpenID/Consumer/Consumer.php @@ -59,7 +59,7 @@ class Net_OpenID_Consumer { $this->store =& $store; if ($fetcher === null) { - $this->fetcher = _getHTTPFetcher(); + $this->fetcher = Net_OpenID_getHTTPFetcher(); } else { $this->fetcher =& $fetcher; } @@ -92,14 +92,39 @@ class Net_OpenID_Consumer { $replace = 1); // Because _getAssociation is asynchronous if the association is // not already in the store. + + if ($assoc === null) { + trigger_error("Could not get association for redirection", + E_USER_WARNING); + return null; + } + return $this->_constructRedirect($assoc, $auth_request, $return_to, $trust_root); } + function fixResponse($arr) + { + // Depending on PHP settings, the query data received may have + // been modified so that incoming "." values in the keys have + // been replaced with underscores. Look specifically for + // "openid_" and replace it with "openid.". + $result = array(); + + foreach ($arr as $key => $value) { + $new_key = str_replace("openid_", "openid.", $key); + $result[$new_key] = $value; + } + + return $result; + } + function completeAuth($token, $query) { global $Net_OpenID_SUCCESS, $Net_OpenID_FAILURE; + $query = $this->fixResponse($query); + $mode = Net_OpenID_array_get($query, 'openid.mode', ''); if ($mode == 'cancel') { |