]> git.mxchange.org Git - friendica.git/commitdiff
Public federated items now always are having an entry with "uid=0"
authorMichael <heluecht@pirati.ca>
Mon, 23 Apr 2018 11:14:25 +0000 (11:14 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 23 Apr 2018 11:14:25 +0000 (11:14 +0000)
boot.php
mod/admin.php
mod/community.php
src/Content/Nav.php
src/Model/Item.php

index 217a5f4e1d9ba834df26bcc3ba5f3455e933f4a6..1ca8b8d8d8ccf720c977887789c6ebd5f8ade8cf 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -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);
 /**
  * @}
  */
index 3debb57bedf2072d2b1d02de3918df7ac9b5f093..7749cff6dcd3be23fb95a79e2ae5f294beb03964 100644 (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"),
index 40ebdbb6e011f2aa5cea9a9f0a55523da7815d8b..876339dea11d8de39de3408ef5826a8429b7f783 100644 (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 {
index c437c6e2a1859cbcce1bf5a4323a89bbc60d95c0..cd2cfb3639044f116b3234d47df94cd05ebf6320 100644 (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')];
                }
 
index 499ec25c1ae3a65bbcfd0dc36f58d945d8eae371..248418a7c283cadb84c3ef6786ee9d018dd6298f 100644 (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])) {