mirror of
https://github.com/friendica/friendica
synced 2024-11-09 17:02:54 +00:00
Merge pull request #14414 from ne20002/fix/14407
fix upload of csv server blocklist
This commit is contained in:
commit
9bf5b27362
1 changed files with 20 additions and 22 deletions
|
@ -58,23 +58,22 @@ class Import extends \Friendica\Module\BaseModeration
|
|||
$this->blocklist = $this->localBlocklist::extractFromCSVFile($_FILES['listfile']['tmp_name']);
|
||||
} catch (\Throwable $e) {
|
||||
$this->systemMessages->addNotice($this->t('Error importing pattern file'));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($request['page_blocklist_import'])) {
|
||||
$blocklist = json_decode($request['blocklist'], true);
|
||||
if ($blocklist === null) {
|
||||
}
|
||||
else if (isset($request['page_blocklist_import'])) {
|
||||
$this->blocklist = json_decode($request['blocklist'], true);
|
||||
if ($this->blocklist === null) {
|
||||
$this->systemMessages->addNotice($this->t('Error importing pattern file'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (($request['mode'] ?? 'append') == 'replace') {
|
||||
$this->localBlocklist->set($blocklist);
|
||||
$this->localBlocklist->set($this->blocklist);
|
||||
$this->systemMessages->addNotice($this->t('Local blocklist replaced with the provided file.'));
|
||||
} else {
|
||||
$count = $this->localBlocklist->append($blocklist);
|
||||
$count = $this->localBlocklist->append($this->blocklist);
|
||||
if ($count) {
|
||||
$this->systemMessages->addNotice($this->tt('%d pattern was added to the local blocklist.', '%d patterns were added to the local blocklist.', $count));
|
||||
} else {
|
||||
|
@ -86,7 +85,6 @@ class Import extends \Friendica\Module\BaseModeration
|
|||
|
||||
$this->baseUrl->redirect('/moderation/blocklist/server');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $request
|
||||
|
|
Loading…
Reference in a new issue