Initial import of fitme3070.pt platform
Plain-PHP fleet platform with id.andmore.pt SSO. Wires shared/platform-tools as a submodule (platform_update, backups, git/migration tools) like the other platforms. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
commit
e68d357177
2330 files changed
+215968
No files matched your search
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
require __DIR__ . '/../../../config/db.php';
|
||||
require __DIR__ . '/../../../config/functions.php';
|
||||
$user = ["id"=>1,"name"=>"Teste","email"=>"teste@fitme3070.pt","role"=>"sysadmin"]; $_SESSION["user_id"] = 1; $_SESSION["user"] = $user; // require_admin();
|
||||
|
||||
// Handle delete BEFORE any output
|
||||
if (isset($_GET['delete']) && is_numeric($_GET['delete'])) {
|
||||
csrf_check();
|
||||
db_gallery_delete($pdo, (int) $_GET['delete']);
|
||||
session()->setFlashdata('success', 'Galeria apagada.');
|
||||
header('Location: ' . base_url('views/admin/galerias/index.php'));
|
||||
exit;
|
||||
}
|
||||
|
||||
// Optimize every image in every gallery (resize/compress to the gallery cap)
|
||||
if (isset($_POST['optimize_all'])) {
|
||||
csrf_check();
|
||||
$stats = ['resized' => 0, 'skipped' => 0, 'failed' => 0, 'saved' => 0];
|
||||
foreach (glob(__DIR__ . '/../../../uploads/gallery/*', GLOB_ONLYDIR) ?: [] as $dir) {
|
||||
foreach (img_optimize_dir($dir . '/', IMG_MAX_GALLERY) as $k => $v) $stats[$k] += $v;
|
||||
}
|
||||
session()->setFlashdata($stats['failed'] ? 'warning' : 'success', img_stats_message($stats));
|
||||
header('Location: ' . base_url('views/admin/galerias/index.php'));
|
||||
exit;
|
||||
}
|
||||
|
||||
$galleries = db_gallery_list($pdo);
|
||||
$page_title = 'Galerias';
|
||||
include __DIR__ . '/../../../includes/header.php';
|
||||
?>
|
||||
<div class="container">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1 class="h3 mb-0">Galerias</h1>
|
||||
<div class="d-flex gap-2">
|
||||
<form method="POST" class="mb-0">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" name="optimize_all" value="1" class="btn btn-outline-success"
|
||||
title="Redimensiona e comprime as imagens de todas as galerias para o máximo de <?= IMG_MAX_GALLERY ?>px"
|
||||
onclick="return confirm('Otimizar as imagens de todas as galerias (máx. <?= IMG_MAX_GALLERY ?>px)? Os ficheiros originais serão substituídos.')">
|
||||
<i class="bi bi-arrows-angle-contract me-1"></i>Otimizar imagens
|
||||
</button>
|
||||
</form>
|
||||
<a class="btn btn-primary" href="<?= base_url('views/admin/galerias/create.php') ?>"><i class="bi bi-plus-lg me-1"></i>Nova Galeria</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card shadow-sm"><div class="card-body p-0">
|
||||
<table class="table table-hover align-middle mb-0">
|
||||
<thead class="table-light"><tr>
|
||||
<th>Nome</th><th style="width:120px">Ações</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<?php if (!$galleries): ?>
|
||||
<tr><td colspan="2" class="text-center text-muted py-4">Nenhuma galeria.</td></tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($galleries as $g): ?>
|
||||
<tr>
|
||||
<td><strong><?= htmlspecialchars($g['name']) ?></strong></td>
|
||||
<td>
|
||||
<a class="btn btn-sm btn-outline-primary" href="edit.php?id=<?= $g['id'] ?>"><i class="bi bi-pencil"></i> Gerir</a>
|
||||
<a class="btn btn-sm btn-outline-danger" href="?delete=<?= $g['id'] ?>" onclick="return confirm('Apagar esta galeria e todas as suas imagens?')"><i class="bi bi-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div></div>
|
||||
</div>
|
||||
<?php include __DIR__ . '/../../../includes/footer.php';
|
||||
Reference in new issue
Block a user