]> git.mxchange.org Git - friendica-addons.git/blobdiff - statusnet/statusnet.php
Use User::authenticate in addons
[friendica-addons.git] / statusnet / statusnet.php
index bc0f314377a6a345f2a337b1c7bb71ef0d1ea8dc..3c6ac4995cad988726636829fed15d99f0583495 100644 (file)
@@ -48,7 +48,8 @@ require_once 'include/enotify.php';
 
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
-use Friendica\Model\GContact;
+use Friendica\Model\GlobalContact;
+use Friendica\Object\Photo;
 
 class StatusNetOAuth extends TwitterOAuth {
     function get_maxlength() {
@@ -541,6 +542,13 @@ function statusnet_post_hook(&$a,&$b) {
 
                if($b['private'] || !strstr($b['postopts'],'statusnet'))
                        return;
+
+               // Dont't post if the post doesn't belong to us.
+               // This is a check for forum postings
+               $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1));
+               if ($b['contact-id'] != $self['id']) {
+                       return;
+               }
        }
 
        if (($b['verb'] == ACTIVITY_POST) && $b['deleted'])
@@ -929,7 +937,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
        if ($contact->statusnet_profile_url == "")
                return(-1);
 
-       GContact::update(array("url" => $contact->statusnet_profile_url,
+       GlobalContact::update(array("url" => $contact->statusnet_profile_url,
                        "network" => NETWORK_STATUSNET, "photo" => $contact->profile_image_url,
                        "name" => $contact->name, "nick" => $contact->screen_name,
                        "location" => $contact->location, "about" => $contact->description,
@@ -992,7 +1000,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
 
                require_once("Photo.php");
 
-               $photos = import_profile_photo($contact->profile_image_url,$uid,$contact_id);
+               $photos = Photo::importProfilePhoto($contact->profile_image_url,$uid,$contact_id);
 
                q("UPDATE `contact` SET `photo` = '%s',
                                        `thumb` = '%s',
@@ -1019,7 +1027,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
 
                        require_once("Photo.php");
 
-                       $photos = import_profile_photo($contact->profile_image_url, $uid, $r[0]['id']);
+                       $photos = Photo::importProfilePhoto($contact->profile_image_url, $uid, $r[0]['id']);
 
                        q("UPDATE `contact` SET `photo` = '%s',
                                                `thumb` = '%s',