<?php
/****************************************************************************************/
/* ACollab */
/****************************************************************************************/
/* Copyright (c) 2002-2004 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 */
/* Heidi Hazelton - ATRC */
/****************************************************************************************/
// $Id: atutor_integration.php 262 2004-06-09 18:49:04Z joel $
define('AC_INCLUDE_PATH', '../include/');
require(AC_INCLUDE_PATH.'vitals.inc.php');
authenticate(USER_ADMIN);
$_SECTION[0][0] = _AC('administration');
$_SECTION[0][1] = 'admin/';
$_SECTION[1][0] = 'Integrating ATutor';
$_SECTION[1][1] = 'admin/';
if (isset($_POST['url'])) {
if ($_POST['at_path'] && ($_POST['at_path'] != 'http://')) {
/* this code let's us specify something like http://host.com/atutor/index.php and it'll strip off the index.php part */
if (substr($_POST['at_path'], -3) == 'php') {
if (($pos = strrpos($_POST['at_path'], '/')) !== false) {
$at_path = substr($_POST['at_path'], 0, $pos+1);
}
} else {
$at_path = $_POST['at_path'];
if (substr($_POST['at_path'], -1) != '/') {
$at_path .= '/';
}
}
$ac_md5 = md5($_SERVER['SERVER_ADDR'].DB_NAME);
$results = @file($at_path . 'acollab/integrate.php?m=' . $ac_md5);
if (!$results[0]) {
$errors = E_ATUTOR_INTEGRATE;
}
}
}
require(AC_INCLUDE_PATH.'admin/header.inc.php');
if (!isset($_POST['submit']) || isset($errors)) { ?>
<?php if ($errors) { ?>
<?php print_errors($errors); ?>
<br />
<?php } ?>
<p>If you have an ATutor installation that you wish to use along-side ACollab, you must add new information to your configuration file (<code>include/config.inc.php</code>) so that ACollab can find where ATutor is installed and what database tables it is using. Similarly, the ATutor configuration file also needs two additional entries, so it knows about ACollab.</p>
<p><strong>Important:</strong> ATutor and ACollab must have been installed in the same database.</p>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">
<input type="hidden" name="url" value="1" />
<p>First, enter the full web path to your ATutor installation:
<br /><input type="text" name="at_path" value="<?php if ($_POST['at_path']) { echo $_POST['at_path']; } else { echo 'http://'; } ?>" size="55" class="input" /> <input type="submit" name="submit" class="submit" value="<?php echo _AC('submit'); ?>" />
</p>
</form>
<?php } else if (!isset($errors)) { ?>
<p>Add the exact following into the <strong>ACollab configuration file</strong>:<br />
<code>define('AT_PATH', '<?php echo trim($at_path); ?>');<br />
define('AT_TABLE_PREFIX', '<?php echo trim($results[1]); ?>');</code>
</p>
<br />
<p>Add the exact following into the <strong>ATutor configuration file</strong>:<br />
<code>define('AC_PATH', '<?php echo $_base_href; ?>');<br />
define('AC_TABLE_PREFIX', '<?php echo TABLE_PREFIX; ?>');</code>
<?php }
require(AC_INCLUDE_PATH.'admin/footer.inc.php');
?>