Documentation main page Features Installation Administration Usage Developers FibuSQL login


FibuSQL - Notes for developers

Architecture

All data is kept in a database, no external files are involved. The PHP scripts are a (mostly) stateless web interface to the database and contain the algorithms (stored procedures are not used). The only state of the PHP scripts is the $HTTP_SESSION_VARS array, which stores the login data (in PEAR::DB format) in the element dbspec and the current language setting in lang.

Algorithms which can be used outside of the web frontend are factored out to files in the directory backend/.

HTML generation

The HTML output consequently uses CSS (Cascading Style Sheets) to properly separate the formatting from the content. Therefore layout modifications are to be made solely in fibu.css.

Database scheme

The primary data (account list, journal and repeated bookings) are stored in the respective tables accounts, journal, and repeated. Their precise definition can be seen either directly in the database or in the source code where they are created (in backend/dbadmin.inc in the function init_db()).

The last table used is balances which caches the current account balances to speed up ledger generation. Its content can safely be deleted, if an entry is missing, it gets recalculated. Attention has to be payed when an booking of an account is added or modified: in this case the respective balance in the cache has to be invalidated by calling invalidate_balance($account) (in backend/invalbal.inc).

Translation

The file langinc.inc, which is included by all pages, looks at the browser supplied HTTP_ACCEPT_LANGUAGE string to determine which language to use. Since the decision algorithm is quite complex, the result is cached in the session variable lang, so changes in the browser's language setting get active not until the next login.

All translatable strings an user will see are stored separately in files in the lang/ directory. Their names always begin with the standard ISO language abbreviations (the same codes that the browser uses). Since not all pages use all strings, there are several files which are only included if necessary. The file without suffix contains common strings that are used very often and gets included by default.

To provide a new translation for language XX, just copy the files of an existing language (preferably the one you feel best at) and name them XX.php, XX-admin.php and so on, and translate the strings within. You do not need to register them, FibuSQL will automatically use the new language if requested by the browser.

Changes to the source

If you change anything in FibuSQL that could be of interest also to other users, it would be nice if you mailed them to me so that I can include them in the next release (of course, you get acknowledged).

If you do not want your changes be included in the official release, I would appreciate a link to your version; I can refer to it at the project page.

Please document all changes in the file ChangeLog.