The base template for the Netsyms Business Apps.

Skylar Ittner ee0c0f65e3 Fix PHP variable warnings 16 hours ago
lang 66fa86e04e Change string 2 days ago
lib be34857d71 Change session ID on successful login, make sessions last at least 2 hours 1 week ago
mobile d10c6214a6 Switch to Mozilla Public License 2.0 for code consistency 1 month ago
nbproject 64add57446 Add MPL header 1 month ago
pages d10c6214a6 Switch to Mozilla Public License 2.0 for code consistency 1 month ago
static 8e65d4c98d Use bundled Roboto font 5 days ago
.gitignore d6df9d582c User name in navbar now links to Portal home 1 year ago
.gitmodules c0a93fb666 Convert material-color CSS to submodule 6 months ago
LICENSE.md d10c6214a6 Switch to Mozilla Public License 2.0 for code consistency 1 month ago
README.md ca6e1f2c5a Update README 1 month ago
action.php d10c6214a6 Switch to Mozilla Public License 2.0 for code consistency 1 month ago
api.php d10c6214a6 Switch to Mozilla Public License 2.0 for code consistency 1 month ago
app.php 8e65d4c98d Use bundled Roboto font 5 days ago
composer.json d10c6214a6 Switch to Mozilla Public License 2.0 for code consistency 1 month ago
composer.lock d54ebed189 Update dependencies 4 months ago
index.php ee0c0f65e3 Fix PHP variable warnings 16 hours ago
pages.php d10c6214a6 Switch to Mozilla Public License 2.0 for code consistency 1 month ago
required.php 41c8b6c16b Fix #2 1 week ago
settings.template.php a9eb59c936 Replace reCAPTCHA with Captcheck 1 month ago

README.md

Business App Template

This is an empty (but fully functional) PHP application. It is designed to integrate with AccountHub, an account management web interface. AccountHub manages user credentials and account data, and is accessed by this app via a simple API.

Codacy Badge

Program Structure

Folders

  • lang Translations and alert messages. 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.
  • lib A good place to put helper functions that you don't want "in the way".
  • 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. 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.
  • static CSS, JS, fonts, images...
  • 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.

Files

  • settings.template.php App configuration. Copy to settings.php and customize. Documented with inline comments.
  • required.php 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 also has some utility functions, including dieifnotloggedin(), is_empty($var), and lang('key'). Read through it to see what those functions do.
  • action.php A good place to post forms to. By default it only handles logging out, but is easily expanded.
  • api.php Similar to action.php, but designed for user/pass authenticated JSON responses.
  • index.php Login page and handler. Hands off to app.php after authenticating user. It includes 2fa support, by the way.
  • app.php Main app page after login. Handles loading app pages and 404 errors. 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.
  • 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. Optional parameters: '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. 'styles' => ["file.css"] will inject the listed CSS files into the page header (after all other CSS, like Bootstrap). 'scripts' => ["file.js"] will inject the listed JavaScript files into the page footer (after jQuery and other builtin scripts).
  • lang/messages.php Array of alert messages. "string" is the language string for the message, "type" is one of success, info, warning, or danger (i.e. Bootstrap alert classes). Changing the type changes the icon and color of the alert box. *lang/en_us.php Language data for US English. *lib/login.php Functions for logging in users and stuff like that. Most functions transparently makes requests to the AccountHub API and return the results. *lib/userinfo.php Functions for getting user data, like real names and managed employees. *static/css/app.css Custom styles for the app. See the comments inside for instructions on theming the app.