aboutsummaryrefslogtreecommitdiffhomepage
path: root/import.php
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas.loeuillet@gmail.com>2013-08-04 21:42:46 +0200
committerNicolas Lœuillet <nicolas.loeuillet@gmail.com>2013-08-04 21:42:46 +0200
commitc765c3679fee3ed9e4bad9954a808116187a7e83 (patch)
treee18a69e8dc7d651f464c531e64773212017a22c8 /import.php
parenteb1af592194e225bf887e4893e697f0ab8dd9a26 (diff)
downloadwallabag-c765c3679fee3ed9e4bad9954a808116187a7e83.tar.gz
wallabag-c765c3679fee3ed9e4bad9954a808116187a7e83.tar.zst
wallabag-c765c3679fee3ed9e4bad9954a808116187a7e83.zip
import in poche and not in an external file
Diffstat (limited to 'import.php')
-rw-r--r--import.php73
1 files changed, 0 insertions, 73 deletions
diff --git a/import.php b/import.php
deleted file mode 100644
index 45fe8334..00000000
--- a/import.php
+++ /dev/null
@@ -1,73 +0,0 @@
1<?php
2/**
3 * poche, a read it later open source system
4 *
5 * @category poche
6 * @author Nicolas Lœuillet <support@inthepoche.com>
7 * @copyright 2013
8 * @license http://www.wtfpl.net/ see COPYING file
9 */
10
11set_time_limit(0);
12
13include dirname(__FILE__).'/inc/config.php';
14include dirname(__FILE__).'/inc/simple_html_dom.php';
15
16if (!isset($_GET['start'])) {
17 echo _('Please execute the import script locally, it can take a very long time.') . '<br /><br />' . _('Please choose between Pocket & Readabilty :') . '<br /><a href="import.php?start=pocket">' . _('Bye bye Pocket, let\'s go !') . '</a><br /><a href="import.php?start=readability">' . _('Bye bye Readability, let\'s go !') . '</a>';
18}
19else {
20 if ($_GET['start'] == 'pocket') {
21 $html = new simple_html_dom();
22 $html->load_file('ril_export.html');
23
24 $read = 0;
25 $errors = array();
26 foreach($html->find('ul') as $ul)
27 {
28 foreach($ul->find('li') as $li)
29 {
30 $a = $li->find('a');
31 $url = $a[0]->href;
32
33 action_to_do('add', $url);
34 if ($read == '1') {
35 $last_id = $db->getHandle()->lastInsertId();
36 $sql_update = "UPDATE entries SET is_read=~is_read WHERE id=?";
37 $params_update = array($last_id);
38 $query_update = $db->getHandle()->prepare($sql_update);
39 $query_update->execute($params_update);
40 }
41 }
42 # Pocket génère un fichier HTML avec deux <ul>
43 # Le premier concerne les éléments non lus
44 # Le second concerne les éléments archivés
45 $read = 1;
46 }
47
48 echo _('Import from Pocket completed.') . '<a href="index.php">' . _('Welcome to poche !') .'</a>';
49 logm('import from pocket completed');
50 }
51 else if ($_GET['start'] == 'readability') {
52 $str_data = file_get_contents("readability");
53 $data = json_decode($str_data,true);
54
55 foreach ($data as $key => $value) {
56 $url = '';
57 foreach ($value as $key2 => $value2) {
58 if ($key2 == 'article__url') {
59 $url = $value2;
60 }
61 }
62 if ($url != '')
63 action_to_do('add', $url);
64 }
65
66 echo _('Import from Readability completed.') . '<a href="index.php">' . _('Welcome to poche !') . '</a>';
67 logm('import from Readability completed');
68 }
69 else {
70 echo _('Error with the import.') . '<a href="index.php">' . _('Back to poche'). '</a>';
71 logm('error with the import');
72 }
73} \ No newline at end of file