Architecture
Architecture.mdArchitecture
High-Level Shape
the site is a classic folder-routed PHP app with a shared shell and file-based storage.
usual pattern:
session_start()- set
$titleand$description - locate the preferred template
- load route-local
content.html - inject dynamic placeholders
- echo final HTML
Shared Building Blocks
template.html
default desktop shell with sidebar, footer, placeholders, and global asset includes
template_mobile.html
alternate shell for mobile-friendly view
lib/render.php
shared helpers for upward file lookup and mobile template selection
main.js
shared client behavior layer
style.css
global styling and component rules
Template Selection
mobile/desktop template choice is centralized in lib/render.php.
mobile mode is enabled when any of these are true:
- host is
m.fridg3.org - cookie
mobile_friendly_viewis truthy - logged-in account has
mobileFriendlyView: trueindata/accounts/accounts.json
if the mobile template is requested but missing, routes fall back to template.html.
Session And Auth Model
- logged-in state lives in
$_SESSION['user'] - frontend admin awareness uses a non-HttpOnly
is_admincookie - backend authorization is still done in PHP, which is correct and non-cursed
common session fields:
usernamenameisAdminallowedPages
Persistence Model
there is no database. the app reads and writes JSON, TXT, HTML, and media files under /data.
main stores:
data/accounts/accounts.jsondata/accounts/login_attempts.jsondata/feed/*.txtdata/journal/*.txtdata/journal/drafts/*.txtdata/guestbook/*.txtdata/newsletter/*.htmldata/etc/*.json
Important Couplings
- many routes still do literal string replacement on the footer account button to swap login/logout
main.jsassumes certain DOM ids exist across templates- bookmarks are stored in
accounts.json, but some old code paths still reference a legacy/data/userspattern - page views are updated from shared frontend flow, so nav changes can silently break view counts