2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /****************************************************************/
15 if (!defined('AT_INCLUDE_PATH')) { exit; }
17 function write_config_file($filename, $comments) {
18 global $config_template;
20 $tokens = array('{USER}',
28 '{GENERATED_COMMENTS}',
34 if ($_POST['step1']['old_path'] != '') {
35 $values = array(urldecode($_POST['step1']['db_login']),
36 addslashes(urldecode($_POST['step1']['db_password'])),
37 $_POST['step1']['db_host'],
38 $_POST['step1']['db_port'],
39 $_POST['step1']['db_name'],
40 $_POST['step1']['tb_prefix'],
41 addslashes(urldecode($_POST['step1']['header_img'])),
42 addslashes(urldecode($_POST['step1']['header_logo'])),
44 addslashes(urldecode($_POST['step5']['content_dir'])),
45 $_POST['step1']['smtp'],
46 $_POST['step1']['get_file']
49 $values = array(urldecode($_POST['step2']['db_login']),
50 addslashes(urldecode($_POST['step2']['db_password'])),
51 $_POST['step2']['db_host'],
52 $_POST['step2']['db_port'],
53 $_POST['step2']['db_name'],
54 $_POST['step2']['tb_prefix'],
58 addslashes(urldecode($_POST['step4']['content_dir'])),
59 $_POST['step3']['smtp'],
60 $_POST['step4']['get_file']
64 $config_template = str_replace($tokens, $values, $config_template);
66 if (!$handle = @fopen($filename, 'wb')) {
69 @ftruncate($handle,0);
70 if (!@fwrite($handle, $config_template, strlen($config_template))) {
78 $config_template = "<"."?php
79 /************************************************************************/
81 /************************************************************************/
82 /* Copyright (c) 2002-2010 */
83 /* http://atutor.ca */
85 /* This program is free software. You can redistribute it and/or */
86 /* modify it under the terms of the GNU General Public License */
87 /* as published by the Free Software Foundation. */
88 /************************************************************************/
90 /************************************************************************/
91 /************************************************************************/
92 /* the database user name */
93 define('DB_USER', '{USER}');
95 /* the database password */
96 define('DB_PASSWORD', '{PASSWORD}');
98 /* the database host */
99 define('DB_HOST', '{HOST}');
101 /* the database tcp/ip port */
102 define('DB_PORT', '{PORT}');
104 /* the database name */
105 define('DB_NAME', '{DBNAME}');
107 /* The prefix to add to table names to avoid conflicts with existing */
108 /* tables. Default: AT_ */
109 define('TABLE_PREFIX', '{TABLE_PREFIX}');
111 /* Where the course content files are located. This includes all file */
112 /* manager and imported files. If security is a concern, it is */
113 /* recommended that the content directory be moved outside of the web */
114 /* accessible area. */
115 define('AT_CONTENT_DIR', '{CONTENT_DIR}');
117 /* Whether or not to use the default php.ini SMTP settings. */
118 /* If false, then mail will try to be sent using sendmail. */
119 define('MAIL_USE_SMTP', {MAIL_USE_SMTP});
121 /* Whether or not to use the AT_CONTENT_DIR as a protected directory. */
122 /* If set to FALSE then the content directory will be hard coded */
123 /* to ATutor_install_dir/content/ and AT_CONTENT_DIR will be ignored. */
124 /* This option is used for compatability with IIS and Apache 2. */
125 define('AT_FORCE_GET_FILE', {GET_FILE});
127 /* DO NOT ALTER THIS LAST LINE */
128 define('AT_INSTALL', TRUE);