Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions public_html/assets/templates/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,18 @@
estadosMsg.innerHTML = alert.innerHTML;
estadosMsg.className = 'alert mt-2 ' + alert.className.replace('alert ', '');
estadosMsg.classList.remove('d-none');
// Recargar la página después de 1 segundo para actualizar la configuración
setTimeout(function() {
window.location.reload();
}, 1000);
} else {
estadosMsg.innerHTML = 'Guardado.';
estadosMsg.className = 'alert alert-success mt-2';
estadosMsg.classList.remove('d-none');
// Recargar la página después de 1 segundo para actualizar la configuración
setTimeout(function() {
window.location.reload();
}, 1000);
}
});
});
Expand Down
24 changes: 24 additions & 0 deletions public_html/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,29 @@


//////////FUNCTIONS\\\\\\\\\\
// Incrementar versión de caché para forzar recarga de JSON
function increment_cache_version()
{
$version_file = $_SERVER['DOCUMENT_ROOT'] . '/data/cache_version.txt';
$version = 1;
if (file_exists($version_file)) {
$version = (int)file_get_contents($version_file);
}
$version++;
file_put_contents($version_file, $version);
return $version;
}

// Obtener versión de caché actual
function get_cache_version()
{
$version_file = $_SERVER['DOCUMENT_ROOT'] . '/data/cache_version.txt';
if (file_exists($version_file)) {
return (int)file_get_contents($version_file);
}
return 1;
}

// Formatea fecha ICS a dd-mm-yyyy H:m en horario de Madrid
function format_ics_date_madrid($ics_date)
{
Expand Down Expand Up @@ -143,6 +166,7 @@ function sort_tasks_by_end($a, $b)
$new_status = $_POST['new_status'];
$all_states[$type][$uid] = $new_status;
file_put_contents($states_path, json_encode($all_states, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
increment_cache_version();
header('Location: ' . $_SERVER['REQUEST_URI']);
exit;
}
1 change: 1 addition & 0 deletions public_html/data/cache_version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
10 changes: 10 additions & 0 deletions public_html/editar_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@
}
}
file_put_contents($configPath, json_encode($config, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));

// Incrementar versión de caché para forzar recarga
$version_file = ROOT . '/public_html/data/cache_version.txt';
$version = 1;
if (file_exists($version_file)) {
$version = (int)file_get_contents($version_file);
}
$version++;
file_put_contents($version_file, $version);

$msg = '¡Configuración actualizada!';
}
?>
Expand Down
10 changes: 10 additions & 0 deletions public_html/tools/compare.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@
if ($added > 0) {
file_put_contents($data_path, json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
file_put_contents($status_path, json_encode($tasks_status, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));

// Incrementar versión de caché para forzar recarga
$version_file = $_SERVER['DOCUMENT_ROOT'] . '/data/cache_version.txt';
$version = 1;
if (file_exists($version_file)) {
$version = (int)file_get_contents($version_file);
}
$version++;
file_put_contents($version_file, $version);

$add_result = "$added tarea(s) añadidas a tasks.json.";
} else {
$add_result = "No hay tareas nuevas que añadir.";
Expand Down
10 changes: 10 additions & 0 deletions public_html/tools/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ function index_by_uid($events) {
$calendarics_events[] = $ev;
}
file_put_contents($calendar_json_path, json_encode($calendarics_events, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));

// Incrementar versión de caché para forzar recarga
$version_file = $_SERVER['DOCUMENT_ROOT'] . '/data/cache_version.txt';
$version = 1;
if (file_exists($version_file)) {
$version = (int)file_get_contents($version_file);
}
$version++;
file_put_contents($version_file, $version);

$add_result = count($missing) . ' evento(s) añadidos a calendar.json.';
header('Location: ' . $_SERVER['REQUEST_URI']);
exit;
Expand Down