From 7ff02bb7d4483b3dc24edd78551a3936798056a8 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 26 Sep 2008 10:50:08 -0400 Subject: [PATCH] try to clean up user-without-profile errors darcs-hash:20080926145008-5ed1f-8a60ed3c5adbfe75aa044732e8d10dbdb9b93089.gz --- actions/allrss.php | 3 +++ actions/noticesearch.php | 1 + actions/profilesettings.php | 6 ++++++ actions/remotesubscribe.php | 7 +++++++ actions/repliesrss.php | 3 +++ actions/showstream.php | 5 +++++ actions/userauthorization.php | 5 +++++ actions/userrss.php | 5 +++++ 8 files changed, 35 insertions(+) diff --git a/actions/allrss.php b/actions/allrss.php index 9cbfe8dc8f..e49ac55401 100644 --- a/actions/allrss.php +++ b/actions/allrss.php @@ -68,6 +68,9 @@ class AllrssAction extends Rss10Action { function get_image() { $user = $this->user; $profile = $user->getProfile(); + if (!$profile) { + return NULL; + } $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); return ($avatar) ? $avatar->url : NULL; } diff --git a/actions/noticesearch.php b/actions/noticesearch.php index 7022109e66..e6de21ae06 100644 --- a/actions/noticesearch.php +++ b/actions/noticesearch.php @@ -92,6 +92,7 @@ class NoticesearchAction extends SearchAction { $profile = $notice->getProfile(); if (!$profile) { common_log_db_error($notice, 'SELECT', __FILE__); + $this->server_error(_('Notice without matching profile')); return; } # XXX: RDFa diff --git a/actions/profilesettings.php b/actions/profilesettings.php index 0474c69375..e5698011ac 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -110,6 +110,12 @@ class ProfilesettingsAction extends SettingsAction { $user = common_current_user(); $profile = $user->getProfile(); + if (!$profile) { + common_log_db_error($user, 'SELECT', __FILE__); + $this->server_error(_('User without matching profile')); + return; + } + $original = $profile->getOriginalAvatar(); diff --git a/actions/remotesubscribe.php b/actions/remotesubscribe.php index c2c00ab619..7137b42a26 100644 --- a/actions/remotesubscribe.php +++ b/actions/remotesubscribe.php @@ -313,7 +313,14 @@ class RemotesubscribeAction extends Action { $req->set_parameter('omb_listenee_profile', common_profile_url($user->nickname)); $req->set_parameter('omb_listenee_nickname', $user->nickname); $req->set_parameter('omb_listenee_license', $config['license']['url']); + $profile = $user->getProfile(); + if (!$profile) { + common_log_db_error($user, 'SELECT', __FILE__); + $this->server_error(_('User without matching profile')); + return; + } + if ($profile->fullname) { $req->set_parameter('omb_listenee_fullname', $profile->fullname); } diff --git a/actions/repliesrss.php b/actions/repliesrss.php index 1a12b45bf9..b811db7eb3 100644 --- a/actions/repliesrss.php +++ b/actions/repliesrss.php @@ -84,6 +84,9 @@ class RepliesrssAction extends Rss10Action { function get_image() { $user = $this->user; $profile = $user->getProfile(); + if (!$profile) { + return NULL; + } $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); return ($avatar) ? $avatar->url : NULL; } diff --git a/actions/showstream.php b/actions/showstream.php index 2f7c2fb921..43556a0ed9 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -252,6 +252,11 @@ class ShowstreamAction extends StreamAction { $other = Profile::staticGet($subs->subscribed); + if (!$other) { + common_log_db_error($subs, 'SELECT', __FILE__); + continue; + } + common_element_start('li'); common_element_start('a', array('title' => ($other->fullname) ? $other->fullname : diff --git a/actions/userauthorization.php b/actions/userauthorization.php index 735bcb6b5a..680f55094c 100644 --- a/actions/userauthorization.php +++ b/actions/userauthorization.php @@ -154,6 +154,11 @@ class UserauthorizationAction extends Action { $params['omb_version'] = OMB_VERSION_01; $user = User::staticGet('uri', $req->get_parameter('omb_listener')); $profile = $user->getProfile(); + if (!$profile) { + common_log_db_error($user, 'SELECT', __FILE__); + $this->server_error(_('User without matching profile')); + return; + } $params['omb_listener_nickname'] = $user->nickname; $params['omb_listener_profile'] = common_local_url('showstream', array('nickname' => $user->nickname)); diff --git a/actions/userrss.php b/actions/userrss.php index 2ae45dc9cd..e608519157 100644 --- a/actions/userrss.php +++ b/actions/userrss.php @@ -74,6 +74,11 @@ class UserrssAction extends Rss10Action { function get_image() { $user = $this->user; $profile = $user->getProfile(); + if (!$profile) { + common_log_db_error($user, 'SELECT', __FILE__); + $this->server_error(_('User without matching profile')); + return NULL; + } $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); return ($avatar) ? $avatar->url : NULL; } -- 2.39.5