aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc
diff options
context:
space:
mode:
authortcit <tcit@tcit.fr>2014-09-27 17:54:13 +0200
committertcit <tcit@tcit.fr>2014-09-27 17:54:13 +0200
commit04a7674bdd20f2f24b32de69c086ecffdf20ceb4 (patch)
treebcc26634c68a8689ad511513c316058647e90789 /inc
parent657245dcbdbca323621952d2b6f9e991dd94fa03 (diff)
parenta15108e65b12ceaf50821783bcaa1ee3fee10d13 (diff)
downloadwallabag-04a7674bdd20f2f24b32de69c086ecffdf20ceb4.tar.gz
wallabag-04a7674bdd20f2f24b32de69c086ecffdf20ceb4.tar.zst
wallabag-04a7674bdd20f2f24b32de69c086ecffdf20ceb4.zip
merge refactor and dev
Diffstat (limited to 'inc')
-rwxr-xr-x[-rw-r--r--]inc/3rdparty/libraries/readability/Readability.php17
-rw-r--r--inc/3rdparty/site_config/custom/blogs.faz.net.txt45
-rw-r--r--inc/3rdparty/site_config/standard/.about.com.txt14
-rwxr-xr-xinc/3rdparty/site_config/standard/dn.pt.txt9
-rw-r--r--[-rwxr-xr-x]inc/3rdparty/site_config/standard/faz.net.txt117
-rwxr-xr-xinc/3rdparty/site_config/standard/habrahabr.ru.txt21
-rwxr-xr-xinc/poche/Database.class.php4
-rwxr-xr-xinc/poche/Poche.class.php85
-rwxr-xr-x[-rw-r--r--]inc/poche/Routing.class.php79
-rwxr-xr-xinc/poche/Tools.class.php19
-rwxr-xr-xinc/poche/config.inc.default.php2
-rw-r--r--inc/poche/pochePictures.php2
12 files changed, 291 insertions, 123 deletions
diff --git a/inc/3rdparty/libraries/readability/Readability.php b/inc/3rdparty/libraries/readability/Readability.php
index d0f09d74..4fa3ba63 100644..100755
--- a/inc/3rdparty/libraries/readability/Readability.php
+++ b/inc/3rdparty/libraries/readability/Readability.php
@@ -679,6 +679,7 @@ class Readability
679 } else { 679 } else {
680 $topCandidate->innerHTML = $page->documentElement->innerHTML; 680 $topCandidate->innerHTML = $page->documentElement->innerHTML;
681 $page->documentElement->innerHTML = ''; 681 $page->documentElement->innerHTML = '';
682 $this->reinitBody();
682 $page->documentElement->appendChild($topCandidate); 683 $page->documentElement->appendChild($topCandidate);
683 } 684 }
684 } else { 685 } else {
@@ -794,8 +795,7 @@ class Readability
794 { 795 {
795 // TODO: find out why element disappears sometimes, e.g. for this URL http://www.businessinsider.com/6-hedge-fund-etfs-for-average-investors-2011-7 796 // TODO: find out why element disappears sometimes, e.g. for this URL http://www.businessinsider.com/6-hedge-fund-etfs-for-average-investors-2011-7
796 // in the meantime, we check and create an empty element if it's not there. 797 // in the meantime, we check and create an empty element if it's not there.
797 if (!isset($this->body->childNodes)) $this->body = $this->dom->createElement('body'); 798 $this->reinitBody();
798 $this->body->innerHTML = $this->bodyCache;
799 799
800 if ($this->flagIsActive(self::FLAG_STRIP_UNLIKELYS)) { 800 if ($this->flagIsActive(self::FLAG_STRIP_UNLIKELYS)) {
801 $this->removeFlag(self::FLAG_STRIP_UNLIKELYS); 801 $this->removeFlag(self::FLAG_STRIP_UNLIKELYS);
@@ -1134,5 +1134,18 @@ class Readability
1134 public function removeFlag($flag) { 1134 public function removeFlag($flag) {
1135 $this->flags = $this->flags & ~$flag; 1135 $this->flags = $this->flags & ~$flag;
1136 } 1136 }
1137
1138 /**
1139 * Will recreate previously deleted body property
1140 *
1141 * @return void
1142 */
1143 protected function reinitBody() {
1144 if (!isset($this->body->childNodes)) {
1145 $this->body = $this->dom->createElement('body');
1146 $this->body->innerHTML = $this->bodyCache;
1147 }
1148 }
1149
1137} 1150}
1138?> \ No newline at end of file 1151?> \ No newline at end of file
diff --git a/inc/3rdparty/site_config/custom/blogs.faz.net.txt b/inc/3rdparty/site_config/custom/blogs.faz.net.txt
new file mode 100644
index 00000000..4f2626f1
--- /dev/null
+++ b/inc/3rdparty/site_config/custom/blogs.faz.net.txt
@@ -0,0 +1,45 @@
1# Author: zinnober
2
3tidy: no
4prune: no
5
6# Set author
7author: //a[@rel='author']
8
9# Set date
10date: //span[@class='Datum']
11
12# Content is here
13body: //div[@class='Artikel']
14
15# Tidy up before article
16strip: //div[@id='FAZHeaderNeu']
17strip: //h2[@itemprop='headline']
18strip: //span[@class='Datum']
19strip: //span[@class='Autor']
20strip_id_or_class: ArticlePagerTop
21strip: //div[@class='FAZArtikelEinleitung']/h2
22
23# General cleanup
24strip: //div[@class='clear']
25strip: //span[@class='Bildnachweis']
26strip: //iframe
27strip_id_or_class: Community
28strip: ' · '
29
30# Remove tracking and ads
31strip_image_src: /l.gif?
32strip: //img[@width='1']
33strip_id_or_class: invisible
34strip_id_or_class: Anzeige
35strip_id_or_class: billboard
36
37# Remove clutter after article
38strip_id_or_class: Tagline
39strip_id_or_class: ArtikelAbbinder
40strip_id_or_class: FAZArtikelKommentare
41strip_id_or_class: ArtikelKommentieren
42strip_id_or_class: FAZContentRight
43
44# Try it yourself
45test_url: http://blogs.faz.net/wost/2014/08/17/viel-fuck-und-wenig-guter-sex-1239/
diff --git a/inc/3rdparty/site_config/standard/.about.com.txt b/inc/3rdparty/site_config/standard/.about.com.txt
new file mode 100644
index 00000000..e1ebaee3
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/.about.com.txt
@@ -0,0 +1,14 @@
1body: //div[@id='articlebody']
2title: //h1
3author: //p[@id='by']//a
4
5next_page_link: //span[@class='next']/a
6# Not the same as below!
7
8prune: yes
9tidy: no
10
11# Annoying 'next' links plainly inside the article body
12strip: //*[text()[contains(.,'Next: ')]]
13
14test_url: http://psychology.about.com/od/theoriesofpersonality/ss/defensemech.htm
diff --git a/inc/3rdparty/site_config/standard/dn.pt.txt b/inc/3rdparty/site_config/standard/dn.pt.txt
new file mode 100755
index 00000000..051b8cb9
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/dn.pt.txt
@@ -0,0 +1,9 @@
1single_page_link: concat('http://www.dn.pt/Common/print.aspx?content_id=', //input[@type='hidden' and @name='link-comments']/@value)
2#<input type="hidden" name="link-comments" class="link-comments" value="3972244">
3
4title: //h1
5author: //div[@class="Author"]
6
7strip: //div[@class="Patrocinio"]
8
9test_url: http://www.dn.pt/inicio/opiniao/interior.aspx?content_id=3972244&seccao=Alberto%20Gon%E7alves&tag=Opini%E3o%20-%20Em%20Foco&page=1 \ No newline at end of file
diff --git a/inc/3rdparty/site_config/standard/faz.net.txt b/inc/3rdparty/site_config/standard/faz.net.txt
index d087d2aa..47048a1b 100755..100644
--- a/inc/3rdparty/site_config/standard/faz.net.txt
+++ b/inc/3rdparty/site_config/standard/faz.net.txt
@@ -1,36 +1,101 @@
1# Author: zinnober
2# Complete rewrite of the faz.net template as the standard one is broken
3# I tried to consider as many page variants as possible, which was some serious work
4
5tidy: no
6prune: no
7
1# Title 8# Title
2title: //p[@class='Content HeadlineShort'] 9title: //p[@class='Content HeadlineShort']
3 10
4# Authors 11# Set author
5# some are known and have a link, others don't 12author: substring-after(//span[@class='Autor'], 'von ')
6author: substring-after(//span[@class='Autor'], 'Von') 13author: //span[@class='caps last']/span[@class='caps last']
14author: //a[@rel='author']
7 15
8# Date 16# Set date
9date: //span[@class='Datum'] 17date: //span[@class='Datum']
18date: //span[@class='Datum'],/span
19
20# Fetch full multipage articles
21next_page_link: //a[@title='Nächste Seite']
10 22
11# Body 23# Content is here
12body: //div[@class='Artikel'] 24body: //div[@class='Artikel']
13 25
14# Removements before body text 26# Tidy up before article
15strip: //div[@class='Breadcrumbs'] 27strip: //div[@id='FAZHeaderNeu']
16strip: //div[@class='QuickSearchBox'] 28strip: //h2[@itemprop='headline']
17strip: //div[@class='FAZArtikelEinleitung'] 29strip: //span[@class='Datum']
18strip: //div[@class='FAZArtikelReiter'] 30strip: //span[@class='Autor']
31strip_id_or_class: ArticlePagerTop
32
33# General cleanup
19strip: //div[@class='clear'] 34strip: //div[@class='clear']
35strip: //a[@title='Zur Homepage FAZ.NET']
36strip: //iframe
37replace_string( · ):
38
39# Remove tracking and ads
40strip_image_src: /l.gif?
41strip: //div[contains(@style, 'background-image')]
42strip: //img[@width='1']
43strip_id_or_class: invisible
44strip_id_or_class: Anzeige
45strip_id_or_class: billboard
46
47# Remove various text boxes and social media foo
48strip_id_or_class: WeitereBeitraege
49strip_id_or_class: WBListe
50strip_id_or_class: AutorenModul
51strip_id_or_class: Community
52strip_id_or_class: SocialMediaStatus
53strip_id_or_class: RelatedLinkBox
54strip_id_or_class: MultimediaNavigation
55strip_id_or_class: IndexTitel
56
57# Fix picture caps and pictures (use better resolution and remove clutter)
58strip_id_or_class: LightBoxOverlay
59strip_id_or_class: exitLarge
60strip_id_or_class: PagerBox
61strip_id_or_class: Bildnachweis
62strip_id_or_class: Bildueberschrift
63strip_id_or_class: Bildbeschreibung
64strip_id_or_class: ArtikelBild610
65strip_id_or_class: MediaLink
66strip_id_or_class: FotoBoxInnerLeft
67strip_id_or_class: BilderRelatedLinks
68
69# Remove clutter after article
70strip_id_or_class: ArticlePagerBottom
71strip_id_or_class: backToHome
72strip_id_or_class: ArtikelAbbinder
73strip_id_or_class: lesermeinungscontainer
74strip_id_or_class: ThemenLinks
75strip_id_or_class: rechtehinweis
76strip_id_or_class: FAZArtikelMap
77strip_id_or_class: FAZArtikelKommentare
78strip_id_or_class: ArtikelKommentieren
79strip_id_or_class: FAZArtikelFunktionen
80strip_id_or_class: mailLB
81strip_id_or_class: FAZContentRight
82strip_id_or_class: stageModule
83strip_id_or_class: ContentFooter
84strip_id_or_class: ServicesFooter
85strip_id_or_class: FAZFooter
86
87# Clean up stuff present just in some articles
88strip_id_or_class: Teaser620
89strip_id_or_class: TeaserMultimedia
90strip_id_or_class: VideoBox
91
92# Remove as soon as Wallabag maight be able to embed flash video
93strip_id_or_class: mmoObjectAsTeaserInArticle
94strip_id_or_class: additionalStylesAudioVideo
95strip_id_or_class: hideMMElements
96
97# Try it yourself
98test_url: http://www.faz.net/aktuell/feuilleton/zum-tod-von-margaret-thatcher-die-reizfigur-12141919.html#Drucken
99test_url: http://www.faz.net/aktuell/politik/inland/allensbach-analyse-im-namen-des-volkes-13106492.html
100test_url: http://www.faz.net/aktuell/feuilleton/kino/video-filmkritiken/video-filmkritik-when-animals-dream-zerrissene-jugend-13105772.html
20 101
21# General removements
22strip: //span[@class='Bildnachweis']
23strip: //img[@class='MediaIcon']
24strip: //div[@class='ArtikelMediaLink']
25dissolve: //a[img]
26
27# Removements after body text
28strip: //div[@class='ArtikelAbbinder']
29strip: //div[@class='ArtikelKommentieren Artikelfuss GETS;tk;boxen.top-lesermeinungen;tp;content']
30strip: //div[@class='FAZArtikelKommentare FAZArtikelContent']
31strip: //div[@class='FAZArtikelFunktionen']
32strip: //div[@id='FAZContentRight']
33
34# Fix picture captions
35wrap_in(small): //span[@class='Bildunterschrift']/text()
36test_url: http://www.faz.net/aktuell/feuilleton/zum-tod-von-margaret-thatcher-die-reizfigur-12141919.html#Drucken \ No newline at end of file
diff --git a/inc/3rdparty/site_config/standard/habrahabr.ru.txt b/inc/3rdparty/site_config/standard/habrahabr.ru.txt
new file mode 100755
index 00000000..67538359
--- /dev/null
+++ b/inc/3rdparty/site_config/standard/habrahabr.ru.txt
@@ -0,0 +1,21 @@
1title: //span[@class="post_title"]
2author: //div[@class="author"]
3date: //div[@class="published
4
5body: //div[@class='content html_format'] | //div[@id='comments']
6
7strip: //a[@class="link_to_comment"]
8strip: //div[@class="show_tree"]
9strip: //a[@class="to_parent"]
10
11
12replace_string(class="reply_comments"): style="padding-left: 20px"
13replace_string(class="voting "): style="float: right"
14replace_string(src="//habrastorage.org/getpro/habr/avatars/): style="width:24px; height:24px;" class="123" src="//habrastorage.org/getpro/habr/avatars/
15replace_string(class="info "): style="padding-top:5px;font-size:0.85em;line-height:24px;"
16
17
18prune: no
19tidy: no
20
21test_url: http://habrahabr.ru/post/229883/ \ No newline at end of file
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php
index 2c80b64b..dfd7ae34 100755
--- a/inc/poche/Database.class.php
+++ b/inc/poche/Database.class.php
@@ -23,6 +23,10 @@ class Database {
23 { 23 {
24 switch (STORAGE) { 24 switch (STORAGE) {
25 case 'sqlite': 25 case 'sqlite':
26 // Check if /db is writeable
27 if ( !is_writable(STORAGE_SQLITE) || !is_writable(dirname(STORAGE_SQLITE))) {
28 die('An error occured: "db" directory must be writeable for your web server user!');
29 }
26 $db_path = 'sqlite:' . STORAGE_SQLITE; 30 $db_path = 'sqlite:' . STORAGE_SQLITE;
27 $this->handle = new PDO($db_path); 31 $this->handle = new PDO($db_path);
28 break; 32 break;
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index a49413f2..c80e5d2a 100755
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -524,6 +524,14 @@ class Poche
524 $longlastingsession = isset($_POST['longlastingsession']); 524 $longlastingsession = isset($_POST['longlastingsession']);
525 $passwordTest = ($isauthenticated) ? $user['password'] : Tools::encodeString($password . $login); 525 $passwordTest = ($isauthenticated) ? $user['password'] : Tools::encodeString($password . $login);
526 Session::login($user['username'], $user['password'], $login, $passwordTest, $longlastingsession, array('poche_user' => new User($user))); 526 Session::login($user['username'], $user['password'], $login, $passwordTest, $longlastingsession, array('poche_user' => new User($user)));
527
528 # reload l10n
529 $language = $user['config']['language'];
530 @putenv('LC_ALL=' . $language);
531 setlocale(LC_ALL, $language);
532 bindtextdomain($language, LOCALE);
533 textdomain($language);
534
527 $this->messages->add('s', _('welcome to your wallabag')); 535 $this->messages->add('s', _('welcome to your wallabag'));
528 Tools::logm('login successful'); 536 Tools::logm('login successful');
529 Tools::redirect($referer); 537 Tools::redirect($referer);
@@ -551,42 +559,39 @@ class Poche
551 * import datas into your wallabag 559 * import datas into your wallabag
552 * @return boolean 560 * @return boolean
553 */ 561 */
554 public function import()
555 {
556 if (isset($_FILES['file'])) {
557 Tools::logm('Import stated: parsing file');
558
559 // assume, that file is in json format
560
561 $str_data = file_get_contents($_FILES['file']['tmp_name']);
562 $data = json_decode($str_data, true);
563 if ($data === null) {
564
565 // not json - assume html
566
567 $html = new simple_html_dom();
568 $html->load_file($_FILES['file']['tmp_name']);
569 $data = array();
570 $read = 0;
571 foreach(array('ol','ul') as $list) {
572 foreach($html->find($list) as $ul) {
573 foreach($ul->find('li') as $li) {
574 $tmpEntry = array();
575 $a = $li->find('a');
576 $tmpEntry['url'] = $a[0]->href;
577 $tmpEntry['tags'] = $a[0]->tags;
578 $tmpEntry['is_read'] = $read;
579 if ($tmpEntry['url']) {
580 $data[] = $tmpEntry;
581 }
582 }
583
584 // the second <ol/ul> is for read links
585 562
586 $read = ((sizeof($data) && $read) ? 0 : 1); 563 public function import() {
587 } 564
588 } 565 if ( isset($_FILES['file']) && $_FILES['file']['tmp_name'] ) {
566 Tools::logm('Import stated: parsing file');
567
568 // assume, that file is in json format
569 $str_data = file_get_contents($_FILES['file']['tmp_name']);
570 $data = json_decode($str_data, true);
571
572 if ( $data === null ) {
573 //not json - assume html
574 $html = new simple_html_dom();
575 $html->load_file($_FILES['file']['tmp_name']);
576 $data = array();
577 $read = 0;
578 foreach (array('ol','ul') as $list) {
579 foreach ($html->find($list) as $ul) {
580 foreach ($ul->find('li') as $li) {
581 $tmpEntry = array();
582 $a = $li->find('a');
583 $tmpEntry['url'] = $a[0]->href;
584 $tmpEntry['tags'] = $a[0]->tags;
585 $tmpEntry['is_read'] = $read;
586 if ($tmpEntry['url']) {
587 $data[] = $tmpEntry;
588 }
589 }
590 # the second <ol/ul> is for read links
591 $read = ((sizeof($data) && $read)?0:1);
589 } 592 }
593 }
594 }
590 595
591 // for readability structure 596 // for readability structure
592 597
@@ -629,9 +634,11 @@ class Poche
629 $this->messages->add('s', _('Articles inserted: ') . $i . _('. Please note, that some may be marked as "read".')); 634 $this->messages->add('s', _('Articles inserted: ') . $i . _('. Please note, that some may be marked as "read".'));
630 } 635 }
631 636
632 Tools::logm('Import of articles finished: ' . $i . ' articles added (w/o content if not provided).'); 637 Tools::logm('Import of articles finished: '.$i.' articles added (w/o content if not provided).');
633 } 638 }
634 639 else {
640 $this->messages->add('s', _('Did you forget to select a file?'));
641 }
635 // file parsing finished here 642 // file parsing finished here
636 // now download article contents if any 643 // now download article contents if any
637 // check if we need to download any content 644 // check if we need to download any content
@@ -750,8 +757,8 @@ class Poche
750 die(sprintf(_('User with this id (%d) does not exist.'), $user_id)); 757 die(sprintf(_('User with this id (%d) does not exist.'), $user_id));
751 } 758 }
752 759
753 if (!in_array($type, $allowed_types) || $token != $config['token']) { 760 if (!in_array($type, $allowed_types) || !isset($config['token']) || $token != $config['token']) {
754 die(_('Uh, there is a problem while generating feeds.')); 761 die(_('Uh, there is a problem while generating feed. Wrong token used?'));
755 } 762 }
756 763
757 $feed = new FeedWriter(RSS2); 764 $feed = new FeedWriter(RSS2);
diff --git a/inc/poche/Routing.class.php b/inc/poche/Routing.class.php
index 2db57d12..0b373058 100644..100755
--- a/inc/poche/Routing.class.php
+++ b/inc/poche/Routing.class.php
@@ -98,49 +98,50 @@ class Routing
98 private function _launchAction() 98 private function _launchAction()
99 { 99 {
100 if (isset($_GET['login'])) { 100 if (isset($_GET['login'])) {
101 // hello you 101 // hello to you
102 $this->wallabag->login($this->referer); 102 $this->wallabag->login($this->referer);
103 } elseif (isset($_GET['logout'])) { 103 } elseif (isset($_GET['feed']) && isset($_GET['user_id'])) {
104 // see you soon ! 104 $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0);
105 $this->wallabag->logout(); 105 $this->wallabag->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type']);
106 } elseif (isset($_GET['config'])) { 106 }
107 // update password 107
108 $this->wallabag->updatePassword($_POST['password'], $_POST['password_repeat']); 108 //allowed ONLY to logged in user
109 } elseif (isset($_GET['newuser'])) { 109 if (\Session::isLogged() === true)
110 $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser']); 110 {
111 } elseif (isset($_GET['deluser'])) { 111 if (isset($_GET['logout'])) {
112 $this->wallabag->deleteUser($_POST['password4deletinguser']); 112 // see you soon !
113 } elseif (isset($_GET['epub'])) { 113 $this->wallabag->logout();
114 $epub = new WallabagEpub($this->wallabag, $_GET['method'], $_GET['value']); 114 } elseif (isset($_GET['config'])) {
115 $epub->run(); 115 // update password
116 } elseif (isset($_GET['import'])) { 116 $this->wallabag->updatePassword($_POST['password'], $_POST['password_repeat']);
117 $import = $this->wallabag->import(); 117 } elseif (isset($_GET['newuser'])) {
118 $tplVars = array_merge($this->vars, $import); 118 $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser']);
119 } elseif (isset($_GET['download'])) { 119 } elseif (isset($_GET['deluser'])) {
120 Tools::downloadDb(); 120 $this->wallabag->deleteUser($_POST['password4deletinguser']);
121 } elseif (isset($_GET['empty-cache'])) { 121 } elseif (isset($_GET['epub'])) {
122 Tools::emptyCache(); 122 $epub = new WallabagEpub($this->wallabag, $_GET['method'], $_GET['id'], $_GET['value']);
123 } elseif (isset($_GET['export'])) { 123 $epub->run();
124 $this->wallabag->export(); 124 } elseif (isset($_GET['import'])) {
125 } elseif (isset($_GET['updatetheme'])) { 125 $import = $this->wallabag->import();
126 $this->wallabag->tpl->updateTheme($_POST['theme']); 126 $tplVars = array_merge($this->vars, $import);
127 } elseif (isset($_GET['updatelanguage'])) { 127 } elseif (isset($_GET['empty-cache'])) {
128 $this->wallabag->language->updateLanguage($_POST['language']); 128 Tools::emptyCache();
129 } elseif (isset($_GET['uploadfile'])) { 129 } elseif (isset($_GET['export'])) {
130 $this->wallabag->uploadFile(); 130 $this->wallabag->export();
131 } elseif (isset($_GET['feed'])) { 131 } elseif (isset($_GET['updatetheme'])) {
132 if (isset($_GET['action']) && $_GET['action'] == 'generate') { 132 $this->wallabag->tpl->updateTheme($_POST['theme']);
133 } elseif (isset($_GET['updatelanguage'])) {
134 $this->wallabag->language->updateLanguage($_POST['language']);
135 } elseif (isset($_GET['uploadfile'])) {
136 $this->wallabag->uploadFile();
137 } elseif (isset($_GET['feed']) && isset($_GET['action']) && $_GET['action'] == 'generate') {
133 $this->wallabag->updateToken(); 138 $this->wallabag->updateToken();
134 } 139 }
135 else { 140 elseif (isset($_GET['plainurl']) && !empty($_GET['plainurl'])) {
136 $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0); 141 $plainUrl = new Url(base64_encode($_GET['plainurl']));
137 $this->wallabag->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type']); 142 $this->wallabag->action('add', $plainUrl);
138 } 143 }
139 } 144 }
140 elseif (isset($_GET['plainurl']) && !empty($_GET['plainurl'])) {
141 $plainUrl = new Url(base64_encode($_GET['plainurl']));
142 $this->wallabag->action('add', $plainUrl);
143 }
144 } 145 }
145 146
146 public function _render($file, $vars) 147 public function _render($file, $vars)
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php
index 63137d76..93ec3fc6 100755
--- a/inc/poche/Tools.class.php
+++ b/inc/poche/Tools.class.php
@@ -54,6 +54,10 @@ final class Tools
54 || ($https && $_SERVER["SERVER_PORT"] == '443') 54 || ($https && $_SERVER["SERVER_PORT"] == '443')
55 || ($https && $_SERVER["SERVER_PORT"]==SSL_PORT) //Custom HTTPS port detection 55 || ($https && $_SERVER["SERVER_PORT"]==SSL_PORT) //Custom HTTPS port detection
56 ? '' : ':' . $_SERVER["SERVER_PORT"]); 56 ? '' : ':' . $_SERVER["SERVER_PORT"]);
57
58 if (isset($_SERVER["HTTP_X_FORWARDED_PORT"])) {
59 $serverport = ':' . $_SERVER["HTTP_X_FORWARDED_PORT"];
60 }
57 61
58 $scriptname = str_replace('/index.php', '/', $_SERVER["SCRIPT_NAME"]); 62 $scriptname = str_replace('/index.php', '/', $_SERVER["SCRIPT_NAME"]);
59 63
@@ -295,21 +299,6 @@ final class Tools
295 } 299 }
296 300
297 /** 301 /**
298 * Download the sqlite database
299 */
300 public static function downloadDb()
301 {
302 header('Content-Disposition: attachment; filename="poche.sqlite.gz"');
303 self::_status(200);
304
305 header('Content-Transfer-Encoding: binary');
306 header('Content-Type: application/octet-stream');
307 echo gzencode(file_get_contents(STORAGE_SQLITE));
308
309 exit;
310 }
311
312 /**
313 * Get the content for a given URL (by a call to FullTextFeed) 302 * Get the content for a given URL (by a call to FullTextFeed)
314 * 303 *
315 * @param Url $url 304 * @param Url $url
diff --git a/inc/poche/config.inc.default.php b/inc/poche/config.inc.default.php
index 6f03af18..2a458544 100755
--- a/inc/poche/config.inc.default.php
+++ b/inc/poche/config.inc.default.php
@@ -59,7 +59,7 @@
59@define ('LOCALE', ROOT . '/locale'); 59@define ('LOCALE', ROOT . '/locale');
60@define ('CACHE', ROOT . '/cache'); 60@define ('CACHE', ROOT . '/cache');
61 61
62@define ('PAGINATION', '10'); 62@define ('PAGINATION', '12');
63 63
64//limit for download of articles during import 64//limit for download of articles during import
65@define ('IMPORT_LIMIT', 5); 65@define ('IMPORT_LIMIT', 5);
diff --git a/inc/poche/pochePictures.php b/inc/poche/pochePictures.php
index 7a914f90..52394c70 100644
--- a/inc/poche/pochePictures.php
+++ b/inc/poche/pochePictures.php
@@ -33,7 +33,7 @@ final class Picture
33 } 33 }
34 34
35 if (self::_downloadPictures($absolute_path, $fullpath) === true) { 35 if (self::_downloadPictures($absolute_path, $fullpath) === true) {
36 $content = str_replace($matches[$i][2], $fullpath, $content); 36 $content = str_replace($matches[$i][2], Tools::getPocheUrl() . $fullpath, $content);
37 } 37 }
38 38
39 $processing_pictures[] = $absolute_path; 39 $processing_pictures[] = $absolute_path;