31 lines
836 B
PHP
31 lines
836 B
PHP
<?php
|
|
/**
|
|
* API - Obtener configuración de Términos y Condiciones
|
|
*/
|
|
|
|
require_once '../config/config.php';
|
|
|
|
error_reporting(E_ALL);
|
|
@ini_set('display_errors', 0);
|
|
|
|
requireAuthentication();
|
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
|
|
try {
|
|
$db = Database::getInstance();
|
|
$active = $db->fetch(
|
|
"SELECT id, version, documento_url, documento_nombre, mensaje_aceptacion,
|
|
mensaje_rechazo, forzar_reenvio, activa, created_at
|
|
FROM terms_versions
|
|
WHERE activa = 1
|
|
ORDER BY id DESC LIMIT 1"
|
|
);
|
|
|
|
echo json_encode(['success' => true, 'data' => $active ?: null]);
|
|
} catch (Exception $e) {
|
|
error_log('get_terms_config.php error: ' . $e->getMessage());
|
|
http_response_code(500);
|
|
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
|
|
}
|