Compare commits
38
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
212728e138 | ||
|
|
0d627f297e | ||
|
|
f07ae979a2 | ||
|
|
8bdbbafcff | ||
|
|
3856ccb576 | ||
|
|
9f839d3f5d | ||
|
|
721b611cdb | ||
|
|
70fb30f673 | ||
|
|
e200dab2a4 | ||
|
|
e8c246f002 | ||
|
|
251bf1be3d | ||
|
|
0be20a6097 | ||
|
|
d5d3563ddc | ||
|
|
19aa4098e5 | ||
|
|
394c8b8830 | ||
|
|
dc4ba4b5a4 | ||
|
|
eda4e00378 | ||
|
|
dfc74375d7 | ||
|
|
dc1aedd28f | ||
|
|
787427b211 | ||
|
|
05b1a84168 | ||
|
|
e2a0da3dd2 | ||
|
|
e751fdaa3e | ||
|
|
675d7e60d0 | ||
|
|
0d097aacb5 | ||
|
|
98cd15e91f | ||
|
|
4f680db8f3 | ||
|
|
ea98af0681 | ||
|
|
05934d6245 | ||
|
|
3ab8ac5fe6 | ||
|
|
94e60e4ac5 | ||
|
|
9df5028c20 | ||
|
|
49bd03f303 | ||
|
|
7210e12656 | ||
|
|
8320b94210 | ||
|
|
28aa762153 | ||
|
|
33eb154112 | ||
|
|
a2ca7888f4 |
No files matched your search
@@ -1,3 +1,4 @@
|
||||
APP_NAME=MapQuiz
|
||||
DEV=1
|
||||
DB_HOST=mariadb
|
||||
DB_USER=mapguesser
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
Hi,
|
||||
<br><br>
|
||||
You recently signed up on MapGuesser with this Google account ({{EMAIL}}).
|
||||
You recently signed up on {{APP_NAME}} with this Google account ({{EMAIL}}).
|
||||
<br><br>
|
||||
Have fun on MapGuesser!
|
||||
Have fun on {{APP_NAME}}!
|
||||
<br><br>
|
||||
Regards,<br>
|
||||
MapGuesser<br>
|
||||
<a href="{{BASE_URL}}" title="MapGuesser">{{BASE_URL}}</a>
|
||||
{{APP_NAME}}<br>
|
||||
<a href="{{BASE_URL}}" title="{{APP_NAME}}">{{BASE_URL}}</a>
|
||||
+5
-5
@@ -1,14 +1,14 @@
|
||||
Hi,
|
||||
<br><br>
|
||||
You recently signed up on MapGuesser with this email address ({{EMAIL}}). To activate your account, please click on the following link:<br>
|
||||
You recently signed up on {{APP_NAME}} with this email address ({{EMAIL}}). To activate your account, please click on the following link:<br>
|
||||
<a href="{{ACTIVATE_LINK}}" title="Account activation">{{ACTIVATE_LINK}}</a>
|
||||
<br><br>
|
||||
If you did not sign up on MapGuesser or changed your mind, no further action is required, your email address will be deleted soon.<br>
|
||||
If you did not sign up on {{APP_NAME}} or changed your mind, no further action is required, your email address will be deleted soon.<br>
|
||||
However if you want to immediately delete it, please click on the following link:<br>
|
||||
<a href="{{CANCEL_LINK}}" title="Sign up cancellation">{{CANCEL_LINK}}</a>
|
||||
<br><br>
|
||||
Have fun on MapGuesser!
|
||||
Have fun on {{APP_NAME}}!
|
||||
<br><br>
|
||||
Regards,<br>
|
||||
MapGuesser<br>
|
||||
<a href="{{BASE_URL}}" title="MapGuesser">{{BASE_URL}}</a>
|
||||
{{APP_NAME}}<br>
|
||||
<a href="{{BASE_URL}}" title="{{APP_NAME}}">{{BASE_URL}}</a>
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
#noPano {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
visibility: hidden;
|
||||
@@ -23,7 +25,7 @@
|
||||
}
|
||||
|
||||
#noPano>p {
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#control {
|
||||
|
||||
@@ -42,7 +42,7 @@ h1>a:hover, h1>a:focus {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
h2, div.header.small h1 {
|
||||
h2, header.small h1 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
@@ -83,8 +83,8 @@ hr {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.small {
|
||||
font-size: 12px;
|
||||
p.small, span.small {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.justify {
|
||||
@@ -119,6 +119,7 @@ svg.inline, img.inline {
|
||||
display: inline;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
margin-right: 0.3em;
|
||||
vertical-align: -0.15em;
|
||||
}
|
||||
|
||||
@@ -147,6 +148,13 @@ button, a.button {
|
||||
line-height: 35px;
|
||||
}
|
||||
|
||||
button.small {
|
||||
font-size: 14px;
|
||||
padding: 0 12px;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
button:enabled:hover, button:enabled:focus, a.button:hover, a.button:focus {
|
||||
background-color: #29457f;
|
||||
outline: none;
|
||||
@@ -250,11 +258,10 @@ input.big:focus, select.big:focus, textarea.big:focus {
|
||||
|
||||
div.modal {
|
||||
position: fixed;
|
||||
top: 100px;
|
||||
background-color: #ffffff;
|
||||
border-radius: 3px;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
overflow-y: auto;
|
||||
z-index: 6;
|
||||
visibility: hidden;
|
||||
}
|
||||
@@ -280,7 +287,7 @@ p.formError {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.header {
|
||||
header {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto;
|
||||
background-color: #333333;
|
||||
@@ -290,33 +297,44 @@ div.header {
|
||||
color: white;
|
||||
}
|
||||
|
||||
div.header.small {
|
||||
header.small {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
div.header>p.header {
|
||||
header>p {
|
||||
line-height: inherit;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div.header>p.header>span {
|
||||
header>p>span {
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
div.header>p.header>span>a:link, div.header>p.header>span>a:visited {
|
||||
header>p>span>a:link, header>p>span>a:visited {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
div.header>p.header>span:not(:last-child) {
|
||||
header>p>span:not(:last-child) {
|
||||
border-right: solid white 1px;
|
||||
padding-right: 6px;
|
||||
}
|
||||
|
||||
div.main {
|
||||
main {
|
||||
padding: 6px 12px;
|
||||
}
|
||||
|
||||
footer {
|
||||
background-color: #444444;
|
||||
padding: 6px 12px;
|
||||
color: white;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
footer>p {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
div.buttonContainer {
|
||||
height: 35px;
|
||||
}
|
||||
@@ -325,6 +343,12 @@ div.buttonContainer>button {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
#cookiesNotice {
|
||||
background-color: #eeeeee;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#loading {
|
||||
position: fixed;
|
||||
width: 64px;
|
||||
@@ -347,9 +371,12 @@ div.box {
|
||||
}
|
||||
|
||||
@media screen and (max-width: 599px) {
|
||||
div.header h1 span {
|
||||
header h1 span {
|
||||
display: none;
|
||||
}
|
||||
footer>p:not(:first-child) {
|
||||
margin-top: 4px;
|
||||
}
|
||||
button, a.button {
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
@@ -363,6 +390,8 @@ div.box {
|
||||
div.modal {
|
||||
left: 20px;
|
||||
right: 20px;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
}
|
||||
div.box {
|
||||
width: initial;
|
||||
@@ -370,9 +399,48 @@ div.box {
|
||||
}
|
||||
|
||||
@media screen and (min-width: 600px) {
|
||||
footer>p {
|
||||
display: inline;
|
||||
}
|
||||
footer>p:not(:first-child) {
|
||||
padding-left: 6px;
|
||||
}
|
||||
footer>p:not(:last-child) {
|
||||
border-right: solid white 1px;
|
||||
padding-right: 6px;
|
||||
}
|
||||
div.modal {
|
||||
width: 540px;
|
||||
left: 50%;
|
||||
margin-left: -270px;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-height: 399px) {
|
||||
div.modal {
|
||||
top: 20px;
|
||||
max-height: calc(100% - 40px);
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-height: 400px) and (max-height: 499px) {
|
||||
div.modal {
|
||||
top: 50px;
|
||||
max-height: calc(100% - 100px);
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-height: 500px) {
|
||||
div.modal {
|
||||
top: 75px;
|
||||
max-height: calc(100% - 150px);
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
}
|
||||
@@ -29,17 +29,16 @@ div.mapItem>div.title>p.title {
|
||||
div.mapItem>div.imgContainer {
|
||||
width: 100%;
|
||||
padding-top: 50%;
|
||||
background: #cccccc;
|
||||
}
|
||||
|
||||
div.mapItem>div.imgContainer>img {
|
||||
width: 100%;
|
||||
margin-top: -50%
|
||||
background-color: #cccccc;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
div.mapItem>div.inner {
|
||||
background-color: #eeeeee;
|
||||
padding: 10px 8px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
div.mapItem>div.inner>div.info {
|
||||
@@ -47,6 +46,12 @@ div.mapItem>div.inner>div.info {
|
||||
grid-template-columns: auto auto;
|
||||
}
|
||||
|
||||
div.mapItem>div.inner>div.description {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
div.mapItem>div.inner>div.info>p:nth-child(1) {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$#" -lt 1 ]; then
|
||||
echo "Usage: $0 <sql_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SQL_FILE=$1
|
||||
|
||||
ROOT_DIR=$(dirname $(readlink -f "$0"))/..
|
||||
|
||||
. ${ROOT_DIR}/.env
|
||||
|
||||
if [ -z "${DEV}" ] || [ "${DEV}" -eq "0" ]; then
|
||||
echo "This script can only be used in DEV mode!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Running SQL on DB..."
|
||||
mysql --host=${DB_HOST} --user=${DB_USER} --password=${DB_PASSWORD} ${DB_NAME} < ${SQL_FILE}
|
||||
@@ -373,12 +373,11 @@ class LoginController
|
||||
{
|
||||
$mail = new Mail();
|
||||
$mail->addRecipient($email);
|
||||
$mail->setSubject('Welcome to MapGuesser - Activate your account');
|
||||
$mail->setSubject('Welcome to ' . $_ENV['APP_NAME'] . ' - Activate your account');
|
||||
$mail->setBodyFromTemplate('signup', [
|
||||
'EMAIL' => $email,
|
||||
'ACTIVATE_LINK' => $this->request->getBase() . '/'. \Container::$routeCollection->getRoute('signup.activate')->generateLink(['token' => $token]),
|
||||
'CANCEL_LINK' => $this->request->getBase() . '/' . \Container::$routeCollection->getRoute('signup.cancel')->generateLink(['token' => $token]),
|
||||
'BASE_URL' => $this->request->getBase(),
|
||||
]);
|
||||
$mail->send();
|
||||
}
|
||||
@@ -387,10 +386,9 @@ class LoginController
|
||||
{
|
||||
$mail = new Mail();
|
||||
$mail->addRecipient($email);
|
||||
$mail->setSubject('Welcome to MapGuesser');
|
||||
$mail->setSubject('Welcome to ' . $_ENV['APP_NAME']);
|
||||
$mail->setBodyFromTemplate('signup-noconfirm', [
|
||||
'EMAIL' => $email,
|
||||
'BASE_URL' => $this->request->getBase(),
|
||||
]);
|
||||
$mail->send();
|
||||
}
|
||||
|
||||
@@ -29,6 +29,13 @@ class Mail
|
||||
{
|
||||
$this->body = file_get_contents(ROOT . '/mail/' . $template . '.html');
|
||||
|
||||
$baseParameters = [
|
||||
'APP_NAME' => $_ENV['APP_NAME'],
|
||||
'BASE_URL' => \Container::$request->getBase(),
|
||||
];
|
||||
|
||||
$params = array_merge($baseParameters, $params);
|
||||
|
||||
foreach ($params as $key => $param) {
|
||||
$this->body = str_replace('{{' . $key . '}}', $param, $this->body);
|
||||
}
|
||||
@@ -58,8 +65,8 @@ class Mail
|
||||
$mailer->Mailer = 'mail';
|
||||
}
|
||||
|
||||
$mailer->setFrom($_ENV['MAIL_FROM'], 'MapGuesser');
|
||||
$mailer->addReplyTo($_ENV['MAIL_FROM'], 'MapGuesser');
|
||||
$mailer->setFrom($_ENV['MAIL_FROM'], $_ENV['APP_NAME']);
|
||||
$mailer->addReplyTo($_ENV['MAIL_FROM'], $_ENV['APP_NAME']);
|
||||
|
||||
$mailer->Sender = !empty($_ENV['MAIL_BOUNCE']) ? $_ENV['MAIL_BOUNCE'] : $_ENV['MAIL_FROM'];
|
||||
$mailer->Subject = $this->subject;
|
||||
|
||||
@@ -45,6 +45,11 @@ class RouteCollection
|
||||
{
|
||||
$groupNumber = count($uri);
|
||||
|
||||
// response to HEAD request with the GET content
|
||||
if ($method === 'head') {
|
||||
$method = 'get';
|
||||
}
|
||||
|
||||
if (!isset($this->searchTable[$method][$groupNumber])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+11
-11
@@ -13,11 +13,11 @@ $jsFiles = [
|
||||
];
|
||||
?>
|
||||
<?php require ROOT . '/views/templates/main_header.php'; ?>
|
||||
<div class="header small">
|
||||
<header class="small">
|
||||
<h1>
|
||||
<a href="/maps" title="Back to playable maps">
|
||||
<img class="inline" width="1em" height="1em" src="<?= $_ENV['STATIC_ROOT'] ?>/img/icon.svg?rev=<?= REVISION ?>">
|
||||
<span>MapGuesser</span>
|
||||
<a href="/" title="<?= $_ENV['APP_NAME'] ?>">
|
||||
<img class="inline" width="1em" height="1em" src="<?= $_ENV['STATIC_ROOT'] ?>/img/icon.svg?rev=<?= REVISION ?>"><!--
|
||||
--><span><?= $_ENV['APP_NAME'] ?></span>
|
||||
</a>
|
||||
</h1>
|
||||
<p class="header">
|
||||
@@ -28,26 +28,26 @@ $jsFiles = [
|
||||
<path fill-rule="evenodd" d="M8 3.5a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5H4a.5.5 0 0 1 0-1h3.5V4a.5.5 0 0 1 .5-.5z"/>
|
||||
<path fill-rule="evenodd" d="M7.5 8a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1H8.5V12a.5.5 0 0 1-1 0V8z"/>
|
||||
<path fill-rule="evenodd" d="M14 1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"/>
|
||||
</svg>
|
||||
<span id="added" class="bold">0</span><!--
|
||||
</svg><!--
|
||||
--><span id="added" class="bold">0</span><!--
|
||||
--></span><!--
|
||||
--><span><!--
|
||||
<?php /* Copyright (c) 2019 The Bootstrap Authors. License can be found in 'USED_SOFTWARE' in section 'Bootstrap Icons'. */ ?>
|
||||
--><svg class="inline" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M15.502 1.94a.5.5 0 0 1 0 .706a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456l-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z"/> <path fill-rule="evenodd" d="M14 1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"/>
|
||||
</svg>
|
||||
<span id="edited" class="bold">0</span><!--
|
||||
</svg><!--
|
||||
--><span id="edited" class="bold">0</span><!--
|
||||
--></span><!--
|
||||
--><span><!--
|
||||
<?php /* Copyright (c) 2019 The Bootstrap Authors. License can be found in 'USED_SOFTWARE' in section 'Bootstrap Icons'. */ ?>
|
||||
--><svg class="inline" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" d="M3.5 8a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 0 1H4a.5.5 0 0 1-.5-.5z"/>
|
||||
<path fill-rule="evenodd" d="M14 1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"/>
|
||||
</svg>
|
||||
<span id="deleted" class="bold">0</span><!--
|
||||
</svg><!--
|
||||
--><span id="deleted" class="bold">0</span><!--
|
||||
--></span>
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
<div id="metadata" class="modal">
|
||||
<h2>Edit map data</h2>
|
||||
<form id="metadataForm" class="marginTop">
|
||||
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
<?php require ROOT . '/views/templates/main_header.php'; ?>
|
||||
<?php require ROOT . '/views/templates/header.php'; ?>
|
||||
<div class="main">
|
||||
<h2>404 | Page not found</h2>
|
||||
<p>The requested URL was not found on this server. <a href="/" title="MapGuesser">Back to start.</a></p>
|
||||
</div>
|
||||
<p>The requested URL was not found on this server. <a href="/" title="<?= $_ENV['APP_NAME'] ?>">Back to start.</a></p>
|
||||
<?php require ROOT . '/views/templates/footer.php'; ?>
|
||||
<?php require ROOT . '/views/templates/main_footer.php'; ?>
|
||||
+5
-5
@@ -8,11 +8,11 @@ $jsFiles = [
|
||||
];
|
||||
?>
|
||||
<?php require ROOT . '/views/templates/main_header.php'; ?>
|
||||
<div class="header small">
|
||||
<header class="small">
|
||||
<h1>
|
||||
<a href="/maps" title="Back to playable maps">
|
||||
<img class="inline" width="1em" height="1em" src="<?= $_ENV['STATIC_ROOT'] ?>/img/icon.svg?rev=<?= REVISION ?>">
|
||||
<span>MapGuesser</span>
|
||||
<a href="/" title="<?= $_ENV['APP_NAME'] ?>">
|
||||
<img class="inline" width="1em" height="1em" src="<?= $_ENV['STATIC_ROOT'] ?>/img/icon.svg?rev=<?= REVISION ?>"><!--
|
||||
--><span><?= $_ENV['APP_NAME'] ?></span>
|
||||
</a>
|
||||
</h1>
|
||||
<p class="header">
|
||||
@@ -20,7 +20,7 @@ $jsFiles = [
|
||||
--><span>Round <span id="currentRound" class="bold"></span></span><!--
|
||||
--><span>Score <span id="currentScoreSum" class="bold"></span></span>
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
<div id="guessCover"></div>
|
||||
<div id="panorama"></div>
|
||||
<div id="showGuessButtonContainer">
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<?php require ROOT . '/views/templates/main_header.php'; ?>
|
||||
<?php require ROOT . '/views/templates/header.php'; ?>
|
||||
<div class="main">
|
||||
<h2>Account activation</h2>
|
||||
<div class="box">
|
||||
<p class="error justify">Activation failed. Please check the link you entered or retry <a href="/signup" title="Sign up">sign up</a>!</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php require ROOT . '/views/templates/footer.php'; ?>
|
||||
<?php require ROOT . '/views/templates/main_footer.php'; ?>
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php require ROOT . '/views/templates/main_header.php'; ?>
|
||||
<?php require ROOT . '/views/templates/header.php'; ?>
|
||||
<div class="main">
|
||||
<h2>Account cancellation</h2>
|
||||
<div class="box">
|
||||
<?php if ($success) : ?>
|
||||
@@ -9,5 +8,5 @@
|
||||
<p class="error justify">Cancellation failed. Please check the link you entered! Maybe the account was already deleted, in this case no further action is required.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php require ROOT . '/views/templates/footer.php'; ?>
|
||||
<?php require ROOT . '/views/templates/main_footer.php'; ?>
|
||||
@@ -1,9 +1,8 @@
|
||||
<?php require ROOT . '/views/templates/main_header.php'; ?>
|
||||
<?php require ROOT . '/views/templates/header.php'; ?>
|
||||
<div class="main">
|
||||
<h2>Login up with Google</h2>
|
||||
<div class="box">
|
||||
<p class="error justify">Authenticating with Google failed. Please <a href="/login/google" title="Login with Google">retry</a>!</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php require ROOT . '/views/templates/footer.php'; ?>
|
||||
<?php require ROOT . '/views/templates/main_footer.php'; ?>
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php require ROOT . '/views/templates/main_header.php'; ?>
|
||||
<?php require ROOT . '/views/templates/header.php'; ?>
|
||||
<div class="main">
|
||||
<h2>Sign up</h2>
|
||||
<div class="box">
|
||||
<form id="googleSignupForm" action="/signup/google" method="post">
|
||||
@@ -22,7 +21,7 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php require ROOT . '/views/templates/footer.php'; ?>
|
||||
<script>
|
||||
(function () {
|
||||
var form = document.getElementById('googleSignupForm');
|
||||
|
||||
@@ -5,7 +5,6 @@ $jsFiles = [
|
||||
?>
|
||||
<?php require ROOT . '/views/templates/main_header.php'; ?>
|
||||
<?php require ROOT . '/views/templates/header.php'; ?>
|
||||
<div class="main">
|
||||
<h2>Login</h2>
|
||||
<div class="box">
|
||||
<form id="loginForm" action="/login" method="post">
|
||||
@@ -21,5 +20,5 @@ $jsFiles = [
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php require ROOT . '/views/templates/footer.php'; ?>
|
||||
<?php require ROOT . '/views/templates/main_footer.php'; ?>
|
||||
@@ -5,7 +5,6 @@ $jsFiles = [
|
||||
?>
|
||||
<?php require ROOT . '/views/templates/main_header.php'; ?>
|
||||
<?php require ROOT . '/views/templates/header.php'; ?>
|
||||
<div class="main">
|
||||
<h2>Sign up</h2>
|
||||
<div class="box">
|
||||
<form id="signupForm" action="/signup" method="post">
|
||||
@@ -31,5 +30,5 @@ $jsFiles = [
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php require ROOT . '/views/templates/footer.php'; ?>
|
||||
<?php require ROOT . '/views/templates/main_footer.php'; ?>
|
||||
@@ -1,9 +1,8 @@
|
||||
<?php require ROOT . '/views/templates/main_header.php'; ?>
|
||||
<?php require ROOT . '/views/templates/header.php'; ?>
|
||||
<div class="main">
|
||||
<h2>Sign up</h2>
|
||||
<div class="box">
|
||||
<p class="justify">Sign up was successful. Please check your email and click on the activation link to activate your account!</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php require ROOT . '/views/templates/footer.php'; ?>
|
||||
<?php require ROOT . '/views/templates/main_footer.php'; ?>
|
||||
+93
-13
@@ -5,36 +5,34 @@ $cssFiles = [
|
||||
?>
|
||||
<?php require ROOT . '/views/templates/main_header.php'; ?>
|
||||
<?php require ROOT . '/views/templates/header.php'; ?>
|
||||
<div class="main">
|
||||
<h2>Playable maps</h2>
|
||||
<div id="mapContainer">
|
||||
<?php foreach ($maps as $map): ?>
|
||||
<div class="mapItem">
|
||||
<div class="title">
|
||||
<p class="title"><?= $map['name'] ?></p>
|
||||
</div>
|
||||
<div class="imgContainer">
|
||||
<img src="https://maps.googleapis.com/maps/api/staticmap?size=350x175&visible=<?= $map['bound_south_lat'] . ',' . $map['bound_west_lng'] . '|' . $map['bound_north_lat'] . ',' . $map['bound_east_lng'] ?>&key=<?= $_ENV['GOOGLE_MAPS_JS_API_KEY'] ?>" alt="Map area">
|
||||
</div>
|
||||
<div class="imgContainer" data-bound-south-lat="<?= $map['bound_south_lat'] ?>" data-bound-west-lng="<?= $map['bound_west_lng'] ?>" data-bound-north-lat="<?= $map['bound_north_lat'] ?>" data-bound-east-lng="<?= $map['bound_east_lng'] ?>"></div>
|
||||
<div class="inner">
|
||||
<div class="info">
|
||||
<p>
|
||||
<?php /* Copyright (c) 2019 The Bootstrap Authors. License can be found in 'USED_SOFTWARE' in section 'Bootstrap Icons'. */ ?>
|
||||
<svg class="inline" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" d="M8 16s6-5.686 6-10A6 6 0 0 0 2 6c0 4.314 6 10 6 10zm0-7a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" />
|
||||
</svg>
|
||||
<?= $map['num_places'] ?> places
|
||||
</svg><!--
|
||||
--><?= $map['num_places'] ?> places
|
||||
</p>
|
||||
<p>
|
||||
<?php /* Copyright (c) 2019 The Bootstrap Authors. License can be found in 'USED_SOFTWARE' in section 'Bootstrap Icons'. */ ?>
|
||||
<svg class="inline" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" d="M12.5 2h-9V1h9v1zm-10 1.5v9h-1v-9h1zm11 9v-9h1v9h-1zM3.5 14h9v1h-9v-1z" />
|
||||
<path fill-rule="evenodd" d="M14 3a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm0 1a2 2 0 1 0 0-4 2 2 0 0 0 0 4zm0 11a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm0 1a2 2 0 1 0 0-4 2 2 0 0 0 0 4zM2 3a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm0 1a2 2 0 1 0 0-4 2 2 0 0 0 0 4zm0 11a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm0 1a2 2 0 1 0 0-4 2 2 0 0 0 0 4z" />
|
||||
</svg>
|
||||
~ <?= $map['area'][0] ?> <?= $map['area'][1] ?><sup>2</sup>
|
||||
</svg><!--
|
||||
-->~ <?= $map['area'][0] ?> <?= $map['area'][1] ?><sup>2</sup>
|
||||
</p>
|
||||
</div>
|
||||
<p class="small justify marginTop"><?= $map['description'] ?></p>
|
||||
<div class="description marginTop">
|
||||
<p class="small center"><?= $map['description'] ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($isAdmin): ?>
|
||||
<div class="buttonContainer">
|
||||
@@ -62,10 +60,90 @@ $cssFiles = [
|
||||
<?php endfor; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php require ROOT . '/views/templates/footer.php'; ?>
|
||||
<script>
|
||||
(function () {
|
||||
const GOOGLE_MAPS_JS_API_KEY = '<?= $_ENV['GOOGLE_MAPS_JS_API_KEY'] ?>';
|
||||
|
||||
var Maps = {
|
||||
descriptionDivs: null,
|
||||
|
||||
addStaticMaps: function () {
|
||||
var imgContainers = document.getElementById('mapContainer').getElementsByClassName('imgContainer');
|
||||
for (var i = 0; i < imgContainers.length; i++) {
|
||||
var imgContainer = imgContainers[i];
|
||||
|
||||
var imgSrc = 'https://maps.googleapis.com/maps/api/staticmap?size=350x175&' +
|
||||
'scale=' + (window.devicePixelRatio >= 2 ? 2 : 1) + '&' +
|
||||
'visible=' + imgContainer.dataset.boundSouthLat + ',' + imgContainer.dataset.boundWestLng + '|' +
|
||||
imgContainer.dataset.boundNorthLat + ',' + imgContainer.dataset.boundEastLng +
|
||||
'&key=' + GOOGLE_MAPS_JS_API_KEY;
|
||||
|
||||
imgContainer.style.backgroundImage = 'url("' + imgSrc + '")';
|
||||
}
|
||||
},
|
||||
|
||||
initializeDescriptionDivs: function () {
|
||||
Maps.descriptionDivs = document.getElementById('mapContainer').getElementsByClassName('description');
|
||||
|
||||
for (var i = 0; i < Maps.descriptionDivs.length; i++) {
|
||||
var description = Maps.descriptionDivs[i];
|
||||
var boundingClientRect = description.getBoundingClientRect();
|
||||
|
||||
description.defaultHeight = boundingClientRect.height;
|
||||
}
|
||||
},
|
||||
|
||||
calculateDescriptionDivHeights: function () {
|
||||
var currentY;
|
||||
var rows = [];
|
||||
for (var i = 0; i < Maps.descriptionDivs.length; i++) {
|
||||
var description = Maps.descriptionDivs[i];
|
||||
var boundingClientRect = description.getBoundingClientRect();
|
||||
|
||||
if (currentY !== boundingClientRect.y) {
|
||||
rows.push([]);
|
||||
}
|
||||
|
||||
rows[rows.length - 1].push(description);
|
||||
|
||||
currentY = boundingClientRect.y;
|
||||
}
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
|
||||
var maxHeight = 0;
|
||||
for (var j = 0; j < row.length; j++) {
|
||||
var description = row[j];
|
||||
|
||||
if (description.defaultHeight > maxHeight) {
|
||||
maxHeight = description.defaultHeight;
|
||||
}
|
||||
}
|
||||
|
||||
for (var j = 0; j < row.length; j++) {
|
||||
var description = row[j];
|
||||
|
||||
description.style.height = maxHeight + 'px';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Maps.addStaticMaps();
|
||||
|
||||
Maps.initializeDescriptionDivs();
|
||||
Maps.calculateDescriptionDivHeights();
|
||||
|
||||
window.onresize = function () {
|
||||
Maps.calculateDescriptionDivHeights();
|
||||
};
|
||||
})();
|
||||
</script>
|
||||
<?php if ($isAdmin): ?>
|
||||
<script>
|
||||
(function() {
|
||||
(function () {
|
||||
Maps = {
|
||||
deleteMap: function(mapId, mapName) {
|
||||
MapGuesser.showModalWithContent('Delete map', 'Are you sure you want to delete map \'' + mapName + '\'?', [{
|
||||
@@ -91,7 +169,9 @@ $cssFiles = [
|
||||
};
|
||||
|
||||
var buttons = document.getElementById('mapContainer').getElementsByClassName('deleteButton');
|
||||
for (var button of buttons) {
|
||||
for (var i = 0; i < buttons.length; i++) {
|
||||
var button = buttons[i];
|
||||
|
||||
button.onclick = function() {
|
||||
Maps.deleteMap(this.dataset.mapId, this.dataset.mapName);
|
||||
};
|
||||
|
||||
+1
-2
@@ -5,7 +5,6 @@ $jsFiles = [
|
||||
?>
|
||||
<?php require ROOT . '/views/templates/main_header.php'; ?>
|
||||
<?php require ROOT . '/views/templates/header.php'; ?>
|
||||
<div class="main">
|
||||
<h2>Profile</h2>
|
||||
<div class="box">
|
||||
<form id="profileForm" action="/profile" method="post">
|
||||
@@ -21,5 +20,5 @@ $jsFiles = [
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php require ROOT . '/views/templates/footer.php'; ?>
|
||||
<?php require ROOT . '/views/templates/main_footer.php'; ?>
|
||||
@@ -0,0 +1,5 @@
|
||||
</main>
|
||||
<footer>
|
||||
<p><span class="bold"><?= $_ENV['APP_NAME'] ?></span> <?= str_replace('Release_', '', VERSION) ?></p><!--
|
||||
--><p>© Pőcze Bence <?= (new DateTime(REVISION_DATE))->format('Y') ?></p>
|
||||
</footer>
|
||||
@@ -1,18 +1,18 @@
|
||||
<div class="header">
|
||||
<header>
|
||||
<h1>
|
||||
<a href="/" title="MapGuesser">
|
||||
<img class="inline" width="1em" height="1em" src="<?= $_ENV['STATIC_ROOT'] ?>/img/icon.svg?rev=<?= REVISION ?>">
|
||||
<span>MapGuesser</span>
|
||||
<a href="/" title="<?= $_ENV['APP_NAME'] ?>">
|
||||
<img class="inline" width="1em" height="1em" src="<?= $_ENV['STATIC_ROOT'] ?>/img/icon.svg?rev=<?= REVISION ?>"><!--
|
||||
--><span><?= $_ENV['APP_NAME'] ?></span>
|
||||
</a>
|
||||
</h1>
|
||||
<p class="header">
|
||||
<p>
|
||||
<?php if (Container::$request->user()) : ?>
|
||||
<span><a href="/profile" title="Profile">
|
||||
<?php /* Copyright (c) 2019 The Bootstrap Authors. License can be found in 'USED_SOFTWARE' in section 'Bootstrap Icons'. */ ?>
|
||||
<svg class="inline" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
|
||||
</svg>
|
||||
<?= Container::$request->user()->getDisplayName() ?><!--
|
||||
</svg><!--
|
||||
--><?= Container::$request->user()->getDisplayName() ?><!--
|
||||
--></a></span><!--
|
||||
--><span><a href="/logout" title="Logout">Logout</a></span>
|
||||
<?php else : ?>
|
||||
@@ -20,4 +20,5 @@
|
||||
--><span><a href="/login" title="Login">Login</a></span>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
<main>
|
||||
@@ -14,5 +14,30 @@
|
||||
<script src="<?= $jsFile ?>"></script>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<?php if (!isset($_COOKIE['COOKIES_CONSENT'])): ?>
|
||||
<script>
|
||||
(function () {
|
||||
MapGuesser = {
|
||||
cookiesAgreed: false,
|
||||
|
||||
agreeCookies: function () {
|
||||
if (MapGuesser.cookiesAgreed) {
|
||||
return;
|
||||
}
|
||||
|
||||
var expirationDate = new Date(new Date().getTime() + 20 * 365 * 24 * 60 * 60 * 1000).toUTCString();
|
||||
document.cookie = 'COOKIES_CONSENT=1; expires=' + expirationDate + '; path=/';
|
||||
|
||||
MapGuesser.cookiesAgreed = true;
|
||||
document.getElementById('cookiesNotice').style.display = 'none';
|
||||
}
|
||||
};
|
||||
|
||||
window.onclick = function () {
|
||||
MapGuesser.agreeCookies();
|
||||
};
|
||||
})();
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>MapGuesser</title>
|
||||
<title><?= $_ENV['APP_NAME'] ?></title>
|
||||
<link href="<?= $_ENV['STATIC_ROOT'] ?>/css/mapguesser.css?rev=<?= REVISION ?>" rel="stylesheet">
|
||||
<?php if (isset($cssFiles)) : ?>
|
||||
<?php foreach ($cssFiles as $cssFile) : ?>
|
||||
@@ -22,6 +22,14 @@
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="<?= $_ENV['STATIC_ROOT'] ?>/img/favicon/16x16.png?rev=<?= REVISION ?>">
|
||||
</head>
|
||||
<body>
|
||||
<?php if (!isset($_COOKIE['COOKIES_CONSENT'])): ?>
|
||||
<div id="cookiesNotice">
|
||||
<p class="small">
|
||||
<?= $_ENV['APP_NAME'] ?> uses cookies to improve user experience. By using the app or clicking 'Agree', you consent to our use of cookies.
|
||||
</p>
|
||||
<button id="agreeCookies" class="small marginTop">Agree</button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div id="loading">
|
||||
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/loading.svg?rev=<?= REVISION ?>" width="64" height="64">
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,7 @@ if (!empty($_ENV['DEV'])) {
|
||||
|
||||
Container::$routeCollection = new MapGuesser\Routing\RouteCollection();
|
||||
|
||||
Container::$routeCollection->get('index', '', [MapGuesser\Controller\HomeController::class, 'getIndex']);
|
||||
Container::$routeCollection->get('index', '', [MapGuesser\Controller\MapsController::class, 'getMaps']);
|
||||
Container::$routeCollection->group('login', function (MapGuesser\Routing\RouteCollection $routeCollection) {
|
||||
$routeCollection->get('login', '', [MapGuesser\Controller\LoginController::class, 'getLoginForm']);
|
||||
$routeCollection->post('login-action', '', [MapGuesser\Controller\LoginController::class, 'login']);
|
||||
@@ -35,7 +35,7 @@ Container::$routeCollection->group('profile', function (MapGuesser\Routing\Route
|
||||
$routeCollection->get('profile', '', [MapGuesser\Controller\UserController::class, 'getProfile']);
|
||||
$routeCollection->post('profile-action', '', [MapGuesser\Controller\UserController::class, 'saveProfile']);
|
||||
});
|
||||
Container::$routeCollection->get('maps', 'maps', [MapGuesser\Controller\MapsController::class, 'getMaps']);
|
||||
//Container::$routeCollection->get('maps', 'maps', [MapGuesser\Controller\MapsController::class, 'getMaps']);
|
||||
Container::$routeCollection->group('game', function (MapGuesser\Routing\RouteCollection $routeCollection) {
|
||||
$routeCollection->get('game', '{mapId}', [MapGuesser\Controller\GameController::class, 'getGame']);
|
||||
$routeCollection->get('game-json', '{mapId}/json', [MapGuesser\Controller\GameController::class, 'getGameJson']);
|
||||
@@ -49,15 +49,19 @@ Container::$routeCollection->group('admin', function (MapGuesser\Routing\RouteCo
|
||||
$routeCollection->post('admin.deleteMap', 'deleteMap/{mapId}', [MapGuesser\Controller\MapAdminController::class, 'deleteMap']);
|
||||
});
|
||||
|
||||
Container::$sessionHandler = new MapGuesser\Session\DatabaseSessionHandler();
|
||||
if (isset($_COOKIE['COOKIES_CONSENT'])) {
|
||||
Container::$sessionHandler = new MapGuesser\Session\DatabaseSessionHandler();
|
||||
|
||||
session_set_save_handler(Container::$sessionHandler, true);
|
||||
session_start([
|
||||
'gc_maxlifetime' => 604800,
|
||||
'cookie_lifetime' => 604800,
|
||||
'cookie_httponly' => true,
|
||||
'cookie_samesite' => 'Lax'
|
||||
]);
|
||||
session_set_save_handler(Container::$sessionHandler, true);
|
||||
session_start([
|
||||
'gc_maxlifetime' => 604800,
|
||||
'cookie_lifetime' => 604800,
|
||||
'cookie_httponly' => true,
|
||||
'cookie_samesite' => 'Lax'
|
||||
]);
|
||||
} else {
|
||||
$_SESSION = [];
|
||||
}
|
||||
|
||||
Container::$request = new MapGuesser\Request\Request($_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'], $_GET, $_POST, $_SESSION);
|
||||
|
||||
|
||||
Reference in new issue
Block a user