familyHub/includes/utils.php

23 lines
544 B
PHP

<?php
require_once __DIR__ . '/../config/config.php';
function sanitizeInput($input) {
if (is_array($input)) {
return array_map('sanitizeInput', $input);
}
return htmlspecialchars(trim($input), ENT_QUOTES, 'UTF-8');
}
function formatDate($date) {
return date('Y-m-d', strtotime($date));
}
function generateExportFilename($type) {
return $type . '_' . date('Y-m-d') . '.json';
}
function ensureExportDirectory() {
if (!file_exists(EXPORT_DESTINATION)) {
mkdir(EXPORT_DESTINATION, 0755, true);
}
}