From d06f30ef931402a1e56aab841ce852b3b81a9697 Mon Sep 17 00:00:00 2001 From: nicosomb Date: Thu, 18 Apr 2013 10:15:46 +0200 Subject: [PATCH] =?UTF-8?q?Fixed=20#54=20-=20r=C3=A9cup=C3=A9ration=20de?= =?UTF-8?q?=20l'id=20am=C3=A9lior=C3=A9e=20et=20utilisation=20de=20action?= =?UTF-8?q?=5Fto=5Fdo()=20pour=20l'insertion=20dans=20l'import=20pocket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- import.php | 20 +------------------- inc/config.php | 3 ++- inc/functions.php | 30 +++++++++++++++++------------- 3 files changed, 20 insertions(+), 33 deletions(-) diff --git a/import.php b/import.php index 497e32f..9b42071 100644 --- a/import.php +++ b/import.php @@ -29,26 +29,8 @@ else { $a = $li->find('a'); $url = $a[0]->href; - # FIXME corriger cette génération d'ID - $req = $db->getHandle()->query("SELECT id FROM entries ORDER BY id DESC"); - $id = $req->fetchColumn()+1; - $parametres_url = prepare_url($url, $id); - $sql_action = 'INSERT INTO entries ( url, title, content, is_read ) VALUES (?, ?, ?, ?)'; - $params_action = array($url, $parametres_url['title'], $parametres_url['content'], $read); - try - { - # action query - if (isset($sql_action)) - { - $query = $db->getHandle()->prepare($sql_action); - $query->execute($params_action); - } - } - catch (Exception $e) - { - logm('error during pocket import : ' . $e->getMessage()); - } + action_to_do('add', $url, $token); } # Pocket génère un fichier HTML avec deux