. Expects $adminTitle (optional) and $fontStack (optional). // Compat shim: if this file is included mid-request by the old 1.9.7 updater, // functions.php in memory won't have t() yet. Define a no-op fallback so the // page renders (with raw keys) rather than crashing with "undefined function". if (!function_exists('t')) { function t(string $key, array $replacements = []): string { return $key; } } $adminTitle = $adminTitle ?? 'Admin - Pureblog'; $blogPostsEnabled = $config['enable_blog_posts'] ?? true; $fontStack = $fontStack ?? font_stack_css($config['theme']['admin_font_stack'] ?? 'sans'); $adminColorMode = $adminColorMode ?? ($config['theme']['admin_color_mode'] ?? 'auto'); $extraHead = $extraHead ?? ''; $codeMirror = $codeMirror ?? null; // 'markdown' or 'css' $hideAdminNav = $hideAdminNav ?? false; $adminCssVersion = (string) @filemtime(PUREBLOG_BASE_PATH . '/admin/css/admin.css'); if (!$hideAdminNav && ($_SERVER['REQUEST_METHOD'] ?? 'GET') === 'POST' && isset($_POST['search_page_action'])) { verify_csrf(); if ($_POST['search_page_action'] === 'create') { $newPage = [ 'title' => 'Search', 'slug' => 'search', 'status' => 'published', 'description' => 'Search posts on this site.', 'include_in_nav' => true, 'content' => "# Search this site\n\nThis is the search page. You can replace (or remove) this text by editing the page in Pure Blog admin.", ]; $saveError = null; save_page($newPage, null, null, $saveError); $_SESSION['admin_action_flash'] = ['ok' => true, 'message' => t('admin.settings.site.notice_search_created')]; } $config['search_page_notified'] = true; save_config($config); $defaultAdminLanding = base_path() . '/admin/' . ($blogPostsEnabled ? 'dashboard.php' : 'content.php'); header('Location: ' . ($_SERVER['REQUEST_URI'] ?? $defaultAdminLanding)); exit; } if (!$hideAdminNav && ($_SERVER['REQUEST_METHOD'] ?? 'GET') === 'POST' && isset($_POST['admin_action_id'])) { verify_csrf(); $actionId = strtolower(trim((string) ($_POST['admin_action_id'] ?? ''))); $actionId = preg_replace('/[^a-z0-9_-]/', '', $actionId) ?? ''; if ($actionId === 'clear_cache') { cache_clear(); $_SESSION['admin_action_flash'] = ['ok' => true, 'message' => t('admin.nav.cache_cleared')]; } elseif ($actionId !== '') { $_SESSION['admin_action_flash'] = run_admin_action($actionId); } else { $_SESSION['admin_action_flash'] = ['ok' => false, 'message' => t('admin.nav.invalid_action')]; } $defaultAdminLanding = base_path() . '/admin/' . ($blogPostsEnabled ? 'dashboard.php' : 'content.php'); $redirectTo = (string) ($_SERVER['REQUEST_URI'] ?? $defaultAdminLanding); header('Location: ' . $redirectTo); exit; } $adminActionButtons = !$hideAdminNav ? get_admin_action_buttons() : []; $adminActionFlash = $_SESSION['admin_action_flash'] ?? null; unset($_SESSION['admin_action_flash']); ?>
= e((string) $adminActionFlash['message']) ?>