X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=statusnet%2Fstatusnet.php;h=7e9226a0e55bf512a3ed569fdef11ae627345ec7;hb=d7bd2246c18f5880fc3c083bf3d698fe4f29fcb6;hp=51caba10d74e041e2ec20403ddc036d33701322d;hpb=97cdca14c46fdda12fa56dd16566f7b08745cfb9;p=friendica-addons.git diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php old mode 100644 new mode 100755 index 51caba10..7e9226a0 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -5,7 +5,7 @@ * Author: Tobias Diekershoff */ -/* StatusNet Plugin for Friendika +/* StatusNet Plugin for Friendica * * Author: Tobias Diekershoff * tobias.diekershoff@gmx.net @@ -56,14 +56,13 @@ class StatusNetOAuth extends TwitterOAuth { * * @return API results * - * Copied here from the twitteroauth library and complemented by applying the proxy settings of friendika + * Copied here from the twitteroauth library and complemented by applying the proxy settings of friendica */ function http($url, $method, $postfields = NULL) { $this->http_info = array(); $ci = curl_init(); /* Curl settings */ $prx = get_config('system','proxy'); - logger('Proxy SN: '.$prx); if(strlen($prx)) { curl_setopt($ci, CURLOPT_HTTPPROXYTUNNEL, 1); curl_setopt($ci, CURLOPT_PROXY, $prx); @@ -184,7 +183,7 @@ function statusnet_settings_post ($a,$post) { } } } - goaway($a->get_baseurl().'/settings/addon'); + goaway($a->get_baseurl().'/settings/connectors'); } else { if (isset($_POST['statusnet-consumersecret'])) { // check if we can reach the API of the StatusNet server @@ -211,11 +210,10 @@ function statusnet_settings_post ($a,$post) { notice( t('We could not contact the StatusNet API with the Path you entered.').EOL ); } } - goaway($a->get_baseurl().'/settings/addon'); + goaway($a->get_baseurl().'/settings/connectors'); } else { if (isset($_POST['statusnet-pin'])) { // if the user supplied us with a PIN from Twitter, let the magic of OAuth happen - logger('got a StatusNet security code'); $api = get_pconfig(local_user(), 'statusnet', 'baseapi'); $ckey = get_pconfig(local_user(), 'statusnet', 'consumerkey' ); $csecret = get_pconfig(local_user(), 'statusnet', 'consumersecret' ); @@ -229,7 +227,7 @@ function statusnet_settings_post ($a,$post) { set_pconfig(local_user(),'statusnet', 'oauthsecret', $token['oauth_token_secret']); set_pconfig(local_user(),'statusnet', 'post', 1); // reload the Addon Settings page, if we don't do it see Bug #42 - goaway($a->get_baseurl().'/settings/addon'); + goaway($a->get_baseurl().'/settings/connectors'); } else { // if no PIN is supplied in the POST variables, the user has changed the setting // to post a tweet for every new __public__ posting to the wall @@ -282,7 +280,7 @@ function statusnet_settings(&$a,&$s) { $s .= '
'; } $s .= '

' . t('Provide your own OAuth Credentials') . '

'; - $s .= '

'. t('No consumer key pair for StatusNet found. Register your Friendika Account as an desktop client on your StatusNet account, copy the consumer key pair here and enter the API base root.
Before you register your own OAuth key pair ask the administrator if there is already a key pair for this Friendika installation at your favorited StatusNet installation.') .'

'; + $s .= '

'. t('No consumer key pair for StatusNet found. Register your Friendica Account as an desktop client on your StatusNet account, copy the consumer key pair here and enter the API base root.
Before you register your own OAuth key pair ask the administrator if there is already a key pair for this Friendica installation at your favorited StatusNet installation.') .'

'; $s .= '
'; $s .= ''; $s .= '
'; @@ -362,10 +360,10 @@ function statusnet_post_local(&$a,&$b) { if((local_user()) && (local_user() == $b['uid']) && (! $b['private'])) { $statusnet_post = get_pconfig(local_user(),'statusnet','post'); - $statusnet_enable = (($statusnet_post && x($_POST,'statusnet_enable')) ? intval($_POST['statusnet_enable']) : 0); + $statusnet_enable = (($statusnet_post && x($_REQUEST,'statusnet_enable')) ? intval($_REQUEST['statusnet_enable']) : 0); // if API is used, default to the chosen settings - if($_POST['api_source'] && intval(get_pconfig(local_user(),'statusnet','post_by_default'))) + if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'statusnet','post_by_default'))) $statusnet_enable = 1; if(! $statusnet_enable) @@ -389,9 +387,6 @@ function statusnet_post_hook(&$a,&$b) { if(! strstr($b['postopts'],'statusnet')) return; - logger('StatusNet post invoked'); - - load_pconfig($b['uid'], 'statusnet'); $api = get_pconfig($b['uid'], 'statusnet', 'baseapi'); @@ -408,7 +403,7 @@ function statusnet_post_hook(&$a,&$b) { $msg = strip_tags(bbcode($b['body'])); // quotes not working - let's try this $msg = html_entity_decode($msg); - if ( strlen($msg) > $max_char) { + if (( strlen($msg) > $max_char) && $max_char > 0) { $shortlink = ""; require_once('library/slinky.php'); $slinky = new Slinky( $b['plink'] );