# ๐Ÿ“ PHP Directory Browser (Master Architecture) A centralized, path-aware PHP file browser powered by a single master renderer. Update one file. Every folder updates automatically. --- ## ๐Ÿš€ Features - ๐Ÿ“‚ Subdirectory support - โฌ† Safe โ€œUpโ€ navigation - โญ Path-based favorites (files + folders) - ๐Ÿงผ Automatic JSON normalization - ๐Ÿ”ค Auto-sorted favorites - ๐Ÿ“ฆ Folders first, newest first sorting - ๐Ÿ’พ Download buttons - ๐Ÿ“ฑ Mobile-friendly layout - ๐Ÿง  No database required --- ## ๐Ÿ— Architecture Overview Uses a single master renderer: ``` public_html/ โ”‚ โ”œโ”€โ”€ some-folder/ โ”‚ โ””โ”€โ”€ directory.php โ”‚ โ”œโ”€โ”€ another-folder/ โ”‚ โ””โ”€โ”€ directory.php โ”‚ โ””โ”€โ”€ custom-directory/ โ”œโ”€โ”€ master-directory.php โ”œโ”€โ”€ toggle_favorite.php โ””โ”€โ”€ favorites.json ``` Each directory.php is a thin wrapper: ``` ``` --- ## โญ Favorites System (Path-Based) Favorites are stored using full relative paths: ``` { "favorites": [ "/test.png", "/weather", "/tools/vlc-3.0.20-win32.exe" ] } ``` Improvements: - All favorites use full relative paths (no ambiguity) - Directories and files both supported - Automatic migration from legacy name-only entries - JSON stored using: JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES - Favorites auto-sorted before saving Cleaner JSON example: ``` { "favorites": [ "/sample-robots.txt", "/test.jpg", "/test.png", "/tools/7z2403-x64.exe", "/tools/vlc-3.0.20-win32.exe", "/vlc-3.0.20-win32.exe", "/weather" ] } ``` --- ## ๐Ÿ” Security - Uses realpath() for safe resolution - Prevents directory traversal - Restricts navigation to DOCUMENT_ROOT - Validates favorite paths before storing --- ## ๐Ÿ•’ Revision Tracking Footer shows: - Centralized APP_REVISION - True modification timestamp of master-directory.php - Displayed in Eastern Time (America/New_York) --- ## โš™ Requirements - PHP 8.0+ - Apache recommended - Writable custom-directory/ folder Optional .htaccess: DirectoryIndex directory.php --- ## ๐Ÿ“Œ Current Revision - master-directory.php โ†’ 3.1 - toggle_favorite.php โ†’ 2.0 - directory.php wrapper โ†’ 1.0 --- ## ๐Ÿ‘จโ€๐Ÿ’ป Author Jason Lamb --- ## ๐Ÿ“œ License MIT