private function importFromInstapaper()
{
+ # TODO gestion des articles favs
$html = new simple_html_dom();
$html->load_file('./instapaper-export.html');
$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
+
+ # the second <ol> is for read links
$read = 1;
}
Tools::logm('import from instapaper completed');
private function importFromPocket()
{
+ # TODO gestion des articles favs
$html = new simple_html_dom();
$html->load_file('./ril_export.html');
$this->store->archiveById($last_id);
}
}
- # Pocket génère un fichier HTML avec deux <ul>
- # Le premier concerne les éléments non lus
- # Le second concerne les éléments archivés
+
+ # the second <ul> is for read links
$read = 1;
}
Tools::logm('import from pocket completed');
private function importFromReadability()
{
- # TODO finaliser tout ça ici
- # noms des variables + gestion des articles lus
+ # TODO gestion des articles lus / favs
$str_data = file_get_contents("./readability");
$data = json_decode($str_data,true);
foreach ($data as $key => $value) {
$url = '';
- foreach ($value as $key2 => $value2) {
- if ($key2 == 'article__url') {
- $url = new Url(base64_encode($value2));
+ foreach ($value as $attr => $attr_value) {
+ if ($attr == 'article__url') {
+ $url = new Url(base64_encode($attr_value));
}
+ // if ($attr_value == 'favorite' && $attr_value == 'true') {
+ // $last_id = $this->store->getLastId();
+ // $this->store->favoriteById($last_id);
+ // }
+ // if ($attr_value == 'archive' && $attr_value == 'true') {
+ // $last_id = $this->store->getLastId();
+ // $this->store->archiveById($last_id);
+ // }
}
if ($url->isCorrect())
$this->action('add', $url);
include dirname(__FILE__).'/inc/poche/config.inc.php';
#XSRF protection with token
-// if (!empty($_POST)) {
-// if (!Session::isToken($_POST['token'])) {
-// die(_('Wrong token'));
-// // TODO remettre le test
-// }
-// unset($_SESSION['tokens']);
-// }
+if (!empty($_POST)) {
+ if (!Session::isToken($_POST['token'])) {
+ die(_('Wrong token'));
+ }
+ unset($_SESSION['tokens']);
+}
$referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
-$view = Tools::checkVar('view');
+$view = Tools::checkVar('view', 'home');
$action = Tools::checkVar('action');
$id = Tools::checkVar('id');
$_SESSION['sort'] = Tools::checkVar('sort');