Documentation

Application

Table of Contents

Classes

ExportUserListController
Controller responsible for exporting the user list to PDF.

Constants

CSP_NONCE  = $cspNonce
DB_CHARSET  = $_ENV['DB_CHARSET'] ?? $_SERVER['DB_CHARSET'] ?? 'utf8mb4'
DB_HOST  = $_ENV['DB_HOST'] ?? $_SERVER['DB_HOST'] ?? '127.0.0.1'
DB_NAME  = $_ENV['DB_NAME'] ?? $_SERVER['DB_NAME'] ?? 'bdelive_test'
DB_PASSWORD  = $_ENV['DB_PASSWORD'] ?? $_SERVER['DB_PASSWORD'] ?? 'root'
DB_USER  = $_ENV['DB_USER'] ?? $_SERVER['DB_USER'] ?? 'root'
FROM_EMAIL  = (string) $_ENV['FROM_EMAIL']

Functions

requireLogin()  : void
Require user authentication
requireAdmin()  : void
Require events privileges
generateCsrfToken()  : string
Generate a CSRF token and store it in session
validateCsrfToken()  : bool
Validate CSRF token
csrfField()  : string
Get CSRF token field HTML

Constants

CSP_NONCE

public mixed CSP_NONCE = $cspNonce

DB_CHARSET

public mixed DB_CHARSET = $_ENV['DB_CHARSET'] ?? $_SERVER['DB_CHARSET'] ?? 'utf8mb4'

DB_HOST

public mixed DB_HOST = $_ENV['DB_HOST'] ?? $_SERVER['DB_HOST'] ?? '127.0.0.1'

DB_NAME

public mixed DB_NAME = $_ENV['DB_NAME'] ?? $_SERVER['DB_NAME'] ?? 'bdelive_test'

DB_PASSWORD

public mixed DB_PASSWORD = $_ENV['DB_PASSWORD'] ?? $_SERVER['DB_PASSWORD'] ?? 'root'

DB_USER

public mixed DB_USER = $_ENV['DB_USER'] ?? $_SERVER['DB_USER'] ?? 'root'

FROM_EMAIL

public mixed FROM_EMAIL = (string) $_ENV['FROM_EMAIL']

Functions

requireLogin()

Require user authentication

requireLogin() : void

Checks if a user session is active and if the user is logged in. Redirects to the login page with an error message if the user is not authenticated.

Tags
author

BDELIVE - Groupe 8

throws
void

Exits execution if user is not authenticated

requireAdmin()

Require events privileges

requireAdmin() : void

Checks if a user session is active, if the user is logged in, and if the user has events status ('BDE'). Redirects to login page if not authenticated, or returns 403 Forbidden if authenticated but not events.

Tags
throws
void

Exits execution if user is not authenticated or not events

generateCsrfToken()

Generate a CSRF token and store it in session

generateCsrfToken() : string

Generates a cryptographically secure random token (64 hex characters) and stores it in the session along with a timestamp.

Return values
string

The generated token (64 hex characters), or empty string if session is not active

validateCsrfToken()

Validate CSRF token

validateCsrfToken(string $token) : bool

Validates that the provided token matches the token stored in the session and that the token has not expired (1 hour expiration).

Parameters
$token : string

The token to validate

Return values
bool

True if the token is valid and not expired, false otherwise

csrfField()

Get CSRF token field HTML

csrfField() : string

Generates an HTML hidden input field containing the CSRF token. Uses an existing token if available, otherwise generates a new one.

Return values
string

HTML input field with CSRF token, or empty string if session is not active


        
On this page

Search results