]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/profilelist.php
Updated Cloudy theme default avatars and minor CSS
[quix0rs-gnu-social.git] / lib / profilelist.php
index 75053b7a42c6cdb90014b15f026ece5b848a5c9e..a4cc235552a4d24723cbb5abe9934bfa1c9e08a6 100644 (file)
@@ -89,6 +89,7 @@ class ProfileList extends Widget
                                              'id' => 'profile-' . $this->profile->id));
 
         $user = common_current_user();
+        $is_own = !is_null($user) && isset($this->owner) && ($user->id === $this->owner->id);
 
         $this->out->elementStart('div', 'entity_profile vcard');
 
@@ -108,7 +109,7 @@ class ProfileList extends Widget
         $this->out->elementEnd('span');
         $this->out->elementEnd('a');
 
-        if ($this->profile->fullname !== '') {
+        if (!empty($this->profile->fullname)) {
             $this->out->elementStart('dl', 'entity_fn');
             $this->out->element('dt', null, 'Full name');
             $this->out->elementStart('dd');
@@ -118,7 +119,7 @@ class ProfileList extends Widget
             $this->out->elementEnd('dd');
             $this->out->elementEnd('dl');
         }
-        if ($this->profile->location !== '') {
+        if (!empty($this->profile->location)) {
             $this->out->elementStart('dl', 'entity_location');
             $this->out->element('dt', null, _('Location'));
             $this->out->elementStart('dd', 'label');
@@ -126,7 +127,7 @@ class ProfileList extends Widget
             $this->out->elementEnd('dd');
             $this->out->elementEnd('dl');
         }
-        if ($this->profile->homepage !== '') {
+        if (!empty($this->profile->homepage)) {
             $this->out->elementStart('dl', 'entity_url');
             $this->out->element('dt', null, _('URL'));
             $this->out->elementStart('dd');
@@ -137,7 +138,7 @@ class ProfileList extends Widget
             $this->out->elementEnd('dd');
             $this->out->elementEnd('dl');
         }
-        if ($this->profile->bio !== '') {
+        if (!empty($this->profile->bio)) {
             $this->out->elementStart('dl', 'entity_note');
             $this->out->element('dt', null, _('Note'));
             $this->out->elementStart('dd', 'note');
@@ -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,9 +194,10 @@ class ProfileList extends Widget
 
         $this->out->elementStart('ul');
 
-        if ($user && $user->id != $this->profile->id) {
-            # XXX: special-case for user looking at own
-            # subscriptions page
+        // Is this a logged-in user, looking at someone else's
+        // profile?
+
+        if (!empty($user) && $this->profile->id != $user->id) {
             $this->out->elementStart('li', 'entity_subscribe');
             if ($user->isSubscribed($this->profile)) {
                 $usf = new UnsubscribeForm($this->out, $this->profile);
@@ -206,7 +208,7 @@ class ProfileList extends Widget
             }
             $this->out->elementEnd('li');
             $this->out->elementStart('li', 'entity_block');
-            if ($user && $user->id == $this->owner->id) {
+            if ($user->id == $this->owner->id) {
                 $this->showBlockForm();
             }
             $this->out->elementEnd('li');