From 7f959169b7220b4ed3e083cb2a545fe2c5400f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 5 Aug 2013 10:32:15 +0200 Subject: [PATCH] copy of poche.sqlite --- .gitignore | 3 ++- db/poche.sqlite.in | Bin 0 -> 294912 bytes inc/poche/Poche.class.php | 29 ++++++++++++++++++----------- inc/poche/Tools.class.php | 4 ++-- index.php | 15 +++++++-------- 5 files changed, 29 insertions(+), 22 deletions(-) create mode 100755 db/poche.sqlite.in diff --git a/.gitignore b/.gitignore index 08db745..050a138 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ vendor -composer.phar \ No newline at end of file +composer.phar +db/poche.sqlite \ No newline at end of file diff --git a/db/poche.sqlite.in b/db/poche.sqlite.in new file mode 100755 index 0000000000000000000000000000000000000000..45add0d76750821603c167ba00de75bb7bd4abe3 GIT binary patch literal 294912 zcmeI*O>Y~=835p=CF`qjTNG#o!5*5t}snA)Ye zORFDnXd~#K=%MJf{~-5V+x~{4mjF2zxg;n${3!eZ1PR=m^bB@(xHI$ayzfKa`J0cn z^EwL$W&bFx!!MHONu!axA3~BOU&p=}`+V$;*nbfFZ0!GQqq*;DUnf`p_0GBBwPgO; zhxhZYnR1A{%CTayS2Nyv9}raHg0ZjhUR3l87?;SPBU!n z>}~#Pb2r@E-TH82_d)pe=7SJ6?(f~*+KFKwZtm=buyc1W?A+hp4&naJ)<^d@!yKHk{9b!TIDIv=N>rrklDzqx()=A{?=v-8UrE;K&<={TjVsQYo(!_0oxSlm`&zwkEM6RGUWt*HhJQ+a`0`hJd2w#}#`#8) z7oF_4)0lKnm*eOC$rrhQZ89!iUicoHS0|enhTkN!SLf!IH!ghJ+o#{i{myM_+%%Emqvg90RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK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&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009Ccfu%9S?09&dB*QOload_file('./instapaper-export.html'); @@ -229,9 +230,8 @@ class Poche $this->store->archiveById($last_id); } } - # Instapaper génère un fichier HTML avec deux
    - # Le premier concerne les éléments non lus - # Le second concerne les éléments archivés + + # the second
      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
        - # Le premier concerne les éléments non lus - # Le second concerne les éléments archivés + + # the second
          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); diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 1ff4ba5..834940f 100644 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -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); } } \ No newline at end of file diff --git a/index.php b/index.php index 294620d..654403c 100644 --- a/index.php +++ b/index.php @@ -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');