- Add db.php with PDO singleton, migration runner, and all helper functions - Add migrations/001_initial_schema.sql (full schema) - Add migrations/002_import_json.php (one-time JSON → DB importer) - Add _incl/switch_tenant.php POST endpoint for tenant/centro switching - Update tools.auth.php: DB-backed login, cookie auth, session reload, init_active_centro() - Update all sysadmin pages (users, centros, aularios, invitations, reset_password) to use DB - Update aulatek/index.php, aulario.php, supercafe.php, supercafe_edit.php to use DB - Update aulatek/comedor.php and api/comedor.php to use DB - Update aulatek/paneldiario.php: aulario config + comedor data from DB - Update aulatek/proyectos.php: aulario config + sharing metadata from DB - Update club/cal.php, index.php, edit_data.php, upload/upload.php to use DB - Update account/index.php: rich profile, tenant list, aula list, session info, permissions - Update pre-body.php account dropdown: shows active org + inline tenant switcher - Update DATA_STRUCTURE.md to document DB approach and migration system Co-authored-by: naielv <109038805+naielv@users.noreply.github.com>
72 lines
3.7 KiB
PHP
Executable File
72 lines
3.7 KiB
PHP
Executable File
<?php
|
|
require_once "../_incl/tools.session.php";
|
|
require_once "../_incl/tools.security.php";
|
|
require_once "../_incl/db.php";
|
|
ini_set("display_errors", 0);
|
|
$file = Sf($_GET["f"]);
|
|
$date = implode("/", array_reverse(explode("-", $file)));
|
|
$val = db_get_club_event($file);
|
|
|
|
$fotos = glob("/DATA/club/IMG/$file/*/");
|
|
|
|
$APP_CODE = "club";
|
|
$APP_NAME = "La web del Club<sup>3</sup>";
|
|
$APP_TITLE = "La web del Club";
|
|
$PAGE_TITLE = $val["title"] ? "$date - " . $val["title"] . " - Club" : "$date - Club";
|
|
require_once "../_incl/pre-body.php"; ?>
|
|
<div class="card pad">
|
|
<h1><?php echo $date; ?> - <?php echo $val["title"] ?: "Por definir"; ?></h1>
|
|
<span>
|
|
<a href="/club/" class="btn btn-secondary">Volver a Inicio</a>
|
|
<a href="/club/edit_data.php?f=<?php echo htmlspecialchars($file); ?>" class="btn btn-secondary">Cambiar datos</a>
|
|
<a href="/club/upload/index.php?f=<?php echo htmlspecialchars($file); ?>" class="btn btn-primary">Subir fotos</a>
|
|
<?php if (isset($val["mapa"]["url"]) and $val["mapa"]["url"] != ""): ?>
|
|
<a class="btn btn-secondary" href="<?php echo htmlspecialchars($val["mapa"]["url"]); ?>" target="_blank">Abrir ruta interactiva</a>
|
|
<?php endif; ?>
|
|
</span>
|
|
|
|
<?php if (isset($val["mapa"]) and $val["mapa"] != ""): ?>
|
|
<h2>Ruta y estadísticas</h2>
|
|
<?php if (isset($val["mapa"]["route"]) and $val["mapa"]["route"] != ""): ?>
|
|
<img height="300" loading="lazy" src="foto_dl.php?f=<?php echo $file . "/" . $val["mapa"]["route"]; ?>" alt="">
|
|
<?php endif; ?>
|
|
<?php if (isset($val["mapa"]["stats"]) and $val["mapa"]["stats"] != ""): ?>
|
|
<img height="300" loading="lazy" src="foto_dl.php?f=<?php echo $file . "/" . $val["mapa"]["stats"]; ?>" alt="">
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
<h2>Fotos</h2>
|
|
<div id="grid">
|
|
<?php foreach ($fotos as $persona): ?>
|
|
<?php $pname = str_replace("/", "", str_replace("/DATA/club/IMG/$file/", "", $persona)); ?>
|
|
<?php foreach (preg_grep('/^([^.])/', scandir($persona)) as $foto): ?>
|
|
<?php if (is_dir($foto)) {
|
|
continue;
|
|
} ?>
|
|
<?php if (strtolower(pathinfo($foto, PATHINFO_EXTENSION)) == "thumbnail") {
|
|
continue;
|
|
} ?>
|
|
<div style="width: 240px; display: inline-block; margin-bottom: 10px; border: 3px solid black; border-radius: 6.5px; box-sizing: content-box;"
|
|
class="grid-item">
|
|
<?php $dl_url = "foto_dl.php?f=" . urlencode("$file/$pname/" . str_replace($persona, "", $foto)); ?>
|
|
<img class="stack" width="240px" loading="lazy" src="<?php echo $dl_url; ?>&thumbnail=1"
|
|
alt="Foto de <?php echo htmlspecialchars($pname . " - " . str_replace($persona, "", $foto)); ?>">
|
|
<div style="padding: 5px; text-align: center;">
|
|
Subido por <?php echo htmlspecialchars($pname); ?><br>
|
|
<a href="<?php echo $dl_url; ?>" target="_blank" class="btn btn-secondary">Abrir</a>
|
|
<a href="<?php echo $dl_url; ?>"
|
|
download="<?php echo "CLUB-" . htmlspecialchars($file) . "-" . htmlspecialchars($pname) . "-" . htmlspecialchars(str_replace($persona, "", $foto)); ?>"
|
|
class="btn btn-secondary">Descargar</a>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
var msnry = new Masonry('#grid', { "columnWidth": 240, "itemSelector": ".grid-item", "gutter": 10, "transitionDuration": 0 });
|
|
setInterval(() => {
|
|
msnry.layout()
|
|
}, 1000);
|
|
</script>
|
|
<?php require_once "../_incl/post-body.php"; ?>
|