Commit cd02cd35 authored by CLOUARD Regis's avatar CLOUARD Regis
Browse files

Bug on gpx import

parent 7f52d142
<FilesMatch "\.(jpeg|psd|log|sh)$">
Order allow,deny
Deny from all
</FilesMatch>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/public
RewriteRule ^(.*)$ /public/$1 [L]
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.+) index.php/$1 [QSA,L]
RewriteRule ^index.php/(.*)$ $1 [L]
# Contribuer
# Contribuer au développement du site Vikazimut
## Installation de symfony pour le développement
......@@ -75,7 +75,4 @@ Mettre à jour la base de données
### Lancement du serveur
php bin/console --document-root=/export/home/clouard/software/Vikazimut/site-vikazimute
ou
symfony server:start --dir=site-vikazimute/public
\ No newline at end of file
symfony server:start --document-root=site-vikazimute
......@@ -13,10 +13,10 @@ des points de contrôle.
Un parcours d'orientation consiste en une suite de points de contrôle matérialisés sur le
terrain par une balise type fédération internationale de course d’orientation (IOF) contenant
en plus un QrCode et tag NFC.
en plus un code QR et un tag NFC.
L’orienteur utilise l’application pour se repérer à partir de la carte et valider son passage
aux points de contrôle avec le lecteur QrcOde ou le lecteur NFC si le parcours est équipé de
aux points de contrôle avec le lecteur de code QR ou le lecteur NFC si le parcours est équipé de
balises physiques ou par détection automatique de la position GPS.
L’application affiche en fin du parcours des statistiques sur la réalisation du parcours :
......
......@@ -13,10 +13,13 @@
"ext-openssl": "*",
"ext-pdo": "*",
"ext-simplexml": "*",
"ext-zip": "*",
"ext-zlib": "*",
"doctrine/doctrine-bundle": "^2.4",
"michaeldegroot/doctrine-encrypt-bundle": "^4.0",
"paragonie/halite": "^4",
"sensio/framework-extra-bundle": "^5.6",
"symfony/apache-pack": "^1.0",
"symfony/asset": "5.3.*",
"symfony/console": "5.3.*",
"symfony/dotenv": "5.3.*",
......@@ -39,9 +42,7 @@
"symfony/twig-pack": "^1.0",
"symfony/validator": "5.3.*",
"symfony/web-link": "5.3.*",
"symfony/yaml": "5.3.*",
"ext-zlib": "*",
"ext-zip": "*"
"symfony/yaml": "5.3.*"
},
"require-dev": {
"dama/doctrine-test-bundle": "^6.6",
......
......@@ -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": "a52ec5c0e751f6aa7fa384bc27ec8260",
"content-hash": "d9e49375dcb7e5701bbe54ac95c13ed3",
"packages": [
{
"name": "composer/package-versions-deprecated",
......@@ -153,16 +153,16 @@
},
{
"name": "doctrine/cache",
"version": "1.11.3",
"version": "2.0.3",
"source": {
"type": "git",
"url": "https://github.com/doctrine/cache.git",
"reference": "3bb5588cec00a0268829cc4a518490df6741af9d"
"reference": "c9622c6820d3ede1e2315a6a377ea1076e421d88"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/3bb5588cec00a0268829cc4a518490df6741af9d",
"reference": "3bb5588cec00a0268829cc4a518490df6741af9d",
"url": "https://api.github.com/repos/doctrine/cache/zipball/c9622c6820d3ede1e2315a6a377ea1076e421d88",
"reference": "c9622c6820d3ede1e2315a6a377ea1076e421d88",
"shasum": ""
},
"require": {
......@@ -232,7 +232,7 @@
],
"support": {
"issues": "https://github.com/doctrine/cache/issues",
"source": "https://github.com/doctrine/cache/tree/1.11.3"
"source": "https://github.com/doctrine/cache/tree/2.0.3"
},
"funding": [
{
......@@ -248,7 +248,7 @@
"type": "tidelift"
}
],
"time": "2021-05-25T09:01:55+00:00"
"time": "2021-05-25T09:43:04+00:00"
},
{
"name": "doctrine/collections",
......@@ -411,31 +411,32 @@
},
{
"name": "doctrine/dbal",
"version": "2.13.1",
"version": "2.13.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "c800380457948e65bbd30ba92cc17cda108bf8c9"
"reference": "8dd39d2ead4409ce652fd4f02621060f009ea5e4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/c800380457948e65bbd30ba92cc17cda108bf8c9",
"reference": "c800380457948e65bbd30ba92cc17cda108bf8c9",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/8dd39d2ead4409ce652fd4f02621060f009ea5e4",
"reference": "8dd39d2ead4409ce652fd4f02621060f009ea5e4",
"shasum": ""
},
"require": {
"doctrine/cache": "^1.0",
"doctrine/cache": "^1.0|^2.0",
"doctrine/deprecations": "^0.5.3",
"doctrine/event-manager": "^1.0",
"ext-pdo": "*",
"php": "^7.1 || ^8"
},
"require-dev": {
"doctrine/coding-standard": "8.2.0",
"doctrine/coding-standard": "9.0.0",
"jetbrains/phpstorm-stubs": "2020.2",
"phpstan/phpstan": "0.12.81",
"phpunit/phpunit": "^7.5.20|^8.5|9.5.0",
"phpunit/phpunit": "^7.5.20|^8.5|9.5.5",
"squizlabs/php_codesniffer": "3.6.0",
"symfony/cache": "^4.4",
"symfony/console": "^2.0.5|^3.0|^4.0|^5.0",
"vimeo/psalm": "4.6.4"
},
......@@ -498,7 +499,7 @@
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/2.13.1"
"source": "https://github.com/doctrine/dbal/tree/2.13.2"
},
"funding": [
{
......@@ -514,7 +515,7 @@
"type": "tidelift"
}
],
"time": "2021-04-17T17:30:19+00:00"
"time": "2021-06-18T21:48:39+00:00"
},
{
"name": "doctrine/deprecations",
......@@ -2646,6 +2647,32 @@
],
"time": "2021-03-09T12:30:35+00:00"
},
{
"name": "symfony/apache-pack",
"version": "v1.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/apache-pack.git",
"reference": "3aa5818d73ad2551281fc58a75afd9ca82622e6c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/apache-pack/zipball/3aa5818d73ad2551281fc58a75afd9ca82622e6c",
"reference": "3aa5818d73ad2551281fc58a75afd9ca82622e6c",
"shasum": ""
},
"type": "symfony-pack",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "A pack for Apache support in Symfony",
"support": {
"issues": "https://github.com/symfony/apache-pack/issues",
"source": "https://github.com/symfony/apache-pack/tree/master"
},
"time": "2017-12-12T01:46:35+00:00"
},
{
"name": "symfony/asset",
"version": "v5.3.2",
......@@ -9025,16 +9052,16 @@
},
{
"name": "phpunit/phpunit",
"version": "8.5.16",
"version": "8.5.17",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "cc66f2fc61296be66c99931a862200e7456b9a01"
"reference": "79067856d85421c56d413bd238d4e2cd6b0e54da"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/cc66f2fc61296be66c99931a862200e7456b9a01",
"reference": "cc66f2fc61296be66c99931a862200e7456b9a01",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/79067856d85421c56d413bd238d4e2cd6b0e54da",
"reference": "79067856d85421c56d413bd238d4e2cd6b0e54da",
"shasum": ""
},
"require": {
......@@ -9106,7 +9133,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.16"
"source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.17"
},
"funding": [
{
......@@ -9118,7 +9145,7 @@
"type": "github"
}
],
"time": "2021-06-05T04:46:20+00:00"
"time": "2021-06-23T05:12:43+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
......@@ -9744,7 +9771,6 @@
"type": "github"
}
],
"abandoned": true,
"time": "2020-11-30T07:30:19+00:00"
},
{
......@@ -10591,6 +10617,7 @@
"ext-openssl": "*",
"ext-pdo": "*",
"ext-simplexml": "*",
"ext-zip": "*",
"ext-zlib": "*"
},
"platform-dev": [],
......
favicon.ico

