aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/3rdparty/Session.class.php4
-rw-r--r--inc/3rdparty/site_config/standard/bastamag.net.txt10
-rw-r--r--inc/3rdparty/site_config/standard/bearmetal.eu.txt6
-rwxr-xr-xinc/3rdparty/site_config/standard/blog.cloudflare.com.txt8
-rw-r--r--inc/3rdparty/site_config/standard/blog.niqnutn.com.txt9
-rw-r--r--inc/3rdparty/site_config/standard/captaineconomics.fr.txt6
-rw-r--r--inc/3rdparty/site_config/standard/cloudacademy.com.txt6
-rw-r--r--inc/3rdparty/site_config/standard/codebase64.org.txt9
-rw-r--r--inc/3rdparty/site_config/standard/cyrille-borne.com.txt6
-rw-r--r--inc/3rdparty/site_config/standard/des-livres-pour-changer-de-vie.fr.txt6
-rw-r--r--inc/3rdparty/site_config/standard/espacepolitique.revues.org.txt10
-rw-r--r--inc/3rdparty/site_config/standard/frankdenneman.nl.txt2
-rw-r--r--inc/3rdparty/site_config/standard/frontburner.dmagazine.com.txt6
-rw-r--r--inc/3rdparty/site_config/standard/ganglia.info.txt2
-rw-r--r--inc/3rdparty/site_config/standard/gokulkrishh.github.io.txt6
-rw-r--r--inc/3rdparty/site_config/standard/hackersrepublic.org.txt6
-rw-r--r--inc/3rdparty/site_config/standard/iceblog.free.fr.txt7
-rw-r--r--inc/3rdparty/site_config/standard/iso.500px.com.txt6
-rw-r--r--inc/3rdparty/site_config/standard/it-connect.fr.txt9
-rw-r--r--inc/3rdparty/site_config/standard/jsforcats.com.txt6
-rw-r--r--inc/3rdparty/site_config/standard/lapin-blanc.blogs.docteo.net.txt6
-rw-r--r--inc/3rdparty/site_config/standard/lececil.org.txt6
-rw-r--r--inc/3rdparty/site_config/standard/metrocop.net.txt6
-rw-r--r--inc/3rdparty/site_config/standard/n0where.net.txt5
-rw-r--r--inc/3rdparty/site_config/standard/pérotin.com.txt6
-rwxr-xr-xinc/3rdparty/site_config/standard/reddit.com.txt6
-rw-r--r--inc/3rdparty/site_config/standard/spiil.org.txt6
-rw-r--r--inc/3rdparty/site_config/standard/yosko.net.txt6
-rwxr-xr-xinc/poche/Database.class.php165
-rwxr-xr-xinc/poche/Poche.class.php168
-rwxr-xr-xinc/poche/Routing.class.php7
-rwxr-xr-xinc/poche/Tools.class.php26
-rw-r--r--inc/poche/WallabagEBooks.class.php16
33 files changed, 448 insertions, 111 deletions
diff --git a/inc/3rdparty/Session.class.php b/inc/3rdparty/Session.class.php
index b56e4c54..6ff73a76 100644
--- a/inc/3rdparty/Session.class.php
+++ b/inc/3rdparty/Session.class.php
@@ -51,9 +51,9 @@ class Session
51 public static function init($longlastingsession = false) 51 public static function init($longlastingsession = false)
52 { 52 {
53 //check if session name is correct 53 //check if session name is correct
54 if ( (session_id() && !empty(self::$sessionName) && session_name()!=self::$sessionName) || $longlastingsession ) { 54 /*if ( (session_id() && !empty(self::$sessionName) && session_name()!=self::$sessionName) || $longlastingsession ) {
55 session_destroy(); 55 session_destroy();
56 } 56 }*/
57 57
58 // Force cookie path (but do not change lifetime) 58 // Force cookie path (but do not change lifetime)
59 $cookie = session_get_cookie_params(); 59 $cookie = session_get_cookie_params();
diff --git a/inc/3rdparty/site_config/standard/bastamag.net.txt b/inc/3rdparty/site_config/standard/bastamag.net.txt
new file mode 100644
index 00000000..142c959c
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/bastamag.net.txt
@@ -0,0 +1,10 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Fwww.bastamag.net%2FEncadrement-des-loyers-pourquoi-Anne-Hidalgo-ferait-bien-de-visiter-Vienne-l
4
5body: //div[@id='content']//article
6
7strip_id_or_class: appel-soutien
8strip_id_or_class: liste dossiers-content
9
10test_url: http://www.bastamag.net/Encadrement-des-loyers-pourquoi-Anne-Hidalgo-ferait-bien-de-visiter-Vienne-l
diff --git a/inc/3rdparty/site_config/standard/bearmetal.eu.txt b/inc/3rdparty/site_config/standard/bearmetal.eu.txt
new file mode 100644
index 00000000..44d34655
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/bearmetal.eu.txt
@@ -0,0 +1,6 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=https%3A%2F%2Fbearmetal.eu%2Ftheden%2Fits-not-about-you%2F
4
5body: //div[contains(concat(' ',normalize-space(@class),' '),' entry-content ')]
6test_url: https://bearmetal.eu/theden/its-not-about-you/
diff --git a/inc/3rdparty/site_config/standard/blog.cloudflare.com.txt b/inc/3rdparty/site_config/standard/blog.cloudflare.com.txt
index db80a35f..9b7cf25c 100755
--- a/inc/3rdparty/site_config/standard/blog.cloudflare.com.txt
+++ b/inc/3rdparty/site_config/standard/blog.cloudflare.com.txt
@@ -3,7 +3,11 @@ title: substring-before(//title, '-')
3 3
4author: //a[ contains(@href, '/people') ] 4author: //a[ contains(@href, '/people') ]
5 5
6body: //div[ @class='post' ] 6body: //article[contains(concat(' ',normalize-space(@class),' '),' post ')]
7
8strip_id_or_class: section learn-more
9strip_id_or_class: section comments
10strip_id_or_class: disqus_thread
7 11
8# Date is impossible to retrieve since they use those stupid "fuzzy" dates, inserted through javascript, at posterous. 12# Date is impossible to retrieve since they use those stupid "fuzzy" dates, inserted through javascript, at posterous.
9test_url: http://blog.cloudflare.com/understanding-analytics-when-is-a-page-view-n \ No newline at end of file 13test_url: http://blog.cloudflare.com/understanding-analytics-when-is-a-page-view-n
diff --git a/inc/3rdparty/site_config/standard/blog.niqnutn.com.txt b/inc/3rdparty/site_config/standard/blog.niqnutn.com.txt
new file mode 100644
index 00000000..aa2f1865
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/blog.niqnutn.com.txt
@@ -0,0 +1,9 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Fblog.niqnutn.com%2Farticle35%2Fsteganographie-l-art-de-dissimuler-un-message
4
5body: //article[contains(concat(' ',normalize-space(@class),' '),' article-content ')]//section
6
7strip_id_or_class: sommaire
8
9test_url: http://blog.niqnutn.com/article35/steganographie-l-art-de-dissimuler-un-message
diff --git a/inc/3rdparty/site_config/standard/captaineconomics.fr.txt b/inc/3rdparty/site_config/standard/captaineconomics.fr.txt
new file mode 100644
index 00000000..036e0281
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/captaineconomics.fr.txt
@@ -0,0 +1,6 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Fwww.captaineconomics.fr%2F-les-immigres-recemment-arrives-en-france-qui-sont-ils-insee
4
5body: //div[contains(concat(' ',normalize-space(@class),' '),' post_content ')]
6test_url: http://www.captaineconomics.fr/-les-immigres-recemment-arrives-en-france-qui-sont-ils-insee
diff --git a/inc/3rdparty/site_config/standard/cloudacademy.com.txt b/inc/3rdparty/site_config/standard/cloudacademy.com.txt
new file mode 100644
index 00000000..f5b67840
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/cloudacademy.com.txt
@@ -0,0 +1,6 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Fcloudacademy.com%2Fblog%2Fberkshelf-manage-chef-cookbooks%2F
4
5body: //div[contains(concat(' ',normalize-space(@class),' '),' entry-content ')]
6test_url: http://cloudacademy.com/blog/berkshelf-manage-chef-cookbooks/ \ No newline at end of file
diff --git a/inc/3rdparty/site_config/standard/codebase64.org.txt b/inc/3rdparty/site_config/standard/codebase64.org.txt
new file mode 100644
index 00000000..d992d2f1
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/codebase64.org.txt
@@ -0,0 +1,9 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Fcodebase64.org%2Fdoku.php%3Fid%3Dbase%3Ademo_coding_introduction
4
5body: //div[contains(concat(' ',normalize-space(@class),' '),' page ')]
6
7strip_id_or_class: dw__toc
8
9test_url: http://codebase64.org/doku.php?id=base:demo_coding_introduction
diff --git a/inc/3rdparty/site_config/standard/cyrille-borne.com.txt b/inc/3rdparty/site_config/standard/cyrille-borne.com.txt
new file mode 100644
index 00000000..7b41aa0b
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/cyrille-borne.com.txt
@@ -0,0 +1,6 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Fwww.cyrille-borne.com%2Farticle511%2Fun-an-de-zte-open-c-plus-tard
4
5body: //article//section
6test_url: http://www.cyrille-borne.com/article511/un-an-de-zte-open-c-plus-tard \ No newline at end of file
diff --git a/inc/3rdparty/site_config/standard/des-livres-pour-changer-de-vie.fr.txt b/inc/3rdparty/site_config/standard/des-livres-pour-changer-de-vie.fr.txt
new file mode 100644
index 00000000..56b0ea27
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/des-livres-pour-changer-de-vie.fr.txt
@@ -0,0 +1,6 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Fwww.des-livres-pour-changer-de-vie.fr%2Fbit-literacy-2%2F
4
5body: //div[@id='getsocialmain']
6test_url: http://www.des-livres-pour-changer-de-vie.fr/bit-literacy-2/ \ No newline at end of file
diff --git a/inc/3rdparty/site_config/standard/espacepolitique.revues.org.txt b/inc/3rdparty/site_config/standard/espacepolitique.revues.org.txt
new file mode 100644
index 00000000..c4acb26e
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/espacepolitique.revues.org.txt
@@ -0,0 +1,10 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Fespacepolitique.revues.org%2F284
4
5body: //div[@id='text']
6
7strip_id_or_class: paranumber
8strip_id_or_class: go-top
9
10test_url: http://espacepolitique.revues.org/284
diff --git a/inc/3rdparty/site_config/standard/frankdenneman.nl.txt b/inc/3rdparty/site_config/standard/frankdenneman.nl.txt
new file mode 100644
index 00000000..c6011002
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/frankdenneman.nl.txt
@@ -0,0 +1,2 @@
1body: //*[(@class = "content")]
2test_url: http://frankdenneman.nl/
diff --git a/inc/3rdparty/site_config/standard/frontburner.dmagazine.com.txt b/inc/3rdparty/site_config/standard/frontburner.dmagazine.com.txt
new file mode 100644
index 00000000..73f44324
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/frontburner.dmagazine.com.txt
@@ -0,0 +1,6 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Ffrontburner.dmagazine.com%2F2015%2F04%2F23%2Fthe-barrett-brown-review-of-arts-and-letters-and-jail-a-sign-of-things-to-come%2F
4
5body: //div[@id='article-body']
6test_url: http://frontburner.dmagazine.com/2015/04/23/the-barrett-brown-review-of-arts-and-letters-and-jail-a-sign-of-things-to-come/
diff --git a/inc/3rdparty/site_config/standard/ganglia.info.txt b/inc/3rdparty/site_config/standard/ganglia.info.txt
new file mode 100644
index 00000000..2ae27b48
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/ganglia.info.txt
@@ -0,0 +1,2 @@
1body: //*[(@id = "mid")]
2test_url: http://ganglia.info/
diff --git a/inc/3rdparty/site_config/standard/gokulkrishh.github.io.txt b/inc/3rdparty/site_config/standard/gokulkrishh.github.io.txt
new file mode 100644
index 00000000..b395fa9e
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/gokulkrishh.github.io.txt
@@ -0,0 +1,6 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=https%3A%2F%2Fgokulkrishh.github.io%2FJavascript-Guidelines%2F
4
5body: //section[contains(concat(' ',normalize-space(@class),' '),' main-content ')]
6test_url: https://gokulkrishh.github.io/Javascript-Guidelines/
diff --git a/inc/3rdparty/site_config/standard/hackersrepublic.org.txt b/inc/3rdparty/site_config/standard/hackersrepublic.org.txt
new file mode 100644
index 00000000..da01c213
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/hackersrepublic.org.txt
@@ -0,0 +1,6 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Fwww.hackersrepublic.org%2Fculture-du-hacking%2Fune-histoire-de-privileges
4
5body: //div[contains(concat(' ',normalize-space(@class),' '),' field-name-body ')]//div[contains(concat(' ',normalize-space(@class),' '),' field-items ')]//div[contains(concat(' ',normalize-space(@class),' '),' field-item ') and (contains(concat(' ',normalize-space(@class),' '),' even '))]
6test_url: http://www.hackersrepublic.org/culture-du-hacking/une-histoire-de-privileges
diff --git a/inc/3rdparty/site_config/standard/iceblog.free.fr.txt b/inc/3rdparty/site_config/standard/iceblog.free.fr.txt
new file mode 100644
index 00000000..9d1ce214
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/iceblog.free.fr.txt
@@ -0,0 +1,7 @@
1
2# Generated by FiveFilters.org's web-based selection tool
3# Place this file inside your site_config/custom/ folder
4# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Ficeblog.free.fr%2Findex.php%3Farticle102%2Fweb-histoire-geek-4
5
6body: //article//section
7test_url: http://iceblog.free.fr/index.php?article102/web-histoire-geek-4
diff --git a/inc/3rdparty/site_config/standard/iso.500px.com.txt b/inc/3rdparty/site_config/standard/iso.500px.com.txt
new file mode 100644
index 00000000..ffa29a1d
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/iso.500px.com.txt
@@ -0,0 +1,6 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=https%3A%2F%2Fiso.500px.com%2Fhow-i-post-processed-the-most-successful-image-of-my-career%2F
4
5body: //div[contains(concat(' ',normalize-space(@class),' '),' post-content ')]
6test_url: https://iso.500px.com/how-i-post-processed-the-most-successful-image-of-my-career/
diff --git a/inc/3rdparty/site_config/standard/it-connect.fr.txt b/inc/3rdparty/site_config/standard/it-connect.fr.txt
new file mode 100644
index 00000000..80c95e68
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/it-connect.fr.txt
@@ -0,0 +1,9 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Fwww.it-connect.fr%2Fdebuter-avec-docker-et-les-containers-sous-debian-8%2F
4
5body: //div[contains(concat(' ',normalize-space(@class),' '),' post_inner_wrapper ')]
6
7strip_id_or_class: toc_container
8
9test_url: http://www.it-connect.fr/debuter-avec-docker-et-les-containers-sous-debian-8/
diff --git a/inc/3rdparty/site_config/standard/jsforcats.com.txt b/inc/3rdparty/site_config/standard/jsforcats.com.txt
new file mode 100644
index 00000000..f2699ef1
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/jsforcats.com.txt
@@ -0,0 +1,6 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Fjsforcats.com%2F
4
5body: //div[contains(concat(' ',normalize-space(@class),' '),' post-content ')]
6test_url: http://jsforcats.com/
diff --git a/inc/3rdparty/site_config/standard/lapin-blanc.blogs.docteo.net.txt b/inc/3rdparty/site_config/standard/lapin-blanc.blogs.docteo.net.txt
new file mode 100644
index 00000000..38835a90
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/lapin-blanc.blogs.docteo.net.txt
@@ -0,0 +1,6 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Flapin-blanc.blogs.docteo.net%2F2015%2F01%2F20%2Flencadrement-doctoral-deviendrait-il-un-sujet-dactualite%2F
4
5body: //div[contains(concat(' ',normalize-space(@class),' '),' entry-content ')]
6test_url: http://lapin-blanc.blogs.docteo.net/2015/01/20/lencadrement-doctoral-deviendrait-il-un-sujet-dactualite/
diff --git a/inc/3rdparty/site_config/standard/lececil.org.txt b/inc/3rdparty/site_config/standard/lececil.org.txt
new file mode 100644
index 00000000..8a38bbf3
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/lececil.org.txt
@@ -0,0 +1,6 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Fwww.lececil.org%2Fnode%2F7688
4
5body: //div[contains(concat(' ',normalize-space(@class),' '),' field-body ')]
6test_url: http://www.lececil.org/node/7688
diff --git a/inc/3rdparty/site_config/standard/metrocop.net.txt b/inc/3rdparty/site_config/standard/metrocop.net.txt
new file mode 100644
index 00000000..9535f125
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/metrocop.net.txt
@@ -0,0 +1,6 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Fmetrocop.net%2Fmythic-comics%2Fissue-1%2F
4
5body: //div[contains(concat(' ',normalize-space(@class),' '),' entry ')]
6test_url: http://metrocop.net/mythic-comics/issue-1/
diff --git a/inc/3rdparty/site_config/standard/n0where.net.txt b/inc/3rdparty/site_config/standard/n0where.net.txt
new file mode 100644
index 00000000..e91159ea
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/n0where.net.txt
@@ -0,0 +1,5 @@
1title://div[@class='main-title single-title entry-title']
2body://div[@id="content-anchor-inner"]
3date://meta[@content]
4
5strip: //noscript
diff --git a/inc/3rdparty/site_config/standard/pérotin.com.txt b/inc/3rdparty/site_config/standard/pérotin.com.txt
new file mode 100644
index 00000000..7784fa4c
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/pérotin.com.txt
@@ -0,0 +1,6 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=xn--protin-bva.com%2Fpost%2F2009%2F06%2F09%2FSAV-Free-un-sketch-kafkaien
4
5body: //div[contains(concat(' ',normalize-space(@class),' '),' post ')]
6test_url: http://xn--protin-bva.com/post/2009/06/09/SAV-Free-un-sketch-kafkaien
diff --git a/inc/3rdparty/site_config/standard/reddit.com.txt b/inc/3rdparty/site_config/standard/reddit.com.txt
index ba342c7c..c3f2d3e5 100755
--- a/inc/3rdparty/site_config/standard/reddit.com.txt
+++ b/inc/3rdparty/site_config/standard/reddit.com.txt
@@ -7,7 +7,9 @@ author: //p[@class="tagline"]/a
7# this doesn't work for some reason...? 7# this doesn't work for some reason...?
8date: //p[@class="tagline"]//@datetime 8date: //p[@class="tagline"]//@datetime
9 9
10body: (//div[contains(@class, 'noncollapsed')]//div[contains(@class, 'usertext-body')])[1] 10#body: (//div[contains(@class, 'noncollapsed')]//div[contains(@class, 'usertext-body')])[1]
11
12body: //div[contains(concat(' ',normalize-space(@class),' '),' usertext-body ') and (contains(concat(' ',normalize-space(@class),' '),' may-blank-within ')) and (contains(concat(' ',normalize-space(@class),' '),' md-container '))]//div[contains(concat(' ',normalize-space(@class),' '),' md ')]
11 13
12strip_id_or_class: tagline 14strip_id_or_class: tagline
13strip_id_or_class: unvotable-message 15strip_id_or_class: unvotable-message
@@ -18,4 +20,4 @@ single_page_link: //p[@class="title"]/a[contains(@href, 'http://')]
18 20
19test_url: http://www.reddit.com/r/truegaming/comments/wfe7r/i_wrote_about_the_problems_i_honestly_feel_that/ 21test_url: http://www.reddit.com/r/truegaming/comments/wfe7r/i_wrote_about_the_problems_i_honestly_feel_that/
20test_url: http://www.reddit.com/r/worldnews/comments/1as37r/twelve_north_korean_soldiers_attempting_to_defect/ 22test_url: http://www.reddit.com/r/worldnews/comments/1as37r/twelve_north_korean_soldiers_attempting_to_defect/
21test_url: http://www.reddit.com/r/WritingPrompts/comments/2786lw/wp_in_a_world_where_puns_are_illegal_one_man/chybk8e \ No newline at end of file 23test_url: http://www.reddit.com/r/WritingPrompts/comments/2786lw/wp_in_a_world_where_puns_are_illegal_one_man/chybk8e
diff --git a/inc/3rdparty/site_config/standard/spiil.org.txt b/inc/3rdparty/site_config/standard/spiil.org.txt
new file mode 100644
index 00000000..dd12fb88
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/spiil.org.txt
@@ -0,0 +1,6 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=https%3A%2F%2Fwww.spiil.org%2Fguide-bonnes-pratiques-editeurs-de-presse-ligne
4
5body: //div[contains(concat(' ',normalize-space(@class),' '),' node-content ')]
6test_url: https://www.spiil.org/guide-bonnes-pratiques-editeurs-de-presse-ligne
diff --git a/inc/3rdparty/site_config/standard/yosko.net.txt b/inc/3rdparty/site_config/standard/yosko.net.txt
new file mode 100644
index 00000000..99e711e3
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/yosko.net.txt
@@ -0,0 +1,6 @@
1# Generated by FiveFilters.org's web-based selection tool
2# Place this file inside your site_config/custom/ folder
3# Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Fwww.yosko.net%2Farticle33%2Fsnippet-06-javascript-capturer-des-raccourcis-clavier-utilises-par-votre-navigateur
4
5body: //article//section
6test_url: http://www.yosko.net/article33/snippet-06-javascript-capturer-des-raccourcis-clavier-utilises-par-votre-navigateur
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php
index 65675afe..7ec1602d 100755
--- a/inc/poche/Database.class.php
+++ b/inc/poche/Database.class.php
@@ -156,11 +156,14 @@ class Database {
156 { 156 {
157 $sql = "SELECT * FROM users_config WHERE user_id = ?"; 157 $sql = "SELECT * FROM users_config WHERE user_id = ?";
158 $query = $this->executeQuery($sql, array($id)); 158 $query = $this->executeQuery($sql, array($id));
159 $result = $query->fetchAll(); 159 $result = ($query) ? $query->fetchAll() : false;
160 $user_config = array(); 160 $user_config = false;
161 if ($query) {
162 $user_config = array();
161 163
162 foreach ($result as $key => $value) { 164 foreach ($result as $key => $value) {
163 $user_config[$value['name']] = $value['value']; 165 $user_config[$value['name']] = $value['value'];
166 }
164 } 167 }
165 168
166 return $user_config; 169 return $user_config;
@@ -171,11 +174,7 @@ class Database {
171 $sql = "SELECT * FROM users WHERE username=?"; 174 $sql = "SELECT * FROM users WHERE username=?";
172 $query = $this->executeQuery($sql, array($username)); 175 $query = $this->executeQuery($sql, array($username));
173 $login = $query->fetchAll(); 176 $login = $query->fetchAll();
174 if (isset($login[0])) { 177 return (isset($login[0]) && $query) ? true : false;
175 return true;
176 } else {
177 return false;
178 }
179 } 178 }
180 179
181 public function login($username, $password, $isauthenticated = FALSE) 180 public function login($username, $password, $isauthenticated = FALSE)
@@ -187,10 +186,10 @@ class Database {
187 $sql = "SELECT * FROM users WHERE username=? AND password=?"; 186 $sql = "SELECT * FROM users WHERE username=? AND password=?";
188 $query = $this->executeQuery($sql, array($username, $password)); 187 $query = $this->executeQuery($sql, array($username, $password));
189 } 188 }
190 $login = $query->fetchAll(); 189 $login = ($query) ? $query->fetchAll() : false;
191 190
192 $user = array(); 191 $user = array();
193 if (isset($login[0])) { 192 if ($login[0]) {
194 $user['id'] = $login[0]['id']; 193 $user['id'] = $login[0]['id'];
195 $user['username'] = $login[0]['username']; 194 $user['username'] = $login[0]['username'];
196 $user['password'] = $login[0]['password']; 195 $user['password'] = $login[0]['password'];
@@ -243,7 +242,7 @@ class Database {
243 { 242 {
244 $sql = 'SELECT count(*) FROM users'.( $username ? ' WHERE username=?' : ''); 243 $sql = 'SELECT count(*) FROM users'.( $username ? ' WHERE username=?' : '');
245 $query = $this->executeQuery($sql, ( $username ? array($username) : array())); 244 $query = $this->executeQuery($sql, ( $username ? array($username) : array()));
246 list($count) = $query->fetch(); 245 list($count) = ($query) ? $query->fetch() : false;
247 return $count; 246 return $count;
248 } 247 }
249 248
@@ -252,7 +251,7 @@ class Database {
252 $sql = "SELECT * FROM users WHERE id=?"; 251 $sql = "SELECT * FROM users WHERE id=?";
253 $query = $this->executeQuery($sql, array($userID)); 252 $query = $this->executeQuery($sql, array($userID));
254 $password = $query->fetchAll(); 253 $password = $query->fetchAll();
255 return isset($password[0]['password']) ? $password[0]['password'] : null; 254 return ($query) ? $password[0]['password'] : false;
256 } 255 }
257 256
258 public function deleteUserConfig($userID) 257 public function deleteUserConfig($userID)
@@ -260,18 +259,22 @@ class Database {
260 $sql_action = 'DELETE from users_config WHERE user_id=?'; 259 $sql_action = 'DELETE from users_config WHERE user_id=?';
261 $params_action = array($userID); 260 $params_action = array($userID);
262 $query = $this->executeQuery($sql_action, $params_action); 261 $query = $this->executeQuery($sql_action, $params_action);
263 return $query; 262 return ($query) ? $query : false;
264 } 263 }
265 264
266 public function deleteTagsEntriesAndEntries($userID) 265 public function deleteTagsEntriesAndEntries($userID)
267 { 266 {
268 $entries = $this->retrieveAll($userID); 267 $entries = $this->retrieveAll($userID);
269 foreach($entries as $entryid) { 268 if ($entries) {
270 $tags = $this->retrieveTagsByEntry($entryid); 269 foreach($entries as $entry) {
271 foreach($tags as $tag) { 270 $tags = $this->retrieveTagsByEntry($entry['id']);
272 $this->removeTagForEntry($entryid,$tags); 271 foreach($tags as $tag) {
272 $this->removeTagForEntry($entry['id'], $tags);
273 }
274 $this->deleteById($entryid,$userID);
273 } 275 }
274 $this->deleteById($entryid,$userID); 276 } else {
277 return false;
275 } 278 }
276 } 279 }
277 280
@@ -302,7 +305,7 @@ class Database {
302 $query = $this->executeQuery($sql, array($user_id)); 305 $query = $this->executeQuery($sql, array($user_id));
303 $entries = $query->fetchAll(); 306 $entries = $query->fetchAll();
304 307
305 return $entries; 308 return ($query) ? $entries : false;
306 } 309 }
307 310
308 public function retrieveUnfetchedEntriesCount($user_id) 311 public function retrieveUnfetchedEntriesCount($user_id)
@@ -320,29 +323,44 @@ class Database {
320 $query = $this->executeQuery($sql, array($user_id)); 323 $query = $this->executeQuery($sql, array($user_id));
321 $entries = $query->fetchAll(); 324 $entries = $query->fetchAll();
322 325
326 return ($query) ? $entries : false;
327 }
328
329 public function retrieveAllWithTags($user_id)
330 {
331 $entries = $this->retrieveAll($user_id);
332 if ($entries) {
333 $count = count($entries);
334 for ($i = 0; $i < $count; $i++) {
335 $tag_entries = $this->retrieveTagsByEntry($entries[$i]['id']);
336 $tags = [];
337 foreach ($tag_entries as $tag) {
338 $tags[] = $tag[1];
339 }
340 $entries[$i]['tags'] = implode(',', $tags);
341 }
342 }
323 return $entries; 343 return $entries;
324 } 344 }
325 345
326 public function retrieveOneById($id, $user_id) 346 public function retrieveOneById($id, $user_id)
327 { 347 {
328 $entry = NULL;
329 $sql = "SELECT * FROM entries WHERE id=? AND user_id=?"; 348 $sql = "SELECT * FROM entries WHERE id=? AND user_id=?";
330 $params = array(intval($id), $user_id); 349 $params = array(intval($id), $user_id);
331 $query = $this->executeQuery($sql, $params); 350 $query = $this->executeQuery($sql, $params);
332 $entry = $query->fetchAll(); 351 $entry = $query->fetchAll();
333 352
334 return isset($entry[0]) ? $entry[0] : null; 353 return ($query) ? $entry[0] : false;
335 } 354 }
336 355
337 public function retrieveOneByURL($url, $user_id) 356 public function retrieveOneByURL($url, $user_id)
338 { 357 {
339 $entry = NULL;
340 $sql = "SELECT * FROM entries WHERE url=? AND user_id=?"; 358 $sql = "SELECT * FROM entries WHERE url=? AND user_id=?";
341 $params = array($url, $user_id); 359 $params = array($url, $user_id);
342 $query = $this->executeQuery($sql, $params); 360 $query = $this->executeQuery($sql, $params);
343 $entry = $query->fetchAll(); 361 $entry = $query->fetchAll();
344 362
345 return isset($entry[0]) ? $entry[0] : null; 363 return ($query) ? $entry[0] : false;
346 } 364 }
347 365
348 public function reassignTags($old_entry_id, $new_entry_id) 366 public function reassignTags($old_entry_id, $new_entry_id)
@@ -380,7 +398,8 @@ class Database {
380 $query = $this->executeQuery($sql, $params); 398 $query = $this->executeQuery($sql, $params);
381 $entries = $query->fetchAll(); 399 $entries = $query->fetchAll();
382 400
383 return $entries; 401 return ($query) ? $entries : false;
402
384 } 403 }
385 404
386 public function getEntriesByViewCount($view, $user_id, $tag_id = 0) 405 public function getEntriesByViewCount($view, $user_id, $tag_id = 0)
@@ -407,17 +426,57 @@ class Database {
407 } 426 }
408 427
409 $query = $this->executeQuery($sql, $params); 428 $query = $this->executeQuery($sql, $params);
410 list($count) = $query->fetch(); 429 list($count) = ($query) ? $query->fetch() : array(false);
411 430
412 return $count; 431 return $count;
413 } 432 }
414 public function getRandomId($user_id) { 433 public function getRandomId($user_id, $view) {
415 $random = (STORAGE == 'mysql') ? 'RAND()' : 'RANDOM()'; 434 $random = (STORAGE == 'mysql') ? 'RAND()' : 'RANDOM()';
416 $sql = "SELECT id FROM entries WHERE user_id=? ORDER BY ". $random . " LIMIT 1"; 435 switch ($view) {
417 $params = array($user_id); 436 case 'archive':
437 $sql = "SELECT id FROM entries WHERE user_id=? AND is_read=? ORDER BY ". $random . " LIMIT 1";
438 $params = array($user_id,1);
439 break;
440 case 'fav':
441 $sql = "SELECT id FROM entries WHERE user_id=? AND is_fav=? ORDER BY ". $random . " LIMIT 1";
442 $params = array($user_id,1);
443 break;
444 default:
445 $sql = "SELECT id FROM entries WHERE user_id=? AND is_read=? ORDER BY ". $random . " LIMIT 1";
446 $params = array($user_id,0);
447 break;
448 }
418 $query = $this->executeQuery($sql, $params); 449 $query = $this->executeQuery($sql, $params);
419 $id = $query->fetchAll(); 450 $id = $query->fetchAll();
420 451
452 return ($query) ? $id : false;
453 }
454
455 public function getPreviousArticle($id, $user_id)
456 {
457 $sqlcondition = "is_read=0";
458 if (STORAGE == 'postgres') {
459 $sqlcondition = "is_read=false";
460 }
461 $sql = "SELECT id FROM entries WHERE id = (SELECT max(id) FROM entries WHERE id < ? AND " . $sqlcondition . ") AND user_id=? AND " . $sqlcondition;
462 $params = array($id, $user_id);
463 $query = $this->executeQuery($sql, $params);
464 $id_entry = ($query) ? $query->fetchAll() : false;
465 $id = ($query) ? $id_entry[0][0] : false;
466 return $id;
467 }
468
469 public function getNextArticle($id, $user_id)
470 {
471 $sqlcondition = "is_read=0";
472 if (STORAGE == 'postgres') {
473 $sqlcondition = "is_read=false";
474 }
475 $sql = "SELECT id FROM entries WHERE id = (SELECT min(id) FROM entries WHERE id > ? AND " . $sqlcondition . ") AND user_id=? AND " . $sqlcondition;
476 $params = array($id, $user_id);
477 $query = $this->executeQuery($sql, $params);
478 $id_entry = ($query) ? $query->fetchAll() : false;
479 $id = ($query) ? $id_entry[0][0] : false;
421 return $id; 480 return $id;
422 } 481 }
423 482
@@ -493,7 +552,7 @@ class Database {
493 $sql_action .= $this->getEntriesOrder().' ' . $limit; 552 $sql_action .= $this->getEntriesOrder().' ' . $limit;
494 $params_action = array($user_id, $search, $search, $search); 553 $params_action = array($user_id, $search, $search, $search);
495 $query = $this->executeQuery($sql_action, $params_action); 554 $query = $this->executeQuery($sql_action, $params_action);
496 return $query->fetchAll(); 555 return ($query) ? $query->fetchAll() : false;
497 } 556 }
498 557
499 public function retrieveAllTags($user_id, $term = NULL) 558 public function retrieveAllTags($user_id, $term = NULL)
@@ -506,23 +565,23 @@ class Database {
506 GROUP BY tags.id, tags.value 565 GROUP BY tags.id, tags.value
507 ORDER BY tags.value"; 566 ORDER BY tags.value";
508 $query = $this->executeQuery($sql, (($term)? array($user_id, strtolower('%'.$term.'%')) : array($user_id) )); 567 $query = $this->executeQuery($sql, (($term)? array($user_id, strtolower('%'.$term.'%')) : array($user_id) ));
509 $tags = $query->fetchAll(); 568 $tags = ($query) ? $query->fetchAll() : false;
510 569
511 return $tags; 570 return $tags;
512 } 571 }
513 572
514 public function retrieveTag($id, $user_id) 573 public function retrieveTag($id, $user_id)
515 { 574 {
516 $tag = NULL;
517 $sql = "SELECT DISTINCT tags.* FROM tags 575 $sql = "SELECT DISTINCT tags.* FROM tags
518 LEFT JOIN tags_entries ON tags_entries.tag_id=tags.id 576 LEFT JOIN tags_entries ON tags_entries.tag_id=tags.id
519 LEFT JOIN entries ON tags_entries.entry_id=entries.id 577 LEFT JOIN entries ON tags_entries.entry_id=entries.id
520 WHERE tags.id=? AND entries.user_id=?"; 578 WHERE tags.id=? AND entries.user_id=?";
521 $params = array(intval($id), $user_id); 579 $params = array(intval($id), $user_id);
522 $query = $this->executeQuery($sql, $params); 580 $query = $this->executeQuery($sql, $params);
523 $tag = $query->fetchAll(); 581 $tags = ($query) ? $query->fetchAll() : false;
582 $tag = ($query) ? $tags[0] : false;
524 583
525 return isset($tag[0]) ? $tag[0] : NULL; 584 return $tag[0];
526 } 585 }
527 586
528 public function retrieveEntriesByTag($tag_id, $user_id) 587 public function retrieveEntriesByTag($tag_id, $user_id)
@@ -532,7 +591,7 @@ class Database {
532 LEFT JOIN tags_entries ON tags_entries.entry_id=entries.id 591 LEFT JOIN tags_entries ON tags_entries.entry_id=entries.id
533 WHERE tags_entries.tag_id = ? AND entries.user_id=? ORDER by entries.id DESC"; 592 WHERE tags_entries.tag_id = ? AND entries.user_id=? ORDER by entries.id DESC";
534 $query = $this->executeQuery($sql, array($tag_id, $user_id)); 593 $query = $this->executeQuery($sql, array($tag_id, $user_id));
535 $entries = $query->fetchAll(); 594 $entries = ($query) ? $query->fetchAll() : false;
536 595
537 return $entries; 596 return $entries;
538 } 597 }
@@ -544,7 +603,7 @@ class Database {
544 LEFT JOIN tags_entries ON tags_entries.tag_id=tags.id 603 LEFT JOIN tags_entries ON tags_entries.tag_id=tags.id
545 WHERE tags_entries.entry_id = ?"; 604 WHERE tags_entries.entry_id = ?";
546 $query = $this->executeQuery($sql, array($entry_id)); 605 $query = $this->executeQuery($sql, array($entry_id));
547 $tags = $query->fetchAll(); 606 $tags = ($query) ? $query->fetchAll() : false;
548 607
549 return $tags; 608 return $tags;
550 } 609 }
@@ -554,38 +613,40 @@ class Database {
554 $sql_action = "DELETE FROM tags_entries WHERE tag_id=? AND entry_id=?"; 613 $sql_action = "DELETE FROM tags_entries WHERE tag_id=? AND entry_id=?";
555 $params_action = array($tag_id, $entry_id); 614 $params_action = array($tag_id, $entry_id);
556 $query = $this->executeQuery($sql_action, $params_action); 615 $query = $this->executeQuery($sql_action, $params_action);
557 return $query; 616 return ($query) ? $query : false;
558 } 617 }
559 618
560 public function cleanUnusedTag($tag_id) 619 public function cleanUnusedTag($tag_id)
561 { 620 {
562 $sql_action = "SELECT tags.* FROM tags JOIN tags_entries ON tags_entries.tag_id=tags.id WHERE tags.id=?"; 621 $sql_action = "SELECT tags.* FROM tags JOIN tags_entries ON tags_entries.tag_id=tags.id WHERE tags.id=?";
563 $query = $this->executeQuery($sql_action,array($tag_id)); 622 $query = $this->executeQuery($sql_action,array($tag_id));
564 $tagstokeep = $query->fetchAll(); 623 $tagstokeep = ($query) ? $query->fetchAll() : false;
565 $sql_action = "SELECT tags.* FROM tags LEFT JOIN tags_entries ON tags_entries.tag_id=tags.id WHERE tags.id=?"; 624 $sql_action = "SELECT tags.* FROM tags LEFT JOIN tags_entries ON tags_entries.tag_id=tags.id WHERE tags.id=?";
566 $query = $this->executeQuery($sql_action,array($tag_id)); 625 $query = $this->executeQuery($sql_action,array($tag_id));
567 $alltags = $query->fetchAll(); 626 $alltags = ($query) ? $query->fetchAll() : false;
568 627
569 foreach ($alltags as $tag) { 628 if ($tagstokeep && $alltags) {
570 if ($tag && !in_array($tag,$tagstokeep)) { 629 foreach ($alltags as $tag) {
571 $sql_action = "DELETE FROM tags WHERE id=?"; 630 if ($tag && !in_array($tag,$tagstokeep)) {
572 $params_action = array($tag[0]); 631 $sql_action = "DELETE FROM tags WHERE id=?";
573 $this->executeQuery($sql_action, $params_action); 632 $params_action = array($tag[0]);
574 return true; 633 $this->executeQuery($sql_action, $params_action);
634 return true;
635 }
575 } 636 }
637 } else {
638 return false;
576 } 639 }
577
578 } 640 }
579 641
580 public function retrieveTagByValue($value) 642 public function retrieveTagByValue($value)
581 { 643 {
582 $tag = NULL;
583 $sql = "SELECT * FROM tags WHERE value=?"; 644 $sql = "SELECT * FROM tags WHERE value=?";
584 $params = array($value); 645 $params = array($value);
585 $query = $this->executeQuery($sql, $params); 646 $query = $this->executeQuery($sql, $params);
586 $tag = $query->fetchAll(); 647 $tag = ($query) ? $query->fetchAll() : false;
587 648
588 return isset($tag[0]) ? $tag[0] : null; 649 return ($query) ? $tag[0] : false;
589 } 650 }
590 651
591 public function createTag($value) 652 public function createTag($value)
@@ -593,7 +654,7 @@ class Database {
593 $sql_action = 'INSERT INTO tags ( value ) VALUES (?)'; 654 $sql_action = 'INSERT INTO tags ( value ) VALUES (?)';
594 $params_action = array($value); 655 $params_action = array($value);
595 $query = $this->executeQuery($sql_action, $params_action); 656 $query = $this->executeQuery($sql_action, $params_action);
596 return $query; 657 return ($query) ? $query : false;
597 } 658 }
598 659
599 public function setTagToEntry($tag_id, $entry_id) 660 public function setTagToEntry($tag_id, $entry_id)
@@ -601,7 +662,7 @@ class Database {
601 $sql_action = 'INSERT INTO tags_entries ( tag_id, entry_id ) VALUES (?, ?)'; 662 $sql_action = 'INSERT INTO tags_entries ( tag_id, entry_id ) VALUES (?, ?)';
602 $params_action = array($tag_id, $entry_id); 663 $params_action = array($tag_id, $entry_id);
603 $query = $this->executeQuery($sql_action, $params_action); 664 $query = $this->executeQuery($sql_action, $params_action);
604 return $query; 665 return ($query) ? $query : false;
605 } 666 }
606 667
607 private function getEntriesOrder() 668 private function getEntriesOrder()
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index fd2600f3..15d83bfe 100755
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -200,27 +200,34 @@ class Poche
200 200
201 //search for possible duplicate 201 //search for possible duplicate
202 $duplicate = NULL; 202 $duplicate = NULL;
203 $duplicate = $this->store->retrieveOneByURL($url->getUrl(), $this->user->getId()); 203 $clean_url = $url->getUrl();
204 204
205 $last_id = $this->store->add($url->getUrl(), $title, $body, $this->user->getId()); 205 // Clean URL to remove parameters from feedburner and all this stuff. Taken from Shaarli.
206 $i=strpos($clean_url,'&utm_source='); if ($i!==false) $clean_url=substr($clean_url,0,$i);
207 $i=strpos($clean_url,'?utm_source='); if ($i!==false) $clean_url=substr($clean_url,0,$i);
208 $i=strpos($clean_url,'#xtor=RSS-'); if ($i!==false) $clean_url=substr($clean_url,0,$i);
209
210 $duplicate = $this->store->retrieveOneByURL($clean_url, $this->user->getId());
211
212 $last_id = $this->store->add($clean_url, $title, $body, $this->user->getId());
206 if ( $last_id ) { 213 if ( $last_id ) {
207 Tools::logm('add link ' . $url->getUrl()); 214 Tools::logm('add link ' . $clean_url);
208 if (DOWNLOAD_PICTURES) { 215 if (DOWNLOAD_PICTURES) {
209 $content = Picture::filterPicture($body, $url->getUrl(), $last_id); 216 $content = Picture::filterPicture($body, $clean_url, $last_id);
210 Tools::logm('updating content article'); 217 Tools::logm('updating content article');
211 $this->store->updateContent($last_id, $content, $this->user->getId()); 218 $this->store->updateContent($last_id, $content, $this->user->getId());
212 } 219 }
213 220
214 if ($duplicate != NULL) { 221 if ($duplicate != NULL) {
215 // duplicate exists, so, older entry needs to be deleted (as new entry should go to the top of list), BUT favorite mark and tags should be preserved 222 // duplicate exists, so, older entry needs to be deleted (as new entry should go to the top of list), BUT favorite mark and tags should be preserved
216 Tools::logm('link ' . $url->getUrl() . ' is a duplicate'); 223 Tools::logm('link ' . $clean_url . ' is a duplicate');
217 // 1) - preserve tags and favorite, then drop old entry 224 // 1) - preserve tags and favorite, then drop old entry
218 $this->store->reassignTags($duplicate['id'], $last_id); 225 $this->store->reassignTags($duplicate['id'], $last_id);
219 if ($duplicate['is_fav']) { 226 if ($duplicate['is_fav']) {
220 $this->store->favoriteById($last_id, $this->user->getId()); 227 $this->store->favoriteById($last_id, $this->user->getId());
221 } 228 }
222 if ($this->store->deleteById($duplicate['id'], $this->user->getId())) { 229 if ($this->store->deleteById($duplicate['id'], $this->user->getId())) {
223 Tools::logm('previous link ' . $url->getUrl() .' entry deleted'); 230 Tools::logm('previous link ' . $clean_url .' entry deleted');
224 } 231 }
225 } 232 }
226 233
@@ -235,7 +242,7 @@ class Poche
235 } 242 }
236 else { 243 else {
237 $this->messages->add('e', _('error during insertion : the link wasn\'t added')); 244 $this->messages->add('e', _('error during insertion : the link wasn\'t added'));
238 Tools::logm('error during insertion : the link wasn\'t added ' . $url->getUrl()); 245 Tools::logm('error during insertion : the link wasn\'t added ' . $clean_url);
239 } 246 }
240 247
241 if ($autoclose == TRUE) { 248 if ($autoclose == TRUE) {
@@ -259,6 +266,15 @@ class Poche
259 } 266 }
260 foreach($entry_ids as $id) { 267 foreach($entry_ids as $id) {
261 $msg = 'delete link #' . $id; 268 $msg = 'delete link #' . $id;
269
270 // deleting tags and tags_entries
271 $tags = $this->store->retrieveTagsByEntry($id);
272 foreach ($tags as $tag) {
273 $this->store->removeTagForEntry($id, $tag['id']);
274 $this->store->cleanUnusedTag($tag['id']);
275 }
276
277 // deleting pictures
262 if ($this->store->deleteById($id, $this->user->getId())) { 278 if ($this->store->deleteById($id, $this->user->getId())) {
263 if (DOWNLOAD_PICTURES) { 279 if (DOWNLOAD_PICTURES) {
264 Picture::removeDirectory(ABS_PATH . $id); 280 Picture::removeDirectory(ABS_PATH . $id);
@@ -303,11 +319,16 @@ class Poche
303 if ( Tools::isAjaxRequest() ) { 319 if ( Tools::isAjaxRequest() ) {
304 echo 1; 320 echo 1;
305 exit; 321 exit;
306 } 322 } else {
307 else {
308 Tools::redirect(); 323 Tools::redirect();
309 } 324 }
310 break; 325 break;
326 case 'archive_and_next' :
327 $nextid = $this->store->getPreviousArticle($id, $this->user->getId());
328 $this->store->archiveById($id, $this->user->getId());
329 Tools::logm('archive link #' . $id);
330 Tools::redirect('?view=view&id=' . $nextid);
331 break;
311 case 'archive_all' : 332 case 'archive_all' :
312 $this->store->archiveAll($this->user->getId()); 333 $this->store->archiveAll($this->user->getId());
313 Tools::logm('archive all links'); 334 Tools::logm('archive all links');
@@ -394,8 +415,9 @@ class Poche
394 /* For some unknown reason I can't get displayView() to work here (it redirects to home view afterwards). So here's a dirty fix which redirects directly to URL */ 415 /* For some unknown reason I can't get displayView() to work here (it redirects to home view afterwards). So here's a dirty fix which redirects directly to URL */
395 case 'random': 416 case 'random':
396 Tools::logm('get a random article'); 417 Tools::logm('get a random article');
397 if ($this->store->getRandomId($this->user->getId())) { 418 $view = $_GET['view'];
398 $id_array = $this->store->getRandomId($this->user->getId()); 419 if ($this->store->getRandomId($this->user->getId(),$view)) {
420 $id_array = $this->store->getRandomId($this->user->getId(),$view);
399 $id = $id_array[0]; 421 $id = $id_array[0];
400 Tools::redirect('?view=view&id=' . $id[0]); 422 Tools::redirect('?view=view&id=' . $id[0]);
401 Tools::logm('got the article with id ' . $id[0]); 423 Tools::logm('got the article with id ' . $id[0]);
@@ -453,9 +475,31 @@ class Poche
453 Tools::redirect(); 475 Tools::redirect();
454 } 476 }
455 $tags = $this->store->retrieveTagsByEntry($id); 477 $tags = $this->store->retrieveTagsByEntry($id);
478 $all_tags = $this->store->retrieveAllTags($this->user->getId());
479 $maximus = 0;
480 foreach ($all_tags as $eachtag) { // search for the most times a tag is present
481 if ($eachtag["entriescount"] > $maximus) $maximus = $eachtag["entriescount"];
482 }
483 foreach ($all_tags as $key => $eachtag) { // get the percentage of presence of each tag
484 $percent = floor(($eachtag["entriescount"] / $maximus) * 100);
485
486 if ($percent < 20): // assign a css class, depending on the number of entries count
487 $cssclass = 'smallesttag';
488 elseif ($percent >= 20 and $percent < 40):
489 $cssclass = 'smalltag';
490 elseif ($percent >= 40 and $percent < 60):
491 $cssclass = 'mediumtag';
492 elseif ($percent >= 60 and $percent < 80):
493 $cssclass = 'largetag';
494 else:
495 $cssclass = 'largesttag';
496 endif;
497 $all_tags[$key]['cssclass'] = $cssclass;
498 }
456 $tpl_vars = array( 499 $tpl_vars = array(
457 'entry_id' => $id, 500 'entry_id' => $id,
458 'tags' => $tags, 501 'tags' => $tags,
502 'alltags' => $all_tags,
459 'entry' => $entry, 503 'entry' => $entry,
460 ); 504 );
461 break; 505 break;
@@ -509,6 +553,20 @@ class Poche
509 $flattr->checkItem($entry['url'], $entry['id']); 553 $flattr->checkItem($entry['url'], $entry['id']);
510 } 554 }
511 555
556 # previous and next
557 $previous = FALSE;
558 $previous_id = $this->store->getPreviousArticle($id, $this->user->getId());
559 $next = FALSE;
560 $next_id = $this->store->getNextArticle($id, $this->user->getId());
561
562 if ($this->store->retrieveOneById($previous_id, $this->user->getId())) {
563 $previous = TRUE;
564 }
565 if ($this->store->retrieveOneById($next_id, $this->user->getId())) {
566 $next = TRUE;
567 }
568 $navigate = array('previous' => $previous, 'previousid' => $previous_id, 'next' => $next, 'nextid' => $next_id);
569
512 # tags 570 # tags
513 $tags = $this->store->retrieveTagsByEntry($entry['id']); 571 $tags = $this->store->retrieveTagsByEntry($entry['id']);
514 572
@@ -516,7 +574,8 @@ class Poche
516 'entry' => $entry, 574 'entry' => $entry,
517 'content' => $content, 575 'content' => $content,
518 'flattr' => $flattr, 576 'flattr' => $flattr,
519 'tags' => $tags 577 'tags' => $tags,
578 'navigate' => $navigate
520 ); 579 );
521 } 580 }
522 else { 581 else {
@@ -529,6 +588,7 @@ class Poche
529 'page_links' => '', 588 'page_links' => '',
530 'nb_results' => '', 589 'nb_results' => '',
531 'listmode' => (isset($_COOKIE['listmode']) ? true : false), 590 'listmode' => (isset($_COOKIE['listmode']) ? true : false),
591 'view' => $view,
532 ); 592 );
533 593
534 //if id is given - we retrieve entries by tag: id is tag id 594 //if id is given - we retrieve entries by tag: id is tag id
@@ -539,7 +599,7 @@ class Poche
539 599
540 $count = $this->store->getEntriesByViewCount($view, $this->user->getId(), $id); 600 $count = $this->store->getEntriesByViewCount($view, $this->user->getId(), $id);
541 601
542 if ($count > 0) { 602 if ($count && $count > 0) {
543 $this->pagination->set_total($count); 603 $this->pagination->set_total($count);
544 $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')), 604 $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')),
545 $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . (($id)?'&id='.$id:'') . '&' )); 605 $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . (($id)?'&id='.$id:'') . '&' ));
@@ -635,6 +695,7 @@ class Poche
635 setlocale(LC_ALL, $language); 695 setlocale(LC_ALL, $language);
636 bindtextdomain($language, LOCALE); 696 bindtextdomain($language, LOCALE);
637 textdomain($language); 697 textdomain($language);
698 bind_textdomain_codeset($language, 'UTF-8');
638 699
639 $this->messages->add('s', _('welcome to your wallabag')); 700 $this->messages->add('s', _('welcome to your wallabag'));
640 Tools::logm('login successful'); 701 Tools::logm('login successful');
@@ -681,23 +742,45 @@ class Poche
681 $html->load_file($_FILES['file']['tmp_name']); 742 $html->load_file($_FILES['file']['tmp_name']);
682 $data = array(); 743 $data = array();
683 $read = 0; 744 $read = 0;
684 foreach (array('ol','ul') as $list) { 745
685 foreach ($html->find($list) as $ul) { 746 if (Tools::get_doctype($html)->innertext == "<!DOCTYPE NETSCAPE-Bookmark-file-1>") {
686 foreach ($ul->find('li') as $li) { 747 // Firefox-bookmarks HTML
687 $tmpEntry = array(); 748 foreach (array('DL','ul') as $list) {
688 $a = $li->find('a'); 749 foreach ($html->find($list) as $ul) {
689 $tmpEntry['url'] = $a[0]->href; 750 foreach ($ul->find('DT') as $li) {
690 $tmpEntry['tags'] = $a[0]->tags; 751 $tmpEntry = array();
691 $tmpEntry['is_read'] = $read; 752 $a = $li->find('A');
692 if ($tmpEntry['url']) { 753 $tmpEntry['url'] = $a[0]->href;
693 $data[] = $tmpEntry; 754 $tmpEntry['tags'] = $a[0]->tags;
755 $tmpEntry['is_read'] = $read;
756 if ($tmpEntry['url']) {
757 $data[] = $tmpEntry;
758 }
694 } 759 }
695 } 760 # the second <ol/ul> is for read links
696 # the second <ol/ul> is for read links 761 $read = ((sizeof($data) && $read)?0:1);
697 $read = ((sizeof($data) && $read)?0:1); 762 }
698 } 763 }
699 } 764 } else {
700 } 765 // regular HTML
766 foreach (array('ol','ul') as $list) {
767 foreach ($html->find($list) as $ul) {
768 foreach ($ul->find('li') as $li) {
769 $tmpEntry = array();
770 $a = $li->find('a');
771 $tmpEntry['url'] = $a[0]->href;
772 $tmpEntry['tags'] = $a[0]->tags;
773 $tmpEntry['is_read'] = $read;
774 if ($tmpEntry['url']) {
775 $data[] = $tmpEntry;
776 }
777 }
778 # the second <ol/ul> is for read links
779 $read = ((sizeof($data) && $read)?0:1);
780 }
781 }
782 }
783 }
701 784
702 // for readability structure 785 // for readability structure
703 786
@@ -715,7 +798,7 @@ class Poche
715 $urlsInserted = array(); //urls of articles inserted 798 $urlsInserted = array(); //urls of articles inserted
716 foreach($data as $record) { 799 foreach($data as $record) {
717 $url = trim(isset($record['article__url']) ? $record['article__url'] : (isset($record['url']) ? $record['url'] : '')); 800 $url = trim(isset($record['article__url']) ? $record['article__url'] : (isset($record['url']) ? $record['url'] : ''));
718 if ($url and !in_array($url, $urlsInserted)) { 801 if (filter_var($url, FILTER_VALIDATE_URL) and !in_array($url, $urlsInserted)) {
719 $title = (isset($record['title']) ? $record['title'] : _('Untitled - Import - ') . '</a> <a href="./?import">' . _('click to finish import') . '</a><a>'); 802 $title = (isset($record['title']) ? $record['title'] : _('Untitled - Import - ') . '</a> <a href="./?import">' . _('click to finish import') . '</a><a>');
720 $body = (isset($record['content']) ? $record['content'] : ''); 803 $body = (isset($record['content']) ? $record['content'] : '');
721 $isRead = (isset($record['is_read']) ? intval($record['is_read']) : (isset($record['archive']) ? intval($record['archive']) : 0)); 804 $isRead = (isset($record['is_read']) ? intval($record['is_read']) : (isset($record['archive']) ? intval($record['archive']) : 0));
@@ -820,14 +903,18 @@ class Poche
820 */ 903 */
821 public function export() 904 public function export()
822 { 905 {
823 $filename = "wallabag-export-".$this->user->getId()."-".date("Y-m-d").".json"; 906 $filename = "wallabag-export-".$this->user->getId()."-".date("Y-m-d").".json";
824 header('Content-Disposition: attachment; filename='.$filename); 907 header('Content-Disposition: attachment; filename='.$filename);
825 908
826 $entries = $this->store->retrieveAll($this->user->getId()); 909 $entries = $this->store->retrieveAllWithTags($this->user->getId());
827 echo $this->tpl->render('export.twig', array( 910 if ($entries) {
828 'export' => Tools::renderJson($entries), 911 echo $this->tpl->render('export.twig', array(
829 )); 912 'export' => Tools::renderJson($entries),
830 Tools::logm('export view'); 913 ));
914 Tools::logm('export view');
915 } else {
916 Tools::logm('error accessing database while exporting');
917 }
831 } 918 }
832 919
833 /** 920 /**
@@ -903,7 +990,7 @@ class Poche
903 if (0 == $limit) { 990 if (0 == $limit) {
904 $limit = count($entries); 991 $limit = count($entries);
905 } 992 }
906 if (count($entries) > 0) { 993 if ($entries && count($entries) > 0) {
907 for ($i = 0; $i < min(count($entries), $limit); $i++) { 994 for ($i = 0; $i < min(count($entries), $limit); $i++) {
908 $entry = $entries[$i]; 995 $entry = $entries[$i];
909 $newItem = $feed->createNewItem(); 996 $newItem = $feed->createNewItem();
@@ -915,7 +1002,10 @@ class Poche
915 $feed->addItem($newItem); 1002 $feed->addItem($newItem);
916 } 1003 }
917 } 1004 }
918 1005 else
1006 {
1007 Tools::logm("database error while generating feeds");
1008 }
919 $feed->genarateFeed(); 1009 $feed->genarateFeed();
920 exit; 1010 exit;
921 } 1011 }
diff --git a/inc/poche/Routing.class.php b/inc/poche/Routing.class.php
index 177b74d5..33a81435 100755
--- a/inc/poche/Routing.class.php
+++ b/inc/poche/Routing.class.php
@@ -15,6 +15,7 @@ class Routing
15 protected $view; 15 protected $view;
16 protected $action; 16 protected $action;
17 protected $id; 17 protected $id;
18 protected $autoclose;
18 protected $url; 19 protected $url;
19 protected $file; 20 protected $file;
20 protected $defaultVars = array(); 21 protected $defaultVars = array();
@@ -111,9 +112,7 @@ class Routing
111 $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0); 112 $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0);
112 $limit = (isset($_GET['limit']) ? intval($_GET['limit']) : 0); 113 $limit = (isset($_GET['limit']) ? intval($_GET['limit']) : 0);
113 $this->wallabag->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type'], $limit); 114 $this->wallabag->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type'], $limit);
114 } //elseif (ALLOW_REGISTER && isset($_GET['register'])) { 115 }
115 //$this->wallabag->register
116 //}
117 116
118 //allowed ONLY to logged in user 117 //allowed ONLY to logged in user
119 if (\Session::isLogged() === true) 118 if (\Session::isLogged() === true)
@@ -142,7 +141,7 @@ class Routing
142 $pdf->producePDF(); 141 $pdf->producePDF();
143 } elseif (isset($_GET['import'])) { 142 } elseif (isset($_GET['import'])) {
144 $import = $this->wallabag->import(); 143 $import = $this->wallabag->import();
145 $tplVars = array_merge($this->vars, $import); 144 $this->vars = array_merge($this->vars, $import);
146 } elseif (isset($_GET['empty-cache'])) { 145 } elseif (isset($_GET['empty-cache'])) {
147 Tools::emptyCache(); 146 Tools::emptyCache();
148 } elseif (isset($_GET['export'])) { 147 } elseif (isset($_GET['export'])) {
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php
index d0b31d4f..f3d1013f 100755
--- a/inc/poche/Tools.class.php
+++ b/inc/poche/Tools.class.php
@@ -392,8 +392,11 @@ final class Tools
392 ); 392 );
393 393
394 foreach ($files as $fileInfo) { 394 foreach ($files as $fileInfo) {
395 $todo = ($fileInfo->isDir() ? 'rmdir' : 'unlink'); 395 $filename = $fileInfo->getFilename();
396 $todo($fileInfo->getRealPath()); 396 if (!$filename[0] == '.') {
397 $todo = ($fileInfo->isDir() ? 'rmdir' : 'unlink');
398 $todo($fileInfo->getRealPath());
399 }
397 } 400 }
398 401
399 Tools::logm('empty cache'); 402 Tools::logm('empty cache');
@@ -417,4 +420,23 @@ final class Tools
417 return str_replace('+', '', $token); 420 return str_replace('+', '', $token);
418 } 421 }
419 422
423 /**
424 *
425 * Returns the doctype for an HTML document (used for Mozilla Bookmarks)
426 * @param simple_html_dom $doc
427 * @return doctype $el
428 *
429 */
430
431 public static function get_doctype($doc)
432 {
433 $els = $doc->find('unknown');
434
435 foreach ($els as $e => $el)
436 if ($el->parent()->tag == 'root')
437 return $el;
438
439 return NULL;
440 }
441
420} 442}
diff --git a/inc/poche/WallabagEBooks.class.php b/inc/poche/WallabagEBooks.class.php
index 55831571..ec1e4b27 100644
--- a/inc/poche/WallabagEBooks.class.php
+++ b/inc/poche/WallabagEBooks.class.php
@@ -96,7 +96,6 @@ class WallabagEpub extends WallabagEBooks
96 $bookEnd = "</body>\n</html>\n"; 96 $bookEnd = "</body>\n</html>\n";
97 97
98 $log = new Logger("wallabag", TRUE); 98 $log = new Logger("wallabag", TRUE);
99 $fileDir = CACHE;
100 99
101 $book = new EPub(EPub::BOOK_VERSION_EPUB3, DEBUG_POCHE); 100 $book = new EPub(EPub::BOOK_VERSION_EPUB3, DEBUG_POCHE);
102 $log->logLine("new EPub()"); 101 $log->logLine("new EPub()");
@@ -121,8 +120,12 @@ class WallabagEpub extends WallabagEBooks
121 $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP"); 120 $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP");
122 $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "wallabag"); 121 $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "wallabag");
123 122
124 $cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n"; 123 /*
125 124 * Line not used but planned to be used
125 *
126 *$cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n";
127 */
128
126 $log->logLine("Add Cover"); 129 $log->logLine("Add Cover");
127 130
128 $fullTitle = "<h1> " . $this->bookTitle . "</h1>\n"; 131 $fullTitle = "<h1> " . $this->bookTitle . "</h1>\n";
@@ -180,8 +183,6 @@ class WallabagMobi extends WallabagEBooks
180 $mobi = new MOBI(); 183 $mobi = new MOBI();
181 $content = new MOBIFile(); 184 $content = new MOBIFile();
182 185
183 $messages = new Messages(); // for later
184
185 Tools::logm('Filling metadata for Mobi...'); 186 Tools::logm('Filling metadata for Mobi...');
186 187
187 $content->set("title", $this->bookTitle); 188 $content->set("title", $this->bookTitle);
@@ -243,10 +244,9 @@ class WallabagPDF extends WallabagEbooks
243 244
244 $pdf->writeHTMLCell(0, 0, '', '', $intro, 0, 1, 0, true, '', true); 245 $pdf->writeHTMLCell(0, 0, '', '', $intro, 0, 1, 0, true, '', true);
245 246
246 $i = 1;
247 Tools::logm('Adding actual content...'); 247 Tools::logm('Adding actual content...');
248 foreach ($this->entries as $item) { 248 foreach ($this->entries as $item) {
249 $tags = $this->wallabag->store->retrieveTagsByEntry($entry['id']); 249 $tags = $this->wallabag->store->retrieveTagsByEntry($item['id']);
250 foreach ($tags as $tag) { 250 foreach ($tags as $tag) {
251 $pdf->SetKeywords($tag['value']); 251 $pdf->SetKeywords($tag['value']);
252 } 252 }
@@ -260,7 +260,7 @@ class WallabagPDF extends WallabagEbooks
260 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); 260 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
261 261
262 262
263 $pdf->Output($this->bookFileName . '.pdf', 'FD'); 263 $pdf->Output('cache/' . $this->bookFileName . '.pdf', 'FD');
264 } 264 }
265 catch (Exception $e) { 265 catch (Exception $e) {
266 Tools::logm('TCPDF has encountered an error : '.$e->getMessage()); 266 Tools::logm('TCPDF has encountered an error : '.$e->getMessage());