From 4d7479dcbc3d0f658de230c139242e7176d0ba16 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 12 Mar 2010 10:07:32 -0800 Subject: OpenID fixes: - avoid notice spew when checking sreg items that weren't provided - fix keys spec for user_openid, clears up problems with removing openid associations - fix keys spec for user_openid_trustroot --- plugins/OpenID/User_openid.php | 5 +++++ plugins/OpenID/User_openid_trustroot.php | 5 +++++ plugins/OpenID/openid.php | 6 +++--- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'plugins/OpenID') diff --git a/plugins/OpenID/User_openid.php b/plugins/OpenID/User_openid.php index 5ef05b4c7..1beff9ea3 100644 --- a/plugins/OpenID/User_openid.php +++ b/plugins/OpenID/User_openid.php @@ -44,6 +44,11 @@ class User_openid extends Memcached_DataObject * Unique keys used for lookup *MUST* be listed to ensure proper caching. */ function keys() + { + return array_keys($this->keyTypes()); + } + + function keyTypes() { return array('canonical' => 'K', 'display' => 'U', 'user_id' => 'U'); } diff --git a/plugins/OpenID/User_openid_trustroot.php b/plugins/OpenID/User_openid_trustroot.php index 0b411b8f7..17c03afb0 100644 --- a/plugins/OpenID/User_openid_trustroot.php +++ b/plugins/OpenID/User_openid_trustroot.php @@ -42,6 +42,11 @@ class User_openid_trustroot extends Memcached_DataObject } function keys() + { + return array_keys($this->keyTypes()); + } + + function keyTypes() { return array('trustroot' => 'K', 'user_id' => 'K'); } diff --git a/plugins/OpenID/openid.php b/plugins/OpenID/openid.php index 8f949c9c5..9e02c7a88 100644 --- a/plugins/OpenID/openid.php +++ b/plugins/OpenID/openid.php @@ -225,11 +225,11 @@ function oid_update_user(&$user, &$sreg) $orig_profile = clone($profile); - if ($sreg['fullname'] && strlen($sreg['fullname']) <= 255) { + if (!empty($sreg['fullname']) && strlen($sreg['fullname']) <= 255) { $profile->fullname = $sreg['fullname']; } - if ($sreg['country']) { + if (!empty($sreg['country'])) { if ($sreg['postcode']) { # XXX: use postcode to get city and region # XXX: also, store postcode somewhere -- it's valuable! @@ -249,7 +249,7 @@ function oid_update_user(&$user, &$sreg) $orig_user = clone($user); - if ($sreg['email'] && Validate::email($sreg['email'], common_config('email', 'check_domain'))) { + if (!empty($sreg['email']) && Validate::email($sreg['email'], common_config('email', 'check_domain'))) { $user->email = $sreg['email']; } -- cgit v1.2.3-54-g00ecf