switch $action à terminer.

This commit is contained in:
Fred Tempez 2022-10-18 18:51:36 +02:00
parent 03d27a5ee4
commit 7ff51d24fb
1 changed files with 26 additions and 18 deletions

View File

@ -569,7 +569,7 @@ class plugin extends common
mkdir($tmpFolder, 0755); mkdir($tmpFolder, 0755);
} }
$target = $this->getUrl(2); $action = $this->getUrl(2);
$moduleId = $this->getUrl(3); $moduleId = $this->getUrl(3);
// Descripteur de l'archive // Descripteur de l'archive
@ -586,7 +586,7 @@ class plugin extends common
// Construire l'archive // Construire l'archive
$this->makeZip($tmpFolder . '/' . $fileName, self::MODULE_DIR . $moduleId); $this->makeZip($tmpFolder . '/' . $fileName, self::MODULE_DIR . $moduleId);
switch ($target) { switch ($action) {
case 'filemanager': case 'filemanager':
if (!file_exists(self::FILE_DIR . 'source/modules')) { if (!file_exists(self::FILE_DIR . 'source/modules')) {
mkdir(self::FILE_DIR . 'source/modules'); mkdir(self::FILE_DIR . 'source/modules');
@ -661,7 +661,7 @@ class plugin extends common
public function dataExport() public function dataExport()
{ {
// Jeton incorrect // Jeton incorrect
if ($this->getUrl(5) !== $_SESSION['csrf']) { if ($this->getUrl(6) !== $_SESSION['csrf']) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . 'plugin', 'redirect' => helper::baseUrl() . 'plugin',
@ -676,8 +676,10 @@ class plugin extends common
mkdir($tmpFolder, 0755); mkdir($tmpFolder, 0755);
} }
$moduleId = $this->getUrl(3); $action = $this->getUrl(2);
$pageId = $this->getUrl(4); $lang = $this->getUrl(3);
$moduleId = $this->getUrl(4);
$pageId = $this->getUrl(5);
// DOnnèes du module de la page sléectionnée // DOnnèes du module de la page sléectionnée
$moduleData = $this->getData(['module', $pageId]); $moduleData = $this->getData(['module', $pageId]);
@ -697,7 +699,12 @@ class plugin extends common
// création du zip // création du zip
if ($success) { if ($success) {
$fileName = $this->getUrl(2) . '-' . $moduleId . '-' . $pageId . '.zip'; switch ($action) {
case 'filemanager':
case 'download':
default:
$fileName = $lang . '-' . $moduleId . '-' . $pageId . '.zip';
$this->makeZip($fileName, $tmpFolder); $this->makeZip($fileName, $tmpFolder);
if (file_exists($fileName)) { if (file_exists($fileName)) {
ob_start(); ob_start();
@ -711,6 +718,7 @@ class plugin extends common
$this->removeDir($tmpFolder); $this->removeDir($tmpFolder);
exit(); exit();
} }
}
} else { } else {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([