diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index d297807a8..0754d6599 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)->innertext == "") { + // 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 @@ -766,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)); 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'])) { diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index c8fb2e527..f3d1013fe 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -420,4 +420,23 @@ 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 + * + */ + + public static function get_doctype($doc) + { + $els = $doc->find('unknown'); + + foreach ($els as $e => $el) + if ($el->parent()->tag == 'root') + return $el; + + return NULL; + } + } 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')){ 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 000000000..cfbbf604a Binary files /dev/null and b/themes/_global/img/appicon/firefox-service-icon-16.png 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 000000000..0c6dcc1b0 Binary files /dev/null and b/themes/_global/img/appicon/firefox-service-icon-32.png 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 000000000..6da3247f8 Binary files /dev/null and b/themes/_global/img/appicon/firefox-service-icon-64.png differ 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 @@