Lecteur Markdown
REFERPAGE_DOCUMENTATION_EN
BeamReactor — Module `referpage` (Page Recommendation) #
Version: 1.15.0
Author: Treveur Bretaudière
Since: 2002
Last updated: 2015-06-21
---
Overview #
The `referpage` module allows visitors to send a link to a page on the site to one or more recipients by email. It is a recommendation / referral system of the "send to a friend" type.
It relies on three files:
| File | Role |
|---|---|
| `referpage.php` | Main logic: form, validation, email sending |
| `referpage_conf_inc.php` | Module configuration (display, access level) |
| `referpage_fr_inc.php` | French locale (+ EN, DE locales available) |
---
Requirements #
- Minimum `BASE_LEVEL_USER` access.
- PHP `mail()` function must be operational on the server.
- The corresponding locale file must be loaded via `getlocale('referpage')`.
- The BeamReactor templating system (`frameheader` / `framefooter`) must be active.
- The utility functions `censor()`, `Parser::sanitize()` and `Parser::check()` must be available.
---
Behaviour #
Main Flow #
1. Form display — The user enters their name, email address and one or more recipient addresses separated by semicolons.
2. Validation — The module checks for the name, validity of the sender email and validity of each recipient address.
3. Sending — An email is sent to each valid recipient via `mail()`. The message contains a link to the recommended page and explanatory text.
4. Result — A summary shows successful and failed sends.
Referred Page URL #
The module can receive a specific page to recommend via the GET parameters `query` (Base64-encoded URL) and `id` (MD5 verification hash using `$cfg[17]` as salt). Without these parameters, the default URL is `$cfg[0]` (site root URL).
---
Configuration (`referpage_conf_inc.php`) #
| Variable | Value | Role |
|---|---|---|
| `$basedatadisplay` | `'no'` | No base data display |
| `$basedisplevel` | `BASE_LEVEL_USER` | Minimum access level |
---
Email Structure #
The email is sent as plain text (`text/plain`) with 8bit encoding and includes:
- A personalised greeting message
- The URL of the recommended page
- The name and URL of the site (from `$cfg[0]` and `$cfg[1]`)
- The content of `$cfg[19]` (additional description)
- An anti-spam note indicating the origin of the message
Subject: `[locale label] {sender name} ({sender email})`
Headers: From, Reply-To, X-Sender, X-Mailer, MIME, Content-Type, Content-Transfer-Encoding.
---
Data Validation #
| Field | Validation |
|---|---|
| Sender name | Required, cleaned via `Parser::sanitize($str, 'string', maxLength: 150)`, filtered by `censor()` |
| Sender email | Required, validated via `Parser::check($email, 'email')` |
| Recipient emails | Separated by `;`, each individually validated, at least one required |