]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - import.php
template pour la config et les outils de poche
[github/wallabag/wallabag.git] / import.php
index 9b42071b9a9138c62d1bf0fdb5da854a8614c357..72e3eac7696974177e765211d3aadfee25c5c282 100644 (file)
@@ -20,7 +20,7 @@ else {
     $html = new simple_html_dom();
     $html->load_file('ril_export.html');
 
-    $read = '0';
+    $read = 0;
     $errors = array();
     foreach($html->find('ul') as $ul)
     {
@@ -30,12 +30,19 @@ else {
             $url = $a[0]->href;
 
 
-            action_to_do('add', $url, $token);
+            action_to_do('add', $url);
+            if ($read == '1') {
+                $last_id = $db->getHandle()->lastInsertId();
+                $sql_update     = "UPDATE entries SET is_read=~is_read WHERE id=?";
+                $params_update  = array($last_id);
+                $query_update   = $db->getHandle()->prepare($sql_update);
+                $query_update->execute($params_update);
+            }
         }
         # Pocket génère un fichier HTML avec deux <ul>
         # Le premier concerne les éléments non lus
         # Le second concerne les éléments archivés
-        $read = '-1';
+        $read = 1;
     }
 
     echo 'Import from Pocket completed. <a href="index.php">Welcome to #poche !</a>';