| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- require dirname(__DIR__) . '/app/bootstrap.php';
- auth_require();
- $site = site_get();
- $galleries = galleries_all();
- $active = count(array_filter($galleries, fn($g) => !gallery_is_expired($g)));
- $stats = array_map(fn($g) => gallery_stats($g['slug']), $galleries);
- $views = array_sum(array_column($stats, 'views'));
- $downloads = array_sum(array_column($stats, 'downloads'));
- // Computed from the galleries already loaded above rather than by rescanning:
- // this is the page an operator lands on after an update, so it is where a
- // pending migration should announce itself.
- $pending = array_filter($galleries, fn($g) => migrate_pending_for($g) !== []);
- admin_header('Dashboard');
- flash_render();
- ?>
- <h1>Dashboard</h1>
- <?php if ($pending !== []): ?>
- <div class="flash flash-error">
- <?= count($pending) ?> galler<?= count($pending) === 1 ? 'y needs' : 'ies need' ?>
- a one-time data migration after the last software update.
- <a href="migrate.php">Run it now →</a>
- </div>
- <?php endif; ?>
- <div class="card">
- <table>
- <tr><td>Showreel images</td><td><?= count($site['showreel'] ?? []) ?></td>
- <td><a href="showreel.php">Manage →</a></td></tr>
- <tr><td>Galleries</td><td><?= count($galleries) ?> (<?= $active ?> active)</td>
- <td><a href="galleries.php">Manage →</a></td></tr>
- <tr><td>Gallery views</td><td><?= $views ?></td>
- <td><a href="galleries.php">Per gallery →</a></td></tr>
- <tr><td>Archive downloads</td><td><?= $downloads ?></td>
- <td><a href="galleries.php">Per gallery →</a></td></tr>
- <tr><td>Front page</td><td><?= e($site['intro_title']) ?></td>
- <td><a href="frontpage.php">Edit →</a></td></tr>
- <tr><td>Data format</td>
- <td><?= $pending === [] ? 'up to date (v' . (int)SCHEMA_VERSION . ')' : count($pending) . ' pending' ?></td>
- <td><a href="migrate.php">Migration →</a></td></tr>
- </table>
- </div>
- <p class="help">
- Tip: create a gallery under <em>Galleries</em>, then share its link with your client.
- Password and expiry date are optional per gallery.
- </p>
- <?php admin_footer(); ?>
|