Location: PHPKode > projects > ACollab > install/include/config_template.php
<?php
/****************************************************************************************/
/* ACollab                                                                              */
/****************************************************************************************/
/* Copyright (c) 2002-2005  Adaptive Technology Resource Centre / University of Toronto */
/*                                                                                      */
/* http://atutor.ca/acollab                                                             */
/*                                                                                      */
/* This program is free software. You may redistribute it and/or                        */
/* modify it under the terms of the GNU General Public License                          */
/* as published by the Free Software Foundation; either version 2 of the License,       */
/* or (at your option) any later version.                                               */
/*                                                                                      */
/* This program is distributed in the hope that it will be useful, but                  */
/* WITHOUT ANY WARRANTY; without even the implied warranty of                           */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                                 */
/* See the GNU General Public License for more details.                                 */
/*                                                                                      */
/* You may access the GNU General Public License at:                                    */
/* http://www.opensource.org/licenses/gpl-license.php                                   */
/*                                                                                      */
/* You may contact the Adaptive Technology Resource Centre at                           */
/* Robarts Library, University of Toronto                                               */
/* 130 St. George Street, Toronto, Ontario, Canada M5S 1A5                              */
/* Further contact information is available at http://www.utoronto.ca/atrc/             */
/****************************************************************************************/
/* Programmer:                                                                          */
/* Joel Kronenberg - ATRC                                                               */
/****************************************************************************************/
// $Id: config_template.php 318 2005-01-31 20:25:07Z shozubq $

if (!defined('AC_INCLUDE_PATH')) { exit; }


function write_config_file($filename, $comments) {

	global $config_template, $addslashes;

	$tokens = array('{USER}',
					'{PASSWORD}',
					'{HOST}',
					'{PORT}',
					'{DBNAME}',
					'{SITE_NAME}',
					'{TABLE_PREFIX}',
					'{ADMIN_USERNAME}',
					'{ADMIN_PASSWORD}',
					'{ADMIN_EMAIL}',
					'{GENERATED_COMMENTS}',
					'{UPLOAD_DIR}',
					'{NOTIFY_GROUP_ADMIN}',
					'{MAIL_USE_SMTP}');

	if ($_POST['step1']['old_path'] != '') {
		$values = array(urldecode($_POST['step1']['db_login']),
					addslashes(urldecode($_POST['step1']['db_password'])),
					$_POST['step1']['db_host'],
					$_POST['step1']['db_port'],
					$_POST['step1']['db_name'],
					addslashes(urldecode($_POST['step3']['site_name'])),
					$_POST['step1']['tb_prefix'],
					urldecode($_POST['step3']['admin_username']),
					addslashes(urldecode($_POST['step3']['admin_password'])),
					urldecode($_POST['step3']['admin_email']),
					$comments,
					addslashes(urldecode($_POST['step3']['upload_dir'])),
					addslashes($_POST['step3']['notify_group_admin']),
					$_POST['step3']['smtp'] 
				);
	} else {	
		$values = array(urldecode($_POST['step2']['db_login']),
					addslashes(urldecode($_POST['step2']['db_password'])),
					$_POST['step2']['db_host'],
					$_POST['step2']['db_port'],
					$_POST['step2']['db_name'],
					addslashes(urldecode($_POST['step3']['site_name'])),
					$_POST['step2']['tb_prefix'],
					urldecode($_POST['step3']['admin_username']),
					addslashes(urldecode($_POST['step3']['admin_password'])),
					urldecode($_POST['step3']['admin_email']),
					$comments,
					addslashes(urldecode($_POST['step3']['upload_dir'])),
					addslashes($_POST['step3']['notify_group_admin']),
					$_POST['step3']['smtp']
				);
	}

	$config_template = str_replace($tokens, $values, $config_template);

	if (!$handle = fopen($filename, 'wb')) {
         return 0;
    }
	ftruncate($handle,0);
    if (!fwrite($handle, $config_template, strlen($config_template))) {
		return 0;
    }
        
    fclose($handle);
	return 1;				
}

