From 251fa4af943989285f853cdb1ff6d5c1be58a13f Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 15 May 2015 10:45:11 +0200 Subject: [PATCH 1/8] add forgotten icons --- .../img/appicon/firefox-service-icon-16.png | Bin 0 -> 337 bytes .../img/appicon/firefox-service-icon-32.png | Bin 0 -> 675 bytes .../img/appicon/firefox-service-icon-64.png | Bin 0 -> 1616 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 themes/_global/img/appicon/firefox-service-icon-16.png create mode 100644 themes/_global/img/appicon/firefox-service-icon-32.png create mode 100644 themes/_global/img/appicon/firefox-service-icon-64.png diff --git a/themes/_global/img/appicon/firefox-service-icon-16.png b/themes/_global/img/appicon/firefox-service-icon-16.png new file mode 100644 index 0000000000000000000000000000000000000000..cfbbf604ab9e58687bbec2e7aa550fddbc311a64 GIT binary patch literal 337 zcmV-X0j~auP)uu-h;cn%e~>9^k;{|e*c}xj4|mO zDbkk`1PCGbFpi@j!8jR)(KJm}RgUBEt{{+QnXc;qfV!@ESAaw*^?m<1jyR4#Lh8D1 z-}mdfhGF;!2||bvLI^4h5h@$AX zBSl%)^&Qf-ZF!z2NrExQ4%Q@e7?hS=8hM$B9ei*+5#t?8ErzpzyN~hDw=ktaU%;$52 zkR(auu}~=Z{r=TzrK<$21Mzqq0Bknf`}_NPy(WpZT1`)`E`oNuOVu zVFVcC+uPgix|_|W&O}`V!{PAH-YSZsCs&uqkB^VtZdaD&ySqD=%Vo7%kB*LrFnd9L z<1AV(mlQ>voSYcuB2g4smctJ11OkCT0AozkG{cA!{OK|x7X{Po}L20 z)6>(-%S$K}vREu+1`j&ywlNqC(&_Z4$EMTiL38l?00009a7bBm000XU z000XU0RWnu7ytkO2XskIMF-yn3=IY@FWwD^000H=NklS?+Gc(PrDfjYzBf)lKp*$LmSoQAo^#LKGvB@Eo^$35#`8Ql$Rq;? zoFo7e011EuKms5E*gx?+KQ=ZN4u^k7d47K0<#MGK01U$%4o7ZoZc9r`C=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%H)3!Y$xb8g01Vn$%Yhr-g*Qifqt Date: Tue, 19 May 2015 21:11:19 +0200 Subject: [PATCH 2/8] fix restart of import --- inc/poche/Routing.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/poche/Routing.class.php b/inc/poche/Routing.class.php index 138da48d3..33a814351 100755 --- a/inc/poche/Routing.class.php +++ b/inc/poche/Routing.class.php @@ -141,7 +141,7 @@ class Routing $pdf->producePDF(); } elseif (isset($_GET['import'])) { $import = $this->wallabag->import(); - $tplVars = array_merge($this->vars, $import); + $this->vars = array_merge($this->vars, $import); } elseif (isset($_GET['empty-cache'])) { Tools::emptyCache(); } elseif (isset($_GET['export'])) { From 973085356452b3d74147a5e768907924029be331 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 22 May 2015 18:54:55 +0200 Subject: [PATCH 3/8] revert session destroy to avoid warning --- install/index.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/install/index.php b/install/index.php index 654d21cab..bb3510952 100755 --- a/install/index.php +++ b/install/index.php @@ -36,8 +36,6 @@ if (isset($_SERVER['HTTP_COOKIE'])) { if (isset($_SESSION['poche_user'])) { unset($_SESSION['poche_user']); } -session_destroy(); - if (isset($_GET['clean'])) { if (is_dir('install')){ From d31766300a4c15acf0d6d496eb0156f2e6d3a269 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 22 May 2015 19:29:12 +0200 Subject: [PATCH 4/8] added Firefox-bookmarks format import mode --- inc/poche/Poche.class.php | 52 ++++++++++++++++++++++++++++----------- inc/poche/Tools.class.php | 11 +++++++++ 2 files changed, 48 insertions(+), 15 deletions(-) diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 465d9f956..7b13c97e4 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -732,23 +732,45 @@ class Poche $html->load_file($_FILES['file']['tmp_name']); $data = array(); $read = 0; - foreach (array('ol','ul') as $list) { - foreach ($html->find($list) as $ul) { - foreach ($ul->find('li') as $li) { - $tmpEntry = array(); - $a = $li->find('a'); - $tmpEntry['url'] = $a[0]->href; - $tmpEntry['tags'] = $a[0]->tags; - $tmpEntry['is_read'] = $read; - if ($tmpEntry['url']) { - $data[] = $tmpEntry; + + if (Tools:: get_doctype($html)) { + // Firefox-bookmarks HTML + foreach (array('DL','ul') as $list) { + foreach ($html->find($list) as $ul) { + foreach ($ul->find('DT') as $li) { + $tmpEntry = array(); + $a = $li->find('A'); + $tmpEntry['url'] = $a[0]->href; + $tmpEntry['tags'] = $a[0]->tags; + $tmpEntry['is_read'] = $read; + if ($tmpEntry['url']) { + $data[] = $tmpEntry; + } } - } - # the second
    is for read links - $read = ((sizeof($data) && $read)?0:1); + # the second
      is for read links + $read = ((sizeof($data) && $read)?0:1); + } } - } - } + } else { + // regular HTML + foreach (array('ol','ul') as $list) { + foreach ($html->find($list) as $ul) { + foreach ($ul->find('li') as $li) { + $tmpEntry = array(); + $a = $li->find('a'); + $tmpEntry['url'] = $a[0]->href; + $tmpEntry['tags'] = $a[0]->tags; + $tmpEntry['is_read'] = $read; + if ($tmpEntry['url']) { + $data[] = $tmpEntry; + } + } + # the second
        is for read links + $read = ((sizeof($data) && $read)?0:1); + } + } + } + } // for readability structure diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index c8fb2e527..1c5545908 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -420,4 +420,15 @@ final class Tools return str_replace('+', '', $token); } + function get_doctype($doc) + { + $els = $doc->find('unknown'); + + foreach ($els as $e => $el) + if ($el->parent()->tag == 'root') + return $el; + + return NULL; + } + } From f0a819a968e5d935c757bb65acdfbca480398274 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 22 May 2015 20:09:23 +0200 Subject: [PATCH 5/8] added commentsand fixed something forgotten --- inc/poche/Poche.class.php | 2 +- inc/poche/Tools.class.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 7b13c97e4..d039de1f1 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -733,7 +733,7 @@ class Poche $data = array(); $read = 0; - if (Tools:: get_doctype($html)) { + if (Tools::get_doctype($html)->innertext == "") { // Firefox-bookmarks HTML foreach (array('DL','ul') as $list) { foreach ($html->find($list) as $ul) { diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 1c5545908..f34e8bebe 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -420,6 +420,14 @@ final class Tools return str_replace('+', '', $token); } + /** + * + * Returns the doctype for an HTML document (used for Mozilla Bookmarks) + * @param simple_html_dom $doc + * @return doctype $el + * + */ + function get_doctype($doc) { $els = $doc->find('unknown'); From 12b97d67573042a66b8bf7a84f60df861a5d8632 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 25 May 2015 20:41:39 +0200 Subject: [PATCH 6/8] hide article until import is finished --- themes/default/_import.twig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/themes/default/_import.twig b/themes/default/_import.twig index c59b7a154..079203a26 100755 --- a/themes/default/_import.twig +++ b/themes/default/_import.twig @@ -2,11 +2,13 @@
        From 3a690fad55cafb5b30debd1f3069e9c87b0a4b39 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 25 May 2015 20:44:22 +0200 Subject: [PATCH 7/8] declare function correctly --- inc/poche/Tools.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index f34e8bebe..f3d1013fe 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -428,7 +428,7 @@ final class Tools * */ - function get_doctype($doc) + public static function get_doctype($doc) { $els = $doc->find('unknown'); From ddbb2308a3302e2d2d6ff89f4dd3235f85d335e1 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sat, 30 May 2015 18:11:00 +0200 Subject: [PATCH 8/8] check that URL are real ones before importing them (for instance, avoid bookmarklets) --- inc/poche/Poche.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index d039de1f1..4fb028ff2 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -788,7 +788,7 @@ class Poche $urlsInserted = array(); //urls of articles inserted foreach($data as $record) { $url = trim(isset($record['article__url']) ? $record['article__url'] : (isset($record['url']) ? $record['url'] : '')); - if ($url and !in_array($url, $urlsInserted)) { + if (filter_var($url, FILTER_VALIDATE_URL) and !in_array($url, $urlsInserted)) { $title = (isset($record['title']) ? $record['title'] : _('Untitled - Import - ') . ' ' . _('click to finish import') . ''); $body = (isset($record['content']) ? $record['content'] : ''); $isRead = (isset($record['is_read']) ? intval($record['is_read']) : (isset($record['archive']) ? intval($record['archive']) : 0));