This repository has been archived by the owner on Mar 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
238 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
latest | ||
1.1.2 | ||
1.1.4 | ||
1.1 | ||
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
/** | ||
* KIMB-Forms-Project | ||
* https://github.com/KIMB-technologies/KIMB-Forms-Project | ||
* | ||
* (c) 2018 - 2020 KIMB-technologies | ||
* https://github.com/KIMB-technologies/ | ||
* | ||
* released under the terms of GNU Public License Version 3 | ||
* https://www.gnu.org/licenses/gpl-3.0.txt | ||
*/ | ||
defined( 'KIMB-FORMS-PROJECT' ) or die('Invalid Endpoint!'); | ||
|
||
/** | ||
* System Mailer Class | ||
* Uses PHP-Mail Function (to use SMTP use the Docker-Image, which uses internally https://hub.docker.com/r/kimbtechnologies/php_smtp_nginx) | ||
*/ | ||
class Mail { | ||
|
||
private static $templates = array( | ||
'mailAdminNotif' | ||
); | ||
|
||
private $type, $template, $mailHeader; | ||
|
||
/** | ||
* Creates the Mail (also using a HTML Template) | ||
*/ | ||
public function __construct( string $mailType ){ | ||
$this->type = 'mail' . $mailType; | ||
if( !in_array( $this->type, self::$templates ) ){ | ||
throw new Exception('Unknown Mail Template Type'); | ||
} | ||
$this->template = new Template( $this->type ); | ||
|
||
$this->setUpMailMeta(); | ||
} | ||
|
||
/** | ||
* Set a content key in the mail template | ||
*/ | ||
public function setContent( $key, $value ){ | ||
$this->template->setContent($key, $value); | ||
} | ||
|
||
/** | ||
* Sets up the meta data for the mail (header, ...) | ||
*/ | ||
private function setUpMailMeta(){ | ||
$c = new Config(); | ||
preg_match( '/https?:\/\/([^\/\:]+).*/', $c->getValue(['site', 'hosturl']), $match ); | ||
if( !isset($match[1])){ | ||
$match[1] = 'example.com'; | ||
} | ||
|
||
$this->mailHeader = implode("\r\n", | ||
array( | ||
'MIME-Version: 1.0', | ||
'Content-type: text/html; charset=utf-8', | ||
'From: KIMB-Forms <forms@' . $match[1] . '>' | ||
) | ||
); | ||
} | ||
|
||
/** | ||
* Sends the created Mail | ||
* @param $to The destination mail address | ||
*/ | ||
public function sendMail(string $to){ | ||
mail( | ||
$to, | ||
LanguageManager::getTranslation($this->type), | ||
$this->template->getOutputString(), | ||
$this->mailHeader | ||
); | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"%%POLLNAME%%": "", | ||
"%%TERMINE%%": "", | ||
"%%NAME%%": "", | ||
"%%EMAIL%%": "", | ||
"%%ADMINLINK%%": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<html> | ||
<body> | ||
<h1>Neue Teilnahme</h1> | ||
<h2>%%POLLNAME%%</h2> | ||
<ul> | ||
<li> | ||
Gewählte Termine<br /> | ||
%%TERMINE%% | ||
</li> | ||
<li> | ||
%%NAME%% | ||
</li> | ||
<li> | ||
%%EMAIL%% | ||
</li> | ||
</ul> | ||
<a href="%%ADMINLINK%%"> | ||
Zum Adminbereich | ||
</a> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<html> | ||
<body> | ||
<h1>New Submission</h1> | ||
<h2>%%POLLNAME%%</h2> | ||
<ul> | ||
<li> | ||
Choosen options<br /> | ||
%%TERMINE%% | ||
</li> | ||
<li> | ||
%%NAME%% | ||
</li> | ||
<li> | ||
%%EMAIL%% | ||
</li> | ||
</ul> | ||
<a href="%%ADMINLINK%%"> | ||
Open admin section | ||
</a> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters