Merge pull request #423 from annando/api-source

"remote self" should work now with the addons
This commit is contained in:
Tobias Diekershoff 2017-09-06 19:40:26 +02:00 committed by GitHub
commit a5e7a651c8
11 changed files with 129 additions and 87 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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';
}

View file

@ -233,27 +233,34 @@ 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)
if (!$diaspora_enable) {
return;
}
if(strlen($b['postopts']))
if (strlen($b['postopts'])) {
$b['postopts'] .= ',';
}
$b['postopts'] .= 'diaspora';
}

View file

@ -115,27 +115,34 @@ 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)
if (!$ltree_enable) {
return;
}
if(strlen($b['postopts']))
if (strlen($b['postopts'])) {
$b['postopts'] .= ',';
}
$b['postopts'] .= 'libertree';
}

View file

@ -351,21 +351,25 @@ function pumpio_settings_post(&$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_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';
}

View file

@ -429,25 +429,31 @@ function statusnet_settings(&$a,&$s) {
function statusnet_post_local(&$a, &$b) {
if($b['edit'])
if ($b['edit']) {
return;
}
if((local_user()) && (local_user() == $b['uid']) && (! $b['private'])) {
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($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'statusnet','post_by_default')))
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';
}
if (!$statusnet_enable) {
return;
}
if (strlen($b['postopts'])) {
$b['postopts'] .= ',';
}
$b['postopts'] .= 'statusnet';
}
function statusnet_action($a, $uid, $pid, $action) {

View file

@ -277,27 +277,34 @@ 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';
}

View file

@ -336,25 +336,31 @@ function twitter_settings(&$a,&$s) {
function twitter_post_local(&$a, &$b) {
if($b['edit'])
if ($b['edit']) {
return;
}
if((local_user()) && (local_user() == $b['uid']) && (! $b['private']) && (! $b['parent']) ) {
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($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'twitter','post_by_default')))
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';
}
if (!$twitter_enable) {
return;
}
if (strlen($b['postopts'])) {
$b['postopts'] .= ',';
}
$b['postopts'] .= 'twitter';
}
function twitter_action($a, $uid, $pid, $action) {

View file

@ -1,7 +1,7 @@
<?php
/*
* Name: Unicode Smilies
* Description: Smilies based on the unicode emojis
* Description: Smilies based on the unicode emojis - On Linux use https://github.com/eosrei/emojione-color-font to see them in color
* Version: 1.0
* Author: Michael Vogel <http://pirati.ca/profile/heluecht>
*/

View file

@ -157,7 +157,7 @@ function wppost_post_local(&$a,&$b) {
return;
}
if((! local_user()) || (local_user() != $b['uid'])) {
if (!local_user() || (local_user() != $b['uid'])) {
return;
}
@ -169,7 +169,7 @@ function wppost_post_local(&$a,&$b) {
$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;
}
@ -180,6 +180,7 @@ function wppost_post_local(&$a,&$b) {
if (strlen($b['postopts'])) {
$b['postopts'] .= ',';
}
$b['postopts'] .= 'wppost';
}