v1.0.0.8
Publisium
- <?php
-
- declare(strict_types=1);
-
- require_once __DIR__ . '/icons.php';
- require_once __DIR__ . '/asset.php';
- require_once __DIR__ . '/font-library.php';
- require_once __DIR__ . '/activity-log.php';
-
- $dashAvailableFonts = FontLibrary::available();
-
- $dashSiteName = Config::get('APP_NAME', 'Publisium');
- $dashCurrentUser = Auth::user();
- $dashCurrentRole = Auth::role();
- $dashIsAdmin = Auth::hasRoleAtLeast(Auth::ROLE_EDITOR_IN_CHIEF);
- require_once __DIR__ . '/avatar.php';
- require_once __DIR__ . '/author-profile.php';
- require_once __DIR__ . '/site-comments.php';
-
- if (!function_exists('dashStatusLabel')) {
- function dashStatusLabel(string $status): string
- {
- return [
- 'draft' => 'Draft',
- 'pending_review' => 'Waiting for review',
- 'scheduled' => 'Scheduled',
- 'published' => 'Published',
- 'rejected' => 'Needs changes',
- 'archived' => 'Archived',
- 'pending' => 'Waiting for review',
- 'approved' => 'Approved',
- ][$status] ?? ucfirst(str_replace('_', ' ', $status));
- }
- }
-
- ?>
- <!DOCTYPE html>
- <html lang="en">
-
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
- <title><?= htmlspecialchars($dashPageTitle ?? 'Dashboard') ?> - <?= htmlspecialchars($dashSiteName) ?></title>
- <?= Asset::favicon() ?>
- <?= Asset::css('assets/dashboard.css') ?>
- <style>
- <?php foreach ($dashAvailableFonts as $dashFont): ?>
- <?= FontLibrary::fontFaceCss($dashFont['display_name'], $dashFont['display_name']) ?>
- <?php endforeach; ?>
- </style>
- </head>
-
- <body data-theme="dark">
- <script>
- (function() {
- try {
- var t = localStorage.getItem('publisium_dashboard_theme');
- if (t === 'dark' || t === 'light') {
- document.body.setAttribute('data-theme', t);
- } else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) {
- document.body.setAttribute('data-theme', 'light');
- }
- } catch (e) {}
- })();
- </script>
- <script>
- (function() {
- try {
- var minimal = localStorage.getItem('publisium_dashboard_minimal') === '1';
- if (minimal) {
- document.body.classList.add('dash-minimal');
- }
- if (minimal || localStorage.getItem('publisium_dashboard_glass') === '0') {
- document.body.classList.add('dash-no-glass');
- }
- } catch (e) {}
- })();
- </script>
- <script>
- (function() {
- try {
- var validScales = [80, 90, 100, 110, 120, 130, 140, 150];
- var sidebarScale = parseInt(localStorage.getItem('publisium_dashboard_sidebar_scale'), 10);
- var mainScale = parseInt(localStorage.getItem('publisium_dashboard_main_scale'), 10);
- if (validScales.indexOf(sidebarScale) === -1) {
- sidebarScale = 100;
- }
- if (validScales.indexOf(mainScale) === -1) {
- mainScale = 100;
- }
- if (sidebarScale !== 100 || mainScale !== 100) {
- var style = document.createElement('style');
- var rules = '';
- if (sidebarScale !== 100) {
- rules += '.dash-sidebar{zoom:' + (sidebarScale / 100) + ';}';
- }
- if (mainScale !== 100) {
- rules += '.dash-main{zoom:' + (mainScale / 100) + ';}';
- }
- style.textContent = rules;
- document.head.appendChild(style);
- }
- } catch (e) {}
- })();
- </script>
- <?= Icons::sprite() ?>
-
- <div class="dash-mobile-topbar">
- <div class="dash-brand"><span class="dash-brand-dot"></span><?= htmlspecialchars($dashSiteName) ?></div>
- <div class="dash-mobile-topbar-right">
- <button type="button" class="dash-theme-toggle" aria-label="Toggle theme">
- <?= Icons::icon('sun', 'icon icon-sm icon-sun') ?>
- <?= Icons::icon('moon', 'icon icon-sm icon-moon') ?>
- </button>
- <?= Avatar::html($dashCurrentUser, 'dash-user-avatar') ?>
- </div>
- </div>
-
- <div class="dash-shell">
- <aside class="dash-sidebar">
-
- <div class="dash-brand-row">
- <div class="dash-brand"><span class="dash-brand-dot"></span><?= htmlspecialchars($dashSiteName) ?></div>
- <button type="button" class="dash-theme-toggle" id="dash-theme-toggle-btn" aria-label="Toggle theme">
- <?= Icons::icon('sun', 'icon icon-sm icon-sun') ?>
- <?= Icons::icon('moon', 'icon icon-sm icon-moon') ?>
- </button>
- </div>
-
- <nav class="dash-nav">
- <a href="dashboard.php?view=overview" class="<?= ($dashView ?? '') === 'overview' ? 'active' : '' ?>"><?= Icons::icon('overview') ?>Overview</a>
- <a href="dashboard.php?view=articles" class="<?= in_array($dashView ?? '', ['articles', 'article-edit'], true) ? 'active' : '' ?>"><?= Icons::icon('articles') ?>Articles</a>
- <a href="dashboard.php?view=categories" class="<?= ($dashView ?? '') === 'categories' ? 'active' : '' ?>"><?= Icons::icon('categories') ?>Categories</a>
- <?php $dashProfilesOn = AuthorProfile::isEnabled(); ?>
- <?php if (AuthorProfile::canHaveProfile() && ($dashProfilesOn || $dashIsAdmin)): ?>
- <a href="dashboard.php?view=profile" class="<?= ($dashView ?? '') === 'profile' ? 'active' : '' ?>"><?= Icons::icon('user') ?>Artist</a>
- <?php endif; ?>
- <?php if ($dashProfilesOn && Auth::canModerate()): ?>
- <?php $dashPendingProfiles = AuthorProfile::pendingCount(); ?>
- <a href="dashboard.php?view=profile-reviews" class="<?= ($dashView ?? '') === 'profile-reviews' ? 'active' : '' ?>"><?= Icons::icon('flag') ?>Artist reviews<?= $dashPendingProfiles > 0 ? ' (' . $dashPendingProfiles . ')' : '' ?></a>
- <?php endif; ?>
- <?php if (Auth::canModerate() && SiteComments::isActive()): ?>
- <?php $dashPendingComments = SiteComments::pendingCount(); ?>
- <a href="comments.php" class="<?= ($dashActivePage ?? '') === 'comments' ? 'active' : '' ?>"><?= Icons::icon('message') ?>Comments<?= $dashPendingComments > 0 ? ' (' . $dashPendingComments . ')' : '' ?></a>
- <?php endif; ?>
- <a href="dashboard.php?view=pages" class="<?= ($dashView ?? '') === 'pages' ? 'active' : '' ?>"><?= Icons::icon('pages') ?>Pages</a>
- <a href="dashboard.php?view=stats" class="<?= ($dashView ?? '') === 'stats' ? 'active' : '' ?>"><?= Icons::icon('stats') ?>Statistics</a>
- <a href="dashboard.php?view=security" class="<?= ($dashView ?? '') === 'security' ? 'active' : '' ?>"><?= Icons::icon('lock') ?>Security</a>
- <a href="interface.php" class="<?= ($dashActivePage ?? '') === 'interface' ? 'active' : '' ?>"><?= Icons::icon('sliders') ?>Interface</a>
- <?php if ($dashIsAdmin): ?>
- <div class="dash-nav-divider"></div>
- <a href="admin.php" class="<?= ($dashActivePage ?? '') === 'admin' ? 'active' : '' ?>"><?= Icons::icon('team') ?>Team</a>
- <a href="settings.php" class="<?= ($dashActivePage ?? '') === 'settings' ? 'active' : '' ?>"><?= Icons::icon('settings') ?>Settings</a>
- <a href="languages.php" class="<?= ($dashActivePage ?? '') === 'languages' ? 'active' : '' ?>"><?= Icons::icon('translate') ?>Languages</a>
- <a href="ads.php" class="<?= ($dashActivePage ?? '') === 'ads' ? 'active' : '' ?>"><?= Icons::icon('ads') ?>Ads</a>
- <?php if (ActivityLog::isEnabled()): ?>
- <a href="activity.php" class="<?= ($dashActivePage ?? '') === 'activity' ? 'active' : '' ?>"><?= Icons::icon('stats') ?>Activity log</a>
- <?php endif; ?>
- <a href="analytics.php" class="<?= ($dashActivePage ?? '') === 'analytics' ? 'active' : '' ?>"><?= Icons::icon('analytics') ?>Analytics</a>
- <?php endif; ?>
- </nav>
-
- <div class="dash-user">
- <?= Avatar::html($dashCurrentUser, 'dash-user-avatar') ?>
- <div class="dash-user-info">
- <div class="dash-user-name"><?= htmlspecialchars($dashCurrentUser['display_name']) ?></div>
- <div class="dash-user-role"><?= htmlspecialchars(Auth::roleLabel($dashCurrentRole)) ?></div>
- </div>
- <a href="team-login.php?logout=1" class="dash-user-logout" aria-label="Log out"><?= Icons::icon('logout', 'icon icon-sm') ?></a>
- </div>
-
- </aside>
- <main class="dash-main">