X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=inc%2Fpoche%2FPoche.class.php;h=d039de1f1877d6cc9b70b86d44cd2d3dabce47d0;hb=f0a819a968e5d935c757bb65acdfbca480398274;hp=b27dda6c220fb949670b306e3fc1288f17ed7b97;hpb=ae27d0ffca1c3a381226fed42adea66c3971fdde;p=github%2Fwallabag%2Fwallabag.git diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index b27dda6c..d039de1f 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -556,7 +556,7 @@ class Poche if ($this->store->retrieveOneById($next_id, $this->user->getId())) { $next = TRUE; } - $navigate = $arrayName = array('previous' => $previous, 'previousid' => $previous_id, 'next' => $next, 'nextid' => $next_id); + $navigate = array('previous' => $previous, 'previousid' => $previous_id, 'next' => $next, 'nextid' => $next_id); # tags $tags = $this->store->retrieveTagsByEntry($entry['id']); @@ -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