2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2010 */
6 /* Inclusive Design Institute */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
13 if (!defined('TR_INCLUDE_PATH')) { exit; }
15 function write_config_file($filename, $comments) {
16 global $config_template;
18 $tokens = array('{USER}',
25 '{GENERATED_COMMENTS}',
29 $values = array(urldecode($_POST['step2']['db_login']),
30 addslashes(urldecode($_POST['step2']['db_password'])),
31 $_POST['step2']['db_host'],
32 $_POST['step2']['db_port'],
33 $_POST['step2']['db_name'],
34 $_POST['step2']['tb_prefix'],
35 addslashes(urldecode($_POST['step4']['content_dir'])),
37 $_POST['step4']['get_file']
40 $config_template = str_replace($tokens, $values, $config_template);
42 if (!$handle = @fopen($filename, 'wb')) {
45 @ftruncate($handle,0);
46 if (!@fwrite($handle, $config_template, strlen($config_template))) {
54 $config_template = "<"."?php
55 /************************************************************************/
57 /************************************************************************/
58 /* Copyright (c) 2009 */
59 /* Adaptive Technology Resource Centre / University of Toronto */
61 /* This program is free software. You can redistribute it and/or */
62 /* modify it under the terms of the GNU General Public License */
63 /* as published by the Free Software Foundation. */
64 /************************************************************************/
66 /************************************************************************/
67 /************************************************************************/
68 /* the database user name */
69 define('DB_USER', '{USER}');
71 /* the database password */
72 define('DB_PASSWORD', '{PASSWORD}');
74 /* the database host */
75 define('DB_HOST', '{HOST}');
77 /* the database tcp/ip port */
78 define('DB_PORT', '{PORT}');
80 /* the database name */
81 define('DB_NAME', '{DBNAME}');
83 /* The prefix to add to table names to avoid conflicts with existing */
84 /* tables. Default: TR_ */
85 define('TABLE_PREFIX', '{TABLE_PREFIX}');
87 /* Where the content files are located. This includes all file */
88 /* manager and imported files. If security is a concern, it is */
89 /* recommended that the content directory be moved outside of the web */
90 /* accessible area. */
91 define('TR_CONTENT_DIR', '{CONTENT_DIR}');
93 /* Whether or not to use the TR_CONTENT_DIR as a protected directory. */
94 /* The if set to FALSE then the content directory will be hard coded */
95 /* to Transformable_install_dir/content/ and TR_CONTENT_DIR will be ignored. */
96 /* This option is used for compatability with IIS and Apache 2. */
97 define('TR_FORCE_GET_FILE', {GET_FILE});
99 /* DO NOT ALTER THIS LAST LINE */
100 define('TR_INSTALL', TRUE);