diff --git a/index.php b/index.php index 8ba9039..19be948 100644 --- a/index.php +++ b/index.php @@ -66,7 +66,6 @@ if ($action === 'login') { } // Handle POST actions that need a redirect BEFORE layout outputs any HTML. -// Adding new redirect-based POST keys here keeps header() calls safe. if ($_SERVER['REQUEST_METHOD'] === 'POST' && $user_id) { // Mood setter if (isset($_POST['set_mood'])) { @@ -86,19 +85,74 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && $user_id) { header('Location: ?action=dashboard'); exit; } + + // Profile picture upload + if (isset($_POST['upload_profile_pic'])) { + // Ensure column exists + try { $pdo->exec("ALTER TABLE users ADD COLUMN profile_pic TEXT DEFAULT NULL"); } catch(Exception $e) {} + if (isset($_FILES['profile_pic']) && $_FILES['profile_pic']['error'] === 0) { + $allowed_types = ['image/jpeg','image/png','image/gif','image/webp']; + if (in_array($_FILES['profile_pic']['type'], $allowed_types)) { + $ext = pathinfo($_FILES['profile_pic']['name'], PATHINFO_EXTENSION); + $filename = 'avatar_' . $user_id . '_' . time() . '.' . $ext; + $dest = 'uploads/' . $filename; + if (move_uploaded_file($_FILES['profile_pic']['tmp_name'], $dest)) { + // Delete old pic + $old = $pdo->prepare("SELECT profile_pic FROM users WHERE id=?"); + $old->execute([$user_id]); + $old_pic = $old->fetchColumn(); + if ($old_pic && file_exists($old_pic)) @unlink($old_pic); + $pdo->prepare("UPDATE users SET profile_pic=? WHERE id=?")->execute([$dest, $user_id]); + } + } + } + header('Location: ?action=' . ($_POST['redirect_to'] ?? 'dashboard')); + exit; + } + + // Delete profile picture + if (isset($_POST['delete_profile_pic'])) { + try { $pdo->exec("ALTER TABLE users ADD COLUMN profile_pic TEXT DEFAULT NULL"); } catch(Exception $e) {} + $old = $pdo->prepare("SELECT profile_pic FROM users WHERE id=?"); + $old->execute([$user_id]); + $old_pic = $old->fetchColumn(); + if ($old_pic && file_exists($old_pic)) @unlink($old_pic); + $pdo->prepare("UPDATE users SET profile_pic=NULL WHERE id=?")->execute([$user_id]); + header('Location: ?action=' . ($_POST['redirect_to'] ?? 'dashboard')); + exit; + } + + // Change password + if (isset($_POST['change_password'])) { + $cur = trim($_POST['current_password'] ?? ''); + $new = trim($_POST['new_password'] ?? ''); + $cnf = trim($_POST['confirm_password'] ?? ''); + $user = get_user($user_id); + $pw_error = ''; + if (!password_verify($cur, $user['password_hash'])) { + $pw_error = 'Current password is incorrect.'; + } elseif (strlen($new) < 6) { + $pw_error = 'New password must be at least 6 characters.'; + } elseif ($new !== $cnf) { + $pw_error = 'Passwords do not match.'; + } else { + $pdo->prepare("UPDATE users SET password_hash=? WHERE id=?") + ->execute([password_hash($new, PASSWORD_DEFAULT), $user_id]); + } + $_SESSION['pw_change_msg'] = $pw_error ?: 'success'; + header('Location: ?action=' . ($_POST['redirect_to'] ?? 'dashboard')); + exit; + } } $view_file = 'views/' . basename($action) . '.php'; if (file_exists($view_file)) { - // AJAX-only POST requests must not have the HTML layout wrapped around them, - // otherwise the JSON response gets embedded inside the HTML document and - // JSON.parse() fails on the client side. $is_ajax_post = isset($_POST['ajax_submit']) || isset($_POST['delete_attachment_ajax']) || isset($_POST['upload_attachment_ajax']); if ($is_ajax_post) { - include $view_file; // view handles its own output + exit + include $view_file; } else { include 'views/layout_top.php'; include $view_file; diff --git a/public/css/style.css b/public/css/style.css index 4033d97..2bc6322 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -30,29 +30,32 @@ a { text-decoration: none; color: var(--primary); } a:hover { text-decoration: underline; } .app-container { display: flex; min-height: 100vh; } -.sidebar { width: 250px; background: var(--surface); border-right: 1px solid var(--border); padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; } -.sidebar h2 { font-size: 1.2rem; margin-bottom: 2rem; color: var(--primary); } -.nav-link { padding: 0.75rem 1rem; border-radius: 0.5rem; text-decoration: none !important; color: var(--text); font-weight: 500; transition: background 0.2s; display: flex; justify-content: space-between; align-items: center; } +.sidebar { width: 240px; background: var(--surface); border-right: 1px solid var(--border); padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; } +.sidebar h2 { font-size: 1.15rem; margin-bottom: 1.5rem; color: var(--primary); } +.nav-link { padding: 0.6rem 0.9rem; border-radius: 0.5rem; text-decoration: none !important; color: var(--text); font-weight: 500; transition: background 0.2s; display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; } .nav-link:hover, .nav-link.active { background: rgba(var(--primary-rgb), 0.1); color: var(--primary); } .nav-link .badge { background: #EF4444; color: white; padding: 2px 6px; border-radius: 12px; font-size: 0.75rem; } -.main-content { flex: 1; padding: 2rem; overflow-y: auto; } -.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; } +.main-content { flex: 1; padding: 1.5rem 2rem; overflow-y: auto; max-height: 100vh; } +.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; } .card { background: var(--surface); padding: 1.5rem; border-radius: 1rem; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); margin-bottom: 1.5rem; } -.btn { display: inline-flex; align-items: center; gap: 0.5rem; justify-content:center; padding: 0.5rem 1rem; background: var(--primary); color: white !important; border-radius: 0.5rem; border: none; cursor: pointer; text-decoration: none !important; font-weight: 500; transition: opacity 0.2s; } -.btn:hover { opacity: 0.9; } -.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.875rem; } +.btn { display: inline-flex; align-items: center; gap: 0.5rem; justify-content:center; padding: 0.5rem 1rem; background: var(--primary); color: white !important; border-radius: 0.5rem; border: none; cursor: pointer; text-decoration: none !important; font-weight: 500; transition: opacity 0.2s; font-size: 0.875rem; } +.btn:hover { opacity: 0.9; text-decoration: none !important; } +.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; } .btn-secondary { background: var(--text-light); } .btn-danger { background: #EF4444; } .form-group { margin-bottom: 1rem; } -.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; } -.form-control { width: 100%; padding: 0.75rem; border: 1px solid var(--border); border-radius: 0.5rem; font-family: inherit; background: var(--input-bg); color: var(--text); } +.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.875rem; } +.form-control { width: 100%; padding: 0.65rem 0.75rem; border: 1px solid var(--border); border-radius: 0.5rem; font-family: inherit; background: var(--input-bg); color: var(--text); font-size: 0.9rem; } +.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.12); } -table { width: 100%; border-collapse: collapse; margin-top: 1rem; } -th, td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border); } -th { color: var(--text-light); font-weight: 500; } +table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.875rem; } +th, td { padding: 0.65rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); } +th { color: var(--text-light); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; background: rgba(0,0,0,0.02); } +body.dark-mode th { background: rgba(255,255,255,0.02); } +tr:hover td { background: rgba(var(--primary-rgb),0.03); } .kanban-board { display: flex; gap: 1.5rem; overflow-x: auto; padding-bottom: 1rem; } .kanban-col { background: rgba(0,0,0,0.03); border-radius: 1rem; width: 320px; min-width: 320px; display: flex; flex-direction: column; } @@ -62,22 +65,191 @@ body.dark-mode .kanban-col { background: rgba(255,255,255,0.03); } .kanban-task { background: var(--surface); padding: 1rem; border-radius: 0.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.05); border: 1px solid var(--border); cursor: grab; } .kanban-task:active { cursor: grabbing; } -.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.2s; } +.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.2s; backdrop-filter: blur(3px); } .modal-overlay.active { opacity: 1; pointer-events: auto; } -.modal-content { background: var(--surface); padding: 2rem; border-radius: 1rem; width: 100%; max-width: 400px; transform: translateY(-20px); transition: transform 0.2s; } +.modal-content { background: var(--surface); padding: 2rem; border-radius: 1rem; width: 100%; max-width: 500px; transform: translateY(-20px); transition: transform 0.2s; box-shadow: 0 25px 50px rgba(0,0,0,0.3); } .modal-overlay.active .modal-content { transform: translateY(0); } -#toast { position: fixed; bottom: 20px; right: 20px; background: var(--text); color: var(--surface); padding: 1rem; border-radius: 0.5rem; z-index: 9999; transform: translateY(100px); opacity: 0; transition: all 0.3s; } +#toast { position: fixed; bottom: 20px; right: 20px; background: var(--text); color: var(--surface); padding: 1rem 1.25rem; border-radius: 0.5rem; z-index: 9999; transform: translateY(100px); opacity: 0; transition: all 0.3s; font-size: 0.875rem; } #toast.show { transform: translateY(0); opacity: 1; } -.dropzone { border: 2px dashed var(--border); padding: 3rem; text-align: center; border-radius: 1rem; cursor: pointer; transition: background 0.2s; } +.dropzone { border: 2px dashed var(--border); padding: 2rem; text-align: center; border-radius: 1rem; cursor: pointer; transition: background 0.2s; color: var(--text-light); } .dropzone.dragover { background: rgba(var(--primary-rgb), 0.1); border-color: var(--primary); } -.project-item { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem; border-bottom: 1px solid var(--border); } -.project-item:hover { background: rgba(0,0,0,0.02); } -body.dark-mode .project-item:hover { background: rgba(255,255,255,0.02); } +.project-item { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); transition: background 0.15s; } +.project-item:hover { background: rgba(var(--primary-rgb),0.04); } +body.dark-mode .project-item:hover { background: rgba(255,255,255,0.03); } .login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #4F46E5 0%, #10B981 100%); } .login-card { background: var(--surface); padding: 2.5rem; border-radius: 1rem; width: 100%; max-width: 400px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); } .login-card h1 { text-align: center; margin-bottom: 1.5rem; color: var(--text); } -.alert { padding: 1rem; border-radius: 0.5rem; margin-bottom: 1rem; background: #FEF2F2; color: #991B1B; } +.alert { padding: 1rem; border-radius: 0.5rem; margin-bottom: 1rem; background: #FEF2F2; color: #991B1B; font-size: 0.875rem; } + +/* ── User Avatar Dropdown ─────────────────────────────────────────────────── */ +.user-dropdown-wrap { position: relative; } +.user-avatar-btn { + width: 40px; height: 40px; border-radius: 50%; + background: var(--primary); color: #fff; + border: 2px solid transparent; + cursor: pointer; display: flex; align-items: center; justify-content: center; + font-size: 1rem; font-weight: 700; overflow: hidden; + transition: box-shadow 0.2s, border-color 0.2s; + flex-shrink: 0; +} +.user-avatar-btn:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.2); } +.user-dropdown-menu { + display: none; position: absolute; top: calc(100% + 8px); right: 0; + background: var(--surface); border: 1px solid var(--border); border-radius: 0.75rem; + box-shadow: 0 10px 25px rgba(0,0,0,0.15); min-width: 200px; z-index: 500; + overflow: hidden; animation: dropdown-in 0.15s ease; +} +.user-dropdown-menu.open { display: block; } +@keyframes dropdown-in { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } } +.user-dropdown-header { padding: 0.9rem 1rem; background: rgba(var(--primary-rgb),0.06); } +.user-dropdown-name { font-weight: 700; font-size: 0.9rem; color: var(--text); } +.user-dropdown-role { font-size: 0.75rem; color: var(--text-light); margin-top: 2px; } +.user-dropdown-divider { height: 1px; background: var(--border); margin: 0; } +.user-dropdown-item { + display: flex; align-items: center; gap: 0.65rem; + padding: 0.65rem 1rem; width: 100%; border: none; + background: none; color: var(--text); font-size: 0.875rem; + cursor: pointer; text-decoration: none !important; font-family: inherit; + transition: background 0.15s; +} +.user-dropdown-item:hover { background: rgba(var(--primary-rgb),0.07); color: var(--primary); } +.user-dropdown-item i { width: 16px; text-align: center; color: var(--text-light); } +.user-dropdown-item:hover i { color: var(--primary); } +.user-dropdown-logout { color: #EF4444 !important; } +.user-dropdown-logout:hover { background: rgba(239,68,68,0.07) !important; } +.user-dropdown-logout i { color: #EF4444 !important; } + +/* ── Notes / Google Keep Style ───────────────────────────────────────────── */ +.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; } +.note-card { + background: var(--surface); border: 1px solid var(--border); + border-radius: 0.75rem; padding: 1rem; cursor: pointer; + transition: box-shadow 0.2s, transform 0.15s; position: relative; + display: flex; flex-direction: column; gap: 0.5rem; min-height: 120px; +} +.note-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,0.12); transform: translateY(-2px); } +.note-card-title { font-weight: 600; font-size: 0.95rem; color: var(--text); word-break: break-word; } +.note-card-preview { font-size: 0.8rem; color: var(--text-light); overflow: hidden; max-height: 80px; line-height: 1.5; word-break: break-word; } +.note-card-img { width: 100%; height: 120px; object-fit: cover; border-radius: 0.5rem; margin-bottom: 0.25rem; } +.note-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 0.5rem; border-top: 1px solid var(--border); gap: 0.5rem; } +.note-card-actions { display: none; gap: 0.25rem; } +.note-card:hover .note-card-actions { display: flex; } +.note-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; } +.note-card-shared-badge { background: #10B981; color: #fff; font-size: 0.65rem; padding: 2px 6px; border-radius: 10px; font-weight: 600; letter-spacing: 0.03em; } + +/* Note editor toolbar */ +.note-editor-toolbar { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.5rem; padding: 0.35rem; background: var(--bg); border-radius: 0.5rem; border: 1px solid var(--border); } +.note-toolbar-btn { background: none; border: none; cursor: pointer; padding: 4px 7px; border-radius: 4px; color: var(--text-light); font-size: 0.85rem; transition: background 0.15s, color 0.15s; } +.note-toolbar-btn:hover { background: rgba(var(--primary-rgb),0.1); color: var(--primary); } +.note-content-area { min-height: 160px; border: 1px solid var(--border); border-radius: 0.5rem; padding: 0.75rem; outline: none; font-size: 0.9rem; line-height: 1.6; background: var(--input-bg); color: var(--text); resize: vertical; } +.note-content-area:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.1); } + +/* Note color palette */ +.note-color-palette { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.5rem; } +.color-swatch { width: 24px; height: 24px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: transform 0.15s, border-color 0.15s; } +.color-swatch:hover, .color-swatch.selected { transform: scale(1.2); border-color: var(--text); } + +/* ── Passwords Vault / Bitwarden Style ───────────────────────────────────── */ +.vault-layout { display: grid; grid-template-columns: 220px 1fr; gap: 0; min-height: 500px; } +.vault-sidebar { + background: rgba(var(--primary-rgb),0.05); border-right: 1px solid var(--border); + border-radius: 1rem 0 0 1rem; padding: 1rem; display: flex; flex-direction: column; gap: 0.25rem; +} +.vault-folder-item { + display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.65rem; + border-radius: 0.5rem; cursor: pointer; font-size: 0.875rem; color: var(--text); + border: none; background: none; width: 100%; text-align: left; transition: background 0.15s; + font-family: inherit; +} +.vault-folder-item:hover, .vault-folder-item.active { background: rgba(var(--primary-rgb),0.12); color: var(--primary); font-weight: 600; } +.vault-folder-item i { width: 16px; color: var(--text-light); } +.vault-folder-item.active i { color: var(--primary); } +.vault-main { padding: 1.5rem; } +.vault-search { display: flex; align-items:center; gap: 0.5rem; margin-bottom: 1rem; } +.vault-entry { display: flex; align-items: center; gap: 1rem; padding: 0.75rem; border-radius: 0.5rem; border: 1px solid transparent; transition: background 0.15s, border-color 0.15s; cursor: pointer; } +.vault-entry:hover { background: rgba(var(--primary-rgb),0.04); border-color: var(--border); } +.vault-entry-icon { width: 36px; height: 36px; border-radius: 8px; background: rgba(var(--primary-rgb),0.12); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; overflow: hidden; } +.vault-entry-icon img { width: 100%; height: 100%; object-fit: contain; } +.vault-entry-info { flex: 1; min-width: 0; } +.vault-entry-title { font-weight: 600; font-size: 0.9rem; color: var(--text); } +.vault-entry-user { font-size: 0.78rem; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.vault-entry-actions { display: flex; gap: 0.25rem; opacity: 0; transition: opacity 0.15s; } +.vault-entry:hover .vault-entry-actions { opacity: 1; } + +/* ── Projects / Windows Explorer Detail View ─────────────────────────────── */ +.explorer-toolbar { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; padding: 0.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 0.5rem; flex-wrap: wrap; } +.explorer-path { display: flex; align-items: center; gap: 0.25rem; flex: 1; min-width: 0; font-size: 0.875rem; } +.explorer-path-part { color: var(--text-light); } +.explorer-path-part.current { color: var(--text); font-weight: 600; } +.explorer-path-sep { color: var(--text-light); font-size: 0.75rem; margin: 0 2px; } + +.explorer-table { width: 100%; border-collapse: collapse; } +.explorer-table thead tr { background: rgba(var(--primary-rgb),0.05); } +.explorer-table th { padding: 0.55rem 0.75rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-light); font-weight: 600; cursor: pointer; user-select: none; border-bottom: 2px solid var(--border); white-space: nowrap; } +.explorer-table th:hover { color: var(--primary); } +.explorer-table td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.875rem; vertical-align: middle; } +.explorer-row { transition: background 0.12s; } +.explorer-row:hover { background: rgba(var(--primary-rgb),0.04); } +.explorer-row.selected { background: rgba(var(--primary-rgb),0.1); } +.explorer-icon { font-size: 1rem; width: 22px; display: inline-block; text-align: center; } +.explorer-name { display: flex; align-items: center; gap: 0.5rem; } +.explorer-name a { font-weight: 500; color: var(--text); } +.explorer-name a:hover { color: var(--primary); text-decoration: none; } +.explorer-actions { display: flex; gap: 0.25rem; opacity: 0; transition: opacity 0.15s; } +.explorer-row:hover .explorer-actions { opacity: 1; } +.explorer-status-bar { display: flex; gap: 1rem; align-items: center; padding: 0.4rem 0.75rem; background: var(--bg); border: 1px solid var(--border); border-radius: 0.5rem; font-size: 0.78rem; color: var(--text-light); margin-top: 0.5rem; } + +/* ── Admin Panel ─────────────────────────────────────────────────────────── */ +.admin-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; } +.admin-tab { padding: 0.65rem 1.25rem; border: none; background: none; cursor: pointer; font-size: 0.875rem; font-weight: 600; color: var(--text-light); font-family: inherit; transition: color 0.15s; border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; } +.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); } +.admin-tab-pane { display: none; } +.admin-tab-pane.active { display: block; } +.admin-user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; } +.admin-user-card { background: var(--bg); border: 1px solid var(--border); border-radius: 0.75rem; padding: 1rem; } +.admin-user-card-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; } +.admin-user-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; overflow: hidden; flex-shrink: 0; } +.admin-badge-admin { background: rgba(79,70,229,0.1); color: var(--primary); font-size: 0.7rem; padding: 2px 8px; border-radius: 20px; font-weight: 700; letter-spacing: 0.04em; } +.admin-badge-user { background: rgba(107,114,128,0.1); color: var(--text-light); font-size: 0.7rem; padding: 2px 8px; border-radius: 20px; font-weight: 600; } + +/* ── Misc utils ──────────────────────────────────────────────────────────── */ +.flex-between { display: flex; justify-content: space-between; align-items: center; } +.badge { background: #EF4444; color: white; padding: 2px 6px; border-radius: 12px; font-size: 0.75rem; } + +/* ── Dashboard stat card (also used in admin) ────────────────────────────── */ +.db-stat-card { + background: var(--surface); border-radius: 1rem; padding: 1.25rem 1.5rem; + box-shadow: 0 4px 6px -1px rgba(0,0,0,0.07); border: 1px solid var(--border); + display: flex; flex-direction: column; gap: 0.5rem; + transition: transform 0.15s, box-shadow 0.15s; + text-decoration: none !important; color: var(--text) !important; +} +.db-stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 15px -3px rgba(0,0,0,0.1); } + +/* ── Activity Log (shared) ───────────────────────────────────────────────── */ +.log-item { display: flex; gap: 0.75rem; align-items: flex-start; font-size: 0.8rem; padding: 0.35rem 0; } +.log-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: 700; flex-shrink: 0; } +.log-body { flex: 1; min-width: 0; } +.log-body strong { color: var(--text); } +.log-body .log-detail { color: var(--text-light); } +.log-time { font-size: 0.7rem; color: var(--text-light); white-space: nowrap; flex-shrink: 0; } + +/* ── Markdown body styles ────────────────────────────────────────────────── */ +.markdown-body h1,.markdown-body h2,.markdown-body h3 { margin: 0.75rem 0 0.4rem; font-weight: 700; color: var(--text); } +.markdown-body h1 { font-size: 1.3rem; } +.markdown-body h2 { font-size: 1.1rem; } +.markdown-body h3 { font-size: 1rem; } +.markdown-body p { margin: 0.4rem 0; line-height: 1.6; } +.markdown-body ul,.markdown-body ol { padding-left: 1.5rem; margin: 0.4rem 0; } +.markdown-body li { margin: 0.2rem 0; } +.markdown-body code { background: rgba(var(--primary-rgb),0.1); padding: 2px 5px; border-radius: 4px; font-size: 0.85em; font-family: monospace; } +.markdown-body pre { background: rgba(0,0,0,0.07); padding: 0.75rem; border-radius: 6px; overflow-x: auto; } +.markdown-body pre code { background: none; padding: 0; } +body.dark-mode .markdown-body pre { background: rgba(255,255,255,0.05); } +.markdown-body blockquote { border-left: 3px solid var(--primary); padding-left: 0.75rem; color: var(--text-light); margin: 0.5rem 0; } +.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 0.75rem 0; } +.markdown-body a { color: var(--primary); } diff --git a/views/admin.php b/views/admin.php index fcc5380..a0fec52 100644 --- a/views/admin.php +++ b/views/admin.php @@ -1,132 +1,412 @@ prepare("INSERT INTO users (username, password_hash, is_admin) VALUES (?, ?, ?)"); - $stmt->execute([$username, $pass, $is_admin]); - } - if(isset($_POST['create_group'])) { - $stmt = $pdo->prepare("INSERT INTO groups (name) VALUES (?)"); - $stmt->execute([$_POST['group_name']]); - } - if(isset($_POST['assign_group'])) { - $stmt = $pdo->prepare("INSERT OR IGNORE INTO user_groups (user_id, group_id) VALUES (?, ?)"); - $stmt->execute([$_POST['user_id'], $_POST['group_id']]); - } - if(isset($_POST['update_user_channels'])) { - $ch = $_POST['channels'] ?? []; - $ch_str = is_array($ch) ? implode(',', $ch) : ''; - $stmt = $pdo->prepare("UPDATE users SET notify_channels=?, telegram_id=?, email=?, whatsapp_number=? WHERE id=?"); - $stmt->execute([$ch_str, $_POST['telegram_id'], $_POST['email'], $_POST['whatsapp_number'], $_POST['user_id']]); - echo "
No groups created yet.
+ +No members yet.
+ +Assign specific notification channels (Native, Telegram, Email, WhatsApp) to users. User must be created above first.
+Configure notification channels (Native, Telegram, Email, WhatsApp) per user.
| Username | Active Channels | Telegram ID | Action | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| User | +Role | +Channels | +Telegram ID | +Save | +||||||||
| = htmlspecialchars($u['username']) ?> | -- - - - - + |
+
+
+ = htmlspecialchars($u['username']) ?>
+
|
- - | - | - | + | = $u['is_admin']?'Admin':'User' ?> | +
+
+
+
+
+
+ |
+ + | + | + |
Control how long tasks stay in Completed or Archived states before being moved/deleted.
+No groups registered.
+These actions are irreversible. Proceed with extreme caution.
+