mirror of
https://github.com/wallabag/wallabag.git
synced 2025-02-12 16:55:13 +00:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
900f2a9160
8 changed files with 60 additions and 19 deletions
|
@ -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 == "<!DOCTYPE NETSCAPE-Bookmark-file-1>") {
|
||||
// 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 <ol/ul> is for read links
|
||||
$read = ((sizeof($data) && $read)?0:1);
|
||||
# the second <ol/ul> 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 <ol/ul> 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 - ') . '</a> <a href="./?import">' . _('click to finish import') . '</a><a>');
|
||||
$body = (isset($record['content']) ? $record['content'] : '');
|
||||
$isRead = (isset($record['is_read']) ? intval($record['is_read']) : (isset($record['archive']) ? intval($record['archive']) : 0));
|
||||
|
|
|
@ -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'])) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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')){
|
||||
|
|
BIN
themes/_global/img/appicon/firefox-service-icon-16.png
Normal file
BIN
themes/_global/img/appicon/firefox-service-icon-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 337 B |
BIN
themes/_global/img/appicon/firefox-service-icon-32.png
Normal file
BIN
themes/_global/img/appicon/firefox-service-icon-32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 675 B |
BIN
themes/_global/img/appicon/firefox-service-icon-64.png
Normal file
BIN
themes/_global/img/appicon/firefox-service-icon-64.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -2,11 +2,13 @@
|
|||
<!--
|
||||
$(document).ready(function() {
|
||||
$("body").css("cursor", "wait");
|
||||
$("#content").css("display", "none");
|
||||
|
||||
setTimeout(function(){
|
||||
window.location = './?import';
|
||||
}, {{ import.delay }} );
|
||||
});
|
||||
|
||||
//-->
|
||||
</script>
|
||||
<div class="messages warning">
|
||||
|
|
Loading…
Reference in a new issue