#100: welcome to you, instapaper users

This commit is contained in:
Nicolas Lœuillet 2013-08-05 09:43:33 +02:00
parent 3208d538a7
commit a62788c61e
6 changed files with 30 additions and 6 deletions

View file

@ -212,6 +212,28 @@ class Poche
private function importFromInstapaper() 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 <ol>
# 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::logm('import from instapaper completed');
Tools::redirect(); Tools::redirect();
} }

View file

@ -8,12 +8,13 @@
* @license http://www.wtfpl.net/ see COPYING file * @license http://www.wtfpl.net/ see COPYING file
*/ */
define ('POCHE_VERSION', '0.4'); define ('POCHE_VERSION', '1.0-alpha');
define ('MODE_DEMO', FALSE); define ('MODE_DEMO', TRUE);
define ('DEBUG_POCHE', FALSE); define ('DEBUG_POCHE', FALSE);
define ('CONVERT_LINKS_FOOTNOTES', FALSE); define ('CONVERT_LINKS_FOOTNOTES', FALSE);
define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE); define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
define ('DOWNLOAD_PICTURES', FALSE); define ('DOWNLOAD_PICTURES', FALSE);
define ('SHARE_TWITTER', TRUE);
define ('SALT', '464v54gLLw928uz4zUBqkRJeiPY68zCX'); define ('SALT', '464v54gLLw928uz4zUBqkRJeiPY68zCX');
define ('ABS_PATH', 'assets/'); define ('ABS_PATH', 'assets/');
define ('TPL', './tpl'); define ('TPL', './tpl');

View file

@ -49,7 +49,6 @@ $tpl_vars = array(
'referer' => $referer, 'referer' => $referer,
'view' => $view, 'view' => $view,
'poche_url' => Tools::getPocheUrl(), 'poche_url' => Tools::getPocheUrl(),
'demo' => MODE_DEMO,
'title' => _('poche, a read it later open source system'), 'title' => _('poche, a read it later open source system'),
'token' => Session::getToken(), 'token' => Session::getToken(),
); );

View file

@ -42,6 +42,7 @@
<p><ul> <p><ul>
<li><a href="./?import&from=pocket">{% trans "import from Pocket" %}</a> (you must have a "ril_export.html" file on your server)</li> <li><a href="./?import&from=pocket">{% trans "import from Pocket" %}</a> (you must have a "ril_export.html" file on your server)</li>
<li><a href="./?import&from=readability">{% trans "import from Readability" %}</a> (you must have a "readability" file on your server)</li> <li><a href="./?import&from=readability">{% trans "import from Readability" %}</a> (you must have a "readability" file on your server)</li>
<li><a href="./?import&from=instapaper">{% trans "import from Instapaper" %}</a> (you must have a "instapaper-export.html" file on your server)</li>
</ul></p> </ul></p>
<h2>{% trans "Export your poche datas" %}</h2> <h2>{% trans "Export your poche datas" %}</h2>

View file

@ -5,15 +5,15 @@
<form method="post" action="?login" name="loginform"> <form method="post" action="?login" name="loginform">
<fieldset class="w500p center"> <fieldset class="w500p center">
<h2 class="mbs txtcenter">{% trans "login to your poche" %}</h2> <h2 class="mbs txtcenter">{% trans "login to your poche" %}</h2>
{% if demo == 1 %}<p>{% trans "you are in demo mode, some features may be disabled." %}</p>{% endif %} {% if constant('MODE_DEMO') == 1 %}<p>{% trans "you are in demo mode, some features may be disabled." %}</p>{% endif %}
<div class="row"> <div class="row">
<label class="col w150p" for="login">{% trans "Login" %}</label> <label class="col w150p" for="login">{% trans "Login" %}</label>
<input class="col" type="text" id="login" name="login" placeholder="Login" tabindex="1" autofocus {% if demo == 1 %}value="poche"{% endif %} /> <input class="col" type="text" id="login" name="login" placeholder="Login" tabindex="1" autofocus {% if constant('MODE_DEMO') == 1 %}value="poche"{% endif %} />
</div> </div>
<div class="row"> <div class="row">
<label class="col w150p" for="password">{% trans "Password" %}</label> <label class="col w150p" for="password">{% trans "Password" %}</label>
<input class="col" type="password" id="password" name="password" placeholder="Password" tabindex="2" {% if demo == 1 %}value="poche"{% endif %} /> <input class="col" type="password" id="password" name="password" placeholder="Password" tabindex="2" {% if constant('MODE_DEMO') == 1 %}value="poche"{% endif %} />
</div> </div>
<div class="row"> <div class="row">
<label class="col w150p" for="longlastingsession">{% trans "Stay signed in" %}</label> <label class="col w150p" for="longlastingsession">{% trans "Stay signed in" %}</label>

View file

@ -8,6 +8,7 @@
</div> </div>
<div class="tools"> <div class="tools">
<ul> <ul>
{% if constant('SHARE_TWITTER') == 1 %}<li><a href="https://twitter.com/home?status={{entry.title}}%20{{ entry.url|e }}%20via%20@getpoche" target="_blank" class="tool twitter"><span></span></a></li>{% endif %}
<li><a title="{% trans "toggle mark as read" %}" class="tool archive {% if entry.is_read == 0 %}archive-off{% endif %}" onclick="toggle_archive(this, {{ entry.id|e }})"><span></span></a></li> <li><a title="{% trans "toggle mark as read" %}" class="tool archive {% if entry.is_read == 0 %}archive-off{% endif %}" onclick="toggle_archive(this, {{ entry.id|e }})"><span></span></a></li>
<li><a href="#" id="themeswitch">{% trans "dark" %}</a></li> <li><a href="#" id="themeswitch">{% trans "dark" %}</a></li>
<li><a title="{% trans "toggle favorite" %}" class="tool fav {% if entry.is_fav == 0 %}fav-off{% endif %}" onclick="toggle_favorite(this, {{ entry.id|e }})"><span></span></a></li> <li><a title="{% trans "toggle favorite" %}" class="tool fav {% if entry.is_fav == 0 %}fav-off{% endif %}" onclick="toggle_favorite(this, {{ entry.id|e }})"><span></span></a></li>