From b3d73b125526002e147302cfd05279d33bd8db73 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 25 Nov 2017 23:56:18 +0000 Subject: [PATCH] Publiv forum posts aren't transmitted via the connectors anymore --- buffer/buffer.php | 7 +++++++ diaspora/diaspora.php | 7 +++++++ libertree/libertree.php | 18 ++++++++++++------ pumpio/pumpio.php | 7 +++++++ statusnet/statusnet.php | 7 +++++++ tumblr/tumblr.php | 7 +++++++ twitter/twitter.php | 14 +++++++++++--- wppost/wppost.php | 6 ++++++ 8 files changed, 64 insertions(+), 9 deletions(-) diff --git a/buffer/buffer.php b/buffer/buffer.php index f5f88e106..131574819 100644 --- a/buffer/buffer.php +++ b/buffer/buffer.php @@ -247,6 +247,13 @@ function buffer_send(&$a,&$b) { if($b['parent'] != $b['id']) return; + // Dont't post if the post doesn't belong to us. + // This is a check for forum postings + $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1)); + if ($b['contact-id'] != $self['id']) { + return; + } + // if post comes from buffer don't send it back //if($b['app'] == "Buffer") // return; diff --git a/diaspora/diaspora.php b/diaspora/diaspora.php index 64388bbd2..04ed24ca8 100755 --- a/diaspora/diaspora.php +++ b/diaspora/diaspora.php @@ -284,6 +284,13 @@ function diaspora_send(&$a,&$b) { if($b['parent'] != $b['id']) return; + // Dont't post if the post doesn't belong to us. + // This is a check for forum postings + $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1)); + if ($b['contact-id'] != $self['id']) { + return; + } + logger('diaspora_send: prepare posting', LOGGER_DEBUG); $handle = PConfig::get($b['uid'],'diaspora','handle'); diff --git a/libertree/libertree.php b/libertree/libertree.php index 0ff512cf2..95def07a0 100755 --- a/libertree/libertree.php +++ b/libertree/libertree.php @@ -155,15 +155,21 @@ function libertree_send(&$a,&$b) { logger('libertree_send: invoked'); - if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) - return; + if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) + return; - if(! strstr($b['postopts'],'libertree')) - return; + if (! strstr($b['postopts'],'libertree')) + return; - if($b['parent'] != $b['id']) - return; + if ($b['parent'] != $b['id']) + return; + // Dont't post if the post doesn't belong to us. + // This is a check for forum postings + $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1)); + if ($b['contact-id'] != $self['id']) { + return; + } $ltree_api_token = PConfig::get($b['uid'],'libertree','libertree_api_token'); $ltree_url = PConfig::get($b['uid'],'libertree','libertree_url'); diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 3d3f5bf4d..358a22571 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -415,6 +415,13 @@ function pumpio_send(&$a,&$b) { if (!count($receiver) && ($b['private'] || !strstr($b['postopts'],'pumpio'))) return; + + // Dont't post if the post doesn't belong to us. + // This is a check for forum postings + $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1)); + if ($b['contact-id'] != $self['id']) { + return; + } } if($b['verb'] == ACTIVITY_LIKE) { diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 5f3e83ca1..94393313e 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -541,6 +541,13 @@ function statusnet_post_hook(&$a,&$b) { if($b['private'] || !strstr($b['postopts'],'statusnet')) return; + + // Dont't post if the post doesn't belong to us. + // This is a check for forum postings + $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1)); + if ($b['contact-id'] != $self['id']) { + return; + } } if (($b['verb'] == ACTIVITY_POST) && $b['deleted']) diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index 0a22d143a..77d98aca7 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -325,6 +325,13 @@ function tumblr_send(&$a,&$b) { if($b['parent'] != $b['id']) return; + // Dont't post if the post doesn't belong to us. + // This is a check for forum postings + $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1)); + if ($b['contact-id'] != $self['id']) { + return; + } + $oauth_token = PConfig::get($b['uid'], "tumblr", "oauth_token"); $oauth_token_secret = PConfig::get($b['uid'], "tumblr", "oauth_token_secret"); $page = PConfig::get($b['uid'], "tumblr", "page"); diff --git a/twitter/twitter.php b/twitter/twitter.php index f8c6aec9a..f0c71cf41 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -171,7 +171,7 @@ function twitter_jot_nets(&$a,&$b) { } } -function twitter_settings_post ($a,$post) { +function twitter_settings_post($a,$post) { if(! local_user()) return; // don't check twitter settings if twitter submit button is not clicked @@ -412,7 +412,7 @@ function twitter_post_hook(&$a,&$b) { return; } - if($b['parent'] != $b['id']) { + if ($b['parent'] != $b['id']) { logger("twitter_post_hook: parameter ".print_r($b, true), LOGGER_DATA); // Looking if its a reply to a twitter post @@ -446,8 +446,16 @@ function twitter_post_hook(&$a,&$b) { } else { $iscomment = false; - if($b['private'] || !strstr($b['postopts'],'twitter')) + if ($b['private'] || !strstr($b['postopts'],'twitter')) { return; + } + + // Dont't post if the post doesn't belong to us. + // This is a check for forum postings + $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1)); + if ($b['contact-id'] != $self['id']) { + return; + } } if (($b['verb'] == ACTIVITY_POST) && $b['deleted']) diff --git a/wppost/wppost.php b/wppost/wppost.php index f14831018..ea26ae453 100755 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -200,6 +200,12 @@ function wppost_send(&$a,&$b) { if($b['parent'] != $b['id']) return; + // Dont't post if the post doesn't belong to us. + // This is a check for forum postings + $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1)); + if ($b['contact-id'] != $self['id']) { + return; + } $wp_username = xmlify(PConfig::get($b['uid'],'wppost','wp_username')); $wp_password = xmlify(PConfig::get($b['uid'],'wppost','wp_password'));