Remove duplicate profile_uid key in App->profile array

This commit is contained in:
Hypolite Petovan 2019-11-02 21:19:42 -04:00
parent 9803c96db4
commit 6d7f0a6fd8
10 changed files with 59 additions and 74 deletions

View File

@ -494,7 +494,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
} }
} elseif ($mode === 'profile') { } elseif ($mode === 'profile') {
$items = conversation_add_children($items, false, $order, $uid); $items = conversation_add_children($items, false, $order, $uid);
$profile_owner = $a->profile['profile_uid']; $profile_owner = $a->profile['uid'];
if (!$update) { if (!$update) {
$tab = 'posts'; $tab = 'posts';
@ -508,7 +508,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
*/ */
$live_update_div = '<div id="live-profile"></div>' . "\r\n" $live_update_div = '<div id="live-profile"></div>' . "\r\n"
. "<script> var profile_uid = " . $a->profile['profile_uid'] . "<script> var profile_uid = " . $a->profile['uid']
. "; var netargs = '?f='; var profile_page = " . $pager->getPage() . "; </script>\r\n"; . "; var netargs = '?f='; var profile_page = " . $pager->getPage() . "; </script>\r\n";
} }
} }

View File

@ -101,27 +101,14 @@ function cal_content(App $a)
} }
// Setup permissions structures // Setup permissions structures
$remote_contact = false;
$contact_id = 0;
$owner_uid = intval($a->data['user']['uid']); $owner_uid = intval($a->data['user']['uid']);
$nick = $a->data['user']['nickname']; $nick = $a->data['user']['nickname'];
if (!empty(Session::getRemoteContactID($a->profile['profile_uid']))) { $contact_id = Session::getRemoteContactID($a->profile['uid']);
$contact_id = Session::getRemoteContactID($a->profile['profile_uid']);
}
if ($contact_id) { $remote_contact = $contact_id && DBA::exists('contact', ['id' => $contact_id, 'uid' => $a->profile['uid']]);
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id),
intval($a->profile['profile_uid'])
);
if (DBA::isResult($r)) {
$remote_contact = true;
}
}
$is_owner = local_user() == $a->profile['profile_uid']; $is_owner = local_user() == $a->profile['uid'];
if ($a->profile['hidewall'] && !$is_owner && !$remote_contact) { if ($a->profile['hidewall'] && !$is_owner && !$remote_contact) {
notice(DI::l10n()->t('Access to this profile has been restricted.') . EOL); notice(DI::l10n()->t('Access to this profile has been restricted.') . EOL);

View File

@ -100,7 +100,7 @@ function display_init(App $a)
$nickname = str_replace(Strings::normaliseLink(DI::baseUrl())."/profile/", "", Strings::normaliseLink($profiledata["url"])); $nickname = str_replace(Strings::normaliseLink(DI::baseUrl())."/profile/", "", Strings::normaliseLink($profiledata["url"]));
if ($nickname != $a->user["nickname"]) { if ($nickname != $a->user["nickname"]) {
$profile = DBA::fetchFirst("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile` $profile = DBA::fetchFirst("SELECT `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid` INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`
WHERE `user`.`nickname` = ? AND `profile`.`is-default` AND `contact`.`self` LIMIT 1", WHERE `user`.`nickname` = ? AND `profile`.`is-default` AND `contact`.`self` LIMIT 1",
$nickname $nickname
@ -175,9 +175,9 @@ function display_content(App $a, $update = false, $update_uid = 0)
$item_id = $_REQUEST['item_id']; $item_id = $_REQUEST['item_id'];
$item = Item::selectFirst(['uid', 'parent', 'parent-uri'], ['id' => $item_id]); $item = Item::selectFirst(['uid', 'parent', 'parent-uri'], ['id' => $item_id]);
if ($item['uid'] != 0) { if ($item['uid'] != 0) {
$a->profile = ['uid' => intval($item['uid']), 'profile_uid' => intval($item['uid'])]; $a->profile = ['uid' => intval($item['uid'])];
} else { } else {
$a->profile = ['uid' => intval($update_uid), 'profile_uid' => intval($update_uid)]; $a->profile = ['uid' => intval($update_uid)];
} }
$item_parent = $item['parent']; $item_parent = $item['parent'];
$item_parent_uri = $item['parent-uri']; $item_parent_uri = $item['parent-uri'];
@ -249,13 +249,12 @@ function display_content(App $a, $update = false, $update_uid = 0)
if (DBA::isResult($parent)) { if (DBA::isResult($parent)) {
$a->profile['uid'] = ($a->profile['uid'] ?? 0) ?: $parent['uid']; $a->profile['uid'] = ($a->profile['uid'] ?? 0) ?: $parent['uid'];
$a->profile['profile_uid'] = ($a->profile['profile_uid'] ?? 0) ?: $parent['uid']; $is_remote_contact = Session::getRemoteContactID($a->profile['uid']);
$is_remote_contact = Session::getRemoteContactID($a->profile['profile_uid']);
if ($is_remote_contact) { if ($is_remote_contact) {
$item_uid = $parent['uid']; $item_uid = $parent['uid'];
} }
} else { } else {
$a->profile = ['uid' => intval($item['uid']), 'profile_uid' => intval($item['uid'])]; $a->profile = ['uid' => intval($item['uid'])];
} }
$page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]); $page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]);
@ -263,7 +262,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
$a->page_contact = $page_contact; $a->page_contact = $page_contact;
} }
$is_owner = (local_user() && (in_array($a->profile['profile_uid'], [local_user(), 0])) ? true : false); $is_owner = (local_user() && (in_array($a->profile['uid'], [local_user(), 0])) ? true : false);
if (!empty($a->profile['hidewall']) && !$is_owner && !$is_remote_contact) { if (!empty($a->profile['hidewall']) && !$is_owner && !$is_remote_contact) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access to this profile has been restricted.')); throw new HTTPException\ForbiddenException(DI::l10n()->t('Access to this profile has been restricted.'));
@ -284,9 +283,9 @@ function display_content(App $a, $update = false, $update_uid = 0)
]; ];
$o .= status_editor($a, $x, 0, true); $o .= status_editor($a, $x, 0, true);
} }
$sql_extra = Item::getPermissionsSQLByUserId($a->profile['profile_uid']); $sql_extra = Item::getPermissionsSQLByUserId($a->profile['uid']);
if (local_user() && (local_user() == $a->profile['profile_uid'])) { if (local_user() && (local_user() == $a->profile['uid'])) {
$condition = ['parent-uri' => $item_parent_uri, 'uid' => local_user(), 'unseen' => true]; $condition = ['parent-uri' => $item_parent_uri, 'uid' => local_user(), 'unseen' => true];
$unseen = Item::exists($condition); $unseen = Item::exists($condition);
} else { } else {
@ -299,7 +298,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
$condition = ["`id` = ? AND `item`.`uid` IN (0, ?) " . $sql_extra, $item_id, $item_uid]; $condition = ["`id` = ? AND `item`.`uid` IN (0, ?) " . $sql_extra, $item_id, $item_uid];
$fields = ['parent-uri', 'body', 'title', 'author-name', 'author-avatar', 'plink', 'author-id', 'owner-id', 'contact-id']; $fields = ['parent-uri', 'body', 'title', 'author-name', 'author-avatar', 'plink', 'author-id', 'owner-id', 'contact-id'];
$item = Item::selectFirstForUser($a->profile['profile_uid'], $fields, $condition); $item = Item::selectFirstForUser($a->profile['uid'], $fields, $condition);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('The requested item doesn\'t exist or has been deleted.')); throw new HTTPException\NotFoundException(DI::l10n()->t('The requested item doesn\'t exist or has been deleted.'));

View File

@ -61,8 +61,7 @@ abstract class BaseModule
*/ */
public static function post(array $parameters = []) public static function post(array $parameters = [])
{ {
// $a = self::getApp(); // DI::baseurl()->redirect('module');
// $a->internalRedirect('module');
} }
/** /**

View File

@ -301,7 +301,7 @@ class Widget
{ {
$a = DI::app(); $a = DI::app();
$uid = intval($a->profile['profile_uid']); $uid = intval($a->profile['uid']);
if (!Feature::isEnabled($uid, 'categories')) { if (!Feature::isEnabled($uid, 'categories')) {
return ''; return '';
@ -418,7 +418,7 @@ class Widget
{ {
$a = DI::app(); $a = DI::app();
$uid = intval($a->profile['profile_uid']); $uid = intval($a->profile['uid']);
if (!$uid || !$a->profile['url']) { if (!$uid || !$a->profile['url']) {
return ''; return '';

View File

@ -126,13 +126,13 @@ class Profile
* *
* @param App $a * @param App $a
* @param string $nickname string * @param string $nickname string
* @param int $profile int * @param int $profile_id int
* @param array $profiledata array * @param array $profiledata array
* @param boolean $show_connect Show connect link * @param boolean $show_connect Show connect link
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException * @throws \ImagickException
*/ */
public static function load(App $a, $nickname, $profile = 0, array $profiledata = [], $show_connect = true) public static function load(App $a, $nickname, $profile_id = 0, array $profiledata = [], $show_connect = true)
{ {
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]); $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]);
@ -155,31 +155,31 @@ class Profile
} }
} }
$pdata = self::getByNickname($nickname, $user['uid'], $profile); $profile = self::getByNickname($nickname, $user['uid'], $profile_id);
if (empty($pdata) && empty($profiledata)) { if (empty($profile) && empty($profiledata)) {
Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG); Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG);
return; return;
} }
if (empty($pdata)) { if (empty($profile)) {
$pdata = ['uid' => 0, 'profile_uid' => 0, 'is-default' => false,'name' => $nickname]; $profile = ['uid' => 0, 'is-default' => false,'name' => $nickname];
} }
// fetch user tags if this isn't the default profile // fetch user tags if this isn't the default profile
if (!$pdata['is-default']) { if (!$profile['is-default']) {
$condition = ['uid' => $pdata['profile_uid'], 'is-default' => true]; $condition = ['uid' => $profile['uid'], 'is-default' => true];
$profile = DBA::selectFirst('profile', ['pub_keywords'], $condition); $profile_id = DBA::selectFirst('profile', ['pub_keywords'], $condition);
if (DBA::isResult($profile)) { if (DBA::isResult($profile_id)) {
$pdata['pub_keywords'] = $profile['pub_keywords']; $profile['pub_keywords'] = $profile_id['pub_keywords'];
} }
} }
$a->profile = $pdata; $a->profile = $profile;
$a->profile_uid = $pdata['profile_uid']; $a->profile_uid = $profile['uid'];
$a->profile['mobile-theme'] = DI::pConfig()->get($a->profile['profile_uid'], 'system', 'mobile_theme'); $a->profile['mobile-theme'] = DI::pConfig()->get($a->profile['uid'], 'system', 'mobile_theme');
$a->profile['network'] = Protocol::DFRN; $a->profile['network'] = Protocol::DFRN;
DI::page()['title'] = $a->profile['name'] . ' @ ' . DI::config()->get('config', 'sitename'); DI::page()['title'] = $a->profile['name'] . ' @ ' . DI::config()->get('config', 'sitename');
@ -255,7 +255,7 @@ class Profile
$profile = DBA::fetchFirst( $profile = DBA::fetchFirst(
"SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` AS `contact_photo`, "SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` AS `contact_photo`,
`contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`, `contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`,
`profile`.`uid` AS `profile_uid`, `profile`.*, `profile`.*,
`contact`.`avatar-date` AS picdate, `contact`.`addr`, `contact`.`url`, `user`.* `contact`.`avatar-date` AS picdate, `contact`.`addr`, `contact`.`url`, `user`.*
FROM `profile` FROM `profile`
INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` AND `contact`.`self` INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` AND `contact`.`self`
@ -269,7 +269,7 @@ class Profile
$profile = DBA::fetchFirst( $profile = DBA::fetchFirst(
"SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` as `contact_photo`, "SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` as `contact_photo`,
`contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`, `contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`,
`profile`.`uid` AS `profile_uid`, `profile`.*, `profile`.*,
`contact`.`avatar-date` AS picdate, `contact`.`addr`, `contact`.`url`, `user`.* `contact`.`avatar-date` AS picdate, `contact`.`addr`, `contact`.`url`, `user`.*
FROM `profile` FROM `profile`
INNER JOIN `contact` ON `contact`.`uid` = `profile`.`uid` AND `contact`.`self` INNER JOIN `contact` ON `contact`.`uid` = `profile`.`uid` AND `contact`.`self`
@ -350,7 +350,7 @@ class Profile
$profile_is_dfrn = $profile['network'] == Protocol::DFRN; $profile_is_dfrn = $profile['network'] == Protocol::DFRN;
$profile_is_native = in_array($profile['network'], Protocol::NATIVE_SUPPORT); $profile_is_native = in_array($profile['network'], Protocol::NATIVE_SUPPORT);
$local_user_is_self = local_user() && local_user() == ($profile['profile_uid'] ?? 0); $local_user_is_self = local_user() && local_user() == ($profile['uid'] ?? 0);
$visitor_is_authenticated = (bool)self::getMyURL(); $visitor_is_authenticated = (bool)self::getMyURL();
$visitor_is_following = $visitor_is_following =
in_array($visitor_contact['rel'] ?? 0, [Contact::FOLLOWER, Contact::FRIEND]) in_array($visitor_contact['rel'] ?? 0, [Contact::FOLLOWER, Contact::FRIEND])

View File

@ -82,8 +82,8 @@ class Profile extends BaseModule
$page['htmlhead'] .= "\n"; $page['htmlhead'] .= "\n";
$blocked = !local_user() && !Session::getRemoteContactID($a->profile['profile_uid']) && DI::config()->get('system', 'block_public'); $blocked = !local_user() && !Session::getRemoteContactID($a->profile['uid']) && DI::config()->get('system', 'block_public');
$userblock = !local_user() && !Session::getRemoteContactID($a->profile['profile_uid']) && $a->profile['hidewall']; $userblock = !local_user() && !Session::getRemoteContactID($a->profile['uid']) && $a->profile['hidewall'];
if (!empty($a->profile['page-flags']) && $a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY) { if (!empty($a->profile['page-flags']) && $a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY) {
$page['htmlhead'] .= '<meta name="friendica.community" content="true" />' . "\n"; $page['htmlhead'] .= '<meta name="friendica.community" content="true" />' . "\n";
@ -149,7 +149,7 @@ class Profile extends BaseModule
$hashtags = $_GET['tag'] ?? ''; $hashtags = $_GET['tag'] ?? '';
if (DI::config()->get('system', 'block_public') && !local_user() && !Session::getRemoteContactID($a->profile['profile_uid'])) { if (DI::config()->get('system', 'block_public') && !local_user() && !Session::getRemoteContactID($a->profile['uid'])) {
return Login::form(); return Login::form();
} }
@ -157,14 +157,14 @@ class Profile extends BaseModule
if ($update) { if ($update) {
// Ensure we've got a profile owner if updating. // Ensure we've got a profile owner if updating.
$a->profile['profile_uid'] = $update; $a->profile['uid'] = $update;
} elseif ($a->profile['profile_uid'] == local_user()) { } elseif ($a->profile['uid'] == local_user()) {
Nav::setSelected('home'); Nav::setSelected('home');
} }
$remote_contact = Session::getRemoteContactID($a->profile['profile_uid']); $remote_contact = Session::getRemoteContactID($a->profile['uid']);
$is_owner = local_user() == $a->profile['profile_uid']; $is_owner = local_user() == $a->profile['uid'];
$last_updated_key = "profile:" . $a->profile['profile_uid'] . ":" . local_user() . ":" . $remote_contact; $last_updated_key = "profile:" . $a->profile['uid'] . ":" . local_user() . ":" . $remote_contact;
if (!empty($a->profile['hidewall']) && !$is_owner && !$remote_contact) { if (!empty($a->profile['hidewall']) && !$is_owner && !$remote_contact) {
notice(DI::l10n()->t('Access to this profile has been restricted.') . EOL); notice(DI::l10n()->t('Access to this profile has been restricted.') . EOL);
@ -182,16 +182,16 @@ class Profile extends BaseModule
return $o; return $o;
} }
$o .= Widget::commonFriendsVisitor($a->profile['profile_uid']); $o .= Widget::commonFriendsVisitor($a->profile['uid']);
$commpage = $a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY; $commpage = $a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
$commvisitor = $commpage && $remote_contact; $commvisitor = $commpage && $remote_contact;
DI::page()['aside'] .= Widget::postedByYear(DI::baseUrl()->get(true) . '/profile/' . $a->profile['nickname'], $a->profile['profile_uid'] ?? 0, true); DI::page()['aside'] .= Widget::postedByYear(DI::baseUrl()->get(true) . '/profile/' . $a->profile['nickname'], $a->profile['uid'] ?? 0, true);
DI::page()['aside'] .= Widget::categories(DI::baseUrl()->get(true) . '/profile/' . $a->profile['nickname'], XML::escape($category)); DI::page()['aside'] .= Widget::categories(DI::baseUrl()->get(true) . '/profile/' . $a->profile['nickname'], XML::escape($category));
DI::page()['aside'] .= Widget::tagCloud(); DI::page()['aside'] .= Widget::tagCloud();
if (Security::canWriteToUserWall($a->profile['profile_uid'])) { if (Security::canWriteToUserWall($a->profile['uid'])) {
$x = [ $x = [
'is_owner' => $is_owner, 'is_owner' => $is_owner,
'allow_location' => ($is_owner || $commvisitor) && $a->profile['allow_location'], 'allow_location' => ($is_owner || $commvisitor) && $a->profile['allow_location'],
@ -206,7 +206,7 @@ class Profile extends BaseModule
'acl' => $is_owner ? ACL::getFullSelectorHTML(DI::page(), $a->user, true) : '', 'acl' => $is_owner ? ACL::getFullSelectorHTML(DI::page(), $a->user, true) : '',
'bang' => '', 'bang' => '',
'visitor' => $is_owner || $commvisitor ? 'block' : 'none', 'visitor' => $is_owner || $commvisitor ? 'block' : 'none',
'profile_uid' => $a->profile['profile_uid'], 'profile_uid' => $a->profile['uid'],
]; ];
$o .= status_editor($a, $x); $o .= status_editor($a, $x);
@ -214,7 +214,7 @@ class Profile extends BaseModule
} }
// Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups // Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups
$sql_extra = Item::getPermissionsSQLByUserId($a->profile['profile_uid']); $sql_extra = Item::getPermissionsSQLByUserId($a->profile['uid']);
$sql_extra2 = ''; $sql_extra2 = '';
$last_updated_array = Session::get('last_updated', []); $last_updated_array = Session::get('last_updated', []);
@ -246,7 +246,7 @@ class Profile extends BaseModule
$sql_extra4 $sql_extra4
$sql_extra $sql_extra
ORDER BY `item`.`received` DESC", ORDER BY `item`.`received` DESC",
$a->profile['profile_uid'], $a->profile['uid'],
GRAVITY_ACTIVITY GRAVITY_ACTIVITY
); );
@ -260,12 +260,12 @@ class Profile extends BaseModule
if (!empty($category)) { if (!empty($category)) {
$sql_post_table = sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ", $sql_post_table = sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
DBA::escape(Strings::protectSprintf($category)), intval(TERM_OBJ_POST), intval(TERM_CATEGORY), intval($a->profile['profile_uid'])); DBA::escape(Strings::protectSprintf($category)), intval(TERM_OBJ_POST), intval(TERM_CATEGORY), intval($a->profile['uid']));
} }
if (!empty($hashtags)) { if (!empty($hashtags)) {
$sql_post_table .= sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ", $sql_post_table .= sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
DBA::escape(Strings::protectSprintf($hashtags)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG), intval($a->profile['profile_uid'])); DBA::escape(Strings::protectSprintf($hashtags)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG), intval($a->profile['uid']));
} }
if (!empty($datequery)) { if (!empty($datequery)) {
@ -277,7 +277,7 @@ class Profile extends BaseModule
// Does the profile page belong to a forum? // Does the profile page belong to a forum?
// If not then we can improve the performance with an additional condition // If not then we can improve the performance with an additional condition
$condition = ['uid' => $a->profile['profile_uid'], 'page-flags' => [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP]]; $condition = ['uid' => $a->profile['uid'], 'page-flags' => [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP]];
if (!DBA::exists('user', $condition)) { if (!DBA::exists('user', $condition)) {
$sql_extra3 = sprintf(" AND `thread`.`contact-id` = %d ", intval(intval($a->profile['contact_id']))); $sql_extra3 = sprintf(" AND `thread`.`contact-id` = %d ", intval(intval($a->profile['contact_id'])));
} else { } else {
@ -321,7 +321,7 @@ class Profile extends BaseModule
$sql_extra2 $sql_extra2
ORDER BY `thread`.`received` DESC ORDER BY `thread`.`received` DESC
$pager_sql", $pager_sql",
$a->profile['profile_uid'] $a->profile['uid']
); );
} }
@ -344,13 +344,13 @@ class Profile extends BaseModule
$items = DBA::toArray($items_stmt); $items = DBA::toArray($items_stmt);
if ($pager->getStart() == 0 && !empty($a->profile['profile_uid'])) { if ($pager->getStart() == 0 && !empty($a->profile['uid'])) {
$pinned_items = Item::selectPinned($a->profile['profile_uid'], ['uri', 'pinned'], ['true' . $sql_extra]); $pinned_items = Item::selectPinned($a->profile['uid'], ['uri', 'pinned'], ['true' . $sql_extra]);
$pinned = Item::inArray($pinned_items); $pinned = Item::inArray($pinned_items);
$items = array_merge($items, $pinned); $items = array_merge($items, $pinned);
} }
$o .= conversation($a, $items, $pager, 'profile', $update, false, 'pinned_received', $a->profile['profile_uid']); $o .= conversation($a, $items, $pager, 'profile', $update, false, 'pinned_received', $a->profile['uid']);
if (!$update) { if (!$update) {
$o .= $pager->renderMinimal(count($items)); $o .= $pager->renderMinimal(count($items));

View File

@ -40,7 +40,7 @@ class Contacts extends BaseModule
Profile::load($a, $nickname); Profile::load($a, $nickname);
$is_owner = $a->profile['profile_uid'] == local_user(); $is_owner = $a->profile['uid'] == local_user();
// tabs // tabs
$o = Profile::getTabs($a, 'contacts', $is_owner, $nickname); $o = Profile::getTabs($a, 'contacts', $is_owner, $nickname);

View File

@ -61,7 +61,7 @@ class Thread
$this->writable = true; $this->writable = true;
break; break;
case 'profile': case 'profile':
$this->profile_owner = $a->profile['profile_uid']; $this->profile_owner = $a->profile['uid'];
$this->writable = Security::canWriteToUserWall($this->profile_owner); $this->writable = Security::canWriteToUserWall($this->profile_owner);
break; break;
case 'display': case 'display':

View File

@ -145,7 +145,7 @@ function vier_community_info()
$tpl = Renderer::getMarkupTemplate('ch_directory_item.tpl'); $tpl = Renderer::getMarkupTemplate('ch_directory_item.tpl');
$r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname` $r = q("SELECT `profile`.*, `user`.`nickname`
FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $order LIMIT %d , %d ", WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $order LIMIT %d , %d ",
0, 0,
@ -157,7 +157,7 @@ function vier_community_info()
$aside['$lastusers_items'] = []; $aside['$lastusers_items'] = [];
foreach ($r as $rr) { foreach ($r as $rr) {
$profile_link = 'profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']); $profile_link = 'profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['uid']);
$entry = Renderer::replaceMacros($tpl, [ $entry = Renderer::replaceMacros($tpl, [
'$id' => $rr['id'], '$id' => $rr['id'],
'$profile_link' => $profile_link, '$profile_link' => $profile_link,