From 02ea9f07691adf79f3f9d6cddfb1e045777927b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 1 Aug 2013 18:34:50 +0200 Subject: first test for readability import --- import.php | 77 ++++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 25 deletions(-) (limited to 'import.php') diff --git a/import.php b/import.php index 72e3eac7..c1ebdf49 100644 --- a/import.php +++ b/import.php @@ -14,37 +14,64 @@ include dirname(__FILE__).'/inc/config.php'; include dirname(__FILE__).'/inc/simple_html_dom.php'; if (!isset($_GET['start'])) { - echo 'Please execute the import script locally, it can take a very long time.
Bye bye Pocket, let\'s go !'; + echo ' + Please execute the import script locally, it can take a very long time.

+ Please choose between Pocket & Readabilty : +
Bye bye Pocket, let\'s go ! +
Bye bye Readability, let\'s go !'; } else { - $html = new simple_html_dom(); - $html->load_file('ril_export.html'); - - $read = 0; - $errors = array(); - foreach($html->find('ul') as $ul) - { - foreach($ul->find('li') as $li) - { - $a = $li->find('a'); - $url = $a[0]->href; + if ($_GET['start'] == 'pocket') { + $html = new simple_html_dom(); + $html->load_file('ril_export.html'); + $read = 0; + $errors = array(); + foreach($html->find('ul') as $ul) + { + foreach($ul->find('li') as $li) + { + $a = $li->find('a'); + $url = $a[0]->href; - 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); + 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