Commit 5661fb2d authored by Tino Goratsch's avatar Tino Goratsch

replace the KCFinder with RichFilemanager

parent b4262007
Pipeline #42276208 passed with stages
in 2 minutes and 46 seconds

Too many changes to show.

To preserve performance only 417 of 417+ files are displayed.

**/*min.js
ACP3/Modules/ACP3/Filemanager/libraries/kcfinder/*
ACP3/Modules/ACP3/Filemanager/Resources/Assets/rich-filemanager/*
ACP3/Modules/ACP3/Wysiwygckeditor/Resources/Assets/js/ckeditor/*
ACP3/Modules/ACP3/System/Resources/Assets/js/bootbox.js
ACP3/Modules/ACP3/System/Resources/Assets/js/dataTables.bootstrap.js
......
......@@ -10,11 +10,11 @@
/node_modules
/tests/cache/
/uploads/.htaccess
/uploads/_thumbs/*
/uploads/assets/*
/uploads/categories/*
/uploads/files/*
/uploads/gallery/*
/uploads/kcfinder/*
/vendor
/.htaccess
/sitemap*.xml
......
<?php
$finder = PhpCsFixer\Finder::create()
->exclude('ACP3/Modules/ACP3/Filemanager/libraries')
->notPath('#ACP3/Modules/.*/.*/Resources#')
->exclude('build')
->exclude('cache')
->exclude('designs')
......
......@@ -12,7 +12,7 @@ $iterator = Finder::create()
->name('*.php')
->exclude('Resources')
->exclude('Tests')
->exclude('Modules/ACP3/Filemanager/libraries/kcfinder')
->notPath('#ACP3/Modules/.*/.*/Resources#')
->in($dir = __DIR__ . '/ACP3');
return new Sami($iterator, array(
......
<?php
/**
* Copyright (c) by the ACP3 Developers.
* See the LICENSE file at the top-level module directory for licensing details.
*/
namespace ACP3\Modules\ACP3\Filemanager\Controller\Admin\Index;
use ACP3\Core\Controller\AbstractFrontendAction;
class RichFileManager extends AbstractFrontendAction
{
/**
* @throws \Exception
*/
public function execute(): void
{
$app = new \RFM\Application();
$local = new \RFM\Repository\Local\Storage($this->getFileManagerConfig());
$local->setRoot($this->appPath->getUploadsDir(), true, false);
$app->setStorage($local);
$app->api = new \RFM\Api\LocalApi();
$app->run();
}
/**
* @return array
*/
private function getFileManagerConfig(): array
{
return [
'security' => [
'patterns' => [
'policy' => 'DISALLOW_LIST',
'ignoreCase' => true,
'restrictions' => [
'*/.htaccess',
'*/web.config',
'*/cache/*',
'*/assets/*',
],
],
],
];
}
}
<?php
/**
* Copyright (c) by the ACP3 Developers.
* See the LICENSE file at the top-level module directory for licensing details.
*/
namespace ACP3\Modules\ACP3\Filemanager\Helper;
use ACP3\Core\Authentication\AuthenticationInterface;
use ACP3\Modules\ACP3\Users\Model\UserModel;
class KCFinderAuthenticationHelper
{
/**
* @var \ACP3\Core\Authentication\AuthenticationInterface
*/
private $authentication;
/**
* @var \ACP3\Modules\ACP3\Users\Model\UserModel
*/
private $userModel;
/**
* @var string
*/
private $environment;
public function __construct(
AuthenticationInterface $authentication,
UserModel $userModel,
string $environment
) {
$this->authentication = $authentication;
$this->userModel = $userModel;
$this->environment = $environment;
}
public function checkAuthorization(): bool
{
$this->authentication->authenticate();
return $this->userModel->isAuthenticated();
}
}
......@@ -31,6 +31,6 @@ class Helpers
*/
public function getFilemanagerPath()
{
return $this->appPath->getWebRoot() . 'ACP3/Modules/ACP3/Filemanager/libraries/kcfinder/';
return $this->appPath->getWebRoot() . 'ACP3/Modules/ACP3/Filemanager/Resources/Assets/rich-filemanager/index.html';
}
}
......@@ -18,7 +18,11 @@ class Migration implements Modules\Installer\MigrationInterface
*/
public function schemaUpdates()
{
return [];
return [
2 => [
"INSERT INTO `{pre}acl_resources` (`module_id`, `area`, `controller`, `page`, `params`, `privilege_id`) VALUES ('{moduleId}', 'admin', 'index', 'richfilemanager', '', 3);",
],
];
}
/**
......
......@@ -7,6 +7,7 @@
namespace ACP3\Modules\ACP3\Filemanager\Installer;
use ACP3\Core\ACL\PrivilegeEnum;
use ACP3\Core\Modules;
class Schema implements Modules\Installer\SchemaInterface
......@@ -18,7 +19,13 @@ class Schema implements Modules\Installer\SchemaInterface
*/
public function specialResources()
{
return [];
return [
'admin' => [
'index' => [
'richfilemanager' => PrivilegeEnum::ADMIN_VIEW,
],
],
];
}
/**
......@@ -34,7 +41,7 @@ class Schema implements Modules\Installer\SchemaInterface
*/
public function getSchemaVersion()
{
return 1;
return 2;
}
/**
......
{
"_comment": "IMPORTANT : go to the wiki page to know about options configuration https://github.com/servocoder/RichFilemanager/wiki/Configuration-options",
"options": {
"theme": "flat-dark",
"showTitleAttr": false,
"showConfirmation": true,
"browseOnly": false,
"fileSorting": "NAME_ASC",
"folderPosition": "bottom",
"quickSelect": false,
"logger": false,
"allowFolderDownload": true,
"allowChangeExtensions": false,
"capabilities": [
"select",
"upload",
"download",
"rename",
"copy",
"move",
"delete",
"extract",
"createFolder"
]
},
"language": {
"default": "en",
"available": ["ar", "bs", "ca", "cs", "da", "de", "el", "en", "es", "fa", "fi", "fr", "he", "hu", "it", "ja", "nl", "pl", "pt", "ru", "sv", "th", "tr", "vi", "zh-CN", "zh-TW"]
},
"formatter": {
"datetime": {
"skeleton": "yMMMdHm"
}
},
"filetree": {
"enabled": true,
"foldersOnly": false,
"reloadOnClick": true,
"expandSpeed": 200,
"showLine": true,
"width": 200,
"minWidth": 200
},
"manager": {
"defaultViewMode": "grid",
"dblClickOpen": false,
"selection": {
"enabled": true,
"useCtrlKey": true
},
"renderer": {
"position": false,
"indexFile": "readme.md"
}
},
"api": {
"lang": "php",
"connectorUrl": false,
"requestParams": {
"GET": {},
"POST": {},
"MIXED": {}
}
},
"upload": {
"multiple": true,
"maxNumberOfFiles": 5,
"chunkSize": false
},
"clipboard": {
"enabled": true,
"encodeCopyUrl": true
},
"filter": {
"image": ["jpg", "jpeg", "gif", "png", "svg"],
"media": ["ogv", "avi", "mkv", "mp4", "webm", "m4v", "ogg", "mp3", "wav"],
"office": ["txt", "pdf", "odp", "ods", "odt", "rtf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "csv", "md"],
"archive": ["zip", "tar", "rar"],
"audio": ["ogg", "mp3", "wav"],
"video": ["ogv", "avi", "mkv", "mp4", "webm", "m4v"]
},
"search": {
"enabled": true,
"recursive": false,
"caseSensitive": false,
"typingDelay": 500
},
"viewer": {
"absolutePath": true,
"previewUrl": false,
"image": {
"enabled": true,
"lazyLoad": true,
"showThumbs": true,
"thumbMaxWidth": 64,
"extensions": [
"jpg",
"jpe",
"jpeg",
"gif",
"png",
"svg"
]
},
"video": {
"enabled": true,
"extensions": [
"ogv",
"mp4",
"webm",
"m4v"
],
"playerWidth": 400,
"playerHeight": 222
},
"audio": {
"enabled": true,
"extensions": [
"ogg",
"mp3",
"wav"
]
},
"iframe": {
"enabled": true,
"extensions": [
"htm",
"html"
],
"readerWidth": "95%",
"readerHeight": "600"
},
"opendoc": {
"enabled": true,
"extensions": [
"pdf",
"odt",
"odp",
"ods"
],
"readerWidth": "640",
"readerHeight": "480"
},
"google": {
"enabled": true,
"extensions": [
"doc",
"docx",
"xls",
"xlsx",
"ppt",
"pptx"
],
"readerWidth": "640",
"readerHeight": "480"
},
"codeMirrorRenderer": {
"enabled": true,
"extensions": [
"txt",
"csv"
]
},
"markdownRenderer": {
"enabled": true,
"extensions": [
"md"
]
}
},
"editor": {
"enabled": true,
"theme": "default",
"lineNumbers": true,
"lineWrapping": true,
"codeHighlight": true,
"matchBrackets": true,
"extensions": [
"html",
"txt",
"csv",
"md"
]
},
"customScrollbar": {
"enabled": true,
"theme": "inset-2-dark",
"button": true
},
"extras": {
"extra_js": [],
"extra_js_async": true
},
"url": "https://github.com/servocoder/RichFilemanager",
"version": "2.7.6"
}
{
"options": {
"theme": "default",
"showTitleAttr": false,
"showConfirmation": true,
"browseOnly": false,
"fileSorting": "NAME_ASC",
"folderPosition": "bottom",
"quickSelect": false,
"logger": false,
"allowFolderDownload": false,
"allowChangeExtensions": false,
"capabilities": [
"select",
"upload",
"delete",
"createFolder"
]
},
"language": {
"default": "en",
"available": ["ar", "bs", "ca", "cs", "da", "de", "el", "en", "es", "fa", "fi", "fr", "he", "hu", "it", "ja", "nl", "pl", "pt", "ru", "sv", "th", "tr", "vi", "zh-CN", "zh-TW"]
},
"formatter": {
"datetime": {
"skeleton": "yMMMdHm"
}
},
"filetree": {
"enabled": true,
"foldersOnly": true,
"reloadOnClick": true,
"expandSpeed": 200,
"showLine": true,
"width": 200,
"minWidth": 200
},
"manager": {
"defaultViewMode": "grid",
"dblClickOpen": false,
"selection": {
"enabled": true,
"useCtrlKey": true
},
"renderer": {
"position": false,
"indexFile": "readme.md"
}
},
"api": {
"lang": "php",
"connectorUrl": "../../../../../../../index.php/acp/filemanager/index/richfilemanager/",
"requestParams": {
"GET": {},
"POST": {},
"MIXED": {}
}
},
"upload": {
"multiple": true,
"maxNumberOfFiles": 5,
"chunkSize": false
},
"clipboard": {
"enabled": true,
"encodeCopyUrl": true
},
"filter": {
"image": ["jpg", "jpeg", "gif", "png", "svg"],
"media": ["ogv", "avi", "mkv", "mp4", "webm", "m4v", "ogg", "mp3", "wav"],
"office": ["txt", "pdf", "odp", "ods", "odt", "rtf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "csv", "md"],
"archive": ["zip", "tar", "rar"],
"audio": ["ogg", "mp3", "wav"],
"video": ["ogv", "avi", "mkv", "mp4", "webm", "m4v"]
},
"search": {
"enabled": false,
"recursive": false,
"caseSensitive": false,