From eb319f8c1e704c14532b070d6628a58fbd9e9958 Mon Sep 17 00:00:00 2001 From: Patrick Niebeling Date: Sat, 7 Nov 2026 13:24:29 +0100 Subject: [PATCH] Add initial Plenario live polling app 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 --- .editorconfig | 26 + .gitattributes | 36 + .gitea/workflows/ci.yml | 146 + .gitignore | 90 + .htaccess | 12 + AGENTS.md | 159 + CLAUDE.md | 8 + README.md | 79 + bin/bash_completion.sh | 47 + bin/cake | 75 + bin/cake.bat | 27 + bin/cake.php | 10 + composer.json | 58 + composer.lock | 6594 +++++++++++++++++ config/.env.example | 38 + .../20261107120000_CreateInitialSchema.php | 79 + config/app.php | 509 ++ config/app_local.example.php | 68 + config/bootstrap.php | 239 + config/paths.php | 94 + config/plugins.php | 36 + config/routes.php | 70 + config/schema/i18n.sql | 18 + config/schema/sessions.sql | 15 + data/.gitkeep | 0 index.php | 16 + phpcs.xml | 10 + phpunit.xml.dist | 36 + plugins/.gitkeep | 0 resources/.gitkeep | 0 src/Application.php | 129 + src/Captcha/CaptchaFactory.php | 36 + src/Captcha/CaptchaInterface.php | 34 + src/Captcha/MathCaptcha.php | 76 + src/Captcha/NoCaptcha.php | 36 + src/Captcha/RecaptchaCaptcha.php | 83 + src/Console/Installer.php | 260 + src/Controller/AdminAppController.php | 107 + src/Controller/AdminController.php | 308 + src/Controller/AppController.php | 56 + src/Controller/Component/.gitkeep | 0 src/Controller/ErrorController.php | 70 + src/Controller/HomeController.php | 229 + src/Controller/ParticipateController.php | 168 + src/Controller/SlidesController.php | 191 + src/Mailer/PollMailer.php | 50 + src/Mailer/Transport/FileTransport.php | 48 + src/Middleware/HostHeaderMiddleware.php | 58 + src/Model/Behavior/.gitkeep | 0 src/Model/Entity/.gitkeep | 0 src/Model/Entity/Poll.php | 58 + src/Model/Entity/Response.php | 39 + src/Model/Entity/Slide.php | 126 + src/Model/Entity/SlideOption.php | 23 + src/Model/Table/.gitkeep | 0 src/Model/Table/PollsTable.php | 233 + src/Model/Table/ResponsesTable.php | 139 + src/Model/Table/SlideOptionsTable.php | 45 + src/Model/Table/SlidesTable.php | 281 + src/Service/PollStateService.php | 185 + src/Service/ResultsService.php | 198 + src/Service/ThrottleService.php | 45 + src/Service/VoteException.php | 13 + src/Service/VoteService.php | 280 + src/View/AjaxView.php | 46 + src/View/AppView.php | 41 + src/View/Cell/.gitkeep | 0 src/View/Helper/.gitkeep | 0 templates/Admin/index.php | 163 + templates/Admin/present.php | 56 + templates/Error/error400.php | 24 + templates/Error/error500.php | 39 + templates/Home/created.php | 29 + templates/Home/index.php | 60 + templates/Home/join.php | 26 + templates/Home/recover.php | 23 + templates/Participate/view.php | 130 + templates/Slides/form.php | 109 + templates/cell/.gitkeep | 1 + templates/element/captcha.php | 25 + templates/element/flash/default.php | 15 + templates/element/flash/error.php | 11 + templates/element/flash/info.php | 11 + templates/element/flash/success.php | 11 + templates/element/flash/warning.php | 11 + templates/email/html/admin_link.php | 17 + templates/email/html/default.php | 22 + templates/email/html/recovery.php | 17 + templates/email/text/admin_link.php | 24 + templates/email/text/default.php | 18 + templates/email/text/recovery.php | 19 + templates/layout/ajax.php | 17 + templates/layout/default.php | 46 + templates/layout/email/html/default.php | 18 + templates/layout/email/text/default.php | 17 + templates/layout/error.php | 31 + templates/layout/present.php | 24 + tests/Fixture/.gitkeep | 0 tests/Fixture/PollsFixture.php | 18 + tests/Fixture/ResponsesFixture.php | 18 + tests/Fixture/SlideOptionsFixture.php | 18 + tests/Fixture/SlidesFixture.php | 18 + tests/TestCase/ApplicationTest.php | 88 + tests/TestCase/Captcha/CaptchaTest.php | 79 + .../Controller/AdminControllerTest.php | 186 + tests/TestCase/Controller/Component/.gitkeep | 0 .../Controller/HomeControllerTest.php | 149 + .../Controller/ParticipateControllerTest.php | 157 + tests/TestCase/Model/Behavior/.gitkeep | 0 tests/TestCase/PlenarioTestTrait.php | 83 + tests/TestCase/Service/VoteServiceTest.php | 233 + tests/TestCase/View/Helper/.gitkeep | 0 tests/bootstrap.php | 60 + webroot/.htaccess | 5 + webroot/css/normalize.min.css | 8 + webroot/css/plenario.css | 335 + webroot/favicon.ico | Bin 0 -> 15086 bytes webroot/index.php | 37 + webroot/js/.gitkeep | 0 webroot/js/plenario.js | 780 ++ 120 files changed, 15572 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitea/workflows/ci.yml create mode 100644 .gitignore create mode 100644 .htaccess create mode 100644 AGENTS.md create mode 100644 CLAUDE.md create mode 100644 README.md create mode 100644 bin/bash_completion.sh create mode 100644 bin/cake create mode 100644 bin/cake.bat create mode 100644 bin/cake.php create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 config/.env.example create mode 100644 config/Migrations/20261107120000_CreateInitialSchema.php create mode 100644 config/app.php create mode 100644 config/app_local.example.php create mode 100644 config/bootstrap.php create mode 100644 config/paths.php create mode 100644 config/plugins.php create mode 100644 config/routes.php create mode 100644 config/schema/i18n.sql create mode 100644 config/schema/sessions.sql create mode 100644 data/.gitkeep create mode 100644 index.php create mode 100644 phpcs.xml create mode 100644 phpunit.xml.dist create mode 100644 plugins/.gitkeep create mode 100644 resources/.gitkeep create mode 100644 src/Application.php create mode 100644 src/Captcha/CaptchaFactory.php create mode 100644 src/Captcha/CaptchaInterface.php create mode 100644 src/Captcha/MathCaptcha.php create mode 100644 src/Captcha/NoCaptcha.php create mode 100644 src/Captcha/RecaptchaCaptcha.php create mode 100644 src/Console/Installer.php create mode 100644 src/Controller/AdminAppController.php create mode 100644 src/Controller/AdminController.php create mode 100644 src/Controller/AppController.php create mode 100644 src/Controller/Component/.gitkeep create mode 100644 src/Controller/ErrorController.php create mode 100644 src/Controller/HomeController.php create mode 100644 src/Controller/ParticipateController.php create mode 100644 src/Controller/SlidesController.php create mode 100644 src/Mailer/PollMailer.php create mode 100644 src/Mailer/Transport/FileTransport.php create mode 100644 src/Middleware/HostHeaderMiddleware.php create mode 100644 src/Model/Behavior/.gitkeep create mode 100644 src/Model/Entity/.gitkeep create mode 100644 src/Model/Entity/Poll.php create mode 100644 src/Model/Entity/Response.php create mode 100644 src/Model/Entity/Slide.php create mode 100644 src/Model/Entity/SlideOption.php create mode 100644 src/Model/Table/.gitkeep create mode 100644 src/Model/Table/PollsTable.php create mode 100644 src/Model/Table/ResponsesTable.php create mode 100644 src/Model/Table/SlideOptionsTable.php create mode 100644 src/Model/Table/SlidesTable.php create mode 100644 src/Service/PollStateService.php create mode 100644 src/Service/ResultsService.php create mode 100644 src/Service/ThrottleService.php create mode 100644 src/Service/VoteException.php create mode 100644 src/Service/VoteService.php create mode 100644 src/View/AjaxView.php create mode 100644 src/View/AppView.php create mode 100644 src/View/Cell/.gitkeep create mode 100644 src/View/Helper/.gitkeep create mode 100644 templates/Admin/index.php create mode 100644 templates/Admin/present.php create mode 100644 templates/Error/error400.php create mode 100644 templates/Error/error500.php create mode 100644 templates/Home/created.php create mode 100644 templates/Home/index.php create mode 100644 templates/Home/join.php create mode 100644 templates/Home/recover.php create mode 100644 templates/Participate/view.php create mode 100644 templates/Slides/form.php create mode 100644 templates/cell/.gitkeep create mode 100644 templates/element/captcha.php create mode 100644 templates/element/flash/default.php create mode 100644 templates/element/flash/error.php create mode 100644 templates/element/flash/info.php create mode 100644 templates/element/flash/success.php create mode 100644 templates/element/flash/warning.php create mode 100644 templates/email/html/admin_link.php create mode 100644 templates/email/html/default.php create mode 100644 templates/email/html/recovery.php create mode 100644 templates/email/text/admin_link.php create mode 100644 templates/email/text/default.php create mode 100644 templates/email/text/recovery.php create mode 100644 templates/layout/ajax.php create mode 100644 templates/layout/default.php create mode 100644 templates/layout/email/html/default.php create mode 100644 templates/layout/email/text/default.php create mode 100644 templates/layout/error.php create mode 100644 templates/layout/present.php create mode 100644 tests/Fixture/.gitkeep create mode 100644 tests/Fixture/PollsFixture.php create mode 100644 tests/Fixture/ResponsesFixture.php create mode 100644 tests/Fixture/SlideOptionsFixture.php create mode 100644 tests/Fixture/SlidesFixture.php create mode 100644 tests/TestCase/ApplicationTest.php create mode 100644 tests/TestCase/Captcha/CaptchaTest.php create mode 100644 tests/TestCase/Controller/AdminControllerTest.php create mode 100644 tests/TestCase/Controller/Component/.gitkeep create mode 100644 tests/TestCase/Controller/HomeControllerTest.php create mode 100644 tests/TestCase/Controller/ParticipateControllerTest.php create mode 100644 tests/TestCase/Model/Behavior/.gitkeep create mode 100644 tests/TestCase/PlenarioTestTrait.php create mode 100644 tests/TestCase/Service/VoteServiceTest.php create mode 100644 tests/TestCase/View/Helper/.gitkeep create mode 100644 tests/bootstrap.php create mode 100644 webroot/.htaccess create mode 100644 webroot/css/normalize.min.css create mode 100644 webroot/css/plenario.css create mode 100644 webroot/favicon.ico create mode 100644 webroot/index.php create mode 100644 webroot/js/.gitkeep create mode 100644 webroot/js/plenario.js diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..87b5178 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,26 @@ +; This file is for unifying the coding style for different editors and IDEs. +; More information at https://editorconfig.org + +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.bat] +end_of_line = crlf + +[*.yml] +indent_size = 2 + +[*.twig] +insert_final_newline = false + +[*.neon] +indent_style = tab + +[Makefile] +indent_style = tab diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ebf0b2 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,36 @@ +# Define the line ending behavior of the different file extensions +# Set default behavior, in case users don't have core.autocrlf set. +* text text=auto eol=lf + +# Declare files that will always have CRLF line endings on checkout. +*.bat eol=crlf + +# Declare files that will always have LF line endings on checkout. +*.pem eol=lf + +# Denote all files that are truly binary and should not be modified. +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.webp binary +*.avif binary +*.ico binary +*.mo binary +*.pdf binary +*.xls binary +*.xlsx binary +*.phar binary +*.woff binary +*.woff2 binary +*.ttc binary +*.ttf binary +*.otf binary +*.eot binary +*.gz binary +*.bz2 binary +*.7z binary +*.zip binary +*.webm binary +*.mp4 binary +*.ogv binary diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..8896d04 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,146 @@ +# CI + Deployment (Gitea Actions, GitHub Actions compatible). +# +# - test: runs on every push to any branch. Its commit status is what the branch +# protection of main requires, so a PR can only be merged once the tests are green. +# - deploy: runs only on push to main (i.e. after a merge), only if the tests are green and +# ONLY if the repository variable DEPLOY_ENABLED is "true" (deactivated by default). +# +# Target: DirectAdmin hosting, app checked out directly into the domain's public_html +# (the root .htaccess/index.php forward every request to webroot/). +# The server pulls the code itself over HTTPS with the job's short-lived token, so no +# deploy key and no stored credentials are needed on the server. +# +# Repository variables (Settings → Actions → Variables): +# DEPLOY_ENABLED "true" to enable deployment (anything else = disabled) +# SSH_HOST e.g. plenario.gnilebein.de +# SSH_PORT optional, default 22 +# SSH_USER e.g. gnilebein.de +# SSH_FINGERPRINT optional but recommended: SHA256 host key fingerprint (ssh-keygen -lf) +# DEPLOY_PATH e.g. /home/gnilebein.de/domains/plenario.gnilebein.de/public_html +# PHP_BIN optional, PHP CLI binary (default: auto-detect, must be >= 8.4) +# COMPOSER_BIN optional, composer command (default: auto-detect, else composer.phar +# is installed once to ~/.local/bin) +# Repository secrets: +# SSH_KEY private deploy key (preferred), or +# SSH_PASSWORD password (fallback) +# +# One-time setup on the server: create config/.env (DEBUG=false, APP_FULL_BASE_URL, +# SECURITY_SALT, mail settings – see config/.env.example). The deploy aborts without it. +name: CI / Deploy + +on: + push: + branches: ['**'] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.5' + extensions: mbstring, intl, pdo_sqlite, sqlite3 + coverage: none + + - name: Install dependencies + run: composer install --no-interaction --prefer-dist --no-progress + + - name: Run tests + run: vendor/bin/phpunit + + - name: Coding standard + run: vendor/bin/phpcs --warning-severity=0 + + deploy: + needs: test + # Deactivated until the repository variable DEPLOY_ENABLED is "true". + if: vars.DEPLOY_ENABLED == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + concurrency: + group: deploy-production + cancel-in-progress: false + steps: + - name: Deploy via SSH + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ vars.SSH_HOST }} + port: ${{ vars.SSH_PORT || 22 }} + username: ${{ vars.SSH_USER }} + key: ${{ secrets.SSH_KEY }} + password: ${{ secrets.SSH_PASSWORD }} + fingerprint: ${{ vars.SSH_FINGERPRINT }} + script_stop: true + script: | + set -eu + DEPLOY_PATH="${{ vars.DEPLOY_PATH }}" + PHP="${{ vars.PHP_BIN }}" + COMPOSER="${{ vars.COMPOSER_BIN }}" + REPO_URL="${{ github.server_url }}/${{ github.repository }}.git" + GIT_AUTH="Authorization: Basic $(printf 'oauth2:%s' '${{ github.token }}' | base64 | tr -d '\n')" + + if [ -z "$DEPLOY_PATH" ] || [ ! -d "$DEPLOY_PATH" ]; then + echo "DEPLOY_PATH is not set or does not exist: '$DEPLOY_PATH'" >&2 + exit 1 + fi + cd "$DEPLOY_PATH" + + # --- PHP --------------------------------------------------------------- + if [ -z "$PHP" ]; then + for candidate in /usr/local/php85/bin/php /usr/local/php84/bin/php /usr/local/bin/php php; do + if command -v "$candidate" >/dev/null 2>&1 \ + && "$candidate" -r 'exit(PHP_VERSION_ID >= 80400 ? 0 : 1);'; then + PHP="$candidate" + break + fi + done + fi + if [ -z "$PHP" ]; then + echo "No PHP >= 8.4 found – set the repository variable PHP_BIN." >&2 + exit 1 + fi + echo "Using PHP: $PHP ($("$PHP" -r 'echo PHP_VERSION;'))" + + # --- Composer (installed once, verified against the official checksum) -- + if [ -z "$COMPOSER" ]; then + if command -v composer >/dev/null 2>&1; then + COMPOSER="$PHP $(command -v composer)" + else + PHAR="$HOME/.local/bin/composer.phar" + if [ ! -f "$PHAR" ]; then + mkdir -p "$HOME/.local/bin" + EXPECTED="$(curl -fsSL https://composer.github.io/installer.sig)" + curl -fsSL https://getcomposer.org/installer -o /tmp/composer-setup.php + ACTUAL="$("$PHP" -r "echo hash_file('sha384', '/tmp/composer-setup.php');")" + if [ "$EXPECTED" != "$ACTUAL" ]; then + rm -f /tmp/composer-setup.php + echo "Composer installer checksum mismatch" >&2 + exit 1 + fi + "$PHP" /tmp/composer-setup.php --quiet --install-dir="$HOME/.local/bin" --filename=composer.phar + rm -f /tmp/composer-setup.php + fi + COMPOSER="$PHP $PHAR" + fi + fi + + # --- Code: first run initialises the checkout, later runs update it ----- + if [ ! -d .git ]; then + git init -q + git remote add origin "$REPO_URL" + fi + git remote set-url origin "$REPO_URL" + git -c "http.extraHeader=$GIT_AUTH" fetch --quiet origin '+refs/heads/main:refs/remotes/origin/main' + git reset --hard origin/main + echo "Deployed commit: $(git rev-parse --short HEAD)" + + if [ ! -f config/.env ]; then + echo "config/.env is missing – create it once on the server (see config/.env.example)." >&2 + exit 1 + fi + + $COMPOSER install --no-dev --optimize-autoloader --no-interaction --no-progress + "$PHP" bin/cake.php migrations migrate + "$PHP" bin/cake.php cache clear_all diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..32c42c1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,90 @@ +# CakePHP specific files # +########################## +/config/app_local.php +/config/.env +/.env +/logs/* +/tmp/* +/vendor/* +/plugins/*/vendor/ +# Plugin-Assets, die per `bin/cake plugin assets symlink|copy` entstehen +/webroot/debug_kit +/webroot/bake +# SQLite-Backups aus der Deploy-Pipeline +/data/backups/ +# Composer +/composer.phar +# Test-/Analyse-Artefakte +/coverage/ +/build/ +/.phpstan/ +/.psalm/ + +# Migrations Lock-Datei (wird zur Laufzeit generiert) +/config/Migrations/schema-dump-default.lock + +# Gecachte Assets (werden on-the-fly generiert) +/webroot/cache_css/* +/webroot/cache_js/* + +# Uploads / User-Dateien (falls genutzt) +/webroot/files/* +/files/* + +# Claude AI +.claude/ +CLAUDE.local.md + +# OS generated files # +###################### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +Icon +ehthumbs.db +Thumbs.db +.directory + +# Tool specific files # +####################### +# PHPUnit +.phpunit.cache +.phpunit.result.cache +tests.sqlite +# vim +*~ +*.swp +*.swo +# sublime text & textmate +*.sublime-* +*.stTheme.cache +*.tmlanguage.cache +*.tmPreferences.cache +# Eclipse +.settings/* +# JetBrains +.idea/* +# NetBeans +nbproject/* +# Visual Studio Code +.vscode +# nova +.nova +# Sass preprocessor +.sass-cache/ +# node +/node_modules/* +# yarn +yarn-debug.log +yarn-error.log + +# PHP CS Fixer +.php_cs.cache +.php-cs-fixer.cache +# Plenario: lokale SQLite-Datenbank und Mail-Dumps +/data/*.sqlite +/data/*.sqlite-journal +/data/*.sqlite-wal +/data/*.sqlite-shm diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..54b08e8 --- /dev/null +++ b/.htaccess @@ -0,0 +1,12 @@ +# Uncomment the following to prevent the httpoxy vulnerability +# See: https://httpoxy.org/ +# +# RequestHeader unset Proxy +# + + + RewriteEngine on + RewriteRule ^(\.well-known/.*)$ $1 [L] + RewriteRule ^$ webroot/ [L] + RewriteRule (.*) webroot/$1 [L] + diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..600c17c --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,159 @@ +# AGENTS.md – Infos für KI-Agents + +Diese Datei ist die zentrale Arbeitsgrundlage für KI-Agents (Claude Code, Codex, Cursor, …). +**Halte sie aktuell**, wenn du Architektur, Konventionen, Routen, Konfiguration oder Befehle änderst. +Lokale, maschinenspezifische Infos gehören in `CLAUDE.local.md` (nicht versioniert). + +## Rolle & Arbeitsweise + +Du arbeitest in diesem Projekt als **Senior PHP-Entwickler** (CakePHP, modernes PHP 8) und +**UI/UX-Experte** (zugängliche, klare, mobile-taugliche Oberflächen). + +- **Idiomatisch:** Nutze die Mittel von CakePHP und PHP so, wie sie gedacht sind (ORM, Finder, + Validatoren, Middleware, Helper, benannte Routen, Konventionen statt Eigenbau). Kein Workaround, + wo das Framework eine Lösung bietet. Im Frontend: semantisches HTML, Vanilla JS, schlankes CSS. +- **Idempotent:** Änderungen, Befehle, Migrationen, Seeds und Deploy-Schritte müssen sich gefahrlos + mehrfach ausführen lassen und dabei dasselbe Ergebnis liefern (z. B. vorher prüfen statt blind + anlegen, keine doppelten Einträge, wiederholte POSTs ohne Nebenwirkungen abfangen). +- **UX zuerst mitdenken:** verständliche deutsche Texte, sinnvolle Fehlermeldungen, Tastatur- und + Screenreader-Bedienbarkeit, ausreichende Kontraste, gute Darstellung auf Smartphone und Beamer. + +## Projekt in einem Satz + +Plenario ist ein Mentimeter-/Claper-ähnliches Live-Umfragetool auf **CakePHP 5.4**: Umfrage per +E-Mail anlegen, kein Login, Verwaltung über einen geheimen Admin-Link, Teilnahme per Code. + +## Befehle + +| Zweck | Befehl | +|---|---| +| Abhängigkeiten | `composer install` | +| Migrationen | `bin/cake migrations migrate` (Windows: `php bin/cake.php migrations migrate`) | +| Dev-Server | `bin/cake server -p 8765` → http://localhost:8765 | +| Tests | `vendor/bin/phpunit` | +| Coding Standard | `vendor/bin/phpcs` / Autofix `vendor/bin/phpcbf` | +| Neue Migration | `bin/cake bake migration NameDerMigration` | + +**Vor jedem Commit:** `vendor/bin/phpunit` und `vendor/bin/phpcs` müssen grün sein +(Warnungen zur Zeilenlänge bei langen deutschen Texten sind ok). + +Zum manuellen Testen im Browser bzw. per HTTP den Cake-Dev-Server nutzen (`bin/cake server`). +Mails landen lokal als `.eml` in `tmp/mails/`; im Debug-Modus zeigt `/created` den Admin-Link direkt an. + +## Architektur + +``` +config/ + app.php Defaults inkl. Block 'Plenario' (Captcha, Throttle, Polling) und Cache 'throttle' + app_local.example.php Vorlage für app_local.php (SQLite, FileTransport) – app_local.php ist gitignored + .env.example Alle Umgebungsvariablen (config/.env wird optional geladen) + routes.php Alle Routen benannt, KEINE Fallback-Routen + Migrations/ Schema (einzige Quelle der Wahrheit, auch für Tests) +src/ + Captcha/ CaptchaInterface + NoCaptcha / MathCaptcha / RecaptchaCaptcha, CaptchaFactory + Controller/ + HomeController Startseite, Anlegen (/create), Bestätigung, Join, Recover + AdminAppController Basis für /admin/{token}: löst Poll über Token-Hash auf (404 sonst), setzt Privacy-Header + AdminController Dashboard, Settings, Present, State-JSON, Control, QR, CSV-Export, Token rotieren, Löschen + SlidesController Folien-CRUD, Sortieren, Antworten zurücksetzen + ParticipateController /p/{code}: Ansicht, State-JSON, Abstimmen; anonymes Cookie plenario_pid + Mailer/ PollMailer (adminLink, recovery), Transport/FileTransport (lokal) + Model/ Polls → Slides → SlideOptions, Slides → Responses + Service/ + VoteService Validiert + speichert Antworten (alle Abstimmungsregeln hier) + ResultsService Aggregiert Ergebnisse je Folientyp (JSON-Struktur im Docblock) + PollStateService State-JSON für Presenter und Teilnehmende + ThrottleService Rate-Limit pro IP (Cache 'throttle') +templates/ Deutsche UI, Layouts: default, present (Vollbild, dunkel), error, email +webroot/css/plenario.css Eigenes CSS, kein Framework +webroot/js/plenario.js Vanilla JS: Polling, Ergebnis-Rendering, Presenter-Steuerung +tests/ PHPUnit; PlenarioTestTrait erzeugt Testdaten, Fixtures sind leer +``` + +### Datenmodell + +- `polls`: `title`, `email`, `admin_token_hash` (sha256), `admin_token_encrypted` (Security::encrypt), + `join_code` (6 Zeichen, ohne 0/O/1/I/L), `current_slide_id`, `is_active`, `show_results_to_participants` +- `slides`: `type` (`choice|wordcloud|open|scale|content`), `question`, `description`, `position`, + `settings` (JSON, je Typ siehe `Slide::DEFAULT_SETTINGS`), `is_voting_open` +- `slide_options`: Antwortoptionen für `choice` +- `responses`: `participant_hash`, `slide_option_id` | `text_value` | `numeric_value`. + Mehrfachauswahl/mehrere Wörter = mehrere Zeilen mit gleichem `participant_hash`. + +### Zentrale Regeln (nicht versehentlich brechen) + +- **Kein Login.** Zugriff auf die Verwaltung = Besitz des Tokens in der URL `/admin/{token}`. + Token nie loggen, nie in JSON ausgeben, nie als Referrer leaken (`Referrer-Policy: no-referrer`). + Lookup immer über `PollsTable::hashToken()` / Finder `byAdminToken`. +- Admin-Aktionen müssen **immer** auf `$this->poll` eingeschränkt sein (z. B. `SlidesController::loadSlide()` + prüft `poll_id`). Neue Admin-Controller von `AdminAppController` ableiten. +- `SECURITY_SALT` verschlüsselt Admin-Tokens und hasht Teilnehmer-IDs → darf in Produktion nicht geändert werden. +- Teilnehmende sind anonym: nur `VoteService::participantHash()` (HMAC, pro Poll) speichern. +- Abgestimmt werden darf nur auf der **aktuellen** Folie (`polls.current_slide_id`), bei offener Abstimmung, + aktivem Poll und einmal pro Teilnehmer. Diese Logik gehört in `VoteService`, nicht in Controller. +- Ausnahme Wortwolke: Begriffe werden einzeln abgegeben (AJAX, `vote` liefert dann JSON `{ok, message, state}`), + jeder Begriff einmal pro Person, max. `max_words` (0 = unbegrenzt). Einen vorhandenen Begriff erneut nennen + bzw. in der Wolke anklicken = Upvote (gleiche Zeile in `responses`). Mit `allow_upvotes` sehen Teilnehmende + die Wolke live (auch ohne `show_results_to_participants`); Vorschläge inkl. Kölner Phonetik in `plenario.js` (`Words`). + Downvotes (`vote=down`, Setting `allow_downvotes`, nur zusammen mit Upvotes): Zeile mit `numeric_value = VoteService::DOWNVOTE` (-1), + nur auf fremde, vorhandene Begriffe, ein Rating pro Begriff und Person, zählen nicht zu `max_words`. + Wortgröße richtet sich nur nach den Upvotes (`count`), Downvotes stehen separat in `down`. +- `Poll`/`Response` haben `_hidden` für sensible Felder; mass assignment über `_accessible` restriktiv halten. +- Alle POST-Formulare laufen über CSRF (`CsrfProtectionMiddleware`). JS sendet `X-CSRF-Token` aus ``. +- Ausgaben in Templates immer mit `h()` escapen. JS baut DOM mit `textContent`, nie `innerHTML` mit Nutzerdaten. +- Routen nur benannt verwenden (`['_name' => 'admin', 'token' => $adminToken]`), keine Fallbacks einführen. + +### Neuen Folientyp hinzufügen (Checkliste) + +1. Konstante + Label + Beschreibung + `DEFAULT_SETTINGS` in `src/Model/Entity/Slide.php` +2. Settings-Sanitizing in `SlidesTable::sanitizeSettings()` +3. Validierung/Speicherung in `VoteService::submit()` (eigene `…Rows()`-Methode) +4. Aggregation in `ResultsService::forSlide()` + Docblock der JSON-Struktur +5. Formularfelder in `templates/Slides/form.php`, Eingabe in `templates/Participate/view.php` +6. Renderer in `webroot/js/plenario.js` (`Results.`), Styles in `plenario.css`, Badge-Farbe +7. Tests in `tests/TestCase/Service/VoteServiceTest.php` + +### Live-Updates + +Kein WebSocket: Presenter (`/admin/{token}/state`) und Teilnehmende (`/p/{code}/state`) pollen per `fetch` +(`Plenario.pollIntervalMs`). Die Teilnehmerseite lädt neu, wenn sich `version` im State ändert. + +## Konventionen + +- Sprache der UI: **Deutsch**, Texte über `__()`. Code, Kommentare, Bezeichner: Englisch. +- PHP: `declare(strict_types=1);`, CakePHP Coding Standard (`phpcs.xml`), typisierte Properties statt dynamischer. +- Tables über `fetchTable()` holen und in typisierte Properties legen. +- Einrückung 4 Spaces, LF (siehe `.editorconfig`). +- Keine neuen Frontend-Abhängigkeiten / kein Build-Schritt ohne Rücksprache. +- Schemaänderungen nur per neuer Migration, nie bestehende Migration ändern (sobald deployed). +- Commits klein und thematisch; Commit-Messages auf Englisch im Imperativ. +- **`main` ist geschützt:** nie direkt auf `main` committen oder pushen. Jede Änderung auf einem + eigenen Branch (z. B. `feature/…`, `fix/…`, `docs/…`), pushen und per Pull Request in Gitea mergen. + Merge erst, wenn der Status-Check `test` grün ist. Kein Force-Push auf `main`. + +## Deployment + +Deploy erfolgt über Git (Remote: Gitea) mit `.gitea/workflows/ci.yml`: + +- Job `test` (PHPUnit + phpcs) läuft bei jedem Push auf jeden Branch. `main` ist per Branch-Schutz + in Gitea gesperrt: kein direkter Push, Merge nur per PR und nur mit grünem Status-Check des Jobs `test`. +- Job `deploy` läuft nur bei Push auf `main`, nur bei grünen Tests und **nur wenn die Repo-Variable + `DEPLOY_ENABLED=true` gesetzt ist** (standardmäßig deaktiviert). Er verbindet sich per SSH + (DirectAdmin, `plenario.gnilebein.de`, Checkout direkt in `public_html`), holt den Code per HTTPS mit + dem kurzlebigen Job-Token (kein Deploy-Key auf dem Server), macht `git reset --hard origin/main`, + bricht ab, wenn `config/.env` fehlt, dann `composer install --no-dev`, `migrations migrate`, `cache clear_all`. PHP und Composer werden + automatisch erkannt (überschreibbar über `PHP_BIN`/`COMPOSER_BIN`). +- Benötigte Variablen/Secrets sind im Kopf der Workflow-Datei dokumentiert. Zugangsdaten nur als + Gitea-Secret, nie ins Repo. + +Produktiv auf dem Server in `config/.env`: `DEBUG=false`, `APP_FULL_BASE_URL`, `SECURITY_SALT`, SMTP. +Ohne `DEBUG=false` steht die per Composer erzeugte `app_local.php` auf debug=true und zeigt Admin-Links direkt an. +Document-Root zeigt idealerweise auf `webroot/`; liegt die App direkt im Document-Root (z. B. `public_html`), +leiten `.htaccess` + `index.php` im Projektroot alles nach `webroot/` weiter. + +## Bekannte Grenzen / Ideen + +- Doppelte Stimmen sind möglich, wenn Teilnehmende Cookies löschen (bewusst: keine Accounts, kein IP-Tracking). +- Polling skaliert für typische Meetings; für sehr große Events wären Server-Sent Events/WebSockets sinnvoll. +- Mögliche Erweiterungen: Q&A mit Upvotes, Quiz mit richtigen Antworten/Punkten, Bilder auf Folien, + Umfrage duplizieren, mehrsprachige UI (Übersetzungen unter `resources/locales`). diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..c8ce82e --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,8 @@ +# CLAUDE.md + +Alle Projektinfos für Agents stehen in **AGENTS.md** – bitte dort lesen und dort pflegen: + +@AGENTS.md + +Maschinenspezifische Hinweise (lokale PHP-Version, Pfade, Shell) stehen in `CLAUDE.local.md` +(gitignored). Wenn du lokal etwas Neues über die Umgebung lernst, ergänze es dort. diff --git a/README.md b/README.md new file mode 100644 index 0000000..b5a64f7 --- /dev/null +++ b/README.md @@ -0,0 +1,79 @@ +# Plenario + +Live-Umfragen für Vorträge, Workshops und Meetings – ähnlich wie Mentimeter oder Claper, +aber **ohne Login**: Wer eine Umfrage anlegt, bekommt einen geheimen Admin-Link per E-Mail. + +Basiert auf **CakePHP 5.4** (PHP ≥ 8.2), läuft lokal mit **SQLite**, ohne Build-Schritt fürs Frontend. + +## Funktionen + +- Umfrage anlegen mit Titel + E-Mail-Adresse, Admin-Link kommt per Mail +- Optionales Captcha: keins, einfache Rechenaufgabe oder Google reCAPTCHA v2 +- Folientypen: **Multiple Choice** (Einfach-/Mehrfachauswahl), **Wortwolke**, **Offene Frage**, **Skala**, **Inhaltsfolie** +- Präsentationsmodus (Vollbild, Tastatursteuerung, QR-Code, Live-Ergebnisse) +- Teilnahme über 6-stelligen Code oder QR-Code, anonym (Cookie), eine Antwort pro Person und Folie +- Ergebnisse optional auch für Teilnehmende sichtbar +- CSV-Export, Antworten zurücksetzen, Folien sortieren +- „Admin-Link verloren?“ – schickt alle Links zu einer Adresse erneut +- Admin-Link neu erzeugen (alter Link wird ungültig), Umfrage löschen +- Rate-Limit für Anlegen und Wiederherstellen pro IP + +## Lokal starten + +```bash +composer install # legt config/app_local.php an (SQLite, Mails als Datei) +bin/cake migrations migrate # erstellt data/plenario.sqlite +bin/cake server -p 8765 # http://localhost:8765 +``` + +Unter Windows ggf. `php bin/cake.php …` statt `bin/cake …`. + +Lokal werden keine Mails verschickt: Sie landen als `.eml` in `tmp/mails/`. Zusätzlich wird der +Admin-Link im Debug-Modus direkt nach dem Anlegen angezeigt. + +## Tests + +```bash +vendor/bin/phpunit # nutzt tmp/tests.sqlite, Schema kommt aus den Migrationen +vendor/bin/phpcs # CakePHP Coding Standard +``` + +## Konfiguration + +Alle Einstellungen gehen über Umgebungsvariablen oder `config/.env` +(Vorlage: [config/.env.example](config/.env.example)). Wichtig für den Betrieb: + +| Variable | Bedeutung | +|---|---| +| `DEBUG` | `false` in Produktion | +| `APP_FULL_BASE_URL` | Absolute URL, wird für Links in E-Mails gebraucht (Pflicht in Produktion) | +| `SECURITY_SALT` | Langer Zufallswert. **Nicht nachträglich ändern** – damit werden Admin-Tokens verschlüsselt und Teilnehmer-IDs gehasht | +| `DATABASE_URL` | Leer = SQLite in `data/`. Sonst z. B. `mysql://user:pw@host/plenario?encoding=utf8mb4` | +| `EMAIL_TRANSPORT_DEFAULT_URL` | z. B. `smtp://user:pw@mail.example.org:587?tls=true` | +| `MAIL_FROM`, `MAIL_FROM_NAME` | Absender | +| `CAPTCHA_TYPE` | `none`, `math` (Standard) oder `recaptcha` | +| `RECAPTCHA_SITE_KEY`, `RECAPTCHA_SECRET_KEY` | Für reCAPTCHA v2 („Ich bin kein Roboter“) | +| `SHOW_ADMIN_LINK_AFTER_CREATE` | Nur für Entwicklung | +| `THROTTLE_CREATE_PER_HOUR`, `THROTTLE_RECOVER_PER_HOUR` | Rate-Limits pro IP (0 = aus) | +| `POLL_INTERVAL_MS` | Aktualisierungsintervall der Live-Ansichten | + +## Deployment + +1. Code auschecken, `composer install --no-dev --optimize-autoloader` +2. `config/.env` (oder echte Umgebungsvariablen) setzen, mindestens `DEBUG=false`, + `APP_FULL_BASE_URL`, `SECURITY_SALT`, Mail-Transport +3. `bin/cake migrations migrate` +4. Webserver-Document-Root auf `webroot/` zeigen lassen; `tmp/`, `logs/` und `data/` beschreibbar machen + +Live-Updates laufen über kurzes Polling (Standard alle 2 s) – kein WebSocket-Server nötig. +Für sehr große Runden (mehrere hundert Teilnehmende) `POLL_INTERVAL_MS` erhöhen und MySQL/PostgreSQL statt SQLite verwenden. + +## Datenschutz + +- Teilnehmende sind anonym. Gespeichert wird nur ein HMAC der Cookie-ID, pro Umfrage unterschiedlich. +- Die E-Mail-Adresse dient nur dem Versand der Admin-Links. +- In der Datenbank liegt nur der SHA-256-Hash des Admin-Tokens (plus eine mit `SECURITY_SALT` verschlüsselte Kopie für die Wiederherstellungs-Mail). + +## Für KI-Agents + +Siehe [AGENTS.md](AGENTS.md). diff --git a/bin/bash_completion.sh b/bin/bash_completion.sh new file mode 100644 index 0000000..319059e --- /dev/null +++ b/bin/bash_completion.sh @@ -0,0 +1,47 @@ +# +# Bash completion file for CakePHP console. +# Copy this file to a file named `cake` under `/etc/bash_completion.d/`. +# For more info check https://book.cakephp.org/5/en/console-commands/completion.html#how-to-enable-bash-autocompletion-for-the-cakephp-console +# + +_cake() +{ + local cur prev opts cake + COMPREPLY=() + cake="${COMP_WORDS[0]}" + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + if [[ "$cur" == -* ]] ; then + if [[ ${COMP_CWORD} = 1 ]] ; then + opts=$(${cake} completion options) + elif [[ ${COMP_CWORD} = 2 ]] ; then + opts=$(${cake} completion options "${COMP_WORDS[1]}") + else + opts=$(${cake} completion options "${COMP_WORDS[1]}" "${COMP_WORDS[2]}") + fi + + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + + if [[ ${COMP_CWORD} = 1 ]] ; then + opts=$(${cake} completion commands) + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + + if [[ ${COMP_CWORD} = 2 ]] ; then + opts=$(${cake} completion subcommands $prev) + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + if [[ $COMPREPLY = "" ]] ; then + _filedir + return 0 + fi + return 0 + fi + + return 0 +} + +complete -F _cake cake bin/cake diff --git a/bin/cake b/bin/cake new file mode 100644 index 0000000..4b696c8 --- /dev/null +++ b/bin/cake @@ -0,0 +1,75 @@ +#!/usr/bin/env sh +################################################################################ +# +# Cake is a shell script for invoking CakePHP shell commands +# +# CakePHP(tm) : Rapid Development Framework (https://cakephp.org) +# Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) +# +# Licensed under The MIT License +# For full copyright and license information, please see the LICENSE.txt +# Redistributions of files must retain the above copyright notice. +# +# @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) +# @link https://cakephp.org CakePHP(tm) Project +# @since 1.2.0 +# @license https://opensource.org/licenses/mit-license.php MIT License +# +################################################################################ + +# Canonicalize by following every symlink of the given name recursively +canonicalize() { + NAME="$1" + if [ -f "$NAME" ] + then + DIR=$(dirname -- "$NAME") + NAME=$(cd -P "$DIR" > /dev/null && pwd -P)/$(basename -- "$NAME") + fi + while [ -h "$NAME" ]; do + DIR=$(dirname -- "$NAME") + SYM=$(readlink "$NAME") + NAME=$(cd "$DIR" > /dev/null && cd "$(dirname -- "$SYM")" > /dev/null && pwd)/$(basename -- "$SYM") + done + echo "$NAME" +} + +# Find a CLI version of PHP +findCliPhp() { + for TESTEXEC in php php-cli /usr/local/bin/php + do + SAPI=$(echo "" | $TESTEXEC 2>/dev/null) + if [ "$SAPI" = "cli" ] + then + echo $TESTEXEC + return + fi + done + echo "Failed to find a CLI version of PHP; falling back to system standard php executable" >&2 + echo "php"; +} + +# If current path is a symlink, resolve to real path +realname="$0" +if [ -L "$realname" ] +then + realname=$(readlink -f "$0") +fi + +CONSOLE=$(dirname -- "$(canonicalize "$realname")") +APP=$(dirname "$CONSOLE") + +# If your CLI PHP is somewhere that this doesn't find, you can define a PHP environment +# variable with the correct path in it. +if [ -z "$PHP" ] +then + PHP=$(findCliPhp) +fi + +if [ "$(basename "$realname")" != 'cake' ] +then + exec "$PHP" "$CONSOLE"/cake.php "$(basename "$realname")" "$@" +else + exec "$PHP" "$CONSOLE"/cake.php "$@" +fi + +exit diff --git a/bin/cake.bat b/bin/cake.bat new file mode 100644 index 0000000..ad13782 --- /dev/null +++ b/bin/cake.bat @@ -0,0 +1,27 @@ +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: +:: Cake is a Windows batch script for invoking CakePHP shell commands +:: +:: CakePHP(tm) : Rapid Development Framework (https://cakephp.org) +:: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) +:: +:: Licensed under The MIT License +:: Redistributions of files must retain the above copyright notice. +:: +:: @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) +:: @link https://cakephp.org CakePHP(tm) Project +:: @since 2.0.0 +:: @license https://opensource.org/licenses/mit-license.php MIT License +:: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +@echo off + +SET app=%0 +SET lib=%~dp0 + +php "%lib%cake.php" %* + +echo. + +exit /B %ERRORLEVEL% diff --git a/bin/cake.php b/bin/cake.php new file mode 100644 index 0000000..aab8d9f --- /dev/null +++ b/bin/cake.php @@ -0,0 +1,10 @@ +#!/usr/bin/php -q +run($argv)); diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..1e06fb4 --- /dev/null +++ b/composer.json @@ -0,0 +1,58 @@ +{ + "name": "cakephp/app", + "description": "CakePHP skeleton app", + "license": "MIT", + "type": "project", + "homepage": "https://cakephp.org", + "require": { + "php": ">=8.2", + "cakephp/cakephp": "5.4.*", + "cakephp/migrations": "^5.0", + "cakephp/plugin-installer": "^2.0", + "chillerlan/php-qrcode": "^6.0", + "josegonzalez/dotenv": "^4.0", + "mobiledetect/mobiledetectlib": "^4.8.03" + }, + "require-dev": { + "cakephp/bake": "^3.6", + "cakephp/cakephp-codesniffer": "^5.3", + "cakephp/debug_kit": "^5.2", + "phpunit/phpunit": "^11.5.3 || ^12.1.3 || ^13.0" + }, + "suggest": { + "cakephp/repl": "Console tools for a REPL interface for CakePHP applications.", + "dereuromark/cakephp-ide-helper": "After baking your code, this keeps your annotations in sync with the code evolving from there on for maximum IDE and PHPStan/Psalm compatibility.", + "markstory/asset_compress": "An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.", + "phpstan/phpstan": "PHPStan focuses on finding errors in your code without actually running it. It catches whole classes of bugs even before you write tests for the code." + }, + "autoload": { + "psr-4": { + "App\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "App\\Test\\": "tests/", + "Cake\\Test\\": "vendor/cakephp/cakephp/tests/" + } + }, + "config": { + "allow-plugins": { + "cakephp/plugin-installer": true, + "dealerdirect/phpcodesniffer-composer-installer": true + }, + "platform-check": true, + "sort-packages": true + }, + "scripts": { + "post-install-cmd": "App\\Console\\Installer::postInstall", + "post-create-project-cmd": "App\\Console\\Installer::postInstall", + "check": [ + "@test", + "@cs-check" + ], + "cs-check": "phpcs --colors -p", + "cs-fix": "phpcbf --colors -p", + "test": "phpunit --colors=always" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..0c89f90 --- /dev/null +++ b/composer.lock @@ -0,0 +1,6594 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "88c13c87305bce8edbbea435904da107", + "packages": [ + { + "name": "cakephp/cakephp", + "version": "5.4.4", + "source": { + "type": "git", + "url": "https://github.com/cakephp/cakephp.git", + "reference": "47f15a350fff9ac374172a5c675bca6b4146716f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/cakephp/zipball/47f15a350fff9ac374172a5c675bca6b4146716f", + "reference": "47f15a350fff9ac374172a5c675bca6b4146716f", + "shasum": "" + }, + "require": { + "cakephp/chronos": "^3.3", + "composer/ca-bundle": "^1.6", + "ext-intl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "laminas/laminas-diactoros": "^3.8", + "laminas/laminas-httphandlerrunner": "^2.6", + "league/container": "^5.1", + "php": ">=8.2", + "psr/container": "^1.1 || ^2.0", + "psr/http-client": "^1.0.2", + "psr/http-factory": "^1.1", + "psr/http-message": "^1.1 || ^2.0", + "psr/http-server-handler": "^1.0.2", + "psr/http-server-middleware": "^1.0.2", + "psr/link": "^2.0", + "psr/log": "^3.0", + "psr/simple-cache": "^2.0 || ^3.0" + }, + "provide": { + "psr/container-implementation": "^2.0", + "psr/http-client-implementation": "^1.0", + "psr/http-factory-implementation": "^1.0", + "psr/http-server-handler-implementation": "^1.0", + "psr/http-server-middleware-implementation": "^1.0", + "psr/link-implementation": "^2.0", + "psr/log-implementation": "^3.0", + "psr/simple-cache-implementation": "^3.0" + }, + "replace": { + "cakephp/cache": "self.version", + "cakephp/collection": "self.version", + "cakephp/console": "self.version", + "cakephp/container": "self.version", + "cakephp/core": "self.version", + "cakephp/database": "self.version", + "cakephp/datasource": "self.version", + "cakephp/event": "self.version", + "cakephp/form": "self.version", + "cakephp/http": "self.version", + "cakephp/i18n": "self.version", + "cakephp/log": "self.version", + "cakephp/orm": "self.version", + "cakephp/utility": "self.version", + "cakephp/validation": "self.version" + }, + "require-dev": { + "boundwize/structarmed": "^0.19", + "cakephp/cakephp-codesniffer": "^5.3", + "http-interop/http-factory-tests": "^2.0", + "mockery/mockery": "^1.6", + "paragonie/csp-builder": "^2.3 || ^3.0", + "phpunit/phpunit": "^11.5.3 || ^12.1.3 || ^13.0" + }, + "suggest": { + "ext-curl": "To enable more efficient network calls in Http\\Client.", + "ext-openssl": "To use Security::encrypt() or have secure CSRF token generation.", + "paragonie/csp-builder": "CSP builder, to use the CSP Middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-5.next": "5.5.x-dev" + } + }, + "autoload": { + "files": [ + "src/Core/functions.php", + "src/Error/functions.php", + "src/Collection/functions.php", + "src/I18n/functions.php", + "src/ORM/bootstrap.php", + "src/Routing/functions.php", + "src/Utility/bootstrap.php" + ], + "psr-4": { + "Cake\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/cakephp/graphs/contributors" + } + ], + "description": "The CakePHP framework", + "homepage": "https://cakephp.org", + "keywords": [ + "conventions over configuration", + "dry", + "form", + "framework", + "mvc", + "orm", + "psr-7", + "rapid-development", + "validation" + ], + "support": { + "forum": "https://discourse.cakephp.org/", + "issues": "https://github.com/cakephp/cakephp/issues", + "source": "https://github.com/cakephp/cakephp" + }, + "time": "2026-11-01T00:47:56+00:00", + "published-time": "2026-11-01T00:48:07+00:00" + }, + { + "name": "cakephp/chronos", + "version": "3.5.1", + "source": { + "type": "git", + "url": "https://github.com/cakephp/chronos.git", + "reference": "00c16f165a762226d58f9cf88f43e54e41093f84" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/chronos/zipball/00c16f165a762226d58f9cf88f43e54e41093f84", + "reference": "00c16f165a762226d58f9cf88f43e54e41093f84", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/clock": "^1.0" + }, + "provide": { + "psr/clock-implementation": "1.0" + }, + "require-dev": { + "cakephp/cakephp-codesniffer": "^5.0", + "phpunit/phpunit": "^10.5.58 || ^11.5.3 || ^12.1.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Cake\\Chronos\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "http://nesbot.com" + }, + { + "name": "The CakePHP Team", + "homepage": "https://cakephp.org" + } + ], + "description": "A simple API extension for DateTime.", + "homepage": "https://cakephp.org", + "keywords": [ + "date", + "datetime", + "time" + ], + "support": { + "issues": "https://github.com/cakephp/chronos/issues", + "source": "https://github.com/cakephp/chronos" + }, + "time": "2026-09-06T02:30:12+00:00", + "published-time": "2026-09-06T02:34:32+00:00" + }, + { + "name": "cakephp/migrations", + "version": "5.2.6", + "source": { + "type": "git", + "url": "https://github.com/cakephp/migrations.git", + "reference": "56ec71d99c525a01fc5c9ef51d90cc69a70291d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/migrations/zipball/56ec71d99c525a01fc5c9ef51d90cc69a70291d7", + "reference": "56ec71d99c525a01fc5c9ef51d90cc69a70291d7", + "shasum": "" + }, + "require": { + "cakephp/cache": "^5.3.0", + "cakephp/database": "^5.3.2", + "cakephp/orm": "^5.3.0", + "php": ">=8.2" + }, + "require-dev": { + "cakephp/bake": "^3.3", + "cakephp/cakephp": "^5.3.0", + "cakephp/cakephp-codesniffer": "^5.0", + "phpunit/phpunit": "^11.5.3 || ^12.1.3 || ^13.0" + }, + "suggest": { + "cakephp/bake": "If you want to generate migrations.", + "dereuromark/cakephp-ide-helper": "If you want to have IDE suggest/autocomplete when creating migrations." + }, + "type": "cakephp-plugin", + "autoload": { + "psr-4": { + "Migrations\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/migrations/graphs/contributors" + } + ], + "description": "Database Migration plugin for CakePHP", + "homepage": "https://github.com/cakephp/migrations", + "keywords": [ + "cakephp", + "cli", + "migrations" + ], + "support": { + "forum": "https://stackoverflow.com/tags/cakephp", + "irc": "irc://irc.freenode.org/cakephp", + "issues": "https://github.com/cakephp/migrations/issues", + "source": "https://github.com/cakephp/migrations" + }, + "time": "2026-07-29T15:36:11+00:00", + "published-time": "2026-07-29T15:36:54+00:00" + }, + { + "name": "cakephp/plugin-installer", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/cakephp/plugin-installer.git", + "reference": "b50925d28e3301d9108562a899e3f68cc4cc18bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/plugin-installer/zipball/b50925d28e3301d9108562a899e3f68cc4cc18bd", + "reference": "b50925d28e3301d9108562a899e3f68cc4cc18bd", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0", + "php": ">=8.1" + }, + "require-dev": { + "cakephp/cakephp-codesniffer": "^5.0", + "composer/composer": "^2.0", + "phpunit/phpunit": "^10.1.0 || ^11.1.3 || ^12.0 || ^13.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Cake\\Composer\\Plugin" + }, + "autoload": { + "psr-4": { + "Cake\\Composer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "https://cakephp.org" + } + ], + "description": "A composer installer for CakePHP plugins.", + "keywords": [ + "cakephp", + "composer-plugin", + "installer", + "plugin" + ], + "support": { + "issues": "https://github.com/cakephp/plugin-installer/issues", + "source": "https://github.com/cakephp/plugin-installer" + }, + "time": "2026-10-10T14:35:32+00:00", + "published-time": "2026-10-10T14:35:50+00:00" + }, + { + "name": "chillerlan/php-qrcode", + "version": "6.0.1", + "source": { + "type": "git", + "url": "https://github.com/chillerlan/php-qrcode.git", + "reference": "49006e34bd5328f163e80329e7312f34dceea59b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/chillerlan/php-qrcode/zipball/49006e34bd5328f163e80329e7312f34dceea59b", + "reference": "49006e34bd5328f163e80329e7312f34dceea59b", + "shasum": "" + }, + "require": { + "chillerlan/php-settings-container": "^3.2.1", + "ext-mbstring": "*", + "php": "^8.2" + }, + "require-dev": { + "chillerlan/php-authenticator": "^5.3", + "ext-fileinfo": "*", + "intervention/image": "^3.11", + "phan/phan": "^6.0.1", + "phpbench/phpbench": "^1.4", + "phpmd/phpmd": "^2.15", + "phpstan/phpstan": "^2.1.40", + "phpstan/phpstan-deprecation-rules": "^2.0.4", + "phpunit/phpunit": "^11.5", + "setasign/fpdf": "^1.8.6", + "slevomat/coding-standard": "^8.28", + "squizlabs/php_codesniffer": "^4.0" + }, + "suggest": { + "chillerlan/php-authenticator": "Yet another Google authenticator! Also creates URIs for mobile apps.", + "intervention/image": "More advanced GD and ImageMagick output.", + "setasign/fpdf": "Required to use the QR FPDF output.", + "simple-icons/simple-icons": "SVG icons that you can use to embed as logos in the QR Code" + }, + "type": "library", + "autoload": { + "psr-4": { + "chillerlan\\QRCode\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT", + "Apache-2.0" + ], + "authors": [ + { + "name": "Kazuhiko Arase", + "homepage": "https://github.com/kazuhikoarase/qrcode-generator" + }, + { + "name": "ZXing Authors", + "homepage": "https://github.com/zxing/zxing" + }, + { + "name": "Ashot Khanamiryan", + "homepage": "https://github.com/khanamiryan/php-qrcode-detector-decoder" + }, + { + "name": "Smiley", + "email": "smiley@chillerlan.net", + "homepage": "https://github.com/codemasher" + }, + { + "name": "Contributors", + "homepage": "https://github.com/chillerlan/php-qrcode/graphs/contributors" + } + ], + "description": "A QR Code generator and reader with a user-friendly API. PHP 8.2+", + "homepage": "https://github.com/chillerlan/php-qrcode", + "keywords": [ + "phpqrcode", + "qr", + "qr code", + "qr-reader", + "qrcode", + "qrcode-generator", + "qrcode-reader" + ], + "support": { + "docs": "https://php-qrcode.readthedocs.io", + "issues": "https://github.com/chillerlan/php-qrcode/issues", + "source": "https://github.com/chillerlan/php-qrcode" + }, + "funding": [ + { + "url": "https://ko-fi.com/codemasher", + "type": "Ko-Fi" + } + ], + "time": "2026-03-18T21:21:07+00:00", + "published-time": "2026-03-30T15:49:24+00:00" + }, + { + "name": "chillerlan/php-settings-container", + "version": "3.3.0", + "source": { + "type": "git", + "url": "https://github.com/chillerlan/php-settings-container.git", + "reference": "a0a487cbf5344f721eb504bf0f59bada40c381b7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/a0a487cbf5344f721eb504bf0f59bada40c381b7", + "reference": "a0a487cbf5344f721eb504bf0f59bada40c381b7", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^8.1" + }, + "require-dev": { + "phan/phan": "^5.5.2", + "phpmd/phpmd": "^2.15", + "phpstan/phpstan": "^2.1.31", + "phpstan/phpstan-deprecation-rules": "^2.0.3", + "phpunit/phpunit": "^10.5", + "slevomat/coding-standard": "^8.22", + "squizlabs/php_codesniffer": "^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "chillerlan\\Settings\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Smiley", + "email": "smiley@chillerlan.net", + "homepage": "https://github.com/codemasher" + } + ], + "description": "A container class for immutable settings objects. Not a DI container.", + "homepage": "https://github.com/chillerlan/php-settings-container", + "keywords": [ + "Settings", + "configuration", + "container", + "helper", + "property hook" + ], + "support": { + "issues": "https://github.com/chillerlan/php-settings-container/issues", + "source": "https://github.com/chillerlan/php-settings-container" + }, + "funding": [ + { + "url": "https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4", + "type": "custom" + }, + { + "url": "https://ko-fi.com/codemasher", + "type": "ko_fi" + } + ], + "time": "2026-03-20T21:10:52+00:00", + "published-time": "2026-03-20T21:26:09+00:00" + }, + { + "name": "composer/ca-bundle", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/composer/ca-bundle.git", + "reference": "0c64479fae6952ba4cf021a72c0ac530394c91d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/0c64479fae6952ba4cf021a72c0ac530394c91d4", + "reference": "0c64479fae6952ba4cf021a72c0ac530394c91d4", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "ext-pcre": "*", + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^8 || ^9", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "symfony/process": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\CaBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", + "keywords": [ + "cabundle", + "cacert", + "certificate", + "ssl", + "tls" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/ca-bundle/issues", + "source": "https://github.com/composer/ca-bundle/tree/1.6.1" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + } + ], + "time": "2026-10-29T14:10:42+00:00", + "published-time": "2026-10-29T14:45:12+00:00" + }, + { + "name": "josegonzalez/dotenv", + "version": "4.0.0", + "source": { + "type": "git", + "url": "https://github.com/josegonzalez/php-dotenv.git", + "reference": "e97dbd3db53508dcd536e73ec787a7f11458d41d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/josegonzalez/php-dotenv/zipball/e97dbd3db53508dcd536e73ec787a7f11458d41d", + "reference": "e97dbd3db53508dcd536e73ec787a7f11458d41d", + "shasum": "" + }, + "require": { + "m1/env": "2.*", + "php": ">=5.5.0" + }, + "require-dev": { + "php-coveralls/php-coveralls": "~2.0", + "php-mock/php-mock-phpunit": "~1.1||~2.0", + "squizlabs/php_codesniffer": "~2.9||~3.7" + }, + "type": "library", + "autoload": { + "psr-0": { + "josegonzalez\\Dotenv": [ + "src", + "tests" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jose Diaz-Gonzalez", + "email": "dotenv@josegonzalez.com", + "homepage": "http://josediazgonzalez.com", + "role": "Maintainer" + } + ], + "description": "dotenv file parsing for PHP", + "homepage": "https://github.com/josegonzalez/php-dotenv", + "keywords": [ + "configuration", + "dotenv", + "php" + ], + "support": { + "issues": "https://github.com/josegonzalez/php-dotenv/issues", + "source": "https://github.com/josegonzalez/php-dotenv/tree/4.0.0" + }, + "time": "2023-05-29T22:49:26+00:00", + "published-time": "2023-05-29T22:50:40+00:00" + }, + { + "name": "laminas/laminas-diactoros", + "version": "3.10.0", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-diactoros.git", + "reference": "5939fbc03e9043e5d27050ed584de263b869c57f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/5939fbc03e9043e5d27050ed584de263b869c57f", + "reference": "5939fbc03e9043e5d27050ed584de263b869c57f", + "shasum": "" + }, + "require": { + "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "psr/http-factory": "^1.1", + "psr/http-message": "^1.1 || ^2.0" + }, + "conflict": { + "amphp/amp": "<2.6.4" + }, + "provide": { + "psr/http-factory-implementation": "^1.0", + "psr/http-message-implementation": "^1.1 || ^2.0" + }, + "require-dev": { + "boundwize/structarmed": "^0.17.7", + "ext-curl": "*", + "ext-dom": "*", + "ext-gd": "*", + "ext-libxml": "*", + "http-interop/http-factory-tests": "^2.2.0", + "laminas/laminas-coding-standard": "~3.1.0", + "php-http/psr7-integration-tests": "^1.4.0", + "phpunit/phpunit": "^10.5.36", + "psalm/plugin-phpunit": "^0.19.5", + "vimeo/psalm": "^6.13" + }, + "type": "library", + "extra": { + "laminas": { + "module": "Laminas\\Diactoros", + "config-provider": "Laminas\\Diactoros\\ConfigProvider" + } + }, + "autoload": { + "files": [ + "src/functions/create_uploaded_file.php", + "src/functions/marshal_headers_from_sapi.php", + "src/functions/marshal_method_from_sapi.php", + "src/functions/marshal_protocol_version_from_sapi.php", + "src/functions/normalize_server.php", + "src/functions/normalize_uploaded_files.php", + "src/functions/parse_cookie_header.php" + ], + "psr-4": { + "Laminas\\Diactoros\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "PSR HTTP Message implementations", + "homepage": "https://laminas.dev", + "keywords": [ + "http", + "laminas", + "psr", + "psr-17", + "psr-7" + ], + "support": { + "chat": "https://laminas.dev/chat", + "docs": "https://docs.laminas.dev/laminas-diactoros/", + "forum": "https://discourse.laminas.dev", + "issues": "https://github.com/laminas/laminas-diactoros/issues", + "rss": "https://github.com/laminas/laminas-diactoros/releases.atom", + "source": "https://github.com/laminas/laminas-diactoros" + }, + "funding": [ + { + "url": "https://crowdfunding.linuxfoundation.org/initiatives/laminas-project", + "type": "custom" + } + ], + "time": "2026-11-04T10:34:30+00:00", + "published-time": "2026-11-04T10:56:11+00:00" + }, + { + "name": "laminas/laminas-httphandlerrunner", + "version": "2.14.0", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-httphandlerrunner.git", + "reference": "14d5182a4ba180c998dfbba9d19f9a70337c02b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-httphandlerrunner/zipball/14d5182a4ba180c998dfbba9d19f9a70337c02b4", + "reference": "14d5182a4ba180c998dfbba9d19f9a70337c02b4", + "shasum": "" + }, + "require": { + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", + "psr/http-message": "^1.0 || ^2.0", + "psr/http-message-implementation": "^1.0 || ^2.0", + "psr/http-server-handler": "^1.0" + }, + "require-dev": { + "laminas/laminas-coding-standard": "~3.1.0", + "laminas/laminas-diactoros": "^3.6.0", + "phpunit/phpunit": "^10.5.46", + "psalm/plugin-phpunit": "^0.19.5", + "vimeo/psalm": "^6.10.3" + }, + "type": "library", + "extra": { + "laminas": { + "config-provider": "Laminas\\HttpHandlerRunner\\ConfigProvider" + } + }, + "autoload": { + "psr-4": { + "Laminas\\HttpHandlerRunner\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Execute PSR-15 RequestHandlerInterface instances and emit responses they generate.", + "homepage": "https://laminas.dev", + "keywords": [ + "components", + "laminas", + "mezzio", + "psr-15", + "psr-7" + ], + "support": { + "chat": "https://laminas.dev/chat", + "docs": "https://docs.laminas.dev/laminas-httphandlerrunner/", + "forum": "https://discourse.laminas.dev", + "issues": "https://github.com/laminas/laminas-httphandlerrunner/issues", + "rss": "https://github.com/laminas/laminas-httphandlerrunner/releases.atom", + "source": "https://github.com/laminas/laminas-httphandlerrunner" + }, + "funding": [ + { + "url": "https://crowdfunding.linuxfoundation.org/initiatives/laminas-project", + "type": "custom" + } + ], + "time": "2026-09-21T10:14:52+00:00", + "published-time": "2026-09-21T10:15:58+00:00" + }, + { + "name": "league/container", + "version": "5.2.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/container.git", + "reference": "58accbc032f0090a9bd08326f93062c5a658b2c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/container/zipball/58accbc032f0090a9bd08326f93062c5a658b2c5", + "reference": "58accbc032f0090a9bd08326f93062c5a658b2c5", + "shasum": "" + }, + "require": { + "php": "^8.1", + "psr/container": "^2.0.2", + "psr/event-dispatcher": "^1.0" + }, + "provide": { + "psr/container-implementation": "^1.0" + }, + "replace": { + "orno/di": "~2.0" + }, + "require-dev": { + "nette/php-generator": "^4.1", + "nikic/php-parser": "^5.0", + "phpstan/phpstan": "^2.1.11", + "phpunit/phpunit": "^10.5.45|^11.5.15|^12.0", + "roave/security-advisories": "dev-latest", + "scrutinizer/ocular": "^1.9", + "squizlabs/php_codesniffer": "^3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev", + "dev-2.x": "2.x-dev", + "dev-3.x": "3.x-dev", + "dev-4.x": "4.x-dev", + "dev-5.x": "5.x-dev", + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Container\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Phil Bennett", + "email": "mail@philbennett.co.uk", + "role": "Developer" + } + ], + "description": "A fast and intuitive dependency injection container.", + "homepage": "https://github.com/thephpleague/container", + "keywords": [ + "container", + "dependency", + "di", + "injection", + "league", + "provider", + "service" + ], + "support": { + "issues": "https://github.com/thephpleague/container/issues", + "source": "https://github.com/thephpleague/container/tree/5.2.0" + }, + "funding": [ + { + "url": "https://github.com/philipobenito", + "type": "github" + } + ], + "time": "2026-03-19T18:52:39+00:00", + "published-time": "2026-03-19T18:53:16+00:00" + }, + { + "name": "m1/env", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/m1/Env.git", + "reference": "5c296e3e13450a207e12b343f3af1d7ab569f6f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/m1/Env/zipball/5c296e3e13450a207e12b343f3af1d7ab569f6f3", + "reference": "5c296e3e13450a207e12b343f3af1d7ab569f6f3", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "scrutinizer/ocular": "~1.1", + "squizlabs/php_codesniffer": "^2.3" + }, + "suggest": { + "josegonzalez/dotenv": "For loading of .env", + "m1/vars": "For loading of configs" + }, + "type": "library", + "autoload": { + "psr-4": { + "M1\\Env\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Miles Croxford", + "email": "hello@milescroxford.com", + "homepage": "http://milescroxford.com", + "role": "Developer" + } + ], + "description": "Env is a lightweight library bringing .env file parser compatibility to PHP. In short - it enables you to read .env files with PHP.", + "homepage": "https://github.com/m1/Env", + "keywords": [ + ".env", + "config", + "dotenv", + "env", + "loader", + "m1", + "parser", + "support" + ], + "support": { + "issues": "https://github.com/m1/Env/issues", + "source": "https://github.com/m1/Env/tree/2.2.0" + }, + "time": "2020-02-19T09:02:13+00:00", + "published-time": "2020-02-20T19:46:58+00:00" + }, + { + "name": "mobiledetect/mobiledetectlib", + "version": "4.11.0", + "source": { + "type": "git", + "url": "https://github.com/serbanghita/Mobile-Detect.git", + "reference": "ab39168b7556f44c11c80be1222b44b239f5c2e4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/ab39168b7556f44c11c80be1222b44b239f5c2e4", + "reference": "ab39168b7556f44c11c80be1222b44b239f5c2e4", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "psr/simple-cache": "^1.0 || ^2.0 || ^3.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "3.95.1", + "phpbench/phpbench": "1.6.1", + "phpstan/phpstan": "2.1.47", + "phpunit/phpunit": "9.6.34", + "squizlabs/php_codesniffer": "3.13.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Detection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Serban Ghita", + "email": "serbanghita@gmail.com", + "homepage": "http://mobiledetect.net", + "role": "Developer" + } + ], + "description": "Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.", + "homepage": "https://github.com/serbanghita/Mobile-Detect", + "keywords": [ + "detect mobile devices", + "mobile", + "mobile detect", + "mobile detector", + "php mobile detect" + ], + "support": { + "issues": "https://github.com/serbanghita/Mobile-Detect/issues", + "source": "https://github.com/serbanghita/Mobile-Detect/tree/4.11.0" + }, + "funding": [ + { + "url": "https://github.com/serbanghita", + "type": "github" + } + ], + "time": "2026-05-24T12:32:40+00:00", + "published-time": "2026-05-24T12:33:27+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00", + "published-time": "2022-11-25T14:59:22+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00", + "published-time": "2021-11-05T16:53:27+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00", + "published-time": "2019-03-25T15:31:44+00:00" + }, + { + "name": "psr/http-client", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "time": "2023-09-23T14:17:50+00:00", + "published-time": "2023-09-23T14:18:12+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory" + }, + "time": "2024-04-15T12:06:14+00:00", + "published-time": "2024-05-10T07:32:19+00:00" + }, + { + "name": "psr/http-message", + "version": "2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/2.0" + }, + "time": "2023-04-04T09:54:51+00:00", + "published-time": "2023-04-04T09:55:35+00:00" + }, + { + "name": "psr/http-server-handler", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-server-handler.git", + "reference": "84c4fb66179be4caaf8e97bd239203245302e7d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-server-handler/zipball/84c4fb66179be4caaf8e97bd239203245302e7d4", + "reference": "84c4fb66179be4caaf8e97bd239203245302e7d4", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Server\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP server-side request handler", + "keywords": [ + "handler", + "http", + "http-interop", + "psr", + "psr-15", + "psr-7", + "request", + "response", + "server" + ], + "support": { + "source": "https://github.com/php-fig/http-server-handler/tree/1.0.2" + }, + "time": "2023-04-10T20:06:20+00:00", + "published-time": "2023-04-10T20:07:30+00:00" + }, + { + "name": "psr/http-server-middleware", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-server-middleware.git", + "reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-server-middleware/zipball/c1481f747daaa6a0782775cd6a8c26a1bf4a3829", + "reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "psr/http-message": "^1.0 || ^2.0", + "psr/http-server-handler": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Server\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP server-side middleware", + "keywords": [ + "http", + "http-interop", + "middleware", + "psr", + "psr-15", + "psr-7", + "request", + "response" + ], + "support": { + "issues": "https://github.com/php-fig/http-server-middleware/issues", + "source": "https://github.com/php-fig/http-server-middleware/tree/1.0.2" + }, + "time": "2023-04-11T06:14:47+00:00", + "published-time": "2023-04-11T06:15:22+00:00" + }, + { + "name": "psr/link", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/link.git", + "reference": "84b159194ecfd7eaa472280213976e96415433f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/link/zipball/84b159194ecfd7eaa472280213976e96415433f7", + "reference": "84b159194ecfd7eaa472280213976e96415433f7", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "suggest": { + "fig/link-util": "Provides some useful PSR-13 utilities" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Link\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for HTTP links", + "homepage": "https://github.com/php-fig/link", + "keywords": [ + "http", + "http-link", + "link", + "psr", + "psr-13", + "rest" + ], + "support": { + "source": "https://github.com/php-fig/link/tree/2.0.1" + }, + "time": "2021-03-11T23:00:27+00:00", + "published-time": "2021-03-11T23:05:05+00:00" + }, + { + "name": "psr/log", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.2" + }, + "time": "2024-09-11T13:17:53+00:00", + "published-time": "2024-09-11T13:21:14+00:00" + }, + { + "name": "psr/simple-cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865", + "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "support": { + "source": "https://github.com/php-fig/simple-cache/tree/3.0.0" + }, + "time": "2021-10-29T13:26:27+00:00", + "published-time": "2021-10-29T13:27:19+00:00" + } + ], + "packages-dev": [ + { + "name": "brick/varexporter", + "version": "0.7.0", + "source": { + "type": "git", + "url": "https://github.com/brick/varexporter.git", + "reference": "b3a50b8f630a9ed5015ea3e1f00479af261ed80d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/brick/varexporter/zipball/b3a50b8f630a9ed5015ea3e1f00479af261ed80d", + "reference": "b3a50b8f630a9ed5015ea3e1f00479af261ed80d", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^5.0", + "php": "^8.2" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.2", + "phpunit/phpunit": "^11.0", + "vimeo/psalm": "6.14.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Brick\\VarExporter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A powerful alternative to var_export(), which can export closures and objects without __set_state()", + "keywords": [ + "var_export" + ], + "support": { + "issues": "https://github.com/brick/varexporter/issues", + "source": "https://github.com/brick/varexporter/tree/0.7.0" + }, + "funding": [ + { + "url": "https://github.com/BenMorel", + "type": "github" + } + ], + "time": "2026-01-06T22:56:00+00:00", + "published-time": "2026-01-06T22:57:30+00:00" + }, + { + "name": "cakephp/bake", + "version": "3.8.1", + "source": { + "type": "git", + "url": "https://github.com/cakephp/bake.git", + "reference": "f584b015cb40413666bf36d248bae902be2d3ddc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/bake/zipball/f584b015cb40413666bf36d248bae902be2d3ddc", + "reference": "f584b015cb40413666bf36d248bae902be2d3ddc", + "shasum": "" + }, + "require": { + "brick/varexporter": "^0.7.0", + "cakephp/cakephp": "^5.4", + "cakephp/twig-view": "^2.1", + "nikic/php-parser": "^5.0.0", + "php": ">=8.2" + }, + "require-dev": { + "cakephp/cakephp-codesniffer": "^5.0.0", + "cakephp/debug_kit": "^5.0.0", + "phpunit/phpunit": "^11.5.20 || ^12.2.4 || ^13.0" + }, + "type": "cakephp-plugin", + "autoload": { + "psr-4": { + "Bake\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/bake/graphs/contributors" + } + ], + "description": "Bake plugin for CakePHP", + "homepage": "https://github.com/cakephp/bake", + "keywords": [ + "bake", + "cakephp", + "cli", + "dev" + ], + "support": { + "forum": "https://stackoverflow.com/tags/cakephp", + "issues": "https://github.com/cakephp/bake/issues", + "source": "https://github.com/cakephp/bake" + }, + "time": "2026-07-29T15:35:12+00:00", + "published-time": "2026-07-29T15:35:55+00:00" + }, + { + "name": "cakephp/cakephp-codesniffer", + "version": "5.3.2", + "source": { + "type": "git", + "url": "https://github.com/cakephp/cakephp-codesniffer.git", + "reference": "71ed579d4acef3716c8b12631dae92eed2ddae3d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/cakephp-codesniffer/zipball/71ed579d4acef3716c8b12631dae92eed2ddae3d", + "reference": "71ed579d4acef3716c8b12631dae92eed2ddae3d", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.1.2", + "php": ">=8.1", + "phpstan/phpdoc-parser": "^2.1", + "slevomat/coding-standard": "^8.23", + "squizlabs/php_codesniffer": "^4.0.2" + }, + "require-dev": { + "phpunit/phpunit": "^10.5.32 || ^11.3.3" + }, + "type": "phpcodesniffer-standard", + "autoload": { + "psr-4": { + "CakePHP\\": "CakePHP/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/cakephp-codesniffer/graphs/contributors" + } + ], + "description": "CakePHP CodeSniffer Standards", + "homepage": "https://cakephp.org", + "keywords": [ + "codesniffer", + "framework" + ], + "support": { + "forum": "https://stackoverflow.com/tags/cakephp", + "irc": "irc://irc.freenode.org/cakephp", + "issues": "https://github.com/cakephp/cakephp-codesniffer/issues", + "source": "https://github.com/cakephp/cakephp-codesniffer" + }, + "time": "2026-08-14T12:10:49+00:00", + "published-time": "2026-08-21T05:07:30+00:00" + }, + { + "name": "cakephp/debug_kit", + "version": "5.2.4", + "source": { + "type": "git", + "url": "https://github.com/cakephp/debug_kit.git", + "reference": "c21a8c1c27edfe9f1b8ab7acff0e96704f4ab4e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/debug_kit/zipball/c21a8c1c27edfe9f1b8ab7acff0e96704f4ab4e7", + "reference": "c21a8c1c27edfe9f1b8ab7acff0e96704f4ab4e7", + "shasum": "" + }, + "require": { + "cakephp/cakephp": "^5.1", + "composer/composer": "^2.7.7", + "doctrine/sql-formatter": "^1.1.3", + "php": ">=8.1" + }, + "require-dev": { + "cakephp/authorization": "^3.0", + "cakephp/cakephp-codesniffer": "^5.0", + "phpunit/phpunit": "^10.5.32 || ^11.1.3 || ^12.0.9" + }, + "suggest": { + "ext-pdo_sqlite": "DebugKit needs to store panel data in a database. SQLite is simple and easy to use." + }, + "type": "cakephp-plugin", + "autoload": { + "psr-4": { + "DebugKit\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Story", + "homepage": "https://mark-story.com", + "role": "Author" + }, + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/debug_kit/graphs/contributors" + } + ], + "description": "CakePHP Debug Kit", + "homepage": "https://github.com/cakephp/debug_kit", + "keywords": [ + "cakephp", + "debug", + "dev", + "kit" + ], + "support": { + "forum": "https://stackoverflow.com/tags/cakephp", + "irc": "irc://irc.freenode.org/cakephp", + "issues": "https://github.com/cakephp/debug_kit/issues", + "source": "https://github.com/cakephp/debug_kit" + }, + "time": "2026-06-06T03:17:03+00:00", + "published-time": "2026-06-06T03:22:52+00:00" + }, + { + "name": "cakephp/twig-view", + "version": "2.1.2", + "source": { + "type": "git", + "url": "https://github.com/cakephp/twig-view.git", + "reference": "99a59407b138a0efff0ce3896cbf67e71a9c9cd3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/twig-view/zipball/99a59407b138a0efff0ce3896cbf67e71a9c9cd3", + "reference": "99a59407b138a0efff0ce3896cbf67e71a9c9cd3", + "shasum": "" + }, + "require": { + "cakephp/cakephp": "^5.0.0", + "jasny/twig-extensions": "^1.3", + "php": ">=8.1", + "twig/markdown-extra": "^3.0", + "twig/twig": "^3.27.0" + }, + "conflict": { + "wyrihaximus/twig-view": "*" + }, + "require-dev": { + "cakephp/cakephp-codesniffer": "^5.0", + "cakephp/debug_kit": "^5.0", + "michelf/php-markdown": "^1.9", + "mikey179/vfsstream": "^1.6.10", + "phpunit/phpunit": "^11.5.3 | ^12.1.3" + }, + "type": "cakephp-plugin", + "autoload": { + "psr-4": { + "Cake\\TwigView\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/cakephp/graphs/contributors" + } + ], + "description": "Twig powered View for CakePHP", + "keywords": [ + "cakephp", + "template", + "twig", + "view" + ], + "support": { + "forum": "https://stackoverflow.com/tags/cakephp", + "irc": "irc://irc.freenode.org/cakephp", + "issues": "https://github.com/cakephp/twig-view/issues", + "source": "https://github.com/cakephp/twig-view" + }, + "time": "2026-06-20T04:25:53+00:00", + "published-time": "2026-06-20T04:26:36+00:00" + }, + { + "name": "composer/class-map-generator", + "version": "1.9.0", + "source": { + "type": "git", + "url": "https://github.com/composer/class-map-generator.git", + "reference": "5fa48e0e1992ea8a786df3ceca80625c9a643b75" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/class-map-generator/zipball/5fa48e0e1992ea8a786df3ceca80625c9a643b75", + "reference": "5fa48e0e1992ea8a786df3ceca80625c9a643b75", + "shasum": "" + }, + "require": { + "composer/pcre": "^2.1 || ^3.1", + "php": "^7.2 || ^8.0", + "symfony/finder": "^4.4 || ^5.3 || ^6 || ^7 || ^8" + }, + "require-dev": { + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-deprecation-rules": "^1 || ^2", + "phpstan/phpstan-phpunit": "^1 || ^2", + "phpstan/phpstan-strict-rules": "^1.1 || ^2", + "phpunit/phpunit": "^8", + "symfony/filesystem": "^5.4 || ^6 || ^7 || ^8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\ClassMapGenerator\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "Utilities to scan PHP code and generate class maps.", + "keywords": [ + "classmap" + ], + "support": { + "issues": "https://github.com/composer/class-map-generator/issues", + "source": "https://github.com/composer/class-map-generator/tree/1.9.0" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + } + ], + "time": "2026-11-03T10:10:19+00:00", + "published-time": "2026-11-03T10:12:49+00:00" + }, + { + "name": "composer/composer", + "version": "2.11.1", + "source": { + "type": "git", + "url": "https://github.com/composer/composer.git", + "reference": "472b418967419c6124edd91dc6310a3bec091dae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/composer/zipball/472b418967419c6124edd91dc6310a3bec091dae", + "reference": "472b418967419c6124edd91dc6310a3bec091dae", + "shasum": "" + }, + "require": { + "composer/ca-bundle": "^1.6", + "composer/class-map-generator": "^1.8.0", + "composer/metadata-minifier": "^1.0", + "composer/pcre": "^2.3 || ^3.3", + "composer/semver": "^3.3", + "composer/spdx-licenses": "^1.5.7", + "composer/xdebug-handler": "^2.0.2 || ^3.0.3", + "ext-filter": "*", + "ext-hash": "*", + "ext-json": "*", + "justinrainbow/json-schema": "^6.6.3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "react/promise": "^3.3", + "seld/jsonlint": "^1.4", + "seld/phar-utils": "^1.2", + "seld/signal-handler": "^2.0", + "symfony/console": "^5.4.47 || ^6.4.25 || ^7.1.10 || ^8.0", + "symfony/filesystem": "^5.4.45 || ^6.4.24 || ^7.1.10 || ^8.0", + "symfony/finder": "^5.4.45 || ^6.4.24 || ^7.1.10 || ^8.0", + "symfony/polyfill-php73": "^1.24", + "symfony/polyfill-php80": "^1.24", + "symfony/polyfill-php81": "^1.24", + "symfony/polyfill-php84": "^1.30", + "symfony/process": "^5.4.47 || ^6.4.25 || ^7.1.10 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "1.12.33", + "phpstan/phpstan-deprecation-rules": "^1.2.0", + "phpstan/phpstan-phpunit": "^1.4.0", + "phpstan/phpstan-strict-rules": "^1.6.0", + "phpstan/phpstan-symfony": "^1.4.0", + "symfony/phpunit-bridge": "^6.4.25 || ^7.3.3 || ^8.0" + }, + "suggest": { + "ext-curl": "Provides HTTP support (will fallback to PHP streams if missing)", + "ext-openssl": "Enables access to repositories and packages over HTTPS", + "ext-zip": "Allows direct extraction of ZIP archives (unzip/7z binaries will be used instead if available)", + "ext-zlib": "Enables gzip for HTTP requests" + }, + "bin": [ + "bin/composer" + ], + "type": "library", + "extra": { + "phpstan": { + "includes": [ + "phpstan/rules.neon" + ] + }, + "branch-alias": { + "dev-main": "2.11-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\": "src/Composer/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "https://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.", + "homepage": "https://getcomposer.org/", + "keywords": [ + "autoload", + "dependency", + "package" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/composer/issues", + "security": "https://github.com/composer/composer/security/policy", + "source": "https://github.com/composer/composer/tree/2.11.1" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + } + ], + "time": "2026-10-30T13:52:10+00:00", + "published-time": "2026-10-30T14:03:09+00:00" + }, + { + "name": "composer/metadata-minifier", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/composer/metadata-minifier.git", + "reference": "8e86142e3ade750b837d55e55f0cdc786d8da006" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/metadata-minifier/zipball/8e86142e3ade750b837d55e55f0cdc786d8da006", + "reference": "8e86142e3ade750b837d55e55f0cdc786d8da006", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "composer/composer": "^2", + "phpstan/phpstan": "^1", + "symfony/phpunit-bridge": "^4.2 || ^5 || ^6 || ^7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\MetadataMinifier\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Small utility library that handles metadata minification and expansion.", + "keywords": [ + "composer", + "compression" + ], + "support": { + "issues": "https://github.com/composer/metadata-minifier/issues", + "source": "https://github.com/composer/metadata-minifier/tree/1.0.1" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + } + ], + "time": "2026-06-30T11:34:59+00:00", + "published-time": "2026-06-30T11:37:18+00:00" + }, + { + "name": "composer/pcre", + "version": "3.4.0", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "d5a341b3fb61f3001970940afb1d332968a183ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/d5a341b3fb61f3001970940afb1d332968a183ed", + "reference": "d5a341b3fb61f3001970940afb1d332968a183ed", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<2.2.2" + }, + "require-dev": { + "phpstan/phpstan": "^2", + "phpstan/phpstan-deprecation-rules": "^2", + "phpstan/phpstan-strict-rules": "^2", + "phpunit/phpunit": "^9" + }, + "type": "library", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + }, + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.4.0" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + } + ], + "time": "2026-06-07T11:47:49+00:00", + "published-time": "2026-06-11T12:12:37+00:00" + }, + { + "name": "composer/semver", + "version": "3.6.0", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "d92543b7ede9c4ec6b59853cefb061e39866d2cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/d92543b7ede9c4ec6b59853cefb061e39866d2cf", + "reference": "d92543b7ede9c4ec6b59853cefb061e39866d2cf", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Version comparison library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.6.0" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + } + ], + "time": "2026-10-29T09:13:34+00:00", + "published-time": "2026-10-29T09:14:11+00:00" + }, + { + "name": "composer/spdx-licenses", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/composer/spdx-licenses.git", + "reference": "5ecd0cb4177696f9fd48f1605dda81db3dee7889" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/5ecd0cb4177696f9fd48f1605dda81db3dee7889", + "reference": "5ecd0cb4177696f9fd48f1605dda81db3dee7889", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^6.4.25 || ^7.3.3 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Spdx\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "SPDX licenses list and validation library.", + "keywords": [ + "license", + "spdx", + "validator" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/spdx-licenses/issues", + "source": "https://github.com/composer/spdx-licenses/tree/1.6.0" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + } + ], + "time": "2026-04-08T20:18:39+00:00", + "published-time": "2026-04-08T20:19:56+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "3.0.5", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef", + "shasum": "" + }, + "require": { + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-05-06T16:37:16+00:00", + "published-time": "2024-05-06T17:01:42+00:00" + }, + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v1.2.1", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "963f0c67bffde0eac41b56be71ac0e8ba132f0bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/963f0c67bffde0eac41b56be71ac0e8ba132f0bd", + "reference": "963f0c67bffde0eac41b56be71ac0e8ba132f0bd", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.2", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.1.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "^2.2", + "ext-json": "*", + "ext-zip": "*", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpcompatibility/php-compatibility": "^9.0 || ^10.0.0@dev", + "yoast/phpunit-polyfills": "^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "opensource@frenck.dev", + "homepage": "https://frenck.dev", + "role": "Open source developer" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcbf", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "security": "https://github.com/PHPCSStandards/composer-installer/security/policy", + "source": "https://github.com/PHPCSStandards/composer-installer" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2026-05-06T08:26:05+00:00", + "published-time": "2026-05-06T12:56:03+00:00" + }, + { + "name": "doctrine/sql-formatter", + "version": "1.5.4", + "source": { + "type": "git", + "url": "https://github.com/doctrine/sql-formatter.git", + "reference": "9563949f5cd3bd12a17d12fb980528bc141c5806" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/sql-formatter/zipball/9563949f5cd3bd12a17d12fb980528bc141c5806", + "reference": "9563949f5cd3bd12a17d12fb980528bc141c5806", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "doctrine/coding-standard": "^14", + "ergebnis/phpunit-slow-test-detector": "^2.20", + "phpstan/phpstan": "^2.1.31", + "phpunit/phpunit": "^10.5.58" + }, + "bin": [ + "bin/sql-formatter" + ], + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\SqlFormatter\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeremy Dorn", + "email": "jeremy@jeremydorn.com", + "homepage": "https://jeremydorn.com/" + } + ], + "description": "a PHP SQL highlighting library", + "homepage": "https://github.com/doctrine/sql-formatter/", + "keywords": [ + "highlight", + "sql" + ], + "support": { + "issues": "https://github.com/doctrine/sql-formatter/issues", + "source": "https://github.com/doctrine/sql-formatter/tree/1.5.4" + }, + "time": "2026-02-08T16:21:46+00:00", + "published-time": "2026-02-08T16:22:50+00:00" + }, + { + "name": "jasny/twig-extensions", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/jasny/twig-extensions.git", + "reference": "8a5ca5f49317bf421a519556ad2e876820d41e01" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jasny/twig-extensions/zipball/8a5ca5f49317bf421a519556ad2e876820d41e01", + "reference": "8a5ca5f49317bf421a519556ad2e876820d41e01", + "shasum": "" + }, + "require": { + "php": ">=7.4.0", + "twig/twig": "^2.7 | ^3.0" + }, + "require-dev": { + "ext-intl": "*", + "ext-json": "*", + "ext-pcre": "*", + "phpstan/phpstan": "^1.12.0", + "phpunit/phpunit": "^9.6", + "squizlabs/php_codesniffer": "^3.10" + }, + "suggest": { + "ext-intl": "Required for the use of the LocalDate Twig extension", + "ext-pcre": "Required for the use of the PCRE Twig extension" + }, + "type": "library", + "autoload": { + "psr-4": { + "Jasny\\Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Arnold Daniels", + "email": "arnold@jasny.net", + "homepage": "http://www.jasny.net" + } + ], + "description": "A set of useful Twig filters", + "homepage": "http://github.com/jasny/twig-extensions#README", + "keywords": [ + "PCRE", + "array", + "date", + "datetime", + "preg", + "regex", + "templating", + "text", + "time" + ], + "support": { + "issues": "https://github.com/jasny/twig-extensions/issues", + "source": "https://github.com/jasny/twig-extensions" + }, + "time": "2024-09-03T09:04:53+00:00", + "published-time": "2024-09-03T09:05:19+00:00" + }, + { + "name": "justinrainbow/json-schema", + "version": "6.14.0", + "source": { + "type": "git", + "url": "https://github.com/jsonrainbow/json-schema.git", + "reference": "bae415e135dd68260c2d020ba392850231e9b1ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/bae415e135dd68260c2d020ba392850231e9b1ab", + "reference": "bae415e135dd68260c2d020ba392850231e9b1ab", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "ext-json": "*", + "marc-mabe/php-enum": "^4.4", + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "3.3.0", + "json-schema/json-schema-test-suite": "dev-main", + "marc-mabe/php-enum-phpstan": "^2.0", + "phpspec/prophecy": "^1.19", + "phpstan/phpstan": "^1.12", + "phpunit/phpunit": "^8.5" + }, + "bin": [ + "bin/validate-json" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "autoload": { + "psr-4": { + "JsonSchema\\": "src/JsonSchema/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Danny van der Sluijs", + "email": "danny.vandersluijs@icloud.com", + "role": "Maintainer" + } + ], + "description": "A library to validate a json schema.", + "homepage": "https://github.com/jsonrainbow/json-schema", + "keywords": [ + "json", + "schema" + ], + "support": { + "issues": "https://github.com/jsonrainbow/json-schema/issues", + "source": "https://github.com/jsonrainbow/json-schema/tree/6.14.0" + }, + "time": "2026-10-24T08:53:34+00:00", + "published-time": "2026-10-24T08:53:38+00:00" + }, + { + "name": "marc-mabe/php-enum", + "version": "v4.7.2", + "source": { + "type": "git", + "url": "https://github.com/marc-mabe/php-enum.git", + "reference": "bb426fcdd65c60fb3638ef741e8782508fda7eef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/marc-mabe/php-enum/zipball/bb426fcdd65c60fb3638ef741e8782508fda7eef", + "reference": "bb426fcdd65c60fb3638ef741e8782508fda7eef", + "shasum": "" + }, + "require": { + "ext-reflection": "*", + "php": "^7.1 | ^8.0" + }, + "require-dev": { + "phpbench/phpbench": "^0.16.10 || ^1.0.4", + "phpstan/phpstan": "^1.3.1", + "phpunit/phpunit": "^7.5.20 | ^8.5.22 | ^9.5.11", + "vimeo/psalm": "^4.17.0 | ^5.26.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-3.x": "3.2-dev", + "dev-master": "4.7-dev" + } + }, + "autoload": { + "psr-4": { + "MabeEnum\\": "src/" + }, + "classmap": [ + "stubs/Stringable.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Marc Bennewitz", + "email": "dev@mabe.berlin", + "homepage": "https://mabe.berlin/", + "role": "Lead" + } + ], + "description": "Simple and fast implementation of enumerations with native PHP", + "homepage": "https://github.com/marc-mabe/php-enum", + "keywords": [ + "enum", + "enum-map", + "enum-set", + "enumeration", + "enumerator", + "enummap", + "enumset", + "map", + "set", + "type", + "type-hint", + "typehint" + ], + "support": { + "issues": "https://github.com/marc-mabe/php-enum/issues", + "source": "https://github.com/marc-mabe/php-enum/tree/v4.7.2" + }, + "time": "2025-09-14T11:18:39+00:00", + "published-time": "2025-09-14T11:32:17+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.14.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae", + "reference": "8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae", + "shasum": "" + }, + "require": { + "php": "^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3 <3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.14.0" + }, + "funding": [ + { + "url": "https://github.com/mnapoli", + "type": "github" + } + ], + "time": "2026-08-11T10:17:44+00:00", + "published-time": "2026-08-11T10:29:20+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v5.9.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "9e33da9553fe7786f0962b35f4e4ecf01be89def" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9e33da9553fe7786f0962b35f4e4ecf01be89def", + "reference": "9e33da9553fe7786f0962b35f4e4ecf01be89def", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-tokenizer": "*", + "php": ">=7.4" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v5.9.0" + }, + "time": "2026-09-13T18:51:52+00:00", + "published-time": "2026-09-13T18:53:16+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "54750ef60c58e43759730615a392c31c80e23176" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00", + "published-time": "2024-03-03T12:39:44+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00", + "published-time": "2022-02-21T01:04:30+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "2.4.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "af8e840551031d254cfdb3a18a62c3470a309c10" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/af8e840551031d254cfdb3a18a62c3470a309c10", + "reference": "af8e840551031d254cfdb3a18a62c3470a309c10", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "doctrine/annotations": "^2.0", + "nikic/php-parser": "^5.3.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.4.1" + }, + "time": "2026-10-30T19:36:28+00:00", + "published-time": "2026-10-30T19:37:11+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "14.5.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "4063552c678ce3beb4b7f131a5b7354a19ff3e2a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/4063552c678ce3beb4b7f131a5b7354a19ff3e2a", + "reference": "4063552c678ce3beb4b7f131a5b7354a19ff3e2a", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^5.9.0", + "php": ">=8.4", + "phpunit/php-text-template": "^6.0.1", + "sebastian/complexity": "^6.0", + "sebastian/environment": "^9.3.3", + "sebastian/git-state": "^1.1.0", + "sebastian/lines-of-code": "^5.0.2", + "sebastian/version": "^7.0.1" + }, + "require-dev": { + "phpunit/phpunit": "^13.4.5" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "14.5.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/14.5.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/php-code-coverage", + "type": "tidelift" + } + ], + "time": "2026-11-02T11:47:37+00:00", + "published-time": "2026-11-02T11:49:08+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "7.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "9bb4e6c58b62c1e043be995c66abec7c97307aae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/9bb4e6c58b62c1e043be995c66abec7c97307aae", + "reference": "9bb4e6c58b62c1e043be995c66abec7c97307aae", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "require-dev": { + "phpunit/phpunit": "^13.3.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "7.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/7.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/php-file-iterator", + "type": "tidelift" + } + ], + "time": "2026-08-25T14:47:43+00:00", + "published-time": "2026-08-25T14:48:49+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "7.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "42e5c5cae0c65df12d1b1a3ab52bf3f50f244d88" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/42e5c5cae0c65df12d1b1a3ab52bf3f50f244d88", + "reference": "42e5c5cae0c65df12d1b1a3ab52bf3f50f244d88", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^13.0" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "7.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/7.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/php-invoker", + "type": "tidelift" + } + ], + "time": "2026-02-06T04:34:47+00:00", + "published-time": "2026-02-06T04:35:29+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "6.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "97107691cb2b6c743b5e0c44be19e983cb337a02" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/97107691cb2b6c743b5e0c44be19e983cb337a02", + "reference": "97107691cb2b6c743b5e0c44be19e983cb337a02", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "require-dev": { + "phpunit/phpunit": "^13.3.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/6.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/php-text-template", + "type": "tidelift" + } + ], + "time": "2026-10-03T04:54:24+00:00", + "published-time": "2026-10-03T04:54:39+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "9.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "a0e12065831f6ab0d83120dc61513eb8d9a966f6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/a0e12065831f6ab0d83120dc61513eb8d9a966f6", + "reference": "a0e12065831f6ab0d83120dc61513eb8d9a966f6", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "require-dev": { + "phpunit/phpunit": "^13.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "9.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "security": "https://github.com/sebastianbergmann/php-timer/security/policy", + "source": "https://github.com/sebastianbergmann/php-timer/tree/9.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/php-timer", + "type": "tidelift" + } + ], + "time": "2026-02-06T04:37:53+00:00", + "published-time": "2026-02-06T04:38:39+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "13.4.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "4821376960d0e1e5a7b7b700955ebcab33ecd71b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4821376960d0e1e5a7b7b700955ebcab33ecd71b", + "reference": "4821376960d0e1e5a7b7b700955ebcab33ecd71b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-filter": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.14.0", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=8.4.1", + "phpunit/php-code-coverage": "^14.5.0", + "phpunit/php-file-iterator": "^7.0.2", + "phpunit/php-invoker": "^7.0.0", + "phpunit/php-text-template": "^6.0.1", + "phpunit/php-timer": "^9.0.0", + "sebastian/cli-parser": "^5.0.1", + "sebastian/comparator": "^8.4", + "sebastian/diff": "^9.0.1", + "sebastian/environment": "^9.3.3", + "sebastian/exporter": "^8.2.1", + "sebastian/file-filter": "^1.0", + "sebastian/git-state": "^1.1", + "sebastian/global-state": "^9.0.1", + "sebastian/object-enumerator": "^8.1.0", + "sebastian/recursion-context": "^8.0.1", + "sebastian/type": "^7.0.2", + "sebastian/version": "^7.0.1", + "staabm/side-effects-detector": "^1.0.5" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "13.4-dev" + } + }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/13.4.6" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsoring.html", + "type": "other" + } + ], + "time": "2026-11-02T07:12:28+00:00", + "published-time": "2026-11-02T07:13:08+00:00" + }, + { + "name": "react/promise", + "version": "v3.3.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "23444f53a813a3296c1368bb104793ce8d88f04a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/23444f53a813a3296c1368bb104793ce8d88f04a", + "reference": "23444f53a813a3296c1368bb104793ce8d88f04a", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.12.28 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.3.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2025-08-19T18:57:03+00:00", + "published-time": "2025-08-19T19:13:36+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "5.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "eeb759ad3146b7096fb59c3195d39e071cd409e3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/eeb759ad3146b7096fb59c3195d39e071cd409e3", + "reference": "eeb759ad3146b7096fb59c3195d39e071cd409e3", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "require-dev": { + "phpunit/phpunit": "^13.2.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/5.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/cli-parser", + "type": "tidelift" + } + ], + "time": "2026-08-01T04:27:14+00:00", + "published-time": "2026-08-01T04:29:01+00:00" + }, + { + "name": "sebastian/comparator", + "version": "8.4.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "3b070e608146cba00fd6fd1f0ffba89e5a8897fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/3b070e608146cba00fd6fd1f0ffba89e5a8897fb", + "reference": "3b070e608146cba00fd6fd1f0ffba89e5a8897fb", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.4", + "sebastian/diff": "^9.0", + "sebastian/exporter": "^8.2" + }, + "require-dev": { + "phpunit/phpunit": "^13.3" + }, + "suggest": { + "ext-bcmath": "For comparing BcMath\\Number objects" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "8.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/8.4.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/comparator", + "type": "tidelift" + } + ], + "time": "2026-08-07T07:23:13+00:00", + "published-time": "2026-08-07T07:23:29+00:00" + }, + { + "name": "sebastian/complexity", + "version": "6.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "c5651c795c98093480df79350cb050813fc7a2f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/c5651c795c98093480df79350cb050813fc7a2f3", + "reference": "c5651c795c98093480df79350cb050813fc7a2f3", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^5.0", + "php": ">=8.4" + }, + "require-dev": { + "phpunit/phpunit": "^13.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/6.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/complexity", + "type": "tidelift" + } + ], + "time": "2026-02-06T04:41:32+00:00", + "published-time": "2026-02-06T04:41:49+00:00" + }, + { + "name": "sebastian/diff", + "version": "9.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "a2df6626c1baf31d5a88674882a3072f151b5a26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/a2df6626c1baf31d5a88674882a3072f151b5a26", + "reference": "a2df6626c1baf31d5a88674882a3072f151b5a26", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "require-dev": { + "phpunit/phpunit": "^13.3.1", + "symfony/process": "^7.4.17" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "9.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/9.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/diff", + "type": "tidelift" + } + ], + "time": "2026-08-25T15:38:55+00:00", + "published-time": "2026-08-25T15:39:44+00:00" + }, + { + "name": "sebastian/environment", + "version": "9.3.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "d4dd10267a11055066a2a78ae04583d8ddd4f595" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d4dd10267a11055066a2a78ae04583d8ddd4f595", + "reference": "d4dd10267a11055066a2a78ae04583d8ddd4f595", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "require-dev": { + "phpunit/phpunit": "^13.3.6" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "9.3-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "https://github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/9.3.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/environment", + "type": "tidelift" + } + ], + "time": "2026-10-01T12:37:56+00:00", + "published-time": "2026-10-01T12:38:48+00:00" + }, + { + "name": "sebastian/exporter", + "version": "8.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "24a3b69bba4a12ab615fca9d34680c5598d9ab7a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/24a3b69bba4a12ab615fca9d34680c5598d9ab7a", + "reference": "24a3b69bba4a12ab615fca9d34680c5598d9ab7a", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=8.4", + "sebastian/recursion-context": "^8.0.1" + }, + "require-dev": { + "phpunit/phpunit": "^13.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "8.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/8.2.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/exporter", + "type": "tidelift" + } + ], + "time": "2026-08-07T07:22:06+00:00", + "published-time": "2026-08-07T07:23:47+00:00" + }, + { + "name": "sebastian/file-filter", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/file-filter.git", + "reference": "33a26f394330f6faa7684bb9cc73afb7727aae93" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/file-filter/zipball/33a26f394330f6faa7684bb9cc73afb7727aae93", + "reference": "33a26f394330f6faa7684bb9cc73afb7727aae93", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "require-dev": { + "phpunit/phpunit": "^13.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for filtering files", + "homepage": "https://github.com/sebastianbergmann/file-filter", + "support": { + "issues": "https://github.com/sebastianbergmann/file-filter/issues", + "security": "https://github.com/sebastianbergmann/file-filter/security/policy", + "source": "https://github.com/sebastianbergmann/file-filter/tree/1.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/file-filter", + "type": "tidelift" + } + ], + "time": "2026-04-22T07:20:04+00:00", + "published-time": "2026-04-22T07:20:25+00:00" + }, + { + "name": "sebastian/git-state", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/git-state.git", + "reference": "31a565f463686f0eefa85f899549256bf5805985" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/git-state/zipball/31a565f463686f0eefa85f899549256bf5805985", + "reference": "31a565f463686f0eefa85f899549256bf5805985", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "require-dev": { + "phpunit/phpunit": "^13.4.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for describing the state of a Git checkout", + "homepage": "https://github.com/sebastianbergmann/git-state", + "support": { + "issues": "https://github.com/sebastianbergmann/git-state/issues", + "security": "https://github.com/sebastianbergmann/git-state/security/policy", + "source": "https://github.com/sebastianbergmann/git-state/tree/1.1.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/git-state", + "type": "tidelift" + } + ], + "time": "2026-10-21T05:59:52+00:00", + "published-time": "2026-10-21T06:01:28+00:00" + }, + { + "name": "sebastian/global-state", + "version": "9.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "ba68ba79da690cf7eddefd3ce5b78b20b9ba9945" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/ba68ba79da690cf7eddefd3ce5b78b20b9ba9945", + "reference": "ba68ba79da690cf7eddefd3ce5b78b20b9ba9945", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "sebastian/object-reflector": "^6.0", + "sebastian/recursion-context": "^8.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^13.1.13" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "9.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/9.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/global-state", + "type": "tidelift" + } + ], + "time": "2026-06-01T15:11:33+00:00", + "published-time": "2026-06-01T15:20:45+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "5.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "d1b6f8fce682505dbd048977f1abedf1b8ad3ff8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d1b6f8fce682505dbd048977f1abedf1b8ad3ff8", + "reference": "d1b6f8fce682505dbd048977f1abedf1b8ad3ff8", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^5.8.0", + "php": ">=8.4" + }, + "require-dev": { + "phpunit/phpunit": "^13.2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/5.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/lines-of-code", + "type": "tidelift" + } + ], + "time": "2026-07-09T08:42:34+00:00", + "published-time": "2026-07-09T08:44:06+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "8.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "511064ecde82bd747e2ba2fab3dda8d977b59576" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/511064ecde82bd747e2ba2fab3dda8d977b59576", + "reference": "511064ecde82bd747e2ba2fab3dda8d977b59576", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "sebastian/recursion-context": "^8.0.1" + }, + "require-dev": { + "phpunit/phpunit": "^13.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "8.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/8.1.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/object-enumerator", + "type": "tidelift" + } + ], + "time": "2026-08-13T07:05:05+00:00", + "published-time": "2026-08-13T07:07:58+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "6.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "f71bbcdc4f95456b4622810bec64eb06372e25b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/f71bbcdc4f95456b4622810bec64eb06372e25b2", + "reference": "f71bbcdc4f95456b4622810bec64eb06372e25b2", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "require-dev": { + "phpunit/phpunit": "^13.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/6.1.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/object-reflector", + "type": "tidelift" + } + ], + "time": "2026-08-13T06:34:36+00:00", + "published-time": "2026-08-13T06:39:22+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "8.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "32dba72f2b4642d6a93db22d6c0a9280ff2e3ca0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/32dba72f2b4642d6a93db22d6c0a9280ff2e3ca0", + "reference": "32dba72f2b4642d6a93db22d6c0a9280ff2e3ca0", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "require-dev": { + "phpunit/phpunit": "^13.2.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "8.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/8.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context", + "type": "tidelift" + } + ], + "time": "2026-08-03T05:58:12+00:00", + "published-time": "2026-08-03T05:59:59+00:00" + }, + { + "name": "sebastian/type", + "version": "7.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "bd1df467864cb95140414059a535b2d906173fcf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/bd1df467864cb95140414059a535b2d906173fcf", + "reference": "bd1df467864cb95140414059a535b2d906173fcf", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "require-dev": { + "phpunit/phpunit": "^13.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "7.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "security": "https://github.com/sebastianbergmann/type/security/policy", + "source": "https://github.com/sebastianbergmann/type/tree/7.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/type", + "type": "tidelift" + } + ], + "time": "2026-08-10T08:00:57+00:00", + "published-time": "2026-08-10T08:01:43+00:00" + }, + { + "name": "sebastian/version", + "version": "7.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "f1598cf1d8d1ca4c0f194a52f2fe72a559a7b0b1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/f1598cf1d8d1ca4c0f194a52f2fe72a559a7b0b1", + "reference": "f1598cf1d8d1ca4c0f194a52f2fe72a559a7b0b1", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "7.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "security": "https://github.com/sebastianbergmann/version/security/policy", + "source": "https://github.com/sebastianbergmann/version/tree/7.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/version", + "type": "tidelift" + } + ], + "time": "2026-10-04T05:51:14+00:00", + "published-time": "2026-10-04T05:52:22+00:00" + }, + { + "name": "seld/jsonlint", + "version": "1.12.2", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/jsonlint.git", + "reference": "4882a0459c88772e4afa3a73ee81b7824490aa9c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/4882a0459c88772e4afa3a73ee81b7824490aa9c", + "reference": "4882a0459c88772e4afa3a73ee81b7824490aa9c", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.11", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^8.5.13" + }, + "bin": [ + "bin/jsonlint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Seld\\JsonLint\\": "src/Seld/JsonLint/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "JSON Linter", + "keywords": [ + "json", + "linter", + "parser", + "validator" + ], + "support": { + "issues": "https://github.com/Seldaek/jsonlint/issues", + "source": "https://github.com/Seldaek/jsonlint/tree/1.12.2" + }, + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/seld/jsonlint", + "type": "tidelift" + } + ], + "time": "2026-11-03T10:16:18+00:00", + "published-time": "2026-11-03T10:20:37+00:00" + }, + { + "name": "seld/phar-utils", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/phar-utils.git", + "reference": "65fb381613fd31745d39a740a112a233f978d2d9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/65fb381613fd31745d39a740a112a233f978d2d9", + "reference": "65fb381613fd31745d39a740a112a233f978d2d9", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Seld\\PharUtils\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "PHAR file format utilities, for when PHP phars you up", + "keywords": [ + "phar" + ], + "support": { + "issues": "https://github.com/Seldaek/phar-utils/issues", + "source": "https://github.com/Seldaek/phar-utils/tree/1.2.3" + }, + "time": "2026-10-01T08:16:23+00:00", + "published-time": "2026-10-01T08:17:41+00:00" + }, + { + "name": "seld/signal-handler", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/signal-handler.git", + "reference": "04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/signal-handler/zipball/04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98", + "reference": "04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "require-dev": { + "phpstan/phpstan": "^1", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "^7.5.20 || ^8.5.23", + "psr/log": "^1 || ^2 || ^3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Seld\\Signal\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Simple unix signal handler that silently fails where signals are not supported for easy cross-platform development", + "keywords": [ + "posix", + "sigint", + "signal", + "sigterm", + "unix" + ], + "support": { + "issues": "https://github.com/Seldaek/signal-handler/issues", + "source": "https://github.com/Seldaek/signal-handler/tree/2.0.2" + }, + "time": "2023-09-03T09:24:00+00:00", + "published-time": "2023-09-03T09:24:36+00:00" + }, + { + "name": "slevomat/coding-standard", + "version": "8.31.3", + "source": { + "type": "git", + "url": "https://github.com/slevomat/coding-standard.git", + "reference": "b5c34b28811ee2ed323c52c7dabe2f2802dd2f8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/b5c34b28811ee2ed323c52c7dabe2f2802dd2f8a", + "reference": "b5c34b28811ee2ed323c52c7dabe2f2802dd2f8a", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || ^1.2.1", + "php": "^7.4 || ^8.0", + "phpstan/phpdoc-parser": "^2.3.6", + "squizlabs/php_codesniffer": "^4.0.4" + }, + "require-dev": { + "phing/phing": "3.0.1|3.1.2", + "php-parallel-lint/php-parallel-lint": "1.4.0", + "phpstan/phpstan": "2.3.2", + "phpstan/phpstan-deprecation-rules": "2.0.5", + "phpstan/phpstan-phpunit": "2.1.1", + "phpstan/phpstan-strict-rules": "2.1.0", + "phpunit/phpunit": "9.6.38|10.5.66|11.4.4|11.5.57|12.5.40" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-master": "8.x-dev" + } + }, + "autoload": { + "psr-4": { + "SlevomatCodingStandard\\": "SlevomatCodingStandard/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "keywords": [ + "dev", + "phpcs" + ], + "support": { + "issues": "https://github.com/slevomat/coding-standard/issues", + "source": "https://github.com/slevomat/coding-standard/tree/8.31.3" + }, + "funding": [ + { + "url": "https://github.com/kukulich", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard", + "type": "tidelift" + } + ], + "time": "2026-10-28T16:34:46+00:00", + "published-time": "2026-10-28T16:36:09+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "bbdc3d0532623e21838b7041a4364383a8126f96" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/bbdc3d0532623e21838b7041a4364383a8126f96", + "reference": "bbdc3d0532623e21838b7041a4364383a8126f96", + "shasum": "" + }, + "require": { + "ext-libxml": "*", + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=7.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.4.0 || ^9.3.4 || ^10.5.32 || 11.3.3 - 11.5.28 || ^11.5.31" + }, + "suggest": { + "ext-iconv": "For accurate character length calculation when the checked files contain multi-byte characters.", + "ext-pcntl": "For parallel processing support via the --parallel CLI option." + }, + "bin": [ + "bin/phpcbf", + "bin/phpcs" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2026-08-06T02:45:27+00:00", + "published-time": "2026-08-06T02:57:35+00:00" + }, + { + "name": "staabm/side-effects-detector", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/staabm/side-effects-detector.git", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.6", + "phpunit/phpunit": "^9.6.21", + "symfony/var-dumper": "^5.4.43", + "tomasvotruba/type-coverage": "1.0.0", + "tomasvotruba/unused-public": "1.0.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A static analysis tool to detect side effects in PHP code", + "keywords": [ + "static analysis" + ], + "support": { + "issues": "https://github.com/staabm/side-effects-detector/issues", + "source": "https://github.com/staabm/side-effects-detector/tree/1.0.5" + }, + "funding": [ + { + "url": "https://github.com/staabm", + "type": "github" + } + ], + "time": "2024-10-20T05:08:20+00:00", + "published-time": "2024-10-20T05:09:39+00:00" + }, + { + "name": "symfony/console", + "version": "v8.1.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "5a315b092b81f3e920e9daea1a2ae4c66ed298b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/5a315b092b81f3e920e9daea1a2ae4c66ed298b9", + "reference": "5a315b092b81f3e920e9daea1a2ae4c66ed298b9", + "shasum": "" + }, + "require": { + "php": ">=8.4.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php85": "^1.32", + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^7.4.6|^8.0.6" + }, + "conflict": { + "symfony/dependency-injection": "<8.1", + "symfony/event-dispatcher": "<8.1" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^8.1", + "symfony/event-dispatcher": "^8.1", + "symfony/filesystem": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/lock": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/mime": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0", + "symfony/uid": "^7.4|^8.0", + "symfony/validator": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v8.1.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-11-04T07:07:11+00:00", + "published-time": "2026-11-04T11:31:39+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.8.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "feb1edf4e546af3b85c5caebe8359a20db230ca3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/feb1edf4e546af3b85c5caebe8359a20db230ca3", + "reference": "feb1edf4e546af3b85c5caebe8359a20db230ca3", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.8-dev" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.8.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-09-16T14:15:10+00:00", + "published-time": "2026-11-04T11:25:34+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v8.1.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "58f57b6a33e3495f7f41e01258f1ae5ef76cccd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/58f57b6a33e3495f7f41e01258f1ae5ef76cccd2", + "reference": "58f57b6a33e3495f7f41e01258f1ae5ef76cccd2", + "shasum": "" + }, + "require": { + "php": ">=8.4.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8" + }, + "require-dev": { + "symfony/process": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides basic utilities for the filesystem", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v8.1.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-11-04T08:39:20+00:00", + "published-time": "2026-11-04T11:32:01+00:00" + }, + { + "name": "symfony/finder", + "version": "v8.1.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "a2902e479ba5691d20d51d100a715ea19ad2c837" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/a2902e479ba5691d20d51d100a715ea19ad2c837", + "reference": "a2902e479ba5691d20d51d100a715ea19ad2c837", + "shasum": "" + }, + "require": { + "php": ">=8.4.1" + }, + "require-dev": { + "symfony/filesystem": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v8.1.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-11-02T10:58:30+00:00", + "published-time": "2026-11-04T11:31:20+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "141046a8f9477948ff284fa65be2095baafb94f2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/141046a8f9477948ff284fa65be2095baafb94f2", + "reference": "141046a8f9477948ff284fa65be2095baafb94f2", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.37.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-04-10T16:19:22+00:00", + "published-time": "2026-04-26T14:44:50+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.43.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "5a8f33c87aeecffce24e721b5064fab05f4becf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/5a8f33c87aeecffce24e721b5064fab05f4becf8", + "reference": "5a8f33c87aeecffce24e721b5064fab05f4becf8", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.43.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-10-15T09:18:53+00:00", + "published-time": "2026-10-28T10:07:44+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.43.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "ebd57ccc7edb93d632e184efbe7693d2517bab3b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/ebd57ccc7edb93d632e184efbe7693d2517bab3b", + "reference": "ebd57ccc7edb93d632e184efbe7693d2517bab3b", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.43.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-09-23T22:02:09+00:00", + "published-time": "2026-09-30T10:23:47+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.43.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "122889ed24dc000165bcbfd77ec412f15cbdfc6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/122889ed24dc000165bcbfd77ec412f15cbdfc6a", + "reference": "122889ed24dc000165bcbfd77ec412f15cbdfc6a", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.43.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-10-28T09:35:49+00:00", + "published-time": "2026-10-28T10:07:45+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb", + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.37.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00", + "published-time": "2026-04-26T14:44:49+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.43.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "9c6a5d6b01ca51d486c813e9a9c0ed55f208bb74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/9c6a5d6b01ca51d486c813e9a9c0ed55f208bb74", + "reference": "9c6a5d6b01ca51d486c813e9a9c0ed55f208bb74", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.43.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-09-25T15:50:05+00:00", + "published-time": "2026-09-30T10:23:35+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.38.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "6bfb9c766cacffbc8e118cb87217d08ed84e5cd7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/6bfb9c766cacffbc8e118cb87217d08ed84e5cd7", + "reference": "6bfb9c766cacffbc8e118cb87217d08ed84e5cd7", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.38.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-05-26T12:45:58+00:00", + "published-time": "2026-05-26T13:40:34+00:00" + }, + { + "name": "symfony/polyfill-php84", + "version": "v1.43.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php84.git", + "reference": "22c6548499cbe5c5bb072fc0c42312dff062a015" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/22c6548499cbe5c5bb072fc0c42312dff062a015", + "reference": "22c6548499cbe5c5bb072fc0c42312dff062a015", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php84\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php84/tree/v1.43.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-09-23T22:01:09+00:00", + "published-time": "2026-09-30T10:23:33+00:00" + }, + { + "name": "symfony/polyfill-php85", + "version": "v1.43.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php85.git", + "reference": "86a42cbcc07adc331481a5ab310a4024bfc227f6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/86a42cbcc07adc331481a5ab310a4024bfc227f6", + "reference": "86a42cbcc07adc331481a5ab310a4024bfc227f6", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php85\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.5+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php85/tree/v1.43.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-09-25T15:46:47+00:00", + "published-time": "2026-09-30T10:23:32+00:00" + }, + { + "name": "symfony/process", + "version": "v8.1.10", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "08aa69fa0998bb65a089f9e148a2c0f8b391398e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/08aa69fa0998bb65a089f9e148a2c0f8b391398e", + "reference": "08aa69fa0998bb65a089f9e148a2c0f8b391398e", + "shasum": "" + }, + "require": { + "php": ">=8.4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v8.1.10" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-10-25T14:40:25+00:00", + "published-time": "2026-10-28T18:25:20+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v3.8.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "052852a96fd5e5ebdb617dba22031e41a3300fb5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/052852a96fd5e5ebdb617dba22031e41a3300fb5", + "reference": "052852a96fd5e5ebdb617dba22031e41a3300fb5", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v3.8.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-10-20T17:38:25+00:00", + "published-time": "2026-11-04T11:25:33+00:00" + }, + { + "name": "symfony/string", + "version": "v8.1.10", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "6c6110979c0150393bbb336170e286d51ab4d76c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/6c6110979c0150393bbb336170e286d51ab4d76c", + "reference": "6c6110979c0150393bbb336170e286d51ab4d76c", + "shasum": "" + }, + "require": { + "php": ">=8.4.1", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-intl-grapheme": "^1.33", + "symfony/polyfill-intl-normalizer": "^1.0", + "symfony/polyfill-mbstring": "^1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.5" + }, + "require-dev": { + "symfony/emoji": "^7.4|^8.0", + "symfony/http-client": "^7.4|^8.0", + "symfony/intl": "^7.4|^8.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v8.1.10" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-10-23T17:06:53+00:00", + "published-time": "2026-10-28T18:24:27+00:00" + }, + { + "name": "twig/markdown-extra", + "version": "v3.29.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/markdown-extra.git", + "reference": "8a8e3c28ed17b03ed4965b2e265a018d61f00ba5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/markdown-extra/zipball/8a8e3c28ed17b03ed4965b2e265a018d61f00ba5", + "reference": "8a8e3c28ed17b03ed4965b2e265a018d61f00ba5", + "shasum": "" + }, + "require": { + "php": ">=8.1.0", + "symfony/deprecation-contracts": "^2.5|^3", + "twig/twig": "^3.13|^4.0" + }, + "require-dev": { + "erusev/parsedown": "dev-master as 1.x-dev", + "league/commonmark": "^2.7", + "league/html-to-markdown": "^4.8|^5.0", + "michelf/php-markdown": "^1.8|^2.0", + "symfony/phpunit-bridge": "^6.4|^7.0", + "tempest/markdown": "^1.2" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Twig\\Extra\\Markdown\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + } + ], + "description": "A Twig extension for Markdown", + "homepage": "https://twig.symfony.com", + "keywords": [ + "html", + "markdown", + "twig" + ], + "support": { + "source": "https://github.com/twigphp/markdown-extra/tree/v3.29.0" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "time": "2026-09-06T20:35:36+00:00", + "published-time": "2026-09-18T09:10:33+00:00" + }, + { + "name": "twig/twig", + "version": "v3.30.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "8c737079b726af72ff8ef3c595be9f6a810ea1ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/8c737079b726af72ff8ef3c595be9f6a810ea1ef", + "reference": "8c737079b726af72ff8ef3c595be9f6a810ea1ef", + "shasum": "" + }, + "require": { + "php": ">=8.1.0", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "^1.3" + }, + "require-dev": { + "php-cs-fixer/shim": "^3.0@stable", + "phpstan/phpstan": "^2.0@stable", + "psr/container": "^1.0|^2.0", + "symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/Resources/core.php", + "src/Resources/debug.php", + "src/Resources/escaper.php", + "src/Resources/string_loader.php" + ], + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Twig Team", + "role": "Contributors" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "https://twig.symfony.com", + "keywords": [ + "templating" + ], + "support": { + "issues": "https://github.com/twigphp/Twig/issues", + "source": "https://github.com/twigphp/Twig/tree/v3.30.0" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "time": "2026-09-25T13:20:01+00:00", + "published-time": "2026-09-25T13:20:14+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": {}, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=8.2" + }, + "platform-dev": {}, + "plugin-api-version": "2.11.0" +} diff --git a/config/.env.example b/config/.env.example new file mode 100644 index 0000000..243de31 --- /dev/null +++ b/config/.env.example @@ -0,0 +1,38 @@ +# Plenario environment configuration +# Copy to config/.env (not committed) or set these as real environment variables. +# Real environment variables take precedence over this file. + +# --- Core ------------------------------------------------------------------- +DEBUG=false +# Absolute URL used in e-mails, MUST be set in production +APP_FULL_BASE_URL=https://plenario.example.org +# Generate with: php -r "echo bin2hex(random_bytes(32));" +SECURITY_SALT=change-me-to-a-long-random-string +APP_DEFAULT_LOCALE=de_DE + +# --- Database --------------------------------------------------------------- +# Empty = SQLite file data/plenario.sqlite +# DATABASE_URL=mysql://user:password@localhost/plenario?encoding=utf8mb4 +# DATABASE_URL=postgres://user:password@localhost/plenario + +# --- Mail ------------------------------------------------------------------- +# Empty = .eml files in tmp/mails/ (development only!) +# EMAIL_TRANSPORT_DEFAULT_URL=smtp://user:password@mail.example.org:587?tls=true +MAIL_FROM=noreply@plenario.example.org +MAIL_FROM_NAME=Plenario + +# --- Captcha ---------------------------------------------------------------- +# none | math | recaptcha +CAPTCHA_TYPE=math +# Only for CAPTCHA_TYPE=recaptcha (reCAPTCHA v2 checkbox, https://www.google.com/recaptcha/admin) +RECAPTCHA_SITE_KEY= +RECAPTCHA_SECRET_KEY= + +# --- Behaviour -------------------------------------------------------------- +# Show the admin link right after creation (development only, never in production) +SHOW_ADMIN_LINK_AFTER_CREATE=false +# Max. polls / recovery mails per IP and hour (0 = unlimited) +THROTTLE_CREATE_PER_HOUR=10 +THROTTLE_RECOVER_PER_HOUR=5 +# How often presenter and participant pages poll for updates (ms) +POLL_INTERVAL_MS=2000 diff --git a/config/Migrations/20261107120000_CreateInitialSchema.php b/config/Migrations/20261107120000_CreateInitialSchema.php new file mode 100644 index 0000000..539a843 --- /dev/null +++ b/config/Migrations/20261107120000_CreateInitialSchema.php @@ -0,0 +1,79 @@ +table('polls') + ->addColumn('title', 'string', ['limit' => 200, 'null' => false]) + ->addColumn('email', 'string', ['limit' => 255, 'null' => false]) + // sha256 of the secret admin token; the token itself is only sent by mail + ->addColumn('admin_token_hash', 'string', ['limit' => 64, 'null' => false]) + // token encrypted with Security.salt so the recovery mail can resend the same link + ->addColumn('admin_token_encrypted', 'text', ['null' => false]) + // short public code participants use to join, e.g. "K7P2QX" + ->addColumn('join_code', 'string', ['limit' => 12, 'null' => false]) + ->addColumn('current_slide_id', 'integer', ['null' => true, 'default' => null]) + ->addColumn('is_active', 'boolean', ['null' => false, 'default' => true]) + ->addColumn('show_results_to_participants', 'boolean', ['null' => false, 'default' => true]) + ->addColumn('last_admin_access', 'datetime', ['null' => true, 'default' => null]) + ->addColumn('created', 'datetime', ['null' => false]) + ->addColumn('modified', 'datetime', ['null' => false]) + ->addIndex(['admin_token_hash'], ['unique' => true]) + ->addIndex(['join_code'], ['unique' => true]) + ->addIndex(['email']) + ->create(); + + $this->table('slides') + ->addColumn('poll_id', 'integer', ['null' => false]) + // choice | wordcloud | open | scale | content + ->addColumn('type', 'string', ['limit' => 20, 'null' => false]) + ->addColumn('question', 'string', ['limit' => 500, 'null' => false]) + ->addColumn('description', 'text', ['null' => true, 'default' => null]) + ->addColumn('position', 'integer', ['null' => false, 'default' => 0]) + // JSON encoded type specific settings (multiple, scale_min, scale_max, ...) + ->addColumn('settings', 'text', ['null' => true, 'default' => null]) + ->addColumn('is_voting_open', 'boolean', ['null' => false, 'default' => true]) + ->addColumn('created', 'datetime', ['null' => false]) + ->addColumn('modified', 'datetime', ['null' => false]) + ->addIndex(['poll_id', 'position']) + ->addForeignKey('poll_id', 'polls', 'id', ['delete' => 'CASCADE', 'update' => 'NO_ACTION']) + ->create(); + + $this->table('slide_options') + ->addColumn('slide_id', 'integer', ['null' => false]) + ->addColumn('label', 'string', ['limit' => 255, 'null' => false]) + ->addColumn('position', 'integer', ['null' => false, 'default' => 0]) + ->addIndex(['slide_id', 'position']) + ->addForeignKey('slide_id', 'slides', 'id', ['delete' => 'CASCADE', 'update' => 'NO_ACTION']) + ->create(); + + $this->table('responses') + ->addColumn('slide_id', 'integer', ['null' => false]) + // sha256 of the participant cookie id - anonymous, only used to prevent double voting + ->addColumn('participant_hash', 'string', ['limit' => 64, 'null' => false]) + ->addColumn('slide_option_id', 'integer', ['null' => true, 'default' => null]) + ->addColumn('text_value', 'string', ['limit' => 500, 'null' => true, 'default' => null]) + ->addColumn('numeric_value', 'integer', ['null' => true, 'default' => null]) + ->addColumn('created', 'datetime', ['null' => false]) + ->addIndex(['slide_id', 'participant_hash']) + ->addIndex(['slide_option_id']) + ->addForeignKey('slide_id', 'slides', 'id', ['delete' => 'CASCADE', 'update' => 'NO_ACTION']) + ->addForeignKey('slide_option_id', 'slide_options', 'id', ['delete' => 'CASCADE', 'update' => 'NO_ACTION']) + ->create(); + } +} diff --git a/config/app.php b/config/app.php new file mode 100644 index 0000000..7d776f2 --- /dev/null +++ b/config/app.php @@ -0,0 +1,509 @@ + [ + 'captcha' => [ + 'type' => env('CAPTCHA_TYPE', 'math'), + 'recaptcha' => [ + 'siteKey' => env('RECAPTCHA_SITE_KEY', ''), + 'secretKey' => env('RECAPTCHA_SECRET_KEY', ''), + ], + ], + 'showAdminLinkAfterCreate' => filter_var( + env('SHOW_ADMIN_LINK_AFTER_CREATE', env('DEBUG', false)), + FILTER_VALIDATE_BOOLEAN, + ), + 'throttle' => [ + 'createPerHour' => (int)env('THROTTLE_CREATE_PER_HOUR', 10), + 'recoverPerHour' => (int)env('THROTTLE_RECOVER_PER_HOUR', 5), + ], + 'pollIntervalMs' => (int)env('POLL_INTERVAL_MS', 2000), + ], + + /* + * Debug Level: + * + * Production Mode: + * false: No error messages, errors, or warnings shown. + * + * Development Mode: + * true: Errors and warnings shown. + */ + 'debug' => filter_var(env('DEBUG', false), FILTER_VALIDATE_BOOLEAN), + + /* + * Configure basic information about the application. + * + * - namespace - The namespace to find app classes under. + * - defaultLocale - The default locale for translation, formatting currencies and numbers, date and time. + * - encoding - The encoding used for HTML + database connections. + * - base - The base directory the app resides in. If false this + * will be auto-detected. + * - dir - Name of app directory. + * - webroot - The webroot directory. + * - wwwRoot - The file path to webroot. + * - baseUrl - To configure CakePHP to *not* use mod_rewrite and to + * use CakePHP pretty URLs, remove these .htaccess + * files: + * /.htaccess + * /webroot/.htaccess + * And uncomment the baseUrl key below. + * - fullBaseUrl - SECURITY: A base URL to use for absolute links. + * IMPORTANT: This MUST be set in production to prevent Host Header Injection attacks + * that can compromise password reset and other security-critical features. + * Set this via APP_FULL_BASE_URL environment variable or directly in config. + * Example: 'https://example.com' + * When not set, the application will throw an exception in production mode. + * - imageBaseUrl - Web path to the public images/ directory under webroot. + * - cssBaseUrl - Web path to the public css/ directory under webroot. + * - jsBaseUrl - Web path to the public js/ directory under webroot. + * - paths - Configure paths for non class-based resources. Supports the + * `plugins`, `templates`, `locales` subkeys, which allow the definition of + * paths for plugins, view templates and locale files respectively. + */ + 'App' => [ + 'namespace' => 'App', + 'encoding' => env('APP_ENCODING', 'UTF-8'), + 'defaultLocale' => env('APP_DEFAULT_LOCALE', 'de_DE'), + 'defaultTimezone' => env('APP_DEFAULT_TIMEZONE', 'UTC'), + 'base' => false, + 'dir' => 'src', + 'webroot' => 'webroot', + 'wwwRoot' => WWW_ROOT, + //'baseUrl' => env('SCRIPT_NAME'), + 'fullBaseUrl' => env('APP_FULL_BASE_URL', false), + 'imageBaseUrl' => 'img/', + 'cssBaseUrl' => 'css/', + 'jsBaseUrl' => 'js/', + 'paths' => [ + 'plugins' => [ROOT . DS . 'plugins' . DS], + 'templates' => [ROOT . DS . 'templates' . DS], + 'locales' => [RESOURCES . 'locales' . DS], + ], + ], + + /* + * Security and encryption configuration + * + * - salt - A random string used in security hashing methods. + * The salt value is also used as the encryption key. + * You should treat it as extremely sensitive data. + */ + 'Security' => [ + 'salt' => env('SECURITY_SALT'), + ], + + /* + * Apply timestamps with the last modified time to static assets (js, css, images). + * Will append a querystring parameter containing the time the file was modified. + * This is useful for busting browser caches. + * + * Set to true to apply timestamps when debug is true. Set to 'force' to always + * enable timestamping regardless of debug value. + */ + 'Asset' => [ + //'timestamp' => true, + // 'cacheTime' => '+1 year' + ], + + /* + * Configure the cache adapters. + */ + 'Cache' => [ + 'default' => [ + 'className' => FileEngine::class, + 'path' => CACHE, + 'url' => env('CACHE_DEFAULT_URL', null), + ], + + /* + * Rate limiting of poll creation / recovery mails (App\Service\ThrottleService). + */ + 'throttle' => [ + 'className' => FileEngine::class, + 'prefix' => 'plenario_', + 'path' => CACHE . 'throttle' . DS, + 'duration' => '+1 hour', + 'url' => env('CACHE_THROTTLE_URL', null), + ], + + /* + * Configure the cache used for general framework caching. + * Translation cache files are stored with this configuration. + * Duration will be set to '+2 minutes' in bootstrap.php when debug = true + * If you set 'className' => 'Null' core cache will be disabled. + */ + '_cake_translations_' => [ + 'className' => FileEngine::class, + 'prefix' => 'myapp_cake_translations_', + 'path' => CACHE . 'persistent' . DS, + 'serialize' => true, + 'duration' => '+1 years', + 'url' => env('CACHE_CAKECORE_URL', null), + ], + + /* + * Configure the cache for model and datasource caches. This cache + * configuration is used to store schema descriptions, and table listings + * in connections. + * Duration will be set to '+2 minutes' in bootstrap.php when debug = true + */ + '_cake_model_' => [ + 'className' => FileEngine::class, + 'prefix' => 'myapp_cake_model_', + 'path' => CACHE . 'models' . DS, + 'serialize' => true, + 'duration' => '+1 years', + 'url' => env('CACHE_CAKEMODEL_URL', null), + ], + ], + + /* + * Configure the Error and Exception handlers used by your application. + * + * By default errors are displayed using Debugger, when debug is true and logged + * by Cake\Log\Log when debug is false. + * + * In CLI environments exceptions will be printed to stderr with a backtrace. + * In web environments an HTML page will be displayed for the exception. + * With debug true, framework errors like Missing Controller will be displayed. + * When debug is false, framework errors will be coerced into generic HTTP errors. + * + * Options: + * + * - `errorLevel` - int - The level of errors you are interested in capturing. + * - `trace` - boolean - Whether backtraces should be included in + * logged errors/exceptions. + * - `log` - boolean - Whether you want exceptions logged. + * - `exceptionRenderer` - string - The class responsible for rendering uncaught exceptions. + * The chosen class will be used for both CLI and web environments. If you want different + * classes used in CLI and web environments you'll need to write that conditional logic as well. + * The conventional location for custom renderers is in `src/Error`. Your exception renderer needs to + * implement the `render()` method and return either a string or Http\Response. + * `errorRenderer` - string - The class responsible for rendering PHP errors. The selected + * class will be used for both web and CLI contexts. If you want different classes for each environment + * you'll need to write that conditional logic as well. Error renderers need to + * to implement the `Cake\Error\ErrorRendererInterface`. + * - `skipLog` - array - List of exceptions to skip for logging. Exceptions that + * extend one of the listed exceptions will also be skipped for logging. + * E.g.: + * `'skipLog' => ['Cake\Http\Exception\NotFoundException', 'Cake\Http\Exception\UnauthorizedException']` + * - `extraFatalErrorMemory` - int - The number of megabytes to increase the memory limit by + * when a fatal error is encountered. This allows + * breathing room to complete logging or error handling. + * - `ignoredDeprecationPaths` - array - A list of glob-compatible file paths that deprecations + * should be ignored in. Use this to ignore deprecations for plugins or parts of + * your application that still emits deprecations. + * - `traceFormat` - when logging errors, List of `'array'`, `'points'`, `'shortPoints'`, defaults to `shortPoints`. + */ + 'Error' => [ + 'errorLevel' => E_ALL, + 'skipLog' => [], + 'log' => true, + 'trace' => true, + 'ignoredDeprecationPaths' => [], + 'traceFormat' => null, + ], + + /* + * Debugger configuration + * + * Define development error values for Cake\Error\Debugger + * + * - `editor` Set the editor URL format you want to use. + * By default atom, emacs, macvim, phpstorm, sublime, textmate, and vscode are + * available. You can add additional editor link formats using + * `Debugger::addEditor()` during your application bootstrap. + * - `editorBasePath` - The base path to your project for editor integration. + * Used to generate file links in stack traces. + * - `outputMask` A mapping of `key` to `replacement` values that + * `Debugger` should replace in dumped data and logs generated by `Debugger`. + */ + 'Debugger' => [ + 'editor' => 'phpstorm', + ], + + /* + * Email configuration. + * + * By defining transports separately from delivery profiles you can easily + * re-use transport configuration across multiple profiles. + * + * You can specify multiple configurations for production, development and + * testing. + * + * Each transport needs a `className`. Valid options are as follows: + * + * Mail - Send using PHP mail function + * Smtp - Send using SMTP + * Debug - Do not send the email, just return the result + * + * You can add custom transports (or override existing transports) by adding the + * appropriate file to src/Mailer/Transport. Transports should be named + * 'YourTransport.php', where 'Your' is the name of the transport. + */ + 'EmailTransport' => [ + 'default' => [ + 'className' => MailTransport::class, + /* + * The keys host, port, timeout, username, password, client and tls + * are used in SMTP transports + */ + 'host' => 'localhost', + 'port' => 25, + 'timeout' => 30, + /* + * It is recommended to set these options through your environment or app_local.php + */ + //'username' => null, + //'password' => null, + 'client' => null, + 'tls' => false, + 'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null), + ], + ], + + /* + * Email delivery profiles + * + * Delivery profiles allow you to predefine various properties about email + * messages from your application and give the settings a name. This saves + * duplication across your application and makes maintenance and development + * easier. Each profile accepts a number of keys. See `Cake\Mailer\Mailer` + * for more information. + */ + 'Email' => [ + 'default' => [ + 'transport' => 'default', + 'from' => [env('MAIL_FROM', 'noreply@localhost') => env('MAIL_FROM_NAME', 'Plenario')], + /* + * Will by default be set to config value of App.encoding, if that exists otherwise to UTF-8. + */ + //'charset' => 'utf-8', + //'headerCharset' => 'utf-8', + ], + ], + + /* + * Connection information used by the ORM to connect + * to your application's datastores. + * + * ### Notes + * - Drivers include Mysql Postgres Sqlite Sqlserver + * See vendor\cakephp\cakephp\src\Database\Driver for the complete list + * - Do not use periods in database name - it may lead to errors. + * See https://github.com/cakephp/cakephp/issues/6471 for details. + * - 'encoding' is recommended to be set to full UTF-8 4-Byte support. + * E.g set it to 'utf8mb4' in MariaDB and MySQL and 'utf8' for any + * other RDBMS. + */ + 'Datasources' => [ + /* + * These configurations should contain permanent settings used + * by all environments. + * + * The values in app_local.php will override any values set here + * and should be used for local and per-environment configurations. + * + * Environment variable-based configurations can be loaded here or + * in app_local.php depending on the application's needs. + */ + 'default' => [ + 'className' => Connection::class, + 'driver' => Sqlite::class, + 'persistent' => false, + 'timezone' => 'UTC', + + /* + * For MariaDB/MySQL the internal default changed from utf8 to utf8mb4, aka full utf-8 support + */ + 'encoding' => 'utf8', + + /* + * If your MySQL server is configured with `skip-character-set-client-handshake` + * then you MUST use the `flags` config to set your charset encoding. + * For e.g. `'flags' => [\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4']` + */ + 'flags' => [], + 'cacheMetadata' => true, + 'log' => false, + + /* + * Set identifier quoting to true if you are using reserved words or + * special characters in your table or column names. Enabling this + * setting will result in queries built using the Query Builder having + * identifiers quoted when creating SQL. It should be noted that this + * decreases performance because each query needs to be traversed and + * manipulated before being executed. + */ + 'quoteIdentifiers' => false, + + /* + * During development, if using MySQL < 5.6, uncommenting the + * following line could boost the speed at which schema metadata is + * fetched from the database. It can also be set directly with the + * mysql configuration directive 'innodb_stats_on_metadata = 0' + * which is the recommended value in production environments + */ + //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], + ], + + /* + * The test connection is used during the test suite. + */ + 'test' => [ + 'className' => Connection::class, + 'driver' => Sqlite::class, + 'persistent' => false, + 'timezone' => 'UTC', + 'encoding' => 'utf8', + 'flags' => [], + 'cacheMetadata' => true, + 'quoteIdentifiers' => false, + 'log' => false, + //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], + ], + ], + + /* + * Configures logging options + */ + 'Log' => [ + 'debug' => [ + 'className' => FileLog::class, + 'path' => LOGS, + 'file' => 'debug', + 'url' => env('LOG_DEBUG_URL', null), + 'scopes' => null, + 'levels' => ['notice', 'info', 'debug'], + ], + 'error' => [ + 'className' => FileLog::class, + 'path' => LOGS, + 'file' => 'error', + 'url' => env('LOG_ERROR_URL', null), + 'scopes' => null, + 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'], + ], + // To enable this dedicated query log, you need to set your datasource's log flag to true + 'queries' => [ + 'className' => FileLog::class, + 'path' => LOGS, + 'file' => 'queries', + 'url' => env('LOG_QUERIES_URL', null), + 'scopes' => ['cake.database.queries'], + ], + ], + + /* + * Session configuration. + * + * Contains an array of settings to use for session configuration. The + * `defaults` key is used to define a default preset to use for sessions, any + * settings declared here will override the settings of the default config. + * + * ## Options + * + * - `cookie` - The name of the cookie to use. Defaults to value set for `session.name` php.ini config. + * Avoid using `.` in cookie names, as PHP will drop sessions from cookies with `.` in the name. + * - `cookiePath` - The url path for which session cookie is set. Maps to the + * `session.cookie_path` php.ini config. Defaults to base path of app. + * - `timeout` - The time in minutes a session can be 'idle'. If no request is received in + * this duration, the session will be expired and rotated. Pass 0 to disable idle timeout checks. + * - `defaults` - The default configuration set to use as a basis for your session. + * There are four built-in options: php, cake, cache, database. + * - `handler` - Can be used to enable a custom session handler. Expects an + * array with at least the `engine` key, being the name of the Session engine + * class to use for managing the session. CakePHP bundles the `CacheSession` + * and `DatabaseSession` engines. + * - `ini` - An associative array of additional 'session.*` ini values to set. + * + * Within the `ini` key, you will likely want to define: + * + * - `session.cookie_lifetime` - The number of seconds that cookies are valid for. This + * should be longer than `Session.timeout`. + * - `session.gc_maxlifetime` - The number of seconds after which a session is considered 'garbage' + * that can be deleted by PHP's session cleanup behavior. This value should be greater than both + * `Sesssion.timeout` and `session.cookie_lifetime`. + * + * The built-in `defaults` options are: + * + * - 'php' - Uses settings defined in your php.ini. + * - 'cake' - Saves session files in CakePHP's /tmp directory. + * - 'database' - Uses CakePHP's database sessions. + * - 'cache' - Use the Cache class to save sessions. + * + * To define a custom session handler, save it at src/Http/Session/.php. + * Make sure the class implements PHP's `SessionHandlerInterface` and set + * Session.handler to + * + * To use database sessions, load the SQL file located at config/schema/sessions.sql + */ + 'Session' => [ + 'defaults' => 'php', + ], + + /** + * DebugKit configuration. + * + * Contains an array of configurations to apply to the DebugKit plugin, if loaded. + * Documentation: https://book.cakephp.org/debugkit/5/en/index.html#configuration + * + * ## Options + * + * - `panels` - Enable or disable panels. The key is the panel name, and the value is true to enable, + * or false to disable. + * - `includeSchemaReflection` - Set to true to enable logging of schema reflection queries. Disabled by default. + * - `safeTld` - Set an array of whitelisted TLDs for local development. + * - `forceEnable` - Force DebugKit to display. Careful with this, it is usually safer to simply whitelist + * your local TLDs. + * - `ignorePathsPattern` - Regex pattern (including delimiter) to ignore paths. + * DebugKit won’t save data for request URLs that match this regex. + * - `ignoreAuthorization` - Set to true to ignore Cake Authorization plugin for DebugKit requests. + * Disabled by default. + * - `maxDepth` - Defines how many levels of nested data should be shown in general for debug output. + * Default is 5. WARNING: Increasing the max depth level can lead to an out of memory error. + * - `variablesPanelMaxDepth` - Defines how many levels of nested data should be shown in the variables tab. + * Default is 5. WARNING: Increasing the max depth level can lead to an out of memory error. + */ + 'DebugKit' => [ + 'forceEnable' => filter_var(env('DEBUG_KIT_FORCE_ENABLE', false), FILTER_VALIDATE_BOOLEAN), + 'safeTld' => env('DEBUG_KIT_SAFE_TLD', null), + 'ignoreAuthorization' => env('DEBUG_KIT_IGNORE_AUTHORIZATION', false), + ], + + /** + * TestSuite configuration. + * + * ## Options + * + * - `errorLevel` - Defaults to `E_ALL`. Can be set to `false` to disable overwrite error level. + * - `fixtureStrategy` - Defaults to TruncateStrategy. Can be set to any class implementing FixtureStrategyInterface. + */ + 'TestSuite' => [ + 'errorLevel' => null, + 'fixtureStrategy' => null, + ], +]; diff --git a/config/app_local.example.php b/config/app_local.example.php new file mode 100644 index 0000000..9da5517 --- /dev/null +++ b/config/app_local.example.php @@ -0,0 +1,68 @@ + filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN), + + 'App' => [ + // Absolute base URL used for links in e-mails, e.g. https://plenario.example.org + 'fullBaseUrl' => env('APP_FULL_BASE_URL', 'http://localhost:8765'), + ], + + 'Security' => [ + 'salt' => env('SECURITY_SALT', '__SALT__'), + ], + + 'Plenario' => [ + 'captcha' => [ + // 'none' | 'math' | 'recaptcha' + 'type' => env('CAPTCHA_TYPE', 'math'), + 'recaptcha' => [ + 'siteKey' => env('RECAPTCHA_SITE_KEY', ''), + 'secretKey' => env('RECAPTCHA_SECRET_KEY', ''), + ], + ], + // Shows the admin link on the confirmation page. Development only! + 'showAdminLinkAfterCreate' => filter_var(env('SHOW_ADMIN_LINK_AFTER_CREATE', env('DEBUG', true)), FILTER_VALIDATE_BOOLEAN), + ], + + 'Datasources' => [ + /* + * Default: SQLite file in data/. For MySQL/MariaDB/PostgreSQL set + * DATABASE_URL, e.g. + * mysql://user:pass@localhost/plenario?encoding=utf8mb4 + */ + 'default' => [ + 'driver' => Sqlite::class, + 'database' => ROOT . DS . 'data' . DS . 'plenario.sqlite', + 'url' => env('DATABASE_URL', null), + ], + 'test' => [ + 'driver' => Sqlite::class, + 'database' => ROOT . DS . 'tmp' . DS . 'tests.sqlite', + 'url' => env('DATABASE_TEST_URL', null), + ], + ], + + 'EmailTransport' => [ + /* + * Local default: mails are written as .eml files to tmp/mails/. + * For production use SMTP, e.g. + * EMAIL_TRANSPORT_DEFAULT_URL=smtp://user:pass@mail.example.org:587?tls=true + */ + 'default' => [ + 'className' => \App\Mailer\Transport\FileTransport::class, + 'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null), + ], + ], +]; diff --git a/config/bootstrap.php b/config/bootstrap.php new file mode 100644 index 0000000..b97741e --- /dev/null +++ b/config/bootstrap.php @@ -0,0 +1,239 @@ +parse() + ->skipExisting() + ->putenv() + ->toEnv() + ->toServer(); +} + +/* + * Initializes default Config store and loads the main configuration file (app.php) + * + * CakePHP contains 2 configuration files after project creation: + * - `config/app.php` for the default application configuration. + * - `config/app_local.php` for environment specific configuration. + */ +try { + Configure::config('default', new PhpConfig()); + Configure::load('app', 'default', false); +} catch (Exception $e) { + exit($e->getMessage() . "\n"); +} + +/* + * Load an environment local configuration file to provide overrides to your configuration. + * Notice: For security reasons app_local.php **should not** be included in your git repo. + */ +if (file_exists(CONFIG . 'app_local.php')) { + Configure::load('app_local', 'default'); +} + +/* + * When debug = true the metadata cache should only last for a short time. + */ +if (Configure::read('debug')) { + Configure::write('Cache._cake_model_.duration', '+1 minute'); + Configure::write('Cache._cake_translations_.duration', '+1 minute'); +} + +/* + * Set the default server timezone. Using UTC makes time calculations / conversions easier. + * Check https://php.net/manual/en/timezones.php for list of valid timezone strings. + */ +date_default_timezone_set(Configure::read('App.defaultTimezone')); + +/* + * Configure the mbstring extension to use the correct encoding. + */ +mb_internal_encoding(Configure::read('App.encoding')); + +/* + * Set the default locale. This controls how dates, number and currency is + * formatted and sets the default language to use for translations. + */ +ini_set('intl.default_locale', Configure::read('App.defaultLocale')); + +/* + * Register application error and exception handlers. + */ +(new ErrorTrap(Configure::read('Error')))->register(); +(new ExceptionTrap(Configure::read('Error')))->register(); + +/* + * CLI/Command specific configuration. + */ +if (PHP_SAPI === 'cli') { + // Set the fullBaseUrl to allow URLs to be generated in commands. + // This is useful when sending email from commands. + // Configure::write('App.fullBaseUrl', php_uname('n')); + + // Set logs to different files so they don't have permission conflicts. + if (Configure::check('Log.debug')) { + Configure::write('Log.debug.file', 'cli-debug'); + } + if (Configure::check('Log.error')) { + Configure::write('Log.error.file', 'cli-error'); + } +} + +/* + * Set the full base URL for the application. + * + * SECURITY: In production, App.fullBaseUrl MUST be explicitly configured to prevent + * Host Header Injection attacks. The HostHeaderMiddleware enforces this requirement + * and validates incoming Host headers against the configured value. + * + * Set APP_FULL_BASE_URL in your environment variables or configure App.fullBaseUrl + * in config/app.php or config/app_local.php + * + * Example: APP_FULL_BASE_URL=https://example.com + */ +$fullBaseUrl = Configure::read('App.fullBaseUrl'); +if (!$fullBaseUrl) { + $httpHost = env('HTTP_HOST'); + + /* + * Development mode fallback: Use HTTP_HOST for convenience. + * WARNING: This is ONLY safe in development. In production, the + * HostHeaderMiddleware will reject requests when fullBaseUrl is not configured. + */ + if ($httpHost) { + $s = null; + if (env('HTTPS') || env('HTTP_X_FORWARDED_PROTO') === 'https') { + $s = 's'; + } + $fullBaseUrl = 'http' . $s . '://' . $httpHost; + } + unset($httpHost, $s); +} +if ($fullBaseUrl) { + Router::fullBaseUrl($fullBaseUrl); +} +unset($fullBaseUrl); + +/* + * Apply the loaded configuration settings to their respective systems. + * This will also remove the loaded config data from memory. + */ +Cache::setConfig(Configure::consume('Cache')); +ConnectionManager::setConfig(Configure::consume('Datasources')); +TransportFactory::setConfig(Configure::consume('EmailTransport')); +Mailer::setConfig(Configure::consume('Email')); +Log::setConfig(Configure::consume('Log')); +Security::setSalt(Configure::consume('Security.salt')); + +/* + * Setup detectors for mobile and tablet. + * If you don't use these checks you can safely remove this code + * and the mobiledetect package from composer.json. + */ +ServerRequest::addDetector('mobile', function ($request) { + $detector = new MobileDetect(); + + return $detector->isMobile(); +}); +ServerRequest::addDetector('tablet', function ($request) { + $detector = new MobileDetect(); + + return $detector->isTablet(); +}); + +/* + * You can enable default locale format parsing by adding calls + * to `useLocaleParser()`. This enables the automatic conversion of + * locale specific date formats when processing request data. For details see + * @link https://book.cakephp.org/5/en/core-libraries/internationalization-and-localization.html#parsing-localized-datetime-data + */ +// \Cake\Database\TypeFactory::build('time')->useLocaleParser(); +// \Cake\Database\TypeFactory::build('date')->useLocaleParser(); +// \Cake\Database\TypeFactory::build('datetime')->useLocaleParser(); +// \Cake\Database\TypeFactory::build('timestamp')->useLocaleParser(); +// \Cake\Database\TypeFactory::build('datetimefractional')->useLocaleParser(); +// \Cake\Database\TypeFactory::build('timestampfractional')->useLocaleParser(); +// \Cake\Database\TypeFactory::build('datetimetimezone')->useLocaleParser(); +// \Cake\Database\TypeFactory::build('timestamptimezone')->useLocaleParser(); + +/* + * Custom Inflector rules, can be set to correctly pluralize or singularize + * table, model, controller names or whatever other string is passed to the + * inflection functions. + */ +// \Cake\Utility\Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']); +// \Cake\Utility\Inflector::rules('irregular', ['red' => 'redlings']); +// \Cake\Utility\Inflector::rules('uninflected', ['dontinflectme']); + +// set a custom date and time format +// see https://book.cakephp.org/5/en/core-libraries/time.html#setting-the-default-locale-and-format-string +// and https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax +// \Cake\I18n\Date::setToStringFormat('dd.MM.yyyy'); +// \Cake\I18n\Time::setToStringFormat('dd.MM.yyyy HH:mm'); diff --git a/config/paths.php b/config/paths.php new file mode 100644 index 0000000..37a2481 --- /dev/null +++ b/config/paths.php @@ -0,0 +1,94 @@ + `[configuration options]`. + * + * Available options: + * - onlyDebug: Load the plugin only in debug mode. Default false. + * - onlyCli: Load the plugin only in CLI mode. Default false. + * - optional: Do not throw an exception if the plugin is not found. Default false. + */ +return [ + 'DebugKit' => ['onlyDebug' => true], + 'Bake' => ['onlyCli' => true, 'optional' => true], + 'Migrations' => ['onlyCli' => true], + + // Additional plugins here +]; diff --git a/config/routes.php b/config/routes.php new file mode 100644 index 0000000..85da1d6 --- /dev/null +++ b/config/routes.php @@ -0,0 +1,70 @@ + ...]. + * There are intentionally NO fallback routes. + */ + +use Cake\Routing\Route\DashedRoute; +use Cake\Routing\RouteBuilder; + +return function (RouteBuilder $routes): void { + $routes->setRouteClass(DashedRoute::class); + + $routes->scope('/', function (RouteBuilder $builder): void { + // --- public ------------------------------------------------------- + $builder->connect('/', 'Home::index', ['_name' => 'home']); + $builder->connect('/create', 'Home::create', ['_name' => 'create'])->setMethods(['POST']); + $builder->connect('/created', 'Home::created', ['_name' => 'created']); + $builder->connect('/join', 'Home::join', ['_name' => 'join']); + $builder->connect('/recover', 'Home::recover', ['_name' => 'recover']); + + // --- participants ------------------------------------------------- + $builder->connect('/p', 'Home::join', ['_name' => 'join:short']); + $builder->connect('/p/{code}', 'Participate::view', ['_name' => 'participate']) + ->setPatterns(['code' => '[A-Za-z0-9-]{4,16}']) + ->setPass(['code']); + $builder->connect('/p/{code}/state', 'Participate::state', ['_name' => 'participate:state']) + ->setPatterns(['code' => '[A-Za-z0-9-]{4,16}']) + ->setPass(['code']); + $builder->connect('/p/{code}/vote', 'Participate::vote', ['_name' => 'participate:vote']) + ->setPatterns(['code' => '[A-Za-z0-9-]{4,16}']) + ->setPass(['code']) + ->setMethods(['POST']); + + // --- admin (secret token) ----------------------------------------- + $builder->scope('/admin/{token}', function (RouteBuilder $admin): void { + $token = ['token' => '[A-Za-z0-9_-]{20,64}', 'id' => '\d+']; + + $admin->connect('/', 'Admin::index', ['_name' => 'admin'])->setPatterns($token); + $admin->connect('/settings', 'Admin::settings', ['_name' => 'admin:settings']) + ->setPatterns($token)->setMethods(['POST']); + $admin->connect('/rotate-token', 'Admin::rotateToken', ['_name' => 'admin:rotate']) + ->setPatterns($token)->setMethods(['POST']); + $admin->connect('/delete', 'Admin::delete', ['_name' => 'admin:delete']) + ->setPatterns($token)->setMethods(['POST']); + $admin->connect('/present', 'Admin::present', ['_name' => 'admin:present'])->setPatterns($token); + $admin->connect('/state', 'Admin::state', ['_name' => 'admin:state'])->setPatterns($token); + $admin->connect('/control', 'Admin::control', ['_name' => 'admin:control']) + ->setPatterns($token)->setMethods(['POST']); + $admin->connect('/qr.svg', 'Admin::qr', ['_name' => 'admin:qr'])->setPatterns($token); + $admin->connect('/export.csv', 'Admin::export', ['_name' => 'admin:export'])->setPatterns($token); + + $admin->connect('/slides/add', 'Slides::add', ['_name' => 'slides:add'])->setPatterns($token); + $admin->connect('/slides/{id}/edit', 'Slides::edit', ['_name' => 'slides:edit']) + ->setPatterns($token)->setPass(['id']); + $admin->connect('/slides/{id}/delete', 'Slides::delete', ['_name' => 'slides:delete']) + ->setPatterns($token)->setPass(['id'])->setMethods(['POST']); + $admin->connect('/slides/{id}/move/{direction}', 'Slides::move', ['_name' => 'slides:move']) + ->setPatterns($token + ['direction' => 'up|down'])->setPass(['id', 'direction'])->setMethods(['POST']); + $admin->connect('/slides/{id}/reset', 'Slides::reset', ['_name' => 'slides:reset']) + ->setPatterns($token)->setPass(['id'])->setMethods(['POST']); + }); + }); +}; diff --git a/config/schema/i18n.sql b/config/schema/i18n.sql new file mode 100644 index 0000000..e59d1e6 --- /dev/null +++ b/config/schema/i18n.sql @@ -0,0 +1,18 @@ +# Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) +# +# Licensed under The MIT License +# For full copyright and license information, please see the LICENSE.txt +# Redistributions of files must retain the above copyright notice. +# MIT License (https://opensource.org/licenses/mit-license.php) + +CREATE TABLE i18n ( + id int NOT NULL auto_increment, + locale varchar(6) NOT NULL, + model varchar(255) NOT NULL, + foreign_key int(10) NOT NULL, + field varchar(255) NOT NULL, + content text, + PRIMARY KEY (id), + UNIQUE INDEX I18N_LOCALE_FIELD(locale, model, foreign_key, field), + INDEX I18N_FIELD(model, foreign_key, field) +); diff --git a/config/schema/sessions.sql b/config/schema/sessions.sql new file mode 100644 index 0000000..bdfdea0 --- /dev/null +++ b/config/schema/sessions.sql @@ -0,0 +1,15 @@ +# Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) +# +# Licensed under The MIT License +# For full copyright and license information, please see the LICENSE.txt +# Redistributions of files must retain the above copyright notice. +# MIT License (https://opensource.org/licenses/mit-license.php) + +CREATE TABLE `sessions` ( + `id` char(40) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, + `created` datetime DEFAULT CURRENT_TIMESTAMP, -- optional, requires MySQL 5.6.5+ + `modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- optional, requires MySQL 5.6.5+ + `data` blob DEFAULT NULL, -- for PostgreSQL use bytea instead of blob + `expires` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; diff --git a/data/.gitkeep b/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/index.php b/index.php new file mode 100644 index 0000000..4591769 --- /dev/null +++ b/index.php @@ -0,0 +1,16 @@ + + + + + */src/Controller/* + + + src/ + tests/ + diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..38c7d78 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,36 @@ + + + + + + + + + + tests/TestCase/ + + + + + + + + + + + + + src/ + plugins/*/src/ + + + src/Console/Installer.php + + + diff --git a/plugins/.gitkeep b/plugins/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/resources/.gitkeep b/resources/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/Application.php b/src/Application.php new file mode 100644 index 0000000..98ef0b9 --- /dev/null +++ b/src/Application.php @@ -0,0 +1,129 @@ + + */ +class Application extends BaseApplication +{ + /** + * Load all the application configuration and bootstrap logic. + * + * @return void + */ + public function bootstrap(): void + { + // Call parent to load bootstrap from files. + parent::bootstrap(); + + // By default, does not allow fallback classes. + FactoryLocator::add( + 'Table', + (new TableLocator())->allowFallbackClass(false), + ); + } + + /** + * Setup the middleware queue your application will use. + * + * @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to setup. + * @return \Cake\Http\MiddlewareQueue The updated middleware queue. + */ + public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue + { + $middlewareQueue + // Catch any exceptions in the lower layers, + // and make an error page/response + ->add(new ErrorHandlerMiddleware(Configure::read('Error'), $this)) + + // Validate Host header to prevent Host Header Injection attacks. + // In production, ensures App.fullBaseUrl is configured and validates + // the incoming Host header against it. + ->add(new HostHeaderMiddleware()) + + // Handle plugin/theme assets like CakePHP normally does. + ->add(new AssetMiddleware([ + 'cacheTime' => Configure::read('Asset.cacheTime'), + ])) + + // Add routing middleware. + // If you have a large number of routes connected, turning on routes + // caching in production could improve performance. + // See https://github.com/CakeDC/cakephp-cached-routing + ->add(new RoutingMiddleware($this)) + + // Parse various types of encoded request bodies so that they are + // available as array through $request->getData() + // https://book.cakephp.org/5/en/controllers/middleware.html#body-parser-middleware + ->add(new BodyParserMiddleware()) + + // Cross Site Request Forgery (CSRF) Protection Middleware + // https://book.cakephp.org/5/en/security/csrf.html#cross-site-request-forgery-csrf-middleware + ->add(new CsrfProtectionMiddleware([ + 'httponly' => true, + ])); + + return $middlewareQueue; + } + + /** + * Register application container services. + * + * @param \Cake\Core\ContainerInterface $container The Container to update. + * @return void + * @link https://book.cakephp.org/5/en/development/dependency-injection.html#dependency-injection + */ + public function services(ContainerInterface $container): void + { + // Allow your Tables to be dependency injected + //$container->delegate(new \Cake\ORM\Locator\TableContainer()); + } + + /** + * Register custom event listeners here + * + * @param \Cake\Event\EventManagerInterface $eventManager + * @return \Cake\Event\EventManagerInterface + * @link https://book.cakephp.org/5/en/core-libraries/events.html#registering-listeners + */ + public function events(EventManagerInterface $eventManager): EventManagerInterface + { + // $eventManager->on(new SomeCustomListenerClass()); + + return $eventManager; + } +} diff --git a/src/Captcha/CaptchaFactory.php b/src/Captcha/CaptchaFactory.php new file mode 100644 index 0000000..0821ede --- /dev/null +++ b/src/Captcha/CaptchaFactory.php @@ -0,0 +1,36 @@ + new NoCaptcha(), + 'math' => new MathCaptcha($scope), + 'recaptcha' => new RecaptchaCaptcha( + (string)Configure::read('Plenario.captcha.recaptcha.siteKey', ''), + (string)Configure::read('Plenario.captcha.recaptcha.secretKey', ''), + ), + default => throw new InvalidArgumentException(sprintf( + 'Unknown captcha type "%s". Use none, math or recaptcha.', + $type, + )), + }; + } +} diff --git a/src/Captcha/CaptchaInterface.php b/src/Captcha/CaptchaInterface.php new file mode 100644 index 0000000..51d74fd --- /dev/null +++ b/src/Captcha/CaptchaInterface.php @@ -0,0 +1,34 @@ + Always contains 'type' + */ + public function challenge(ServerRequest $request): array; + + /** + * @param \Cake\Http\ServerRequest $request Submitted request + * @return bool + */ + public function verify(ServerRequest $request): bool; +} diff --git a/src/Captcha/MathCaptcha.php b/src/Captcha/MathCaptcha.php new file mode 100644 index 0000000..2b7099e --- /dev/null +++ b/src/Captcha/MathCaptcha.php @@ -0,0 +1,76 @@ +scope; + } + + /** + * @inheritDoc + */ + public function challenge(ServerRequest $request): array + { + $a = random_int(1, 12); + $b = random_int(1, 9); + if (random_int(0, 1) === 1 && $a > $b) { + $question = sprintf('%d − %d', $a, $b); + $answer = $a - $b; + } else { + $question = sprintf('%d + %d', $a, $b); + $answer = $a + $b; + } + $request->getSession()->write($this->sessionKey(), $answer); + + return ['type' => 'math', 'question' => $question, 'field' => self::FIELD]; + } + + /** + * @inheritDoc + */ + public function verify(ServerRequest $request): bool + { + $session = $request->getSession(); + $expected = $session->read($this->sessionKey()); + $session->delete($this->sessionKey()); + + $given = trim((string)$request->getData(self::FIELD, '')); + if ($expected === null || $given === '' || !preg_match('/^-?\d+$/', $given)) { + return false; + } + + return (int)$given === (int)$expected; + } +} diff --git a/src/Captcha/NoCaptcha.php b/src/Captcha/NoCaptcha.php new file mode 100644 index 0000000..5b9d774 --- /dev/null +++ b/src/Captcha/NoCaptcha.php @@ -0,0 +1,36 @@ + 'none']; + } + + /** + * @inheritDoc + */ + public function verify(ServerRequest $request): bool + { + return true; + } +} diff --git a/src/Captcha/RecaptchaCaptcha.php b/src/Captcha/RecaptchaCaptcha.php new file mode 100644 index 0000000..06f2e2e --- /dev/null +++ b/src/Captcha/RecaptchaCaptcha.php @@ -0,0 +1,83 @@ +client = $client ?? new Client(['timeout' => 5]); + } + + /** + * @inheritDoc + */ + public function getType(): string + { + return 'recaptcha'; + } + + /** + * @inheritDoc + */ + public function challenge(ServerRequest $request): array + { + return ['type' => 'recaptcha', 'siteKey' => $this->siteKey]; + } + + /** + * @inheritDoc + */ + public function verify(ServerRequest $request): bool + { + $token = (string)$request->getData(self::FIELD, ''); + if ($token === '') { + return false; + } + if ($this->siteKey === '' || $this->secretKey === '') { + Log::error('reCAPTCHA is enabled but RECAPTCHA_SITE_KEY / RECAPTCHA_SECRET_KEY are not configured.'); + + return false; + } + + try { + $response = $this->client->post(self::VERIFY_URL, [ + 'secret' => $this->secretKey, + 'response' => $token, + 'remoteip' => $request->clientIp(), + ]); + $json = $response->getJson(); + } catch (Throwable $e) { + Log::error('reCAPTCHA verification failed: ' . $e->getMessage()); + + return false; + } + + return is_array($json) && ($json['success'] ?? false) === true; + } +} diff --git a/src/Console/Installer.php b/src/Console/Installer.php new file mode 100644 index 0000000..6ef3c2d --- /dev/null +++ b/src/Console/Installer.php @@ -0,0 +1,260 @@ + + */ + public const WRITABLE_DIRS = [ + 'logs', + 'tmp', + 'tmp/cache', + 'tmp/cache/models', + 'tmp/cache/persistent', + 'tmp/cache/views', + 'tmp/sessions', + 'tmp/tests', + ]; + + /** + * Does some routine installation tasks so people don't have to. + * + * @param \Composer\Script\Event $event The composer event object. + * @throws \Exception Exception raised by validator. + * @return void + */ + public static function postInstall(Event $event): void + { + $io = $event->getIO(); + + $rootDir = dirname(__DIR__, 2); + + static::createAppLocalConfig($rootDir, $io); + static::createWritableDirectories($rootDir, $io); + + static::setFolderPermissions($rootDir, $io); + static::setSecuritySalt($rootDir, $io); + + if (class_exists(CodeceptionInstaller::class)) { + CodeceptionInstaller::customizeCodeceptionBinary($event); + } + } + + /** + * Create config/app_local.php file if it does not exist. + * + * @param string $dir The application's root directory. + * @param \Composer\IO\IOInterface $io IO interface to write to console. + * @return void + */ + public static function createAppLocalConfig(string $dir, IOInterface $io): void + { + $appLocalConfig = $dir . '/config/app_local.php'; + $appLocalConfigTemplate = $dir . '/config/app_local.example.php'; + if (!file_exists($appLocalConfig)) { + copy($appLocalConfigTemplate, $appLocalConfig); + $io->write('Created `config/app_local.php` file'); + } + } + + /** + * Create the `logs` and `tmp` directories. + * + * @param string $dir The application's root directory. + * @param \Composer\IO\IOInterface $io IO interface to write to console. + * @return void + */ + public static function createWritableDirectories(string $dir, IOInterface $io): void + { + foreach (static::WRITABLE_DIRS as $path) { + $path = $dir . '/' . $path; + if (!file_exists($path)) { + mkdir($path); + $io->write('Created `' . $path . '` directory'); + } + } + } + + /** + * Set globally writable permissions on the "tmp" and "logs" directory. + * + * This is not the most secure default, but it gets people up and running quickly. + * + * @param string $dir The application's root directory. + * @param \Composer\IO\IOInterface $io IO interface to write to console. + * @return void + */ + public static function setFolderPermissions(string $dir, IOInterface $io): void + { + // ask if the permissions should be changed + if ($io->isInteractive()) { + $validator = function (string $arg): string { + if (in_array($arg, ['Y', 'y', 'N', 'n'])) { + return $arg; + } + throw new Exception('This is not a valid answer. Please choose Y or n.'); + }; + $setFolderPermissions = $io->askAndValidate( + 'Set Folder Permissions ? (Default to Y) [Y,n]? ', + $validator, + 10, + 'Y', + ); + + if (in_array($setFolderPermissions, ['n', 'N'])) { + return; + } + } + + // Change the permissions on a path and output the results. + $changePerms = function (string $path) use ($io): void { + $currentPerms = fileperms($path) & 0777; + $worldWritable = $currentPerms | 0007; + if ($worldWritable == $currentPerms) { + return; + } + + $res = chmod($path, $worldWritable); + if ($res) { + $io->write('Permissions set on ' . $path); + } else { + $io->write('Failed to set permissions on ' . $path); + } + }; + + $walker = function (string $dir) use (&$walker, $changePerms): void { + $files = array_diff(scandir($dir) ?: [], ['.', '..']); + foreach ($files as $file) { + $path = $dir . '/' . $file; + + if (!is_dir($path)) { + continue; + } + + $changePerms($path); + $walker($path); + } + }; + + $walker($dir . '/tmp'); + $changePerms($dir . '/tmp'); + $changePerms($dir . '/logs'); + } + + /** + * Set the security.salt value in the application's config file. + * + * @param string $dir The application's root directory. + * @param \Composer\IO\IOInterface $io IO interface to write to console. + * @return void + */ + public static function setSecuritySalt(string $dir, IOInterface $io): void + { + $newKey = hash('sha256', Security::randomBytes(64)); + static::setSecuritySaltInFile($dir, $io, $newKey, 'app_local.php'); + } + + /** + * Set the security.salt value in a given file + * + * @param string $dir The application's root directory. + * @param \Composer\IO\IOInterface $io IO interface to write to console. + * @param string $newKey key to set in the file + * @param string $file A path to a file relative to the application's root + * @return void + */ + public static function setSecuritySaltInFile(string $dir, IOInterface $io, string $newKey, string $file): void + { + $config = $dir . '/config/' . $file; + $content = file_get_contents($config); + if ($content === false) { + $io->write('Config file not readable or not found: config/' . $file); + + return; + } + + $content = str_replace('__SALT__', $newKey, $content, $count); + + if ($count == 0) { + $io->write('No Security.salt placeholder to replace.'); + + return; + } + + $result = file_put_contents($config, $content); + if ($result) { + $io->write('Updated Security.salt value in config/' . $file); + + return; + } + $io->write('Unable to update Security.salt value.'); + } + + /** + * Set the APP_NAME value in a given file + * + * @param string $dir The application's root directory. + * @param \Composer\IO\IOInterface $io IO interface to write to console. + * @param string $appName app name to set in the file + * @param string $file A path to a file relative to the application's root + * @return void + */ + public static function setAppNameInFile(string $dir, IOInterface $io, string $appName, string $file): void + { + $config = $dir . '/config/' . $file; + $content = file_get_contents($config); + if ($content === false) { + $io->write('Config file not readable or not found: config/' . $file); + + return; + } + + $content = str_replace('__APP_NAME__', $appName, $content, $count); + + if ($count == 0) { + $io->write('No __APP_NAME__ placeholder to replace.'); + + return; + } + + $result = file_put_contents($config, $content); + if ($result) { + $io->write('Updated __APP_NAME__ value in config/' . $file); + + return; + } + $io->write('Unable to update __APP_NAME__ value.'); + } +} diff --git a/src/Controller/AdminAppController.php b/src/Controller/AdminAppController.php new file mode 100644 index 0000000..c6bd691 --- /dev/null +++ b/src/Controller/AdminAppController.php @@ -0,0 +1,107 @@ +poll and $this->token. + */ +abstract class AdminAppController extends AppController +{ + protected PollsTable $Polls; + + protected Poll $poll; + + protected string $token; + + /** + * @return void + */ + public function initialize(): void + { + parent::initialize(); + /** @var \App\Model\Table\PollsTable $polls */ + $polls = $this->fetchTable('Polls'); + $this->Polls = $polls; + } + + /** + * @param \Cake\Event\EventInterface<\Cake\Controller\Controller> $event Event + * @return void + */ + public function beforeFilter(EventInterface $event): void + { + parent::beforeFilter($event); + + $this->token = (string)$this->request->getParam('token'); + /** @var \App\Model\Entity\Poll|null $poll */ + $poll = $this->Polls->find('byAdminToken', token: $this->token)->first(); + if ($poll === null) { + throw new NotFoundException(__('Diese Admin-URL ist ungültig.')); + } + $this->poll = $poll; + + // Track usage at most every 10 minutes to avoid a write per request. + if ($poll->last_admin_access === null || $poll->last_admin_access->wasWithinLast('10 minutes') === false) { + $this->Polls->updateAll(['last_admin_access' => DateTime::now()], ['id' => $poll->id]); + } + + $this->set('poll', $poll); + $this->set('adminToken', $this->token); + } + + /** + * The token is part of the URL: never send it as referrer, never index it, never cache it. + * + * @param \Cake\Event\EventInterface<\Cake\Controller\Controller> $event Event + * @return void + */ + public function beforeRender(EventInterface $event): void + { + parent::beforeRender($event); + $this->response = $this->protect($this->response); + } + + /** + * @param \Cake\Http\Response $response Response + * @return \Cake\Http\Response + */ + protected function protect(Response $response): Response + { + return $response + ->withHeader('Referrer-Policy', 'no-referrer') + ->withHeader('X-Robots-Tag', 'noindex, nofollow') + ->withHeader('Cache-Control', 'no-store, private'); + } + + /** + * @inheritDoc + */ + protected function json(array $data, int $status = 200): Response + { + return $this->protect(parent::json($data, $status)); + } + + /** + * URL array for a named admin route of the current poll. + * + * @param string $name Route name + * @param array $params Extra params + * @return array + */ + protected function adminUrl(string $name = 'admin', array $params = []): array + { + return ['_name' => $name, 'token' => $this->token] + $params; + } +} diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php new file mode 100644 index 0000000..c4ea776 --- /dev/null +++ b/src/Controller/AdminController.php @@ -0,0 +1,308 @@ +fetchTable('Slides'); + $this->Slides = $slides; + /** @var \App\Model\Table\ResponsesTable $responses */ + $responses = $this->fetchTable('Responses'); + $this->Responses = $responses; + } + + /** + * Dashboard: settings + slide list. + * + * @return void + */ + public function index(): void + { + $slides = $this->Slides->listForPoll($this->poll->id); + $responseCounts = $this->Responses->countParticipantsPerSlide($this->poll->id); + $typeLabels = Slide::typeLabels(); + $typeDescriptions = Slide::typeDescriptions(); + $joinUrl = Router::url(['_name' => 'participate', 'code' => $this->poll->join_code], true); + + $this->set(compact('slides', 'responseCounts', 'typeLabels', 'typeDescriptions', 'joinUrl')); + } + + /** + * @return \Cake\Http\Response|null + */ + public function settings(): ?Response + { + $this->request->allowMethod(['post']); + $this->Polls->patchEntity($this->poll, (array)$this->request->getData(), [ + 'fields' => ['title', 'is_active', 'show_results_to_participants'], + ]); + if ($this->Polls->save($this->poll)) { + $this->Flash->success(__('Einstellungen gespeichert.')); + } else { + $this->Flash->error(__('Die Einstellungen konnten nicht gespeichert werden.')); + } + + return $this->redirect($this->adminUrl()); + } + + /** + * Invalidates the current admin link and mails a new one. + * + * @return \Cake\Http\Response|null + */ + public function rotateToken(): ?Response + { + $this->request->allowMethod(['post']); + $token = $this->Polls->assignNewToken($this->poll); + $this->Polls->saveOrFail($this->poll); + $this->token = $token; + + $adminUrl = Router::url($this->adminUrl(), true); + $joinUrl = Router::url(['_name' => 'participate', 'code' => $this->poll->join_code], true); + try { + (new PollMailer())->send('adminLink', [$this->poll, $adminUrl, $joinUrl]); + $this->Flash->success(__('Neuer Admin-Link erstellt und per E-Mail verschickt. Der alte Link ist ab sofort ungültig – speichere dir diese Seite als Lesezeichen.')); + } catch (Throwable $e) { + Log::error('Mail delivery failed: ' . $e->getMessage()); + $this->Flash->warning(__('Neuer Admin-Link erstellt, die E-Mail konnte aber nicht verschickt werden. Speichere dir diese Seite unbedingt als Lesezeichen!')); + } + + return $this->redirect($this->adminUrl()); + } + + /** + * Deletes the whole poll incl. slides and responses. + * + * @return \Cake\Http\Response|null + */ + public function delete(): ?Response + { + $this->request->allowMethod(['post']); + $confirm = strtoupper(trim((string)$this->request->getData('confirm_code'))); + if ($confirm !== $this->poll->join_code) { + $this->Flash->error(__('Zum Löschen bitte den Teilnahme-Code {0} eingeben.', $this->poll->join_code)); + + return $this->redirect($this->adminUrl()); + } + + $this->Polls->deleteOrFail($this->poll); + $this->Flash->success(__('Die Umfrage „{0}“ wurde gelöscht.', $this->poll->title)); + + return $this->redirect(['_name' => 'home']); + } + + /** + * Full screen presenter mode. + * + * @return void + */ + public function present(): void + { + if ($this->poll->current_slide_id === null) { + $first = $this->Slides->find() + ->where(['poll_id' => $this->poll->id]) + ->orderBy(['position' => 'ASC', 'id' => 'ASC']) + ->first(); + if ($first !== null) { + $this->poll->current_slide_id = $first->id; + $this->Polls->saveOrFail($this->poll); + } + } + + $this->viewBuilder()->setLayout('present'); + $this->set('joinUrl', Router::url(['_name' => 'participate', 'code' => $this->poll->join_code], true)); + $this->set('joinBaseUrl', Router::url(['_name' => 'join:short'], true)); + $this->set('pollIntervalMs', (int)Configure::read('Plenario.pollIntervalMs', 2000)); + } + + /** + * JSON state for the presenter screen. + * + * @return \Cake\Http\Response + */ + public function state(): Response + { + return $this->json((new PollStateService())->forPresenter($this->poll)); + } + + /** + * Presenter controls. Field `action`: + * goto (+ slide_id), next, prev, open, close, toggle, stop + * + * Answers with the new state as JSON for XHR requests, otherwise redirects back. + * + * @return \Cake\Http\Response|null + */ + public function control(): ?Response + { + $this->request->allowMethod(['post']); + $action = (string)$this->request->getData('action'); + $slides = $this->Slides->listForPoll($this->poll->id); + $ids = array_map(fn(Slide $s) => $s->id, $slides); + $index = array_search($this->poll->current_slide_id, $ids, true); + + switch ($action) { + case 'goto': + $target = (int)$this->request->getData('slide_id'); + if (!in_array($target, $ids, true)) { + throw new BadRequestException('Unknown slide'); + } + $this->poll->current_slide_id = $target; + break; + case 'next': + case 'prev': + if ($ids !== []) { + $index = $index === false ? 0 : $index + ($action === 'next' ? 1 : -1); + $this->poll->current_slide_id = $ids[max(0, min(count($ids) - 1, $index))]; + } + break; + case 'stop': + $this->poll->current_slide_id = null; + break; + case 'open': + case 'close': + case 'toggle': + if ($index !== false) { + $slide = $slides[$index]; + $slide->is_voting_open = match ($action) { + 'open' => true, + 'close' => false, + default => !$slide->is_voting_open, + }; + $this->Slides->saveOrFail($slide); + } + break; + default: + throw new BadRequestException('Unknown action'); + } + $this->Polls->saveOrFail($this->poll); + + if ($this->request->is('json') || $this->request->is('ajax')) { + return $this->json((new PollStateService())->forPresenter($this->poll)); + } + + return $this->redirect($this->referer($this->adminUrl(), true)); + } + + /** + * QR code (SVG) with the participant URL. + * + * @return \Cake\Http\Response + */ + public function qr(): Response + { + $url = Router::url(['_name' => 'participate', 'code' => $this->poll->join_code], true); + $options = new QROptions([ + 'outputInterface' => QRMarkupSVG::class, + 'outputBase64' => false, + 'svgAddXmlHeader' => true, + 'addQuietzone' => true, + 'quietzoneSize' => 2, + 'drawLightModules' => false, + ]); + $svg = (new QRCode($options))->render($url); + + return $this->protect($this->response) + ->withType('image/svg+xml') + ->withHeader('Cache-Control', 'private, max-age=3600') + ->withStringBody((string)$svg); + } + + /** + * CSV export of all responses (semicolon separated, UTF-8 with BOM for Excel). + * + * @return \Cake\Http\Response + */ + public function export(): Response + { + $slides = $this->Slides->listForPoll($this->poll->id); + $handle = fopen('php://temp', 'r+'); + assert($handle !== false); + fwrite($handle, "\xEF\xBB\xBF"); + fputcsv($handle, ['Folie', 'Typ', 'Frage', 'Teilnehmer (anonym)', 'Antwort', 'Zeitpunkt'], ';', '"', ''); + + foreach ($slides as $position => $slide) { + if (!$slide->isInteractive()) { + continue; + } + $labels = []; + foreach ($slide->slide_options ?? [] as $option) { + $labels[$option->id] = $option->label; + } + $responses = $this->Responses->find() + ->where(['slide_id' => $slide->id]) + ->orderBy(['id' => 'ASC']) + ->all(); + foreach ($responses as $response) { + $answer = match (true) { + $response->slide_option_id !== null => $labels[$response->slide_option_id] ?? '', + $response->text_value !== null && $response->numeric_value === VoteService::DOWNVOTE + => __('Downvote: {0}', $response->text_value), + $response->numeric_value !== null => (string)$response->numeric_value, + default => (string)$response->text_value, + }; + fputcsv($handle, [ + $position + 1, + $slide->typeLabel(), + $slide->question, + substr($response->participant_hash, 0, 8), + $this->csvSafe($answer), + $response->created->i18nFormat('yyyy-MM-dd HH:mm:ss'), + ], ';', '"', ''); + } + } + rewind($handle); + $csv = (string)stream_get_contents($handle); + fclose($handle); + + $filename = 'plenario-' . $this->poll->join_code . '-' . date('Ymd') . '.csv'; + + return $this->protect($this->response) + ->withType('csv') + ->withCharset('UTF-8') + ->withDownload($filename) + ->withStringBody($csv); + } + + /** + * Prevents CSV/formula injection in spreadsheet programs. + * + * @param string $value Cell value + * @return string + */ + protected function csvSafe(string $value): string + { + return preg_match('/^[=+\-@\t\r]/', $value) ? "'" . $value : $value; + } +} diff --git a/src/Controller/AppController.php b/src/Controller/AppController.php new file mode 100644 index 0000000..6606c28 --- /dev/null +++ b/src/Controller/AppController.php @@ -0,0 +1,56 @@ +loadComponent('Flash'); + } + + /** + * Security headers for every HTML response. + * + * @param \Cake\Event\EventInterface<\Cake\Controller\Controller> $event Event + * @return void + */ + public function beforeRender(EventInterface $event): void + { + parent::beforeRender($event); + + $this->response = $this->response + ->withHeader('X-Content-Type-Options', 'nosniff') + ->withHeader('X-Frame-Options', 'SAMEORIGIN') + ->withHeader('Referrer-Policy', 'same-origin'); + } + + /** + * Returns a JSON response without going through the view layer. + * + * @param array $data Payload + * @param int $status HTTP status + * @return \Cake\Http\Response + */ + protected function json(array $data, int $status = 200): Response + { + return $this->response + ->withStatus($status) + ->withType('application/json') + ->withHeader('Cache-Control', 'no-store') + ->withStringBody((string)json_encode($data, JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR)); + } +} diff --git a/src/Controller/Component/.gitkeep b/src/Controller/Component/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/Controller/ErrorController.php b/src/Controller/ErrorController.php new file mode 100644 index 0000000..eaca059 --- /dev/null +++ b/src/Controller/ErrorController.php @@ -0,0 +1,70 @@ + $event Event. + * @return void + */ + public function beforeFilter(EventInterface $event): void + { + } + + /** + * beforeRender callback. + * + * @param \Cake\Event\EventInterface<\Cake\Controller\Controller> $event Event. + * @return void + */ + public function beforeRender(EventInterface $event): void + { + parent::beforeRender($event); + + $this->viewBuilder()->setTemplatePath('Error'); + } + + /** + * afterFilter callback. + * + * @param \Cake\Event\EventInterface<\Cake\Controller\Controller> $event Event. + * @return void + */ + public function afterFilter(EventInterface $event): void + { + } +} diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php new file mode 100644 index 0000000..169be55 --- /dev/null +++ b/src/Controller/HomeController.php @@ -0,0 +1,229 @@ +fetchTable('Polls'); + $this->Polls = $polls; + } + + /** + * Start page with "create poll" and "join" forms. + * + * @return void + */ + public function index(): void + { + $poll = $this->Polls->newEmptyEntity(); + $captcha = CaptchaFactory::create('create')->challenge($this->request); + $this->set(compact('poll', 'captcha')); + } + + /** + * Creates a poll and mails the admin link. + * + * @return \Cake\Http\Response|null + */ + public function create(): ?Response + { + $this->request->allowMethod(['post']); + $captcha = CaptchaFactory::create('create'); + + $poll = $this->Polls->newEmptyEntity(); + $poll = $this->Polls->patchEntity($poll, (array)$this->request->getData(), ['fields' => ['title', 'email']]); + + if (!$captcha->verify($this->request)) { + $this->Flash->error(__('Die Sicherheitsabfrage war nicht korrekt. Bitte versuche es erneut.')); + } elseif (!$poll->hasErrors() && !$this->throttle('create', 'Plenario.throttle.createPerHour')) { + $this->Flash->error(__('Zu viele Umfragen in kurzer Zeit. Bitte versuche es später noch einmal.')); + } elseif (!$poll->hasErrors()) { + [$poll, $token] = $this->Polls->createPoll((array)$this->request->getData()); + if ($token !== null) { + $adminUrl = Router::url(['_name' => 'admin', 'token' => $token], true); + $joinUrl = Router::url(['_name' => 'participate', 'code' => $poll->join_code], true); + $sent = $this->sendMail(fn(PollMailer $mailer) => $mailer->send('adminLink', [$poll, $adminUrl, $joinUrl])); + + $session = $this->request->getSession(); + $session->write('Plenario.created', [ + 'email' => $poll->email, + 'title' => $poll->title, + 'mailSent' => $sent, + 'adminUrl' => Configure::read('Plenario.showAdminLinkAfterCreate') ? $adminUrl : null, + ]); + + return $this->redirect(['_name' => 'created']); + } + $this->Flash->error(__('Die Umfrage konnte nicht angelegt werden.')); + } + + // Re-render the start page with errors. + $this->set('poll', $poll); + $this->set('captcha', $captcha->challenge($this->request)); + $this->render('index'); + + return null; + } + + /** + * Confirmation page after creating a poll. + * + * @return \Cake\Http\Response|null + */ + public function created(): ?Response + { + $created = $this->request->getSession()->consume('Plenario.created'); + if (!is_array($created)) { + return $this->redirect(['_name' => 'home']); + } + $this->set('created', $created); + + return null; + } + + /** + * Join by code: GET /join?code=XYZ or POST from the start page form. + * + * @return \Cake\Http\Response|null + */ + public function join(): ?Response + { + $code = (string)($this->request->getData('code') ?? $this->request->getQuery('code') ?? ''); + if ($code === '') { + $this->set('code', ''); + + return null; + } + + $poll = $this->Polls->find('byJoinCode', code: $code)->first(); + if ($poll === null) { + $this->Flash->error(__('Zu diesem Code wurde keine Umfrage gefunden.')); + $this->set('code', $code); + + return null; + } + + return $this->redirect(['_name' => 'participate', 'code' => $poll->join_code]); + } + + /** + * Sends all admin links of an e-mail address. Always answers with the same + * message to avoid leaking which addresses exist. + * + * @return \Cake\Http\Response|null + */ + public function recover(): ?Response + { + $captcha = CaptchaFactory::create('recover'); + + if ($this->request->is('post')) { + $email = strtolower(trim((string)$this->request->getData('email'))); + if (!$captcha->verify($this->request)) { + $this->Flash->error(__('Die Sicherheitsabfrage war nicht korrekt. Bitte versuche es erneut.')); + } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { + $this->Flash->error(__('Bitte gib eine gültige E-Mail-Adresse ein.')); + } elseif (!$this->throttle('recover', 'Plenario.throttle.recoverPerHour')) { + $this->Flash->error(__('Zu viele Anfragen. Bitte versuche es später noch einmal.')); + } else { + $this->sendRecoveryMail($email); + $this->Flash->success(__( + 'Falls zu {0} Umfragen existieren, haben wir dir die Admin-Links per E-Mail geschickt.', + $email, + )); + + return $this->redirect(['_name' => 'recover']); + } + } + + $this->set('captcha', $captcha->challenge($this->request)); + + return null; + } + + /** + * @param string $email Normalised e-mail + * @return void + */ + protected function sendRecoveryMail(string $email): void + { + /** @var list<\App\Model\Entity\Poll> $polls */ + $polls = $this->Polls->find() + ->where(['email' => $email]) + ->orderBy(['created' => 'DESC']) + ->limit(50) + ->all() + ->toList(); + + $links = []; + foreach ($polls as $poll) { + $token = $this->Polls->decryptToken($poll); + if ($token === null) { + continue; + } + $links[] = [ + 'title' => $poll->title, + 'url' => Router::url(['_name' => 'admin', 'token' => $token], true), + 'created' => $poll->created->i18nFormat('dd.MM.yyyy HH:mm'), + ]; + } + if ($links !== []) { + $this->sendMail(fn(PollMailer $mailer) => $mailer->send('recovery', [$email, $links])); + } + } + + /** + * @param string $bucket Throttle bucket + * @param string $configKey Configure key holding the hourly limit + * @return bool + */ + protected function throttle(string $bucket, string $configKey): bool + { + return (new ThrottleService())->attempt( + $bucket, + (string)$this->request->clientIp(), + (int)Configure::read($configKey, 0), + ); + } + + /** + * Sends a mail and logs (instead of throwing) transport errors. + * + * @param callable(\App\Mailer\PollMailer): mixed $send Callback + * @return bool + */ + protected function sendMail(callable $send): bool + { + try { + $send(new PollMailer()); + + return true; + } catch (Throwable $e) { + Log::error('Mail delivery failed: ' . $e->getMessage()); + + return false; + } + } +} diff --git a/src/Controller/ParticipateController.php b/src/Controller/ParticipateController.php new file mode 100644 index 0000000..1ef7095 --- /dev/null +++ b/src/Controller/ParticipateController.php @@ -0,0 +1,168 @@ +fetchTable('Polls'); + $this->Polls = $polls; + } + + /** + * @param \Cake\Event\EventInterface<\Cake\Controller\Controller> $event Event + * @return void + */ + public function beforeFilter(EventInterface $event): void + { + parent::beforeFilter($event); + + $pid = (string)$this->request->getCookie(self::COOKIE, ''); + if (!preg_match('/^[a-f0-9]{32}$/', $pid)) { + $pid = bin2hex(random_bytes(16)); + $this->newParticipant = true; + } + $this->participantId = $pid; + } + + /** + * @param \Cake\Event\EventInterface<\Cake\Controller\Controller> $event Event + * @return void + */ + public function afterFilter(EventInterface $event): void + { + parent::afterFilter($event); + if ($this->newParticipant) { + $this->response = $this->response->withCookie(Cookie::create(self::COOKIE, $this->participantId, [ + 'expires' => new DateTime('+1 year'), + 'path' => '/', + 'httponly' => true, + 'secure' => $this->request->is('https'), + 'samesite' => 'Lax', + ])); + } + } + + /** + * @param string $code Join code + * @return void + */ + public function view(string $code): void + { + $poll = $this->loadPoll($code); + $stateService = new PollStateService(); + $slide = $poll->is_active ? $stateService->currentSlide($poll) : null; + $state = $stateService->forParticipant($poll, $this->participantHash($poll)); + + $this->set(compact('poll', 'slide', 'state')); + $this->set('pollIntervalMs', (int)Configure::read('Plenario.pollIntervalMs', 2000)); + } + + /** + * @param string $code Join code + * @return \Cake\Http\Response + */ + public function state(string $code): Response + { + $poll = $this->loadPoll($code); + + return $this->json((new PollStateService())->forParticipant($poll, $this->participantHash($poll))); + } + + /** + * Stores an answer. AJAX requests (word cloud entries and upvotes) get JSON + * `{ok, message, state}` instead of a redirect with flash message. + * + * @param string $code Join code + * @return \Cake\Http\Response|null + */ + public function vote(string $code): ?Response + { + $this->request->allowMethod(['post']); + $poll = $this->loadPoll($code); + $stateService = new PollStateService(); + $slide = $stateService->currentSlide($poll); + $submittedSlideId = (int)$this->request->getData('slide_id'); + $ajax = $this->request->is('ajax'); + + try { + if ($slide === null || $slide->id !== $submittedSlideId) { + throw new VoteException(__('Diese Frage ist nicht mehr aktiv.')); + } + (new VoteService())->submit($poll, $slide, $this->participantHash($poll), (array)$this->request->getData()); + $ok = true; + $message = __('Danke für deine Antwort!'); + } catch (VoteException $e) { + $ok = false; + $message = $e->getMessage(); + } + + if ($ajax) { + return $this->json([ + 'ok' => $ok, + 'message' => $message, + 'state' => $stateService->forParticipant($poll, $this->participantHash($poll)), + ]); + } + $ok ? $this->Flash->success($message) : $this->Flash->error($message); + + return $this->redirect(['_name' => 'participate', 'code' => $poll->join_code]); + } + + /** + * @param string $code Join code + * @return \App\Model\Entity\Poll + */ + protected function loadPoll(string $code): Poll + { + /** @var \App\Model\Entity\Poll|null $poll */ + $poll = $this->Polls->find('byJoinCode', code: $code)->first(); + if ($poll === null) { + throw new NotFoundException(__('Zu diesem Code wurde keine Umfrage gefunden.')); + } + + return $poll; + } + + /** + * @param \App\Model\Entity\Poll $poll Poll + * @return string + */ + protected function participantHash(Poll $poll): string + { + return VoteService::participantHash($this->participantId, $poll->id); + } +} diff --git a/src/Controller/SlidesController.php b/src/Controller/SlidesController.php new file mode 100644 index 0000000..cba4fbc --- /dev/null +++ b/src/Controller/SlidesController.php @@ -0,0 +1,191 @@ +fetchTable('Slides'); + $this->Slides = $slides; + } + + /** + * @return \Cake\Http\Response|null + */ + public function add(): ?Response + { + $type = (string)($this->request->getData('type') ?? $this->request->getQuery('type', Slide::TYPE_CHOICE)); + if (!array_key_exists($type, Slide::typeLabels())) { + $type = Slide::TYPE_CHOICE; + } + $slide = $this->Slides->newEntity(['type' => $type, 'settings' => Slide::DEFAULT_SETTINGS[$type]], [ + 'validate' => false, + ]); + $slide->setNew(true); + $slide->poll_id = $this->poll->id; + $optionsText = $type === Slide::TYPE_CHOICE ? "\n" : ''; + + if ($this->request->is('post')) { + $optionsText = (string)$this->request->getData('options_text', ''); + if ($this->saveSlide($slide, $optionsText)) { + $this->Flash->success(__('Folie angelegt.')); + + return $this->redirect($this->adminUrl()); + } + } + + $this->set(compact('slide', 'optionsText')); + $this->render('form'); + + return null; + } + + /** + * @param string $id Slide id + * @return \Cake\Http\Response|null + */ + public function edit(string $id): ?Response + { + $slide = $this->loadSlide($id); + $optionsText = implode("\n", array_map(fn($o) => $o->label, $slide->slide_options ?? [])); + + if ($this->request->is(['post', 'put', 'patch'])) { + $optionsText = (string)$this->request->getData('options_text', ''); + if ($this->saveSlide($slide, $optionsText)) { + $this->Flash->success(__('Folie gespeichert.')); + + return $this->redirect($this->adminUrl()); + } + } + + $hasResponses = $this->Slides->Responses->exists(['slide_id' => $slide->id]); + $this->set(compact('slide', 'optionsText', 'hasResponses')); + $this->render('form'); + + return null; + } + + /** + * @param string $id Slide id + * @return \Cake\Http\Response|null + */ + public function delete(string $id): ?Response + { + $this->request->allowMethod(['post']); + $slide = $this->loadSlide($id); + if ($this->poll->current_slide_id === $slide->id) { + $this->poll->current_slide_id = null; + $this->Polls->saveOrFail($this->poll); + } + $this->Slides->deleteOrFail($slide); + $this->Slides->normalizePositions($this->poll->id); + $this->Flash->success(__('Folie gelöscht.')); + + return $this->redirect($this->adminUrl()); + } + + /** + * @param string $id Slide id + * @param string $direction up|down + * @return \Cake\Http\Response|null + */ + public function move(string $id, string $direction): ?Response + { + $this->request->allowMethod(['post']); + $this->Slides->move($this->loadSlide($id), $direction); + + return $this->redirect($this->adminUrl()); + } + + /** + * Deletes all responses of a slide. + * + * @param string $id Slide id + * @return \Cake\Http\Response|null + */ + public function reset(string $id): ?Response + { + $this->request->allowMethod(['post']); + $slide = $this->loadSlide($id); + $this->Slides->Responses->deleteAll(['slide_id' => $slide->id]); + $this->Flash->success(__('Antworten der Folie „{0}“ wurden gelöscht.', $slide->question)); + + return $this->redirect($this->adminUrl()); + } + + /** + * Loads a slide that belongs to the current poll (404 otherwise). + * + * @param string $id Slide id + * @return \App\Model\Entity\Slide + */ + protected function loadSlide(string $id): Slide + { + /** @var \App\Model\Entity\Slide|null $slide */ + $slide = $this->Slides->find() + ->where(['Slides.id' => (int)$id, 'Slides.poll_id' => $this->poll->id]) + ->contain(['SlideOptions']) + ->first(); + if ($slide === null) { + throw new NotFoundException(__('Folie nicht gefunden.')); + } + + return $slide; + } + + /** + * Patches and saves a slide incl. its options. + * + * @param \App\Model\Entity\Slide $slide Slide (new or existing) + * @param string $optionsText Options textarea (choice slides) + * @return bool + */ + protected function saveSlide(Slide $slide, string $optionsText): bool + { + $data = (array)$this->request->getData(); + // The type of an existing slide cannot change (would invalidate responses). + $data['type'] = $slide->type; + $this->Slides->patchEntity($slide, $data, [ + 'fields' => ['type', 'question', 'description', 'settings', 'is_voting_open'], + 'associated' => [], + ]); + + $labels = SlidesTable::parseOptionLines($optionsText); + if ($slide->type === Slide::TYPE_CHOICE && count($labels) < 2) { + $slide->setError('options_text', __('Bitte gib mindestens zwei Antwortoptionen an (eine pro Zeile).')); + } + if ($slide->hasErrors()) { + $this->Flash->error(__('Bitte prüfe deine Eingaben.')); + + return false; + } + + return (bool)$this->Slides->getConnection()->transactional(function () use ($slide, $labels): bool { + if (!$this->Slides->save($slide)) { + return false; + } + if ($slide->type === Slide::TYPE_CHOICE) { + $this->Slides->syncOptions($slide, $labels); + } + + return true; + }); + } +} diff --git a/src/Mailer/PollMailer.php b/src/Mailer/PollMailer.php new file mode 100644 index 0000000..d13e25f --- /dev/null +++ b/src/Mailer/PollMailer.php @@ -0,0 +1,50 @@ +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 $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'); + } +} diff --git a/src/Mailer/Transport/FileTransport.php b/src/Mailer/Transport/FileTransport.php new file mode 100644 index 0000000..96afa02 --- /dev/null +++ b/src/Mailer/Transport/FileTransport.php @@ -0,0 +1,48 @@ + + */ + 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]; + } +} diff --git a/src/Middleware/HostHeaderMiddleware.php b/src/Middleware/HostHeaderMiddleware.php new file mode 100644 index 0000000..e6ab578 --- /dev/null +++ b/src/Middleware/HostHeaderMiddleware.php @@ -0,0 +1,58 @@ +handle($request); + } + + $fullBaseUrl = Configure::read('App.fullBaseUrl'); + if (!$fullBaseUrl) { + throw new InternalErrorException( + 'SECURITY: App.fullBaseUrl is not configured. ' . + 'This is required in production to prevent Host Header Injection attacks. ' . + 'Set APP_FULL_BASE_URL environment variable or configure App.fullBaseUrl in config/app.php', + ); + } + + $configuredHost = parse_url($fullBaseUrl, PHP_URL_HOST); + $requestHost = $request->getUri()->getHost(); + + if ($configuredHost && $requestHost && strtolower($configuredHost) !== strtolower($requestHost)) { + throw new BadRequestException( + 'Invalid Host header. Request host does not match configured application host.', + ); + } + + return $handler->handle($request); + } +} diff --git a/src/Model/Behavior/.gitkeep b/src/Model/Behavior/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/Model/Entity/.gitkeep b/src/Model/Entity/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/Model/Entity/Poll.php b/src/Model/Entity/Poll.php new file mode 100644 index 0000000..76e7eb6 --- /dev/null +++ b/src/Model/Entity/Poll.php @@ -0,0 +1,58 @@ + $slides + */ +class Poll extends Entity +{ + /** + * Only harmless fields are mass assignable. Tokens, join code and the + * current slide are always set explicitly in code. + * + * @var array + */ + protected array $_accessible = [ + 'title' => true, + 'email' => true, + 'is_active' => true, + 'show_results_to_participants' => true, + ]; + + /** + * Never leak secrets when an entity is serialised (JSON, debug output). + * + * @var list + */ + protected array $_hidden = [ + 'admin_token_hash', + 'admin_token_encrypted', + 'email', + ]; + + /** + * "K7P2QX" -> "K7P 2QX" for nicer display. + * + * @return string + */ + public function formattedJoinCode(): string + { + return trim(chunk_split($this->join_code, 3, ' ')); + } +} diff --git a/src/Model/Entity/Response.php b/src/Model/Entity/Response.php new file mode 100644 index 0000000..78cf5a6 --- /dev/null +++ b/src/Model/Entity/Response.php @@ -0,0 +1,39 @@ + + */ + protected array $_accessible = [ + 'slide_id' => true, + 'participant_hash' => true, + 'slide_option_id' => true, + 'text_value' => true, + 'numeric_value' => true, + ]; + + /** + * @var list + */ + protected array $_hidden = ['participant_hash']; +} diff --git a/src/Model/Entity/Slide.php b/src/Model/Entity/Slide.php new file mode 100644 index 0000000..9276b27 --- /dev/null +++ b/src/Model/Entity/Slide.php @@ -0,0 +1,126 @@ +|null $settings + * @property bool $is_voting_open + * @property \Cake\I18n\DateTime $created + * @property \Cake\I18n\DateTime $modified + * @property \App\Model\Entity\Poll $poll + * @property array<\App\Model\Entity\SlideOption> $slide_options + * @property array<\App\Model\Entity\Response> $responses + */ +class Slide extends Entity +{ + public const TYPE_CHOICE = 'choice'; + public const TYPE_WORDCLOUD = 'wordcloud'; + public const TYPE_OPEN = 'open'; + public const TYPE_SCALE = 'scale'; + public const TYPE_CONTENT = 'content'; + + /** + * Default settings per type. Unknown keys are dropped on save. + * + * @var array> + */ + public const DEFAULT_SETTINGS = [ + self::TYPE_CHOICE => ['multiple' => false], + // max_words: words per participant incl. upvotes (not downvotes), 0 = unlimited; + // allow_downvotes only takes effect together with allow_upvotes + self::TYPE_WORDCLOUD => ['max_words' => 0, 'allow_upvotes' => true, 'allow_downvotes' => true], + self::TYPE_OPEN => [], + self::TYPE_SCALE => ['scale_min' => 1, 'scale_max' => 5, 'min_label' => '', 'max_label' => ''], + self::TYPE_CONTENT => [], + ]; + + /** + * @var array + */ + protected array $_accessible = [ + 'type' => true, + 'question' => true, + 'description' => true, + 'settings' => true, + 'is_voting_open' => true, + ]; + + /** + * @return array type => human readable label + */ + public static function typeLabels(): array + { + return [ + self::TYPE_CHOICE => __('Multiple Choice'), + self::TYPE_WORDCLOUD => __('Wortwolke'), + self::TYPE_OPEN => __('Offene Frage'), + self::TYPE_SCALE => __('Skala'), + self::TYPE_CONTENT => __('Inhaltsfolie'), + ]; + } + + /** + * @return array type => short description + */ + public static function typeDescriptions(): array + { + return [ + self::TYPE_CHOICE => __('Antwortoptionen vorgeben, Ergebnis als Balkendiagramm.'), + self::TYPE_WORDCLOUD => __('Teilnehmende geben Begriffe ein oder unterstützen vorhandene, häufige werden größer.'), + self::TYPE_OPEN => __('Freitext-Antworten, live als Liste.'), + self::TYPE_SCALE => __('Bewertung auf einer Skala, z. B. 1 bis 5.'), + self::TYPE_CONTENT => __('Nur Text anzeigen, ohne Abstimmung.'), + ]; + } + + /** + * @return string + */ + public function typeLabel(): string + { + return static::typeLabels()[$this->type] ?? $this->type; + } + + /** + * Whether participants can answer this slide at all. + * + * @return bool + */ + public function isInteractive(): bool + { + return $this->type !== self::TYPE_CONTENT; + } + + /** + * Settings merged with the type defaults. + * + * @return array + */ + public function getSettings(): array + { + $defaults = self::DEFAULT_SETTINGS[$this->type] ?? []; + + return array_intersect_key(array_merge($defaults, (array)($this->settings ?? [])), $defaults); + } + + /** + * @param string $key Setting name + * @return mixed + */ + public function setting(string $key): mixed + { + return $this->getSettings()[$key] ?? null; + } +} diff --git a/src/Model/Entity/SlideOption.php b/src/Model/Entity/SlideOption.php new file mode 100644 index 0000000..c9a93ca --- /dev/null +++ b/src/Model/Entity/SlideOption.php @@ -0,0 +1,23 @@ + + */ + protected array $_accessible = [ + 'label' => true, + 'position' => true, + ]; +} diff --git a/src/Model/Table/.gitkeep b/src/Model/Table/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/Model/Table/PollsTable.php b/src/Model/Table/PollsTable.php new file mode 100644 index 0000000..f460308 --- /dev/null +++ b/src/Model/Table/PollsTable.php @@ -0,0 +1,233 @@ + $config The configuration for the Table. + * @return void + */ + public function initialize(array $config): void + { + parent::initialize($config); + + $this->setTable('polls'); + $this->setDisplayField('title'); + $this->setPrimaryKey('id'); + + $this->addBehavior('Timestamp'); + + $this->hasMany('Slides', [ + 'foreignKey' => 'poll_id', + 'sort' => ['Slides.position' => 'ASC', 'Slides.id' => 'ASC'], + 'dependent' => true, + 'cascadeCallbacks' => false, + ]); + } + + /** + * @param \Cake\Validation\Validator $validator Validator instance. + * @return \Cake\Validation\Validator + */ + public function validationDefault(Validator $validator): Validator + { + $validator + ->scalar('title') + ->maxLength('title', 200, __('Der Titel darf maximal 200 Zeichen lang sein.')) + ->requirePresence('title', 'create') + ->notEmptyString('title', __('Bitte gib einen Titel ein.')); + + $validator + ->email('email', false, __('Bitte gib eine gültige E-Mail-Adresse ein.')) + ->maxLength('email', 255) + ->requirePresence('email', 'create') + ->notEmptyString('email', __('Bitte gib deine E-Mail-Adresse ein.')); + + $validator->boolean('is_active'); + $validator->boolean('show_results_to_participants'); + + return $validator; + } + + /** + * @param \Cake\ORM\RulesChecker $rules The rules object to be modified. + * @return \Cake\ORM\RulesChecker + */ + public function buildRules(RulesChecker $rules): RulesChecker + { + $rules->add($rules->isUnique(['join_code']), ['errorField' => 'join_code']); + $rules->add($rules->isUnique(['admin_token_hash']), ['errorField' => 'admin_token_hash']); + + return $rules; + } + + /** + * Creates a new admin token: URL safe, 256 bit entropy. + * + * @return string + */ + public static function generateToken(): string + { + return rtrim(strtr(base64_encode(random_bytes(32)), '+/', '-_'), '='); + } + + /** + * @param string $token Plain admin token + * @return string sha256 hex digest + */ + public static function hashToken(string $token): string + { + return hash('sha256', $token); + } + + /** + * Assigns a fresh admin token to the poll (hash + encrypted copy). + * + * @param \App\Model\Entity\Poll $poll Poll entity + * @return string The plain token (only ever shown in the admin URL / mail) + */ + public function assignNewToken(Poll $poll): string + { + $token = static::generateToken(); + $poll->admin_token_hash = static::hashToken($token); + $poll->admin_token_encrypted = base64_encode(Security::encrypt($token, static::encryptionKey())); + + return $token; + } + + /** + * Decrypts the stored admin token (used by the recovery mail). + * + * @param \App\Model\Entity\Poll $poll Poll entity + * @return string|null + */ + public function decryptToken(Poll $poll): ?string + { + $raw = base64_decode((string)$poll->admin_token_encrypted, true); + if ($raw === false) { + return null; + } + $token = Security::decrypt($raw, static::encryptionKey()); + if ($token === null || static::hashToken($token) !== $poll->admin_token_hash) { + return null; + } + + return $token; + } + + /** + * @return string 32 byte key derived from Security.salt + */ + protected static function encryptionKey(): string + { + return hash('sha256', 'plenario-admin-token|' . Security::getSalt()); + } + + /** + * Generates a join code that is not yet in use. + * + * @return string + */ + public function generateJoinCode(): string + { + $alphabet = self::JOIN_CODE_ALPHABET; + $max = strlen($alphabet) - 1; + for ($attempt = 0; $attempt < 50; $attempt++) { + $code = ''; + for ($i = 0; $i < self::JOIN_CODE_LENGTH; $i++) { + $code .= $alphabet[random_int(0, $max)]; + } + if (!$this->exists(['join_code' => $code])) { + return $code; + } + } + + throw new RuntimeException('Could not generate a unique join code.'); + } + + /** + * Normalises user input like " k7p-2qx " to "K7P2QX". + * + * @param string $code Raw user input + * @return string + */ + public static function normalizeJoinCode(string $code): string + { + return (string)preg_replace('/[^A-Z0-9]/', '', strtoupper($code)); + } + + /** + * Creates and persists a new poll. + * + * @param array $data title + email + * @return array{0: \App\Model\Entity\Poll, 1: string|null} The entity (check getErrors()) and the plain token on success + */ + public function createPoll(array $data): array + { + $poll = $this->newEntity([ + 'title' => trim((string)($data['title'] ?? '')), + 'email' => strtolower(trim((string)($data['email'] ?? ''))), + ], ['fields' => ['title', 'email']]); + + if ($poll->hasErrors()) { + return [$poll, null]; + } + + $token = $this->assignNewToken($poll); + $poll->join_code = $this->generateJoinCode(); + $poll->is_active = true; + $poll->show_results_to_participants = true; + + if (!$this->save($poll)) { + return [$poll, null]; + } + + return [$poll, $token]; + } + + /** + * @param \Cake\ORM\Query\SelectQuery $query Query + * @param string $token Plain admin token + * @return \Cake\ORM\Query\SelectQuery + */ + public function findByAdminToken(SelectQuery $query, string $token): SelectQuery + { + return $query->where(['Polls.admin_token_hash' => static::hashToken($token)]); + } + + /** + * @param \Cake\ORM\Query\SelectQuery $query Query + * @param string $code Join code (will be normalised) + * @return \Cake\ORM\Query\SelectQuery + */ + public function findByJoinCode(SelectQuery $query, string $code): SelectQuery + { + return $query->where(['Polls.join_code' => static::normalizeJoinCode($code)]); + } +} diff --git a/src/Model/Table/ResponsesTable.php b/src/Model/Table/ResponsesTable.php new file mode 100644 index 0000000..820aa2f --- /dev/null +++ b/src/Model/Table/ResponsesTable.php @@ -0,0 +1,139 @@ + $config The configuration for the Table. + * @return void + */ + public function initialize(array $config): void + { + parent::initialize($config); + + $this->setTable('responses'); + $this->setPrimaryKey('id'); + + $this->addBehavior('Timestamp', [ + 'events' => ['Model.beforeSave' => ['created' => 'new']], + ]); + + $this->belongsTo('Slides', ['foreignKey' => 'slide_id', 'joinType' => 'INNER']); + $this->belongsTo('SlideOptions', ['foreignKey' => 'slide_option_id']); + } + + /** + * @param int $slideId Slide id + * @param string $participantHash Participant hash + * @return bool + */ + public function hasResponded(int $slideId, string $participantHash): bool + { + return $this->exists(['slide_id' => $slideId, 'participant_hash' => $participantHash]); + } + + /** + * Word cloud terms a participant named/upvoted and downvoted on a slide. + * + * @param int $slideId Slide id + * @param string $participantHash Participant hash + * @return array{up: list, down: list} raw text values + */ + public function wordVotesOf(int $slideId, string $participantHash): array + { + $rows = $this->find() + ->select(['text_value', 'numeric_value']) + ->where(['slide_id' => $slideId, 'participant_hash' => $participantHash, 'text_value IS NOT' => null]) + ->orderBy(['id' => 'ASC']) + ->disableHydration() + ->all(); + + $votes = ['up' => [], 'down' => []]; + foreach ($rows as $row) { + $votes[(int)$row['numeric_value'] === VoteService::DOWNVOTE ? 'down' : 'up'][] = (string)$row['text_value']; + } + + return $votes; + } + + /** + * Whether anybody named (or upvoted) a word cloud term on a slide. + * + * @param int $slideId Slide id + * @param string $key Word key, see VoteService::wordKey() + * @return bool + */ + public function wordExists(int $slideId, string $key): bool + { + $rows = $this->find() + ->select(['text_value']) + ->where([ + 'slide_id' => $slideId, + 'text_value IS NOT' => null, + 'numeric_value IS' => null, + ]) + ->disableHydration() + ->all(); + foreach ($rows as $row) { + if (VoteService::wordKey((string)$row['text_value']) === $key) { + return true; + } + } + + return false; + } + + /** + * Number of distinct participants that answered a slide. + * + * @param int $slideId Slide id + * @return int + */ + public function countParticipants(int $slideId): int + { + $row = $this->find() + ->select(['n' => $this->find()->func()->count('DISTINCT participant_hash')]) + ->where(['slide_id' => $slideId]) + ->disableHydration() + ->first(); + + return (int)($row['n'] ?? 0); + } + + /** + * Number of responding participants per slide of a poll. + * + * @param int $pollId Poll id + * @return array slide_id => participant count + */ + public function countParticipantsPerSlide(int $pollId): array + { + $rows = $this->find() + ->select([ + 'slide_id' => 'Responses.slide_id', + 'n' => $this->find()->func()->count('DISTINCT Responses.participant_hash'), + ]) + ->innerJoinWith('Slides') + ->where(['Slides.poll_id' => $pollId]) + ->groupBy(['Responses.slide_id']) + ->disableHydration() + ->all(); + + $counts = []; + foreach ($rows as $row) { + $counts[(int)$row['slide_id']] = (int)$row['n']; + } + + return $counts; + } +} diff --git a/src/Model/Table/SlideOptionsTable.php b/src/Model/Table/SlideOptionsTable.php new file mode 100644 index 0000000..5cc2189 --- /dev/null +++ b/src/Model/Table/SlideOptionsTable.php @@ -0,0 +1,45 @@ + $config The configuration for the Table. + * @return void + */ + public function initialize(array $config): void + { + parent::initialize($config); + + $this->setTable('slide_options'); + $this->setDisplayField('label'); + $this->setPrimaryKey('id'); + + $this->belongsTo('Slides', ['foreignKey' => 'slide_id', 'joinType' => 'INNER']); + $this->hasMany('Responses', ['foreignKey' => 'slide_option_id', 'dependent' => true]); + } + + /** + * @param \Cake\Validation\Validator $validator Validator instance. + * @return \Cake\Validation\Validator + */ + public function validationDefault(Validator $validator): Validator + { + $validator + ->scalar('label') + ->maxLength('label', 255) + ->notEmptyString('label'); + + return $validator; + } +} diff --git a/src/Model/Table/SlidesTable.php b/src/Model/Table/SlidesTable.php new file mode 100644 index 0000000..8c9319c --- /dev/null +++ b/src/Model/Table/SlidesTable.php @@ -0,0 +1,281 @@ + $config The configuration for the Table. + * @return void + */ + public function initialize(array $config): void + { + parent::initialize($config); + + $this->setTable('slides'); + $this->setDisplayField('question'); + $this->setPrimaryKey('id'); + + $this->addBehavior('Timestamp'); + $this->getSchema()->setColumnType('settings', 'json'); + + $this->belongsTo('Polls', ['foreignKey' => 'poll_id', 'joinType' => 'INNER']); + $this->hasMany('SlideOptions', [ + 'foreignKey' => 'slide_id', + 'sort' => ['SlideOptions.position' => 'ASC', 'SlideOptions.id' => 'ASC'], + 'dependent' => true, + ]); + $this->hasMany('Responses', [ + 'foreignKey' => 'slide_id', + 'dependent' => true, + ]); + } + + /** + * @param \Cake\Validation\Validator $validator Validator instance. + * @return \Cake\Validation\Validator + */ + public function validationDefault(Validator $validator): Validator + { + $validator + ->inList('type', array_keys(Slide::typeLabels())) + ->requirePresence('type', 'create') + ->notEmptyString('type'); + + $validator + ->scalar('question') + ->maxLength('question', 500, __('Die Frage darf maximal 500 Zeichen lang sein.')) + ->requirePresence('question', 'create') + ->notEmptyString('question', __('Bitte gib eine Frage bzw. Überschrift ein.')); + + $validator + ->scalar('description') + ->maxLength('description', 5000) + ->allowEmptyString('description'); + + $validator->boolean('is_voting_open'); + + return $validator; + } + + /** + * @param \Cake\ORM\RulesChecker $rules The rules object to be modified. + * @return \Cake\ORM\RulesChecker + */ + public function buildRules(RulesChecker $rules): RulesChecker + { + $rules->add($rules->existsIn(['poll_id'], 'Polls'), ['errorField' => 'poll_id']); + + return $rules; + } + + /** + * Normalise settings before they are marshalled into the entity. + * + * @param \Cake\Event\EventInterface<\Cake\ORM\Table> $event Event + * @param \ArrayObject $data Request data + * @param \ArrayObject $options Options + * @return void + */ + public function beforeMarshal(EventInterface $event, ArrayObject $data, ArrayObject $options): void + { + if (isset($data['question']) && is_string($data['question'])) { + $data['question'] = trim($data['question']); + } + if (isset($data['settings']) && is_array($data['settings']) && isset($data['type'])) { + $data['settings'] = static::sanitizeSettings((string)$data['type'], $data['settings']); + } + } + + /** + * Assign the next free position for new slides. + * + * @param \Cake\Event\EventInterface<\Cake\ORM\Table> $event Event + * @param \Cake\Datasource\EntityInterface $entity Slide + * @param \ArrayObject $options Options + * @return void + */ + public function beforeSave(EventInterface $event, EntityInterface $entity, ArrayObject $options): void + { + if ($entity->isNew() && !$entity->has('position')) { + $max = $this->find() + ->where(['poll_id' => $entity->get('poll_id')]) + ->select(['max' => $this->find()->func()->max('position')]) + ->disableHydration() + ->first(); + $entity->set('position', (int)($max['max'] ?? 0) + 1); + } + } + + /** + * Reduces raw settings input to the known keys of the type, with proper types. + * + * @param string $type Slide type + * @param array $input Raw settings + * @return array + */ + public static function sanitizeSettings(string $type, array $input): array + { + $settings = Slide::DEFAULT_SETTINGS[$type] ?? []; + switch ($type) { + case Slide::TYPE_CHOICE: + $settings['multiple'] = filter_var($input['multiple'] ?? false, FILTER_VALIDATE_BOOLEAN); + break; + case Slide::TYPE_WORDCLOUD: + $settings['max_words'] = max(0, min(50, (int)($input['max_words'] ?? 0))); + $settings['allow_upvotes'] = filter_var($input['allow_upvotes'] ?? true, FILTER_VALIDATE_BOOLEAN); + $settings['allow_downvotes'] = filter_var($input['allow_downvotes'] ?? true, FILTER_VALIDATE_BOOLEAN); + break; + case Slide::TYPE_SCALE: + $min = max(0, min(1, (int)($input['scale_min'] ?? 1))); + $max = max(2, min(10, (int)($input['scale_max'] ?? 5))); + $settings['scale_min'] = $min; + $settings['scale_max'] = $max; + $settings['min_label'] = mb_substr(trim((string)($input['min_label'] ?? '')), 0, 60); + $settings['max_label'] = mb_substr(trim((string)($input['max_label'] ?? '')), 0, 60); + break; + } + + return $settings; + } + + /** + * Parses a textarea (one option per line) into a clean list of labels. + * + * @param string $raw Textarea content + * @return list + */ + public static function parseOptionLines(string $raw): array + { + $labels = []; + foreach (preg_split('/\R/', $raw) ?: [] as $line) { + $line = mb_substr(trim($line), 0, 255); + if ($line !== '' && !in_array($line, $labels, true)) { + $labels[] = $line; + } + } + + return array_slice($labels, 0, self::MAX_OPTIONS); + } + + /** + * Synchronises the answer options of a slide with the given labels. + * Options whose label is unchanged keep their id (and therefore their votes); + * removed options are deleted together with their votes. + * + * @param \App\Model\Entity\Slide $slide Saved slide + * @param list $labels New labels in display order + * @return void + */ + public function syncOptions(Slide $slide, array $labels): void + { + $existing = $this->SlideOptions->find() + ->where(['slide_id' => $slide->id]) + ->all() + ->indexBy('label') + ->toArray(); + + $this->getConnection()->transactional(function () use ($slide, $labels, $existing): void { + foreach ($labels as $index => $label) { + $option = $existing[$label] ?? $this->SlideOptions->newEntity(['label' => $label]); + $option->set('slide_id', $slide->id); + $option->set('position', $index + 1); + $this->SlideOptions->saveOrFail($option); + unset($existing[$label]); + } + foreach ($existing as $obsolete) { + $this->SlideOptions->deleteOrFail($obsolete); + } + }); + } + + /** + * Swaps the slide with its neighbour. + * + * @param \App\Model\Entity\Slide $slide Slide to move + * @param string $direction 'up' or 'down' + * @return bool Whether something changed + */ + public function move(Slide $slide, string $direction): bool + { + $this->normalizePositions($slide->poll_id); + $slide = $this->get($slide->id); + + $neighbour = $this->find() + ->where([ + 'poll_id' => $slide->poll_id, + 'position' . ($direction === 'up' ? ' <' : ' >') => $slide->position, + ]) + ->orderBy(['position' => $direction === 'up' ? 'DESC' : 'ASC']) + ->first(); + if ($neighbour === null) { + return false; + } + + return (bool)$this->getConnection()->transactional(function () use ($slide, $neighbour): bool { + $position = $slide->position; + $slide->position = $neighbour->position; + $neighbour->position = $position; + + return $this->save($slide) && $this->save($neighbour); + }); + } + + /** + * Renumbers positions 1..n (closes gaps after deletions). + * + * @param int $pollId Poll id + * @return void + */ + public function normalizePositions(int $pollId): void + { + $slides = $this->find() + ->where(['poll_id' => $pollId]) + ->orderBy(['position' => 'ASC', 'id' => 'ASC']) + ->all(); + $position = 1; + foreach ($slides as $slide) { + if ($slide->position !== $position) { + $this->updateAll(['position' => $position], ['id' => $slide->id]); + } + $position++; + } + } + + /** + * Ordered slides of a poll including options. + * + * @param int $pollId Poll id + * @return list<\App\Model\Entity\Slide> + */ + public function listForPoll(int $pollId): array + { + /** @var list<\App\Model\Entity\Slide> $slides */ + $slides = $this->find() + ->where(['Slides.poll_id' => $pollId]) + ->contain(['SlideOptions']) + ->orderBy(['Slides.position' => 'ASC', 'Slides.id' => 'ASC']) + ->all() + ->toList(); + + return $slides; + } +} diff --git a/src/Service/PollStateService.php b/src/Service/PollStateService.php new file mode 100644 index 0000000..6edc867 --- /dev/null +++ b/src/Service/PollStateService.php @@ -0,0 +1,185 @@ +fetchTable('Slides'); + $this->Slides = $slides; + /** @var \App\Model\Table\ResponsesTable $responses */ + $responses = $this->fetchTable('Responses'); + $this->Responses = $responses; + $this->results = new ResultsService(); + } + + /** + * @param \App\Model\Entity\Poll $poll Poll + * @return \App\Model\Entity\Slide|null + */ + public function currentSlide(Poll $poll): ?Slide + { + if ($poll->current_slide_id === null) { + return null; + } + + /** @var \App\Model\Entity\Slide|null $slide */ + $slide = $this->Slides->find() + ->where(['Slides.id' => $poll->current_slide_id, 'Slides.poll_id' => $poll->id]) + ->contain(['SlideOptions']) + ->first(); + + return $slide; + } + + /** + * @param \App\Model\Entity\Poll $poll Poll + * @return array + */ + public function forPresenter(Poll $poll): array + { + $slides = $this->Slides->listForPoll($poll->id); + $current = null; + $index = null; + foreach ($slides as $i => $slide) { + if ($slide->id === $poll->current_slide_id) { + $current = $slide; + $index = $i; + } + } + + return [ + 'poll' => [ + 'title' => $poll->title, + 'joinCode' => $poll->join_code, + 'joinCodeFormatted' => $poll->formattedJoinCode(), + 'isActive' => $poll->is_active, + ], + 'slides' => array_map(fn(Slide $s) => [ + 'id' => $s->id, + 'type' => $s->type, + 'question' => $s->question, + ], $slides), + 'index' => $index, + 'count' => count($slides), + 'slide' => $current ? $this->slidePayload($current) : null, + 'results' => $current ? $this->results->forSlide($current) : null, + ]; + } + + /** + * @param \App\Model\Entity\Poll $poll Poll + * @param string $participantHash Participant hash + * @return array + */ + public function forParticipant(Poll $poll, string $participantHash): array + { + $slide = $poll->is_active ? $this->currentSlide($poll) : null; + $words = $slide?->type === Slide::TYPE_WORDCLOUD ? $this->wordState($slide, $participantHash) : null; + $hasResponded = $words !== null + ? $words['mine'] !== [] || $words['down'] !== [] + : $slide && $slide->isInteractive() && $this->Responses->hasResponded($slide->id, $participantHash); + + $showResults = $slide !== null + && $slide->isInteractive() + && ( + ($poll->show_results_to_participants && ($hasResponded || !$slide->is_voting_open)) + || ($words !== null && $words['allowUpvotes'] && $slide->is_voting_open) + ); + + return [ + 'isActive' => $poll->is_active, + 'slideId' => $slide?->id, + 'isVotingOpen' => $slide?->is_voting_open ?? false, + 'hasResponded' => $hasResponded, + // Changes whenever the participant page must re-render. + 'version' => implode(':', [ + (int)$poll->is_active, + $slide?->id ?? 0, + (int)($slide?->is_voting_open ?? 0), + // Word clouds are answered word by word without reload. + $words !== null ? (int)$words['limitReached'] : (int)$hasResponded, + $slide?->modified?->toUnixString() ?? 0, + ]), + 'slide' => $showResults ? $this->slidePayload($slide) : null, + 'results' => $showResults ? $this->results->forSlide($slide) : null, + 'words' => $words, + ]; + } + + /** + * Word cloud progress of one participant. + * + * @param \App\Model\Entity\Slide $slide Word cloud slide + * @param string $participantHash Participant hash + * @return array{mine: list, down: list, max: int, remaining: int|null, + * limitReached: bool, allowUpvotes: bool, allowDownvotes: bool} + * `mine` (named/upvoted) and `down` are lower case word keys, `remaining` is null when unlimited + */ + public function wordState(Slide $slide, string $participantHash): array + { + $votes = $this->Responses->wordVotesOf($slide->id, $participantHash); + $mine = array_values(array_unique(array_map(VoteService::wordKey(...), $votes['up']))); + $down = array_values(array_unique(array_map(VoteService::wordKey(...), $votes['down']))); + $max = (int)$slide->setting('max_words'); + $remaining = $max > 0 ? max(0, $max - count($mine)) : null; + $allowUpvotes = (bool)$slide->setting('allow_upvotes'); + + return [ + 'mine' => $mine, + 'down' => $down, + 'max' => $max, + 'remaining' => $remaining, + 'limitReached' => $remaining === 0, + 'allowUpvotes' => $allowUpvotes, + 'allowDownvotes' => $allowUpvotes && (bool)$slide->setting('allow_downvotes'), + ]; + } + + /** + * @param \App\Model\Entity\Slide $slide Slide + * @return array + */ + public function slidePayload(Slide $slide): array + { + return [ + 'id' => $slide->id, + 'type' => $slide->type, + 'typeLabel' => $slide->typeLabel(), + 'question' => $slide->question, + 'description' => (string)$slide->description, + 'isVotingOpen' => $slide->is_voting_open, + 'isInteractive' => $slide->isInteractive(), + 'settings' => $slide->getSettings(), + ]; + } +} diff --git a/src/Service/ResultsService.php b/src/Service/ResultsService.php new file mode 100644 index 0000000..263065f --- /dev/null +++ b/src/Service/ResultsService.php @@ -0,0 +1,198 @@ + string, 'participants' => int, ...] + * - choice: 'options' => [['id', 'label', 'count', 'percent']] + * - wordcloud: 'words' => [['key' (lower case), 'text', 'count', 'down', 'weight' (0..1)]] + * (count = participants who named or upvoted the word, down = downvotes, + * weight follows count) + * - open: 'answers' => [['text', 'created']] newest first + * - scale: 'buckets' => [['value', 'count', 'percent']], 'average' => float|null, + * 'min', 'max', 'minLabel', 'maxLabel' + */ +class ResultsService +{ + use LocatorAwareTrait; + + public const MAX_ANSWERS = 200; + + protected ResponsesTable $Responses; + + /** + * Constructor + */ + public function __construct() + { + /** @var \App\Model\Table\ResponsesTable $responses */ + $responses = $this->fetchTable('Responses'); + $this->Responses = $responses; + } + + /** + * @param \App\Model\Entity\Slide $slide Slide incl. slide_options + * @return array + */ + public function forSlide(Slide $slide): array + { + $result = [ + 'type' => $slide->type, + 'participants' => $slide->isInteractive() ? $this->Responses->countParticipants($slide->id) : 0, + ]; + + return $result + match ($slide->type) { + Slide::TYPE_CHOICE => $this->choice($slide), + Slide::TYPE_WORDCLOUD => $this->wordcloud($slide), + Slide::TYPE_OPEN => $this->open($slide), + Slide::TYPE_SCALE => $this->scale($slide), + default => [], + }; + } + + /** + * @param \App\Model\Entity\Slide $slide Slide + * @return array + */ + protected function choice(Slide $slide): array + { + $counts = $this->Responses->find() + ->select(['slide_option_id', 'n' => $this->Responses->find()->func()->count('*')]) + ->where(['slide_id' => $slide->id, 'slide_option_id IS NOT' => null]) + ->groupBy(['slide_option_id']) + ->disableHydration() + ->all() + ->combine('slide_option_id', 'n') + ->toArray(); + + $total = array_sum(array_map('intval', $counts)); + $options = []; + foreach ($slide->slide_options ?? [] as $option) { + $count = (int)($counts[$option->id] ?? 0); + $options[] = [ + 'id' => $option->id, + 'label' => $option->label, + 'count' => $count, + 'percent' => $total > 0 ? round($count / $total * 100, 1) : 0, + ]; + } + + return ['options' => $options, 'votes' => $total]; + } + + /** + * @param \App\Model\Entity\Slide $slide Slide + * @return array + */ + protected function wordcloud(Slide $slide): array + { + $rows = $this->Responses->find() + ->select(['text_value', 'numeric_value']) + ->where(['slide_id' => $slide->id, 'text_value IS NOT' => null]) + ->disableHydration() + ->all(); + + // Group case-insensitively, display the most frequent spelling. + $groups = []; + $downvotes = []; + foreach ($rows as $row) { + $text = (string)$row['text_value']; + $key = VoteService::wordKey($text); + if ((int)$row['numeric_value'] === VoteService::DOWNVOTE) { + $downvotes[$key] = ($downvotes[$key] ?? 0) + 1; + continue; + } + $groups[$key]['count'] = ($groups[$key]['count'] ?? 0) + 1; + $groups[$key]['spellings'][$text] = ($groups[$key]['spellings'][$text] ?? 0) + 1; + } + // Size follows the upvotes (count); downvotes are shown separately. + uasort($groups, fn($a, $b) => $b['count'] <=> $a['count']); + + $maxCount = $groups === [] ? 1 : max(array_column($groups, 'count')); + $words = []; + foreach ($groups as $key => $group) { + arsort($group['spellings']); + $words[] = [ + 'key' => (string)$key, + 'text' => (string)array_key_first($group['spellings']), + 'count' => $group['count'], + 'down' => $downvotes[$key] ?? 0, + 'weight' => round($group['count'] / $maxCount, 3), + ]; + } + + return ['words' => $words]; + } + + /** + * @param \App\Model\Entity\Slide $slide Slide + * @return array + */ + protected function open(Slide $slide): array + { + $rows = $this->Responses->find() + ->select(['text_value', 'created']) + ->where(['slide_id' => $slide->id, 'text_value IS NOT' => null]) + ->orderBy(['id' => 'DESC']) + ->limit(self::MAX_ANSWERS) + ->all(); + + $answers = []; + foreach ($rows as $row) { + $answers[] = ['text' => $row->text_value, 'created' => $row->created->toIso8601String()]; + } + + return ['answers' => $answers]; + } + + /** + * @param \App\Model\Entity\Slide $slide Slide + * @return array + */ + protected function scale(Slide $slide): array + { + $min = (int)$slide->setting('scale_min'); + $max = (int)$slide->setting('scale_max'); + $counts = $this->Responses->find() + ->select(['numeric_value', 'n' => $this->Responses->find()->func()->count('*')]) + ->where(['slide_id' => $slide->id, 'numeric_value IS NOT' => null]) + ->groupBy(['numeric_value']) + ->disableHydration() + ->all() + ->combine('numeric_value', 'n') + ->toArray(); + + $total = 0; + $sum = 0; + foreach ($counts as $value => $count) { + $total += (int)$count; + $sum += (int)$value * (int)$count; + } + $buckets = []; + for ($value = $min; $value <= $max; $value++) { + $count = (int)($counts[$value] ?? 0); + $buckets[] = [ + 'value' => $value, + 'count' => $count, + 'percent' => $total > 0 ? round($count / $total * 100, 1) : 0, + ]; + } + + return [ + 'buckets' => $buckets, + 'average' => $total > 0 ? round($sum / $total, 2) : null, + 'min' => $min, + 'max' => $max, + 'minLabel' => (string)$slide->setting('min_label'), + 'maxLabel' => (string)$slide->setting('max_label'), + ]; + } +} diff --git a/src/Service/ThrottleService.php b/src/Service/ThrottleService.php new file mode 100644 index 0000000..b710fe8 --- /dev/null +++ b/src/Service/ThrottleService.php @@ -0,0 +1,45 @@ + $now, 'hits' => 0]; + } + if ($state['hits'] >= $limit) { + return false; + } + $state['hits']++; + Cache::write($key, $state, 'throttle'); + + return true; + } +} diff --git a/src/Service/VoteException.php b/src/Service/VoteException.php new file mode 100644 index 0000000..376735b --- /dev/null +++ b/src/Service/VoteException.php @@ -0,0 +1,13 @@ +fetchTable('Responses'); + $this->Responses = $responses; + } + + /** + * Derives the anonymous participant hash from the cookie id. The poll id is + * part of the HMAC key so participants cannot be correlated across polls. + * + * @param string $participantId Random id from the participant cookie + * @param int $pollId Poll id + * @return string + */ + public static function participantHash(string $participantId, int $pollId): string + { + return hash_hmac('sha256', $participantId, Security::getSalt() . '|poll|' . $pollId); + } + + /** + * @param \App\Model\Entity\Poll $poll Poll + * @param \App\Model\Entity\Slide $slide Slide (with slide_options for choice slides) + * @param string $participantHash Participant hash + * @param array $data Request data + * @return void + * @throws \App\Service\VoteException + */ + public function submit(Poll $poll, Slide $slide, string $participantHash, array $data): void + { + if (!$poll->is_active) { + throw new VoteException(__('Diese Umfrage ist derzeit geschlossen.')); + } + if ($slide->poll_id !== $poll->id || $poll->current_slide_id !== $slide->id) { + throw new VoteException(__('Diese Frage ist nicht mehr aktiv.')); + } + if (!$slide->isInteractive()) { + throw new VoteException(__('Auf dieser Folie kann nicht abgestimmt werden.')); + } + if (!$slide->is_voting_open) { + throw new VoteException(__('Die Abstimmung zu dieser Frage ist geschlossen.')); + } + if ($slide->type !== Slide::TYPE_WORDCLOUD && $this->Responses->hasResponded($slide->id, $participantHash)) { + throw new VoteException(__('Du hast bereits abgestimmt.')); + } + + $rows = match ($slide->type) { + Slide::TYPE_CHOICE => $this->choiceRows($slide, $data), + Slide::TYPE_WORDCLOUD => $this->wordRows($slide, $participantHash, $data), + Slide::TYPE_OPEN => $this->openRows($data), + Slide::TYPE_SCALE => $this->scaleRows($slide, $data), + default => throw new VoteException(__('Unbekannter Folientyp.')), + }; + + $entities = []; + foreach ($rows as $row) { + $entities[] = $this->Responses->newEntity($row + [ + 'slide_id' => $slide->id, + 'participant_hash' => $participantHash, + ]); + } + $this->Responses->saveManyOrFail($entities); + } + + /** + * @param \App\Model\Entity\Slide $slide Slide + * @param array $data Request data + * @return list> + */ + protected function choiceRows(Slide $slide, array $data): array + { + $selected = $data['option_ids'] ?? $data['option_id'] ?? []; + $selected = array_values(array_unique(array_map('intval', (array)$selected))); + $validIds = array_map(fn($option) => $option->id, $slide->slide_options ?? []); + $selected = array_values(array_intersect($selected, $validIds)); + + if ($selected === []) { + throw new VoteException(__('Bitte wähle eine Antwort aus.')); + } + if (!$slide->setting('multiple') && count($selected) > 1) { + throw new VoteException(__('Bitte wähle nur eine Antwort aus.')); + } + + return array_map(fn(int $id) => ['slide_option_id' => $id], $selected); + } + + /** + * Normalized key of a word cloud term: whitespace collapsed, trimmed, cut to + * MAX_WORD_LENGTH. Use wordKey() for case-insensitive comparison. + * + * @param string $word Raw input + * @return string + */ + public static function cleanWord(string $word): string + { + $word = trim((string)preg_replace('/\s+/u', ' ', $word)); + + return mb_substr($word, 0, self::MAX_WORD_LENGTH); + } + + /** + * Case-insensitive grouping key of a word cloud term. + * + * @param string $word Word + * @return string + */ + public static function wordKey(string $word): string + { + return mb_strtolower(self::cleanWord($word)); + } + + /** + * Accepts `word` (string) or `words` (list). Words the participant already + * submitted are skipped, the rest is cut to the remaining limit. + * + * @param \App\Model\Entity\Slide $slide Slide + * @param string $participantHash Participant hash + * @param array $data Request data + * @return list> + */ + protected function wordRows(Slide $slide, string $participantHash, array $data): array + { + $votes = $this->Responses->wordVotesOf($slide->id, $participantHash); + $existing = array_values(array_unique(array_map(self::wordKey(...), $votes['up']))); + $downvoted = array_fill_keys(array_map(self::wordKey(...), $votes['down']), true); + if (($data['vote'] ?? null) === 'down') { + return $this->downvoteRows($slide, (string)($data['word'] ?? ''), $existing, $downvoted); + } + + $input = array_merge((array)($data['words'] ?? []), (array)($data['word'] ?? [])); + $seen = array_fill_keys($existing, true); + + $words = []; + $duplicate = false; + $rejected = false; + foreach ($input as $word) { + $word = self::cleanWord((string)$word); + $key = mb_strtolower($word); + if ($word === '') { + continue; + } + if (isset($downvoted[$key])) { + $rejected = true; + continue; + } + if (isset($seen[$key])) { + $duplicate = true; + continue; + } + $seen[$key] = true; + $words[] = $word; + } + + $max = (int)$slide->setting('max_words'); + if ($max > 0) { + $remaining = max(0, $max - count($existing)); + if ($remaining === 0) { + throw new VoteException(__n( + 'Du hast deinen Begriff bereits abgegeben.', + 'Du hast bereits alle {0} Begriffe abgegeben.', + $max, + $max, + )); + } + $words = array_slice($words, 0, $remaining); + } + if ($words === []) { + throw new VoteException(match (true) { + $duplicate => __('Diesen Begriff hast du schon genannt.'), + $rejected => __('Diesen Begriff hast du bereits abgelehnt.'), + default => __('Bitte gib einen Begriff ein.'), + }); + } + + return array_map(fn(string $word) => ['text_value' => $word], $words); + } + + /** + * @param \App\Model\Entity\Slide $slide Slide + * @param string $word Word to downvote + * @param list $own Keys the participant named/upvoted + * @param array $downvoted Keys the participant downvoted + * @return list> + */ + protected function downvoteRows(Slide $slide, string $word, array $own, array $downvoted): array + { + if (!$slide->setting('allow_upvotes') || !$slide->setting('allow_downvotes')) { + throw new VoteException(__('Downvotes sind bei dieser Frage nicht möglich.')); + } + $word = self::cleanWord($word); + $key = mb_strtolower($word); + if ($word === '' || !$this->Responses->wordExists($slide->id, $key)) { + throw new VoteException(__('Diesen Begriff gibt es nicht in der Wortwolke.')); + } + if (in_array($key, $own, true)) { + throw new VoteException(__('Du hast diesen Begriff selbst genannt.')); + } + if (isset($downvoted[$key])) { + throw new VoteException(__('Diesen Begriff hast du bereits abgelehnt.')); + } + + return [['text_value' => $word, 'numeric_value' => self::DOWNVOTE]]; + } + + /** + * @param array $data Request data + * @return list> + */ + protected function openRows(array $data): array + { + $text = trim((string)($data['text'] ?? '')); + if ($text === '') { + throw new VoteException(__('Bitte gib eine Antwort ein.')); + } + if (mb_strlen($text) > self::MAX_TEXT_LENGTH) { + throw new VoteException(__('Die Antwort darf maximal {0} Zeichen lang sein.', self::MAX_TEXT_LENGTH)); + } + + return [['text_value' => $text]]; + } + + /** + * @param \App\Model\Entity\Slide $slide Slide + * @param array $data Request data + * @return list> + */ + protected function scaleRows(Slide $slide, array $data): array + { + $value = filter_var($data['value'] ?? null, FILTER_VALIDATE_INT); + $min = (int)$slide->setting('scale_min'); + $max = (int)$slide->setting('scale_max'); + if ($value === false || $value < $min || $value > $max) { + throw new VoteException(__('Bitte wähle einen Wert zwischen {0} und {1}.', $min, $max)); + } + + return [['numeric_value' => $value]]; + } +} diff --git a/src/View/AjaxView.php b/src/View/AjaxView.php new file mode 100644 index 0000000..c37f318 --- /dev/null +++ b/src/View/AjaxView.php @@ -0,0 +1,46 @@ +response = $this->response->withType('ajax'); + } +} diff --git a/src/View/AppView.php b/src/View/AppView.php new file mode 100644 index 0000000..1bfd5dc --- /dev/null +++ b/src/View/AppView.php @@ -0,0 +1,41 @@ +addHelper('Html');` + * + * @return void + */ + public function initialize(): void + { + } +} diff --git a/src/View/Cell/.gitkeep b/src/View/Cell/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/View/Helper/.gitkeep b/src/View/Helper/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/templates/Admin/index.php b/templates/Admin/index.php new file mode 100644 index 0000000..1ca752a --- /dev/null +++ b/templates/Admin/index.php @@ -0,0 +1,163 @@ + $slides + * @var array $responseCounts + * @var array $typeLabels + * @var array $typeDescriptions + * @var string $joinUrl + */ +$this->assign('title', $poll->title); +$this->assign('noindex', '1'); +$url = fn(string $name, array $params = []) => ['_name' => $name, 'token' => $adminToken] + $params; +?> +
+
+

+

title) ?>

+

+ is_active) : ?> + + + + + +

+
+
+ ▶ + +
+
+ +
+ + +
+ +
+
+
+

+
+ + +
+

+
+ + +
    + $slide) : + $isCurrent = $poll->current_slide_id === $slide->id; + $count = $responseCounts[$slide->id] ?? 0; + ?> +
  1. +
    +
    +
    + typeLabel()) ?> + + isInteractive()) : ?> + + is_voting_open) : ?>· + +
    + question) ?> + type === 'choice' && $slide->slide_options) : ?> +

    $o->label, $slide->slide_options))) ?>

    + +
    +
    + + Form->postLink(__('Live'), $url('admin:control'), [ + 'data' => ['action' => 'goto', 'slide_id' => $slide->id], + 'class' => 'button button--small', + 'title' => __('Diese Folie jetzt den Teilnehmenden zeigen'), + ]) ?> + + + Form->postLink('↑', $url('slides:move', ['id' => $slide->id, 'direction' => 'up']), [ + 'class' => 'button button--small button--icon', 'title' => __('Nach oben'), + ]) ?> + Form->postLink('↓', $url('slides:move', ['id' => $slide->id, 'direction' => 'down']), [ + 'class' => 'button button--small button--icon', 'title' => __('Nach unten'), + ]) ?> + 0) : ?> + Form->postLink(__('Zurücksetzen'), $url('slides:reset', ['id' => $slide->id]), [ + 'class' => 'button button--small', + 'confirm' => __('Alle {0} Antworten dieser Folie löschen?', $count), + ]) ?> + + Form->postLink(__('Löschen'), $url('slides:delete', ['id' => $slide->id]), [ + 'class' => 'button button--small button--danger', + 'confirm' => __('Folie „{0}“ inkl. aller Antworten löschen?', $slide->question), + ]) ?> +
    +
  2. + +
+ +

+
+ $label) : ?> + + + + + +
+
+ + +
diff --git a/templates/Admin/present.php b/templates/Admin/present.php new file mode 100644 index 0000000..8bca174 --- /dev/null +++ b/templates/Admin/present.php @@ -0,0 +1,56 @@ +assign('title', $poll->title); +$host = preg_replace('#^https?://#', '', $joinBaseUrl); +?> +
+ +
+
+ + formattedJoinCode()) ?> +
+ +
+ +
+

+

+

+
+
+ +
+ ✎ + + – + + + + + +
+ + +
diff --git a/templates/Error/error400.php b/templates/Error/error400.php new file mode 100644 index 0000000..f23bbbc --- /dev/null +++ b/templates/Error/error400.php @@ -0,0 +1,24 @@ +setLayout('error'); + +if (Configure::read('debug')) : + $this->setLayout('dev_error'); + + $this->assign('title', $message); + $this->assign('templateName', 'error400.php'); + + $this->start('file'); + echo $this->element('auto_table_warning'); + $this->end(); +endif; +$this->assign('title', __('Nicht gefunden')); +?> +

+

diff --git a/templates/Error/error500.php b/templates/Error/error500.php new file mode 100644 index 0000000..5734405 --- /dev/null +++ b/templates/Error/error500.php @@ -0,0 +1,39 @@ +setLayout('error'); + +if (Configure::read('debug')) : + $this->setLayout('dev_error'); + + $this->assign('title', $message); + $this->assign('templateName', 'error500.php'); + + $this->start('file'); + if (!empty($error->queryString)) : ?> +

SQL Query: queryString) ?>

+ params)) : ?> + SQL Query Params: + params) ?> + getFile(); + $line = $error->getLine(); ?> + Error in: + Html->link(sprintf('%s, line %s', Debugger::trimPath($file), $line), Debugger::editorUrl($file, $line)); ?> + element('auto_table_warning'); + $this->end(); +endif; +$this->assign('title', __('Fehler')); +?> +

+

diff --git a/templates/Home/created.php b/templates/Home/created.php new file mode 100644 index 0000000..39552e0 --- /dev/null +++ b/templates/Home/created.php @@ -0,0 +1,29 @@ +assign('title', __('Umfrage erstellt')); +$this->assign('noindex', '1'); +?> +
+ +

+ +

{1} geschickt.', h($created['title']), h($created['email'])) ?>

+

+ +

+

+ + + +
+ +

+ +
+ +
diff --git a/templates/Home/index.php b/templates/Home/index.php new file mode 100644 index 0000000..aeb1603 --- /dev/null +++ b/templates/Home/index.php @@ -0,0 +1,60 @@ + $captcha + */ +$this->assign('title', __('Live-Umfragen ohne Login')); +?> +
+

+

+
+ +
+
+

+ Form->create($poll, ['url' => ['_name' => 'create'], 'novalidate' => false]) ?> + Form->control('title', [ + 'label' => __('Titel'), + 'placeholder' => __('z. B. Team-Retro Oktober'), + 'maxlength' => 200, + 'required' => true, + ]) ?> + Form->control('email', [ + 'label' => __('Deine E-Mail-Adresse'), + 'type' => 'email', + 'placeholder' => 'name@example.org', + 'required' => true, + 'autocomplete' => 'email', + ]) ?> + element('captcha', ['captcha' => $captcha]) ?> +

+ Form->button(__('Umfrage erstellen'), ['class' => 'button button--primary']) ?> + Form->end() ?> +
+ +
+

+ Form->create(null, ['url' => ['_name' => 'join'], 'type' => 'get']) ?> + Form->control('code', [ + 'label' => __('Teilnahme-Code'), + 'placeholder' => 'K7P 2QX', + 'class' => 'input-code', + 'autocomplete' => 'off', + 'autocapitalize' => 'characters', + 'required' => true, + ]) ?> + Form->button(__('Teilnehmen'), ['class' => 'button']) ?> + Form->end() ?> +
+
+ +
+
+
+
+
+
diff --git a/templates/Home/join.php b/templates/Home/join.php new file mode 100644 index 0000000..e272e12 --- /dev/null +++ b/templates/Home/join.php @@ -0,0 +1,26 @@ +assign('title', __('Teilnehmen')); +?> +
+

+

+ Form->create(null, ['url' => ['_name' => 'join'], 'type' => 'get']) ?> + Form->control('code', [ + 'label' => ['text' => __('Teilnahme-Code'), 'class' => 'sr-only'], + 'value' => $code, + 'placeholder' => 'K7P 2QX', + 'class' => 'input-code input-code--big', + 'autocomplete' => 'off', + 'autocapitalize' => 'characters', + 'autofocus' => true, + 'required' => true, + ]) ?> + Form->button(__('Los geht’s'), ['class' => 'button button--primary button--block']) ?> + Form->end() ?> +
diff --git a/templates/Home/recover.php b/templates/Home/recover.php new file mode 100644 index 0000000..660249f --- /dev/null +++ b/templates/Home/recover.php @@ -0,0 +1,23 @@ + $captcha + */ +$this->assign('title', __('Admin-Link verloren?')); +?> +
+

+

+ Form->create(null, ['url' => ['_name' => 'recover']]) ?> + Form->control('email', [ + 'label' => __('E-Mail-Adresse'), + 'type' => 'email', + 'required' => true, + 'autocomplete' => 'email', + ]) ?> + element('captcha', ['captcha' => $captcha]) ?> + Form->button(__('Links zuschicken'), ['class' => 'button button--primary']) ?> + Form->end() ?> +
diff --git a/templates/Participate/view.php b/templates/Participate/view.php new file mode 100644 index 0000000..3172cbd --- /dev/null +++ b/templates/Participate/view.php @@ -0,0 +1,130 @@ + $state + * @var int $pollIntervalMs + */ +$this->assign('title', $poll->title); +$this->assign('bodyClass', 'participant'); +$voteUrl = ['_name' => 'participate:vote', 'code' => $poll->join_code]; +$words = $state['words'] ?? null; +?> +
+ +

title) ?>

+ + is_active) : ?> +
+

+

+
+ + +
+ +

+

+
+ + isInteractive()) : ?> +
+

question) ?>

+ description) : ?> +
description)) ?>
+ +
+ + +
+

question) ?>

+ description) : ?> +

description)) ?>

+ + + is_voting_open && !$words['limitReached']) : ?> + Form->create(null, ['url' => $voteUrl, 'class' => 'vote-form word-form', 'data-word-form' => true]) ?> + Form->hidden('slide_id', ['value' => $slide->id]) ?> +

+ +

+
+ + +
+

+ Form->button(__('Begriff senden'), ['class' => 'button button--primary button--block']) ?> + Form->end() ?> + +

✓

+ is_voting_open) : ?> +

+ + Form->create(null, ['url' => $voteUrl, 'class' => 'vote-form']) ?> + Form->hidden('slide_id', ['value' => $slide->id]) ?> + + type === 'choice') : + $multiple = (bool)$slide->setting('multiple'); ?> +

+
+ slide_options as $option) : ?> + + +
+ + type === 'open') : ?> + + + type === 'scale') : ?> +
+ setting('scale_min'); $v <= (int)$slide->setting('scale_max'); $v++) : ?> + + +
+
+ setting('min_label')) ?> + setting('max_label')) ?> +
+ + + Form->button(__('Absenden'), ['class' => 'button button--primary button--block']) ?> + Form->end() ?> + +
+ +
> +

+ is_voting_open && !$words['limitReached']) : ?> +

+ +
+
+ + +
diff --git a/templates/Slides/form.php b/templates/Slides/form.php new file mode 100644 index 0000000..aecf23a --- /dev/null +++ b/templates/Slides/form.php @@ -0,0 +1,109 @@ +isNew(); +$settings = $slide->getSettings(); +$this->assign('title', $isNew ? __('Neue Folie') : __('Folie bearbeiten')); +$this->assign('noindex', '1'); +$formUrl = $isNew + ? ['_name' => 'slides:add', 'token' => $adminToken, '?' => ['type' => $slide->type]] + : ['_name' => 'slides:edit', 'token' => $adminToken, 'id' => $slide->id]; +$optionsError = $slide->getError('options_text'); +?> +

← title)) ?>

+ +
+

typeLabel()) ?>

+

+ + Form->create($slide, ['url' => $formUrl]) ?> + Form->hidden('type') ?> + Form->control('question', [ + 'label' => $slide->type === 'content' ? __('Überschrift') : __('Frage'), + 'maxlength' => 500, + 'required' => true, + 'autofocus' => $isNew, + ]) ?> + Form->control('description', [ + 'type' => 'textarea', + 'rows' => $slide->type === 'content' ? 6 : 2, + 'label' => $slide->type === 'content' ? __('Text') : __('Beschreibung (optional)'), + ]) ?> + + type === 'choice') : ?> +
+ + + +
+ + +

+ +
+ Form->control('settings.multiple', [ + 'type' => 'checkbox', + 'label' => __('Mehrfachauswahl erlauben'), + 'checked' => (bool)$settings['multiple'], + ]) ?> + type === 'wordcloud') : ?> + Form->control('settings.max_words', [ + 'type' => 'number', 'min' => 0, 'max' => 50, + 'label' => __('Begriffe pro Person (0 = unbegrenzt)'), + 'value' => $settings['max_words'], + ]) ?> +

+ Form->control('settings.allow_upvotes', [ + 'type' => 'checkbox', + 'label' => __('Upvotes erlauben (Teilnehmende sehen die Wortwolke live und können Begriffe per Klick unterstützen)'), + 'checked' => (bool)$settings['allow_upvotes'], + ]) ?> + Form->control('settings.allow_downvotes', [ + 'type' => 'checkbox', + 'label' => __('Downvotes erlauben (nur zusammen mit Upvotes: Teilnehmende können Begriffe anderer ablehnen)'), + 'checked' => (bool)$settings['allow_downvotes'], + ]) ?> + type === 'scale') : ?> +
+ Form->control('settings.scale_min', [ + 'type' => 'select', 'options' => [0 => '0', 1 => '1'], + 'label' => __('Von'), 'value' => $settings['scale_min'], + ]) ?> + Form->control('settings.scale_max', [ + 'type' => 'select', 'options' => array_combine(range(2, 10), range(2, 10)), + 'label' => __('Bis'), 'value' => $settings['scale_max'], + ]) ?> + Form->control('settings.min_label', [ + 'label' => __('Beschriftung links (optional)'), 'maxlength' => 60, + 'placeholder' => __('z. B. gar nicht'), 'value' => $settings['min_label'], + ]) ?> + Form->control('settings.max_label', [ + 'label' => __('Beschriftung rechts (optional)'), 'maxlength' => 60, + 'placeholder' => __('z. B. sehr'), 'value' => $settings['max_label'], + ]) ?> +
+ + + isInteractive()) : ?> + Form->control('is_voting_open', [ + 'type' => 'checkbox', + 'label' => __('Abstimmung geöffnet'), + 'checked' => $isNew ? true : $slide->is_voting_open, + ]) ?> + + +
+ Form->button($isNew ? __('Folie anlegen') : __('Speichern'), ['class' => 'button button--primary']) ?> + +
+ Form->end() ?> +
diff --git a/templates/cell/.gitkeep b/templates/cell/.gitkeep new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/templates/cell/.gitkeep @@ -0,0 +1 @@ + diff --git a/templates/element/captcha.php b/templates/element/captcha.php new file mode 100644 index 0000000..245788f --- /dev/null +++ b/templates/element/captcha.php @@ -0,0 +1,25 @@ + $captcha Result of CaptchaInterface::challenge() + */ +$type = $captcha['type'] ?? 'none'; +?> + +
+ + +
+ +
+ +

+ +
+ Html->script('https://www.google.com/recaptcha/api.js', ['block' => 'script', 'async' => true, 'defer' => true, 'once' => true]) ?> + +
+ diff --git a/templates/element/flash/default.php b/templates/element/flash/default.php new file mode 100644 index 0000000..061c700 --- /dev/null +++ b/templates/element/flash/default.php @@ -0,0 +1,15 @@ + +
diff --git a/templates/element/flash/error.php b/templates/element/flash/error.php new file mode 100644 index 0000000..2ebf235 --- /dev/null +++ b/templates/element/flash/error.php @@ -0,0 +1,11 @@ + +
diff --git a/templates/element/flash/info.php b/templates/element/flash/info.php new file mode 100644 index 0000000..e25b730 --- /dev/null +++ b/templates/element/flash/info.php @@ -0,0 +1,11 @@ + +
diff --git a/templates/element/flash/success.php b/templates/element/flash/success.php new file mode 100644 index 0000000..73eaac4 --- /dev/null +++ b/templates/element/flash/success.php @@ -0,0 +1,11 @@ + +
diff --git a/templates/element/flash/warning.php b/templates/element/flash/warning.php new file mode 100644 index 0000000..605537c --- /dev/null +++ b/templates/element/flash/warning.php @@ -0,0 +1,11 @@ + +
diff --git a/templates/email/html/admin_link.php b/templates/email/html/admin_link.php new file mode 100644 index 0000000..688a9c9 --- /dev/null +++ b/templates/email/html/admin_link.php @@ -0,0 +1,17 @@ + +

+

{0} wurde angelegt. Über den folgenden Link kannst du Fragen anlegen, die Präsentation starten und Ergebnisse ansehen:', h($poll->title)) ?>

+

+ +

+

+

+

{1}.', '' . h($joinUrl) . '', h($poll->formattedJoinCode())) ?>

+

diff --git a/templates/email/html/default.php b/templates/email/html/default.php new file mode 100644 index 0000000..70a6cd4 --- /dev/null +++ b/templates/email/html/default.php @@ -0,0 +1,22 @@ + ' . $line . "

\n"; +endforeach; diff --git a/templates/email/html/recovery.php b/templates/email/html/recovery.php new file mode 100644 index 0000000..c2c614d --- /dev/null +++ b/templates/email/html/recovery.php @@ -0,0 +1,17 @@ + $links + */ +?> +

+

+
    + +
  • +
    + +
  • + +
+

diff --git a/templates/email/text/admin_link.php b/templates/email/text/admin_link.php new file mode 100644 index 0000000..3312c53 --- /dev/null +++ b/templates/email/text/admin_link.php @@ -0,0 +1,24 @@ + + + + +title) ?> + + + + + + + + +formattedJoinCode()) ?> + + + diff --git a/templates/email/text/default.php b/templates/email/text/default.php new file mode 100644 index 0000000..cb1f378 --- /dev/null +++ b/templates/email/text/default.php @@ -0,0 +1,18 @@ + $links + */ +?> + + + + + + + +- () + + + + + diff --git a/templates/layout/ajax.php b/templates/layout/ajax.php new file mode 100644 index 0000000..cd51169 --- /dev/null +++ b/templates/layout/ajax.php @@ -0,0 +1,17 @@ +fetch('content'); diff --git a/templates/layout/default.php b/templates/layout/default.php new file mode 100644 index 0000000..f43e159 --- /dev/null +++ b/templates/layout/default.php @@ -0,0 +1,46 @@ +fetch('title'); +?> + + + + Html->charset() ?> + + + fetch('noindex')) : ?> + + + <?= $title ? h($title) . ' · ' : '' ?>Plenario + Html->meta('icon') ?> + Html->css(['normalize.min', 'plenario']) ?> + fetch('meta') ?> + fetch('css') ?> + + + +
+ Flash->render() ?> + fetch('content') ?> +
+
+ Plenario – +
+ Html->script('plenario') ?> + fetch('script') ?> + + diff --git a/templates/layout/email/html/default.php b/templates/layout/email/html/default.php new file mode 100644 index 0000000..18c003d --- /dev/null +++ b/templates/layout/email/html/default.php @@ -0,0 +1,18 @@ + + + + + + <?= $this->fetch('title') ?> + + +
+

Plenario

+ fetch('content') ?> +
+ + diff --git a/templates/layout/email/text/default.php b/templates/layout/email/text/default.php new file mode 100644 index 0000000..cd51169 --- /dev/null +++ b/templates/layout/email/text/default.php @@ -0,0 +1,17 @@ +fetch('content'); diff --git a/templates/layout/error.php b/templates/layout/error.php new file mode 100644 index 0000000..5eecf82 --- /dev/null +++ b/templates/layout/error.php @@ -0,0 +1,31 @@ + + + + + Html->charset() ?> + + + <?= h($this->fetch('title')) ?> · Plenario + Html->meta('icon') ?> + Html->css(['normalize.min', 'plenario']) ?> + + + +
+
+ fetch('content') ?> +

+
+
+ + diff --git a/templates/layout/present.php b/templates/layout/present.php new file mode 100644 index 0000000..b06937e --- /dev/null +++ b/templates/layout/present.php @@ -0,0 +1,24 @@ + + + + + Html->charset() ?> + + + + <?= h($this->fetch('title')) ?> · Plenario + Html->meta('icon') ?> + Html->css(['normalize.min', 'plenario']) ?> + + + fetch('content') ?> + Html->script('plenario') ?> + fetch('script') ?> + + diff --git a/tests/Fixture/.gitkeep b/tests/Fixture/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/Fixture/PollsFixture.php b/tests/Fixture/PollsFixture.php new file mode 100644 index 0000000..8f768d9 --- /dev/null +++ b/tests/Fixture/PollsFixture.php @@ -0,0 +1,18 @@ +> + */ + public array $records = []; +} diff --git a/tests/Fixture/ResponsesFixture.php b/tests/Fixture/ResponsesFixture.php new file mode 100644 index 0000000..0a07805 --- /dev/null +++ b/tests/Fixture/ResponsesFixture.php @@ -0,0 +1,18 @@ +> + */ + public array $records = []; +} diff --git a/tests/Fixture/SlideOptionsFixture.php b/tests/Fixture/SlideOptionsFixture.php new file mode 100644 index 0000000..ab0f295 --- /dev/null +++ b/tests/Fixture/SlideOptionsFixture.php @@ -0,0 +1,18 @@ +> + */ + public array $records = []; +} diff --git a/tests/Fixture/SlidesFixture.php b/tests/Fixture/SlidesFixture.php new file mode 100644 index 0000000..50692a9 --- /dev/null +++ b/tests/Fixture/SlidesFixture.php @@ -0,0 +1,18 @@ +> + */ + public array $records = []; +} diff --git a/tests/TestCase/ApplicationTest.php b/tests/TestCase/ApplicationTest.php new file mode 100644 index 0000000..63bc3d1 --- /dev/null +++ b/tests/TestCase/ApplicationTest.php @@ -0,0 +1,88 @@ +bootstrap(); + $plugins = $app->getPlugins(); + + $this->assertTrue($plugins->has('Bake'), 'plugins has Bake?'); + $this->assertFalse($plugins->has('DebugKit'), 'plugins has DebugKit?'); + $this->assertTrue($plugins->has('Migrations'), 'plugins has Migrations?'); + } + + /** + * Test bootstrap add DebugKit plugin in debug mode. + * + * @return void + */ + public function testBootstrapInDebug() + { + Configure::write('debug', true); + $app = new Application(dirname(__DIR__, 2) . '/config'); + $app->bootstrap(); + $plugins = $app->getPlugins(); + + $this->assertTrue($plugins->has('DebugKit'), 'plugins has DebugKit?'); + } + + /** + * testMiddleware + * + * @return void + */ + public function testMiddleware() + { + $app = new Application(dirname(__DIR__, 2) . '/config'); + $middleware = new MiddlewareQueue(); + + $middleware = $app->middleware($middleware); + + $this->assertInstanceOf(ErrorHandlerMiddleware::class, $middleware->current()); + $middleware->seek(1); + $this->assertInstanceOf(HostHeaderMiddleware::class, $middleware->current()); + $middleware->seek(2); + $this->assertInstanceOf(AssetMiddleware::class, $middleware->current()); + $middleware->seek(3); + $this->assertInstanceOf(RoutingMiddleware::class, $middleware->current()); + } +} diff --git a/tests/TestCase/Captcha/CaptchaTest.php b/tests/TestCase/Captcha/CaptchaTest.php new file mode 100644 index 0000000..a685937 --- /dev/null +++ b/tests/TestCase/Captcha/CaptchaTest.php @@ -0,0 +1,79 @@ +assertInstanceOf(NoCaptcha::class, CaptchaFactory::create('x', 'none')); + $this->assertInstanceOf(MathCaptcha::class, CaptchaFactory::create('x', 'math')); + $this->assertInstanceOf(RecaptchaCaptcha::class, CaptchaFactory::create('x', 'recaptcha')); + $this->expectException(InvalidArgumentException::class); + CaptchaFactory::create('x', 'unknown'); + } + + public function testMathCaptchaIsSingleUse(): void + { + $session = new Session(); + $request = new ServerRequest(['session' => $session]); + $captcha = new MathCaptcha('create'); + $challenge = $captcha->challenge($request); + $this->assertSame('math', $challenge['type']); + $answer = (string)$session->read('Captcha.math.create'); + + $submit = (new ServerRequest(['session' => $session]))->withData('captcha_answer', $answer); + $this->assertTrue($captcha->verify($submit)); + $this->assertFalse($captcha->verify($submit), 'second verification must fail'); + } + + public function testMathCaptchaScopesAreIndependent(): void + { + $session = new Session(); + $request = new ServerRequest(['session' => $session]); + (new MathCaptcha('create'))->challenge($request); + $answer = (string)$session->read('Captcha.math.create'); + + $submit = (new ServerRequest(['session' => $session]))->withData('captcha_answer', $answer); + $this->assertFalse((new MathCaptcha('recover'))->verify($submit)); + } + + public function testRecaptchaVerifiesWithGoogle(): void + { + $client = $this->createMock(Client::class); + $client->expects($this->once()) + ->method('post') + ->with(RecaptchaCaptcha::VERIFY_URL, $this->callback(fn($data) => $data['secret'] === 'secret' && $data['response'] === 'tok')) + ->willReturn(new ClientResponse(['HTTP/1.1 200 OK', 'Content-Type: application/json'], '{"success": true}')); + + $captcha = new RecaptchaCaptcha('site', 'secret', $client); + $request = (new ServerRequest())->withData('g-recaptcha-response', 'tok'); + $this->assertTrue($captcha->verify($request)); + } + + public function testRecaptchaFailsClosed(): void + { + $client = $this->createStub(Client::class); + $client->method('post')->willReturn(new ClientResponse(['HTTP/1.1 200 OK'], '{"success": false}')); + + $request = (new ServerRequest())->withData('g-recaptcha-response', 'tok'); + $this->assertFalse((new RecaptchaCaptcha('site', 'secret', $client))->verify($request)); + $this->assertFalse((new RecaptchaCaptcha('', '', $client))->verify($request), 'missing keys'); + $this->assertFalse((new RecaptchaCaptcha('site', 'secret', $client))->verify(new ServerRequest()), 'missing token'); + } +} diff --git a/tests/TestCase/Controller/AdminControllerTest.php b/tests/TestCase/Controller/AdminControllerTest.php new file mode 100644 index 0000000..8da0ba6 --- /dev/null +++ b/tests/TestCase/Controller/AdminControllerTest.php @@ -0,0 +1,186 @@ + + */ + protected array $fixtures = ['app.Polls', 'app.Slides', 'app.SlideOptions', 'app.Responses']; + + protected function setUp(): void + { + parent::setUp(); + $this->enableCsrfToken(); + } + + public function testInvalidTokenIs404(): void + { + $this->createPoll(); + $this->get('/admin/' . str_repeat('x', 43)); + $this->assertResponseCode(404); + } + + public function testDashboardSendsPrivacyHeaders(): void + { + [$poll, $token] = $this->createPoll('Meine '); + $this->get("/admin/$token"); + + $this->assertResponseOk(); + $this->assertResponseContains('Meine <Umfrage>'); + $this->assertResponseContains($poll->formattedJoinCode()); + $this->assertHeader('Referrer-Policy', 'no-referrer'); + $this->assertHeaderContains('X-Robots-Tag', 'noindex'); + } + + public function testTokenOfOtherPollCannotAccessSlides(): void + { + [$pollA] = $this->createPoll('A'); + [, $tokenB] = $this->createPoll('B'); + $slide = $this->createSlide($pollA); + + $this->get("/admin/$tokenB/slides/{$slide->id}/edit"); + $this->assertResponseCode(404); + } + + public function testAddChoiceSlide(): void + { + [$poll, $token] = $this->createPoll(); + $this->post("/admin/$token/slides/add?type=choice", [ + 'type' => 'choice', + 'question' => 'Pizza oder Pasta?', + 'options_text' => "Pizza\n\nPasta\nPizza\n", + 'settings' => ['multiple' => '1', 'evil' => 'x'], + ]); + + $this->assertRedirect(['_name' => 'admin', 'token' => $token]); + $slide = $this->slidesTable()->find()->contain(['SlideOptions'])->firstOrFail(); + $this->assertSame($poll->id, $slide->poll_id); + $this->assertSame(['Pizza', 'Pasta'], array_map(fn($o) => $o->label, $slide->slide_options)); + $this->assertSame(['multiple' => true], $slide->settings); + $this->assertSame(1, $slide->position); + } + + public function testEditKeepsVotesOfUnchangedOptions(): void + { + [$poll, $token] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_CHOICE, [], ['A', 'B']); + $optionA = $slide->slide_options[0]; + + $this->post("/admin/$token/slides/{$slide->id}/edit", [ + 'question' => 'Neu', + 'options_text' => "C\nA", + ]); + + $this->assertRedirect(); + $slide = $this->slidesTable()->get($slide->id, contain: ['SlideOptions']); + $this->assertSame('Neu', $slide->question); + $this->assertSame(['C', 'A'], array_map(fn($o) => $o->label, $slide->slide_options)); + $this->assertSame($optionA->id, $slide->slide_options[1]->id); + } + + public function testMoveAndDeleteSlides(): void + { + [$poll, $token] = $this->createPoll(); + $first = $this->createSlide($poll, Slide::TYPE_OPEN); + $second = $this->createSlide($poll, Slide::TYPE_SCALE); + + $this->post("/admin/$token/slides/{$second->id}/move/up"); + $this->assertSame(1, $this->slidesTable()->get($second->id)->position); + $this->assertSame(2, $this->slidesTable()->get($first->id)->position); + + $this->post("/admin/$token/slides/{$second->id}/delete"); + $this->assertFalse($this->slidesTable()->exists(['id' => $second->id])); + $this->assertSame(1, $this->slidesTable()->get($first->id)->position); + } + + public function testPresentStartsWithFirstSlideAndControlNavigates(): void + { + [$poll, $token] = $this->createPoll(); + $first = $this->createSlide($poll, Slide::TYPE_CHOICE); + $second = $this->createSlide($poll, Slide::TYPE_WORDCLOUD); + + $this->get("/admin/$token/present"); + $this->assertResponseOk(); + $this->assertSame($first->id, $this->pollsTable()->get($poll->id)->current_slide_id); + + $this->configRequest(['headers' => ['Accept' => 'application/json']]); + $this->post("/admin/$token/control", ['action' => 'next']); + $this->assertResponseOk(); + $state = json_decode((string)$this->_response->getBody(), true); + $this->assertSame($second->id, $state['slide']['id']); + $this->assertSame(1, $state['index']); + $this->assertArrayNotHasKey('email', $state['poll']); + + $this->configRequest(['headers' => ['Accept' => 'application/json']]); + $this->post("/admin/$token/control", ['action' => 'toggle']); + $this->assertFalse($this->slidesTable()->get($second->id)->is_voting_open); + + $this->configRequest(['headers' => ['Accept' => 'application/json']]); + $this->post("/admin/$token/control", ['action' => 'next']); + $this->assertSame($second->id, $this->pollsTable()->get($poll->id)->current_slide_id, 'stays on last slide'); + } + + public function testControlRejectsSlideOfOtherPoll(): void + { + [, $token] = $this->createPoll('A'); + [$other] = $this->createPoll('B'); + $foreign = $this->createSlide($other); + + $this->post("/admin/$token/control", ['action' => 'goto', 'slide_id' => $foreign->id]); + $this->assertResponseCode(400); + } + + public function testRotateTokenInvalidatesOldLink(): void + { + [$poll, $token] = $this->createPoll(); + $this->post("/admin/$token/rotate-token"); + + $this->assertRedirect(); + $this->assertMailSentTo('owner@example.org'); + $fresh = $this->pollsTable()->get($poll->id); + $this->assertNotSame(PollsTable::hashToken($token), $fresh->admin_token_hash); + + $this->get("/admin/$token"); + $this->assertResponseCode(404); + } + + public function testDeleteRequiresJoinCode(): void + { + [$poll, $token] = $this->createPoll(); + $this->post("/admin/$token/delete", ['confirm_code' => 'WRONG']); + $this->assertTrue($this->pollsTable()->exists(['id' => $poll->id])); + + $this->post("/admin/$token/delete", ['confirm_code' => strtolower($poll->join_code)]); + $this->assertRedirect(['_name' => 'home']); + $this->assertFalse($this->pollsTable()->exists(['id' => $poll->id])); + } + + public function testQrAndExport(): void + { + [, $token] = $this->createPoll(); + $this->get("/admin/$token/qr.svg"); + $this->assertResponseOk(); + $this->assertContentType('image/svg+xml'); + + $this->get("/admin/$token/export.csv"); + $this->assertResponseOk(); + $this->assertHeaderContains('Content-Disposition', 'attachment'); + } +} diff --git a/tests/TestCase/Controller/Component/.gitkeep b/tests/TestCase/Controller/Component/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/TestCase/Controller/HomeControllerTest.php b/tests/TestCase/Controller/HomeControllerTest.php new file mode 100644 index 0000000..8b1af5d --- /dev/null +++ b/tests/TestCase/Controller/HomeControllerTest.php @@ -0,0 +1,149 @@ + + */ + protected array $fixtures = ['app.Polls', 'app.Slides', 'app.SlideOptions', 'app.Responses']; + + protected function setUp(): void + { + parent::setUp(); + $this->enableCsrfToken(); + Configure::write('Plenario.captcha.type', 'math'); + Configure::write('Plenario.showAdminLinkAfterCreate', false); + Cache::clear('throttle'); + } + + public function testIndexRendersBothForms(): void + { + $this->get('/'); + $this->assertResponseOk(); + $this->assertResponseContains('Neue Umfrage erstellen'); + $this->assertResponseContains('Sicherheitsfrage: Was ist'); + $this->assertResponseContains('Teilnahme-Code'); + } + + public function testCreateWithValidMathCaptchaSendsAdminMail(): void + { + $this->session(['Captcha.math.create' => 7]); + $this->post('/create', ['title' => 'Retro', 'email' => 'Owner@Example.org', 'captcha_answer' => '7']); + + $this->assertRedirect(['_name' => 'created']); + $poll = $this->pollsTable()->find()->firstOrFail(); + $this->assertSame('owner@example.org', $poll->email); + $this->assertMatchesRegularExpression('/^[A-Z2-9]{6}$/', $poll->join_code); + $this->assertMailSentTo('owner@example.org'); + $this->assertMailContains('/admin/'); + + $this->session(['Plenario.created' => $_SESSION['Plenario']['created'] ?? null]); + $this->get('/created'); + $this->assertResponseContains('Fast geschafft'); + $this->assertResponseNotContains('/admin/', 'Admin link must not be shown when disabled'); + } + + public function testCreateRejectsWrongCaptcha(): void + { + $this->session(['Captcha.math.create' => 7]); + $this->post('/create', ['title' => 'Retro', 'email' => 'owner@example.org', 'captcha_answer' => '8']); + + $this->assertResponseOk(); + $this->assertResponseContains('Sicherheitsabfrage war nicht korrekt'); + $this->assertSame(0, $this->pollsTable()->find()->count()); + $this->assertNoMailSent(); + } + + public function testCreateRejectsMissingCaptchaSession(): void + { + $this->post('/create', ['title' => 'Retro', 'email' => 'owner@example.org', 'captcha_answer' => '0']); + $this->assertSame(0, $this->pollsTable()->find()->count()); + } + + public function testCreateWithoutCaptchaAndInvalidEmail(): void + { + Configure::write('Plenario.captcha.type', 'none'); + $this->post('/create', ['title' => 'Retro', 'email' => 'kein-mail']); + + $this->assertResponseOk(); + $this->assertResponseContains('gültige E-Mail-Adresse'); + $this->assertSame(0, $this->pollsTable()->find()->count()); + } + + public function testCreateShowsAdminLinkInDevMode(): void + { + Configure::write('Plenario.captcha.type', 'none'); + Configure::write('Plenario.showAdminLinkAfterCreate', true); + $this->post('/create', ['title' => 'Retro', 'email' => 'owner@example.org']); + $this->session(['Plenario.created' => $_SESSION['Plenario']['created'] ?? null]); + $this->get('/created'); + $this->assertResponseContains('/admin/'); + } + + public function testCreateIsThrottled(): void + { + Configure::write('Plenario.captcha.type', 'none'); + Configure::write('Plenario.throttle.createPerHour', 2); + for ($i = 0; $i < 3; $i++) { + $this->post('/create', ['title' => 'Retro ' . $i, 'email' => 'owner@example.org']); + } + $this->assertResponseContains('Zu viele Umfragen'); + $this->assertSame(2, $this->pollsTable()->find()->count()); + } + + public function testJoinNormalisesCode(): void + { + [$poll] = $this->createPoll(); + $code = strtolower(substr($poll->join_code, 0, 3) . ' - ' . substr($poll->join_code, 3)); + $this->get('/join?code=' . urlencode($code)); + $this->assertRedirect(['_name' => 'participate', 'code' => $poll->join_code]); + } + + public function testJoinUnknownCode(): void + { + $this->get('/join?code=ZZZZZZ'); + $this->assertResponseOk(); + $this->assertResponseContains('keine Umfrage gefunden'); + } + + public function testRecoverResendsExistingLinks(): void + { + Configure::write('Plenario.captcha.type', 'none'); + [, $token] = $this->createPoll('Eins', 'owner@example.org'); + $this->createPoll('Fremd', 'other@example.org'); + + $this->post('/recover', ['email' => 'OWNER@example.org']); + + $this->assertRedirect(['_name' => 'recover']); + $this->assertMailCount(1); + $this->assertMailSentTo('owner@example.org'); + $this->assertMailContains('/admin/' . $token); + $this->assertMailContainsText('Eins'); + } + + public function testRecoverUnknownAddressSendsNothingButSameMessage(): void + { + Configure::write('Plenario.captcha.type', 'none'); + $this->post('/recover', ['email' => 'nobody@example.org']); + $this->assertRedirect(['_name' => 'recover']); + $this->assertFlashMessage('Falls zu nobody@example.org Umfragen existieren, haben wir dir die Admin-Links per E-Mail geschickt.'); + $this->assertNoMailSent(); + } +} diff --git a/tests/TestCase/Controller/ParticipateControllerTest.php b/tests/TestCase/Controller/ParticipateControllerTest.php new file mode 100644 index 0000000..bd1e4be --- /dev/null +++ b/tests/TestCase/Controller/ParticipateControllerTest.php @@ -0,0 +1,157 @@ + + */ + protected array $fixtures = ['app.Polls', 'app.Slides', 'app.SlideOptions', 'app.Responses']; + + protected const PID = '0123456789abcdef0123456789abcdef'; + + protected function setUp(): void + { + parent::setUp(); + $this->enableCsrfToken(); + } + + public function testUnknownCodeIs404(): void + { + $this->get('/p/ZZZZZZ'); + $this->assertResponseCode(404); + } + + public function testWaitingScreenAndCookie(): void + { + [$poll] = $this->createPoll(); + $this->get('/p/' . $poll->join_code); + $this->assertResponseOk(); + $this->assertResponseContains('Gleich geht'); + $this->assertCookieIsSet('plenario_pid'); + } + + public function testVoteOnceOnly(): void + { + [$poll] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_CHOICE); + $this->goLive($poll, $slide); + $optionId = $slide->slide_options[0]->id; + + $this->cookie('plenario_pid', self::PID); + $this->post("/p/{$poll->join_code}/vote", ['slide_id' => $slide->id, 'option_id' => $optionId]); + $this->assertRedirect(['_name' => 'participate', 'code' => $poll->join_code]); + $this->assertFlashMessage('Danke für deine Antwort!'); + + $this->cookie('plenario_pid', self::PID); + $this->post("/p/{$poll->join_code}/vote", ['slide_id' => $slide->id, 'option_id' => $optionId]); + $this->assertFlashMessage('Du hast bereits abgestimmt.'); + + $this->assertSame(1, TableRegistry::getTableLocator()->get('Responses')->find()->count()); + } + + public function testVoteForInactiveSlideIsRejected(): void + { + [$poll] = $this->createPoll(); + $live = $this->createSlide($poll, Slide::TYPE_OPEN); + $other = $this->createSlide($poll, Slide::TYPE_OPEN); + $this->goLive($poll, $live); + + $this->post("/p/{$poll->join_code}/vote", ['slide_id' => $other->id, 'text' => 'Hallo']); + $this->assertFlashMessage('Diese Frage ist nicht mehr aktiv.'); + $this->assertSame(0, TableRegistry::getTableLocator()->get('Responses')->find()->count()); + } + + public function testStateHidesResultsUntilAnswered(): void + { + [$poll] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_SCALE); + $this->goLive($poll, $slide); + + $this->cookie('plenario_pid', self::PID); + $this->get("/p/{$poll->join_code}/state"); + $state = json_decode((string)$this->_response->getBody(), true); + $this->assertSame($slide->id, $state['slideId']); + $this->assertFalse($state['hasResponded']); + $this->assertNull($state['results']); + + $this->cookie('plenario_pid', self::PID); + $this->post("/p/{$poll->join_code}/vote", ['slide_id' => $slide->id, 'value' => 4]); + + $this->cookie('plenario_pid', self::PID); + $this->get("/p/{$poll->join_code}/state"); + $state = json_decode((string)$this->_response->getBody(), true); + $this->assertTrue($state['hasResponded']); + $this->assertEqualsWithDelta(4.0, $state['results']['average'], 0.001); + } + + public function testWordcloudAjaxVoteReturnsStateWithUpvoteCloud(): void + { + [$poll] = $this->createPoll(); + $poll->show_results_to_participants = false; + $this->pollsTable()->saveOrFail($poll); + $slide = $this->createSlide($poll, Slide::TYPE_WORDCLOUD, ['settings' => ['max_words' => 0, 'allow_upvotes' => true]]); + $this->goLive($poll, $slide); + + $this->cookie('plenario_pid', self::PID); + $this->configRequest(['headers' => ['X-Requested-With' => 'XMLHttpRequest', 'Accept' => 'application/json']]); + $this->post("/p/{$poll->join_code}/vote", ['slide_id' => $slide->id, 'word' => 'Kaffee']); + $this->assertResponseOk(); + $body = json_decode((string)$this->_response->getBody(), true); + $this->assertTrue($body['ok']); + $this->assertSame(['kaffee'], $body['state']['words']['mine']); + $this->assertNull($body['state']['words']['remaining']); + // Cloud is visible despite show_results_to_participants=false, because upvotes are on. + $this->assertSame('Kaffee', $body['state']['results']['words'][0]['text']); + + $this->cookie('plenario_pid', self::PID); + $this->configRequest(['headers' => ['X-Requested-With' => 'XMLHttpRequest', 'Accept' => 'application/json']]); + $this->post("/p/{$poll->join_code}/vote", ['slide_id' => $slide->id, 'word' => 'kaffee']); + $body = json_decode((string)$this->_response->getBody(), true); + $this->assertFalse($body['ok']); + $this->assertSame('Diesen Begriff hast du schon genannt.', $body['message']); + } + + public function testWordcloudWithoutUpvotesHidesCloudBeforeAnswer(): void + { + [$poll] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_WORDCLOUD, ['settings' => ['allow_upvotes' => false]]); + $this->goLive($poll, $slide); + + $this->cookie('plenario_pid', self::PID); + $this->get('/p/' . $poll->join_code); + $this->assertResponseOk(); + $this->assertResponseContains('data-word-input'); + $this->assertResponseNotContains('data-upvote-hint'); + + $this->cookie('plenario_pid', self::PID); + $this->get("/p/{$poll->join_code}/state"); + $state = json_decode((string)$this->_response->getBody(), true); + $this->assertNull($state['results']); + $this->assertFalse($state['words']['allowUpvotes']); + } + + public function testClosedPoll(): void + { + [$poll] = $this->createPoll(); + $poll->is_active = false; + $this->pollsTable()->saveOrFail($poll); + + $this->get('/p/' . $poll->join_code); + $this->assertResponseContains('Diese Umfrage ist geschlossen'); + } +} diff --git a/tests/TestCase/Model/Behavior/.gitkeep b/tests/TestCase/Model/Behavior/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/TestCase/PlenarioTestTrait.php b/tests/TestCase/PlenarioTestTrait.php new file mode 100644 index 0000000..1a4c4f6 --- /dev/null +++ b/tests/TestCase/PlenarioTestTrait.php @@ -0,0 +1,83 @@ +get('Polls'); + [$poll, $token] = $polls->createPoll(['title' => $title, 'email' => $email]); + $this->assertNotNull($token, 'Poll could not be created: ' . json_encode($poll->getErrors())); + + return [$poll, (string)$token]; + } + + /** + * @param \App\Model\Entity\Poll $poll Poll + * @param string $type Slide type + * @param array $data Extra slide data + * @param list $options Option labels (choice) + * @return \App\Model\Entity\Slide Slide incl. slide_options + */ + protected function createSlide(Poll $poll, string $type = Slide::TYPE_CHOICE, array $data = [], array $options = ['Ja', 'Nein']): Slide + { + /** @var \App\Model\Table\SlidesTable $slides */ + $slides = TableRegistry::getTableLocator()->get('Slides'); + $slide = $slides->newEntity($data + [ + 'type' => $type, + 'question' => 'Frage ' . $type, + 'settings' => Slide::DEFAULT_SETTINGS[$type] ?? [], + ]); + $slide->poll_id = $poll->id; + $slides->saveOrFail($slide); + if ($type === Slide::TYPE_CHOICE) { + $slides->syncOptions($slide, $options); + } + + return $slides->get($slide->id, contain: ['SlideOptions']); + } + + /** + * Makes the slide the poll's current slide. + */ + protected function goLive(Poll $poll, Slide $slide): Poll + { + $polls = $this->pollsTable(); + $poll->current_slide_id = $slide->id; + $polls->saveOrFail($poll); + + return $polls->get($poll->id); + } + + protected function pollsTable(): PollsTable + { + /** @var \App\Model\Table\PollsTable $table */ + $table = TableRegistry::getTableLocator()->get('Polls'); + + return $table; + } + + protected function slidesTable(): SlidesTable + { + /** @var \App\Model\Table\SlidesTable $table */ + $table = TableRegistry::getTableLocator()->get('Slides'); + + return $table; + } +} diff --git a/tests/TestCase/Service/VoteServiceTest.php b/tests/TestCase/Service/VoteServiceTest.php new file mode 100644 index 0000000..fdf3fbb --- /dev/null +++ b/tests/TestCase/Service/VoteServiceTest.php @@ -0,0 +1,233 @@ + + */ + protected array $fixtures = ['app.Polls', 'app.Slides', 'app.SlideOptions', 'app.Responses']; + + public function testParticipantHashIsScopedPerPoll(): void + { + $this->assertNotSame(VoteService::participantHash('abc', 1), VoteService::participantHash('abc', 2)); + $this->assertSame(VoteService::participantHash('abc', 1), VoteService::participantHash('abc', 1)); + } + + public function testSingleChoiceRejectsMultipleOptions(): void + { + [$poll] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_CHOICE, [], ['A', 'B']); + $poll = $this->goLive($poll, $slide); + $ids = array_map(fn($o) => $o->id, $slide->slide_options); + + $this->expectException(VoteException::class); + (new VoteService())->submit($poll, $slide, 'p1', ['option_ids' => $ids]); + } + + public function testChoiceIgnoresForeignOptionIds(): void + { + [$poll] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_CHOICE); + $poll = $this->goLive($poll, $slide); + + $this->expectExceptionMessage('Bitte wähle eine Antwort aus.'); + (new VoteService())->submit($poll, $slide, 'p1', ['option_id' => 999999]); + } + + public function testClosedVotingIsRejected(): void + { + [$poll] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_OPEN, ['is_voting_open' => false]); + $poll = $this->goLive($poll, $slide); + + $this->expectExceptionMessage('geschlossen'); + (new VoteService())->submit($poll, $slide, 'p1', ['text' => 'Hallo']); + } + + public function testScaleRange(): void + { + [$poll] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_SCALE, ['settings' => ['scale_min' => 1, 'scale_max' => 3]]); + $poll = $this->goLive($poll, $slide); + + $this->expectExceptionMessage('zwischen 1 und 3'); + (new VoteService())->submit($poll, $slide, 'p1', ['value' => '4']); + } + + public function testMultipleChoiceResults(): void + { + [$poll] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_CHOICE, ['settings' => ['multiple' => true]], ['A', 'B', 'C']); + $poll = $this->goLive($poll, $slide); + [$a, $b] = array_map(fn($o) => $o->id, $slide->slide_options); + + $service = new VoteService(); + $service->submit($poll, $slide, 'p1', ['option_ids' => [$a, $b]]); + $service->submit($poll, $slide, 'p2', ['option_ids' => [$a]]); + + $results = (new ResultsService())->forSlide($slide); + $this->assertSame(2, $results['participants']); + $this->assertSame(3, $results['votes']); + $this->assertSame([2, 1, 0], array_column($results['options'], 'count')); + $this->assertEqualsWithDelta(66.7, $results['options'][0]['percent'], 0.01); + } + + public function testWordcloudGroupsCaseInsensitivelyAndLimitsWords(): void + { + [$poll] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_WORDCLOUD, ['settings' => ['max_words' => 2]]); + $poll = $this->goLive($poll, $slide); + + $service = new VoteService(); + $service->submit($poll, $slide, 'p1', ['words' => ['Kaffee', ' tee ', 'Wasser']]); + $service->submit($poll, $slide, 'p2', ['words' => ['kaffee', '', 'KAFFEE']]); + + $results = (new ResultsService())->forSlide($slide); + $this->assertSame(['Kaffee', 'tee'], array_column($results['words'], 'text')); + $this->assertSame(['kaffee', 'tee'], array_column($results['words'], 'key')); + $this->assertSame([2, 1], array_column($results['words'], 'count')); + $this->assertEquals(1, $results['words'][0]['weight']); + } + + public function testWordcloudAcceptsWordsOneByOneAndCountsRepeatsAsUpvote(): void + { + [$poll] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_WORDCLOUD, ['settings' => ['max_words' => 0]]); + $poll = $this->goLive($poll, $slide); + + $service = new VoteService(); + $service->submit($poll, $slide, 'p1', ['word' => 'Kaffee']); + $service->submit($poll, $slide, 'p1', ['word' => 'Tee']); + $service->submit($poll, $slide, 'p1', ['word' => 'Wasser']); + $service->submit($poll, $slide, 'p1', ['word' => 'Saft']); + // Entering an existing word of someone else = upvote. + $service->submit($poll, $slide, 'p2', ['word' => 'kaffee ']); + + $results = (new ResultsService())->forSlide($slide); + $this->assertSame(2, $results['participants']); + $this->assertSame('Kaffee', $results['words'][0]['text']); + $this->assertSame(2, $results['words'][0]['count']); + $this->assertCount(4, $results['words']); + } + + public function testWordcloudRejectsOwnDuplicate(): void + { + [$poll] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_WORDCLOUD); + $poll = $this->goLive($poll, $slide); + + $service = new VoteService(); + $service->submit($poll, $slide, 'p1', ['word' => 'Kaffee']); + + $this->expectExceptionMessage('Diesen Begriff hast du schon genannt.'); + $service->submit($poll, $slide, 'p1', ['word' => 'KAFFEE']); + } + + public function testWordcloudLimitCountsAcrossSubmits(): void + { + [$poll] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_WORDCLOUD, ['settings' => ['max_words' => 2]]); + $poll = $this->goLive($poll, $slide); + + $service = new VoteService(); + $service->submit($poll, $slide, 'p1', ['word' => 'Kaffee']); + $service->submit($poll, $slide, 'p1', ['word' => 'Tee']); + + $state = (new PollStateService())->wordState($slide, 'p1'); + $this->assertSame(['kaffee', 'tee'], $state['mine']); + $this->assertSame(0, $state['remaining']); + $this->assertTrue($state['limitReached']); + + $this->expectExceptionMessage('Du hast bereits alle 2 Begriffe abgegeben.'); + $service->submit($poll, $slide, 'p1', ['word' => 'Wasser']); + } + + public function testWordcloudSettingsSanitizing(): void + { + $settings = SlidesTable::sanitizeSettings(Slide::TYPE_WORDCLOUD, ['max_words' => '-3', 'allow_upvotes' => '0']); + $this->assertSame(['max_words' => 0, 'allow_upvotes' => false, 'allow_downvotes' => true], $settings); + $settings = SlidesTable::sanitizeSettings(Slide::TYPE_WORDCLOUD, ['max_words' => '999', 'allow_downvotes' => '0']); + $this->assertSame(['max_words' => 50, 'allow_upvotes' => true, 'allow_downvotes' => false], $settings); + } + + public function testWordcloudDownvotes(): void + { + [$poll] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_WORDCLOUD, ['settings' => ['max_words' => 1]]); + $poll = $this->goLive($poll, $slide); + + $service = new VoteService(); + $service->submit($poll, $slide, 'p1', ['word' => 'Kaffee']); + $service->submit($poll, $slide, 'p2', ['word' => 'kaffee']); + $service->submit($poll, $slide, 'p3', ['word' => 'Kaffee', 'vote' => 'down']); + // Downvotes do not count towards max_words. + $service->submit($poll, $slide, 'p3', ['word' => 'Tee']); + + $results = (new ResultsService())->forSlide($slide); + $this->assertSame(3, $results['participants']); + $this->assertSame(['Kaffee', 'Tee'], array_column($results['words'], 'text')); + $this->assertSame([2, 1], array_column($results['words'], 'count')); + $this->assertSame([1, 0], array_column($results['words'], 'down')); + + $state = (new PollStateService())->wordState($slide, 'p3'); + $this->assertSame(['tee'], $state['mine']); + $this->assertSame(['kaffee'], $state['down']); + $this->assertTrue($state['allowDownvotes']); + } + + public function testWordcloudDownvoteRules(): void + { + [$poll] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_WORDCLOUD); + $poll = $this->goLive($poll, $slide); + $service = new VoteService(); + $service->submit($poll, $slide, 'p1', ['word' => 'Kaffee']); + + $cases = [ + ['p1', 'Kaffee', 'Du hast diesen Begriff selbst genannt.'], + ['p2', 'Wasser', 'Diesen Begriff gibt es nicht in der Wortwolke.'], + ]; + foreach ($cases as [$participant, $word, $expected]) { + try { + $service->submit($poll, $slide, $participant, ['word' => $word, 'vote' => 'down']); + $this->fail('VoteException expected for ' . $word); + } catch (VoteException $e) { + $this->assertSame($expected, $e->getMessage()); + } + } + + $service->submit($poll, $slide, 'p2', ['word' => 'Kaffee', 'vote' => 'down']); + $this->expectExceptionMessage('Diesen Begriff hast du bereits abgelehnt.'); + // Upvoting after a downvote is not possible. + $service->submit($poll, $slide, 'p2', ['word' => 'Kaffee']); + } + + public function testWordcloudDownvotesCanBeDisabled(): void + { + [$poll] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_WORDCLOUD, ['settings' => ['allow_downvotes' => false]]); + $poll = $this->goLive($poll, $slide); + $service = new VoteService(); + $service->submit($poll, $slide, 'p1', ['word' => 'Kaffee']); + + $this->expectExceptionMessage('Downvotes sind bei dieser Frage nicht möglich.'); + $service->submit($poll, $slide, 'p2', ['word' => 'Kaffee', 'vote' => 'down']); + } +} diff --git a/tests/TestCase/View/Helper/.gitkeep b/tests/TestCase/View/Helper/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..6a36a98 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,60 @@ +loadSqlFiles('./tests/schema.sql', 'test'); + +(new Migrator())->run(); diff --git a/webroot/.htaccess b/webroot/.htaccess new file mode 100644 index 0000000..f5f2d63 --- /dev/null +++ b/webroot/.htaccess @@ -0,0 +1,5 @@ + + RewriteEngine On + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [L] + diff --git a/webroot/css/normalize.min.css b/webroot/css/normalize.min.css new file mode 100644 index 0000000..bde07fc --- /dev/null +++ b/webroot/css/normalize.min.css @@ -0,0 +1,8 @@ +/** + * Minified by jsDelivr using clean-css v4.2.1. + * Original file: /npm/normalize.css@8.0.1/normalize.css + * + * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files + */ +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ +html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none} diff --git a/webroot/css/plenario.css b/webroot/css/plenario.css new file mode 100644 index 0000000..7dc6ca6 --- /dev/null +++ b/webroot/css/plenario.css @@ -0,0 +1,335 @@ +/* + * Plenario stylesheet – no framework, no build step. + * Sections: tokens · base · layout · components · forms · admin · participant · results · presenter + */ + +/* ---------------------------------------------------------------- tokens */ +:root { + --bg: #f5f6fb; + --surface: #ffffff; + --surface-2: #eef0f8; + --text: #1d1f33; + --muted: #5d6280; + --border: #dde0ee; + --primary: #4b3fe0; + --primary-ink: #ffffff; + --primary-soft: #ebe9fd; + --danger: #c42b4b; + --ok: #18865a; + --warn: #a86400; + --radius: 12px; + --shadow: 0 1px 2px rgba(20, 22, 50, .06), 0 4px 16px rgba(20, 22, 50, .05); + --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; + + --c0: #4b3fe0; + --c1: #e0457b; + --c2: #12a08a; + --c3: #f29a1f; + --c4: #2f8fe0; + --c5: #8e44c9; +} + +@media (prefers-color-scheme: dark) { + :root:not(.present) { + --bg: #12131d; + --surface: #1b1d2b; + --surface-2: #24263a; + --text: #eceefa; + --muted: #a1a6c3; + --border: #30334a; + --primary: #7f75ff; + --primary-soft: #2a2752; + --shadow: none; + } +} + +/* ---------------------------------------------------------------- base */ +*, *::before, *::after { box-sizing: border-box; } + +html { font-size: 16px; } + +body { + margin: 0; + background: var(--bg); + color: var(--text); + font-family: var(--font); + line-height: 1.55; + -webkit-font-smoothing: antialiased; +} + +a { color: var(--primary); } +a:hover { text-decoration-thickness: 2px; } + +h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; } +h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); } +h2 { font-size: 1.25rem; } +h3 { font-size: 1.05rem; margin-top: 1.6em; } + +.muted { color: var(--muted); } +.center { text-align: center; } +.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--primary); margin: 0 0 .4em; } +.lead { font-size: 1.15rem; color: var(--muted); } +.hint { font-size: .875rem; color: var(--muted); margin: .25em 0 1em; } +.hint--error { color: var(--danger); } +.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } +[hidden] { display: none !important; } + +/* ---------------------------------------------------------------- layout */ +.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; } +.main { padding-top: 32px; padding-bottom: 48px; min-height: calc(100vh - 140px); } + +.site-header { background: var(--surface); border-bottom: 1px solid var(--border); } +.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; } +.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; } +.brand__mark { width: 22px; height: 22px; border-radius: 6px; background: conic-gradient(var(--c0) 0 40%, var(--c1) 0 65%, var(--c2) 0 85%, var(--c3) 0); } +.site-nav { display: flex; gap: 20px; font-size: .95rem; } +.site-nav a { color: var(--muted); text-decoration: none; } +.site-nav a:hover { color: var(--text); } +.site-footer { padding: 24px 16px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); } + +.grid { display: grid; gap: 24px; } +.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } +.grid--tight { gap: 0 16px; } +.grid--sidebar { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } +@media (max-width: 900px) { + .grid--sidebar { grid-template-columns: 1fr; } +} + +/* ---------------------------------------------------------------- components */ +.card { + background: var(--surface); + border: 1px solid var(--border); + border-radius: var(--radius); + padding: 24px; + box-shadow: var(--shadow); + margin-bottom: 24px; +} +.card--narrow { max-width: 520px; margin-left: auto; margin-right: auto; } +.card--form { max-width: 720px; } +.card--accent { background: var(--primary-soft); border-color: transparent; } +.card--danger h2 { color: var(--danger); } + +.hero { text-align: center; max-width: 760px; margin: 16px auto 40px; } +.hero h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); } + +.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 16px; } +.features div { padding: 16px; border-radius: var(--radius); background: var(--surface-2); } +.features strong { display: block; } +.features span { color: var(--muted); font-size: .9rem; } + +.button { + display: inline-flex; align-items: center; justify-content: center; gap: 6px; + padding: 10px 18px; border-radius: 8px; border: 1px solid var(--border); + background: var(--surface); color: var(--text); font: inherit; font-weight: 600; + text-decoration: none; cursor: pointer; line-height: 1.2; white-space: nowrap; +} +.button:hover { border-color: var(--primary); } +.button:disabled { opacity: .6; cursor: wait; } +.button--primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); } +.button--primary:hover { filter: brightness(1.08); } +.button--danger { color: var(--danger); } +.button--danger:hover { border-color: var(--danger); } +.button--ghost { border-color: transparent; background: transparent; } +.button--small { padding: 6px 10px; font-size: .85rem; } +.button--icon { min-width: 32px; } +.button--block { width: 100%; padding: 14px; font-size: 1.05rem; } + +.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--muted); } +.badge--ok { background: #dff5ea; color: var(--ok); } +.badge--off { background: #fbe3e8; color: var(--danger); } +.badge--live { background: var(--c1); color: #fff; } +.badge--type-choice { background: #e9e7ff; color: #3a2fc4; } +.badge--type-wordcloud { background: #fde4ee; color: #b12a5d; } +.badge--type-open { background: #dcf5f0; color: #0b7766; } +.badge--type-scale { background: #fdeed8; color: #9a5a00; } +.badge--type-content { background: #e3eefb; color: #1f6bb0; } + +.message { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; cursor: pointer; background: var(--surface-2); border-left: 4px solid var(--muted); } +.message.success { border-color: var(--ok); } +.message.error { border-color: var(--danger); } +.message.warning { border-color: var(--warn); } +.message.hidden { display: none; } + +.notice { padding: 12px 16px; border-radius: 8px; background: #fff6e0; color: #6b4a00; margin-bottom: 24px; font-size: .95rem; } +@media (prefers-color-scheme: dark) { .notice { background: #3a2f12; color: #f3d98f; } } + +.devnote { margin-top: 24px; padding: 16px; border: 2px dashed var(--warn); border-radius: var(--radius); } +.icon-circle { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; background: var(--primary-soft); color: var(--primary); } +.empty { padding: 24px; border: 2px dashed var(--border); border-radius: var(--radius); color: var(--muted); text-align: center; } + +/* ---------------------------------------------------------------- forms */ +form .input { margin-bottom: 16px; } +form .input label { display: block; font-weight: 600; margin-bottom: 6px; } +form .input.checkbox label { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; } +form .input.checkbox input { margin-top: 5px; } + +input[type=text], input[type=email], input[type=number], input[type=url], select, textarea { + width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; + background: var(--surface); color: var(--text); font: inherit; +} +input:focus, select:focus, textarea:focus, .button:focus-visible { outline: 3px solid var(--primary-soft); border-color: var(--primary); } +textarea { resize: vertical; } +.input-short { max-width: 160px; } +.input-code { text-transform: uppercase; letter-spacing: .15em; font-weight: 700; } +.input-code--big { font-size: 2rem; text-align: center; padding: 16px; } +.error-message { color: var(--danger); font-size: .875rem; margin-top: 4px; } +.input.error input, .input.error textarea { border-color: var(--danger); } +.form-actions { display: flex; gap: 12px; margin-top: 8px; } + +/* ---------------------------------------------------------------- admin */ +.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; } +.admin-head h1 { margin-bottom: .2em; word-break: break-word; } +.admin-head__actions { display: flex; gap: 10px; flex-wrap: wrap; } + +.slide-list { list-style: none; padding: 0; margin: 0 0 16px; } +.slide-item { + display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 16px; align-items: center; + background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); + padding: 14px 16px; margin-bottom: 10px; +} +.slide-item--current { border-color: var(--c1); box-shadow: 0 0 0 2px rgba(224, 69, 123, .15); } +.slide-item__pos { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; } +.slide-item__meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .85rem; margin-bottom: 4px; } +.slide-item__title { font-weight: 600; color: var(--text); text-decoration: none; word-break: break-word; } +.slide-item__options { margin: 4px 0 0; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.slide-item__actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; } +@media (max-width: 700px) { + .slide-item { grid-template-columns: 32px minmax(0, 1fr); } + .slide-item__actions { grid-column: 1 / -1; justify-content: flex-start; } +} + +.type-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; } +.type-card { display: block; padding: 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: var(--text); border-top: 4px solid var(--c0); } +.type-card:hover { border-color: var(--primary); } +.type-card strong { display: block; } +.type-card span { font-size: .85rem; color: var(--muted); } +.type-card--wordcloud { border-top-color: var(--c1); } +.type-card--open { border-top-color: var(--c2); } +.type-card--scale { border-top-color: var(--c3); } +.type-card--content { border-top-color: var(--c4); } + +.join-code { font-size: 2rem; font-weight: 800; letter-spacing: .12em; text-align: center; margin: 0 0 12px; } +.qr { display: block; margin: 0 auto 16px; background: #fff; border-radius: 8px; padding: 6px; } +.copy-field { display: flex; gap: 8px; } +.copy-field input { font-size: .85rem; } + +/* ---------------------------------------------------------------- participant */ +.participant .main { max-width: 640px; } +.participant .site-nav { display: none; } +.question { font-size: 1.5rem; } +.choices { display: grid; gap: 10px; margin: 16px 0 20px; } +.choice { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border: 2px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 500; } +.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); } +.choice input { width: 20px; height: 20px; accent-color: var(--primary); } +.word-input { margin-bottom: 10px; } +.word-entry .word-input { margin-bottom: 0; } +/* In the flow (not absolute) so it pushes message and button down instead of covering them. */ +.suggestions { margin: 4px 0 0; padding: 4px; max-height: 50vh; overflow-y: auto; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); } +.suggestion { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 8px; cursor: pointer; } +.suggestion:hover, .suggestion.is-active { background: var(--primary-soft); } +.suggestion.is-mine { cursor: default; opacity: .6; } +.suggestion__text { font-weight: 600; word-break: break-word; } +.suggestion__meta { font-size: .8rem; color: var(--muted); white-space: nowrap; align-self: center; } +.word-message { min-height: 1.4em; margin: 8px 0 0; font-size: .9rem; color: var(--ok); } +.word-message.is-error { color: var(--danger); } +.vote-form textarea { margin: 12px 0 16px; } +.vote-form .button { margin-top: 12px; } +.scale { display: flex; gap: 6px; margin: 20px 0 6px; } +.scale__step { flex: 1; } +.scale__step input { position: absolute; opacity: 0; } +.scale__step span { display: block; text-align: center; padding: 14px 0; border: 2px solid var(--border); border-radius: 8px; font-weight: 700; cursor: pointer; } +.scale__step input:checked + span { border-color: var(--primary); background: var(--primary); color: #fff; } +.scale__step input:focus-visible + span { outline: 3px solid var(--primary-soft); } +.scale__labels { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); } +.done { font-size: 1.1rem; font-weight: 600; color: var(--ok); } +.waiting { padding: 48px 24px; } +.pulse { width: 18px; height: 18px; border-radius: 50%; background: var(--primary); margin: 0 auto 24px; animation: pulse 1.6s infinite; } +@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(75, 63, 224, .5); } 100% { box-shadow: 0 0 0 24px rgba(75, 63, 224, 0); } } +.prose { font-size: 1.1rem; } + +/* ---------------------------------------------------------------- results (shared) */ +.results-empty { color: var(--muted); font-style: italic; } +.is-hidden { visibility: hidden; } + +.bars { display: grid; gap: 14px; } +.bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label value" "track track"; gap: 4px 12px; } +.bar__label { grid-area: label; font-weight: 600; word-break: break-word; } +.bar__value { grid-area: value; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; } +.bar__track { grid-area: track; height: 14px; background: var(--surface-2); border-radius: 99px; overflow: hidden; } +.bar__fill { height: 100%; border-radius: 99px; background: var(--c0); transition: width .6s ease; min-width: 2px; } +.bar--c1 .bar__fill { background: var(--c1); } +.bar--c2 .bar__fill { background: var(--c2); } +.bar--c3 .bar__fill { background: var(--c3); } +.bar--c4 .bar__fill { background: var(--c4); } +.bar--c5 .bar__fill { background: var(--c5); } + +.columns { display: flex; gap: 8px; align-items: stretch; height: 180px; } +.column { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; } +.column__count { font-size: .85rem; color: var(--muted); } +.column__track { flex: 1; width: 100%; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 6px; overflow: hidden; } +.column__fill { width: 100%; background: var(--c3); transition: height .6s ease; } +.column__label { font-weight: 700; } +.average { font-size: 1.1rem; margin: 0 0 12px; } +.average strong { font-size: 1.6em; } + +.cloud { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .2em .6em; line-height: 1.15; padding: 8px; } +.cloud__word { font-weight: 800; color: var(--c0); transition: font-size .6s ease; } +.cloud__word--c1 { color: var(--c1); } +.cloud__word--c2 { color: var(--c2); } +.cloud__word--c3 { color: var(--c3); } +.cloud__word--c4 { color: var(--c4); } +.cloud__word--c5 { color: var(--c5); } +.cloud__word { display: inline-flex; align-items: baseline; gap: .25em; } +.cloud__count { font-size: max(.75rem, .4em); font-weight: 600; color: var(--muted); white-space: nowrap; } +.cloud__count--up { color: var(--ok); } +.cloud__count--down { color: var(--danger); } +.stage .cloud__count { font-size: max(.9rem, .4em); } +/* Participant cloud: word (+) and − are separate buttons */ +.cloud--interactive .cloud__word { gap: .1em; } +.cloud__vote { font: inherit; font-weight: inherit; color: inherit; line-height: 1.15; background: none; border: 2px solid transparent; border-radius: 10px; padding: .05em .3em; cursor: pointer; display: inline-flex; align-items: baseline; gap: .25em; } +.cloud__vote:hover:not(:disabled), .cloud__vote:focus-visible { border-color: currentColor; } +.cloud__vote:disabled { cursor: default; } +.cloud__vote--down { padding: .05em .25em; } +.cloud__word.is-mine .cloud__vote--up, .cloud__word.is-down .cloud__vote--down { background: var(--surface-2); } +.cloud__word.is-down .cloud__vote--up { opacity: .55; } + +.answers { list-style: none; padding: 0; margin: 0; columns: 280px; column-gap: 12px; } +.answer { break-inside: avoid; background: var(--surface-2); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; word-break: break-word; } + +/* ---------------------------------------------------------------- presenter */ +body.present { + --bg: #0f1020; + --surface-2: #1f2140; + --text: #f3f4ff; + --muted: #a3a7cf; + background: radial-gradient(1200px 600px at 10% -10%, #2a1f6e 0%, transparent 60%), var(--bg); + color: var(--text); + overflow: hidden; +} +.stage { display: grid; grid-template-rows: auto 1fr auto; height: 100vh; padding: 20px 4vw; } +.stage__top { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: clamp(1rem, 1.6vw, 1.4rem); color: var(--muted); } +.stage__top strong { color: var(--text); } +.stage__code { letter-spacing: .12em; background: rgba(255, 255, 255, .1); padding: 2px 10px; border-radius: 8px; } +.stage__qr { border: 0; padding: 4px; background: #fff; border-radius: 8px; cursor: zoom-in; } +.stage__qr img { display: block; width: 72px; height: 72px; } +.stage__main { display: flex; flex-direction: column; justify-content: center; min-height: 0; overflow: auto; padding: 2vh 0; } +.stage__type { text-transform: uppercase; letter-spacing: .12em; color: var(--c1); font-weight: 700; margin: 0 0 .6em; } +.stage__question { font-size: clamp(2rem, 4.5vw, 4rem); margin-bottom: .3em; } +.stage__description { font-size: clamp(1.1rem, 2vw, 1.6rem); color: var(--muted); white-space: pre-line; margin-top: 0; } +.stage--content .stage__description { color: var(--text); font-size: clamp(1.3rem, 2.6vw, 2.2rem); } +.stage__results { font-size: clamp(1rem, 1.8vw, 1.5rem); margin-top: 2vh; } +.stage--closed .stage__type::after { content: " · Abstimmung geschlossen"; color: var(--muted); } +.stage .bar__track { height: 1.1em; } +.stage .columns { height: 34vh; } +.stage .cloud { font-size: clamp(1.4rem, 2.6vw, 2.6rem); } +.stage .answers { columns: 340px; } + +.stage__controls { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; opacity: .35; transition: opacity .2s; padding-top: 12px; } +.stage__controls:hover, .stage__controls:focus-within { opacity: 1; } +.ctrl { min-width: 44px; height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .06); color: var(--text); font: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; } +.ctrl:hover { background: rgba(255, 255, 255, .15); } +.ctrl-counter { color: var(--muted); min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; } + +.qr-overlay { position: fixed; inset: 0; background: rgba(8, 9, 20, .92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; cursor: zoom-out; z-index: 10; } +.qr-overlay img { width: min(70vh, 80vw); height: auto; background: #fff; border-radius: 16px; padding: 16px; } +.qr-overlay p { font-size: 1.4rem; } diff --git a/webroot/favicon.ico b/webroot/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..49a060fc46e2bdfb8f3908c1873a45aa0e9babd0 GIT binary patch literal 15086 zcmeHN33OD|8GdXgfGk>Z0d2xEnSI~)C7H=&5|*$8g0gCbs@R^?9$R|^6zfv$k$T!% zk9Ku|7Vs!b5<({Pwn+d%IK|U~wg?I$t(DM<0f9`vJ2Q_=;+x4tskL_I%suzLyZrxu z|NAfZ|KFvkLDUdx>{tqQDYbkkMOi3{DlJXDuSff@(5BO+-z5|k8b?twj6oM>q}owY z6vq88{Tjlr56YL`u!$b(QgKq7oUgaa`3EgB{yEe?^=P?k1sD-Wbck2aj13x@VL}_J zeFmn;D(4ZZD7m0h&W#u5liH`F$DqH~BInj(d=u!|3p#0^ zfm4$H<^|C4a>56n+H`6gV&-4$Sd%6jvHMZYbAt8n1@)dGvIx zN7J#;Bj@MVSlQ770+z?%l`A$3sxq_JdDYxhyOMtlzG}N!#velYz$}fQflWSdlEM$j z_~Su4J0%y$x#8Af5hpWxet^x(-c>o6tK2HK!7AhS!zQ22VY3sky~l&rcrW~O!)?QY zme>UNw17j+eAlMnHo{Ns1k6<-OYFK_v`+WOitS478LaK1G3D!f`Ila_NVx=j-?4}- zt_Ygw@z|FN_`dJKC%kNtvEUVV#)vVdvbX@Fo6u6_h-I~cPEFH9@b+j1o^JS=e_@>m zaemltSF+E+7p-w9_y(^wzO2H;E_16n;*0)bk;aKX6>y2x@Q!w6M2CTKLVfM2)TX0qvmUZ26|G&vwe(L z$A)nRY&1*S$uU{<7xDh~s)&2jWYNxa;~jJN44GNpSX>uw962k{G1;l+c32f`lS9R< z@@kptuq8Ti7I-BFquSb9Qe&jA7wZ#it99)v_8V!5TiaFx*=n#WnWrE_8^F&Nn}Y3d zsQK;HPS!Lpvh517`C@G^Jh`{m9*T_#o46a@YWB_~zhpd-hjU_kO!O~gY44?f0=&i3 zxM5*)`*@!|=69&M1wIp(ldr-&pPsI=$yuWN7YR;dkN$j0reS}M1=IK!1^HniYjlE3 zPY0aPdxw(U2%R}(ktX$!oY@azP4gbPt1;{P1I8WKLSA1NTdPU3lB0;}D67|Lm%5&_9-(ReR0L@!l=$O~3XEFrojaZDo8`{j)0@ zfu9)&{(R|7jwARTlK$`yX#E4mZ_k0>t!^JF|R8 zu~X6h4E7YVe|c#z!e85z%!Y`&X^gn^rCKYk>{U)J{T)aZgKNRuD5MMPzmk+|v{T=YmfIsI^cSD|1 zd?n9P?gH9AM)?4G`KC?AM_~h=M65lh!pcloR=+W;-V1oM)pZro;;@Om!E0dEE)DC0 zO`GY{@(Uc&_!3)L`%Qa>7{RcW}Mk*DYO?j@KxeK zBG(TYhzrO#bW)vTI*X_=rxVneuEd~IiG(+iIFd+oqyH>*p`??d$8=KEr^*G2@*)+H z3qykBDRd}{Q7+{vL{BsrQ1}%%P~bp;0|gEgIPibSfgdmZVDOUa-NiG5o5#)#GUMlX z_f3rGc1psE_@w!+U3upqz6jPWinJG3+1QexA@299cP;m5m`9OUTJMm@TWm`DHLH?& z)256cwMg6Fb12yTGkkPj`HBA|?ehZM$cTxvd)55+k-ut0p64)$caTTyHXxU1NXCRD z21~_Q#xgFIA5rips{QPx?_T-RxS+PJsIG$T^}Q?KxtZhYtC%Z8I;IZsRul5Jr$}5z zV!+HeFjs7hb-p*%)6p;e--zrhu5q@Nmh0Inua;hESFu}=6KxIZ>E*M1Exo>7X404I zd76v;x>LixhN2?|mt$q6z%w&c;)%^1*UZ-MnalZHT33R8%L4Krcg7ANaYq#`{ z8PTF@M{IJrftd;!T;otO%_M(|*!nE;w~1s)$K0vBKw1`&TOhnc4m4I9pf7z_?@Mpr zcb{?dB=G&6%p3!e9pq>erX+6=-y^m+N#h?Oray+<@B!pN5!Z8@oO1rxer@~De0pwe zg*o;}*u?w@ecO>II0}A><|~D@i`KvgUHizZ;yiun%=YfoY?2^fcRVv!V?f>#JUi)9 zvYc1NKjqc1w^kT9Z`jf{Wp;V%xcRd;3}5}teM2*0E{g2E26>-95*`wn5b_$Lbf)<) z)`xjrP6;2#gq`czt=%XwOPS+@|Hw_Au`AeCkCs_cX`?j@t74;?o^Q!3f3Z0H#yGpO z{eU1JJvx+@yX1F}R4zBU*T~fX-$~%(VKZ7xa`wYiJKtrOGI`VQRBn-2kT1pe5ZgWatWOtx68c;pvc{BiL(Hi4&psi#r}HYejPYutYusgVU%t5K&s;nD=Gi~T zt)hYdR;|2i@DCa`U2*^2e9>*Q_T1>zajkYW&AQdh6Mkc~F5+la)CK7)pLv`WrB@8& z;!x|=ivrQSa*Sg0`?lSF%epHfp62UAX4)9gw@nQg+E(Bj!VjIQ_|tYJz0Rd>+lCxv ztH;2% z#3$suK*UR?h@G*VYLFSnuKhxa1$_SpNvv(BFuOVpj=5E~Gd(fe#o6QRL2Qc!W_|BPIr2>?Y6#jW_x#PH%W{#rq}sF z6mI|f(T#J|g&zHeUSFbH;B{{L)8~#Zn}pBXf4S7JNK7&s^b;Ka{W8$=Pl5i+yJrLE z|Epg{`N>=U%S~G*S>$y3eygBgg1xxByv?OwDZhg=d>M&fn7recCG$29cPl%7mx?z) zcRKFMh3j(n5!w+mCG@E6s#tVpaO;51lhxLan_O!4C9|B#c~|Um)13*=AY;!vRrL0d zt681R*5_)kt!)|QH%I3p-fl9>*;B-y_2haoa_Qc7E?RT-)km5};tr18P4ZWY_H8y9_gCDNJ_GqmeydN$^`F5{5c)}h ztaRa=^)7NgZMfU@aL~+E)K;}-y-$~m*8chyh4vL!y0({uEN%XPCcccEuW*m)C7d-| zkY{)ed-W#b&Lg;IaNJTBKVgx?Pgte#<7hjInD#B3g5HBW`ccHie{gAIkK>$mS6CMh zO}Fxr`e1AXyEgHK#|ig+`;Ec%HGJ`$(5qwXD`Vs9e7j2{`uG%2Sx1?3%1&v8YL{fT zd-ufpN`AtO(92`%rpAUZn}1|Tf4nO67dTMhK!F1V4iq@>RpmhH5|MD3=yKHLUJ~GR zrt8&I;vC+)(L}AHDBNA@q`b)*x0p~5K_{unjV4lKatZ2-iNv5pEJ;sE5?+E%!9Cjp z_adf{|LRpq_!rV}SEuU~JhE}#41E2(gHDRjnOKc`Qv^6JU=@-2QXw28@0X|kH%qw6 AlmGw# literal 0 HcmV?d00001 diff --git a/webroot/index.php b/webroot/index.php new file mode 100644 index 0000000..cde1e5e --- /dev/null +++ b/webroot/index.php @@ -0,0 +1,37 @@ +emit($server->run()); diff --git a/webroot/js/.gitkeep b/webroot/js/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/webroot/js/plenario.js b/webroot/js/plenario.js new file mode 100644 index 0000000..5ad05d3 --- /dev/null +++ b/webroot/js/plenario.js @@ -0,0 +1,780 @@ +/** + * Plenario frontend – plain JavaScript, no build step, no dependencies. + * + * Modules (auto-initialised by data attributes): + * - [data-copy] copy the value of the sibling [data-copy-source] + * - [data-presenter] presenter screen, polls /admin/{token}/state + * - [data-participant] participant page, polls /p/{code}/state + * + * Results JSON shape: see src/Service/ResultsService.php + */ +(function () { + 'use strict'; + + // ------------------------------------------------------------------ helpers + + function el(tag, attrs, children) { + var node = document.createElement(tag); + Object.keys(attrs || {}).forEach(function (key) { + if (key === 'text') { + node.textContent = attrs[key]; + } else if (key === 'style') { + node.setAttribute('style', attrs[key]); + } else { + node.setAttribute(key, attrs[key]); + } + }); + (children || []).forEach(function (child) { + if (child) { + node.appendChild(child); + } + }); + return node; + } + + function csrfToken() { + var meta = document.querySelector('meta[name="csrf-token"]'); + return meta ? meta.getAttribute('content') : ''; + } + + function getJson(url) { + return fetch(url, { + headers: { Accept: 'application/json' }, + credentials: 'same-origin', + cache: 'no-store' + }).then(function (response) { + if (!response.ok) { + throw new Error('HTTP ' + response.status); + } + return response.json(); + }); + } + + function postJson(url, data) { + var body = new FormData(); + Object.keys(data).forEach(function (key) { + body.append(key, data[key]); + }); + return fetch(url, { + method: 'POST', + body: body, + credentials: 'same-origin', + headers: { + Accept: 'application/json', + 'X-Requested-With': 'XMLHttpRequest', + 'X-CSRF-Token': csrfToken() + } + }).then(function (response) { + if (!response.ok) { + throw new Error('HTTP ' + response.status); + } + return response.json(); + }); + } + + /** Polls `fn` every `interval` ms, pauses while the tab is hidden. */ + function poll(fn, interval) { + var timer = null; + function tick() { + Promise.resolve(fn()).catch(function () { /* retry next tick */ }).then(schedule); + } + function schedule() { + clearTimeout(timer); + timer = setTimeout(tick, document.hidden ? interval * 5 : interval); + } + document.addEventListener('visibilitychange', function () { + if (!document.hidden) { + tick(); + } + }); + tick(); + return { now: tick }; + } + + function formatNumber(value) { + return Number(value).toLocaleString('de-DE'); + } + + // ------------------------------------------------------------------ word matching + + /** + * Suggestions for the word cloud input: prefix/substring matches, small + * typos (Levenshtein) and similar sounding words (Kölner Phonetik). + */ + var Words = { + /** Lower case, umlauts folded, accents and non-alphanumerics removed. */ + fold: function (text) { + return String(text).toLowerCase() + .replace(/ä/g, 'ae').replace(/ö/g, 'oe').replace(/ü/g, 'ue').replace(/ß/g, 'ss') + .normalize('NFD').replace(/[̀-ͯ]/g, '') + .replace(/[^a-z0-9]/g, ''); + }, + + /** Kölner Phonetik – phonetic code for German words. */ + phonetic: function (text) { + var s = String(text).toUpperCase() + .replace(/Ä/g, 'A').replace(/Ö/g, 'O').replace(/Ü/g, 'U').replace(/ß/g, 'S') + .normalize('NFD').replace(/[̀-ͯ]/g, '') + .replace(/[^A-Z]/g, ''); + var codes = ''; + for (var i = 0; i < s.length; i++) { + var c = s[i]; + var prev = i > 0 ? s[i - 1] : ''; + var next = s[i + 1] || ''; + var code = ''; + if ('AEIJOUY'.indexOf(c) >= 0) { + code = '0'; + } else if (c === 'B') { + code = '1'; + } else if (c === 'P') { + code = next === 'H' ? '3' : '1'; + } else if (c === 'D' || c === 'T') { + code = next && 'CSZ'.indexOf(next) >= 0 ? '8' : '2'; + } else if ('FVW'.indexOf(c) >= 0) { + code = '3'; + } else if ('GKQ'.indexOf(c) >= 0) { + code = '4'; + } else if (c === 'C') { + if (i === 0) { + code = next && 'AHKLOQRUX'.indexOf(next) >= 0 ? '4' : '8'; + } else { + code = next && 'AHKOQUX'.indexOf(next) >= 0 && 'SZ'.indexOf(prev) < 0 ? '4' : '8'; + } + } else if (c === 'X') { + code = prev && 'CKQ'.indexOf(prev) >= 0 ? '8' : '48'; + } else if (c === 'L') { + code = '5'; + } else if (c === 'M' || c === 'N') { + code = '6'; + } else if (c === 'R') { + code = '7'; + } else if (c === 'S' || c === 'Z') { + code = '8'; + } + // H and anything else: no code + codes += code; + } + var collapsed = ''; + for (var j = 0; j < codes.length; j++) { + if (codes[j] !== collapsed[collapsed.length - 1]) { + collapsed += codes[j]; + } + } + return collapsed.charAt(0) + collapsed.slice(1).replace(/0/g, ''); + }, + + levenshtein: function (a, b) { + if (a === b) { + return 0; + } + var row = []; + for (var j = 0; j <= b.length; j++) { + row.push(j); + } + for (var i = 1; i <= a.length; i++) { + var diag = row[0]; + row[0] = i; + for (var k = 1; k <= b.length; k++) { + var tmp = row[k]; + row[k] = Math.min(row[k] + 1, row[k - 1] + 1, diag + (a[i - 1] === b[k - 1] ? 0 : 1)); + diag = tmp; + } + } + return row[b.length]; + }, + + /** Score 0 (no match) .. 100 (same word). */ + score: function (input, word) { + var a = Words.fold(input); + var b = Words.fold(word); + if (!a || !b) { + return 0; + } + if (a === b) { + return 100; + } + if (b.indexOf(a) === 0) { + return 90 - Math.min(20, b.length - a.length); + } + var pa = Words.phonetic(input); + var pb = Words.phonetic(word); + if (a.length >= 3 && pa && pa === pb) { + return 70; + } + var tolerance = a.length >= 8 ? 2 : (a.length >= 4 ? 1 : 0); + if (tolerance && Words.levenshtein(a, b) <= tolerance) { + return 65; + } + if (a.length >= 3 && b.indexOf(a) > 0) { + return 60; + } + // Typo within what has been typed so far ("Kafe" → "Kaffeemaschine"). + if (tolerance && b.length > a.length && Words.levenshtein(a, b.slice(0, a.length)) <= tolerance) { + return 50; + } + if (a.length >= 4 && pa.length >= 3 && pb.indexOf(pa) === 0) { + return 45; + } + return 0; + }, + + /** Matching existing cloud words ({key, text, count}) for an input, best first; optional limit. */ + suggest: function (input, words, limit) { + if (Words.fold(input).length < 2) { + return []; + } + return words + .map(function (word) { return { word: word, score: Words.score(input, word.text) }; }) + .filter(function (item) { return item.score > 0; }) + .sort(function (x, y) { return y.score - x.score || y.word.count - x.word.count; }) + .slice(0, limit || undefined) + .map(function (item) { return item.word; }); + } + }; + + // ------------------------------------------------------------------ results + + var Results = { + /** + * @param {Object} [options] renderer specific; wordcloud: {mine: [keys], onUpvote: fn(word)|null} + */ + render: function (container, results, options) { + container.innerHTML = ''; + if (!results) { + return; + } + var renderer = Results[results.type]; + if (typeof renderer !== 'function') { + return; + } + if (results.participants === 0) { + container.appendChild(el('p', { class: 'results-empty', text: 'Noch keine Antworten' })); + return; + } + container.appendChild(renderer(results, options || {})); + }, + + choice: function (results) { + var max = Math.max.apply(null, results.options.map(function (o) { return o.count; }).concat([1])); + return el('div', { class: 'bars' }, results.options.map(function (option, index) { + return el('div', { class: 'bar bar--c' + (index % 6) }, [ + el('div', { class: 'bar__label', text: option.label }), + el('div', { class: 'bar__track' }, [ + el('div', { class: 'bar__fill', style: 'width:' + (option.count / max * 100) + '%' }) + ]), + el('div', { class: 'bar__value', text: formatNumber(option.percent) + ' % (' + option.count + ')' }) + ]); + })); + }, + + scale: function (results) { + var max = Math.max.apply(null, results.buckets.map(function (b) { return b.count; }).concat([1])); + var columns = el('div', { class: 'columns' }, results.buckets.map(function (bucket) { + return el('div', { class: 'column' }, [ + el('div', { class: 'column__count', text: String(bucket.count) }), + el('div', { class: 'column__track' }, [ + el('div', { class: 'column__fill', style: 'height:' + (bucket.count / max * 100) + '%' }) + ]), + el('div', { class: 'column__label', text: String(bucket.value) }) + ]); + })); + var labels = el('div', { class: 'scale__labels' }, [ + el('span', { text: results.minLabel || '' }), + el('span', { text: results.maxLabel || '' }) + ]); + var average = el('p', { class: 'average' }, [ + el('span', { text: 'Durchschnitt ' }), + el('strong', { text: results.average === null ? '–' : formatNumber(results.average) }) + ]); + return el('div', { class: 'scale-results' }, [average, columns, labels]); + }, + + /** + * options: {mine: [keys], down: [keys], onUpvote: fn(word)|null, onDownvote: fn(word)|null} + * Counts are shown as "+up" and "−down" (down only when > 0 or clickable). + */ + wordcloud: function (results, options) { + var mine = (options && options.mine) || []; + var down = (options && options.down) || []; + var onUpvote = options && options.onUpvote; + var onDownvote = options && options.onDownvote; + // Interleave big and small words so the biggest ends up in the middle. + var words = results.words.slice(); + var ordered = []; + words.forEach(function (word, index) { + if (index % 2 === 0) { + ordered.push(word); + } else { + ordered.unshift(word); + } + }); + return el('div', { class: 'cloud' + (onUpvote ? ' cloud--interactive' : '') }, ordered.map(function (word, index) { + var size = 0.9 + word.weight * 2.6; + var isMine = mine.indexOf(word.key) >= 0; + var isDown = down.indexOf(word.key) >= 0; + var rated = isMine || isDown; + var downCount = word.down || 0; + var attrs = { + class: 'cloud__word cloud__word--c' + (index % 6) + (isMine ? ' is-mine' : '') + (isDown ? ' is-down' : ''), + style: 'font-size:' + size.toFixed(2) + 'em', + title: '+' + word.count + ' / −' + downCount + + (isMine ? ' – von dir genannt' : (isDown ? ' – von dir abgelehnt' : '')) + }; + if (!onUpvote) { + // Presenter (and participants without upvotes): show the counts next to the word. + return el('span', attrs, [ + el('span', { text: word.text }), + el('span', { class: 'cloud__count cloud__count--up', text: '+' + word.count }), + downCount > 0 ? el('span', { class: 'cloud__count cloud__count--down', text: '−' + downCount }) : null + ]); + } + + var up = el('button', { + type: 'button', + class: 'cloud__vote cloud__vote--up', + 'aria-pressed': isMine ? 'true' : 'false', + 'aria-label': word.text + ', ' + word.count + ' Stimmen' + + (isMine ? ', von dir genannt' : (isDown ? '' : ', unterstützen')) + }, [ + el('span', { text: word.text }), + el('span', { class: 'cloud__count cloud__count--up', 'aria-hidden': 'true', text: (isMine ? '✓ ' : '+') + word.count }) + ]); + up.disabled = rated; + if (!rated) { + up.addEventListener('click', function () { onUpvote(word); }); + } + + var downEl = null; + if (onDownvote) { + downEl = el('button', { + type: 'button', + class: 'cloud__vote cloud__vote--down', + 'aria-pressed': isDown ? 'true' : 'false', + 'aria-label': word.text + ', ' + downCount + ' Ablehnungen' + + (isDown ? ', von dir abgelehnt' : (isMine ? '' : ', ablehnen')) + }, [ + el('span', { class: 'cloud__count cloud__count--down', 'aria-hidden': 'true', text: (isDown ? '✓ ' : '') + '−' + downCount }) + ]); + downEl.disabled = rated; + if (!rated) { + downEl.addEventListener('click', function () { onDownvote(word); }); + } + } else if (downCount > 0) { + downEl = el('span', { class: 'cloud__count cloud__count--down', text: '−' + downCount }); + } + return el('span', attrs, [up, downEl]); + })); + }, + + open: function (results) { + return el('ul', { class: 'answers' }, results.answers.map(function (answer) { + return el('li', { class: 'answer', text: answer.text }); + })); + } + }; + + // ------------------------------------------------------------------ copy + + function initCopy() { + document.querySelectorAll('[data-copy]').forEach(function (button) { + button.addEventListener('click', function () { + var source = button.parentNode.querySelector('[data-copy-source]'); + if (!source) { + return; + } + source.select(); + var done = function () { + var label = button.textContent; + button.textContent = 'Kopiert ✓'; + setTimeout(function () { button.textContent = label; }, 1500); + }; + if (navigator.clipboard) { + navigator.clipboard.writeText(source.value).then(done, function () { + document.execCommand('copy'); + done(); + }); + } else { + document.execCommand('copy'); + done(); + } + }); + }); + } + + // ------------------------------------------------------------------ presenter + + function initPresenter(root) { + var stateUrl = root.getAttribute('data-state-url'); + var controlUrl = root.getAttribute('data-control-url'); + var interval = parseInt(root.getAttribute('data-interval'), 10) || 2000; + var q = function (selector) { return root.querySelector(selector); }; + var last = ''; + var hideResults = false; + var state = null; + + function render(newState) { + var serialized = JSON.stringify(newState); + if (serialized === last) { + return; + } + last = serialized; + state = newState; + var slide = state.slide; + + q('[data-counter]').textContent = state.count === 0 + ? '0 / 0' + : (state.index === null ? '–' : state.index + 1) + ' / ' + state.count; + + if (!slide) { + q('[data-type]').textContent = ''; + q('[data-question]').textContent = state.count === 0 + ? 'Noch keine Folien angelegt' + : state.poll.title; + q('[data-description]').textContent = state.count === 0 + ? 'Lege in der Verwaltung Fragen an.' + : 'Drücke → um zu starten.'; + q('[data-results]').innerHTML = ''; + q('[data-voting]').hidden = true; + q('[data-participants]').textContent = ''; + return; + } + + q('[data-type]').textContent = slide.typeLabel; + q('[data-question]').textContent = slide.question; + q('[data-description]').textContent = slide.description; + root.classList.toggle('stage--content', !slide.isInteractive); + root.classList.toggle('stage--closed', slide.isInteractive && !slide.isVotingOpen); + + var voting = q('[data-voting]'); + voting.hidden = !slide.isInteractive; + voting.textContent = slide.isVotingOpen ? 'Abstimmung schließen' : 'Abstimmung öffnen'; + + q('[data-participants]').textContent = slide.isInteractive + ? state.results.participants + ' ' + (state.results.participants === 1 ? 'Antwort' : 'Antworten') + : ''; + + var container = q('[data-results]'); + container.classList.toggle('is-hidden', hideResults); + Results.render(container, slide.isInteractive ? state.results : null); + } + + function refresh() { + return getJson(stateUrl).then(render); + } + + function control(action, extra) { + var data = Object.assign({ action: action }, extra || {}); + return postJson(controlUrl, data).then(render).catch(function () { /* next poll fixes it */ }); + } + + root.querySelectorAll('[data-action]').forEach(function (button) { + button.addEventListener('click', function () { + control(button.getAttribute('data-action')); + }); + }); + + function toggleHide() { + hideResults = !hideResults; + q('[data-results]').classList.toggle('is-hidden', hideResults); + q('[data-hide-results]').textContent = hideResults ? 'Ergebnisse zeigen' : 'Ergebnisse verbergen'; + } + q('[data-hide-results]').addEventListener('click', toggleHide); + + function toggleFullscreen() { + if (!document.fullscreenElement) { + (document.documentElement.requestFullscreen || function () {}).call(document.documentElement); + } else if (document.exitFullscreen) { + document.exitFullscreen(); + } + } + q('[data-fullscreen]').addEventListener('click', toggleFullscreen); + + var overlay = q('[data-qr-overlay]'); + function toggleQr() { + overlay.hidden = !overlay.hidden; + } + q('[data-qr-toggle]').addEventListener('click', toggleQr); + overlay.addEventListener('click', toggleQr); + + document.addEventListener('keydown', function (event) { + if (event.target.closest('input, textarea, select')) { + return; + } + switch (event.key) { + case 'ArrowRight': + case 'PageDown': + case ' ': + event.preventDefault(); + control('next'); + break; + case 'ArrowLeft': + case 'PageUp': + event.preventDefault(); + control('prev'); + break; + case 'v': + case 'V': + if (state && state.slide && state.slide.isInteractive) { + control('toggle'); + } + break; + case 'h': + case 'H': + toggleHide(); + break; + case 'f': + case 'F': + toggleFullscreen(); + break; + case 'q': + case 'Q': + toggleQr(); + break; + case 'Escape': + overlay.hidden = true; + break; + } + }); + + poll(refresh, interval); + } + + // ------------------------------------------------------------------ participant + + function initParticipant(root) { + var stateUrl = root.getAttribute('data-state-url'); + var voteUrl = root.getAttribute('data-vote-url'); + var version = root.getAttribute('data-version'); + var interval = parseInt(root.getAttribute('data-interval'), 10) || 2000; + var card = root.querySelector('[data-results-card]'); + var container = root.querySelector('[data-results]'); + var wordForm = root.querySelector('[data-word-form]'); + var current = null; + var lastRendered = ''; + + function canUpvote(state) { + return !!(wordForm && state.words && state.words.allowUpvotes + && state.isVotingOpen && !state.words.limitReached); + } + + function renderResults(state) { + current = state; + if (!card || !container) { + return; + } + var upvote = canUpvote(state); + var key = JSON.stringify([state.results, state.words, upvote]); + if (key === lastRendered) { + return; + } + lastRendered = key; + card.hidden = !state.results; + var hint = root.querySelector('[data-upvote-hint]'); + if (hint) { + hint.hidden = !upvote; + } + Results.render(container, state.results, { + mine: state.words ? state.words.mine : [], + down: state.words ? state.words.down : [], + onUpvote: upvote ? function (word) { sendWord(word.text); } : null, + onDownvote: upvote && state.words.allowDownvotes ? function (word) { sendWord(word.text, 'down'); } : null + }); + } + + // --- word cloud: one word per submit, suggestions, upvotes ---------- + var input = wordForm ? wordForm.querySelector('[data-word-input]') : null; + var list = wordForm ? wordForm.querySelector('[data-suggestions]') : null; + var message = wordForm ? wordForm.querySelector('[data-word-message]') : null; + var matches = []; + var activeIndex = -1; + var sending = false; + + function isMine(word) { + return !!(current && current.words && current.words.mine.indexOf(word.key) >= 0); + } + + function isDown(word) { + return !!(current && current.words && current.words.down.indexOf(word.key) >= 0); + } + + function sendWord(text, vote) { + if (!wordForm || sending) { + return; + } + sending = true; + var slideId = wordForm.querySelector('[name=slide_id]').value; + var data = { slide_id: slideId, word: text }; + if (vote === 'down') { + data.vote = 'down'; + } + postJson(voteUrl, data).then(function (response) { + var success = vote === 'down' ? '✓ „' + text + '“ abgelehnt.' : '✓ „' + text + '“ ist angekommen.'; + message.textContent = response.ok ? success : response.message; + message.classList.toggle('is-error', !response.ok); + if (response.ok && vote !== 'down') { + input.value = ''; + closeSuggestions(); + } + applyWordState(response.state); + }).catch(function () { + message.textContent = 'Das hat nicht geklappt. Bitte versuche es noch einmal.'; + message.classList.add('is-error'); + }).then(function () { + sending = false; + }); + } + + function applyWordState(state) { + if (state.version !== version || !state.words) { + // Limit reached, slide changed or voting closed. + window.location.reload(); + return; + } + var remaining = wordForm.querySelector('[data-words-remaining]'); + if (state.words.remaining === null) { + remaining.textContent = 'Du kannst beliebig viele Begriffe abgeben.'; + } else { + remaining.textContent = state.words.remaining === 1 + ? 'Du kannst noch einen Begriff abgeben.' + : 'Du kannst noch ' + state.words.remaining + ' Begriffe abgeben.'; + } + renderResults(state); + } + + function closeSuggestions() { + matches = []; + activeIndex = -1; + list.hidden = true; + list.textContent = ''; + input.setAttribute('aria-expanded', 'false'); + input.removeAttribute('aria-activedescendant'); + } + + function highlight(index) { + var items = list.querySelectorAll('[role=option]'); + activeIndex = items.length ? (index + items.length) % items.length : -1; + items.forEach(function (item, i) { + item.classList.toggle('is-active', i === activeIndex); + item.setAttribute('aria-selected', i === activeIndex ? 'true' : 'false'); + }); + if (activeIndex >= 0) { + input.setAttribute('aria-activedescendant', items[activeIndex].id); + items[activeIndex].scrollIntoView({ block: 'nearest' }); + } + } + + function pick(word) { + if (isMine(word) || isDown(word)) { + return; + } + input.value = word.text; + closeSuggestions(); + sendWord(word.text); + } + + function updateSuggestions() { + var words = current && current.results && current.results.words ? current.results.words : []; + var found = Words.suggest(input.value, words); + closeSuggestions(); + if (!found.length) { + return; + } + matches = found; + found.forEach(function (word, i) { + var mine = isMine(word); + var rejected = isDown(word); + var item = el('li', { + id: 'word-suggestion-' + i, + role: 'option', + class: 'suggestion' + (mine || rejected ? ' is-mine' : ''), + 'aria-selected': 'false', + 'aria-disabled': mine || rejected ? 'true' : 'false' + }, [ + el('span', { class: 'suggestion__text', text: word.text }), + el('span', { + class: 'suggestion__meta', + text: mine ? 'schon genannt' : (rejected ? 'von dir abgelehnt' : '+' + word.count + ' · unterstützen') + }) + ]); + item.addEventListener('mousedown', function (event) { + event.preventDefault(); // keep focus in the input + pick(word); + }); + list.appendChild(item); + }); + list.hidden = false; + input.setAttribute('aria-expanded', 'true'); + } + + if (wordForm && input && list) { + wordForm.addEventListener('submit', function (event) { + event.preventDefault(); + var text = input.value.trim(); + if (text) { + sendWord(text); + } + }); + input.addEventListener('input', updateSuggestions); + input.addEventListener('blur', function () { setTimeout(closeSuggestions, 150); }); + input.addEventListener('keydown', function (event) { + if (list.hidden) { + return; + } + if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { + event.preventDefault(); + highlight(activeIndex + (event.key === 'ArrowDown' ? 1 : -1)); + } else if (event.key === 'Enter' && activeIndex >= 0) { + event.preventDefault(); + pick(matches[activeIndex]); + } else if (event.key === 'Escape') { + closeSuggestions(); + } + }); + } + + var initial = root.querySelector('[data-initial-state]'); + if (initial) { + try { + renderResults(JSON.parse(initial.textContent)); + } catch (e) { /* ignore */ } + } + + poll(function () { + return getJson(stateUrl).then(function (state) { + if (state.version !== version) { + // Do not destroy what the participant is typing right now. + var typing = document.activeElement && document.activeElement.closest('.vote-form textarea, .vote-form input[type=text]'); + if (typing && typing.value && state.isVotingOpen && String(state.slideId) === String(root.querySelector('[name=slide_id]').value)) { + return; + } + window.location.reload(); + return; + } + renderResults(state); + }); + }, interval); + } + + // ------------------------------------------------------------------ boot + + document.addEventListener('DOMContentLoaded', function () { + initCopy(); + document.querySelectorAll('[data-presenter]').forEach(initPresenter); + document.querySelectorAll('[data-participant]').forEach(initParticipant); + + // Prevent double submits of vote forms. + document.querySelectorAll('.vote-form').forEach(function (form) { + form.addEventListener('submit', function (event) { + if (event.defaultPrevented) { + return; // handled via fetch (word cloud) + } + var button = form.querySelector('button[type=submit], button:not([type])'); + if (button) { + setTimeout(function () { button.disabled = true; }, 0); + } + }); + }); + }); + + window.Plenario = { Results: Results, Words: Words }; +})();