diff --git a/Admin/Routes/Web/Api.php b/Admin/Routes/Web/Api.php index d691c8b..653d899 100755 --- a/Admin/Routes/Web/Api.php +++ b/Admin/Routes/Web/Api.php @@ -22,6 +22,7 @@ return [ [ 'dest' => '\Modules\Media\Controller\ApiController:apiMediaUpload', 'verb' => RouteVerb::PUT, + 'csrf' => true, 'permission' => [ 'module' => ApiController::NAME, 'type' => PermissionType::CREATE, @@ -31,6 +32,7 @@ return [ [ 'dest' => '\Modules\Media\Controller\ApiController:apiMediaUpdate', 'verb' => RouteVerb::SET, + 'csrf' => true, 'permission' => [ 'module' => ApiController::NAME, 'type' => PermissionType::CREATE, @@ -42,6 +44,7 @@ return [ [ 'dest' => '\Modules\Media\Controller\ApiController:apiMediaCreate', 'verb' => RouteVerb::PUT, + 'csrf' => true, 'permission' => [ 'module' => ApiController::NAME, 'type' => PermissionType::CREATE, @@ -53,6 +56,7 @@ return [ [ 'dest' => '\Modules\Media\Controller\ApiController:apiMediaExport', 'verb' => RouteVerb::GET, + 'csrf' => true, 'permission' => [ 'module' => ApiController::NAME, 'type' => PermissionType::READ, @@ -64,6 +68,7 @@ return [ [ 'dest' => '\Modules\Media\Controller\ApiController:apiCollectionCreate', 'verb' => RouteVerb::PUT, + 'csrf' => true, 'permission' => [ 'module' => ApiController::NAME, 'type' => PermissionType::CREATE, diff --git a/Controller/ApiController.php b/Controller/ApiController.php index fd40d65..510ad14 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -1015,7 +1015,7 @@ final class ApiController extends Controller $childCollection->setVirtualPath('/'. \ltrim($virtual, '/')); // We assume that the new path is real path of the first found parent directory + the new virtual path - $childCollection->setPath($real . '/' . \ltrim($newVirtual, '/')); + $childCollection->setPath(\rtrim($real, '/') . '/' . \ltrim($newVirtual, '/')); $this->createModel($account, $childCollection, CollectionMapper::class, 'collection', '127.0.0.1'); $this->createModelRelation( diff --git a/Models/MediaMapper.php b/Models/MediaMapper.php index 14ca5b8..3b231ab 100755 --- a/Models/MediaMapper.php +++ b/Models/MediaMapper.php @@ -190,8 +190,12 @@ class MediaMapper extends DataMapperFactory */ public static function getParentCollection(string $path = '/') : ReadMapper { - $virtualPath = '/' . \trim(\substr($path, 0, \strripos($path, '/') + 1), '/'); - $name = \substr($path, \strripos($path, '/') + 1); + $path = \dirname($path); + $name = \basename($path); + $virtualPath = '/' . \trim(\dirname($path), '/'); + + //$virtualPath = '/' . \trim(\substr($path, 0, \strripos($path, '/') + 1), '/'); + //$name = \substr($path, \strripos($path, '/') + 1); return CollectionMapper::get() ->with('sources') diff --git a/Theme/Backend/Components/Media/invalidPassword.tpl.php b/Theme/Backend/Components/Media/invalidPassword.tpl.php index 79f826d..6ed0807 100755 --- a/Theme/Backend/Components/Media/invalidPassword.tpl.php +++ b/Theme/Backend/Components/Media/invalidPassword.tpl.php @@ -18,7 +18,7 @@ use phpOMS\Uri\UriFactory;
-
+
diff --git a/Theme/Backend/Components/Media/list.tpl.php b/Theme/Backend/Components/Media/list.tpl.php index 4524682..7a3443d 100755 --- a/Theme/Backend/Components/Media/list.tpl.php +++ b/Theme/Backend/Components/Media/list.tpl.php @@ -58,8 +58,10 @@ $next = empty($this->media)
+
\ No newline at end of file diff --git a/Theme/Backend/Components/Upload/upload-list.tpl.php b/Theme/Backend/Components/Upload/upload-list.tpl.php index cc6572b..1f850e9 100755 --- a/Theme/Backend/Components/Upload/upload-list.tpl.php +++ b/Theme/Backend/Components/Upload/upload-list.tpl.php @@ -99,7 +99,7 @@ use phpOMS\Uri\UriFactory; files)->id === $file->id ? ' checked' : ''; ?>> - printHtml((string) $file->id); ?> + id; ?> printHtml($file->name); ?> attachment diff --git a/Theme/Backend/media-collection-create.tpl.php b/Theme/Backend/media-collection-create.tpl.php index de72501..3b75393 100755 --- a/Theme/Backend/media-collection-create.tpl.php +++ b/Theme/Backend/media-collection-create.tpl.php @@ -22,14 +22,14 @@ use phpOMS\Uri\UriFactory;
- +
getHtml('CreateCollection'); ?>
diff --git a/Theme/Backend/media-file-create.tpl.php b/Theme/Backend/media-file-create.tpl.php index bde3e11..7ef4bb3 100755 --- a/Theme/Backend/media-file-create.tpl.php +++ b/Theme/Backend/media-file-create.tpl.php @@ -75,7 +75,7 @@ use phpOMS\Uri\UriFactory;
diff --git a/Theme/Backend/media-upload.tpl.php b/Theme/Backend/media-upload.tpl.php index 1977cb3..3412b6b 100755 --- a/Theme/Backend/media-upload.tpl.php +++ b/Theme/Backend/media-upload.tpl.php @@ -29,7 +29,7 @@ use phpOMS\Uri\UriFactory;
-
+
getHtml('Upload'); ?>