4.19 KB

# Use the front controller as index file. It serves as a fallback solution when
# every other rewrite/redirect fails (e.g. in an aliased environment without
# mod_rewrite). Additionally, this reduces the matching process for the
# start page (path "/") because otherwise Apache will apply the rewriting rules
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
DirectoryIndex index.php
# By default, Apache does not evaluate symbolic links if you did not enable this
# feature in your server configuration. Uncomment the following line if you
# install assets as symlinks or if you experience problems related to symlinks
# when compiling LESS/Sass/CoffeScript assets.
# Options +FollowSymlinks
# Disabling MultiViews prevents unwanted negotiation, e.g. "/index" should not resolve
# to the front controller "/index.php" but be rewritten to "/index.php/index".
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
# Send would-be 404 requests to Craft
# Determine the RewriteBase automatically and set it as environment variable.
# If you are using Apache aliases to do mass virtual hosting or installed the
# project in a subdirectory, the base path will be prepended to allow proper
# resolution of the index.php file and to redirect to the correct URI. It will
# work in environments without path prefix as well, providing a safe, one-size
# fits all solution. But as you do not need it in this case, you can comment
# the following 2 lines to eliminate the overhead.
RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
RewriteRule .* - [E=BASE:%1]
# Sets the HTTP_AUTHORIZATION header removed by Apache
RewriteCond %{HTTP:Authorization} .+
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
# Redirect to URI without front controller to prevent duplicate content
# (with and without `/index.php`). Only do this redirect on the initial
# rewrite by Apache and not on subsequent cycles. Otherwise we would get an
# endless redirect loop (request -> rewrite to front controller ->
# redirect -> request -> ...).
# So in case you get a "too many redirects" error or you always get redirected
# to the start page because your Apache does not expose the REDIRECT_STATUS
# environment variable, you have 2 choices:
# - disable this feature by commenting the following 2 lines or
# - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
# following RewriteCond (best solution)
RewriteCond %{ENV:REDIRECT_STATUS} =""
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
# If the requested filename exists, simply serve it.
# We only want to let Apache serve files and not directories.
# Rewrite all other queries to the front controller.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.+) index.php?p=$1 [QSA,L]
RewriteRule ^ %{ENV:BASE}/index.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
# When mod_rewrite is not available, we instruct a temporary redirect of
# the start page to the front controller explicitly so that the website
# and the generated links can still be used.
RedirectMatch 307 ^/$ /index.php/
# RedirectTemp cannot be used instead
</IfModule>
</IfModule>
<?php
use App\Kernel;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/vendor/autoload.php';
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
require dirname(__FILE__).'/../config/bootstrap.php';
if ($_SERVER['APP_DEBUG']) {
umask(0000);
Debug::enable();
/* Debug::enable();*/
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$kernel = new Kernel($_SERVER['APP_ENV'], (bool)$_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
......
......@@ -107,7 +107,6 @@ function previewXml(data, divXml) {
}
function previewMap(data, divMap, divLeaflet, map, overlay, img) {
// TODO upload address
fetch(window.location.origin + "/" + data.image).then(function (response) {
if (response.status === 200) {
overlay.setUrl(response.url);
......@@ -196,7 +195,7 @@ function showPreview(data, divXml, divMap, divLeaflet, map, overlay, img) {
}
function downloadMap(imageURL) { //see library printJS for further print options.
let printableMap = window.open(window.location.origin + "/" + imageURL); /* TODO supprimer upload */
let printableMap = window.open(window.location.origin + "/" + imageURL);
printableMap.download();
}
......
......@@ -29,7 +29,7 @@ class CourseController extends AbstractController
$latitude = (float)substr($lat, 1, strlen($lat) - 2);
$longitude = (float)substr($lng, 1, strlen($lng) - 2);
$allCourses = $this->getDoctrine()->getRepository(Course::class)->findAll();
if ($lat < 10000 && $lng < 1000) { // These are the default values...
if ($lat < 10000 && $lng < 1000) { // 1000 and 1000 are the default values...
$quantifiedCourses = [];
foreach ($allCourses as $course) {
$distance = $statistics->distanceInMeters($latitude, $longitude, $course->getLatitude(), $course->getLongitude());
......@@ -55,6 +55,7 @@ class CourseController extends AbstractController
$courses = $allCourses;
}
foreach ($courses as $course) {
$course->setImage("data/" . $course->getId() . "/image");
$courseDate = $course->getStartDate();
if ($courseDate !== null) {
$dateDiff = $courseDate->diff(new DateTime('NOW'));
......@@ -200,7 +201,8 @@ class CourseController extends AbstractController
return new JsonResponse(
[
'kml' => $course->getKml(),
'image' => $course->getImage(),
'image' => substr($this->generateUrl('image', ['id' => $id]),1),
]
);
}
......
......@@ -92,8 +92,18 @@ class DataController extends AbstractController
if (!$course) {
return $this->json(["error" => "invalid id"]);
}
$filename = $course->getImage();
$response = new Response();
return $this->file($course->getImage());
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$acceptedExtensions = array("png", "jpeg", "jpg");
if (!in_array("BB", $acceptedExtensions)) {
$ext = "jpeg";
}
$response->headers->set('Content-Type', $ext);
$response->setContent(file_get_contents($filename));
return $response;
}
function encryptFile($encryptKey, $encryptInitializationVector, $inPath): string
......
......@@ -109,7 +109,6 @@ class FileUploader
foreach (scandir($dir) as $file) {
if (!is_dir($dir."/".$file)) {
$files_parts = preg_split("/[.]/", $file);
if ($userid == $files_parts[1]) {
if ($extension == $files_parts[2] || ($extension == "image" && ($files_parts[2] == "png" || $files_parts[2] == "jpg" || $files_parts[2] == "jpeg"))) {
return $dir."/".$file;
......
......@@ -270,6 +270,18 @@
"swiftmailer/swiftmailer": {
"version": "v6.2.3"
},
"symfony/apache-pack": {
"version": "1.0",
"recipe": {
"repo": "github.com/symfony/recipes-contrib",
"branch": "master",
"version": "1.0",
"ref": "71599f5b0fdeeeec0fb90e9b17c85e6f5e1350c1"
},
"files": [
"public/.htaccess"
]
},
"symfony/asset": {
"version": "v5.0.7"
},
......
......@@ -50,11 +50,6 @@
xhr.send()
}
function printMap() { // TODO jamais utilisé ?
let printableMap = window.open(window.location.origin + "/" + imageURL);
printableMap.print();
}
function switchMapDisplay() {
let hideButton = document.getElementById("hide-map");
let showButton = document.getElementById("show-map");
......
......@@ -366,13 +366,13 @@
{% else %}
<input class="custom-control-input" type="checkbox" id="isPrintable">
{% endif %}
<label class="custom-control-label" for="isPrintable"><h5>{% trans %} course.authorize.map.sharing {% endtrans %}</h5></label>
<label class="custom-control-label" for="isPrintable"><h5>{% trans %}course.authorize.map.sharing{% endtrans %}</h5></label>
</div>
<div class="alert alert-primary" role="alert">
{% trans %}course.add.use.owned.map{% endtrans %}
</div>
<div class="row mb-1 mt-1">
<div class="row mb-1 mt-1">
</div>
<div class="row">
......
......@@ -49,8 +49,8 @@
</div>
<div id="map-tab" class="tab-content">
<button class="btn btn-primary" id="show-map" onclick="switchMapDisplay(overlay, 100)" style="position: absolute; z-index: 9999; top: 60px; right: 35px">{% trans %} course.description.mask.map {% endtrans %}</button>
<button class="btn btn-primary" id="hide-map" onclick="switchMapDisplay(overlay, 0)" style="display:none; position: absolute; z-index: 9999; top: 60px; right: 35px">{% trans %} course.description.show.map {% endtrans %}</button>
<button class="btn btn-primary" id="show-map" onclick="switchMapDisplay(overlay, 100)" style="position: absolute; z-index: 9999; top: 60px; right: 35px">{% trans %}course.description.mask.map{% endtrans %}</button>
<button class="btn btn-primary" id="hide-map" onclick="switchMapDisplay(overlay, 0)" style="display:none; position: absolute; z-index: 9999; top: 60px; right: 35px">{% trans %}course.description.show.map{% endtrans %}</button>
<div id="map-div"></div>
</div>
<div id="xml-tab" class="tab-content">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment