From 4bd1061a095a0fd80c69e2151b3fcf0a232a0169 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 6 Mar 2016 14:53:30 +0100 Subject: [PATCH] Only import OStatus threads if we follow the thread starter --- boot.php | 3 +++ include/ostatus.php | 7 +++++++ mod/admin.php | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/boot.php b/boot.php index 0a2f5c50cd..5cc3499311 100644 --- a/boot.php +++ b/boot.php @@ -1509,6 +1509,9 @@ function killme() { * @brief Redirect to another URL and terminate this process. */ function goaway($s) { + if (!strstr(normalise_link($s), normalise_link(App::get_baseurl()))) + $s = App::get_baseurl()."/".$s; + header("Location: $s"); killme(); } diff --git a/include/ostatus.php b/include/ostatus.php index 5c5016d0fc..40df688ea7 100644 --- a/include/ostatus.php +++ b/include/ostatus.php @@ -809,6 +809,13 @@ function ostatus_completion($conversation_url, $uid, $item = array()) { // 2. This first post is a post inside our thread // 3. This first post is a post inside another thread if (($first_id != $parent["uri"]) AND ($parent["uri"] != "")) { + + // Do we only want to import threads that were started by our contacts? + if (get_config('system','ostatus_full_threads')) { + logger("Don't import uri ".$first_id." because we don't follow this person.", LOGGER_DEBUG); + continue; + } + $new_parents = q("SELECT `id`, `parent`, `uri`, `contact-id`, `type`, `verb`, `visible` FROM `item` WHERE `id` IN (SELECT `parent` FROM `item` WHERE `uid` = %d AND `uri` = '%s' AND `network` IN ('%s','%s')) LIMIT 1", diff --git a/mod/admin.php b/mod/admin.php index f6958098b8..e7c4f51b66 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -949,7 +949,7 @@ function admin_page_site(&$a) { '$max_author_posts_community_page' => array('max_author_posts_community_page', t("Posts per user on community page"), get_config('system','max_author_posts_community_page'), t("The maximum number of posts per user on the community page. (Not valid for 'Global Community')")), '$ostatus_disabled' => array('ostatus_disabled', t("Enable OStatus support"), !get_config('system','ostatus_disabled'), t("Provide built-in OStatus \x28StatusNet, GNU Social etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")), '$ostatus_poll_interval' => array('ostatus_poll_interval', t("OStatus conversation completion interval"), (string) intval(get_config('system','ostatus_poll_interval')), t("How often shall the poller check for new entries in OStatus conversations? This can be a very ressource task."), $ostatus_poll_choices), - '$ostatus_full_threads' => array('ostatus_disabled', t("Only import OStatus threads from our contacts"), get_config('system','ostatus_full_threads'), t("Normally we import every content from our OStatus contacts. With this option we only store threads that are started by a contact that is known on our system.")), + '$ostatus_full_threads' => array('ostatus_full_threads', t("Only import OStatus threads from our contacts"), get_config('system','ostatus_full_threads'), t("Normally we import every content from our OStatus contacts. With this option we only store threads that are started by a contact that is known on our system.")), '$ostatus_not_able' => t("OStatus support can only be enabled if threading is enabled."), '$diaspora_able' => $diaspora_able, '$diaspora_not_able' => t("Diaspora support can't be enabled because Friendica was installed into a sub directory."),