]> git.mxchange.org Git - friendica-addons.git/blobdiff - pumpio/pumpio.php
pumpio: PHP fixes for 5.4 not warn all time
[friendica-addons.git] / pumpio / pumpio.php
index 0cea10811212c99cf07fb9fdf2c939797f294b1d..63f403c276d842e3622e57170bf03b52a90647da 100755 (executable)
@@ -163,9 +163,6 @@ function pumpio_connect(&$a) {
 
         if($success) {
                logger("pumpio_connect: authenticated");
-
-               header("Location: ".$a->get_baseurl()."/settings/connectors");
-
                $o .= t("You are now authenticated to pumpio.");
                $o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.t("return to the connector page").'</a>';
        } else {
@@ -1083,14 +1080,17 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
                        }
                }
 
+               $reply = new stdClass;
                $reply->verb = "note";
                $reply->cc = $post->cc;
                $reply->to = $post->to;
+               $reply->object = new stdClass;
                $reply->object->objectType = $post->object->inReplyTo->objectType;
                $reply->object->content = $post->object->inReplyTo->content;
                $reply->object->id = $post->object->inReplyTo->id;
                $reply->actor = $post->object->inReplyTo->author;
                $reply->url = $post->object->inReplyTo->url;
+               $reply->generator = new stdClass;
                $reply->generator->displayName = "pumpio";
                $reply->published = $post->object->inReplyTo->published;
                $reply->received = $post->object->inReplyTo->updated;
@@ -1243,13 +1243,16 @@ function pumpio_fetchinbox(&$a, $uid) {
                $url .= '?since='.urlencode($last_id);
 
         $success = $client->CallAPI($url, 'GET', array(), array('FailOnAccessError'=>true), $user);
-        $posts = array_reverse($user->items);
 
-       if (count($posts))
-               foreach ($posts as $post) {
-                       $last_id = $post->id;
-                       pumpio_dopost($a, $client, $uid, $self, $post, $own_id);
-               }
+       if ($user->items) {
+           $posts = array_reverse($user->items);
+
+           if (count($posts))
+                   foreach ($posts as $post) {
+                           $last_id = $post->id;
+                           pumpio_dopost($a, $client, $uid, $self, $post, $own_id);
+                   }
+       }
 
        set_pconfig($uid,'pumpio','last_id', $last_id);
 }