copy of poche.sqlite

This commit is contained in:
Nicolas Lœuillet 2013-08-05 10:32:15 +02:00
parent e4ed594d82
commit 7f959169b7
5 changed files with 29 additions and 22 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
vendor vendor
composer.phar composer.phar
db/poche.sqlite

BIN
db/poche.sqlite.in Executable file

Binary file not shown.

View File

@ -212,6 +212,7 @@ class Poche
private function importFromInstapaper() private function importFromInstapaper()
{ {
# TODO gestion des articles favs
$html = new simple_html_dom(); $html = new simple_html_dom();
$html->load_file('./instapaper-export.html'); $html->load_file('./instapaper-export.html');
@ -229,9 +230,8 @@ class Poche
$this->store->archiveById($last_id); $this->store->archiveById($last_id);
} }
} }
# Instapaper génère un fichier HTML avec deux <ol>
# Le premier concerne les éléments non lus # the second <ol> is for read links
# Le second concerne les éléments archivés
$read = 1; $read = 1;
} }
Tools::logm('import from instapaper completed'); Tools::logm('import from instapaper completed');
@ -240,6 +240,7 @@ class Poche
private function importFromPocket() private function importFromPocket()
{ {
# TODO gestion des articles favs
$html = new simple_html_dom(); $html = new simple_html_dom();
$html->load_file('./ril_export.html'); $html->load_file('./ril_export.html');
@ -257,9 +258,8 @@ class Poche
$this->store->archiveById($last_id); $this->store->archiveById($last_id);
} }
} }
# Pocket génère un fichier HTML avec deux <ul>
# Le premier concerne les éléments non lus # the second <ul> is for read links
# Le second concerne les éléments archivés
$read = 1; $read = 1;
} }
Tools::logm('import from pocket completed'); Tools::logm('import from pocket completed');
@ -268,17 +268,24 @@ class Poche
private function importFromReadability() private function importFromReadability()
{ {
# TODO finaliser tout ça ici # TODO gestion des articles lus / favs
# noms des variables + gestion des articles lus
$str_data = file_get_contents("./readability"); $str_data = file_get_contents("./readability");
$data = json_decode($str_data,true); $data = json_decode($str_data,true);
foreach ($data as $key => $value) { foreach ($data as $key => $value) {
$url = ''; $url = '';
foreach ($value as $key2 => $value2) { foreach ($value as $attr => $attr_value) {
if ($key2 == 'article__url') { if ($attr == 'article__url') {
$url = new Url(base64_encode($value2)); $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()) if ($url->isCorrect())
$this->action('add', $url); $this->action('add', $url);

View File

@ -206,8 +206,8 @@ class Tools
return sha1($string . SALT); return sha1($string . SALT);
} }
public static function checkVar($var) public static function checkVar($var, $default = '')
{ {
return ((isset ($_REQUEST["$var"])) ? htmlentities($_REQUEST["$var"]) : ''); return ((isset ($_REQUEST["$var"])) ? htmlentities($_REQUEST["$var"]) : $default);
} }
} }

View File

@ -11,16 +11,15 @@
include dirname(__FILE__).'/inc/poche/config.inc.php'; include dirname(__FILE__).'/inc/poche/config.inc.php';
#XSRF protection with token #XSRF protection with token
// if (!empty($_POST)) { if (!empty($_POST)) {
// if (!Session::isToken($_POST['token'])) { if (!Session::isToken($_POST['token'])) {
// die(_('Wrong token')); die(_('Wrong token'));
// // TODO remettre le test }
// } unset($_SESSION['tokens']);
// unset($_SESSION['tokens']); }
// }
$referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER']; $referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
$view = Tools::checkVar('view'); $view = Tools::checkVar('view', 'home');
$action = Tools::checkVar('action'); $action = Tools::checkVar('action');
$id = Tools::checkVar('id'); $id = Tools::checkVar('id');
$_SESSION['sort'] = Tools::checkVar('sort'); $_SESSION['sort'] = Tools::checkVar('sort');