IndexGram v10.11
IndexGram is a self-hosted digital file-cabinet system for publishing, organising, and sharing indexed documents. It is built with plain PHP, SQLite, and vanilla JavaScript β no framework, no Composer, no Node.
> IndexGram by Amfile.org of Page Telegram Volunteer Services v10.01 2026
---
Features
Content
- 3-level topic hierarchy β Topics β Sub-topics β Sub-sub-topics (up to 3 levels deep), each with its own OG image and description
- Topic landing pages β Per-topic Markdown pages activatable by admins/editors; shown above documents when enabled; editable via a quick-link on the topic page
- Document index cards β Documents display as responsive multi-column cards with OG image, description excerpt, audience and generic tags, and topic link
- Collapsible document index β Homepage document index is collapsed by default; click the titlebar to expand; state remembered in
sessionStorage; auto-opens when a filter is active
- Search always visible on homepage β Keyword, topic, and audience filter form is a persistent section above the topic grid, never hidden inside a collapsible
- Search at top of topic pages β Keyword and tag filters appear at the top of every topic page, above descriptions and sub-topics
- Home page root topic β Admin can pin a specific topic as the root of the Topic Index; the grid then shows that topic's sub-topics instead of the full root list; falls back to full root list if the topic has no children
- Markdown editor β Full Markdown with toolbar (bold, italic, headings, blockquotes, lists, code, links, images, tables, horizontal rules)
- Revision history β Every save creates a revision; editors can compare and review past versions
- Audience tags β Colour-coded tags assignable to documents; filterable on all index views; can be toggled off site-wide in Settings
- Generic tags β Flat grey tags for general content categorisation; always visible; managed in Admin β Generic Tags
- Full-text search indexing β FTS5 search index built on save for fast keyword queries across title, description, and document body; falls back to
LIKE if FTS5 is unavailable
- Keyword + tag + topic filtering β Combined filters on the homepage and each topic page
- RSS Feed Importer β Import any RSS 2.0 or Atom feed into documents; downloads images, audio, and PDFs to local storage; converts HTML to Markdown; includes Substack migration support; target topic selectable at step 1 before previewing
- OPML Collection Importer β Import an entire feed collection from an OPML subscription list (Feedly, Inoreader, NewsBlur, Thunderbird exports); upload the
.opml file or link to its URL; nested category paths are shown per feed; route each feed to its own topic, auto-create a sub-topic per feed, or send all feeds to one topic; per-feed item limit; safe to re-run thanks to per-item duplicate detection; large collections are processed in configurable batches with an auto-continuing progress screen, so imports of any size survive PHP and proxy timeouts, and can be stopped early keeping everything imported so far
- Substack ZIP Importer β Full Substack archive import from exported ZIP; target topic selectable at the upload step
- Markdown file import β Document and page editors include an "Import Markdown File" section; choose Replace (with confirmation) or Append mode; client-side
FileReader, no server round-trip; accepts .md and .txt files
Store
- Grid storefront at
/shop/ β responsive product grid with categories and sub-categories, product pages with Markdown descriptions, images, SKU, and stock display; fully theme-aware
- Three store modes β Independent (own catalog, cart, checkout), VistaPrint Pro Store (embed your VistaPrint storefront with
VP_Tracking partner attribution), or Both
- Any number of payment processors β PayPal (redirect checkout, no API keys), Stripe (hosted card checkout, auto-verified), and unlimited manual methods (Zelle, Venmo, CashApp, cheque, cash, bank transfer) with per-method customer instructions using
{order_no} / {total} placeholders
- Inventory system β stock quantities, stock tracking toggle, backorders, hidden/active status, featured products, cost vs. price with live profit-margin calculator and a default margin % applied at a click
- Ordering system β session cart, checkout, tokenised customer order-status pages, flat shipping charge, checkout terms notice, new-order email notifications
- VistaPrint fulfilment workflow β editors/admins process each order from Admin β Store β Orders: per-item "Order at VistaPrint" shortcut links, VistaPrint order # field, payment confirmation, status-update emails to the customer, and revenue / cost / profit-margin display per order
- Page store plugin β any custom page can additionally embed a VistaPrint storefront, a third-party embed (Etsy, Shopify Buy Buttonβ¦), or a link button to the built-in store
News Front Page
- Toggleable homepage news section β newest published documents carrying a configured generic tag (default: the
#info tag) displayed like a news site front page: a lead story with full-width image plus a grid of remaining stories
- Configurable in Admin β Settings: on/off, section title, tag, and story count
Marquee Ticker
- Site-wide scrolling marquee under the nav bar showing the title and description brief of each newly posted document, linking to it; pauses on hover
- Continuous across pages β the scroll position is derived from the wall clock, so navigating the site never restarts the ticker
- Configurable in Admin β Settings: on/off, label, number of documents, speed
Custom Pages
- Custom pages β Admin can create arbitrary static pages (Markdown content, slug, nav label)
- Sub-pages β Any custom page can have child pages; sub-pages appear as dropdown items under their parent in the nav and are listed at the bottom of the parent page; breadcrumb shows the full parent chain
- Pages in nav β Each custom page can be shown as a nav item; sub-pages appear in the parent's nav dropdown
- Topic sub-menus on pages β Custom page nav items can additionally expose a dropdown of selected topics
- Slug editing β The slug of any existing custom page can be renamed in the editor; built-in pages (
landing, bibliography) have read-only slugs; guards prevent reserved system paths and collisions with existing page slugs
Navigation
- Unified nav order β Admin β Config β Nav Order: drag-and-drop interface to set an arbitrary interleaved display order for all top-level topics and nav-visible pages together;
nav_position column stored on both tables
- Topic sub-menus β Top-level topics with sub-topics automatically render as hover dropdown menus; mobile-compatible with tap-to-open
- External nav links β Admin β Nav Links: add labelled external links to the nav bar and footer with sort ordering
- Logo as home link β The site logo (or site title text) in the nav bar is an
<a> linking to the site root; the redundant "Home" text link is removed
Media
- Image uploads β JPEG, PNG, GIF, WebP, SVG up to 10 MB; inserted into Markdown via toolbar
- Audio embeds β MP3, OGG, WAV up to 50 MB; renders as an HTML
<audio> player in documents
- PDF embeds β Upload or link external PDFs; displayed in a resizable iframe (page / tall / fullscreen modes) with download and open controls
- Video embeds β Paste a URL from YouTube, Vimeo, Rumble, Odysee, BitChute, PeerTube, or TikTok; auto-converts to the correct embed
Calendar Plugin
- Shortcode embed β Place
[cal='slug'] on its own line in any page or document to embed a calendar; override the opening view inline with [cal='slug' view='weekly']
- iCal / ICS feeds β Fetches any public iCal feed URL, including Google Calendar's public iCal address; parsed server-side with a full RFC 5545 iCal parser (line unfolding, TZID conversion, VALUE=DATE all-day events, DURATION fallback)
- Five display views β Monthly (traditional grid), Weekly (7-column day columns), Agenda (grouped upcoming events, 90-day window), Yearly (12 mini-month overview with event indicators), List (sortable table of all events)
- Interactive navigation β Prev / Next and Today buttons navigate between periods without a page reload; view switcher buttons change the active view instantly; event click opens a themed popup with title, date/time, location, description, and link
- Theme-aware styling β All calendar CSS uses the active theme's CSS custom properties (
--titlebar-bg, --accent-color, --border-*, --content-bg, etc.) so the calendar automatically matches any theme or colour palette
- Server-side feed caching β Fetched feed data is cached in
data/cal_cache/ (configurable TTL per calendar, default 1 hour); cache is served as JSON and protected from direct web access
- Admin management β Admin β Calendars: add/edit/delete calendars (slug, display name, feed URL, default view, cache TTL); Test button fetches the live feed and reports event count; Clear Cache forces an immediate refresh
- Graceful fallback β If the feed URL is unreachable or the calendar slug is not found, a themed error notice is rendered in place of the calendar
Sharing & Discovery
- Open Graph / Twitter Card meta β Per-document OG title, description, and image; logo used as site-wide fallback image; correct
og:url canonical per page
- RSS 2.0 feeds β Master feed and one feed per topic; marks updated items with
[Updated]; auto-discovered by browsers
- Print view β 8.5 Γ 11 letter layout with
@page CSS; PDF embeds shown as filenames; Ctrl+P shortcut on document pages; optional Include cover photo checkbox shows/hides the OG image full-width on the print page (setting persisted in URL via ?cover=1)
- Auto table of contents β Generated in-page from
h2/h3 headings when 3 or more are present
Access Control
- Public β Visible to everyone
- Password protected β Visitors must enter a password; unlocked for the session
- Link only β Accessible only via a unique token URL; click-to-clipboard share button for editors
Users, Roles & Invites
| Role | Permissions |
|---|
| Contributor | Submit documents as drafts; can be restricted to specific topics |
| Editor | Manage all documents, publish contributor drafts, delete documents |
| Admin | Everything above plus users, invites, themes, settings, backup |
- Contributor workflow β Contributor submissions are saved as drafts automatically; editors and admins approve content by publishing
- Topic restrictions β Admins can restrict any user to specific topics; contributors see only their allowed topics in the editor; empty restriction = all topics allowed
- Topic change β Authors can move a document to a different topic (restricted contributors only see their allowed topics)
- Invite links β Role-scoped, optional email restriction, expiry date, max-use count
Subscribers & Email Notifications
- Subscribe widget β Public subscription form at
/subscribe/; optional fields (name, phone, zip, custom); math captcha option
- SMTP email β Configurable SMTP transport (STARTTLS port 587, SSL/TLS port 465, or plain); PHP
mail() fallback; credentials stored in Settings
- Subscriber notifications β Global toggle to email opted-in admin/editor users when a new subscriber signs up; per-user opt-in toggle in Admin β Users
Analytics
- Human-only hit tracking β 30+ bot UA patterns filtered at record time; no raw IPs stored (SHA-256 hash of IP + date)
- Dashboard rankings β Total hits and unique daily hits per document, ranked on the admin dashboard
- Site-wide totals β Aggregate total and unique hit counts shown on the dashboard
- Hit ratio in document list β Admin β Documents table shows total / unique hits and the return-rate multiplier (e.g.
42 / 15 Β· 2.8Γ) per document; tooltip gives the full breakdown
- Public view stats β Document sidebar "Document Info" section shows total views, unique views, and return rate to all visitors
Markdown
- Single line breaks β A single newline within a paragraph renders as
<br> rather than being collapsed into a space; a blank line still opens a new <p> paragraph
- Fenced code blocks β Triple-backtick blocks with optional language tag; content HTML-escaped and protected from inline processing
- Tables β GitHub-style pipe tables with header / separator / body rows
- Shortcodes β
contact-form], [audio, pdf, video, [cal='slug'] β all block-level, one per line
Design & Theming
- OS/2 Warp 3.0 aesthetic β Deep indigo desktop, rose-purple-to-indigo gradient titlebars, bevelled 3D borders, OS/2-style scrollbars; topic window headings enlarged and centred
- Modern Sleek theme β Clean, flat, gradient-free; topic headings enlarged and centred
- The Matrix theme β Phosphor-green-on-black terminal aesthetic;
Courier New monospace font; green glow effects; image tinting; fingerprint: "There is no spoon"
- Terminator theme β Crimson gradient titlebars on near-black desktop; blood-red accent colour; uppercase nav and section headers; fingerprint: "I'll be back"
- Mr. Robot theme β Cold slate/charcoal desktop with
#00BCD4 cyan edge; JetBrains Mono / Fira Code monospace stack; GitHub-dark-inspired palette; fingerprint: "Hello, friend"
- Theme editor β Full CSS editor with live preview iframe, colour variable injector, save/activate/duplicate/delete themes
- Quick colour palette β 10 CSS variable pickers in Settings; overrides apply on top of the active theme without editing CSS
- Sync from file β All five built-in themes auto-resync from their source CSS files when the DB copy is stale; new themes seeded via a reusable
$seedTheme closure with a comment-header fingerprint string
- All links as buttons β Global bevelled/themed button style for all
<a> elements; Markdown body links remain as underlined text
- Fully responsive β CSS grid cards, hamburger nav, collapsible admin sidebar; tested at 900 / 700 / 400 px breakpoints
Data & Backup
- Site backup β Download the entire site as a ZIP archive (SQLite database + all uploaded files); one click from Admin β Backup
- SQL export β Stream all table data as
INSERT statements for external import or inspection
- File size summary β Backup page shows current database size, uploads size, and total before download
---
Requirements
- PHP 8.0 or higher (the code uses
match expressions and str_contains)
- PHP extensions:
pdo_sqlite (database), curl (Stripe checkout, calendar/RSS feed fetching), mbstring (importers, text excerpts), gd (image optimisation)
- SQLite 3 (bundled with PHP via
pdo_sqlite)
- Apache with
mod_rewrite enabled and AllowOverride All
No Composer. No npm. No build step.
---
Installation
- Upload all files to your web root or a subdirectory.
- Set permissions so PHP can write to the
data/ and uploads/ directories:
bash
chmod 750 data/
chmod 750 uploads/
Visit https://yoursite.com/setup.php in a browser.
Complete the two-step wizard:
-
Step 1 β Site title, description, base URL, footer text
-
Step 2 β Admin username, email, and password
The data/installed flag file is created on completion. The setup page becomes inaccessible.
> If you move the site to a different URL after setup, update
Admin β Settings β Base URL.
---
Directory Structure
indexgram/
βββ admin/ Admin panel pages
β βββ backup.php Site backup β ZIP download and SQL export
β βββ calendars.php Calendar plugin β CRUD, test feed, clear cache
β βββ document-edit.php Markdown editor with media uploads
β βββ documents.php Document list with filters
β βββ generic-tags.php Generic tag management
β βββ index.php Dashboard with hit rankings
β βββ invites.php Invite link management
β βββ nav_links.php External nav link management
β βββ nav_order.php Drag-and-drop unified nav ordering (topics + pages)
β βββ pages.php Custom page and sub-page management
β βββ rss-import.php RSS/Atom feed importer with media localization
β βββ settings.php Site settings, news/marquee, colour palette, email
β βββ store.php Store settings, VistaPrint account, payment processors
β βββ store-categories.php Store categories & sub-categories
β βββ store-orders.php Order processing (payment, VistaPrint ref, profit)
β βββ store-products.php Product/inventory editor with margin calculator
β βββ substack-import.php Substack-specific import helper
β βββ subscribers.php Subscriber list, CSV export, delete
β βββ tags.php Audience tag management
β βββ themes.php Theme editor and manager
β βββ topics.php Topic/sub-topic management with landing pages
β βββ users.php User management with topic restrictions
βββ assets/
β βββ css/
β β βββ calendar.css Calendar plugin styles (theme-variable-driven)
β β βββ matrix.css Source The Matrix theme
β β βββ modern-sleek.css Source Modern Sleek theme
β β βββ mrrobot.css Source Mr. Robot theme
β β βββ os2.css Source OS/2 Warp 3.0 theme
β β βββ print.css Print stylesheet (8.5 Γ 11)
β β βββ terminator.css Source Terminator theme
β βββ js/
β βββ app.js Front-end JS (nav, TOC, lightbox, PDF controls)
β βββ calendar.js Calendar plugin β all five view renderers + event popup
βββ data/ SQLite database, installed flag, and plugin caches (writable)
β βββ cal_cache/ Cached iCal feed JSON (auto-created; protected by .htaccess)
βββ includes/
β βββ auth.php Session auth, roles, CSRF, flash messages
β βββ calendar.php Calendar plugin β CalendarPlugin + ICalParser classes
β βββ db.php Schema, migrations, seeding
β βββ footer.php Public footer template
β βββ functions.php All helper functions
β βββ header.php Public head + OG meta + nav template (with dropdowns)
β βββ mail.php SMTP mailer and subscriber notification helper
β βββ markdown.php Custom Markdown parser (shortcode host)
β βββ pdf.php PDF embed renderer
β βββ store.php Store library β catalog, cart, orders, payments + page embeds
β βββ store_card.php Product card partial for the storefront grids
β βββ video.php Video URL β embed converter
βββ uploads/ User-uploaded files (writable)
β βββ images/ Logos, favicons, general images
β βββ audio/ Audio files
β βββ og/ OG and topic images
β βββ pdf/ Uploaded PDFs
β βββ store/ Product and category images (auto-created)
βββ .htaccess Clean URL rewrites, data directory protection
βββ config.php Constants and IS_INSTALLED flag
βββ document.php Document view (access control, hit tracking)
βββ index.php Homepage (collapsible topic grid + document card index)
βββ login.php Login form
βββ logout.php Session destroy
βββ page.php Custom static page renderer
βββ print.php Print-friendly document view
βββ register.php Invite registration
βββ rss.php RSS 2.0 feed (master + per-topic)
βββ setup.php First-run installation wizard
βββ shop.php Public storefront β grid, cart, checkout, order status
βββ subscribe.php Public subscriber sign-up form
βββ theme.css.php Dynamic CSS: active theme + palette overrides
βββ topic.php Topic view (search first, then sub-topics + document cards)
---
Configuration
Most configuration lives in the admin panel under
Settings. The only file-level constant of note is in
config.php:
| Constant | Default | Description |
|---|
MAXIMAGESIZE | 10 MB | Maximum image upload size |
MAXAUDIOSIZE | 50 MB | Maximum audio upload size |
MAXPDFSIZE | 50 MB | Maximum PDF upload size |
---
Theme Customisation
Quick palette (no CSS editing)
Admin β Settings β Colour Palette β 10 colour pickers update CSS variable overrides that are appended after the active theme CSS on every page request. Changes are immediate on next page load.
Full CSS editing
Admin β Themes β Edit CSS β Edit the full CSS source directly. The colour injector toolbar lets you find-and-replace variable values without manual searching. Save to apply.
Syncing the built-in themes
Built-in themes auto-resync from their source files (
assets/css/os2.css,
assets/css/modern-sleek.css) on boot when the database copy is detected as stale. Use the
Sync File button on the Themes list page to force a reload at any time.
---
Email Setup
Admin β Settings β Email & Notifications
Set From Name and From Email Address.
Select SMTP transport and fill in host, port, encryption, username, and password.
Check Enable email sending.
Use Send Test Email to verify delivery before enabling notifications.
SMTP quick reference
| Provider | Host | Port | Encryption |
|---|
| Gmail / Google Workspace | smtp.gmail.com | 587 | STARTTLS |
| Outlook / Office 365 | smtp.office365.com | 587 | STARTTLS |
| Brevo (Sendinblue) | smtp-relay.brevo.com | 587 | STARTTLS |
| Mailgun | smtp.mailgun.org | 587 | STARTTLS |
> Gmail requires an
App Password (not your account password). Generate one at Google Account β Security β 2-Step Verification β App Passwords.
Subscriber notifications
Enable the
"Send notification email when a new subscriber signs up" global toggle in Settings, then go to
Admin β Users and click
Notify ON/OFF for each admin or editor who wants to receive alerts.
---
Store Setup
Admin β Store Settings β tick Enable the store, choose a store mode:
-
Independent β your own grid catalog with cart and checkout
-
VistaPrint Pro Store β embeds your VistaPrint storefront (paste your storefront URL and optional partner/tracking ID from your VistaPrint account)
-
Both β grid catalog with the VistaPrint embed below it
Add payment processors (same page) β any number, in three flavours:
| Type | Needs | Behaviour |
|---|
| PayPal | Your PayPal business email | Customer is redirected to PayPal with the cart pre-filled |
| Stripe | Secret key (skβ¦) | Hosted Stripe Checkout; payment verified automatically on return |
| Manual | Instruction text | For Zelle, Venmo, CashApp, cheque, cash, bank transfer β your instructions (with {orderno} and {total} placeholders) are shown on the order page; mark Paid in Admin β Store β Orders once received |
Admin β Store β Categories β create categories and sub-categories.
Admin β Store β Products β add products: set Your Cost (what you pay VistaPrint) and Selling Price β the editor shows the live margin, and one click applies your default margin %. Save each product's VistaPrint product URL so staff can re-order it in one click.
Process orders at Admin β Store β Orders (editors and admins): confirm payment, click the per-item Order at VistaPrint links to place the fulfilment order from your VistaPrint account, record the VistaPrint order #, update the status (optionally emailing the customer), and watch the profit column.
---
URL Structure
| URL | Page |
|---|
/ | Homepage β topic grid + document index |
/topic/{slug}/ | Topic page β search, sub-topics, document cards |
/topic/{slug}/{doc-slug}/ | Document view |
/print/{slug}/{doc-slug}/ | Print-friendly document |
/page/{slug}/ | Custom static page (sub-pages also at /page/{child-slug}/) |
/rss/ | Master RSS feed |
/rss/{topic-slug}/ | Per-topic RSS feed |
/shop/ | Storefront β categories + product grid (or VistaPrint embed) |
/shop/cat/{slug}/ | Store category / sub-category |
/shop/product/{slug}/ | Product page |
/shop/cart | Cart |
/shop/checkout | Checkout with payment method selection |
/shop/order/{order-no}/{token} | Customer order-status page |
/subscribe/ | Subscriber sign-up form |
/login/ | Login |
/register/{token}/ | Invite registration |
---
Security Notes
All user input is HTML-escaped with htmlspecialchars() before output
Passwords hashed with passwordhash() / passwordverify()
CSRF tokens on every state-changing form
The data/ directory is blocked by .htaccess (RewriteRule ^data/ - [F,L])
Access tokens for link-only documents use bin2hex(random_bytes(16))
Hit tracking stores only a SHA-256 hash of IP + date; no raw IPs are recorded
SMTP password is stored in the settings table; the data/ directory is not web-accessible
Store: customer order pages are gated by a per-order bin2hex(random_bytes(16)) view token; order lists are visible only to editors/admins
Store: no card data ever touches the server β PayPal and Stripe payments happen on their hosted pages; Stripe sessions are verified server-side with the secret key before an order is marked paid
Store: cart and checkout POSTs carry CSRF tokens like every other form; customer IPs are stored only as SHA-256 hashes
---
License
Copyright Β© 2026 Amfile.org / Page Telegram Volunteer Services. All rights reserved.