| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- // The lines an existing project needs.
- // Meant to be copied, not run directly.
- // ---------------------------------------------------------------------------
- // 1. Admin page for update and backup: <project>/admin/manage.php
- // ---------------------------------------------------------------------------
- require_once __DIR__ . "/../config.php";
- require_once __DIR__ . "/../includes/functions.php";
- // Check the project's own login first - the panel is the application's
- // most powerful page.
- if (empty($_SESSION["admin_logged_in"])) {
- header("Location: login.php");
- exit;
- }
- require __DIR__ . "/../manage-client/ui/panel.php";
- // ---------------------------------------------------------------------------
- // 2. Status block on an existing settings page
- // ---------------------------------------------------------------------------
- $manageStatusPanelUrl = "manage.php";
- include __DIR__ . "/../manage-client/ui/status-partial.php";
- // ---------------------------------------------------------------------------
- // 3. Automatic backup without cron, e.g. on the admin dashboard
- // ---------------------------------------------------------------------------
- require_once __DIR__ . "/../manage-client/lib/client.php";
- try {
- // Only creates one once MANAGE_BACKUP_AUTO_INTERVAL_SECONDS has elapsed.
- manageBackupCreateAutomaticIfDue();
- } catch (Throwable $exception) {
- // A failed backup must not block the dashboard.
- error_log("Automatic backup failed: " . $exception->getMessage());
- }
- // ---------------------------------------------------------------------------
- // 4. Update notice in the project's own navigation
- // ---------------------------------------------------------------------------
- require_once __DIR__ . "/../manage-client/lib/client.php";
- $manageStatus = manageClientStatus(); // never throws
- if ($manageStatus["update"] !== null && $manageStatus["update"]["available"]) {
- echo '<a href="manage.php">Update ' .
- htmlspecialchars($manageStatus["update"]["latest"], ENT_QUOTES, "UTF-8") .
- " available</a>";
- }
|