# phpfilebrowser — Project Instructions ## Overview Single-file PHP file browser. No external dependencies. Dark modern theme, responsive, mobile-optimized. ## Architecture ``` phpfilebrowser/ ├── AGENTS.md # This file — project state & agent instructions ├── index.php # Single-file application (PHP backend + CSS + JS inline) └── .gitignore ``` ## Current State **Step 1 — Project Setup:** `completed` (2026-06-09 16:30) - ✅ Project directory created - ✅ AGENTS.md created - ✅ .gitignore created - ✅ Git init + push to Gitea **Step 2 — PHP Backend:** `completed` (2026-06-09 16:30) - ✅ Directory listing via `?action=list&path=...` - ✅ File download via `?action=download&file=...` - ✅ Configurable ENTRY_POINT (default: `/tmp`) - ✅ Path traversal protection (realpath + ENTRY_POINT prefix check) - ✅ Metadata: name, type, size, modified **Step 3 — Frontend CSS:** `completed` (2026-06-09 16:30) - ✅ Dark theme with CSS variables (--bg-primary, --accent, etc.) - ✅ Responsive table (columns hidden on small screens) - ✅ Toolbar with nav buttons, breadcrumb, filter, sort selector - ✅ Media overlay with backdrop blur - ✅ Inline SVG file-type icons - ✅ Custom scrollbar styling - ✅ Mobile-first responsive breakpoints (768px, 480px) **Step 4 — Table & Sorting:** `completed` (2026-06-09 16:30) - ✅ Directory listing loaded via fetch() - ✅ Sortable columns (name, date, size) with asc/desc toggle - ✅ Directories always sorted first - ✅ Sort state synced with dropdown selector - ✅ Sort indicator arrows in headers **Step 5 — Filtering:** `completed` (2026-06-09 16:30) - ✅ Text filter with 150ms debounce - ✅ Case-insensitive substring match - ✅ Empty state with helpful message **Step 6 — Media Player Overlay:** `completed` (2026-06-09 16:30) - ✅ Image preview (img tag, object-fit: contain) - ✅ Audio player (controls + autoplay) - ✅ Video player (controls + autoplay) - ✅ Close via button, backdrop click, or Escape key - ✅ Media playback stops on close **Step 7 — Download Trigger:** `completed` (2026-06-09 16:30) - ✅ Non-media files trigger browser download - ✅ PHP sets Content-Disposition header - ✅ Client-side: dynamic element click **Step 8 — Browser Navigation:** `completed` (2026-06-09 16:30) - ✅ History stack for back/forward buttons - ✅ URL reflects current directory via query params - ✅ popstate listener for browser back/forward - ✅ Breadcrumb navigation (clickable path segments) - ✅ Nav buttons disabled at boundaries **Git Repository:** `completed` - ✅ Pushed to https://git.jlserver.de/JLtec/phpfilebrowser.git - ✅ Commit: `7bb9b9b` — feat: initial phpfilebrowser ## Implementation Plan ### Step 1: Project Setup - [x] Create project directory - [x] Create AGENTS.md - [x] Create .gitignore - [x] Git init, configure, push to Gitea ### Step 2: PHP Backend (`index.php` — backend portion) - [x] Read directory contents (realpath-based, no traversal) - [x] Return JSON for current directory listing - [x] Handle relative path from query param (`?path=`) - [x] Return metadata: name, type (dir/file), size, modified date ### Step 3: Frontend — CSS (dark, modern, responsive) - [x] Dark color scheme with CSS variables - [x] Responsive table layout (stack on mobile) - [x] Navigation bar with breadcrumb - [x] Back/Forward browser-style navigation buttons - [x] Filter input styling - [x] Media player overlay styling - [x] Sortable column headers with indicators - [x] File type icons (inline SVG) ### Step 4: Frontend — Table & Sorting - [x] Render file/folder table from JSON data - [x] Clickable rows (folders navigate, files trigger action) - [x] Client-side sort by name, date, size (asc/desc) - [x] Sort state persisted in filter bar ### Step 5: Frontend — Filtering - [x] Text filter input (substring match) - [x] Filter applied to table rows in real-time ### Step 6: Frontend — Media Player Overlay - [x] Detect media file types (audio/video/image) - [x] Open overlay with embedded `