aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rwxr-xr-xdb/poche.sqlite.inbin0 -> 294912 bytes
-rw-r--r--inc/poche/Poche.class.php29
-rw-r--r--inc/poche/Tools.class.php4
-rw-r--r--index.php15
5 files changed, 29 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index 08db745d..050a1386 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
1vendor 1vendor
2composer.phar \ No newline at end of file 2composer.phar
3db/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 00000000..45add0d7
--- /dev/null
+++ b/db/poche.sqlite.in
Binary files differ
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index 0d37e3c2..12cb1b42 100644
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -212,6 +212,7 @@ class Poche
212 212
213 private function importFromInstapaper() 213 private function importFromInstapaper()
214 { 214 {
215 # TODO gestion des articles favs
215 $html = new simple_html_dom(); 216 $html = new simple_html_dom();
216 $html->load_file('./instapaper-export.html'); 217 $html->load_file('./instapaper-export.html');
217 218
@@ -229,9 +230,8 @@ class Poche
229 $this->store->archiveById($last_id); 230 $this->store->archiveById($last_id);
230 } 231 }
231 } 232 }
232 # Instapaper génère un fichier HTML avec deux <ol> 233
233 # Le premier concerne les éléments non lus 234 # the second <ol> is for read links
234 # Le second concerne les éléments archivés
235 $read = 1; 235 $read = 1;
236 } 236 }
237 Tools::logm('import from instapaper completed'); 237 Tools::logm('import from instapaper completed');
@@ -240,6 +240,7 @@ class Poche
240 240
241 private function importFromPocket() 241 private function importFromPocket()
242 { 242 {
243 # TODO gestion des articles favs
243 $html = new simple_html_dom(); 244 $html = new simple_html_dom();
244 $html->load_file('./ril_export.html'); 245 $html->load_file('./ril_export.html');
245 246
@@ -257,9 +258,8 @@ class Poche
257 $this->store->archiveById($last_id); 258 $this->store->archiveById($last_id);
258 } 259 }
259 } 260 }
260 # Pocket génère un fichier HTML avec deux <ul> 261
261 # Le premier concerne les éléments non lus 262 # the second <ul> is for read links
262 # Le second concerne les éléments archivés
263 $read = 1; 263 $read = 1;
264 } 264 }
265 Tools::logm('import from pocket completed'); 265 Tools::logm('import from pocket completed');
@@ -268,17 +268,24 @@ class Poche
268 268
269 private function importFromReadability() 269 private function importFromReadability()
270 { 270 {
271 # TODO finaliser tout ça ici 271 # TODO gestion des articles lus / favs
272 # noms des variables + gestion des articles lus
273 $str_data = file_get_contents("./readability"); 272 $str_data = file_get_contents("./readability");
274 $data = json_decode($str_data,true); 273 $data = json_decode($str_data,true);
275 274
276 foreach ($data as $key => $value) { 275 foreach ($data as $key => $value) {
277 $url = ''; 276 $url = '';
278 foreach ($value as $key2 => $value2) { 277 foreach ($value as $attr => $attr_value) {
279 if ($key2 == 'article__url') { 278 if ($attr == 'article__url') {
280 $url = new Url(base64_encode($value2)); 279 $url = new Url(base64_encode($attr_value));
281 } 280 }
281 // if ($attr_value == 'favorite' && $attr_value == 'true') {
282 // $last_id = $this->store->getLastId();
283 // $this->store->favoriteById($last_id);
284 // }
285 // if ($attr_value == 'archive' && $attr_value == 'true') {
286 // $last_id = $this->store->getLastId();
287 // $this->store->archiveById($last_id);
288 // }
282 } 289 }
283 if ($url->isCorrect()) 290 if ($url->isCorrect())
284 $this->action('add', $url); 291 $this->action('add', $url);
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php
index 1ff4ba55..834940ff 100644
--- a/inc/poche/Tools.class.php
+++ b/inc/poche/Tools.class.php
@@ -206,8 +206,8 @@ class Tools
206 return sha1($string . SALT); 206 return sha1($string . SALT);
207 } 207 }
208 208
209 public static function checkVar($var) 209 public static function checkVar($var, $default = '')
210 { 210 {
211 return ((isset ($_REQUEST["$var"])) ? htmlentities($_REQUEST["$var"]) : ''); 211 return ((isset ($_REQUEST["$var"])) ? htmlentities($_REQUEST["$var"]) : $default);
212 } 212 }
213} \ No newline at end of file 213} \ No newline at end of file
diff --git a/index.php b/index.php
index 294620d1..654403c8 100644
--- a/index.php
+++ b/index.php
@@ -11,16 +11,15 @@
11include dirname(__FILE__).'/inc/poche/config.inc.php'; 11include dirname(__FILE__).'/inc/poche/config.inc.php';
12 12
13#XSRF protection with token 13#XSRF protection with token
14// if (!empty($_POST)) { 14if (!empty($_POST)) {
15// if (!Session::isToken($_POST['token'])) { 15 if (!Session::isToken($_POST['token'])) {
16// die(_('Wrong token')); 16 die(_('Wrong token'));
17// // TODO remettre le test 17 }
18// } 18 unset($_SESSION['tokens']);
19// unset($_SESSION['tokens']); 19}
20// }
21 20
22$referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER']; 21$referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
23$view = Tools::checkVar('view'); 22$view = Tools::checkVar('view', 'home');
24$action = Tools::checkVar('action'); 23$action = Tools::checkVar('action');
25$id = Tools::checkVar('id'); 24$id = Tools::checkVar('id');
26$_SESSION['sort'] = Tools::checkVar('sort'); 25$_SESSION['sort'] = Tools::checkVar('sort');