]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
try to clean up user-without-profile errors
authorEvan Prodromou <evan@controlyourself.ca>
Fri, 26 Sep 2008 14:50:08 +0000 (10:50 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Fri, 26 Sep 2008 14:50:08 +0000 (10:50 -0400)
darcs-hash:20080926145008-5ed1f-8a60ed3c5adbfe75aa044732e8d10dbdb9b93089.gz

actions/allrss.php
actions/noticesearch.php
actions/profilesettings.php
actions/remotesubscribe.php
actions/repliesrss.php
actions/showstream.php
actions/userauthorization.php
actions/userrss.php

index 9cbfe8dc8f2c58b5d4829bc8b7433cc039c8f891..e49ac55401435d9cd0d4d7e262e0eaac9e58adc2 100644 (file)
@@ -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;
        }
index 7022109e6658465fb4671f221451cb6706b9dac3..e6de21ae068be9c818a10c6ff1e7d037fa4c37db 100644 (file)
@@ -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
index 0474c693751509e135609866e23eae1516aeea4b..e5698011ac0b7769ab3bea9fe122153e30871271 100644 (file)
@@ -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();
 
 
index c2c00ab619d3a9863fa66af982eb3dc3194bac31..7137b42a26f79749a881c72b6999f5b8f73e2da1 100644 (file)
@@ -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);
                }
index 1a12b45bf9a92ed3f6f583fa91afc4ecc229be51..b811db7eb3067b020cb463202ea061427dacc1cd 100644 (file)
@@ -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;
        }
index 2f7c2fb921818d521035442cbac64b777cf3cae4..43556a0ed9e4bdfc9f049640bfde72b676be9448 100644 (file)
@@ -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 :
index 735bcb6b5ab3c05ca5100a18e9f9e057f74183e9..680f55094c7916da8a8aca6576056ba80bfe4577 100644 (file)
@@ -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));
index 2ae45dc9cd25d8ef094db12ea80a6a69f4f32083..e608519157c6058b4521244ce3c77303fc90293a 100644 (file)
@@ -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;
        }