move facebook post to addon - and under the AGPL
This commit is contained in:
parent
bdc4cd63e1
commit
caf93fffac
4 changed files with 720 additions and 26 deletions
29
mod/item.php
29
mod/item.php
|
@ -377,33 +377,10 @@ function item_post(&$a) {
|
|||
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" &",
|
||||
array(),$foo));
|
||||
|
||||
/**
|
||||
* Post to Facebook stream
|
||||
*/
|
||||
$datarray['id'] = $post_id;
|
||||
|
||||
if((local_user()) && (local_user() == $profile_uid) && (! $private)) {
|
||||
$appid = get_config('system', 'facebook_appid' );
|
||||
$secret = get_config('system', 'facebook_secret' );
|
||||
if($appid && $secret) {
|
||||
$fb_post = get_pconfig($local_user(),'facebook','post');
|
||||
if($fb_post) {
|
||||
require_once('library/facebook.php');
|
||||
require_once('include/bbcode.php');
|
||||
|
||||
$facebook = new Facebook(array(
|
||||
'appId' => $appid,
|
||||
'secret' => $secret,
|
||||
'cookie' => true
|
||||
));
|
||||
try {
|
||||
$statusUpdate = $facebook->api('/me/feed', 'post', array('message'=> bbcode($datarray['body']), 'cb' => ''));
|
||||
}
|
||||
catch (FacebookApiException $e) {
|
||||
notice( t('Facebook status update failed.') . EOL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
call_hooks('post_local_end', $datarray);
|
||||
|
||||
|
||||
goaway($a->get_baseurl() . "/" . $_POST['return'] );
|
||||
return; // NOTREACHED
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue