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

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
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()
{
# TODO gestion des articles favs
$html = new simple_html_dom();
$html->load_file('./instapaper-export.html');
@ -229,9 +230,8 @@ class Poche
$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');
@ -240,6 +240,7 @@ class Poche
private function importFromPocket()
{
# TODO gestion des articles favs
$html = new simple_html_dom();
$html->load_file('./ril_export.html');
@ -257,9 +258,8 @@ class Poche
$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');
@ -268,17 +268,24 @@ class Poche
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);

View File

@ -206,8 +206,8 @@ class Tools
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';
#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');