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

View File

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

View File

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

View File

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

View File

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

View File

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

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

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