summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-06-19 14:32:38 -0400
committerEvan Prodromou <evan@prodromou.name>2008-06-19 14:32:38 -0400
commit480ca70dc8de827211c01a3ac1d75d148a21fbd9 (patch)
tree179c969bf455a13af41f4607c91767916ac9c2bd /lib
parentaabac60b6eb04b7f4c25a96fa1c103baf1cf53e0 (diff)
try to clear openid url cookie better
darcs-hash:20080619183238-84dde-dbe912a40894ec7414e6d5ea0bc40ec527385436.gz
Diffstat (limited to 'lib')
-rw-r--r--lib/openid.php29
1 files changed, 21 insertions, 8 deletions
diff --git a/lib/openid.php b/lib/openid.php
index 8cf614bc2..b066c654d 100644
--- a/lib/openid.php
+++ b/lib/openid.php
@@ -49,21 +49,34 @@ function oid_consumer() {
}
function oid_clear_last() {
- if (oid_get_last()) {
- oid_set_last('');
- }
+ oid_set_last('');
}
function oid_set_last($openid_url) {
- global $config;
- setcookie(OPENID_COOKIE_KEY, $openid_url,
+
+ $path = common_config('site', 'path');
+ $server = common_config('site', 'server');
+
+ if ($path && ($path != '/')) {
+ $cookiepath = '/' . $path . '/';
+ } else {
+ $cookiepath = '/';
+ }
+
+ setcookie(OPENID_COOKIE_KEY,
+ $openid_url,
time() + OPENID_COOKIE_EXPIRY,
- '/' . $config['site']['path'] . '/',
- $config['site']['server']);
+ $cookiepath,
+ $server);
}
function oid_get_last() {
- return $_COOKIE[OPENID_COOKIE_KEY];
+ $openid_url = $_COOKIE[OPENID_COOKIE_KEY];
+ if ($openid_url && strlen($openid_url) > 0) {
+ return $openid_url;
+ } else {
+ return NULL;
+ }
}
function oid_link_user($id, $canonical, $display) {