Merged in feature/MAPG-164-make-possible-to-rename-application (pull request #132)

MAPG-164 show application's name from env variable
This commit is contained in:
Bence Pőcze 2020-06-22 19:07:39 +00:00
commit 0d097aacb5
11 changed files with 26 additions and 20 deletions

View File

@ -1,3 +1,4 @@
APP_NAME=MapQuiz
DEV=1 DEV=1
DB_HOST=mariadb DB_HOST=mariadb
DB_USER=mapguesser DB_USER=mapguesser

View File

@ -1,9 +1,9 @@
Hi, Hi,
<br><br> <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> <br><br>
Have fun on MapGuesser! Have fun on {{APP_NAME}}!
<br><br> <br><br>
Regards,<br> Regards,<br>
MapGuesser<br> {{APP_NAME}}<br>
<a href="{{BASE_URL}}" title="MapGuesser">{{BASE_URL}}</a> <a href="{{BASE_URL}}" title="{{APP_NAME}}">{{BASE_URL}}</a>

View File

@ -1,14 +1,14 @@
Hi, Hi,
<br><br> <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> <a href="{{ACTIVATE_LINK}}" title="Account activation">{{ACTIVATE_LINK}}</a>
<br><br> <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> 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> <a href="{{CANCEL_LINK}}" title="Sign up cancellation">{{CANCEL_LINK}}</a>
<br><br> <br><br>
Have fun on MapGuesser! Have fun on {{APP_NAME}}!
<br><br> <br><br>
Regards,<br> Regards,<br>
MapGuesser<br> {{APP_NAME}}<br>
<a href="{{BASE_URL}}" title="MapGuesser">{{BASE_URL}}</a> <a href="{{BASE_URL}}" title="{{APP_NAME}}">{{BASE_URL}}</a>

View File

@ -373,12 +373,11 @@ class LoginController
{ {
$mail = new Mail(); $mail = new Mail();
$mail->addRecipient($email); $mail->addRecipient($email);
$mail->setSubject('Welcome to MapGuesser - Activate your account'); $mail->setSubject('Welcome to ' . $_ENV['APP_NAME'] . ' - Activate your account');
$mail->setBodyFromTemplate('signup', [ $mail->setBodyFromTemplate('signup', [
'EMAIL' => $email, 'EMAIL' => $email,
'ACTIVATE_LINK' => $this->request->getBase() . '/'. \Container::$routeCollection->getRoute('signup.activate')->generateLink(['token' => $token]), '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]), 'CANCEL_LINK' => $this->request->getBase() . '/' . \Container::$routeCollection->getRoute('signup.cancel')->generateLink(['token' => $token]),
'BASE_URL' => $this->request->getBase(),
]); ]);
$mail->send(); $mail->send();
} }
@ -387,10 +386,9 @@ class LoginController
{ {
$mail = new Mail(); $mail = new Mail();
$mail->addRecipient($email); $mail->addRecipient($email);
$mail->setSubject('Welcome to MapGuesser'); $mail->setSubject('Welcome to ' . $_ENV['APP_NAME']);
$mail->setBodyFromTemplate('signup-noconfirm', [ $mail->setBodyFromTemplate('signup-noconfirm', [
'EMAIL' => $email, 'EMAIL' => $email,
'BASE_URL' => $this->request->getBase(),
]); ]);
$mail->send(); $mail->send();
} }

View File

@ -29,6 +29,13 @@ class Mail
{ {
$this->body = file_get_contents(ROOT . '/mail/' . $template . '.html'); $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) { foreach ($params as $key => $param) {
$this->body = str_replace('{{' . $key . '}}', $param, $this->body); $this->body = str_replace('{{' . $key . '}}', $param, $this->body);
} }

View File

@ -17,7 +17,7 @@ $jsFiles = [
<h1> <h1>
<a href="/maps" title="Back to playable maps"> <a href="/maps" title="Back to playable maps">
<img class="inline" width="1em" height="1em" src="<?= $_ENV['STATIC_ROOT'] ?>/img/icon.svg?rev=<?= REVISION ?>"><!-- <img class="inline" width="1em" height="1em" src="<?= $_ENV['STATIC_ROOT'] ?>/img/icon.svg?rev=<?= REVISION ?>"><!--
--><span>MapGuesser</span> --><span><?= $_ENV['APP_NAME'] ?></span>
</a> </a>
</h1> </h1>
<p class="header"> <p class="header">

View File

@ -1,6 +1,6 @@
<?php require ROOT . '/views/templates/main_header.php'; ?> <?php require ROOT . '/views/templates/main_header.php'; ?>
<?php require ROOT . '/views/templates/header.php'; ?> <?php require ROOT . '/views/templates/header.php'; ?>
<h2>404 | Page not found</h2> <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> <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/footer.php'; ?>
<?php require ROOT . '/views/templates/main_footer.php'; ?> <?php require ROOT . '/views/templates/main_footer.php'; ?>

View File

@ -12,7 +12,7 @@ $jsFiles = [
<h1> <h1>
<a href="/maps" title="Back to playable maps"> <a href="/maps" title="Back to playable maps">
<img class="inline" width="1em" height="1em" src="<?= $_ENV['STATIC_ROOT'] ?>/img/icon.svg?rev=<?= REVISION ?>"><!-- <img class="inline" width="1em" height="1em" src="<?= $_ENV['STATIC_ROOT'] ?>/img/icon.svg?rev=<?= REVISION ?>"><!--
--><span>MapGuesser</span> --><span><?= $_ENV['APP_NAME'] ?></span>
</a> </a>
</h1> </h1>
<p class="header"> <p class="header">

View File

@ -1,5 +1,5 @@
</main> </main>
<footer> <footer>
<p><span class="bold">MapGuesser</span> <?= VERSION ?></p><!-- <p><span class="bold"><?= $_ENV['APP_NAME'] ?></span> <?= VERSION ?></p><!--
--><p>&copy; Pőcze Bence <?= (new DateTime(REVISION_DATE))->format('Y') ?></p> --><p>&copy; Pőcze Bence <?= (new DateTime(REVISION_DATE))->format('Y') ?></p>
</footer> </footer>

View File

@ -1,8 +1,8 @@
<header> <header>
<h1> <h1>
<a href="/" title="MapGuesser"> <a href="/" title="<?= $_ENV['APP_NAME'] ?>">
<img class="inline" width="1em" height="1em" src="<?= $_ENV['STATIC_ROOT'] ?>/img/icon.svg?rev=<?= REVISION ?>"><!-- <img class="inline" width="1em" height="1em" src="<?= $_ENV['STATIC_ROOT'] ?>/img/icon.svg?rev=<?= REVISION ?>"><!--
--><span>MapGuesser</span> --><span><?= $_ENV['APP_NAME'] ?></span>
</a> </a>
</h1> </h1>
<p> <p>

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <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"> <link href="<?= $_ENV['STATIC_ROOT'] ?>/css/mapguesser.css?rev=<?= REVISION ?>" rel="stylesheet">
<?php if (isset($cssFiles)) : ?> <?php if (isset($cssFiles)) : ?>
<?php foreach ($cssFiles as $cssFile) : ?> <?php foreach ($cssFiles as $cssFile) : ?>