mirror of
https://github.com/friendica/friendica
synced 2024-12-23 04:40:15 +00:00
Remove duplicate profile_uid key in App->profile array
This commit is contained in:
parent
f6f4cbab9d
commit
62fec2f190
3 changed files with 31 additions and 30 deletions
|
@ -46,16 +46,18 @@ class Index extends BaseModule
|
|||
{
|
||||
$a = DI::app();
|
||||
|
||||
if (DI::config()->get('system', 'block_public') && !local_user() && !Session::getRemoteContactID($a->profile['profile_uid'])) {
|
||||
ProfileModel::load($a, $parameters['nickname']);
|
||||
|
||||
$remote_contact_id = Session::getRemoteContactID($a->profile['uid']);
|
||||
|
||||
if (DI::config()->get('system', 'block_public') && !local_user() && !$remote_contact_id) {
|
||||
return Login::form();
|
||||
}
|
||||
|
||||
ProfileModel::load($a, $parameters['nickname']);
|
||||
|
||||
DI::page()['htmlhead'] .= "\n";
|
||||
|
||||
$blocked = !local_user() && !Session::getRemoteContactID($a->profile['profile_uid']) && DI::config()->get('system', 'block_public');
|
||||
$userblock = !local_user() && !Session::getRemoteContactID($a->profile['profile_uid']) && $a->profile['hidewall'];
|
||||
$blocked = !local_user() && !$remote_contact_id && DI::config()->get('system', 'block_public');
|
||||
$userblock = !local_user() && !$remote_contact_id && $a->profile['hidewall'];
|
||||
|
||||
if (!empty($a->profile['page-flags']) && $a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY) {
|
||||
DI::page()['htmlhead'] .= '<meta name="friendica.community" content="true" />' . "\n";
|
||||
|
@ -102,10 +104,9 @@ class Index extends BaseModule
|
|||
|
||||
Nav::setSelected('home');
|
||||
|
||||
$remote_contact = Session::getRemoteContactID($a->profile['profile_uid']);
|
||||
$is_owner = local_user() == $a->profile['profile_uid'];
|
||||
$is_owner = local_user() == $a->profile['uid'];
|
||||
|
||||
if (!empty($a->profile['hidewall']) && !$is_owner && !$remote_contact) {
|
||||
if (!empty($a->profile['hidewall']) && !$is_owner && !$remote_contact_id) {
|
||||
notice(DI::l10n()->t('Access to this profile has been restricted.'));
|
||||
return '';
|
||||
}
|
||||
|
|
|
@ -64,19 +64,19 @@ class Status extends BaseModule
|
|||
|
||||
$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();
|
||||
}
|
||||
|
||||
$o = '';
|
||||
|
||||
if ($a->profile['profile_uid'] == local_user()) {
|
||||
if ($a->profile['uid'] == local_user()) {
|
||||
Nav::setSelected('home');
|
||||
}
|
||||
|
||||
$remote_contact = Session::getRemoteContactID($a->profile['profile_uid']);
|
||||
$is_owner = local_user() == $a->profile['profile_uid'];
|
||||
$last_updated_key = "profile:" . $a->profile['profile_uid'] . ":" . local_user() . ":" . $remote_contact;
|
||||
$remote_contact = Session::getRemoteContactID($a->profile['uid']);
|
||||
$is_owner = local_user() == $a->profile['uid'];
|
||||
$last_updated_key = "profile:" . $a->profile['uid'] . ":" . local_user() . ":" . $remote_contact;
|
||||
|
||||
if (!empty($a->profile['hidewall']) && !$is_owner && !$remote_contact) {
|
||||
notice(DI::l10n()->t('Access to this profile has been restricted.') . EOL);
|
||||
|
@ -85,7 +85,7 @@ class Status extends BaseModule
|
|||
|
||||
$o .= ProfileModel::getTabs($a, 'status', $is_owner, $a->profile['nickname']);
|
||||
|
||||
$o .= Widget::commonFriendsVisitor($a->profile['profile_uid']);
|
||||
$o .= Widget::commonFriendsVisitor($a->profile['uid']);
|
||||
|
||||
$commpage = $a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
|
||||
$commvisitor = $commpage && $remote_contact;
|
||||
|
@ -94,7 +94,7 @@ class Status extends BaseModule
|
|||
DI::page()['aside'] .= Widget::categories(DI::baseUrl() . '/profile/' . $a->profile['nickname'] . '/status', XML::escape($category));
|
||||
DI::page()['aside'] .= Widget::tagCloud();
|
||||
|
||||
if (Security::canWriteToUserWall($a->profile['profile_uid'])) {
|
||||
if (Security::canWriteToUserWall($a->profile['uid'])) {
|
||||
$x = [
|
||||
'is_owner' => $is_owner,
|
||||
'allow_location' => ($is_owner || $commvisitor) && $a->profile['allow_location'],
|
||||
|
@ -109,14 +109,14 @@ class Status extends BaseModule
|
|||
'acl' => $is_owner ? ACL::getFullSelectorHTML(DI::page(), $a->user, true) : '',
|
||||
'bang' => '',
|
||||
'visitor' => $is_owner || $commvisitor ? 'block' : 'none',
|
||||
'profile_uid' => $a->profile['profile_uid'],
|
||||
'profile_uid' => $a->profile['uid'],
|
||||
];
|
||||
|
||||
$o .= status_editor($a, $x);
|
||||
}
|
||||
|
||||
// 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 = '';
|
||||
|
||||
$last_updated_array = Session::get('last_updated', []);
|
||||
|
@ -125,12 +125,12 @@ class Status extends BaseModule
|
|||
|
||||
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` ",
|
||||
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)) {
|
||||
$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)) {
|
||||
|
@ -142,7 +142,7 @@ class Status extends BaseModule
|
|||
|
||||
// Does the profile page belong to a forum?
|
||||
// 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)) {
|
||||
$sql_extra3 = sprintf(" AND `thread`.`contact-id` = %d ", intval(intval($a->profile['contact_id'])));
|
||||
} else {
|
||||
|
@ -186,7 +186,7 @@ class Status extends BaseModule
|
|||
$sql_extra2
|
||||
ORDER BY `thread`.`received` DESC
|
||||
$pager_sql",
|
||||
$a->profile['profile_uid']
|
||||
$a->profile['uid']
|
||||
);
|
||||
|
||||
// Set a time stamp for this page. We will make use of it when we
|
||||
|
@ -208,7 +208,7 @@ class Status extends BaseModule
|
|||
|
||||
$items = DBA::toArray($items_stmt);
|
||||
|
||||
$o .= conversation($a, $items, $pager, 'profile', false, false, 'received', $a->profile['profile_uid']);
|
||||
$o .= conversation($a, $items, $pager, 'profile', false, false, 'received', $a->profile['uid']);
|
||||
|
||||
$o .= $pager->renderMinimal(count($items));
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class Profile extends BaseModule
|
|||
{
|
||||
$a = DI::app();
|
||||
|
||||
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'])) {
|
||||
throw new ForbiddenException();
|
||||
}
|
||||
|
||||
|
@ -29,18 +29,18 @@ class Profile extends BaseModule
|
|||
$profile_uid = intval($_GET['p'] ?? 0);
|
||||
|
||||
// Ensure we've got a profile owner if updating.
|
||||
$a->profile['profile_uid'] = $profile_uid;
|
||||
$a->profile['uid'] = $profile_uid;
|
||||
|
||||
$remote_contact = Session::getRemoteContactID($a->profile['profile_uid']);
|
||||
$is_owner = local_user() == $a->profile['profile_uid'];
|
||||
$last_updated_key = "profile:" . $a->profile['profile_uid'] . ":" . local_user() . ":" . $remote_contact;
|
||||
$remote_contact = Session::getRemoteContactID($a->profile['uid']);
|
||||
$is_owner = local_user() == $a->profile['uid'];
|
||||
$last_updated_key = "profile:" . $a->profile['uid'] . ":" . local_user() . ":" . $remote_contact;
|
||||
|
||||
if (!empty($a->profile['hidewall']) && !$is_owner && !$remote_contact) {
|
||||
throw new ForbiddenException(DI::l10n()->t('Access to this profile has been restricted.'));
|
||||
}
|
||||
|
||||
// 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']);
|
||||
|
||||
$last_updated_array = Session::get('last_updated', []);
|
||||
|
||||
|
@ -70,7 +70,7 @@ class Profile extends BaseModule
|
|||
$sql_extra4
|
||||
$sql_extra
|
||||
ORDER BY `item`.`received` DESC",
|
||||
$a->profile['profile_uid'],
|
||||
$a->profile['uid'],
|
||||
GRAVITY_ACTIVITY
|
||||
);
|
||||
|
||||
|
@ -99,7 +99,7 @@ class Profile extends BaseModule
|
|||
|
||||
$items = DBA::toArray($items_stmt);
|
||||
|
||||
$o .= conversation($a, $items, $pager, 'profile', $profile_uid, false, 'received', $a->profile['profile_uid']);
|
||||
$o .= conversation($a, $items, $pager, 'profile', $profile_uid, false, 'received', $a->profile['uid']);
|
||||
|
||||
header("Content-type: text/html");
|
||||
echo "<!DOCTYPE html><html><body>\r\n";
|
||||
|
|
Loading…
Reference in a new issue