forked from friendica/friendica-addons
Merge pull request #153 from annando/master
small changes to pumpio, libertree, blogger and statusnet
This commit is contained in:
commit
f96d9473c1
|
@ -1,11 +1,11 @@
|
||||||
|
|
||||||
#blogger-enable-label, #blogger-username-label, #blogger-password-label, #blogger-bydefault-label {
|
#blogger-enable-label, #blogger-username-label, #blogger-password-label, #blogger-bydefault-label, #blogger-blog-label {
|
||||||
float: left;
|
float: left;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#blogger-checkbox, #blogger-username, #blogger-password, #blogger-bydefault {
|
#blogger-checkbox, #blogger-username, #blogger-password, #blogger-bydefault, #blogger-blog {
|
||||||
float: left;
|
float: left;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,8 +153,11 @@ function libertree_send(&$a,&$b) {
|
||||||
$ltree_api_token = get_pconfig($b['uid'],'libertree','libertree_api_token');
|
$ltree_api_token = get_pconfig($b['uid'],'libertree','libertree_api_token');
|
||||||
$ltree_url = get_pconfig($b['uid'],'libertree','libertree_url');
|
$ltree_url = get_pconfig($b['uid'],'libertree','libertree_url');
|
||||||
$ltree_blog = "$ltree_url/api/v1/posts/create/?token=$ltree_api_token";
|
$ltree_blog = "$ltree_url/api/v1/posts/create/?token=$ltree_api_token";
|
||||||
|
if (isset($a->config['sitename']) AND ($a->config['sitename'] != ""))
|
||||||
|
$ltree_source = $a->config['sitename'];
|
||||||
|
else
|
||||||
$ltree_source = "Friendica";
|
$ltree_source = "Friendica";
|
||||||
//$ltree_source = "[".$a->config['sitename']."](".$a->get_baseurl().")";
|
|
||||||
if($ltree_url && $ltree_api_token && $ltree_blog && $ltree_source) {
|
if($ltree_url && $ltree_api_token && $ltree_blog && $ltree_source) {
|
||||||
|
|
||||||
require_once('include/bb2diaspora.php');
|
require_once('include/bb2diaspora.php');
|
||||||
|
|
|
@ -77,6 +77,8 @@ function pumpio_registerclient(&$a, $host) {
|
||||||
$params["logo_url"] = $a->get_baseurl()."/images/friendica-256.png";
|
$params["logo_url"] = $a->get_baseurl()."/images/friendica-256.png";
|
||||||
$params["redirect_uris"] = $a->get_baseurl()."/pumpio/connect";
|
$params["redirect_uris"] = $a->get_baseurl()."/pumpio/connect";
|
||||||
|
|
||||||
|
logger("pumpio_registerclient: ".$url." parameters ".print_r($params, true), LOGGER_DEBUG);
|
||||||
|
|
||||||
$ch = curl_init($url);
|
$ch = curl_init($url);
|
||||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
|
||||||
|
@ -89,9 +91,12 @@ function pumpio_registerclient(&$a, $host) {
|
||||||
|
|
||||||
if ($curl_info["http_code"] == "200") {
|
if ($curl_info["http_code"] == "200") {
|
||||||
$values = json_decode($s);
|
$values = json_decode($s);
|
||||||
|
logger("pumpio_registerclient: success ".print_r($values, true), LOGGER_DEBUG);
|
||||||
return($values);
|
return($values);
|
||||||
}
|
}
|
||||||
|
logger("pumpio_registerclient: failed: ".print_r($curl_info, true), LOGGER_DEBUG);
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function pumpio_connect(&$a) {
|
function pumpio_connect(&$a) {
|
||||||
|
@ -112,7 +117,7 @@ function pumpio_connect(&$a) {
|
||||||
$consumer_key = get_pconfig(local_user(), 'pumpio','consumer_key');
|
$consumer_key = get_pconfig(local_user(), 'pumpio','consumer_key');
|
||||||
$consumer_secret = get_pconfig(local_user(), 'pumpio','consumer_secret');
|
$consumer_secret = get_pconfig(local_user(), 'pumpio','consumer_secret');
|
||||||
|
|
||||||
logger("pumpio_connect: ckey: ".$consumer_key." csecrect: ".$consumer_secret);
|
logger("pumpio_connect: ckey: ".$consumer_key." csecrect: ".$consumer_secret, LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($consumer_key == "") OR ($consumer_secret == "")) {
|
if (($consumer_key == "") OR ($consumer_secret == "")) {
|
||||||
|
@ -146,7 +151,7 @@ function pumpio_connect(&$a) {
|
||||||
if (($success = $client->Initialize())) {
|
if (($success = $client->Initialize())) {
|
||||||
if (($success = $client->Process())) {
|
if (($success = $client->Process())) {
|
||||||
if (strlen($client->access_token)) {
|
if (strlen($client->access_token)) {
|
||||||
logger("pumpio_connect: otoken: ".$client->access_token." osecrect: ".$client->access_token_secret);
|
logger("pumpio_connect: otoken: ".$client->access_token." osecrect: ".$client->access_token_secret, LOGGER_DEBUG);
|
||||||
set_pconfig(local_user(), "pumpio", "oauth_token", $client->access_token);
|
set_pconfig(local_user(), "pumpio", "oauth_token", $client->access_token);
|
||||||
set_pconfig(local_user(), "pumpio", "oauth_token_secret", $client->access_token_secret);
|
set_pconfig(local_user(), "pumpio", "oauth_token_secret", $client->access_token_secret);
|
||||||
}
|
}
|
||||||
|
@ -157,10 +162,13 @@ function pumpio_connect(&$a) {
|
||||||
$o = 'Could not connect to pumpio. Refresh the page or try again later.';
|
$o = 'Could not connect to pumpio. Refresh the page or try again later.';
|
||||||
|
|
||||||
if($success) {
|
if($success) {
|
||||||
|
logger("pumpio_connect: authenticated");
|
||||||
$o .= t("You are now authenticated to pumpio.");
|
$o .= t("You are now authenticated to pumpio.");
|
||||||
$o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.t("return to the connector page").'</a>';
|
$o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.t("return to the connector page").'</a>';
|
||||||
} else
|
} else {
|
||||||
|
logger("pumpio_connect: could not connect");
|
||||||
$o = 'Could not connect to pumpio. Refresh the page or try again later.';
|
$o = 'Could not connect to pumpio. Refresh the page or try again later.';
|
||||||
|
}
|
||||||
|
|
||||||
return($o);
|
return($o);
|
||||||
}
|
}
|
||||||
|
@ -308,6 +316,8 @@ function pumpio_settings_post(&$a,&$b) {
|
||||||
set_pconfig(local_user(),'pumpio','public',$_POST['pumpio_public']);
|
set_pconfig(local_user(),'pumpio','public',$_POST['pumpio_public']);
|
||||||
set_pconfig(local_user(),'pumpio','mirror',$_POST['pumpio_mirror']);
|
set_pconfig(local_user(),'pumpio','mirror',$_POST['pumpio_mirror']);
|
||||||
set_pconfig(local_user(),'pumpio','post_by_default',intval($_POST['pumpio_bydefault']));
|
set_pconfig(local_user(),'pumpio','post_by_default',intval($_POST['pumpio_bydefault']));
|
||||||
|
|
||||||
|
header("Location: ".$a->get_baseurl()."/pumpio/connect");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,7 +353,7 @@ function pumpio_send(&$a,&$b) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger("pumpio_send: parameter ".print_r($b, true));
|
logger("pumpio_send: parameter ".print_r($b, true), LOGGER_DATA);
|
||||||
|
|
||||||
if($b['parent'] != $b['id']) {
|
if($b['parent'] != $b['id']) {
|
||||||
// Looking if its a reply to a pumpio post
|
// Looking if its a reply to a pumpio post
|
||||||
|
|
|
@ -313,11 +313,12 @@ function statusnet_settings(&$a,&$s) {
|
||||||
$s .= '<div class="clear"></div>';
|
$s .= '<div class="clear"></div>';
|
||||||
$s .= '<label id="statusnet-baseapi-label" for="statusnet-baseapi">'. t("Base API Path \x28remember the trailing /\x29") .'</label>';
|
$s .= '<label id="statusnet-baseapi-label" for="statusnet-baseapi">'. t("Base API Path \x28remember the trailing /\x29") .'</label>';
|
||||||
$s .= '<input id="statusnet-baseapi" type="text" name="statusnet-baseapi" size="35" /><br />';
|
$s .= '<input id="statusnet-baseapi" type="text" name="statusnet-baseapi" size="35" /><br />';
|
||||||
$s .= '<p></p><div class="clear"></div></div>';
|
$s .= '<div class="clear"></div>';
|
||||||
$s .= '<label id="statusnet-applicationname-label" for="statusnet-applicationname">'.t('StatusNet application name').'</label>';
|
$s .= '<label id="statusnet-applicationname-label" for="statusnet-applicationname">'.t('StatusNet application name').'</label>';
|
||||||
$s .= '<input id="statusnet-applicationname" type="text" name="statusnet-applicationname" size="35" /><br />';
|
$s .= '<input id="statusnet-applicationname" type="text" name="statusnet-applicationname" size="35" /><br />';
|
||||||
$s .= '<p></p><div class="clear"></div></div>';
|
$s .= '<p></p><div class="clear"></div>';
|
||||||
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
|
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
|
||||||
|
$s .= '</div>';
|
||||||
} else {
|
} else {
|
||||||
/***
|
/***
|
||||||
* ok we have a consumer key pair now look into the OAuth stuff
|
* ok we have a consumer key pair now look into the OAuth stuff
|
||||||
|
|
Loading…
Reference in a new issue