ForgeCMS
en

CMS

CMS settings, posts, files, visitors and where everything is stored

CMS · cms@8071e48 cmssettingspostsfilesvisitorsstorage

Settings

The plugin Settings (settings_read, settings_save; permission settings) edits the configuration that the CMS keeps inside the metadata of the site and loads into CONF at every start:

KeyMeaning
namethe name of the site, used in the <title> of every page except / and in the file name of the backup
urlthe public address of the site; the CMS also updates it from the host of the admin requests
smtpthe SMTP settings as a JSON text (server, from, user, password, port); settings_test tries them
iconan icon for the site
$tms, secret_tmspublish the events by TMS, and the secret of that connection
op_reqtoken, op_restokenthe tokens of an OpenPlatform; when both are set the admin sign-in is replaced by the one of OpenPlatform
totalapia key for the Total.js API services

Plugins can add more keys, which appear in the same form. Values that live in the file config ($api, cdn, salt and, if you add it, token) are not edited here.

Posts

The plugin Posts is a small manager of articles, kept in its own NoSQL file inside the storage. A post has a name, category, picture, summary, body, reference, icon, color, hidden and date; the admin lists them newest first (100 per page) and posts_categories returns the categories in use. The posts are data for your own code: the public renderer of the CMS (controllers/default.js) does not print them, so a widget or a route of yours has to read them and draw them.

Files

The plugin Files stores uploads in the file storage and marks them as public. GET /download/<id>.<ext> serves a public file (only the public ones; the rest answer 404). For images, ?s=<percent> returns a smaller JPEG (the value must be between 10 and 80, with quality 80), and ?download=1 forces a download. The upload routes and their limits are in the admin API.

Visitors and the dashboard

The module modules/visitors.js counts the visits of the public pages through the script /visitors.js that every page includes: unique visitors, hits, browsers, referrers, search, social and direct traffic, mobile and desktop, hours of the day, and the people online (a visitor is online for 20 minutes without activity). The Dashboard plugin draws those numbers from dashboard_stats, dashboard_online, dashboard_browsers, dashboard_referers and dashboard_pages.

OpenPlatform

When op_reqtoken and op_restoken are set, the CMS signs people in through OpenPlatform (module modules/openplatform.js) and each plugin contributes its permission to the list that OpenPlatform shows when you assign groups: pages, layouts, widgets, navigation, posts, files, redirects, variables, settings and admin. Remember the rule of OpenPlatform: an application is visible only to the groups that you assign to it.

The data model

MAIN.db holds the metadata of the site (pages, layouts, widgets, redirects, vars, nav, config and storage) and it is saved as one JSON document called meta in the file storage. The HTML of every page and layout is a file of that storage whose name is the id of the page or layout. FUNC.load() reads the metadata at start, compiles the widgets (running their install function) and rebuilds the caches; FUNC.save() writes it back. That is why a backup of the storage is a backup of the site.