';
$s .= '';
@@ -439,20 +439,20 @@ function statusnet_action($a, $uid, $pid, $action) {
$connection = new StatusNetOAuth($api,$ckey,$csecret,$otoken,$osecret);
- logger("statusnet_action '".$action."' ID: ".$pid, LOGGER_DATA);
+ logger("statusnet_action '".$action."' ID: ".$pid, LOGGER_DATA);
- switch ($action) {
- case "delete":
- $result = $connection->post("statuses/destroy/".$pid);
- break;
- case "like":
- $result = $connection->post("favorites/create/".$pid);
- break;
- case "unlike":
- $result = $connection->post("favorites/destroy/".$pid);
- break;
- }
- logger("statusnet_action '".$action."' send, result: " . print_r($result, true), LOGGER_DEBUG);
+ switch ($action) {
+ case "delete":
+ $result = $connection->post("statuses/destroy/".$pid);
+ break;
+ case "like":
+ $result = $connection->post("favorites/create/".$pid);
+ break;
+ case "unlike":
+ $result = $connection->post("favorites/destroy/".$pid);
+ break;
+ }
+ logger("statusnet_action '".$action."' send, result: " . print_r($result, true), LOGGER_DEBUG);
}
function statusnet_post_hook(&$a,&$b) {
@@ -510,19 +510,19 @@ function statusnet_post_hook(&$a,&$b) {
}
if (($b['verb'] == ACTIVITY_POST) AND $b['deleted'])
- statusnet_action($a, $b["uid"], substr($orig_post["uri"], $hostlength), "delete");
+ statusnet_action($a, $b["uid"], substr($orig_post["uri"], $hostlength), "delete");
- if($b['verb'] == ACTIVITY_LIKE) {
- logger("statusnet_post_hook: parameter 2 ".substr($b["thr-parent"], $hostlength), LOGGER_DEBUG);
- if ($b['deleted'])
- statusnet_action($a, $b["uid"], substr($b["thr-parent"], $hostlength), "unlike");
- else
- statusnet_action($a, $b["uid"], substr($b["thr-parent"], $hostlength), "like");
- return;
+ if($b['verb'] == ACTIVITY_LIKE) {
+ logger("statusnet_post_hook: parameter 2 ".substr($b["thr-parent"], $hostlength), LOGGER_DEBUG);
+ if ($b['deleted'])
+ statusnet_action($a, $b["uid"], substr($b["thr-parent"], $hostlength), "unlike");
+ else
+ statusnet_action($a, $b["uid"], substr($b["thr-parent"], $hostlength), "like");
+ return;
}
- if($b['deleted'] || ($b['created'] !== $b['edited']))
- return;
+ if($b['deleted'] || ($b['created'] !== $b['edited']))
+ return;
// if posts comes from statusnet don't send it back
if($b['app'] == "StatusNet")
@@ -700,12 +700,12 @@ function statusnet_cron($a,$b) {
}
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'statusnet' AND `k` = 'import' AND `v` = '1' ORDER BY RAND()");
- if(count($r)) {
- foreach($r as $rr) {
- logger('statusnet: importing timeline from user '.$rr['uid']);
- statusnet_fetchhometimeline($a, $rr["uid"]);
- }
- }
+ if(count($r)) {
+ foreach($r as $rr) {
+ logger('statusnet: importing timeline from user '.$rr['uid']);
+ statusnet_fetchhometimeline($a, $rr["uid"]);
+ }
+ }
logger('statusnet: cron_end');
@@ -1429,7 +1429,7 @@ function statusnet_convertmsg($a, $body, $no_tags = false) {
$expanded_url = original_url($match[1]);
$oembed_data = oembed_fetch_url($expanded_url, true);
-print_r($oembed_data);
+
if ($type == "")
$type = $oembed_data->type;
if ($oembed_data->type == "video") {
diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php
old mode 100755
new mode 100644
index 054b53f8..cd9713cf
--- a/tumblr/tumblr.php
+++ b/tumblr/tumblr.php
@@ -12,19 +12,19 @@ require_once('library/OAuth1.php');
require_once('addon/tumblr/tumblroauth/tumblroauth.php');
function tumblr_install() {
- register_hook('post_local', 'addon/tumblr/tumblr.php', 'tumblr_post_local');
- register_hook('notifier_normal', 'addon/tumblr/tumblr.php', 'tumblr_send');
- register_hook('jot_networks', 'addon/tumblr/tumblr.php', 'tumblr_jot_nets');
- register_hook('connector_settings', 'addon/tumblr/tumblr.php', 'tumblr_settings');
- register_hook('connector_settings_post', 'addon/tumblr/tumblr.php', 'tumblr_settings_post');
+ register_hook('post_local', 'addon/tumblr/tumblr.php', 'tumblr_post_local');
+ register_hook('notifier_normal', 'addon/tumblr/tumblr.php', 'tumblr_send');
+ register_hook('jot_networks', 'addon/tumblr/tumblr.php', 'tumblr_jot_nets');
+ register_hook('connector_settings', 'addon/tumblr/tumblr.php', 'tumblr_settings');
+ register_hook('connector_settings_post', 'addon/tumblr/tumblr.php', 'tumblr_settings_post');
}
function tumblr_uninstall() {
- unregister_hook('post_local', 'addon/tumblr/tumblr.php', 'tumblr_post_local');
- unregister_hook('notifier_normal', 'addon/tumblr/tumblr.php', 'tumblr_send');
- unregister_hook('jot_networks', 'addon/tumblr/tumblr.php', 'tumblr_jot_nets');
- unregister_hook('connector_settings', 'addon/tumblr/tumblr.php', 'tumblr_settings');
- unregister_hook('connector_settings_post', 'addon/tumblr/tumblr.php', 'tumblr_settings_post');
+ unregister_hook('post_local', 'addon/tumblr/tumblr.php', 'tumblr_post_local');
+ unregister_hook('notifier_normal', 'addon/tumblr/tumblr.php', 'tumblr_send');
+ unregister_hook('jot_networks', 'addon/tumblr/tumblr.php', 'tumblr_jot_nets');
+ unregister_hook('connector_settings', 'addon/tumblr/tumblr.php', 'tumblr_settings');
+ unregister_hook('connector_settings_post', 'addon/tumblr/tumblr.php', 'tumblr_settings_post');
}
function tumblr_module() {}
@@ -85,22 +85,22 @@ function tumblr_connect($a) {
// Check the HTTP Code. It should be a 200 (OK), if it's anything else then something didn't work.
switch ($tum_oauth->http_code) {
- case 200:
- // Ask Tumblr to give us a special address to their login page
- $url = $tum_oauth->getAuthorizeURL($token);
+ case 200:
+ // Ask Tumblr to give us a special address to their login page
+ $url = $tum_oauth->getAuthorizeURL($token);
- // Redirect the user to the login URL given to us by Tumblr
- header('Location: ' . $url);
+ // Redirect the user to the login URL given to us by Tumblr
+ header('Location: ' . $url);
- // That's it for our side. The user is sent to a Tumblr Login page and
- // asked to authroize our app. After that, Tumblr sends the user back to
- // our Callback URL (callback.php) along with some information we need to get
- // an access token.
+ // That's it for our side. The user is sent to a Tumblr Login page and
+ // asked to authroize our app. After that, Tumblr sends the user back to
+ // our Callback URL (callback.php) along with some information we need to get
+ // an access token.
- break;
- default:
- // Give an error message
- $o = 'Could not connect to Tumblr. Refresh the page or try again later.';
+ break;
+ default:
+ // Give an error message
+ $o = 'Could not connect to Tumblr. Refresh the page or try again later.';
}
return($o);
}
@@ -133,9 +133,9 @@ function tumblr_callback($a) {
// Make sure nothing went wrong.
if (200 == $tum_oauth->http_code) {
- // good to go
+ // good to go
} else {
- return('Unable to authenticate');
+ return('Unable to authenticate');
}
// What's next? Now that we have an Access Token and Secret, we can make an API call.
@@ -148,96 +148,96 @@ function tumblr_callback($a) {
}
function tumblr_jot_nets(&$a,&$b) {
- if(! local_user())
- return;
+ if(! local_user())
+ return;
- $tmbl_post = get_pconfig(local_user(),'tumblr','post');
- if(intval($tmbl_post) == 1) {
- $tmbl_defpost = get_pconfig(local_user(),'tumblr','post_by_default');
- $selected = ((intval($tmbl_defpost) == 1) ? ' checked="checked" ' : '');
- $b .= '
';
+ $s .= "";
+ } else
+ $s .= t("You are not authenticated to tumblr");
+ $s .= '
';
- /* provide a submit button */
+ /* provide a submit button */
- $s .= '
';
+ $s .= '
';
}
@@ -267,19 +267,19 @@ function tumblr_post_local(&$a,&$b) {
if($b['private'] || $b['parent'])
return;
- $tmbl_post = intval(get_pconfig(local_user(),'tumblr','post'));
+ $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')))
$tmbl_enable = 1;
- if(! $tmbl_enable)
- return;
+ if(! $tmbl_enable)
+ return;
- if(strlen($b['postopts']))
- $b['postopts'] .= ',';
- $b['postopts'] .= 'tumblr';
+ if(strlen($b['postopts']))
+ $b['postopts'] .= ',';
+ $b['postopts'] .= 'tumblr';
}
@@ -287,14 +287,14 @@ function tumblr_post_local(&$a,&$b) {
function tumblr_send(&$a,&$b) {
- if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
- return;
+ if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
+ return;
- if(! strstr($b['postopts'],'tumblr'))
- return;
+ if(! strstr($b['postopts'],'tumblr'))
+ return;
- if($b['parent'] != $b['id'])
- return;
+ if($b['parent'] != $b['id'])
+ return;
$oauth_token = get_pconfig($b['uid'], "tumblr", "oauth_token");
$oauth_token_secret = get_pconfig($b['uid'], "tumblr", "oauth_token_secret");
diff --git a/twitter/twitter.php b/twitter/twitter.php
old mode 100755
new mode 100644
index 16debcb7..7c167459
--- a/twitter/twitter.php
+++ b/twitter/twitter.php
@@ -161,10 +161,10 @@ function twitter_settings_post ($a,$post) {
*/
del_pconfig(local_user(), 'twitter', 'consumerkey');
del_pconfig(local_user(), 'twitter', 'consumersecret');
- del_pconfig(local_user(), 'twitter', 'oauthtoken');
- del_pconfig(local_user(), 'twitter', 'oauthsecret');
- del_pconfig(local_user(), 'twitter', 'post');
- del_pconfig(local_user(), 'twitter', 'post_by_default');
+ del_pconfig(local_user(), 'twitter', 'oauthtoken');
+ del_pconfig(local_user(), 'twitter', 'oauthsecret');
+ del_pconfig(local_user(), 'twitter', 'post');
+ del_pconfig(local_user(), 'twitter', 'post_by_default');
del_pconfig(local_user(), 'twitter', 'lastid');
del_pconfig(local_user(), 'twitter', 'mirror_posts');
del_pconfig(local_user(), 'twitter', 'import');
@@ -183,30 +183,30 @@ function twitter_settings_post ($a,$post) {
$connection = new TwitterOAuth($ckey, $csecret, $_POST['twitter-token'], $_POST['twitter-token2']);
$token = $connection->getAccessToken( $_POST['twitter-pin'] );
// ok, now that we have the Access Token, save them in the user config
- set_pconfig(local_user(),'twitter', 'oauthtoken', $token['oauth_token']);
+ set_pconfig(local_user(),'twitter', 'oauthtoken', $token['oauth_token']);
set_pconfig(local_user(),'twitter', 'oauthsecret', $token['oauth_token_secret']);
- set_pconfig(local_user(),'twitter', 'post', 1);
- // reload the Addon Settings page, if we don't do it see Bug #42
- goaway($a->get_baseurl().'/settings/connectors');
+ set_pconfig(local_user(),'twitter', 'post', 1);
+ // reload the Addon Settings page, if we don't do it see Bug #42
+ 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
set_pconfig(local_user(),'twitter','post',intval($_POST['twitter-enable']));
- set_pconfig(local_user(),'twitter','post_by_default',intval($_POST['twitter-default']));
+ set_pconfig(local_user(),'twitter','post_by_default',intval($_POST['twitter-default']));
set_pconfig(local_user(), 'twitter', 'mirror_posts', intval($_POST['twitter-mirror']));
set_pconfig(local_user(), 'twitter', 'import', intval($_POST['twitter-import']));
set_pconfig(local_user(), 'twitter', 'create_user', intval($_POST['twitter-create_user']));
- if (!intval($_POST['twitter-mirror']))
- del_pconfig(local_user(),'twitter','lastid');
+ if (!intval($_POST['twitter-mirror']))
+ del_pconfig(local_user(),'twitter','lastid');
- info(t('Twitter settings updated.') . EOL);
+ info(t('Twitter settings updated.') . EOL);
}}
}
function twitter_settings(&$a,&$s) {
- if(! local_user())
- return;
- $a->page['htmlhead'] .= '' . "\r\n";
+ if(! local_user())
+ return;
+ $a->page['htmlhead'] .= '' . "\r\n";
/***
* 1) Check that we have global consumer key & secret
* 2) If no OAuthtoken & stuff is present, generate button to get some
@@ -216,16 +216,16 @@ function twitter_settings(&$a,&$s) {
$csecret = get_config('twitter', 'consumersecret' );
$otoken = get_pconfig(local_user(), 'twitter', 'oauthtoken' );
$osecret = get_pconfig(local_user(), 'twitter', 'oauthsecret' );
- $enabled = get_pconfig(local_user(), 'twitter', 'post');
+ $enabled = get_pconfig(local_user(), 'twitter', 'post');
$checked = (($enabled) ? ' checked="checked" ' : '');
- $defenabled = get_pconfig(local_user(),'twitter','post_by_default');
+ $defenabled = get_pconfig(local_user(),'twitter','post_by_default');
$defchecked = (($defenabled) ? ' checked="checked" ' : '');
- $mirrorenabled = get_pconfig(local_user(),'twitter','mirror_posts');
- $mirrorchecked = (($mirrorenabled) ? ' checked="checked" ' : '');
- $importenabled = get_pconfig(local_user(),'twitter','import');
- $importchecked = (($importenabled) ? ' checked="checked" ' : '');
- $create_userenabled = get_pconfig(local_user(),'twitter','create_user');
- $create_userchecked = (($create_userenabled) ? ' checked="checked" ' : '');
+ $mirrorenabled = get_pconfig(local_user(),'twitter','mirror_posts');
+ $mirrorchecked = (($mirrorenabled) ? ' checked="checked" ' : '');
+ $importenabled = get_pconfig(local_user(),'twitter','import');
+ $importchecked = (($importenabled) ? ' checked="checked" ' : '');
+ $create_userenabled = get_pconfig(local_user(),'twitter','create_user');
+ $create_userchecked = (($create_userenabled) ? ' checked="checked" ' : '');
$css = (($enabled) ? '' : '-disabled');
@@ -254,7 +254,7 @@ function twitter_settings(&$a,&$s) {
* which the user can request a PIN to connect the account to a
* account at Twitter.
*/
- require_once('library/twitteroauth.php');
+ require_once('library/twitteroauth.php');
$connection = new TwitterOAuth($ckey, $csecret);
$request_token = $connection->getRequestToken();
$token = $request_token['oauth_token'];
@@ -268,50 +268,50 @@ function twitter_settings(&$a,&$s) {
$s .= '';
$s .= '';
$s .= '';
- $s .= '
';
- $s .= '';
+ $s .= '';
+ $s .= '';
} else {
/***
* we have an OAuth key / secret pair for the user
* so let's give a chance to disable the postings to Twitter
*/
- require_once('library/twitteroauth.php');
+ require_once('library/twitteroauth.php');
$connection = new TwitterOAuth($ckey,$csecret,$otoken,$osecret);
$details = $connection->get('account/verify_credentials');
$s .= '
'. t('If enabled all your public postings can be posted to the associated Twitter account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.') .'
';
- if ($a->user['hidewall']) {
- $s .= '
'. t('Note: Due your privacy settings (Hide your profile details from unknown viewers?) the link potentially included in public postings relayed to Twitter will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') .'
';
- }
+ if ($a->user['hidewall']) {
+ $s .= '
'. t('Note: Due your privacy settings (Hide your profile details from unknown viewers?) the link potentially included in public postings relayed to Twitter will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') .'