aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas.loeuillet@gmail.com>2013-08-05 10:32:15 +0200
committerNicolas Lœuillet <nicolas.loeuillet@gmail.com>2013-08-05 10:32:15 +0200
commit7f959169b7220b4ed3e083cb2a545fe2c5400f9c (patch)
tree8b095a693b2ab306d6b83b46de1936ff88e9a350 /inc/poche
parente4ed594d8246ba5877b86e61f7f85c1b3010f62c (diff)
downloadwallabag-7f959169b7220b4ed3e083cb2a545fe2c5400f9c.tar.gz
wallabag-7f959169b7220b4ed3e083cb2a545fe2c5400f9c.tar.zst
wallabag-7f959169b7220b4ed3e083cb2a545fe2c5400f9c.zip
copy of poche.sqlite
Diffstat (limited to 'inc/poche')
-rw-r--r--inc/poche/Poche.class.php29
-rw-r--r--inc/poche/Tools.class.php4
2 files changed, 20 insertions, 13 deletions
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