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

Commit

Permalink
fix #38
Browse files Browse the repository at this point in the history
  • Loading branch information
kimbtech committed Jan 30, 2020
1 parent cb88a36 commit 1ca7d98
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 5 deletions.
3 changes: 2 additions & 1 deletion core/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class Mail {
private static $templates = array(
'mailAdminNotif',
'mailNewPollNotif',
'mailPollSubm'
'mailPollSubm',
'mailAdminDel'
);

private $type, $template, $mailHeader, $maillog;
Expand Down
30 changes: 27 additions & 3 deletions core/api/DelUserSubmission.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ class DelUserSubmission {
const MAXL_ID = 10;

/**
* Poll submission storage
* Poll submission storages and pollid
*/
private $pollsub;
private $pollid;
private $pollid, $pollsub, $polldata;

/**
* Deletes a submisson from a poll
Expand Down Expand Up @@ -57,6 +56,7 @@ private function openPollSubmissions() {
$this->pollid = $_GET['poll'];
if( Utilities::checkFileName($this->pollid) && in_array( $this->pollid, $polls->getArray() ) ){
$this->pollsub = new JSONReader( 'pollsub_' . $this->pollid, true ); //exclusive
$this->polldata = new JSONReader( 'poll_' . $this->pollid );
}
}
else{
Expand Down Expand Up @@ -89,11 +89,35 @@ private function deleteSubmission(int $id, string $code){
__DIR__ . '/../../data/pollsubmissions.log',
json_encode( array( $this->pollid, 'delted entry' , $name, $mail, [$id], time() ) ) . "\r\n",
FILE_APPEND | LOCK_EX );

$this->informAdmin($name, $mail, $id);

die('ok');
}
}
}

/**
* Send Mail to Poll Admin
*/
private function informAdmin(string $name, string $mail, int $termin) {
if( $this->polldata->isValue(['notifymails']) ){
$tos = $this->polldata->getValue(['notifymails']);
if( !empty($tos) ){
$m = new Mail( 'AdminDel' );

$m->setContent('POLLNAME', Utilities::optimizeOutputString($this->polldata->getValue( ['pollname'] )));
$m->setContent('TERMINE', Utilities::optimizeOutputString( $this->polldata->getValue( ['termine', $termin, 'bez'] ) ) );
$m->setContent('NAME', Utilities::optimizeOutputString( $name ));
$m->setContent('EMAIL', Utilities::optimizeOutputString( $mail ));
$m->setContent('ADMINLINK', URL::generateLink('admin', '', $this->polldata->getValue(['code', 'admin'])));

foreach( $tos as $to ){
$m->sendMail( $to );
}
}
}
}
}

?>
7 changes: 7 additions & 0 deletions core/templates/mailAdminDel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"%%POLLNAME%%": "",
"%%TERMINE%%": "",
"%%NAME%%": "",
"%%EMAIL%%": "",
"%%ADMINLINK%%": ""
}
21 changes: 21 additions & 0 deletions core/templates/mailAdminDel_de.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<html>
<body>
<h1>Gelöschter Eintrag</h1>
<h2>%%POLLNAME%%</h2>
<ul>
<li>
Gelöschter Termin<br />
%%TERMINE%%
</li>
<li>
%%NAME%%
</li>
<li>
%%EMAIL%%
</li>
</ul>
<a href="%%ADMINLINK%%">
Zum Adminbereich
</a>
</body>
</html>
21 changes: 21 additions & 0 deletions core/templates/mailAdminDel_en.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<html>
<body>
<h1>Deleted entry</h1>
<h2>%%POLLNAME%%</h2>
<ul>
<li>
Deleted Option<br />
%%TERMINE%%
</li>
<li>
%%NAME%%
</li>
<li>
%%EMAIL%%
</li>
</ul>
<a href="%%ADMINLINK%%">
Open admin section
</a>
</body>
</html>
1 change: 1 addition & 0 deletions data/translation_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
"FillAdditionals": "Bitte alle Felder füllen, nicht als optional gekennzeichnete Felder sind Pflichtfelder.",
"InvalMail": "Die eingegebene E-Mail-Adresse erfüllt nicht die Anforderungen!",
"mailPollSubm": "Liste meiner Eintraege",
"mailAdminDel": "Gelöschter Eintrag",
"MailTimeout": "Mailversand an die Adresse fehlgeschlagen, da zu viele Mails an diese Adresse geschickt wurden. Versuchen Sie es später erneut."
}
1 change: 1 addition & 0 deletions data/translation_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
"FillAdditionals": "Please fill in all values, fields not marked as optional are required.",
"InvalMail": "The given E-Mail-Address does not fullfil the requirements!",
"mailPollSubm": "List of my entries",
"mailAdminDel": "Deleted entry",
"MailTimeout": "Error while sending mail, because too many mails have been send to this address. Please try again later."
}
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- CONF_captcha_new=false
- CONF_texts_enablePoll=true
- CONF_texts_enableNew=true
- CONF_texts_textPoll=Ich bin mit den Datenschutzrichlinien ... einverstanden!
- CONF_texts_textPoll=Ich bin mit den Datenschutzrichtlinien ... einverstanden!
- CONF_texts_textNew=Ich bin mit den AGB des Anbieters einverstanden!
- CONF_cookiebanner=false
- [email protected]
Expand Down

0 comments on commit 1ca7d98

Please sign in to comment.