Skip to content

Commit

Permalink
errors in media multi edit if no media selected or no dir
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-peugnet committed Oct 29, 2024
1 parent 4f312bd commit 7cbb532
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions app/class/Controllermedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,23 @@ public function folderdelete()

public function edit()
{
if ($this->user->issupereditor() && isset($_POST['action']) && isset($_POST['id'])) {
if ($_POST['action'] == 'delete') {
if ($this->user->issupereditor() && isset($_POST['action'])) {
if (!isset($_POST['id']) || empty($_POST['id'])) {
$this->sendflashmessage('no media selected', self::FLASH_ERROR);
$this->redirect($this->generate('media') . $_POST['route']);
}
if ($_POST['action'] === 'delete') {
if ($counter = $this->mediamanager->multifiledelete($_POST['id'])) {
$this->sendflashmessage("$counter files deletion successfull", self::FLASH_SUCCESS);
} else {
$this->sendflashmessage('Error while deleting files', self::FLASH_ERROR);
}
} elseif ($_POST['action'] == 'move' && isset($_POST['dir'])) {
}
if ($_POST['action'] === 'move') {
if (!isset($_POST['dir']) || empty($_POST['dir'])) {
$this->sendflashmessage('no direction selected', self::FLASH_ERROR);
$this->redirect($this->generate('media') . $_POST['route']);
}
$count = $this->mediamanager->multimovefile($_POST['id'], $_POST['dir']);

$total = count($_POST['id']);
Expand Down

0 comments on commit 7cbb532

Please sign in to comment.