Commit 1de27b32 authored by Tino Goratsch's avatar Tino Goratsch

replace the KCFinder with RichFilemanager

parent 389adba0
Pipeline #42276546 failed with stages
in 1 minute and 58 seconds

Too many changes to show.

To preserve performance only 1000 of 1000+ 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/dataTables.bootstrap4.js
ACP3/Modules/ACP3/System/Resources/Assets/js/js.cookie.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,
],
],
];