http://atutor.ca/atutor/mantis/view.php?id=4831
authorcindy li <cli@ocad.ca>
Thu, 25 Aug 2011 17:15:51 +0000 (17:15 -0000)
committercindy li <cli@ocad.ca>
Thu, 25 Aug 2011 17:15:51 +0000 (17:15 -0000)
docs/include/vitals.inc.php
docs/install/include/common.inc.php
docs/install/include/step3.php
docs/install/include/ustep3.php
docs/install/upgrade.php

index 016ef46..8ee4948 100644 (file)
@@ -169,11 +169,11 @@ if (headers_sent()) {
        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
index b323749..3b554d3 100644 (file)
@@ -240,10 +240,10 @@ function print_meta_redirect(){
 /**
  * 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://';
@@ -251,7 +251,7 @@ function get_atutor_installation_path() {
                $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).'/';
index 11ee04b..e0b814c 100644 (file)
@@ -122,7 +122,7 @@ if(isset($_POST['submit']) && ($_POST['action'] == 'process')) {
 
                // 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']);
index 036db89..8e4a230 100644 (file)
@@ -217,7 +217,7 @@ if(isset($_POST['submit']) && ($_POST['action'] == 'process')) {
        /* 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);
@@ -248,7 +248,7 @@ if(isset($_POST['submit']) && ($_POST['action'] == 'process')) {
        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);
        }
 
index bc434a1..6c697a3 100644 (file)
 /************************************************************************/
 // $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'];
@@ -27,7 +27,11 @@ if (!isset($step) || ($step == 0)) {
        $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');