How wascripts/wanewsletter works
Purpose and entry points
WAnewsletter is a PHP-based newsletter management system: it collects subscriptions, manages mailing lists and subscriber profiles, composes and sends campaigns, and exposes archives/profile actions. Public entry points are subscribe.php, newsletter.php, and profil_cp.php; installation begins at install.php. Administrative workflows are rooted at admin/index.php, with campaign sending in admin/envoi.php.
Bootstrap, configuration, and shared runtime
Request initialization and common behavior are centralized in includes/common.inc.php, supported by constants and shared functions in includes/constantes.php and includes/functions.php. Runtime configuration is expected under data/config.sample.inc.php (deployed as a local config), while mutable application state is stored beneath data/, including database, logs, uploads, stats, and temporary files. The application is server-rendered PHP rather than a separate frontend service.
Public subscription and subscriber lifecycle
Public-facing flows accept subscriptions and profile changes through subscribe.php and profil_cp.php. Domain operations are represented by includes/Subscription.php, authentication/session behavior by includes/Auth.php and includes/Session.php, and email confirmation/welcome/unsubscribe text is localized under languages/en/emails/ and languages/fr/emails/. These flows form the boundary between anonymous users and persisted subscriber/list records.
Administrative control plane
The admin area handles login, configuration, list/subscriber inspection, campaign authoring, tools, statistics, upgrades, and sending. Key controllers include admin/login.php, admin/config.php, admin/show.php, admin/stats.php, and admin/envoi.php; they share initialization through admin/start.inc.php. Admin templates in templates/admin/ provide the rendered management UI and campaign send-progress views.
Campaign composition, rendering, and delivery
Campaign control flows move from admin composition into templated content and outbound delivery. includes/Template.php renders application and message layouts; includes/Sender.php is the outbound mail boundary; includes/Attach.php handles attached files. newsletter.php provides archive/public newsletter presentation. Delivery status and operational outcomes feed logs and statistics under data/logs/ and data/stats/.
Persistence and database abstraction
Database access is abstracted behind includes/Dblayer/Wadb.php and engine-specific implementations: includes/Dblayer/Mysqli.php, includes/Dblayer/Postgres.php, includes/Dblayer/Sqlite3.php, and includes/Dblayer/SqlitePdo.php. Initial schemas are provided in includes/Dblayer/schemas/. This isolates subscriber, list, campaign, and administrative data from the selected MySQL, PostgreSQL, or SQLite backend; backup implementations sit alongside the respective drivers.
Output, extensibility, and operations
Output can target HTML, JSON, or command-line contexts through includes/Output/Html.php, includes/Output/Json.php, and includes/Output/CommandLine.php. Scheduled or integration-oriented behavior is exposed through options/cron.php and options/extra.php, with contributor utilities in contrib/ for conversion, cleanup, and related maintenance. External service dependencies are primarily the configured database and the host’s mail transport; includes/PopClient.php additionally indicates POP mailbox interaction capability.
Main entry points: envoi.php Campaign sending · common.inc.php Shared runtime · start.inc.php Admin bootstrap · Template.php Template renderer
Components 20
Public flows
- Subscription & profiles · Accepts subscriptions and profile changes.
- Newsletter archive · Renders public newsletter presentation.
newsletter.php
Admin control plane
- Admin controllers · Manages configuration, lists, subscribers, campaigns, tools, and statistics.
- Campaign sending · Runs campaign delivery and send-progress workflow.
admin/envoi.php - Admin bootstrap
admin/start.inc.php - Admin UI templates
templates/admin
Application core
- Shared runtime · Centralizes request initialization and common behavior.
includes/common.inc.php - Subscriber domain · Implements subscription, authentication, and session behavior.
- Template renderer · Renders application and message layouts.
includes/Template.php - Localized email copy · Confirmation, welcome, and unsubscribe messages.
- Mail delivery · Sends mail and manages attachments.
- Output adapters · Supports HTML, JSON, and command-line output.
Persistence & operations
- Installer · Initializes the application schema and setup.
install.php - Database abstraction · Selects MySQL, PostgreSQL, or SQLite drivers behind a common interface.
- Database schemas
includes/Dblayer/schemas - Application state · Holds local configuration, database files, uploads, logs, stats, and temporary files.
data - Scheduled integrations · Provides cron and extension-oriented behavior.
- Host mail transport
- Configured database · MySQL, PostgreSQL, or SQLite backend.
- POP mailbox client
includes/PopClient.php
Connections 23
- Installer → Database schemas: installs
- Database schemas → Configured database: defines
- Subscription & profiles → Shared runtime: bootstraps
- Subscription & profiles → Subscriber domain: updates subscribers
- Newsletter archive → Shared runtime: bootstraps
- Newsletter archive → Template renderer: renders with
- Admin controllers → Admin bootstrap: initializes via
- Campaign sending → Admin bootstrap: initializes via
- Admin bootstrap → Shared runtime: shares runtime
- Admin controllers → Admin UI templates: renders
- Campaign sending → Admin UI templates: shows progress
- Admin controllers → Subscriber domain: manages
- Campaign sending → Template renderer: composes
- Template renderer → Localized email copy: uses
- Campaign sending → Mail delivery: dispatches
- Mail delivery → Host mail transport: sends through
- Subscriber domain → Database abstraction: persists through
- Database abstraction → Configured database: connects to
- Shared runtime → Output adapters: selects output
- Campaign sending → Application state: records outcomes
- Scheduled integrations → Shared runtime: runs application logic
- Scheduled integrations → Mail delivery: can trigger delivery
- POP mailbox client → Subscriber domain: mailbox interaction