rename to .php

This commit is contained in:
Adrien MALINGREY 2020-11-14 00:00:44 +01:00
parent e1cd9ca1a2
commit 8121768fe4
8 changed files with 80 additions and 60 deletions

24
404.php
View File

@ -15,7 +15,29 @@
<meta name='viewport' content='width=device-width' /> <meta name='viewport' content='width=device-width' />
<title>Sudoku non trouvé</title> <title>Sudoku non trouvé</title>
<link rel='stylesheet' type='text/css' href='style.css' /> <link rel='stylesheet' type='text/css' href='style.css' />
<link rel="icon" type="image/png" href="favicon.png"> <link rel="apple-touch-icon" href="thumbnail.php?size=57" sizes="57x57">
<link rel="apple-touch-icon" href="thumbnail.php?size=114" sizes="114x114">
<link rel="apple-touch-icon" href="thumbnail.php?size=72" sizes="72x72">
<link rel="apple-touch-icon" href="thumbnail.php?size=144" sizes="144x144">
<link rel="apple-touch-icon" href="thumbnail.php?size=60" sizes="60x60">
<link rel="apple-touch-icon" href="thumbnail.php?size=120" sizes="120x120">
<link rel="apple-touch-icon" href="thumbnail.php?size=76" sizes="76x76">
<link rel="apple-touch-icon" href="thumbnail.php?size=152" sizes="152x152">
<link rel="icon" type="image/png" href="thumbnail.php?size=196" sizes="196x196">
<link rel="icon" type="image/png" href="thumbnail.php?size=160" sizes="160x160">
<link rel="icon" type="image/png" href="thumbnail.php?size=96" sizes="96x96">
<link rel="icon" type="image/png" href="thumbnail.php?size=16" sizes="16x16">
<link rel="icon" type="image/png" href="thumbnail.php?size=32" sizes="32x32">
<link rel="manifest" href="manifest.php">
<meta property="og:title" content="Sudoku"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="<?=$_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"].$_SERVER["DOCUMENT_URI"]?>"/>
<meta property="og:image" content="<?=$_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"].dirname($_SERVER["DOCUMENT_URI"])?>/thumbnail.php?size=200"/>
<meta property="og:image:width" content="200"/>
<meta property="og:image:height" content="200"/>
<meta property="og:description" content="Remplissez la grille de sorte que chaque ligne, colonne et région (carré de 3×3 cases) contienne tous les chiffres de 1 à 9."/>
<meta property="og:locale" content="fr_FR"/>
<meta property="og:site_name" content="<?=$_SERVER["HTTP_HOST"]?>"/>
</head> </head>
<body> <body>
<header> <header>

View File

