Fixing a bunch of undefined variable warnings in OpenID signup process

This commit is contained in:
Leslie Michael Orchard 2009-02-17 23:22:56 -05:00 committed by Evan Prodromou
parent 17a6e66030
commit 9a0e71f9bf
2 changed files with 20 additions and 15 deletions

View File

@ -83,7 +83,7 @@ class FinishopenidloginAction extends Action
function showContent() function showContent()
{ {
if ($this->message_text) { if (!empty($this->message_text)) {
$this->element('p', null, $this->message); $this->element('p', null, $this->message);
return; return;
} }
@ -232,7 +232,8 @@ class FinishopenidloginAction extends Action
return; return;
} }
if ($sreg['country']) { $location = '';
if (!empty($sreg['country'])) {
if ($sreg['postcode']) { if ($sreg['postcode']) {
# XXX: use postcode to get city and region # XXX: use postcode to get city and region
# XXX: also, store postcode somewhere -- it's valuable! # XXX: also, store postcode somewhere -- it's valuable!
@ -242,12 +243,16 @@ class FinishopenidloginAction extends Action
} }
} }
if ($sreg['fullname'] && mb_strlen($sreg['fullname']) <= 255) { if (!empty($sreg['fullname']) && mb_strlen($sreg['fullname']) <= 255) {
$fullname = $sreg['fullname']; $fullname = $sreg['fullname'];
} else {
$fullname = '';
} }
if ($sreg['email'] && Validate::email($sreg['email'], true)) { if (!empty($sreg['email']) && Validate::email($sreg['email'], true)) {
$email = $sreg['email']; $email = $sreg['email'];
} else {
$email = '';
} }
# XXX: add language # XXX: add language
@ -328,7 +333,7 @@ class FinishopenidloginAction extends Action
# Try the passed-in nickname # Try the passed-in nickname
if ($sreg['nickname']) { if (!empty($sreg['nickname'])) {
$nickname = $this->nicknamize($sreg['nickname']); $nickname = $this->nicknamize($sreg['nickname']);
if ($this->isNewNickname($nickname)) { if ($this->isNewNickname($nickname)) {
return $nickname; return $nickname;
@ -337,7 +342,7 @@ class FinishopenidloginAction extends Action
# Try the full name # Try the full name
if ($sreg['fullname']) { if (!empty($sreg['fullname'])) {
$fullname = $this->nicknamize($sreg['fullname']); $fullname = $this->nicknamize($sreg['fullname']);
if ($this->isNewNickname($fullname)) { if ($this->isNewNickname($fullname)) {
return $fullname; return $fullname;

View File

@ -183,16 +183,16 @@ class User extends Memcached_DataObject
$profile->nickname = $nickname; $profile->nickname = $nickname;
$profile->profileurl = common_profile_url($nickname); $profile->profileurl = common_profile_url($nickname);
if ($fullname) { if (!empty($fullname)) {
$profile->fullname = $fullname; $profile->fullname = $fullname;
} }
if ($homepage) { if (!empty($homepage)) {
$profile->homepage = $homepage; $profile->homepage = $homepage;
} }
if ($bio) { if (!empty($bio)) {
$profile->bio = $bio; $profile->bio = $bio;
} }
if ($location) { if (!empty($location)) {
$profile->location = $location; $profile->location = $location;
} }
@ -200,7 +200,7 @@ class User extends Memcached_DataObject
$id = $profile->insert(); $id = $profile->insert();
if (!$id) { if (empty($id)) {
common_log_db_error($profile, 'INSERT', __FILE__); common_log_db_error($profile, 'INSERT', __FILE__);
return false; return false;
} }
@ -210,13 +210,13 @@ class User extends Memcached_DataObject
$user->id = $id; $user->id = $id;
$user->nickname = $nickname; $user->nickname = $nickname;
if ($password) { # may not have a password for OpenID users if (!empty($password)) { # may not have a password for OpenID users
$user->password = common_munge_password($password, $id); $user->password = common_munge_password($password, $id);
} }
# Users who respond to invite email have proven their ownership of that address # Users who respond to invite email have proven their ownership of that address
if ($code) { if (!empty($code)) {
$invite = Invitation::staticGet($code); $invite = Invitation::staticGet($code);
if ($invite && $invite->address && $invite->address_type == 'email' && $invite->address == $email) { if ($invite && $invite->address && $invite->address_type == 'email' && $invite->address == $email) {
$user->email = $invite->address; $user->email = $invite->address;
@ -253,7 +253,7 @@ class User extends Memcached_DataObject
return false; return false;
} }
if ($email && !$user->email) { if (!empty($email) && !$user->email) {
$confirm = new Confirm_address(); $confirm = new Confirm_address();
$confirm->code = common_confirmation_code(128); $confirm->code = common_confirmation_code(128);
@ -268,7 +268,7 @@ class User extends Memcached_DataObject
} }
} }
if ($code && $user->email) { if (!empty($code) && $user->email) {
$user->emailChanged(); $user->emailChanged();
} }