Better working with private forums
This commit is contained in:
parent
fd7658a70a
commit
16beab4652
|
@ -23,9 +23,18 @@ function noscrape_init(App $a)
|
|||
|
||||
Profile::load($a, $which, $profile);
|
||||
|
||||
$json_info = [
|
||||
'addr' => $a->profile['addr'],
|
||||
'nick' => $which,
|
||||
'guid' => $a->profile['guid'],
|
||||
'key' => $a->profile['pubkey'],
|
||||
'homepage' => System::baseUrl()."/profile/{$which}",
|
||||
'comm' => ($a->profile['account-type'] == ACCOUNT_TYPE_COMMUNITY),
|
||||
];
|
||||
|
||||
if (!$a->profile['net-publish'] || $a->profile['hidewall']) {
|
||||
header('Content-type: application/json; charset=utf-8');
|
||||
$json_info = ["hide" => true];
|
||||
$json_info["hide"] = true;
|
||||
echo json_encode($json_info);
|
||||
exit;
|
||||
}
|
||||
|
@ -36,17 +45,9 @@ function noscrape_init(App $a)
|
|||
|
||||
$contactPhoto = dba::selectFirst('contact', ['photo'], ['self' => true, 'uid' => $a->profile['uid']]);
|
||||
|
||||
$json_info = [
|
||||
'fn' => $a->profile['name'],
|
||||
'addr' => $a->profile['addr'],
|
||||
'nick' => $which,
|
||||
'guid' => $a->profile['guid'],
|
||||
'key' => $a->profile['pubkey'],
|
||||
'homepage' => System::baseUrl()."/profile/{$which}",
|
||||
'comm' => (x($a->profile, 'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY),
|
||||
'photo' => $contactPhoto["photo"],
|
||||
'tags' => $keywords
|
||||
];
|
||||
$json_info['fn'] = $a->profile['name'];
|
||||
$json_info['photo'] = $contactPhoto["photo"];
|
||||
$json_info['tags'] = $keywords;
|
||||
|
||||
if (is_array($a->profile) && !$a->profile['hide-friends']) {
|
||||
/// @todo What should this value tell us?
|
||||
|
|
|
@ -180,16 +180,12 @@ class Nav
|
|||
|
||||
$nav['home'] = ['profile/' . $a->user['nickname'], L10n::t('Home'), '', L10n::t('Your posts and conversations')];
|
||||
|
||||
if (in_array($_SESSION['page_flags'], [PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_PRVGROUP])) {
|
||||
// only show friend requests for normal pages. Other page types have automatic friendship.
|
||||
if (in_array($_SESSION['page_flags'], [PAGE_NORMAL, PAGE_SOAPBOX, PAGE_PRVGROUP])) {
|
||||
$nav['introductions'] = ['notifications/intros', L10n::t('Introductions'), '', L10n::t('Friend Requests')];
|
||||
}
|
||||
if (in_array($_SESSION['page_flags'], [PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE])) {
|
||||
$nav['notifications'] = ['notifications', L10n::t('Notifications'), '', L10n::t('Notifications')];
|
||||
$nav['notifications']['all'] = ['notifications/system', L10n::t('See all notifications'), '', ''];
|
||||
$nav['notifications']['mark'] = ['', L10n::t('Mark as seen'), '', L10n::t('Mark all system notifications seen')];
|
||||
}
|
||||
// Don't show notifications for public communities
|
||||
if ($_SESSION['page_flags'] != PAGE_COMMUNITY) {
|
||||
$nav['introductions'] = ['notifications/intros', L10n::t('Introductions'), '', L10n::t('Friend Requests')];
|
||||
$nav['notifications'] = ['notifications', L10n::t('Notifications'), '', L10n::t('Notifications')];
|
||||
$nav['notifications']['all'] = ['notifications/system', L10n::t('See all notifications'), '', ''];
|
||||
$nav['notifications']['mark'] = ['', L10n::t('Mark as seen'), '', L10n::t('Mark all system notifications seen')];
|
||||
}
|
||||
|
||||
$nav['messages'] = ['message', L10n::t('Messages'), '', L10n::t('Private mail')];
|
||||
|
|
|
@ -423,7 +423,7 @@ class Contact extends BaseObject
|
|||
// Fetch the data from the gcontact table
|
||||
if (!DBM::is_result($r)) {
|
||||
$s = dba::p("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, '' AS `xmpp`,
|
||||
`keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, `community` AS `forum`, 0 AS `prv`, `community`, `contact-type`, `birthday`, 0 AS `self`
|
||||
`keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, 0 AS `forum`, 0 AS `prv`, `community`, `contact-type`, `birthday`, 0 AS `self`
|
||||
FROM `gcontact` WHERE `nurl` = ?", normalise_link($url));
|
||||
$r = dba::inArray($s);
|
||||
}
|
||||
|
|
|
@ -2923,6 +2923,9 @@ class DFRN
|
|||
|
||||
logger("Import DFRN message for user " . $importer["importer_uid"] . " from contact " . $importer["id"], LOGGER_DEBUG);
|
||||
|
||||
// is it a public forum? Private forums aren't exposed with this method
|
||||
$forum = intval($xpath->evaluate("/atom:feed/dfrn:community/text()")->item(0)->nodeValue);
|
||||
|
||||
// The account type is new since 3.5.1
|
||||
if ($xpath->query("/atom:feed/dfrn:account_type")->length > 0) {
|
||||
$accounttype = intval($xpath->evaluate("/atom:feed/dfrn:account_type/text()")->item(0)->nodeValue);
|
||||
|
@ -2930,17 +2933,17 @@ class DFRN
|
|||
if ($accounttype != $importer["contact-type"]) {
|
||||
dba::update('contact', ['contact-type' => $accounttype], ['id' => $importer["id"]]);
|
||||
}
|
||||
}
|
||||
|
||||
// is it a public forum? Private forums aren't supported with this method
|
||||
// This is deprecated since 3.5.1
|
||||
$forum = intval($xpath->evaluate("/atom:feed/dfrn:community/text()")->item(0)->nodeValue);
|
||||
|
||||
if ($forum != $importer["forum"]) {
|
||||
// A forum contact can either have set "forum" or "prv" - but not both
|
||||
if (($accounttype == ACCOUNT_TYPE_COMMUNITY) && (($forum != $importer["forum"]) || ($forum == $importer["prv"]))) {
|
||||
$condition = ['(`forum` != ? OR `prv` != ?) AND `id` = ?', $forum, !$forum, $importer["id"]];
|
||||
dba::update('contact', ['forum' => $forum, 'prv' => !$forum], $condition);
|
||||
}
|
||||
} elseif ($forum != $importer["forum"]) { // Deprecated since 3.5.1
|
||||
$condition = ['`forum` != ? AND `id` = ?', $forum, $importer["id"]];
|
||||
dba::update('contact', ['forum' => $forum], $condition);
|
||||
}
|
||||
|
||||
|
||||
// We are processing relocations even if we are ignoring a contact
|
||||
$relocations = $xpath->query("/atom:feed/dfrn:relocate");
|
||||
foreach ($relocations as $relocation) {
|
||||
|
|
Loading…
Reference in a new issue