X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=import.php;h=72e3eac7696974177e765211d3aadfee25c5c282;hb=85ebc80c7eaf88e4d57a52adb8e4c32d8cc34b64;hp=97072437cbeff601a57b9dbda7c16639d5ee5a6e;hpb=713b2d69910c1221bc86992ca08d6036d2e71bb6;p=github%2Fwallabag%2Fwallabag.git diff --git a/import.php b/import.php index 97072437..72e3eac7 100644 --- a/import.php +++ b/import.php @@ -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) { @@ -28,27 +28,21 @@ else { { $a = $li->find('a'); $url = $a[0]->href; - $parametres_url = prepare_url($url); - $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); + 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