mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-15 18:57:05 +00:00
[add] upload form for import
This commit is contained in:
parent
4c14936353
commit
31a10069a5
4 changed files with 38 additions and 14 deletions
|
@ -1068,13 +1068,7 @@ class Poche
|
|||
Tools::redirect();
|
||||
}
|
||||
|
||||
$targetDefinition = 'IMPORT_' . strtoupper($from) . '_FILE';
|
||||
$targetFile = constant($targetDefinition);
|
||||
|
||||
if (! defined($targetDefinition)) {
|
||||
$this->messages->add('e', _('Incomplete inc/poche/define.inc.php file, please define "' . $targetDefinition . '".'));
|
||||
Tools::redirect();
|
||||
}
|
||||
$targetFile = CACHE . '/' . constant(strtoupper($from) . '_FILE');
|
||||
|
||||
if (! file_exists($targetFile)) {
|
||||
$this->messages->add('e', _('Could not find required "' . $targetFile . '" import file.'));
|
||||
|
@ -1084,6 +1078,22 @@ class Poche
|
|||
$this->$providers[$from]($targetFile);
|
||||
}
|
||||
|
||||
public function uploadFile() {
|
||||
if(isset($_FILES['file']))
|
||||
{
|
||||
$dir = CACHE . '/';
|
||||
$file = basename($_FILES['file']['name']);
|
||||
if(move_uploaded_file($_FILES['file']['tmp_name'], $dir . $file)) {
|
||||
$this->messages->add('s', _('File uploaded. You can now execute import.'));
|
||||
}
|
||||
else {
|
||||
$this->messages->add('e', _('Error while importing file. Do you have access to upload it?'));
|
||||
}
|
||||
}
|
||||
|
||||
Tools::redirect('?view=config');
|
||||
}
|
||||
|
||||
/**
|
||||
* export poche entries in json
|
||||
* @return json all poche entries
|
||||
|
|
|
@ -241,7 +241,6 @@ class Tools
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static function download_db() {
|
||||
header('Content-Disposition: attachment; filename="poche.sqlite.gz"');
|
||||
self::status(200);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue