diff --git a/composer.lock b/composer.lock index 53c650531a8ac8fff208505e5d024e216c471070..05f21f9ea9ca3c407599322cb4066c36d550318a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b63b0363576a36d88b7d444dc9451ce5", + "content-hash": "9e0fb1d1270499adf1e3618f2c6abf83", "packages": [ { "name": "composer/package-versions-deprecated", @@ -7204,16 +7204,16 @@ }, { "name": "symfony/uid", - "version": "v5.3.10", + "version": "v5.3.13", "source": { "type": "git", "url": "https://github.com/symfony/uid.git", - "reference": "183336998e6b28c37ebf04ee18e6359dfb22084d" + "reference": "915b11b94a6a14627234f89696370d2db3e1b43b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/uid/zipball/183336998e6b28c37ebf04ee18e6359dfb22084d", - "reference": "183336998e6b28c37ebf04ee18e6359dfb22084d", + "url": "https://api.github.com/repos/symfony/uid/zipball/915b11b94a6a14627234f89696370d2db3e1b43b", + "reference": "915b11b94a6a14627234f89696370d2db3e1b43b", "shasum": "" }, "require": { @@ -7254,10 +7254,11 @@ "homepage": "https://symfony.com", "keywords": [ "UID", + "ulid", "uuid" ], "support": { - "source": "https://github.com/symfony/uid/tree/v5.3.10" + "source": "https://github.com/symfony/uid/tree/v5.3.13" }, "funding": [ { @@ -7273,7 +7274,7 @@ "type": "tidelift" } ], - "time": "2021-10-15T16:00:52+00:00" + "time": "2021-12-16T21:47:07+00:00" }, { "name": "symfony/validator", @@ -11964,6 +11965,8 @@ "ext-json": "*", "ext-zip": "^1.15" }, - "platform-dev": [], + "platform-dev": { + "ext-dom": "*" + }, "plugin-api-version": "2.1.0" } diff --git a/docker/legacy/front.conf b/docker/legacy/front.conf index 647a65b03c683aec90e2dc819189833d2e575fcf..cb8390c34bc58b6e3fb34b0c210a97367f4bae91 100644 --- a/docker/legacy/front.conf +++ b/docker/legacy/front.conf @@ -9,7 +9,7 @@ AllowOverride None Require all granted - DirectoryIndex index1.php, index.html + DirectoryIndex index.php, index.html </Directory> # uncomment the following lines if you install assets as symlinks diff --git a/legacy/index1.php b/legacy/index1.php deleted file mode 100644 index 73617603e42352d8814ad0f6e8fa2768c6d5f22e..0000000000000000000000000000000000000000 --- a/legacy/index1.php +++ /dev/null @@ -1,110 +0,0 @@ -<?php -// //Créé un projet Rekall -// function createProject($name, $videoUrl, $sha1password) { -// $retours = array("success" => 0, "error" => "", "value" => ""); -// $name = sanitize($name); -// -// if($name == "") -// $name = sha1(rand()); -// -// if(!file_exists($name)) { -// $zip = new ZipArchive; -// $res = $zip->open("create.zip"); -// if ($res === TRUE) { -// $zip->extractTo($name); -// $zip->close(); -// file_put_contents($name."/file/project.xml", str_replace("__video__", $videoUrl, file_get_contents($name."/file/project.xml"))); -// file_put_contents($name."/file/projectPassword.txt", $sha1password); -// $retours["success"] = 1; -// } else { -// $retours["success"] = -1; -// $retours["error"] = "No seed found"; -// } -// } -// else { -// $retours["success"] = 0; -// $retours["error"] = "Project already exists"; -// } -// $retours["value"] = $name; -// -// echo json_encode($retours); -// } -// -// if((isset($_POST["create"])) && (isset($_POST["video"])) && (isset($_POST["p"]))) { -// createProject($_POST["create"], $_POST["video"], $_POST["p"]); -// exit(); -// } -//?> -<!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">--> -<!--<html xmlns="http://www.w3.org/1999/xhtml">--> -<!--<head>--> -<!-- <meta http-equiv="Content-type" content="text/html; charset=UTF-8">--> -<!-- <meta http-equiv="Content-Language" content="fr">--> -<!-- <meta name="language" content="fr">--> -<!-- <meta name="designer" content="buzzing light"> --> -<!-- <meta name="copyright" content="buzzing light">--> -<!-- <meta name="HandheldFriendly" content="true" />--> -<!-- <meta name="viewport" content="width=device-width, user-scalable=no"><!--, minimum-scale=1.0, maximum-scale=1.0-->--> -<!-- <meta name="apple-mobile-web-app-capable" content="yes">--> -<!-- <meta name="apple-mobile-web-app-status-bar-style" content="black">--> -<!----> -<!-- <link rel="apple-touch-icon" href="favicon.png" />--> -<!-- <link rel="stylesheet" type="text/css" href="css/reset.css" />--> -<!----> -<!-- <title>Rekall</title>--> -<!-- --> -<!-- <script language="javascript" type='text/javascript' src='js/jquery.min.js'></script> --> -<!-- <script language="javascript" type='text/javascript' src='js/sha1.js'></script>--> -<!-- <link rel="stylesheet" type="text/css" href="css/create-theme.css" /> --> -<!-- --> -<!-- <script language="javascript" type='text/javascript'>--> -<!-- $(document).ready(function() {--> -<!-- $("#formCreate").submit(function(event) {--> -<!-- event.stopPropagation();--> -<!-- if(($("input[name=create]").val() != "") && ($("input[name=video]").val() != "") /*&& ($("input[name=password]").val() != "")*/) {--> -<!-- var passwordRaw = "000000"; //$("input[name=p]").val();--> -<!-- var password = (CryptoJS.SHA1(passwordRaw) + "").toUpperCase();--> -<!-- $("#submitCreate").hide();--> -<!-- $.ajax("index.php", {--> -<!-- type: "POST",--> -<!-- dataType: "json",--> -<!-- data: {"create": $("input[name=create]").val(), "video": $("input[name=video]").val(), "p": password},--> -<!-- success: function(retour) {--> -<!-- console.log(retour);--> -<!-- if(retour.success == 1) {--> -<!-- window.document.location = document.URL.substr(0,document.URL.lastIndexOf('/')) + "/" + retour.value + "/?p=" + password;--> -<!-- }--> -<!-- else {--> -<!-- alert(retour.error)--> -<!-- $("#submitCreate").show();--> -<!-- }--> -<!-- },--> -<!-- error: function(retour) {--> -<!-- $("#submitCreate").show();--> -<!-- }--> -<!-- }); --> -<!-- }--> -<!-- else--> -<!-- alert("Merci de saisir tous les champs");--> -<!-- return false;--> -<!-- }); --> -<!-- });--> -<!-- </script>--> -<!--</head>--> -<!--<body id="createProjectBody"> --> -<!-- <img id="createProjectLogo" src="css/images/logo.png" />--> -<!-- <br/><div class="col-md-12 row-title-box">--> -<!-- <div class="row-title">Create Capsule</div>--> -<!-- </div>--> -<!-- <form action="index.php" method="post" id='formCreate'>--> -<!-- <label>Name of the capsule</label>--> -<!-- <input type="text" name="create" placeholder="my-project-name" size="30"><br/>--> -<!-- <label>YouTube or Vimeo video URL</label>--> -<!-- <input type="text" name="video" placeholder="https://www.youtube.com/watch?v=4Rcw5GCXJnQ" size="30"><br/>--> -<!-- <!--<label>Edition password *</label>--> -<!-- <input type="password" name="p" placeholder="password" size="30"><br/>-->--> -<!----> -<!-- <input id="submitCreate" type="submit" value="Create a capsule" name="submit">--> -<!-- </form> --> -<!--</body>--> -<!--</html>--> \ No newline at end of file diff --git a/src/Controller/CapsuleController.php b/src/Controller/CapsuleController.php index 6879e0caf1abdb4fbcef569678621652db359bf4..11e43660dc01286a08361e0eaefb16b03fdcbbbd 100644 --- a/src/Controller/CapsuleController.php +++ b/src/Controller/CapsuleController.php @@ -4,13 +4,11 @@ namespace App\Controller; use App\Entity\Capsule; use App\Entity\User; -use App\Exception\CapsuleNotFoundException; use App\Form\CreateCapsuleFormType; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\Security\Core\Exception\UserNotFoundException; use Symfony\Component\Uid\Uuid; class CapsuleController extends AbstractController @@ -68,48 +66,4 @@ class CapsuleController extends AbstractController 'capsuleCreationForm' => $form->createView() ]); } - -// /** -// * @Route("/capsule/{edition_link}", name="edit_capsule") -// */ -// public function edit(string $edition_link): Response -// { -// $current_user = $this->getUser(); -// -// if (! $current_user instanceof User) { -// return $this->redirectToRoute('app_login'); -// } -// -// $user_id = $current_user->getId(); -// $capsule_repository = $this->getDoctrine() -// ->getRepository(Capsule::class); -// $capsule = $capsule_repository->findOneBy(['edition_link' => $edition_link]); -// -// if (! $capsule instanceof Capsule) { -// throw new CapsuleNotFoundException("The capsule was not found"); -// } -// $author_capsule_creation = $capsule->getCreationAuthor(); -// -// if (! $author_capsule_creation instanceof User) { -// throw new UserNotFoundException("The capsule author was not found"); -// } -// -// $author_capsule_creation_id = $author_capsule_creation->getId(); -// -// if ($user_id === $author_capsule_creation_id) { -// return $this->render("project/edit.html.twig", [ -//// 'url' => $url -// ]); -// } -// -// return $this->render('capsule/no_edition_access.html.twig'); -// } - -// /** -// * @Route("/capsule/{preview_link}", name="display_capsule") -// */ -// public function show(Capsule $capsule): Response -// { -// return $this->redirectToRoute('get_legacy_resource'); -// } } diff --git a/src/Controller/FallbackController.php b/src/Controller/FallbackController.php index 4a96ee8d8e71b54931388c6b522870b9a0d3f088..dfa97390c5366244dfda1ba63fae4f38fd262fdd 100644 --- a/src/Controller/FallbackController.php +++ b/src/Controller/FallbackController.php @@ -83,8 +83,7 @@ class FallbackController extends AbstractController //$url = "{$path_to_legacy_code}{$originalController}"; $url = "{$originalController}"; try { - $legacy_helper = new LegacyHelper(); - $mime = $legacy_helper->getMime($url, $extension); + $mime = LegacyHelper::getMime($url, $extension); $response = new BinaryFileResponse($url); $response->headers->set('Content-Type', $mime ?: 'application/octet-stream'); return $response; @@ -103,9 +102,8 @@ class FallbackController extends AbstractController "{$originalController}{$separator}?{$originalQueryString}"; $url = preg_replace('(^https?:\/\/[^/]+(:\d+)?)', '', $url); - // TODO: fix regex -// $pattern = '/\/\//i'; -// $url = preg_replace($pattern, '/', $url); + $pattern = '/\/\//i'; + $url = preg_replace($pattern, '/', $url); return $this->render("project/edit.html.twig", [ 'url' => $url diff --git a/src/Controller/ProjectController.php b/src/Controller/ProjectController.php index 73d7df7dabab98cdee4b7bec56ee3070e841d2d0..c6b514d4fc3dc4660e6c23a64e5d3255181e3ee1 100644 --- a/src/Controller/ProjectController.php +++ b/src/Controller/ProjectController.php @@ -41,14 +41,7 @@ class ProjectController extends AbstractController return $this->redirectToRoute('capsule_list'); } - $zip = new ZipArchive(); - $zip_file_archive_is_open = $zip->open("create.zip"); - - if (! $zip_file_archive_is_open) { - throw new ZipArchiveNotOpeningException("Create Zip Archive could not be open"); - } - - $this->extractZipArchiveInNewCapsuleDirectory($zip, $capsule_name); + $this->extractZipArchiveInNewCapsuleDirectory($capsule_name); $this->addProjectVideoUrlInXMLProjectFile($capsule_name, $video_url); @@ -63,17 +56,17 @@ class ProjectController extends AbstractController ); return $this->redirectToRoute('capsule_list'); - -// $capsule_edition_link = $capsule->getEditionLink(); - -// return $this->forward('App\Controller\CapsuleController::edit', [ -//// 'video_url' => $video_url, -// 'edition_link' => $capsule_edition_link -// ]); } - private function extractZipArchiveInNewCapsuleDirectory(ZipArchive $zip, string $capsule_name): void + private function extractZipArchiveInNewCapsuleDirectory(string $capsule_name): void { + $zip = new ZipArchive(); + $zip_file_archive_is_open = $zip->open("create.zip"); + + if (! $zip_file_archive_is_open) { + throw new ZipArchiveNotOpeningException("Create Zip Archive could not be open"); + } + $zip->extractTo($capsule_name); $zip->close(); } diff --git a/templates/project/edit.html.twig b/templates/project/edit.html.twig deleted file mode 100644 index 791b99bc7e15756ef647a54b0d8bcdc9261a470f..0000000000000000000000000000000000000000 --- a/templates/project/edit.html.twig +++ /dev/null @@ -1,22 +0,0 @@ -{% extends 'layout.html.twig' %} - -{% block title %} - {{ 'project.edit_project'|trans }} -{% endblock %} - -{% block body %} - -{# <iframe src="{{ url }}"#} - <iframe src="https://www.youtube.com/watch?v=544DTGHIBM0&ab_channel=Vogue" - - style="width:100%;height:100%;top:0;left:0;position:absolute" - {# width="1200" - height="600" #} - - frameborder="0" - webkitallowfullscreen - mozallowfullscreen - allowfullscreen> - </iframe> - -{% endblock %}