Add initial Plenario live polling app
CI / Deploy / test (push) Successful in 49s
CI / Deploy / deploy (push) Failing after 5s

CakePHP 5.4 app for live polls: create via email without login, manage
via secret admin link, join via code. Includes slide types (choice,
wordcloud, open, scale, content), presenter mode, CSV export, captcha,
throttling, tests and Gitea CI/deploy workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-07 13:24:29 +01:00
commit eb319f8c1e
120 files changed
+15572

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace App\Mailer;
use App\Model\Entity\Poll;
use Cake\Mailer\Mailer;
/**
* Mails sent by Plenario. Templates: templates/email/{html,text}/.
*/
class PollMailer extends Mailer
{
/**
* Mail with the secret admin link after a poll was created.
*
* @param \App\Model\Entity\Poll $poll Poll
* @param string $adminUrl Absolute admin URL (contains the token)
* @param string $joinUrl Absolute participant URL
* @return void
*/
public function adminLink(Poll $poll, string $adminUrl, string $joinUrl): void
{
$this
->setTo($poll->email)
->setSubject(__('Deine Umfrage „{0}“ – Admin-Link', $poll->title))
->setEmailFormat('both')
->setViewVars(compact('poll', 'adminUrl', 'joinUrl'))
->viewBuilder()
->setTemplate('admin_link');
}
/**
* Recovery mail listing all admin links of an e-mail address.
*
* @param string $email Recipient
* @param list<array{title: string, url: string, created: string}> $links Admin links
* @return void
*/
public function recovery(string $email, array $links): void
{
$this
->setTo($email)
->setSubject(__('Deine Admin-Links bei Plenario'))
->setEmailFormat('both')
->setViewVars(compact('links'))
->viewBuilder()
->setTemplate('recovery');
}
}
+48
View File
@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
namespace App\Mailer\Transport;
use Cake\Mailer\AbstractTransport;
use Cake\Mailer\Message;
use RuntimeException;
/**
* Development transport: writes every mail as .eml file to tmp/mails/
* instead of sending it. Configure via EmailTransport.default.className.
*
* Options: `path` (default TMP/mails/).
*/
class FileTransport extends AbstractTransport
{
/**
* @var array<string, mixed>
*/
protected array $_defaultConfig = [
'path' => TMP . 'mails' . DS,
];
/**
* @param \Cake\Mailer\Message $message Message
* @return array{headers: string, message: string}
*/
public function send(Message $message): array
{
$this->checkRecipient($message);
$path = rtrim((string)$this->getConfig('path'), '/\\') . DS;
if (!is_dir($path) && !mkdir($path, 0775, true) && !is_dir($path)) {
throw new RuntimeException(sprintf('Could not create mail directory "%s".', $path));
}
$headers = $message->getHeadersString(
['from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'subject'],
);
$body = $message->getBodyString();
$file = $path . date('Ymd-His') . '-' . bin2hex(random_bytes(4)) . '.eml';
file_put_contents($file, $headers . "\r\n\r\n" . $body);
return ['headers' => $headers, 'message' => $body];
}
}