The $db variable needs to be assigned with the correct engine to open the database. Currently only the MysqlEngine exists. This is an example configuration:
// create engine: server, user, password $db = new MysqlEngine("localhost","smokeuser",""); // set database name $db->setDbName("smokedb"); // set table-prefix (optional) $db->setPrefix("smoke_"); //set this to one of the supported MySQL storage engines for DB creation $db->setStorageEngine("InnoDB");The three parameters to the MysqlEngine constructor are: first the host the database server runs on. Use "hostname:port" if it runs on a non-standard port or ":/path/to/socket" if you want to use the local socket on a Unix system. The second parameter is the username for the database server and the third one the password (empty if no password is necessary).
The setDbName call is used to set the database that is used by Magic Smoke. The setPrefix call can optionally be used to set a prefix for all table names -- this way a single database can be used for multiple installations of Magic Smoke or even different applications (if the other applications are guaranteed to not touch Magic Smokes tables).
The setStorageEngine call can be used to set the table storage engine used by MySQL. Magic Smoke relies on MySQL using a transactional table type. The default is "InnoDB". It is not recommended that you change the default unless you know exactly what you are doing.
$db->setAdminPassCode("Admin","SmokeInMyEye");This call sets the web-user and web-passcode for the admin.php script. After installing the system this line should be commented to prevent anyone from destroying the database or installing more admin users.
//Authentication algorithm // possible: md5, sha1, sha256, hmac-md5, hmac-sha1, hmac-sha256 $ClientAuthAlgo="hmac-sha1"; //hash algorithm library -- the PHP extension/module used for calculation // possible: string (md5, sha1 only), hash, mhash $HashLib="hash"; //Initial timeout from start of session request to session authentication // usually 300s (5min) is a good value $ClientAuthTimeout=300; //Authenticated session timeout - how long an authenticated session lasts // this should usually be a few hours (3600s per hour) $ClientSessionTimeout=2*3600;$ClientAuthAlgo contains the algorithm that is used to authenticate the client. You have to make sure that the algorithm selected is a) available in PHP, b) secure enough for your application, and c) available in all clients that are supposed to connect. The algorithms are:
md5 | Uses the MD5 hash algorith described in RFC1321. Please note that this algorithm is regarded as broken and should not be used. |
sha1 | Uses the SHA-1 hash algorithm described eg. in RFC3174. Please note that this algorithm is theoretically broken, although the use of this algorithm in Magic Smoke should still be secure for a few years. |
sha256 | Uses the SHA-256 hash algorithm of the SHA-2 hash family. This algorithm is currently recommended as replacement for SHA-1. However, it is currently not supported by any client. |
hmac-md5, hmac-sha1, hmac-sha256 | Uses the same hash algorithms in HMAC mode (see RFC2104). This use is more secure than the plain use of the algorithms. It is recommended to use HMAC. |
$HashLib defines what PHP extension is used for calculation of hash values:
string | Doesn't use any extension and instead uses the string functions md5 and sha1. This mode does not support sha256 or any of the hmac-modes. |
hash | Uses the "hash" extension. This extension supports all modes listed above. |
mhash | Uses the "mhash" extension. This extension supports all modes listed above. |
The $ClientAuthTimeout and $ClientSessionTimeout set the two session timeouts. The first timeout defines how long the authentication handshake of the client may last before the handshake is terminated. The second value defines how long a session may be active before it is automatically closed.
Please read the chapter about Template Design and create your own set of templates (or customize an existing one).
Then modify the template line in your config file, eg.:
$template="./template/mytemplate/";