36 lines
894 B
PHP
36 lines
894 B
PHP
<?php
|
|
/**
|
|
* API - Obtener configuración del sistema
|
|
* Fecha: 13 de noviembre de 2025
|
|
*/
|
|
|
|
require_once '../config/config.php';
|
|
|
|
// Verificar autenticación
|
|
requireAuthentication();
|
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
header('Access-Control-Allow-Origin: *');
|
|
header('Access-Control-Allow-Methods: GET');
|
|
header('Access-Control-Allow-Headers: Content-Type');
|
|
|
|
try {
|
|
$db = Database::getInstance();
|
|
|
|
$configs = $db->fetchAll(
|
|
"SELECT config_key, config_value FROM system_config"
|
|
);
|
|
|
|
$settings = [];
|
|
foreach ($configs as $config) {
|
|
$settings[$config['config_key']] = $config['config_value'];
|
|
}
|
|
|
|
echo json_encode($settings);
|
|
|
|
} catch (Exception $e) {
|
|
error_log("Error in get_settings.php: " . $e->getMessage());
|
|
http_response_code(500);
|
|
echo json_encode(['error' => 'Error interno del servidor']);
|
|
}
|
|
?>
|