From 642ab7f76fb1b12e61878d1ed6934feb81166993 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 6 Sep 2017 16:16:33 +0000 Subject: [PATCH] "remote self" should work now with the addons --- appnet/appnet.php | 2 +- blogger/blogger.php | 2 +- buffer/buffer.php | 12 ++++++--- diaspora/diaspora.php | 25 ++++++++++------- libertree/libertree.php | 25 ++++++++++------- pumpio/pumpio.php | 16 ++++++----- statusnet/statusnet.php | 42 ++++++++++++++++------------- tumblr/tumblr.php | 21 ++++++++++----- twitter/twitter.php | 42 ++++++++++++++++------------- unicode_smilies/unicode_smilies.php | 2 +- wppost/wppost.php | 27 ++++++++++--------- 11 files changed, 129 insertions(+), 87 deletions(-) diff --git a/appnet/appnet.php b/appnet/appnet.php index fff1cc73d..151a81ee4 100644 --- a/appnet/appnet.php +++ b/appnet/appnet.php @@ -296,7 +296,7 @@ function appnet_post_local(&$a,&$b) { $appnet_enable = (($appnet_post && x($_REQUEST,'appnet_enable')) ? intval($_REQUEST['appnet_enable']) : 0); // if API is used, default to the chosen settings - if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'appnet','post_by_default'))) + if($b['api_source'] && intval(get_pconfig(local_user(),'appnet','post_by_default'))) $appnet_enable = 1; if(! $appnet_enable) diff --git a/blogger/blogger.php b/blogger/blogger.php index 87f58859f..892e8a452 100755 --- a/blogger/blogger.php +++ b/blogger/blogger.php @@ -141,7 +141,7 @@ function blogger_post_local(&$a,&$b) { $bl_enable = (($bl_post && x($_REQUEST,'blogger_enable')) ? intval($_REQUEST['blogger_enable']) : 0); - if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'blogger','post_by_default'))) + if($b['api_source'] && intval(get_pconfig(local_user(),'blogger','post_by_default'))) $bl_enable = 1; if(! $bl_enable) diff --git a/buffer/buffer.php b/buffer/buffer.php index 0b92144b7..ca33708c8 100644 --- a/buffer/buffer.php +++ b/buffer/buffer.php @@ -210,21 +210,25 @@ function buffer_settings_post(&$a,&$b) { function buffer_post_local(&$a,&$b) { - if((! local_user()) || (local_user() != $b['uid'])) + if (!local_user() || (local_user() != $b['uid'])) { return; + } $buffer_post = intval(get_pconfig(local_user(),'buffer','post')); $buffer_enable = (($buffer_post && x($_REQUEST,'buffer_enable')) ? intval($_REQUEST['buffer_enable']) : 0); - if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'buffer','post_by_default'))) + if ($b['api_source'] && intval(get_pconfig(local_user(),'buffer','post_by_default'))) { $buffer_enable = 1; + } - if(! $buffer_enable) + if (!$buffer_enable) { return; + } - if(strlen($b['postopts'])) + if (strlen($b['postopts'])) { $b['postopts'] .= ','; + } $b['postopts'] .= 'buffer'; } diff --git a/diaspora/diaspora.php b/diaspora/diaspora.php index 09d8f1148..f637f468e 100755 --- a/diaspora/diaspora.php +++ b/diaspora/diaspora.php @@ -233,28 +233,35 @@ function diaspora_settings_post(&$a,&$b) { function diaspora_post_local(&$a,&$b) { - if($b['edit']) + if ($b['edit']) { return; + } - if((! local_user()) || (local_user() != $b['uid'])) + if (!local_user() || (local_user() != $b['uid'])) { return; + } - if($b['private'] || $b['parent']) + if ($b['private'] || $b['parent']) { return; + } $diaspora_post = intval(get_pconfig(local_user(),'diaspora','post')); $diaspora_enable = (($diaspora_post && x($_REQUEST,'diaspora_enable')) ? intval($_REQUEST['diaspora_enable']) : 0); - if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'diaspora','post_by_default'))) + if ($b['api_source'] && intval(get_pconfig(local_user(),'diaspora','post_by_default'))) { $diaspora_enable = 1; + } - if(! $diaspora_enable) - return; + if (!$diaspora_enable) { + return; + } - if(strlen($b['postopts'])) - $b['postopts'] .= ','; - $b['postopts'] .= 'diaspora'; + if (strlen($b['postopts'])) { + $b['postopts'] .= ','; + } + + $b['postopts'] .= 'diaspora'; } diff --git a/libertree/libertree.php b/libertree/libertree.php index 56dc946c3..c87a71043 100755 --- a/libertree/libertree.php +++ b/libertree/libertree.php @@ -115,28 +115,35 @@ function libertree_post_local(&$a,&$b) { // This can probably be changed to allow editing by pointing to a different API endpoint - if($b['edit']) + if ($b['edit']) { return; + } - if((! local_user()) || (local_user() != $b['uid'])) + if ((! local_user()) || (local_user() != $b['uid'])) { return; + } - if($b['private'] || $b['parent']) + if ($b['private'] || $b['parent']) { return; + } $ltree_post = intval(get_pconfig(local_user(),'libertree','post')); $ltree_enable = (($ltree_post && x($_REQUEST,'libertree_enable')) ? intval($_REQUEST['libertree_enable']) : 0); - if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'libertree','post_by_default'))) + if ($b['api_source'] && intval(get_pconfig(local_user(),'libertree','post_by_default'))) { $ltree_enable = 1; + } - if(! $ltree_enable) - return; + if (!$ltree_enable) { + return; + } - if(strlen($b['postopts'])) - $b['postopts'] .= ','; - $b['postopts'] .= 'libertree'; + if (strlen($b['postopts'])) { + $b['postopts'] .= ','; + } + + $b['postopts'] .= 'libertree'; } diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 8d11c0285..f70801a85 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -349,23 +349,27 @@ function pumpio_settings_post(&$a,&$b) { } } -function pumpio_post_local(&$a,&$b) { +function pumpio_post_local(&$a, &$b) { - if((! local_user()) || (local_user() != $b['uid'])) + if (!local_user() || (local_user() != $b['uid'])) { return; + } - $pumpio_post = intval(get_pconfig(local_user(),'pumpio','post')); + $pumpio_post = intval(get_pconfig(local_user(), 'pumpio', 'post')); $pumpio_enable = (($pumpio_post && x($_REQUEST,'pumpio_enable')) ? intval($_REQUEST['pumpio_enable']) : 0); - if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'pumpio','post_by_default'))) + if ($b['api_source'] && intval(get_pconfig(local_user(), 'pumpio', 'post_by_default'))) { $pumpio_enable = 1; + } - if(! $pumpio_enable) + if (!$pumpio_enable) { return; + } - if(strlen($b['postopts'])) + if (strlen($b['postopts'])) { $b['postopts'] .= ','; + } $b['postopts'] .= 'pumpio'; } diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index fd266ef17..a004a6243 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -428,26 +428,32 @@ function statusnet_settings(&$a,&$s) { } -function statusnet_post_local(&$a,&$b) { - if($b['edit']) +function statusnet_post_local(&$a, &$b) { + if ($b['edit']) { return; - - if((local_user()) && (local_user() == $b['uid']) && (! $b['private'])) { - - $statusnet_post = get_pconfig(local_user(),'statusnet','post'); - $statusnet_enable = (($statusnet_post && x($_REQUEST,'statusnet_enable')) ? intval($_REQUEST['statusnet_enable']) : 0); - - // if API is used, default to the chosen settings - if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'statusnet','post_by_default'))) - $statusnet_enable = 1; - - if(! $statusnet_enable) - return; - - if(strlen($b['postopts'])) - $b['postopts'] .= ','; - $b['postopts'] .= 'statusnet'; } + + if (!local_user() || (local_user() != $b['uid'])) { + return; + } + + $statusnet_post = get_pconfig(local_user(),'statusnet','post'); + $statusnet_enable = (($statusnet_post && x($_REQUEST,'statusnet_enable')) ? intval($_REQUEST['statusnet_enable']) : 0); + + // if API is used, default to the chosen settings + if ($b['api_source'] && intval(get_pconfig(local_user(),'statusnet','post_by_default'))) { + $statusnet_enable = 1; + } + + if (!$statusnet_enable) { + return; + } + + if (strlen($b['postopts'])) { + $b['postopts'] .= ','; + } + + $b['postopts'] .= 'statusnet'; } function statusnet_action($a, $uid, $pid, $action) { diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index 5685ed4b3..50530401d 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -273,31 +273,38 @@ function tumblr_settings_post(&$a,&$b) { } -function tumblr_post_local(&$a,&$b) { +function tumblr_post_local(&$a, &$b) { // This can probably be changed to allow editing by pointing to a different API endpoint - if($b['edit']) + if ($b['edit']) { return; + } - if((! local_user()) || (local_user() != $b['uid'])) + if (!local_user() || (local_user() != $b['uid'])) { return; + } - if($b['private'] || $b['parent']) + if ($b['private'] || $b['parent']) { return; + } $tmbl_post = intval(get_pconfig(local_user(),'tumblr','post')); $tmbl_enable = (($tmbl_post && x($_REQUEST,'tumblr_enable')) ? intval($_REQUEST['tumblr_enable']) : 0); - if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'tumblr','post_by_default'))) + if ($b['api_source'] && intval(get_pconfig(local_user(),'tumblr','post_by_default'))) { $tmbl_enable = 1; + } - if(! $tmbl_enable) + if (!$tmbl_enable) { return; + } - if(strlen($b['postopts'])) + if (strlen($b['postopts'])) { $b['postopts'] .= ','; + } + $b['postopts'] .= 'tumblr'; } diff --git a/twitter/twitter.php b/twitter/twitter.php index 76b92ac81..7272957ca 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -334,27 +334,33 @@ function twitter_settings(&$a,&$s) { } -function twitter_post_local(&$a,&$b) { +function twitter_post_local(&$a, &$b) { - if($b['edit']) + if ($b['edit']) { return; - - if((local_user()) && (local_user() == $b['uid']) && (! $b['private']) && (! $b['parent']) ) { - - $twitter_post = intval(get_pconfig(local_user(),'twitter','post')); - $twitter_enable = (($twitter_post && x($_REQUEST,'twitter_enable')) ? intval($_REQUEST['twitter_enable']) : 0); - - // if API is used, default to the chosen settings - if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'twitter','post_by_default'))) - $twitter_enable = 1; - - if(! $twitter_enable) - return; - - if(strlen($b['postopts'])) - $b['postopts'] .= ','; - $b['postopts'] .= 'twitter'; } + + if (!local_user() || (local_user() != $b['uid'])) { + return; + } + + $twitter_post = intval(get_pconfig(local_user(), 'twitter', 'post')); + $twitter_enable = (($twitter_post && x($_REQUEST, 'twitter_enable')) ? intval($_REQUEST['twitter_enable']) : 0); + + // if API is used, default to the chosen settings + if ($b['api_source'] && intval(get_pconfig(local_user(), 'twitter', 'post_by_default'))) { + $twitter_enable = 1; + } + + if (!$twitter_enable) { + return; + } + + if (strlen($b['postopts'])) { + $b['postopts'] .= ','; + } + + $b['postopts'] .= 'twitter'; } function twitter_action($a, $uid, $pid, $action) { diff --git a/unicode_smilies/unicode_smilies.php b/unicode_smilies/unicode_smilies.php index 0c941a0cb..4ecea0c53 100644 --- a/unicode_smilies/unicode_smilies.php +++ b/unicode_smilies/unicode_smilies.php @@ -1,7 +1,7 @@ */ diff --git a/wppost/wppost.php b/wppost/wppost.php index 10437a066..fc9244af6 100755 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -149,38 +149,39 @@ function wppost_settings_post(&$a,&$b) { } -function wppost_post_local(&$a,&$b) { +function wppost_post_local(&$a, &$b) { // This can probably be changed to allow editing by pointing to a different API endpoint - if($b['edit']) { + if ($b['edit']) { return; } - if((! local_user()) || (local_user() != $b['uid'])) { + if (!local_user() || (local_user() != $b['uid'])) { return; } - if($b['private'] || $b['parent']) { + if ($b['private'] || $b['parent']) { return; } - $wp_post = intval(get_pconfig(local_user(),'wppost','post')); + $wp_post = intval(get_pconfig(local_user(),'wppost','post')); $wp_enable = (($wp_post && x($_REQUEST,'wppost_enable')) ? intval($_REQUEST['wppost_enable']) : 0); - if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'wppost','post_by_default'))) { + if ($b['api_source'] && intval(get_pconfig(local_user(),'wppost','post_by_default'))) { $wp_enable = 1; } - if(! $wp_enable) { - return; - } + if (!$wp_enable) { + return; + } - if(strlen($b['postopts'])) { - $b['postopts'] .= ','; - } - $b['postopts'] .= 'wppost'; + if (strlen($b['postopts'])) { + $b['postopts'] .= ','; + } + + $b['postopts'] .= 'wppost'; }