]>
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 /><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>' ;
20 if ( $_GET [ 'start' ] == 'pocket' ) {
21 $html = new simple_html_dom ();
22 $html- > load_file ( 'ril_export.html' );
26 foreach ( $html- > find ( 'ul' ) as $ul )
28 foreach ( $ul- > find ( 'li' ) as $li )
33 action_to_do ( 'add' , $url );
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 );
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
48 echo _ ( 'Import from Pocket completed.' ) . '<a href="index.php">' . _ ( 'Welcome to poche !' ) . '</a>' ;
49 logm ( 'import from pocket completed' );
51 else if ( $_GET [ 'start' ] == 'readability' ) {
52 $str_data = file_get_contents ( "readability" );
53 $data = json_decode ( $str_data , true );
55 foreach ( $data as $key => $value ) {
57 foreach ( $value as $key2 => $value2 ) {
58 if ( $key2 == 'article__url' ) {
63 action_to_do ( 'add' , $url );
66 echo _ ( 'Import from Readability completed.' ) . '<a href="index.php">' . _ ( 'Welcome to poche !' ) . '</a>' ;
67 logm ( 'import from Readability completed' );
70 echo _ ( 'Error with the import.' ) . '<a href="index.php">' . _ ( 'Back to poche' ). '</a>' ;
71 logm ( 'error with the import' );