]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge branch 'dev' of https://github.com/inthepoche/poche into dev
authorNicolas Lœuillet <nicolas.loeuillet@gmail.com>
Fri, 3 Jan 2014 14:18:32 +0000 (15:18 +0100)
committerNicolas Lœuillet <nicolas.loeuillet@gmail.com>
Fri, 3 Jan 2014 14:18:32 +0000 (15:18 +0100)
inc/poche/Poche.class.php

index d3eb71d2f6c55879624178ab2b84c02a2b9a3108..e9ff7b46ca0b59426e2fd29e9295cdc80d8d3262 100644 (file)
@@ -806,34 +806,37 @@ class Poche
             $url = NULL;
             $favorite = FALSE;
             $archive = FALSE;
-            foreach ($value as $attr => $attr_value) {
-                if ($attr == 'article__url') {
-                    $url = new Url(base64_encode($attr_value));
-                }
-                $sequence = '';
-                if (STORAGE == 'postgres') {
-                    $sequence = 'entries_id_seq';
-                }
-                if ($attr_value == 'true') {
-                    if ($attr == 'favorite') {
-                        $favorite = TRUE;
+            foreach ($value as $item) {
+                foreach ($item as $attr => $value) {
+                    if ($attr == 'article__url') {
+                        $url = new Url(base64_encode($value));
                     }
-                    if ($attr == 'archive') {
-                        $archive = TRUE;
+                    $sequence = '';
+                    if (STORAGE == 'postgres') {
+                        $sequence = 'entries_id_seq';
+                    }
+                    if ($value == 'true') {
+                        if ($attr == 'favorite') {
+                            $favorite = TRUE;
+                        }
+                        if ($attr == 'archive') {
+                            $archive = TRUE;
+                        }
                     }
                 }
-            }
-            # we can add the url
-            if (!is_null($url) && $url->isCorrect()) {
-                $this->action('add', $url, 0, TRUE);
-                $count++;
-                if ($favorite) {
-                    $last_id = $this->store->getLastId($sequence);
-                    $this->action('toggle_fav', $url, $last_id, TRUE);
-                }
-                if ($archive) {
-                    $last_id = $this->store->getLastId($sequence);
-                    $this->action('toggle_archive', $url, $last_id, TRUE);
+
+                # we can add the url
+                if (!is_null($url) && $url->isCorrect()) {
+                    $this->action('add', $url, 0, TRUE);
+                    $count++;
+                    if ($favorite) {
+                        $last_id = $this->store->getLastId($sequence);
+                        $this->action('toggle_fav', $url, $last_id, TRUE);
+                    }
+                    if ($archive) {
+                        $last_id = $this->store->getLastId($sequence);
+                        $this->action('toggle_archive', $url, $last_id, TRUE);
+                    }
                 }
             }
         }