Skip to content
This repository has been archived by the owner on Mar 30, 2024. It is now read-only.

Commit

Permalink
Imprint URL Support
Browse files Browse the repository at this point in the history
  • Loading branch information
kimbtech committed Sep 26, 2020
1 parent 3ce99c7 commit 5d9f2cd
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
latest
0.2.7
0.2.8
0.2
0
2 changes: 2 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ services:
- DEVMODE=true
- CONF_DOMAIN=http://localhost:8080/
- CONF_TIMEZONE=Europe/Berlin # php timezone string
- CONF_IMPRESSUMURL=http://example.com/impressum
- CONF_IMPRESSUMNAME=Imprint and Privacy
- ADMIN_ACCOUNT=admin
- ADMIN_PASSWORD=password
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ services:
- DEVMODE=false
- CONF_DOMAIN=http://localhost:8080/
- CONF_TIMEZONE=Europe/Berlin # php timezone string
#- CONF_IMPRESSUMURL=http://example.com/impressum # imprint/ privacy link and name pf link (optional)
#- CONF_IMPRESSUMNAME=Imprint and Privacy
- ADMIN_ACCOUNT=test # admin account (initial creation on docker container startup)
- ADMIN_PASSWORD=
10 changes: 10 additions & 0 deletions php/core/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,15 @@ public static function getBaseUrl() : string {
}
return $d;
}

public static function getImprintData() : ?array {
if(empty($_ENV['CONF_IMPRESSUMURL']) || empty($_ENV['CONF_IMPRESSUMURL'])){
return null;
}
return array(
'IMPRESSUMURL' => $_ENV['CONF_IMPRESSUMURL'],
'IMPRESSUMNAME' => $_ENV['CONF_IMPRESSUMNAME']
);
}
}
?>
13 changes: 13 additions & 0 deletions php/core/WebGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,20 @@ public function __construct( ParamParser $param, Login $login ) {
else{
$this->mainTemp->setContent('HOMELINK', '');
}

$this->fillTemplateWithImprint($this->mainTemp);
}

private function fillTemplateWithImprint( Template $t ) : void {
$imprintData = Config::getImprintData();
if(!is_null($imprintData)){
$t->setContent('COOKIEBANNER', '');
foreach($imprintData as $k => $v){
$t->setContent($k, $v);
}
}
}

public function accountManage() : void {
$this->mainTemp->setContent('TITLE', 'Account Management');
$account = new Template('account');
Expand Down Expand Up @@ -276,6 +288,7 @@ public function loginForm() : void {
$this->mainTemp->setContent('TITLE', 'Login');
$login = new Template('login');
$this->mainTemp->includeTemplate($login);
$this->fillTemplateWithImprint($login);
}

public function __destruct(){
Expand Down
6 changes: 5 additions & 1 deletion php/core/templates/login.json
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
{}
{
"%%COOKIEBANNER%%" : "disable",
"%%IMPRESSUMURL%%" : "",
"%%IMPRESSUMNAME%%" : ""
}
7 changes: 7 additions & 0 deletions php/core/templates/login_en.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
<input type="submit" value="Login" class="btn btn-secondary">
</div>
</div>
<div class="alert alert-info %%COOKIEBANNER%%" role="alert">
<h4 class="alert-heading">Cookies</h4>
This site uses cookies to make the login work. This site does not use any tracking or third party cookies.
Beside the cookie for the login, inputs of a user may be stored in the user's browser,
so that the input fields can already be filled in.<br/>
For more information see about cookies and privacy see <a href="%%IMPRESSUMURL%%" target="_blank">%%IMPRESSUMNAME%%</a>.
</div>
</form>


5 changes: 4 additions & 1 deletion php/core/templates/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"%%INNERCONTAINER%%" : "",
"%%DISPLAYLOGOUTBOX%%" : "disable",
"%%GROUP%%" : "",
"%%HOMELINK%%" : "<a href=\"%%SERVERURL%%\/\"><button type=\"button\" class=\"btn btn-dark\">&larr; Home<\/button><\/a>"
"%%HOMELINK%%" : "<a href=\"%%SERVERURL%%\/\"><button type=\"button\" class=\"btn btn-dark\">&larr; Home<\/button><\/a>",
"%%COOKIEBANNER%%" : "disable",
"%%IMPRESSUMURL%%" : "",
"%%IMPRESSUMNAME%%" : ""
}
12 changes: 8 additions & 4 deletions php/core/templates/main_en.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,14 @@ <h2>%%TITLE%%</h2>
<div id="footer">
<center>
<small>
TaskTimeTerminate Server for
<a href="https://github.com/KIMB-technologies/TaskTimeTerminate" target="_blank">TaskTimeTerminate by KIMB-technologies</a>
&ndash;
<a href="https://www.gnu.org/licenses/gpl-3.0.txt" target="_blank">GPLv3</a>
<p>TaskTimeTerminate Server for
<a href="https://github.com/KIMB-technologies/TaskTimeTerminate" target="_blank">TaskTimeTerminate by KIMB-technologies</a>
&ndash;
<a href="https://www.gnu.org/licenses/gpl-3.0.txt" target="_blank">GPLv3</a>
</p>
<p class="%%COOKIEBANNER%%">
<a href="%%IMPRESSUMURL%%" target="_blank">%%IMPRESSUMNAME%%</a>
</p>
</small>
</center>
</div>
Expand Down

0 comments on commit 5d9f2cd

Please sign in to comment.