diff --git a/.env_default b/.env_default index 712121157ff2b56174c08be1712df4dff76788ae..e851c2492b555c1511182f0316a405aa0f0af708 100644 --- a/.env_default +++ b/.env_default @@ -67,3 +67,6 @@ LEGACY_URL=http://legacy/ LEGACY_URL_EXTERNAL=http://localhost:8081/legacy/ # Should be the path part of the above url LEGACY_EXTERNAL_PREFIX=/legacy + +MEMBER_URL_EXTERNAL=http://localhost:8081/ +FRONT_URL_EXTERNAL=http://localhost:8081/ \ No newline at end of file diff --git a/composer.json b/composer.json index 92f6a3f10a7c92a3ac31aee5e5f771a3cf76ea6a..088822792b0f5177d1ea691677e3127d26c51fe0 100644 --- a/composer.json +++ b/composer.json @@ -50,7 +50,8 @@ "symfonycasts/reset-password-bundle": "^1.11", "symfonycasts/verify-email-bundle": "^1.6", "twig/extra-bundle": "^2.12|^3.0", - "twig/twig": "^2.12|^3.0" + "twig/twig": "^2.12|^3.0", + "ext-simplexml": "*" }, "require-dev": { "ext-dom": "*", diff --git a/docker-compose.yml b/docker-compose.yml index d4c3bf9c4266d899606b20c9f9bfbab896075af4..d0fdb7d86f15aefe8ce9283a6345b6ca12068fd6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,6 +32,9 @@ services: build: ./docker/legacy depends_on: - mysql + environment: + - MEMBER_URL_EXTERNAL + - FRONT_URL_EXTERNAL volumes: - $PWD/legacy:/sites/memorekall/www/web_legacy:rw - $PWD/log:/sites/memorekall/www/log:rw diff --git a/legacy/create.zip b/legacy/create.zip index 83f9d669745e5b5e7234b81ea5b62f6025d5666a..f4d442b6316831971a96e58f64a0bef7712069c3 100644 Binary files a/legacy/create.zip and b/legacy/create.zip differ diff --git a/src/Controller/ProjectController.php b/src/Controller/ProjectController.php index 731385b23bd35430dac7cc30814698a7772fddec..b12df7e4a6d09d89ed6ba4c243ccfacfc9082d29 100644 --- a/src/Controller/ProjectController.php +++ b/src/Controller/ProjectController.php @@ -59,7 +59,10 @@ class ProjectController extends AbstractController return $this->redirectToRoute('capsule_list'); } - private function extractZipArchiveInNewCapsuleDirectory(string $capsule_name): void + /** + * @throws ZipArchiveNotOpeningException The archive file doesn't exist. + */ + private function extractZipArchiveInNewCapsuleDirectory(string $capsule_directory): void { $zip = new ZipArchive(); $zip_file_archive_is_open = $zip->open("create.zip"); @@ -68,27 +71,21 @@ class ProjectController extends AbstractController throw new ZipArchiveNotOpeningException("Create Zip Archive could not be open"); } - $zip->extractTo($capsule_name); + $zip->extractTo($capsule_directory); $zip->close(); } private function addProjectVideoUrlInXMLProjectFile(string $capsule_directory, string $video_url): void { $project_xml_file = $capsule_directory . "/file/project.xml"; - $xml_file_content = file_get_contents($project_xml_file); + $xml_file_content = simplexml_load_file($project_xml_file); + $xml_file_content->video['url'] = $video_url; if (false === $xml_file_content) { throw new FileNotFoundException("The XML project file could not be found"); } - $video_url_XML_tag_is_filled = file_put_contents( - $project_xml_file, - str_replace( - "__video__", - $video_url, - $xml_file_content - ) - ); + $video_url_XML_tag_is_filled = $xml_file_content->saveXML($project_xml_file); if (false === $video_url_XML_tag_is_filled) { throw new XmlParsingException('Video URL could not be written in XML project file'); diff --git a/templates/capsule/index.html.twig b/templates/capsule/index.html.twig index 42ef71e168fdfcf9feb353ea5f491e934f5abcc9..d120f01091b9ebe5ad6f94b0ab576cad92e15440 100644 --- a/templates/capsule/index.html.twig +++ b/templates/capsule/index.html.twig @@ -51,7 +51,7 @@ <div class="d-flex flex-column flex-md-row justify-content-center align-items-center"> <div class="m-4 ratio ratio-16x9"> <iframe - src="{{ legacy_url }}/{{ capsule.getEditionLink() }}" + src="{{ legacy_url }}/{{ capsule.getPreviewLink() }}/?p=read" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen> </iframe>