PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.1
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.1
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | back/Controllers/FileController.php +0 -65 11.1.0 → 11.1.1 View file →
@@ -1,65 +1,0 @@
1 -<?php
2 -
3 -namespace AcyMailing\Controllers;
4 -
5 -use AcyMailing\Core\AcymController;
6 -use AcyMailing\Types\FileTreeType;
7 -
8 -class FileController extends AcymController
9 -{
10 - public function __construct()
11 - {
12 - parent::__construct();
13 -
14 - $this->setDefaultTask('select');
15 - }
16 -
17 - public function select(): void
18 - {
19 - acym_setVar('layout', 'select');
20 -
21 - $warnings = '';
22 - $uploadFolderBase = acym_getFilesFolder();
23 - $currentFolder = acym_getVar('string', 'currentFolder', $uploadFolderBase);
24 - if (strpos($currentFolder, $uploadFolderBase) !== 0 || strpos($currentFolder, '..') !== false) {
25 - $currentFolder = $uploadFolderBase;
26 - }
27 -
28 - $uploadFolder = trim(str_replace('/', DS, trim($currentFolder)), DS);
29 - $uploadPath = acym_cleanPath(ACYM_ROOT.$uploadFolder);
30 - $folders = acym_generateArborescence([$uploadFolderBase]);
31 -
32 - $uploadedFile = acym_getVar('array', 'uploadedFile', [], 'files');
33 - $selectedFile = '';
34 - if (!empty($uploadedFile['name'])) {
35 - wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
36 -
37 - ob_start();
38 - $uploaded = acym_importFile($uploadedFile, $uploadPath, false);
39 - $warnings = ob_get_clean();
40 - if (!empty($uploaded)) {
41 - $selectedFile = $uploaded;
42 - }
43 - }
44 -
45 - $files = [];
46 - if (file_exists($uploadPath)) {
47 - $files = acym_getFiles($uploadPath);
48 - }
49 -
50 - $data = [
51 - 'files' => $files,
52 - 'uploadFolder' => $uploadFolder,
53 - 'map' => acym_getVar('string', 'id'),
54 - 'displayType' => acym_getVar('string', 'displayType', 'icons'),
55 - 'imageExtensions' => acym_getImageFileExtensions(),
56 - 'allowedExtensions' => explode(',', $this->config->get('allowed_files')),
57 - 'folders' => $folders,
58 - 'fileTreeType' => new FileTreeType(),
59 - 'selectedFile' => $selectedFile,
60 - 'warnings' => $warnings,
61 - ];
62 -
63 - parent::display($data);
64 - }
65 -}