]> git.mxchange.org Git - friendica.git/commitdiff
facebook connector - initial checkin (untested)
authorFriendika <info@friendika.com>
Sat, 18 Dec 2010 06:36:35 +0000 (22:36 -0800)
committerFriendika <info@friendika.com>
Sat, 18 Dec 2010 06:36:35 +0000 (22:36 -0800)
mod/item.php

index ea88e6c311009d8b7c164b1276fe0b4eebf560fd..99721794a1a3b0e6ee4bcca58fdf3c8fb55d0e8e 100644 (file)
@@ -323,10 +323,42 @@ function item_post(&$a) {
        proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" &",
                array(),$foo));
 
+       /**
+        * Post to Facebook stream
+        */
+
+       if((local_user()) && (local_user() == $profile_uid)) {
+               $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($body), 'cb' => ''));
+                               } 
+                               catch (FacebookApiException $e) {
+                                       notice( t('Facebook status update failed.') . EOL);
+                               }
+                       }
+               }
+       }
+
        goaway($a->get_baseurl() . "/" . $_POST['return'] );
        return; // NOTREACHED
 }
 
+
+
+
+
 function item_content(&$a) {
 
        if((! local_user()) && (! remote_user()))