remove old readme
[atutor.git] / docs / install / include / config_template.php
1 <?php
2 /****************************************************************/
3 /* ATutor                                                                                                               */
4 /****************************************************************/
5 /* Copyright (c) 2002-2010                                      */
6 /* Inclusive Design Institute                                   */
7 /* http://atutor.ca                                                                                             */
8 /*                                                              */
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 /****************************************************************/
13 // $Id$
14
15 if (!defined('AT_INCLUDE_PATH')) { exit; }
16
17 function write_config_file($filename, $comments) {
18         global $config_template;
19
20         $tokens = array('{USER}',
21                                         '{PASSWORD}',
22                                         '{HOST}',
23                                         '{PORT}',
24                                         '{DBNAME}',
25                                         '{TABLE_PREFIX}',
26                                         '{HEADER_IMG}',
27                                         '{HEADER_LOGO}',
28                                         '{GENERATED_COMMENTS}',
29                                         '{CONTENT_DIR}',
30                                         '{MAIL_USE_SMTP}',
31                                         '{GET_FILE}'
32                                 );
33
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'])),
43                                         $comments,
44                                         addslashes(urldecode($_POST['step5']['content_dir'])),
45                                         $_POST['step1']['smtp'],
46                                         $_POST['step1']['get_file']
47                                 );
48         } else {
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'],
55                                         '', //header image
56                                         '', //header logo
57                                         $comments,
58                                         addslashes(urldecode($_POST['step4']['content_dir'])),
59                                         $_POST['step3']['smtp'],
60                                         $_POST['step4']['get_file']
61                                 );
62         }
63
64         $config_template = str_replace($tokens, $values, $config_template);
65
66         if (!$handle = @fopen($filename, 'wb')) {
67          return false;
68     }
69         @ftruncate($handle,0);
70     if (!@fwrite($handle, $config_template, strlen($config_template))) {
71                 return false;
72     }
73         
74     @fclose($handle);
75         return true;
76 }
77
78 $config_template = "<"."?php 
79 /************************************************************************/
80 /* ATutor                                                               */
81 /************************************************************************/
82 /* Copyright (c) 2002-2010                                              */
83 /* http://atutor.ca                                                     */
84 /*                                                                      */
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 /************************************************************************/
89 {GENERATED_COMMENTS}
90 /************************************************************************/
91 /************************************************************************/
92 /* the database user name                                               */
93 define('DB_USER',                      '{USER}');
94
95 /* the database password                                                */
96 define('DB_PASSWORD',                  '{PASSWORD}');
97
98 /* the database host                                                    */
99 define('DB_HOST',                      '{HOST}');
100
101 /* the database tcp/ip port                                             */
102 define('DB_PORT',                      '{PORT}');
103
104 /* the database name                                                    */
105 define('DB_NAME',                      '{DBNAME}');
106
107 /* The prefix to add to table names to avoid conflicts with existing    */
108 /* tables. Default: AT_                                                 */
109 define('TABLE_PREFIX',                 '{TABLE_PREFIX}');
110
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}');
116
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});
120
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});
126
127 /* DO NOT ALTER THIS LAST LINE                                          */
128 define('AT_INSTALL', TRUE);
129
130 ?".">";
131
132 ?>