@ -85,16 +85,18 @@
} }
function containsDuplicates() { function containsDuplicates() {
foreach(array_merge($this->rows, $this->columns, $this->regions) as $area) { foreach(array($this->rows, $this->columns, $this->regions) as $areas) {
$unknownBoxes = array_filter($area, "isUnknown"); foreach ($areas as $area) {
foreach($unknownBoxes as $box1) { $unknownBoxes = array_filter($area, "isKnown");
foreach($unknownBoxes as $box2) { foreach($unknownBoxes as $box1) {
if (($box1 !== $box2) && ($box1->value == $box2->value)) { foreach($unknownBoxes as $box2) {
return true; if (($box1 !== $box2) && ($box1->value == $box2->value)) {
return true;
}
} }
} }
return false;
} }
return false;
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
session_start(); session_start();
if ($_SESSION["currentGrid"]) if (isset($_SESSION["currentGrid"]))
$currentGrid = $_SESSION["currentGrid"]; $currentGrid = $_SESSION["currentGrid"];
else else
$currentGrid = "."; $currentGrid = ".";
@ -10,27 +10,27 @@
"name": "Sudoku", "name": "Sudoku",
"description": "Remplissez la grille de sorte que chaque ligne, colonne et région (carré de 3×3 cases) contienne tous les chiffres de 1 à 9.", "description": "Remplissez la grille de sorte que chaque ligne, colonne et région (carré de 3×3 cases) contienne tous les chiffres de 1 à 9.",
"icons": [{ "icons": [{
"src": "thumbnail.png?size=48", "src": "thumbnail.php?size=48",
"sizes": "48x48", "sizes": "48x48",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=72", "src": "thumbnail.php?size=72",
"sizes": "72x72", "sizes": "72x72",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=96", "src": "thumbnail.php?size=96",
"sizes": "96x96", "sizes": "96x96",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=144", "src": "thumbnail.php?size=144",
"sizes": "144x144", "sizes": "144x144",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=168", "src": "thumbnail.php?size=168",
"sizes": "168x168", "sizes": "168x168",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=192", "src": "thumbnail.php?size=192",
"sizes": "192x192", "sizes": "192x192",
"type": "image/png" "type": "image/png"
}], }],
@ -47,27 +47,27 @@
"description": "Continuer cette grille de sudoku", "description": "Continuer cette grille de sudoku",
"url": "<?=$currentGrid?>", "url": "<?=$currentGrid?>",
"icons": [{ "icons": [{
"src": "thumbnail.png?size=48", "src": "thumbnail.php?size=48",
"sizes": "48x48", "sizes": "48x48",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=72", "src": "thumbnail.php?size=72",
"sizes": "72x72", "sizes": "72x72",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=96", "src": "thumbnail.php?size=96",
"sizes": "96x96", "sizes": "96x96",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=144", "src": "thumbnail.php?size=144",
"sizes": "144x144", "sizes": "144x144",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=168", "src": "thumbnail.php?size=168",
"sizes": "168x168", "sizes": "168x168",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=192", "src": "thumbnail.php?size=192",
"sizes": "192x192", "sizes": "192x192",
"type": "image/png" "type": "image/png"
}] }]
@ -78,27 +78,27 @@
"description": "Grille de sudoku vierge", "description": "Grille de sudoku vierge",
"url": ".................................................................................", "url": ".................................................................................",
"icons": [{ "icons": [{
"src": "thumbnail.png?size=48", "src": "thumbnail.php?size=48",
"sizes": "48x48", "sizes": "48x48",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=72", "src": "thumbnail.php?size=72",
"sizes": "72x72", "sizes": "72x72",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=96", "src": "thumbnail.php?size=96",
"sizes": "96x96", "sizes": "96x96",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=144", "src": "thumbnail.php?size=144",
"sizes": "144x144", "sizes": "144x144",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=168", "src": "thumbnail.php?size=168",
"sizes": "168x168", "sizes": "168x168",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=192", "src": "thumbnail.php?size=192",
"sizes": "192x192", "sizes": "192x192",
"type": "image/png" "type": "image/png"
}] }]
@ -109,27 +109,27 @@
"description": "Nouvelle grille de sudoku", "description": "Nouvelle grille de sudoku",
"url": ".", "url": ".",
"icons": [{ "icons": [{
"src": "thumbnail.png?size=48", "src": "thumbnail.php?size=48",
"sizes": "48x48", "sizes": "48x48",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=72", "src": "thumbnail.php?size=72",
"sizes": "72x72", "sizes": "72x72",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=96", "src": "thumbnail.php?size=96",
"sizes": "96x96", "sizes": "96x96",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=144", "src": "thumbnail.php?size=144",
"sizes": "144x144", "sizes": "144x144",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=168", "src": "thumbnail.php?size=168",
"sizes": "168x168", "sizes": "168x168",
"type": "image/png" "type": "image/png"
}, { }, {
"src": "thumbnail.png?size=192", "src": "thumbnail.php?size=192",
"sizes": "192x192", "sizes": "192x192",
"type": "image/png" "type": "image/png"
}] }]

View File

@ -7,7 +7,7 @@ location /sudoku/ {
index index.php; index index.php;
try_files $uri $uri/ @add-php-extention; try_files $uri $uri/;
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
try_files $uri =404; try_files $uri =404;
@ -29,7 +29,3 @@ location /sudoku/ {
location ~ "^/sudoku/([1-9.]{81})$" { location ~ "^/sudoku/([1-9.]{81})$" {
rewrite "^/sudoku/([1-9.]{81})$" /sudoku/sudoku.php?grid=$1 last; rewrite "^/sudoku/([1-9.]{81})$" /sudoku/sudoku.php?grid=$1 last;
} }
location @add-php-extention {
rewrite ^([^?#]*)(\?.*)?(#.*)?$ $1.php$2$3 last;
}

View File

@ -1,6 +1,6 @@
<?php <?php
session_start(); session_start();
if ($_SESSION["currentGrid"]) if (isset($_SESSION["currentGrid"]))
$currentGrid = $_SESSION["currentGrid"]; $currentGrid = $_SESSION["currentGrid"];
else else
$currentGrid = "."; $currentGrid = ".";

View File

@ -78,7 +78,7 @@ window.onload = function () {
refreshUI() refreshUI()
if ("serviceWorker" in navigator) { if ("serviceWorker" in navigator) {
navigator.serviceWorker.register(`service-worker.js?location=${location.href}`) navigator.serviceWorker.register(`service-worker.php?location=${location.href}`)
} }
} }

View File

@ -30,24 +30,24 @@
<title>Sudoku</title> <title>Sudoku</title>
<link rel='stylesheet' type='text/css' href='style.css' /> <link rel='stylesheet' type='text/css' href='style.css' />
<script src='sudoku.js'></script> <script src='sudoku.js'></script>
<link rel="apple-touch-icon" href="thumbnail.png?size=57" sizes="57x57"> <link rel="apple-touch-icon" href="thumbnail.php?size=57" sizes="57x57">
<link rel="apple-touch-icon" href="thumbnail.png?size=114" sizes="114x114"> <link rel="apple-touch-icon" href="thumbnail.php?size=114" sizes="114x114">
<link rel="apple-touch-icon" href="thumbnail.png?size=72" sizes="72x72"> <link rel="apple-touch-icon" href="thumbnail.php?size=72" sizes="72x72">
<link rel="apple-touch-icon" href="thumbnail.png?size=144" sizes="144x144"> <link rel="apple-touch-icon" href="thumbnail.php?size=144" sizes="144x144">
<link rel="apple-touch-icon" href="thumbnail.png?size=60" sizes="60x60"> <link rel="apple-touch-icon" href="thumbnail.php?size=60" sizes="60x60">
<link rel="apple-touch-icon" href="thumbnail.png?size=120" sizes="120x120"> <link rel="apple-touch-icon" href="thumbnail.php?size=120" sizes="120x120">
<link rel="apple-touch-icon" href="thumbnail.png?size=76" sizes="76x76"> <link rel="apple-touch-icon" href="thumbnail.php?size=76" sizes="76x76">
<link rel="apple-touch-icon" href="thumbnail.png?size=152" sizes="152x152"> <link rel="apple-touch-icon" href="thumbnail.php?size=152" sizes="152x152">
<link rel="icon" type="image/png" href="thumbnail.png?size=196" sizes="196x196"> <link rel="icon" type="image/png" href="thumbnail.php?size=196" sizes="196x196">
<link rel="icon" type="image/png" href="thumbnail.png?size=160" sizes="160x160"> <link rel="icon" type="image/png" href="thumbnail.php?size=160" sizes="160x160">
<link rel="icon" type="image/png" href="thumbnail.png?size=96" sizes="96x96"> <link rel="icon" type="image/png" href="thumbnail.php?size=96" sizes="96x96">
<link rel="icon" type="image/png" href="thumbnail.png?size=16" sizes="16x16"> <link rel="icon" type="image/png" href="thumbnail.php?size=16" sizes="16x16">
<link rel="icon" type="image/png" href="thumbnail.png?size=32" sizes="32x32"> <link rel="icon" type="image/png" href="thumbnail.php?size=32" sizes="32x32">
<link rel="manifest" href="manifest.json"> <link rel="manifest" href="manifest.php">
<meta property="og:title" content="Sudoku"/> <meta property="og:title" content="Sudoku"/>
<meta property="og:type" content="website"/> <meta property="og:type" content="website"/>
<meta property="og:url" content="<?=$_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"].$_SERVER["DOCUMENT_URI"]?>"/> <meta property="og:url" content="<?=$_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"].$_SERVER["DOCUMENT_URI"]?>"/>
<meta property="og:image" content="<?=$_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"].dirname($_SERVER["DOCUMENT_URI"])?>/thumbnail.png?size=200"/> <meta property="og:image" content="<?=$_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"].dirname($_SERVER["DOCUMENT_URI"])?>/thumbnail.php?size=200"/>
<meta property="og:image:width" content="200"/> <meta property="og:image:width" content="200"/>
<meta property="og:image:height" content="200"/> <meta property="og:image:height" content="200"/>
<meta property="og:description" content="Remplissez la grille de sorte que chaque ligne, colonne et région (carré de 3×3 cases) contienne tous les chiffres de 1 à 9."/> <meta property="og:description" content="Remplissez la grille de sorte que chaque ligne, colonne et région (carré de 3×3 cases) contienne tous les chiffres de 1 à 9."/>

View File

@ -1,10 +1,10 @@
<?php <?php
require("classes.php"); require("classes.php");
session_start(); session_start();
if ($_SESSION["currentGrid"]) if (isset($_SESSION["currentGrid"]))
$currentGrid = $_SESSION["currentGrid"]; $currentGrid = $_SESSION["currentGrid"];
else else
$currentGrid = ".528.3....4.9.1...39.562......73.129...1.64.7...42.3656.13.5...28.6.4...4.5287...w"; $currentGrid = ".528.3....4.9.1...39.562......73.129...1.64.7...42.3656.13.5...28.6.4...4.5287...";
header ("Content-type: image/png"); header ("Content-type: image/png");
$size = (int) $_GET['size']; $size = (int) $_GET['size'];
@ -30,7 +30,7 @@
$x = $start; $x = $start;
$y = $start; $y = $start;
$boxSizeMinusOne = $boxSize - 1; $boxSizeMinusOne = $boxSize - 1;
foreach(str_split($_SESSION["currentGrid"]) as $i => $value) { foreach(str_split($currentGrid) as $i => $value) {
if ($i % 3 == 0) $x++; if ($i % 3 == 0) $x++;
if ($i % 27 == 0) $y++; if ($i % 27 == 0) $y++;
if ($value == UNKNOWN) { if ($value == UNKNOWN) {
@ -63,7 +63,7 @@
$x = $start + 1; $x = $start + 1;
$y = $start + 1; $y = $start + 1;
$boxSizeMinusTwo = $boxSize - 2; $boxSizeMinusTwo = $boxSize - 2;
foreach(str_split($_SESSION["currentGrid"]) as $i => $value) { foreach(str_split($currentGrid) as $i => $value) {
if ($value == UNKNOWN) { if ($value == UNKNOWN) {
$bgColor = $white; $bgColor = $white;
} else { } else {
@ -98,7 +98,7 @@
$x = $start + 1; $x = $start + 1;
$y = $start + 1; $y = $start + 1;
$boxSizeMinusTwo = $boxSize - 2; $boxSizeMinusTwo = $boxSize - 2;
foreach(str_split($_SESSION["currentGrid"]) as $i => $value) { foreach(str_split($currentGrid) as $i => $value) {
if ($value == UNKNOWN) { if ($value == UNKNOWN) {
$bgColor = $white; $bgColor = $white;
} else { } else {