Browse Source

Public federated items now always are having an entry with "uid=0"

pull/4924/head
Michael 3 years ago
parent
commit
ba35b19af6
5 changed files with 15 additions and 25 deletions
  1. +5
    -4
      boot.php
  2. +1
    -0
      mod/admin.php
  3. +5
    -0
      mod/community.php
  4. +2
    -1
      src/Content/Nav.php
  5. +2
    -20
      src/Model/Item.php

+ 5
- 4
boot.php View File

@ -232,10 +232,11 @@ define('ACCOUNT_TYPE_RELAY', 4);
* Type of the community page
* @{
*/
define('CP_NO_COMMUNITY_PAGE', -1);
define('CP_USERS_ON_SERVER', 0);
define('CP_GLOBAL_COMMUNITY', 1);
define('CP_USERS_AND_GLOBAL', 2);
define('CP_NO_INTERNAL_COMMUNITY', -2);
define('CP_NO_COMMUNITY_PAGE', -1);
define('CP_USERS_ON_SERVER', 0);
define('CP_GLOBAL_COMMUNITY', 1);
define('CP_USERS_AND_GLOBAL', 2);
/**
* @}
*/


+ 1
- 0
mod/admin.php View File

@ -1262,6 +1262,7 @@ function admin_page_site(App $a)
/* Community page style */
$community_page_style_choices = [
CP_NO_INTERNAL_COMMUNITY => L10n::t("No community page for local users"),
CP_NO_COMMUNITY_PAGE => L10n::t("No community page"),
CP_USERS_ON_SERVER => L10n::t("Public postings from users of this site"),
CP_GLOBAL_COMMUNITY => L10n::t("Public postings from the federated network"),


+ 5
- 0
mod/community.php View File

@ -30,6 +30,11 @@ function community_content(App $a, $update = 0)
$page_style = Config::get('system', 'community_page_style');
if ($page_style == CP_NO_INTERNAL_COMMUNITY) {
notice(L10n::t('Access denied.') . EOL);
return;
}
if ($a->argc > 1) {
$content = $a->argv[1];
} else {


+ 2
- 1
src/Content/Nav.php View File

@ -161,7 +161,8 @@ class Nav
}
}
if (local_user() || Config::get('system', 'community_page_style') != CP_NO_COMMUNITY_PAGE) {
if ((local_user() || Config::get('system', 'community_page_style') != CP_NO_COMMUNITY_PAGE) &&
!(Config::get('system', 'community_page_style') == CP_NO_INTERNAL_COMMUNITY)) {
$nav['community'] = ['community', L10n::t('Community'), '', L10n::t('Conversations on this and other servers')];
}


+ 2
- 20
src/Model/Item.php View File

@ -851,7 +851,7 @@ class Item extends BaseObject
public static function addShadow($itemid)
{
$fields = ['uid', 'wall', 'private', 'moderated', 'visible', 'contact-id', 'deleted', 'network', 'author-id', 'owner-id'];
$condition = ["`id` = ? AND (`parent` = ? OR `parent` = 0)", $itemid, $itemid];
$condition = ['id' => $itemid, 'parent' => [0, $itemid]];
$item = dba::selectFirst('item', $fields, $condition);
if (!DBM::is_result($item)) {
@ -873,27 +873,9 @@ class Item extends BaseObject
return;
}
// Only do these checks if the post isn't a wall post
if (!$item["wall"]) {
// Check, if hide-friends is activated - then don't do a shadow entry
if (dba::exists('profile', ['is-default' => true, 'uid' => $item['uid'], 'hide-friends' => true])) {
return;
}
// Check if the contact is hidden or blocked
if (!dba::exists('contact', ['hidden' => false, 'blocked' => false, 'id' => $item['contact-id']])) {
return;
}
}
// Only add a shadow, if the profile isn't hidden
if (dba::exists('user', ['uid' => $item['uid'], 'hidewall' => true])) {
return;
}
$item = dba::selectFirst('item', [], ['id' => $itemid]);
if (DBM::is_result($item) && ($item["allow_cid"] == '') && ($item["allow_gid"] == '') &&
if (DBM::is_result($item) && ($item["allow_cid"] == '') && ($item["allow_gid"] == '') &&
($item["deny_cid"] == '') && ($item["deny_gid"] == '')) {
if (!dba::exists('item', ['uri' => $item['uri'], 'uid' => 0])) {


Loading…
Cancel
Save