FortNotes is a web application for secure storage of encrypted notes (such as passwords). The presentation layer consists of two HTML pages:
- A welcome page allowing users to register and log in.
- A main page that performs the remainder of the functionality: client-side decryption and encryption, creating, editing, deleting, and navigating notes, backup, etc. The main editing functions are done through a two-pane view with the list of notes on the left and the currently selected note on the right. Other functions are performed using pop-up dialog boxes.
The source code repository of FortNotes contains the following directory structure:
- controllers/ - contains a PHP class for each of the three main resource types (front page, note, and user)
- templates/ - contains PHP templates for the two HTML pages as well as the "dialog boxes" used by the main page
- lang/ - a placeholder to support a future multilingual version of the application (currently empty)
- library/ - contains PHP classes used by the index page and by the controllers
- public/ - the root of the website
- captcha/ - a library for generating CAPTCHA images, called simple-php-captcha
- css/ - contains several Cascading Style Sheets for different parts of the application
- img/ - contains static PNG image files referenced by the HTML
- lang/ - these PNG images are used to visually represent different language codes
- tests/ - contains unit test code based on the PHPUnit framework
PHP Code Structure
The only URI visible to the user is the root of the website, which is handled by public/index.php. This source file simply includes some of the library/*.php modules and then invokes app::run().
app:run() (in library/app.core.php) dispatches requests based on the following URL pattern:
scheme://host:port/ <controller_name>/<method_name> [/<first_arg> [/<second_arg> ...] ]
- <controller_name> is the name of a PHP class, and must match the name of a source code file at application/controllers/<controller_name>.php
- <method_name> is the name of a method in the controller class
- <first_arg> is an optional string that will be passed as the first argument to the method.
- Additional arguments may also be specified
The defaults are <controller_name> = 'front' and <method_name> = 'index', therefore the website root is handled by front::index() in application/controllers/front.php
front::index() simply displays one of two possible HTML pages:
- If no valid login session exists, application/templates/front.init.php is rendered
- If the user is already logged in, application/templates/front.main.php is rendered
The following libraries are used by FortNotes and are included in the source:
- jQuery UI Autocomplete
- SimpleModal jQuery Plugin
The following library is used during development but is not included:
PHP Extensions Required
The following PHP extensions are required: