Current directory: /home/klas4s23/domains/585455.klas4s23.mid-ica.nl/public_html/Gastenboek/uploads
<?php
/**
* Auth helper functions
* Session management and authentication checks
*/
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
require_once __DIR__ . '/../controllers/AuthController.php';
$authController = new AuthController();
/**
* Get current logged-in user
*/
function getCurrentUser() {
global $authController;
return $authController->getCurrentUser();
}
/**
* Check if user is logged in
*/
function isLoggedIn() {
global $authController;
return $authController->isLoggedIn();
}
/**
* Check if user is admin
*/
function isAdmin() {
global $authController;
return $authController->isAdmin();
}
/**
* Require login (redirect if not logged in)
*/
function requireLogin() {
global $authController;
$authController->requireLogin();
}
/**
* Require admin (redirect if not admin)
*/
function requireAdmin() {
global $authController;
$authController->requireAdmin();
}
/**
* Format date for display
*/
function formatDate($date) {
return date('d-m-Y H:i', strtotime($date));
}
/**
* Escape HTML
*/
function e($string) {
return htmlspecialchars($string ?? '', ENT_QUOTES, 'UTF-8');
}