]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - import.php
3 * poche, a read it later open source system
6 * @author Nicolas Lœuillet <support@inthepoche.com>
8 * @license http://www.wtfpl.net/ see COPYING file
13 include dirname(__FILE__
).'/inc/config.php';
14 include dirname(__FILE__
).'/inc/simple_html_dom.php';
16 if (!isset($_GET['start'])) {
17 echo 'Please execute the import script locally, it can take a very long time. <br /><a href="import.php?start">Bye bye Pocket, let\'s go !</a>';
20 $html = new simple_html_dom();
21 $html->load_file('ril_export.html');
25 foreach($html->find('ul') as $ul)
27 foreach($ul->find('li') as $li)
31 $parametres_url = prepare_url($url);
32 $sql_action = 'INSERT INTO entries ( url, title, content, is_read ) VALUES (?, ?, ?, ?)';
33 $params_action = array($url, $parametres_url['title'], $parametres_url['content'], $read);
37 if (isset($sql_action))
39 $query = $db->getHandle()->prepare($sql_action);
40 $query->execute($params_action);
45 logm('error during pocket import : ' . $e->getMessage());
48 # Pocket génère un fichier HTML avec deux <ul>
49 # Le premier concerne les éléments non lus
50 # Le second concerne les éléments archivés
54 echo 'Import from Pocket completed. <a href="index.php">Welcome to #poche !</a>';
55 logm('import from pocket completed');