]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Remove comparison with member variable of null variable, cleaned code a bit.
authorAdrian Lang <mail@adrianlang.de>
Sat, 7 Mar 2009 00:43:55 +0000 (01:43 +0100)
committerAdrian Lang <mail@adrianlang.de>
Wed, 11 Mar 2009 09:38:58 +0000 (10:38 +0100)
lib/profilelist.php
lib/subgroupnav.php

index 75053b7a42c6cdb90014b15f026ece5b848a5c9e..898200d2dbbe86b925b60eb81b6b805b5e8a0be1 100644 (file)
@@ -89,6 +89,7 @@ class ProfileList extends Widget
                                              'id' => 'profile-' . $this->profile->id));
 
         $user = common_current_user();
+        $is_own = !is_null($user) && ($user->id === $this->user->id);
 
         $this->out->elementStart('div', 'entity_profile vcard');
 
@@ -154,7 +155,7 @@ class ProfileList extends Widget
 
             $this->out->elementStart('dl', 'entity_tags');
             $this->out->elementStart('dt');
-            if ($user->id == $this->owner->id) {
+            if ($is_own) {
                 $this->out->element('a', array('href' => common_local_url('tagother',
                                                                           array('id' => $this->profile->id))),
                                     _('Tags'));
@@ -183,7 +184,7 @@ class ProfileList extends Widget
             $this->out->elementEnd('dl');
         }
 
-        if ($user && $user->id == $this->owner->id) {
+        if ($is_own) {
             $this->showOwnerControls($this->profile);
         }
 
@@ -193,11 +194,11 @@ class ProfileList extends Widget
 
         $this->out->elementStart('ul');
 
-        if ($user && $user->id != $this->profile->id) {
+        if (!$is_own) {
             # XXX: special-case for user looking at own
             # subscriptions page
             $this->out->elementStart('li', 'entity_subscribe');
-            if ($user->isSubscribed($this->profile)) {
+            if (!is_null($user) && $user->isSubscribed($this->profile)) {
                 $usf = new UnsubscribeForm($this->out, $this->profile);
                 $usf->show();
             } else {
@@ -206,9 +207,6 @@ class ProfileList extends Widget
             }
             $this->out->elementEnd('li');
             $this->out->elementStart('li', 'entity_block');
-            if ($user && $user->id == $this->owner->id) {
-                $this->showBlockForm();
-            }
             $this->out->elementEnd('li');
         }
 
index 5fd8a72a25dbc5b6d0be9065e1faa01539b0fb62..31c3ea0b568e8ed62b1e0524cec920ba621ef958 100644 (file)
@@ -98,7 +98,7 @@ class SubGroupNav extends Widget
                                      $this->user->nickname),
                              $action == 'usergroups',
                              'nav_usergroups');
-        if ($this->user->id == $cur->id) {
+        if (!is_null($cur) && $this->user->id === $cur->id) {
             $this->out->menuItem(common_local_url('invite'),
                                  _('Invite'),
                                  sprintf(_('Invite friends and colleagues to join you on %s'),