exit;
}
- $isHttps = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on")
- ? false
- : true;
- ob_start();
- session_set_cookie_params(0, $_config["session_path"], "", $isHttps);
+$isHttps = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on")
+ ? false
+ : true;
+ob_start();
+session_set_cookie_params(0, $_config["session_path"], "", $isHttps);
session_start();
// Regenerate session id at every page refresh to prevent CSRF
/**
* This function calculate the ATutor installation path
* @access public
- * @param none
+ * @param include_path: The relative path to install/include
* @return string: atutor installation path, for example: /ATutor/
*/
-function get_atutor_installation_path() {
+function get_atutor_installation_path($include_path) {
/* get the base url */
if (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) {
$server_protocol = 'https://';
$server_protocol = 'http://';
}
- $dir_deep = substr_count(AT_INCLUDE_PATH, '..');
+ $dir_deep = substr_count($include_path, '..');
$url_parts = explode('/', $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
$base_href = array_slice($url_parts, 0, count($url_parts) - $dir_deep-2);
$base_href = $server_protocol . implode('/', $base_href).'/';
// Calculate the ATutor installation path and save into database for the usage of
// session associated path @ include/vitals.inc.php
- $sql = "INSERT INTO ".$_POST['step2']['tb_prefix']."config VALUES ('session_path', '".get_atutor_installation_path()."')";
+ $sql = "INSERT INTO ".$_POST['step2']['tb_prefix']."config VALUES ('session_path', '".get_atutor_installation_path(AT_INCLUDE_PATH)."')";
mysql_query($sql ,$db);
unset($_POST['admin_username']);
/* or delete it from the modules table. or maybe disable it instead? */
if (version_compare($_POST['step1']['old_version'], '1.5.1', '>')) {
define('TABLE_PREFIX', $_POST['step1']['tb_prefix']);
- require(AT_INCLUDE_PATH . '../../mods/_core/modules/classes/Module.class.php');
+ require(AT_INCLUDE_PATH . '../mods/_core/modules/classes/Module.class.php');
$moduleFactory = new ModuleFactory(FALSE);
$module_list =& $moduleFactory->getModules(AT_MODULE_STATUS_DISABLED | AT_MODULE_STATUS_ENABLED);
$keys = array_keys($module_list);
if (version_compare($_POST['step1']['new_version'], '2.0.2', '>')) {
// Calculate the ATutor installation path and save into database for the usage of
// session associated path @ include/vitals.inc.php
- $sql = "INSERT INTO ".$_POST['step1']['tb_prefix']."config VALUES ('session_path', '".get_atutor_installation_path()."')";
+ $sql = "INSERT INTO ".$_POST['step1']['tb_prefix']."config VALUES ('session_path', '".get_atutor_installation_path(AT_UPGRADE_INCLUDE_PATH)."')";
mysql_query($sql ,$db);
}
/************************************************************************/
// $Id$
-// Be careful at modifying AT_INCLUDE_PATH constant which is used by
-// get_atutor_installation_path() @ common.inc.php. Must make sure the
-// function doesn't get broken at its modification.
-define('AT_INCLUDE_PATH', 'include/');
+// AT_INCLUDE_PATH is the relative path to atutor root include directory
+// rather than the install include directory because this path is required
+// by Module.class.php used in ustep3.php.
+define('AT_INCLUDE_PATH', '../include/');
if (isset($_POST['new_version'])) {
$new_version = $_POST['new_version'];
$step = 1;
}
-require(AT_INCLUDE_PATH.'common.inc.php');
+// Be careful at modifying AT_UPGRADE_INCLUDE_PATH constant which is used by
+// get_atutor_installation_path() @ common.inc.php in ustep3.php. Must make sure the
+// function doesn't get broken at modifying this constant.
+define('AT_UPGRADE_INCLUDE_PATH', 'include/');
+require(AT_UPGRADE_INCLUDE_PATH.'common.inc.php');
if (($step == 2) && isset($_POST['override']) && ($_POST['override'] == 0)) {
header('Location: index.php');