]> git.mxchange.org Git - friendica-addons.git/commitdiff
checking if a variable is an array before doing array_reverse.
authorMichael Vogel <icarus@dabo.de>
Wed, 20 Feb 2013 20:46:19 +0000 (21:46 +0100)
committerMichael Vogel <icarus@dabo.de>
Wed, 20 Feb 2013 20:46:19 +0000 (21:46 +0100)
fbpost/fbpost.php
fromgplus/fromgplus.php
statusnet/statusnet.php
twitter/twitter.php

index 4270816402e37fc1559a5d73b8c9f251a923550d..ba60f4e64bdca3b6eb7c62ddbec399f340f7e2af 100644 (file)
@@ -1027,6 +1027,10 @@ function fbpost_fetchwall($a, $uid) {
 
        $feed = fetch_url($url);
        $data = json_decode($feed);
+
+       if (!is_array($data->data))
+               return;
+
        $items = array_reverse($data->data);
 
        foreach ($items as $item) {
index f7841300f3531d5a3f7bd5d15082eaf59b932229..5bd82ed86855cd0c205cfbd7c50c502465520254 100644 (file)
@@ -275,6 +275,9 @@ function fromgplus_handleattachments($item) {
                                        $post .= "\n[url=".$thumb->url."][img]".$image."[/img][/url]\n";
                                }
                                break;
+                       case "audio":
+                               $post .= "\n\n[bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n";
+                               break;
                        //default:
                        //      die($attachment->objectType);
                }
@@ -298,6 +301,9 @@ function fromgplus_fetch($a, $uid) {
 
        $lastdate = 0;
 
+       if (!is_array($activities->items))
+               return;
+
        $reversed = array_reverse($activities->items);
 
        foreach($reversed as $item) {
index 393bbfe53fba58e2286e3d4c5962650cfea88e7f..0ffbae6b1cf3b2dbdf4fcaba4b51a89269ed03de 100755 (executable)
@@ -806,6 +806,10 @@ function statusnet_fetchtimeline($a, $uid) {
                $parameters["since_id"] = $lastid;
 
        $items = $connection->get('statuses/user_timeline', $parameters);
+
+       if (!is_array($items))
+               return;
+
        $posts = array_reverse($items);
 
         if (count($posts)) {
index 808768f8305bbefccfcf8b9750e935c582ca5b6a..e4848f9db8122cb63f0878477c55246c340da945 100755 (executable)
@@ -613,6 +613,10 @@ function twitter_fetchtimeline($a, $uid) {
                $parameters["since_id"] = $lastid;
 
        $items = $connection->get('statuses/user_timeline', $parameters);
+
+       if (!is_array($items))
+               return;
+
        $posts = array_reverse($items);
 
         if (count($posts)) {