#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()
{
$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::redirect();
}

View File

@ -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');

View File

@ -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(),
);

View File

@ -42,6 +42,7 @@
<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=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>
<h2>{% trans "Export your poche datas" %}</h2>

View File

@ -5,15 +5,15 @@
<form method="post" action="?login" name="loginform">
<fieldset class="w500p center">
<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">
<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 class="row">
<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 class="row">
<label class="col w150p" for="longlastingsession">{% trans "Stay signed in" %}</label>

View File

@ -8,6 +8,7 @@
</div>
<div class="tools">
<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 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>