Update readme

master
Skylar Ittner 7 years ago
parent 292ce29b31
commit 8afe41070b

@ -9,50 +9,50 @@ Program Structure
----------------- -----------------
### Folders ### Folders
*lang *lang
Translations and alert messages. Translations and alert messages.
The language file that is loaded depends on the value of `LANGUAGE` in `settings.php`. The language file that is loaded depends on the value of `LANGUAGE` in `settings.php`.
Translate the values (but not the keys) in `en_us.php` into other languages and save in appropriately named files to add languages. Translate the values (but not the keys) in `en_us.php` into other languages and save in appropriately named files to add languages.
*lib *lib
A good place to put helper functions that you don't want "in the way". A good place to put helper functions that you don't want "in the way".
*pages *pages
What it looks like. If you go into `pages.php` and define a page with the name `foo`, there should be a `foo.php` in here. What it looks like. If you go into `pages.php` and define a page with the name `foo`, there should be a `foo.php` in here.
The app checks before loading, so it will give a friendly 404 error if it doesn't find your page. The app checks before loading, so it will give a friendly 404 error if it doesn't find your page.
Woe to you if you delete `home.php` or `404.php`, as those are assumed to exist for fallback behavior. Woe to you if you delete `home.php` or `404.php`, as those are assumed to exist for fallback behavior.
*static *static
CSS, JS, fonts, images... CSS, JS, fonts, images...
*vendor *vendor
If you don't know what this is about, or you don't have it, you need to read up on Composer. Right now. If you don't know what this is about, or you don't have it, you need to read up on Composer. Right now.
### Files ### Files
* settings.template.php * settings.template.php
App configuration. Copy to `settings.php` and customize. Documented with inline comments. App configuration. Copy to `settings.php` and customize. Documented with inline comments.
* required.php * required.php
The "duct tape" that holds the app together. Use `require_once __DIR__."/required.php"` at the top of every file. The "duct tape" that holds the app together. Use `require_once __DIR__."/required.php"` at the top of every file.
It loads Composer dependencies, app settings, language data, and creates `$database` for accessing the database. It loads Composer dependencies, app settings, language data, and creates `$database` for accessing the database.
It also has some utility functions, including `dieifnotloggedin()`, `is_empty($var)`, and `lang('key')`. It also has some utility functions, including `dieifnotloggedin()`, `is_empty($var)`, and `lang('key')`.
Read through it to see what those functions do. Read through it to see what those functions do.
* action.php * action.php
A good place to post forms to. By default it only handles logging out, but is easily expanded. A good place to post forms to. By default it only handles logging out, but is easily expanded.
* index.php * index.php
Login page and handler. Hands off to `app.php` after authenticating user. Login page and handler. Hands off to `app.php` after authenticating user.
It includes 2fa support, by the way. It includes 2fa support, by the way.
* app.php * app.php
Main app page after login. Handles loading app pages and 404 errors. Main app page after login. Handles loading app pages and 404 errors.
Redirects to `index.php` if the user is not logged in. Redirects to `index.php` if the user is not logged in.
Note: to show an alert message (success, error, whatever), set the GET argument `msg` to a message ID from `lang/messages.php`. Note: to show an alert message (success, error, whatever), set the GET argument `msg` to a message ID from `lang/messages.php`.
* pages.php * pages.php
Define app pages/screens in an array. The page ID/array key is assumed to exist as a file `pages/{key}.php`, or it will 404. Define app pages/screens in an array. The page ID/array key is assumed to exist as a file `pages/{key}.php`, or it will 404.
__Optional parameters:__ __Optional parameters:__
`'navbar' => true` will show the page as a button in the app menu bar `'navbar' => true` will show the page as a button in the app menu bar
`'icon' => '...'` will show an icon from FontAwesome in the menu bar. Setting this to `home` will show the icon `fa-home`. `'icon' => '...'` will show an icon from FontAwesome in the menu bar. Setting this to `home` will show the icon `fa-home`.
* lang/messages.php * lang/messages.php
Array of alert messages. Array of alert messages.
`"string"` is the language string for the message, `"type"` is one of `success`, `info`, `warning`, or `danger`. `"string"` is the language string for the message, `"type"` is one of `success`, `info`, `warning`, or `danger`.
Changing the type changes the icon and color of the alert box. Changing the type changes the icon and color of the alert box.
*lang/en_us.php *lang/en_us.php
Language data for US English. Language data for US English.
*lib/login.php *lib/login.php
Functions for logging in users and stuff like that. Mostly makes requests to the Portal API, which calls the real functions "over there". Functions for logging in users and stuff like that. Mostly makes requests to the Portal API, which calls the real functions "over there".
License License

Loading…
Cancel
Save