CSP_NONCE
public
mixed
CSP_NONCE
= $cspNonce
public
mixed
CSP_NONCE
= $cspNonce
public
mixed
DB_CHARSET
= $_ENV['DB_CHARSET'] ?? $_SERVER['DB_CHARSET'] ?? 'utf8mb4'
public
mixed
DB_HOST
= $_ENV['DB_HOST'] ?? $_SERVER['DB_HOST'] ?? '127.0.0.1'
public
mixed
DB_NAME
= $_ENV['DB_NAME'] ?? $_SERVER['DB_NAME'] ?? 'bdelive_test'
public
mixed
DB_PASSWORD
= $_ENV['DB_PASSWORD'] ?? $_SERVER['DB_PASSWORD'] ?? 'root'
public
mixed
DB_USER
= $_ENV['DB_USER'] ?? $_SERVER['DB_USER'] ?? 'root'
public
mixed
FROM_EMAIL
= (string) $_ENV['FROM_EMAIL']
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.
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.
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.
The generated token (64 hex characters), or empty string if session is not active
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).
The token to validate
True if the token is valid and not expired, false otherwise
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.
HTML input field with CSRF token, or empty string if session is not active
Generate a CSRF token hidden input field
csrfField() : string
Convenience function that wraps CsrfProtection::getTokenField().
HTML hidden input with CSRF token
Validate a CSRF token
validateCsrfToken(string $token) : bool
Convenience function that wraps CsrfProtection::validateToken().
The CSRF token to validate
True if valid, false otherwise
Generate a new CSRF token
generateCsrfToken() : string
Convenience function that wraps CsrfProtection::generateToken().
The generated CSRF token (64 hex characters)
Require user authentication
requireLogin() : void
Checks if user is authenticated and redirects to login page if not. Convenience function that wraps AuthManager::requireAuthentication().
Redirects to login page if not authenticated
Require administrator rights (BDE)
requireAdmin() : void
Checks if user is authenticated and has admin (BDE) status. Redirects to login or home page with error message if requirements not met. Convenience function that wraps AuthManager::requireAdmin().
Redirects if not authenticated or not admin
Carousel Component
useCarousel(string $carouselLabel, array<int, array{src: string, alt?: string}> $imageMap, string $carouselId, mixed $event) : void
Reusable carousel component for displaying sliding image content. Used on homepage and other pages for featured content display.
Renders the page header with navigation
start_page(string $title[, bool $wouldNav = true ][, array<string, mixed>|null $user = null ]) : void
Generates the HTML head section and navigation bar with responsive hamburger menu for mobile devices. Includes user-specific navigation options based on authentication status and user role.
Page title for the browser tab
Whether to display the navigation bar
Current user data or null if not logged in
Renders the page footer
end_page() : void
Generates the HTML footer section with navigation links, social media icons, and copyright information. Also handles cookie consent popup display.