From a62788c61ef80e6b0f1cf0b6304b2dfd2223aa38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 5 Aug 2013 09:43:33 +0200 Subject: [PATCH] #100: welcome to you, instapaper users --- inc/poche/Poche.class.php | 22 ++++++++++++++++++++++ inc/poche/config.inc.php | 5 +++-- index.php | 1 - tpl/config.twig | 1 + tpl/login.twig | 6 +++--- tpl/view.twig | 1 + 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 5c3eda806..0d37e3c2c 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -212,6 +212,28 @@ class Poche private function importFromInstapaper() { + $html = new simple_html_dom(); + $html->load_file('./instapaper-export.html'); + + $read = 0; + $errors = array(); + foreach($html->find('ol') as $ul) + { + foreach($ul->find('li') as $li) + { + $a = $li->find('a'); + $url = new Url(base64_encode($a[0]->href)); + $this->action('add', $url); + if ($read == '1') { + $last_id = $this->store->getLastId(); + $this->store->archiveById($last_id); + } + } + # Instapaper génère un fichier HTML avec deux
    + # Le premier concerne les éléments non lus + # Le second concerne les éléments archivés + $read = 1; + } Tools::logm('import from instapaper completed'); Tools::redirect(); } diff --git a/inc/poche/config.inc.php b/inc/poche/config.inc.php index 67d0c8879..a16098d16 100644 --- a/inc/poche/config.inc.php +++ b/inc/poche/config.inc.php @@ -8,12 +8,13 @@ * @license http://www.wtfpl.net/ see COPYING file */ -define ('POCHE_VERSION', '0.4'); -define ('MODE_DEMO', FALSE); +define ('POCHE_VERSION', '1.0-alpha'); +define ('MODE_DEMO', TRUE); define ('DEBUG_POCHE', FALSE); define ('CONVERT_LINKS_FOOTNOTES', FALSE); define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE); define ('DOWNLOAD_PICTURES', FALSE); +define ('SHARE_TWITTER', TRUE); define ('SALT', '464v54gLLw928uz4zUBqkRJeiPY68zCX'); define ('ABS_PATH', 'assets/'); define ('TPL', './tpl'); diff --git a/index.php b/index.php index 94c72a275..294620d1e 100644 --- a/index.php +++ b/index.php @@ -49,7 +49,6 @@ $tpl_vars = array( 'referer' => $referer, 'view' => $view, 'poche_url' => Tools::getPocheUrl(), - 'demo' => MODE_DEMO, 'title' => _('poche, a read it later open source system'), 'token' => Session::getToken(), ); diff --git a/tpl/config.twig b/tpl/config.twig index c18806bc6..dc49ee393 100644 --- a/tpl/config.twig +++ b/tpl/config.twig @@ -42,6 +42,7 @@

    {% trans "Export your poche datas" %}

    diff --git a/tpl/login.twig b/tpl/login.twig index c3028795b..b24674e2b 100644 --- a/tpl/login.twig +++ b/tpl/login.twig @@ -5,15 +5,15 @@

    {% trans "login to your poche" %}

    - {% if demo == 1 %}

    {% trans "you are in demo mode, some features may be disabled." %}

    {% endif %} + {% if constant('MODE_DEMO') == 1 %}

    {% trans "you are in demo mode, some features may be disabled." %}

    {% endif %}
    - +
    - +
    diff --git a/tpl/view.twig b/tpl/view.twig index 8ef5cd9c2..bf9a9af91 100644 --- a/tpl/view.twig +++ b/tpl/view.twig @@ -8,6 +8,7 @@