"remote self" should work now with the addons
[friendica-addons.git] / twitter / twitter.php
index 76b92ac811f82733ead1fe7a9efc23ea7d30ccf2..7272957ca6e7294c7612ea0abdfcb0b4e9fe3849 100644 (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']) ) {
+       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);
+       $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 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)
+       if (!$twitter_enable) {
                return;
+       }
 
-       if(strlen($b['postopts']))
+       if (strlen($b['postopts'])) {
                $b['postopts'] .= ',';
-               $b['postopts'] .= 'twitter';
        }
+
+       $b['postopts'] .= 'twitter';
 }
 
 function twitter_action($a, $uid, $pid, $action) {