/program/init.php - setup database connection, sessions, configuration, etc.
This file is included from one of the main entry points. The following subsystems and global variables are initialised:
Calculate the difference between two microtimes
emergency exit of program in case there is something really, really wrong
This routine outputs a short message and a 'cryptic' condition code and exits the program. It is called when something goes horribly wrong during the early stages of running the program, e.g. the database cannot be opened or there is a version mismatch between the program code (the .php-files) and the database. The complete condition code is the WAS release number followed by a slash followed by the WAS version number followed by a slash and the bare condition code. The message ends with a link to about.html with 'Powered by' or 'Based on', depending on the WAS original flag. Note that we try to show graphics (including logo) but that we switch back to text-only if it is too early, ie. before waslib.php is included.
Here is an overview of meaning of the condition codes used.
initialise the program, setup database, read configuration, etc.
check version of PHP-files against version stored in database
this checks the main WAS_VERSION (of files) against $CFG->version (database). if all is well, we return TRUE indicating both version numbers match. If there is a discrepancy it is logged and depending on parameter $exit_on_error we either exit alltogether OR we return FALSE to indicate the version mismatch.
Typical use is to call this routine near the start as follows (e.g. in main_index.php or main_file.php):
This forces an exit for the interfaces at the 'visitor' side. For the webmaster it is different: even if the versions do not match, we want to be able to login and do something about it via some sort of upgrade routine, e.g:
Documentation generated on Wed, 11 May 2011 23:45:16 +0200 by phpDocumentor 1.4.0