diff options
Diffstat (limited to 'inc')
20 files changed, 97 insertions, 18 deletions
diff --git a/inc/3rdparty/libraries/PHPePub/Zip.php b/inc/3rdparty/libraries/PHPePub/Zip.php index 01e03566..92e78e70 100644 --- a/inc/3rdparty/libraries/PHPePub/Zip.php +++ b/inc/3rdparty/libraries/PHPePub/Zip.php | |||
@@ -569,7 +569,7 @@ class Zip { | |||
569 | if ($inline) { | 569 | if ($inline) { |
570 | $cd .= "inline"; | 570 | $cd .= "inline"; |
571 | } else{ | 571 | } else{ |
572 | $cd .= "attached"; | 572 | $cd .= "attachment"; |
573 | } | 573 | } |
574 | if ($fileName) { | 574 | if ($fileName) { |
575 | $cd .= '; filename="' . $fileName . '"'; | 575 | $cd .= '; filename="' . $fileName . '"'; |
diff --git a/inc/3rdparty/site_config/standard/aclu.org.txt b/inc/3rdparty/site_config/standard/aclu.org.txt new file mode 100644 index 00000000..74236e2d --- /dev/null +++ b/inc/3rdparty/site_config/standard/aclu.org.txt | |||
@@ -0,0 +1,5 @@ | |||
1 | body: //div[@class='panel-panel panel-main-3 content-column'] | ||
2 | title: //div[@class='panel-pane pane-node-title'] | ||
3 | date: //div[@class='updated-date'] | ||
4 | |||
5 | test_url: https://www.aclu.org/blog/free-future/chinas-nightmarish-citizen-scores-are-warning-americans | ||
diff --git a/inc/3rdparty/site_config/standard/bez.es.txt b/inc/3rdparty/site_config/standard/bez.es.txt new file mode 100644 index 00000000..cab7c6f7 --- /dev/null +++ b/inc/3rdparty/site_config/standard/bez.es.txt | |||
@@ -0,0 +1,5 @@ | |||
1 | body: //div[@class='text_art'] | ||
2 | strip: //div[@class='cab_datos_opinion'] | ||
3 | strip: //div[@class='sumario2_left'] | ||
4 | |||
5 | test_url: http://www.bez.es/382758623/otros-fracasos-empresas.html | ||
diff --git a/inc/3rdparty/site_config/standard/blog.cloudflare.com.txt b/inc/3rdparty/site_config/standard/blog.cloudflare.com.txt index db80a35f..2f9a5a2f 100755 --- a/inc/3rdparty/site_config/standard/blog.cloudflare.com.txt +++ b/inc/3rdparty/site_config/standard/blog.cloudflare.com.txt | |||
@@ -1,9 +1,10 @@ | |||
1 | # Instapaper gets this back to front and only gets the blog title instead of the article title. | 1 | # Instapaper gets this back to front and only gets the blog title instead of the article title. |
2 | title: substring-before(//title, '-') | 2 | title: //div[@class='title'] |
3 | 3 | ||
4 | author: //a[ contains(@href, '/people') ] | 4 | author: //a[ contains(@href, '/people') ] |
5 | 5 | ||
6 | body: //div[ @class='post' ] | 6 | body: //div[ @class='post-content' ] |
7 | 7 | ||
8 | # Date is impossible to retrieve since they use those stupid "fuzzy" dates, inserted through javascript, at posterous. | 8 | # Date is impossible to retrieve since they use those stupid "fuzzy" dates, inserted through javascript, at posterous. |
9 | test_url: http://blog.cloudflare.com/understanding-analytics-when-is-a-page-view-n \ No newline at end of file | 9 | test_url: http://blog.cloudflare.com/understanding-analytics-when-is-a-page-view-n |
10 | test_url: https://blog.cloudflare.com/sha-1-deprecation-no-browser-left-behind | ||
diff --git a/inc/3rdparty/site_config/standard/caffereggio.net.txt b/inc/3rdparty/site_config/standard/caffereggio.net.txt new file mode 100644 index 00000000..08e1f05a --- /dev/null +++ b/inc/3rdparty/site_config/standard/caffereggio.net.txt | |||
@@ -0,0 +1,3 @@ | |||
1 | body: //div[@class="pf-content"] | ||
2 | |||
3 | test_url: http://www.caffereggio.net/2016/01/16/115327/ | ||
diff --git a/inc/3rdparty/site_config/standard/chronicle.com.txt b/inc/3rdparty/site_config/standard/chronicle.com.txt index e86d3eca..227a03c7 100755 --- a/inc/3rdparty/site_config/standard/chronicle.com.txt +++ b/inc/3rdparty/site_config/standard/chronicle.com.txt | |||
@@ -1,17 +1,10 @@ | |||
1 | title: //h1[contains(@class, "entry-title")] | 1 | title: //h1[contains(@class, "entry-title")] |
2 | author: //p[contains(@class, "byline")] | 2 | author: //p[contains(@class, "byline")] |
3 | 3 | ||
4 | # blog articles (chronicle.com/blogs/*) | ||
5 | body: //div[contains(@class, "abstract")] | ||
6 | date: //p[contains(@class, "time")] | ||
7 | |||
8 | # all (?) other articles | 4 | # all (?) other articles |
9 | body: //div[@id="article-body"] | 5 | body: //div[@class="content-item__story"] |
10 | date: //p[contains(@class, "dateline")] | 6 | date: //p[contains(@class, "dateline")] |
11 | 7 | ||
12 | # remove sidebars containing images (I assume this is desired for Instapaper) | 8 | # note that if you're not a Chronicle subscriber (personally or institutionally), you'll only see the first couple of paragraphs of the article, and Instapaper $ |
13 | strip: //div[@id="related"] | 9 | test_url: http://chronicle.com/article/In-a-Land-of-Second-Chances/128375/ |
14 | strip: //div[contains(@class, "image")] | 10 | test_url: http://chronicle.com/blogs/wiredcampus/university-run-boot-camps-offer-students-marketable-skills-but-not-course-credit/57494 |
15 | |||
16 | # note that if you're not a Chronicle subscriber (personally or institutionally), you'll only see the first couple of paragraphs of the article, and Instapaper will display that with some crap above and below. thank goodness for that bookmarklet | ||
17 | test_url: http://chronicle.com/article/In-a-Land-of-Second-Chances/128375/ \ No newline at end of file | ||
diff --git a/inc/3rdparty/site_config/standard/deia.com.txt b/inc/3rdparty/site_config/standard/deia.com.txt new file mode 100644 index 00000000..d2f78239 --- /dev/null +++ b/inc/3rdparty/site_config/standard/deia.com.txt | |||
@@ -0,0 +1,4 @@ | |||
1 | body: //div[@class='widget full_article'] | ||
2 | strip: //div[@class='Herramientas'] | ||
3 | |||
4 | test_url: http://www.deia.com/2015/10/03/politica/euskadi/el-envilecimiento-de-la-politica-y-de-los-medios-de-comunicacion | ||
diff --git a/inc/3rdparty/site_config/standard/diagonalperiodico.net.txt b/inc/3rdparty/site_config/standard/diagonalperiodico.net.txt new file mode 100644 index 00000000..f0681bac --- /dev/null +++ b/inc/3rdparty/site_config/standard/diagonalperiodico.net.txt | |||
@@ -0,0 +1,4 @@ | |||
1 | body: //div[@class='field__items'] | ||
2 | title: //div[@class='art_titulo'] | ||
3 | |||
4 | test_url: https://www.diagonalperiodico.net/global/27947-cuanto-mas-tiempo-nos-aferremos-este-sistema-peor-y-menores-seran-nuestras-opciones | ||
diff --git a/inc/3rdparty/site_config/standard/esglobal.org.txt b/inc/3rdparty/site_config/standard/esglobal.org.txt new file mode 100644 index 00000000..6408f441 --- /dev/null +++ b/inc/3rdparty/site_config/standard/esglobal.org.txt | |||
@@ -0,0 +1,3 @@ | |||
1 | body: //div[@class='blog-content'] | ||
2 | |||
3 | test_url: http://www.esglobal.org/el-caos-en-el-este-los-socios-de-la-ue-necesitan-que-se-les-preste-atencion/ | ||
diff --git a/inc/3rdparty/site_config/standard/lawfareblog.com.txt b/inc/3rdparty/site_config/standard/lawfareblog.com.txt new file mode 100644 index 00000000..49d858a7 --- /dev/null +++ b/inc/3rdparty/site_config/standard/lawfareblog.com.txt | |||
@@ -0,0 +1,4 @@ | |||
1 | body: //div[@class='field-items'] | ||
2 | title: //div[@class='title'] | ||
3 | |||
4 | test_url: https://lawfareblog.com/limits-panopticon | ||
diff --git a/inc/3rdparty/site_config/standard/letraslibres.com.txt b/inc/3rdparty/site_config/standard/letraslibres.com.txt new file mode 100644 index 00000000..cf271bca --- /dev/null +++ b/inc/3rdparty/site_config/standard/letraslibres.com.txt | |||
@@ -0,0 +1,3 @@ | |||
1 | single_page_link: concat(link[@rel="canonical"], "?page=full") | ||
2 | |||
3 | test_url: http://www.letraslibres.com/revista/dossier/quien-manda-en-europa | ||
diff --git a/inc/3rdparty/site_config/standard/naiz.eus.txt b/inc/3rdparty/site_config/standard/naiz.eus.txt new file mode 100644 index 00000000..9e48333a --- /dev/null +++ b/inc/3rdparty/site_config/standard/naiz.eus.txt | |||
@@ -0,0 +1,4 @@ | |||
1 | body: //div[contains(@class,'widget full_article')] | ||
2 | |||
3 | test_url: http://www.naiz.eus/eu/actualidad/noticia/20151002/adegi-afirma-que-los-jovenes-viven-una-vida-muy-comoda-y-no-tienen-hambre-para-emprender# | ||
4 | test_url: http://www.naiz.eus/eu/actualidad/noticia/20151012/podemos-euskadi-critica-que-otegi-y-sus-companeros-quieran-pasar-por-grandes-pacifistas | ||
diff --git a/inc/3rdparty/site_config/standard/pieria.co.uk.txt b/inc/3rdparty/site_config/standard/pieria.co.uk.txt new file mode 100644 index 00000000..31f2c84a --- /dev/null +++ b/inc/3rdparty/site_config/standard/pieria.co.uk.txt | |||
@@ -0,0 +1,3 @@ | |||
1 | body: //div[@id='article'] | ||
2 | |||
3 | test_url: http://www.pieria.co.uk/articles/need_a_fiscal_rule_george__try_get_the_economy_growing | ||
diff --git a/inc/3rdparty/site_config/standard/popehat.com.txt b/inc/3rdparty/site_config/standard/popehat.com.txt new file mode 100644 index 00000000..45b76ae1 --- /dev/null +++ b/inc/3rdparty/site_config/standard/popehat.com.txt | |||
@@ -0,0 +1,6 @@ | |||
1 | title: //div[@class='entry-title'] | ||
2 | author: //div[@class='entry-author'] | ||
3 | date: //div[@class='entry-time'] | ||
4 | body: //div[@class='entry-content'] | ||
5 | |||
6 | test_url: https://popehat.com/2015/12/16/eric-posner-the-first-amendments-nemesis/ | ||
diff --git a/inc/3rdparty/site_config/standard/rasgolatente.es.txt b/inc/3rdparty/site_config/standard/rasgolatente.es.txt new file mode 100644 index 00000000..fcdbbd97 --- /dev/null +++ b/inc/3rdparty/site_config/standard/rasgolatente.es.txt | |||
@@ -0,0 +1,6 @@ | |||
1 | title: //div[@class='entry-title'] | ||
2 | author: //div[@class='entry-author'] | ||
3 | date: //div[@class='entry-time'] | ||
4 | body: //div[@class='entry-content'] | ||
5 | |||
6 | test_url: http://rasgolatente.es/estupidez-psicologia-estupidos/ | ||
diff --git a/inc/3rdparty/site_config/standard/thenews.coop.txt b/inc/3rdparty/site_config/standard/thenews.coop.txt new file mode 100644 index 00000000..7d593805 --- /dev/null +++ b/inc/3rdparty/site_config/standard/thenews.coop.txt | |||
@@ -0,0 +1,3 @@ | |||
1 | body: //div[@class='entry-content'] | ||
2 | |||
3 | test_url: http://www.thenews.coop/98221/news/co-operatives/jeremy-corbyn-needs-co-op-movement/ | ||
diff --git a/inc/3rdparty/site_config/standard/timeshighereducation.com.txt b/inc/3rdparty/site_config/standard/timeshighereducation.com.txt new file mode 100644 index 00000000..ba52788d --- /dev/null +++ b/inc/3rdparty/site_config/standard/timeshighereducation.com.txt | |||
@@ -0,0 +1,3 @@ | |||
1 | body: //div[@class="col-md-12 radix-layouts-contentheader panel-panel"] | ||
2 | strip: //div[@class="htmlContent subscribe_box"] | ||
3 | test_url: https://www.timeshighereducation.com/blog/jeremy-corbyn-serious-about-free-higher-education | ||
diff --git a/inc/3rdparty/site_config/standard/wired.de.txt b/inc/3rdparty/site_config/standard/wired.de.txt new file mode 100644 index 00000000..da88362f --- /dev/null +++ b/inc/3rdparty/site_config/standard/wired.de.txt | |||
@@ -0,0 +1,8 @@ | |||
1 | title: //meta[@name='Title']/@content | ||
2 | author: //meta[@name='Author']/@content | ||
3 | date: //meta[@name='DisplayDate']/@content | ||
4 | body: //div[@class='article-content'] | ||
5 | strip: //div[@class='article-sidebar'] | ||
6 | |||
7 | test_url: https://www.wired.de/collection/latest/der-vw-skandal-zeigt-ohne-vertrauen-ist-software-nicht-mehr-als-bose-magie | ||
8 | |||
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 9014f455..1476d158 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -190,7 +190,7 @@ class Poche | |||
190 | { | 190 | { |
191 | case 'add': | 191 | case 'add': |
192 | $content = Tools::getPageContent($url); | 192 | $content = Tools::getPageContent($url); |
193 | $title = ($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled'); | 193 | $title = ($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : parse_url($url, PHP_URL_HOST); |
194 | $body = $content['rss']['channel']['item']['description']; | 194 | $body = $content['rss']['channel']['item']['description']; |
195 | 195 | ||
196 | // clean content from prevent xss attack | 196 | // clean content from prevent xss attack |
@@ -908,7 +908,7 @@ class Poche | |||
908 | $entries = $this->store->retrieveAllWithTags($this->user->getId()); | 908 | $entries = $this->store->retrieveAllWithTags($this->user->getId()); |
909 | if ($entries) { | 909 | if ($entries) { |
910 | echo $this->tpl->render('export.twig', array( | 910 | echo $this->tpl->render('export.twig', array( |
911 | 'export' => Tools::renderJson($entries), | 911 | 'export' => Tools::renderJson(Tools::utf8ize($entries)), |
912 | )); | 912 | )); |
913 | Tools::logm('export view'); | 913 | Tools::logm('export view'); |
914 | } else { | 914 | } else { |
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 9c748391..263034f0 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php | |||
@@ -141,7 +141,7 @@ final class Tools | |||
141 | public static function getFile($url) | 141 | public static function getFile($url) |
142 | { | 142 | { |
143 | $timeout = 15; | 143 | $timeout = 15; |
144 | $useragent = "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0"; | 144 | $useragent = "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0"; |
145 | 145 | ||
146 | if (in_array ('curl', get_loaded_extensions())) { | 146 | if (in_array ('curl', get_loaded_extensions())) { |
147 | # Fetch feed from URL | 147 | # Fetch feed from URL |
@@ -233,6 +233,27 @@ final class Tools | |||
233 | } | 233 | } |
234 | 234 | ||
235 | /** | 235 | /** |
236 | * UTF-8 encode array of string | ||
237 | * | ||
238 | * @param $data | ||
239 | */ | ||
240 | public static function utf8ize($data) | ||
241 | { | ||
242 | if (is_array($data)) | ||
243 | { | ||
244 | foreach ($data as $k => $v) | ||
245 | { | ||
246 | $data[$k] = self::utf8ize($v); | ||
247 | } | ||
248 | } | ||
249 | else if (is_string ($data) && '' == mb_detect_encoding($data)) | ||
250 | { | ||
251 | return utf8_encode($data); | ||
252 | } | ||
253 | return $data; | ||
254 | } | ||
255 | |||
256 | /** | ||
236 | * Create new line in log file | 257 | * Create new line in log file |
237 | * | 258 | * |
238 | * @param $message | 259 | * @param $message |