From: Mikael Nordfeldth Date: Tue, 5 Jan 2016 22:07:30 +0000 (+0100) Subject: Require Profile for Profile->getOtherTags X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3d66d960a1c1c3abe7682c776a8ab9b69f87c298;p=quix0rs-gnu-social.git Require Profile for Profile->getOtherTags --- diff --git a/actions/apilistmemberships.php b/actions/apilistmemberships.php index 04c7715363..bf7f0e84d8 100644 --- a/actions/apilistmemberships.php +++ b/actions/apilistmemberships.php @@ -115,11 +115,10 @@ class ApiListMembershipsAction extends ApiBareAuthAction function getLists() { - $profile = $this->target; - $fn = array($profile, 'getOtherTags'); + $fn = array($this->target, 'getOtherTags'); # 20 lists list($this->lists, $this->next_cursor, $this->prev_cursor) = - Profile_list::getAtCursor($fn, array($this->auth_user), $this->cursor, 20); + Profile_list::getAtCursor($fn, array($this->scoped), $this->cursor, 20); } } diff --git a/actions/peopletagsforuser.php b/actions/peopletagsforuser.php index 827b284d5c..7679be0b86 100644 --- a/actions/peopletagsforuser.php +++ b/actions/peopletagsforuser.php @@ -126,7 +126,7 @@ class PeopletagsforuserAction extends Action $offset = ($this->page-1) * PEOPLETAGS_PER_PAGE; $limit = PEOPLETAGS_PER_PAGE + 1; - $ptags = $this->tagged->getOtherTags(common_current_user(), $offset, $limit); + $ptags = $this->tagged->getOtherTags($this->scoped, $offset, $limit); $pl = new PeopletagList($ptags, $this); $cnt = $pl->show(); diff --git a/classes/Profile.php b/classes/Profile.php index 945d1a74ca..69b78e27d5 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -446,7 +446,7 @@ class Profile extends Managed_DataObject /** * Get tags that other people put on this profile, in reverse-chron order * - * @param (Profile|User) $auth_user Authorized user (used for privacy) + * @param Profile $scoped User we are requesting as * @param int $offset Offset from latest * @param int $limit Max number to get * @param datetime $since_id max date @@ -455,7 +455,7 @@ class Profile extends Managed_DataObject * @return Profile_list resulting lists */ - function getOtherTags($auth_user=null, $offset=0, $limit=null, $since_id=0, $max_id=0) + function getOtherTags(Profile $scoped=null, $offset=0, $limit=null, $since_id=0, $max_id=0) { $list = new Profile_list(); @@ -467,11 +467,11 @@ class Profile extends Managed_DataObject $this->id); - if ($auth_user instanceof User || $auth_user instanceof Profile) { + if (!is_null($scoped)) { $qry .= sprintf('AND ( ( profile_list.private = false ) ' . 'OR ( profile_list.tagger = %d AND ' . 'profile_list.private = true ) )', - $auth_user->id); + $scoped->getID()); } else { $qry .= 'AND profile_list.private = 0 '; } diff --git a/lib/peopletagsforusersection.php b/lib/peopletagsforusersection.php index 37f46b850d..fa5ec31033 100644 --- a/lib/peopletagsforusersection.php +++ b/lib/peopletagsforusersection.php @@ -54,8 +54,7 @@ class PeopletagsForUserSection extends PeopletagSection $limit = PEOPLETAGS_PER_SECTION+1; $offset = 0; - $auth_user = common_current_user(); - $ptags = $this->profile->getOtherTags($auth_user, $offset, $limit); + $ptags = $this->profile->getOtherTags(Profile::current(), $offset, $limit); return $ptags; }