# Software architecture ## Program flow `init.php` : Initializes common values `router.php` : Receives every external HTTP request from the web server, executes actions required in any case, executes matching code in `pg-act` if appropriate, and calls `view.php` either way. `pg-act/` : Executed when a form is submitted: checks that every parameter is valid and secure, then executes the feature of the page according to the parameters. `view.php` : Displays global HTML and includes matching file from `pg-view`. `pg-view/` : Displays the main page content (notably HTML forms), may sometimes display form output passed through the `$data` array. The `output` function is used to return success or error messages and stop processing of the request. ## Other components `fn/` : Functions, grouped by concerned service `jobs/` : CLI scripts ; should be run as the same user as the rest of the program (e.g. `sudo -u servnest php /srv/servnest/core/jobs/something.php`) `sftpgo-auth.php` : When someone tries to log in over SFTP, SFTPGo sends username and password to this script, which queries the database and replies whether authentication succeeded or not. `css/` : Each `.css` file in this directory is declared in every page. `db/` : SQlite database, the only directory writable by the program `locales/` : Gettext translations, see [translation.md](translation.md)