aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVincent Malley <vincent.malley@insalien.org>2015-06-02 11:09:37 -0400
committerVincent Malley <vincent.malley@insalien.org>2015-06-02 11:09:37 -0400
commit900f2a91604bf04e86ac7ff4a22f2b19439c6652 (patch)
tree0185d8b6fbd1ea5a48ad1ed2e79394cb3596f95e
parentf9c8087f787b6ac38ca2c3b6a876a803860b8991 (diff)
parentddbb2308a3302e2d2d6ff89f4dd3235f85d335e1 (diff)
downloadwallabag-900f2a91604bf04e86ac7ff4a22f2b19439c6652.tar.gz
wallabag-900f2a91604bf04e86ac7ff4a22f2b19439c6652.tar.zst
wallabag-900f2a91604bf04e86ac7ff4a22f2b19439c6652.zip
Merge remote-tracking branch 'upstream/dev' into dev
-rwxr-xr-xinc/poche/Poche.class.php54
-rwxr-xr-xinc/poche/Routing.class.php2
-rwxr-xr-xinc/poche/Tools.class.php19
-rwxr-xr-xinstall/index.php2
-rw-r--r--themes/_global/img/appicon/firefox-service-icon-16.pngbin0 -> 337 bytes
-rw-r--r--themes/_global/img/appicon/firefox-service-icon-32.pngbin0 -> 675 bytes
-rw-r--r--themes/_global/img/appicon/firefox-service-icon-64.pngbin0 -> 1616 bytes
-rwxr-xr-xthemes/default/_import.twig2
8 files changed, 60 insertions, 19 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index d297807a..0754d659 100755
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -732,23 +732,45 @@ class Poche
732 $html->load_file($_FILES['file']['tmp_name']); 732 $html->load_file($_FILES['file']['tmp_name']);
733 $data = array(); 733 $data = array();
734 $read = 0; 734 $read = 0;
735 foreach (array('ol','ul') as $list) { 735
736 foreach ($html->find($list) as $ul) { 736 if (Tools::get_doctype($html)->innertext == "<!DOCTYPE NETSCAPE-Bookmark-file-1>") {
737 foreach ($ul->find('li') as $li) { 737 // Firefox-bookmarks HTML
738 $tmpEntry = array(); 738 foreach (array('DL','ul') as $list) {
739 $a = $li->find('a'); 739 foreach ($html->find($list) as $ul) {
740 $tmpEntry['url'] = $a[0]->href; 740 foreach ($ul->find('DT') as $li) {
741 $tmpEntry['tags'] = $a[0]->tags; 741 $tmpEntry = array();
742 $tmpEntry['is_read'] = $read; 742 $a = $li->find('A');
743 if ($tmpEntry['url']) { 743 $tmpEntry['url'] = $a[0]->href;
744 $data[] = $tmpEntry; 744 $tmpEntry['tags'] = $a[0]->tags;
745 $tmpEntry['is_read'] = $read;
746 if ($tmpEntry['url']) {
747 $data[] = $tmpEntry;
748 }
745 } 749 }
746 } 750 # the second <ol/ul> is for read links
747 # the second <ol/ul> is for read links 751 $read = ((sizeof($data) && $read)?0:1);
748 $read = ((sizeof($data) && $read)?0:1); 752 }
749 } 753 }
750 } 754 } else {
751 } 755 // regular HTML
756 foreach (array('ol','ul') as $list) {
757 foreach ($html->find($list) as $ul) {
758 foreach ($ul->find('li') as $li) {
759 $tmpEntry = array();
760 $a = $li->find('a');
761 $tmpEntry['url'] = $a[0]->href;
762 $tmpEntry['tags'] = $a[0]->tags;
763 $tmpEntry['is_read'] = $read;
764 if ($tmpEntry['url']) {
765 $data[] = $tmpEntry;
766 }
767 }
768 # the second <ol/ul> is for read links
769 $read = ((sizeof($data) && $read)?0:1);
770 }
771 }
772 }
773 }
752 774
753 // for readability structure 775 // for readability structure
754 776
@@ -766,7 +788,7 @@ class Poche
766 $urlsInserted = array(); //urls of articles inserted 788 $urlsInserted = array(); //urls of articles inserted
767 foreach($data as $record) { 789 foreach($data as $record) {
768 $url = trim(isset($record['article__url']) ? $record['article__url'] : (isset($record['url']) ? $record['url'] : '')); 790 $url = trim(isset($record['article__url']) ? $record['article__url'] : (isset($record['url']) ? $record['url'] : ''));
769 if ($url and !in_array($url, $urlsInserted)) { 791 if (filter_var($url, FILTER_VALIDATE_URL) and !in_array($url, $urlsInserted)) {
770 $title = (isset($record['title']) ? $record['title'] : _('Untitled - Import - ') . '</a> <a href="./?import">' . _('click to finish import') . '</a><a>'); 792 $title = (isset($record['title']) ? $record['title'] : _('Untitled - Import - ') . '</a> <a href="./?import">' . _('click to finish import') . '</a><a>');
771 $body = (isset($record['content']) ? $record['content'] : ''); 793 $body = (isset($record['content']) ? $record['content'] : '');
772 $isRead = (isset($record['is_read']) ? intval($record['is_read']) : (isset($record['archive']) ? intval($record['archive']) : 0)); 794 $isRead = (isset($record['is_read']) ? intval($record['is_read']) : (isset($record['archive']) ? intval($record['archive']) : 0));
diff --git a/inc/poche/Routing.class.php b/inc/poche/Routing.class.php
index 138da48d..33a81435 100755
--- a/inc/poche/Routing.class.php
+++ b/inc/poche/Routing.class.php
@@ -141,7 +141,7 @@ class Routing
141 $pdf->producePDF(); 141 $pdf->producePDF();
142 } elseif (isset($_GET['import'])) { 142 } elseif (isset($_GET['import'])) {
143 $import = $this->wallabag->import(); 143 $import = $this->wallabag->import();
144 $tplVars = array_merge($this->vars, $import); 144 $this->vars = array_merge($this->vars, $import);
145 } elseif (isset($_GET['empty-cache'])) { 145 } elseif (isset($_GET['empty-cache'])) {
146 Tools::emptyCache(); 146 Tools::emptyCache();
147 } elseif (isset($_GET['export'])) { 147 } elseif (isset($_GET['export'])) {
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php
index c8fb2e52..f3d1013f 100755
--- a/inc/poche/Tools.class.php
+++ b/inc/poche/Tools.class.php
@@ -420,4 +420,23 @@ final class Tools
420 return str_replace('+', '', $token); 420 return str_replace('+', '', $token);
421 } 421 }
422 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
423} 442}
diff --git a/install/index.php b/install/index.php
index 654d21ca..bb351095 100755
--- a/install/index.php
+++ b/install/index.php
@@ -36,8 +36,6 @@ if (isset($_SERVER['HTTP_COOKIE'])) {
36if (isset($_SESSION['poche_user'])) { 36if (isset($_SESSION['poche_user'])) {
37 unset($_SESSION['poche_user']); 37 unset($_SESSION['poche_user']);
38} 38}
39session_destroy();
40
41 39
42if (isset($_GET['clean'])) { 40if (isset($_GET['clean'])) {
43 if (is_dir('install')){ 41 if (is_dir('install')){
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 00000000..cfbbf604
--- /dev/null
+++ b/themes/_global/img/appicon/firefox-service-icon-16.png
Binary files differ
diff --git a/themes/_global/img/appicon/firefox-service-icon-32.png b/themes/_global/img/appicon/firefox-service-icon-32.png
new file mode 100644
index 00000000..0c6dcc1b
--- /dev/null
+++ b/themes/_global/img/appicon/firefox-service-icon-32.png
Binary files differ
diff --git a/themes/_global/img/appicon/firefox-service-icon-64.png b/themes/_global/img/appicon/firefox-service-icon-64.png
new file mode 100644
index 00000000..6da3247f
--- /dev/null
+++ b/themes/_global/img/appicon/firefox-service-icon-64.png
Binary files differ
diff --git a/themes/default/_import.twig b/themes/default/_import.twig
index c59b7a15..079203a2 100755
--- a/themes/default/_import.twig
+++ b/themes/default/_import.twig
@@ -2,11 +2,13 @@
2<!-- 2<!--
3 $(document).ready(function() { 3 $(document).ready(function() {
4 $("body").css("cursor", "wait"); 4 $("body").css("cursor", "wait");
5 $("#content").css("display", "none");
5 6
6 setTimeout(function(){ 7 setTimeout(function(){
7 window.location = './?import'; 8 window.location = './?import';
8 }, {{ import.delay }} ); 9 }, {{ import.delay }} );
9 }); 10 });
11
10//--> 12//-->
11</script> 13</script>
12<div class="messages warning"> 14<div class="messages warning">