$config_template = "<"."?php 
/****************************************************************************************/
/* ACollab                                                                              */
/****************************************************************************************/
/* Copyright (c) 2002-2003  Adaptive Technology Resource Centre / University of Toronto */
/*                                                                                      */
/* http://atutor.ca/acollab                                                             */
/*                                                                                      */
/* This program is free software. You may redistribute it and/or                        */
/* modify it under the terms of the GNU General Public License                          */
/* as published by the Free Software Foundation; either version 2 of the License,       */
/* or (at your option) any later version.                                               */
/*                                                                                      */
/* This program is distributed in the hope that it will be useful, but                  */
/* WITHOUT ANY WARRANTY; without even the implied warranty of                           */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                                 */
/* See the GNU General Public License for more details.                                 */
/*                                                                                      */
/* You may access the GNU General Public License at:                                    */
/* http://www.opensource.org/licenses/gpl-license.php                                   */
/*                                                                                      */
/* You may contact the Adaptive Technology Resource Centre at                           */
/* Robarts Library, University of Toronto                                               */
/* 130 St. George Street, Toronto, Ontario, Canada M5S 1A5                              */
/* Further contact information is available at http://www.utoronto.ca/atrc/             */
/****************************************************************************************/
/* Programmer:                                                                          */
/* Joel Kronenberg - ATRC                                                               */
/****************************************************************************************/
{GENERATED_COMMENTS}
/****************************************************************************************/
/****************************************************************************************/

/* the database user name                                               */
define('DB_USER',                      '{USER}');

/* the database password                                                */
define('DB_PASSWORD',                  '{PASSWORD}');

/* the database host                                                    */
define('DB_HOST',                      '{HOST}');

/* the database tcp/ip port                                             */
define('DB_PORT',                      '{PORT}');

/* the database name                                                    */
define('DB_NAME',                      '{DBNAME}');

/* The prefix to add to table names to avoid conflicts with existing    */
/* tables. Default: AT_                                                 */
define('TABLE_PREFIX',                 '{TABLE_PREFIX}');

/* your (ATutor system admin) username to let you add new instructors   */
define('ADMIN_USERNAME',               '{ADMIN_USERNAME}');


/* your (ATutor system admin) password to let you add new instructors   */
define('ADMIN_PASSWORD',               '{ADMIN_PASSWORD}');

/* your (admin) email address                                           */
define('ADMIN_EMAIL',                  '{ADMIN_EMAIL}');


/* The name of your ACollab website.                                    */
/* Example: Acme University's ACollab Server                            */
/* Single quotes will have to be escaped with a slash: \'.              */
define('SITE_NAME',						'{SITE_NAME}');

/* Default language to use, if not browser-defined or                   */
/* user-defined. 'en' is always available. Any other language           */
/* specified must already exist in the database.                        */
/* Default language: en                                                 */
define('DEFAULT_LANGUAGE',             'en');

/* Where the upload directory is located. On a Windows                  */
/* machine the path should look like C:\Windows\\temp\. Path             */
/* must end in a slash. The directory must already exist.               */
/* Full path to non-web accessible directory where uploads will reside, */
/* writable by the webserver owner recommend one directory above your   */
/* server's Web root or your home /home/mydir/                          */
/* Back slashes must be escaped if at the end: ex: ..tmp\\');           */
define('UPLOAD_DIR', '{UPLOAD_DIR}');


/* Whether or not members should be allowed to notify the group admin   */
/* of newly added files and revisions.                                  */
/* Default: false                                                       */
define('ALLOW_NOTIFY_GROUP_ADMIN', {NOTIFY_GROUP_ADMIN});

/* DO NOT ALTER THIS LAST LINE                                          */
define('AC_INSTALL', true);

define('EUSA', false);
define('MAIL_USE_SMTP', {MAIL_USE_SMTP});


/* for ATutor-ACollab integration                                       */
/* follow the instructions in the ACollab administration section        */
/* under Integrate ATutor                                               */
//define('AT_PATH',                             ''); 
//define('AT_TABLE_PREFIX',                     '');


?".">";

?>
Return current item: ACollab